Diff for /libaitio/example/bpf.c between versions 1.1.2.9 and 1.1.2.10

version 1.1.2.9, 2013/06/26 12:27:40 version 1.1.2.10, 2013/06/26 13:33:55
Line 78  ShowPkt(void *buffer) Line 78  ShowPkt(void *buffer)
   
         assert(buffer);          assert(buffer);
   
 #ifdef __FreeBSD__  
         bpf = (struct bpf_hdr*) (buffer + (flg ? sizeof(struct bpf_zbuf_header) : 0));  
         snprintf(szLine, BUFSIZ, "#Packet length: %d/%d\n>>> Ethernet ...\n", flg ? bzh->bzh_kernel_len : bpf->bh_datalen, bpf->bh_datalen);  
         strlcat(szShow, szLine, USHRT_MAX);  
         eth = (struct ether_header *) (buffer + (flg ? sizeof(struct bpf_zbuf_header) : 0) + bpf->bh_hdrlen);  
 #else  
         snprintf(szLine, BUFSIZ, "#Packet length: %d\n>>> Ethernet ...\n", bpf->bh_datalen);          snprintf(szLine, BUFSIZ, "#Packet length: %d\n>>> Ethernet ...\n", bpf->bh_datalen);
         strlcat(szShow, szLine, USHRT_MAX);          strlcat(szShow, szLine, USHRT_MAX);
         eth = (struct ether_header *) (buffer + bpf->bh_hdrlen);          eth = (struct ether_header *) (buffer + bpf->bh_hdrlen);
 #endif  
   
         switch (ntohs(eth->ether_type)) {          switch (ntohs(eth->ether_type)) {
                 case ETHERTYPE_ARP:                  case ETHERTYPE_ARP:
Line 342  main(int argc, char **argv) Line 335  main(int argc, char **argv)
         if (mode == 'R') {          if (mode == 'R') {
                 pfd.events = POLLIN;                  pfd.events = POLLIN;
                 for (i = 0; i < count; i++) {                  for (i = 0; i < count; i++) {
                        if (poll(&pfd, 1, -1) == -1)                        if ((ret = poll(&pfd, 1, -1)) == -1)
                                 break;                                  break;
   
                         ret = io_etherRecv(dev, buffer, siz, bz);                          ret = io_etherRecv(dev, buffer, siz, bz);
                           if (!ret)
                                   continue;
                         if (ret == -1)                          if (ret == -1)
                                 printf("%d) io_etherRecv(%d) #%d - %s\n", i, ret,                                   printf("%d) io_etherRecv(%d) #%d - %s\n", i, ret, 
                                                 io_GetErrno(), io_GetError());                                                  io_GetErrno(), io_GetError());

Removed from v.1.1.2.9  
changed lines
  Added in v.1.1.2.10


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>