[Asterisk-code-review] res_pjsip_logger: Expand functionality to improve logging. (asterisk[13])

Joshua Colp asteriskteam at digium.com
Mon May 18 10:27:11 CDT 2020


Joshua Colp has posted comments on this change. ( https://gerrit.asterisk.org/c/asterisk/+/14410 )

Change subject: res_pjsip_logger: Expand functionality to improve logging.
......................................................................


Patch Set 2:

(1 comment)

https://gerrit.asterisk.org/c/asterisk/+/14410/2/res/res_pjsip_logger.c 
File res/res_pjsip_logger.c:

https://gerrit.asterisk.org/c/asterisk/+/14410/2/res/res_pjsip_logger.c@42 
PS2, Line 42: struct pcap_header {
            : 	uint32_t magic_number; 	/*! \brief PCAP file format magic number */
            : 	uint16_t version_major;	/*! \brief Major version number of the file format */
            : 	uint16_t version_minor;	/*! \brief Minor version number of the file format */
            : 	int32_t thiszone;	/*! \brief GMT to local correction */
            : 	uint32_t sigfigs;	/*! \brief Accuracy of timestamps */
            : 	uint32_t snaplen;	/*! \brief The maximum size that can be recorded in the file */
            : 	uint32_t network;	/*! \brief Type of packets held within the file */
            : };
            : 
            : /*! \brief PCAP Packet Record Header */
            : struct pcap_record_header {
            : 	uint32_t ts_sec;	/*! \brief When the record was created */
            : 	uint32_t ts_usec;	/*! \brief When the record was created */
            : 	uint32_t incl_len;	/*! \brief Length of packet as saved in the file */
            : 	uint32_t orig_len;	/*! \brief Length of packet as sent over network */
            : };
            : 
            : /*! \brief PCAP Ethernet Header */
            : struct pcap_ethernet_header {
            : 	uint8_t dst[6];	/*! \brief Destination MAC address */
            : 	uint8_t src[6];	/*! \brief Source MAD address */
            : 	uint16_t type;	/*! \brief The type of packet contained within */
            : } __attribute__((__packed__));
            : 
            : /*! \brief PCAP IPv4 Header */
            : struct pcap_ipv4_header {
            : 	uint8_t ver_ihl;	/*! \brief IP header version and other bits */
            : 	uint8_t ip_tos;		/*! \brief Type of service details */
            : 	uint16_t ip_len;	/*! \brief Total length of the packet (including IPv4 header) */
            : 	uint16_t ip_id;		/*! \brief Identification value */
            : 	uint16_t ip_off;	/*! \brief Fragment offset */
            : 	uint8_t ip_ttl;		/*! \brief Time to live for the packet */
            : 	uint8_t ip_protocol;	/*! \brief Protocol of the data held within the packet (always UDP) */
            : 	uint16_t ip_sum;	/*! \brief Checksum (not calculated for our purposes */
            : 	uint32_t ip_src;	/*! \brief Source IP address */
            : 	uint32_t ip_dst;	/*! \brief Destination IP address */
            : };
            : 
            : /*! \brief PCAP IPv6 Header */
            : struct pcap_ipv6_header {
            :    union {
            :       struct ip6_hdrctl {
            :          uint32_t ip6_un1_flow; /*! \brief Version, traffic class, flow label */
            :          uint16_t ip6_un1_plen; /*! \brief Length of the packet (not including IPv6 header) */
            :          uint8_t ip6_un1_nxt; 	/*! \brief Next header field */
            :          uint8_t ip6_un1_hlim;	/*! \brief Hop Limit */
            :       } ip6_un1;
            :       uint8_t ip6_un2_vfc;	/*! \brief Version, traffic class */
            :    } ip6_ctlun;
            :    struct in6_addr ip6_src; /*! \brief Source IP address */
            :    struct in6_addr ip6_dst; /*! \brief Destination IP address */
            : };
            : 
            : /*! \brief PCAP UDP Header */
            : struct pcap_udp_header {
            : 	uint16_t src;		/*! \brief Source IP port */
            : 	uint16_t dst;		/*! \brief Destination IP port */
            : 	uint16_t length;	/*! \brief Length of the UDP header plus UDP packet */
            : 	uint16_t checksum;	/*! \brief Packet checksum, left uncalculated for our purposes */
            : };
            : 
> Aren't these defined in various system includes like pcap.h, netinet/ip6. […]
I was hesitant to go down that road in case they aren't available on different platforms, but can switch.



-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/14410
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Change-Id: If5859161a72b0d7dd2d1f92d45bed88e0cd07d0e
Gerrit-Change-Number: 14410
Gerrit-PatchSet: 2
Gerrit-Owner: Joshua Colp <jcolp at sangoma.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Comment-Date: Mon, 18 May 2020 15:27:11 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: George Joseph <gjoseph at digium.com>
Gerrit-MessageType: comment
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20200518/3a1c9b6e/attachment.html>


More information about the asterisk-code-review mailing list