⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 loopback.c

📁 mgcp协议源代码。支持多种编码:g711
💻 C
字号:
/****************************************************************************  ** ** File: loopback.c ** ** Author: Mike Borella ** ** Comments: Dump loopback packets ** *****************************************************************************/#include <stdio.h>#include <unistd.h>#include <sys/socket.h>#include <pcap.h>#include "config.h"#include "loopback.h"#include "ip.h"extern struct arg_t *my_args;#define INET_FAMILY 524288u_char *packet_ptr;u_char *packet_end;/*----------------------------------------------------------------------------**** dump_loopback()**** Process packets from DLT_NULL device****----------------------------------------------------------------------------*/void dump_loopback(u_char *user, const struct pcap_pkthdr *h, u_char *p){  int length;   int caplen;  u_int32_t family;  /*   * Get total packet length and length of the captured section   */  length = h->len;  caplen = h->caplen;  /*   * Dump header announcement   */  printf("=================================================================\n");  printf("                        Loopback Header(%u.%06u)\n",	 (u_int32_t) h->ts.tv_sec, (u_int32_t) h->ts.tv_usec);  printf("-----------------------------------------------------------------\n");  /*   * Check for truncated header    */  if (caplen < LOOPBACK_HEADER_LEN)     {      printf("Loopback header too short! (%d bytes)\n", length);      return;    }  /*   * Dump header field   */  printf("Address family          ");  memcpy((void *) &family, (void *) p, LOOPBACK_HEADER_LEN);  if (family == INET_FAMILY)    printf("Internet\n");  else    {      printf("Unknown (%d)\n", family);      return;    }  /*   * Some printers want to get back at the link level addresses,   * and/or check that they're not walking off the end of the packet.   * Rather than pass them all the way down, we set these globals.   */     packet_ptr = p;  packet_end = p + caplen;  /*   * Check for IEEE 802 (LLC) encapsulation.  If not, assume regular ethernet   */  p += LOOPBACK_HEADER_LEN;  dump_ip(p, length);  if(my_args->f)    {      /* flush stdout */      fflush(stdout);    }    return;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -