Ignore:
Timestamp:
Feb 2, 2008 9:12:13 AM (16 years ago)
Author:
bennylp
Message:

More ticket #465: option to return UDP header in pj_pcap_read_udp(), and better RTP packet handling in pcaputil sample

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjlib-util/src/pjlib-util/pcap.c

    r1767 r1769  
    5555 
    5656#if 0 
     57/* gcc insisted on aligning this struct to 32bit on ARM */ 
    5758typedef struct pj_pcap_eth_hdr  
    5859{ 
    5960    pj_uint8_t  dest[6]; 
    6061    pj_uint8_t  src[6]; 
    61     pj_uint8_t  len[2]; /* problem with struct size if pj_uint16_t */ 
     62    pj_uint8_t  len[2]; 
    6263} pj_pcap_eth_hdr; 
    6364#else 
     
    7879    pj_uint32_t ip_dst; 
    7980} pj_pcap_ip_hdr; 
    80  
    81 typedef struct pj_pcap_udp_hdr 
    82 { 
    83     pj_uint16_t src_port; 
    84     pj_uint16_t dst_port; 
    85     pj_uint16_t len; 
    86     pj_uint16_t csum; 
    87 } pj_pcap_udp_hdr; 
    88  
    89 #pragma pack() 
    9081 
    9182/* Implementation of pcap file */ 
     
    211202/* Read UDP packet */ 
    212203PJ_DEF(pj_status_t) pj_pcap_read_udp(pj_pcap_file *file, 
     204                                     pj_pcap_udp_hdr *udp_hdr, 
    213205                                     pj_uint8_t *udp_payload, 
    214206                                     pj_size_t *udp_payload_size) 
     
    343335            } 
    344336 
     337            /* Copy UDP header if caller wants it */ 
     338            if (udp_hdr) { 
     339                pj_memcpy(udp_hdr, &tmp.udp, sizeof(*udp_hdr)); 
     340            } 
     341 
    345342            /* Calculate payload size */ 
    346343            sz = pj_ntohs(tmp.udp.len) - sizeof(tmp.udp); 
Note: See TracChangeset for help on using the changeset viewer.