Changeset e7bc155 for lib


Ignore:
Timestamp:
04/08/06 17:02:24 (16 years ago)
Author:
Perry Lorier <perry@…>
Branches:
4.0.1-hotfixes, cachetimestamps, develop, dpdk-ndag, etsilive, getfragoff, help, libtrace4, master, ndag_format, pfring, rc-4.0.1, rc-4.0.2, rc-4.0.3, rc-4.0.4, ringdecrementfix, ringperformance, ringtimestampfixes
Children:
3be9a2b
Parents:
ce0d2cc
Message:

Merge more of mattb's portability fixes.

Location:
lib
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • lib/libtrace.h

    rce0d2cc re7bc155  
    217217
    218218/** IPv6 header structure */
    219 typedef PACKED struct libtrace_ip6
     219typedef struct libtrace_ip6
    220220{
    221221    uint32_t flow;
     
    225225    struct in6_addr ip_src;             /**< source address */
    226226    struct in6_addr ip_dst;             /**< dest address */
    227 } libtrace_ip6_t;
     227} PACKED libtrace_ip6_t;
    228228
    229229/** Structure for dealing with TCP packets */
    230230typedef struct libtrace_tcp
    231231  {
    232     u_int16_t source;           /**< Source Port */
    233     u_int16_t dest;             /**< Destination port */
    234     u_int32_t seq;              /**< Sequence number */
    235     u_int32_t ack_seq;          /**< Acknowledgement Number */
     232    uint16_t source;            /**< Source Port */
     233    uint16_t dest;              /**< Destination port */
     234    uint32_t seq;               /**< Sequence number */
     235    uint32_t ack_seq;           /**< Acknowledgement Number */
    236236#  if BYTE_ORDER == LITTLE_ENDIAN
    237237    unsigned int res1:4;        /**< Reserved bits */
     
    257257#   error "Adjust your <bits/endian.h> defines"
    258258#  endif
    259     u_int16_t window;           /**< Window Size */
    260     u_int16_t check;            /**< Checksum */
    261     u_int16_t urg_ptr;          /**< Urgent Pointer */
    262 } __attribute__ ((packed)) libtrace_tcp_t;
     259    uint16_t window;            /**< Window Size */
     260    uint16_t check;             /**< Checksum */
     261    uint16_t urg_ptr;           /**< Urgent Pointer */
     262} PACKED libtrace_tcp_t;
    263263
    264264/** UDP Header for dealing with UDP packets */
    265265typedef struct libtrace_udp {
    266   u_int16_t     source;         /**< Source port */
    267   u_int16_t     dest;           /**< Destination port */
    268   u_int16_t     len;            /**< Length */
    269   u_int16_t     check;          /**< Checksum */
    270 } __attribute__ ((packed)) libtrace_udp_t;
     266  uint16_t      source;         /**< Source port */
     267  uint16_t      dest;           /**< Destination port */
     268  uint16_t      len;            /**< Length */
     269  uint16_t      check;          /**< Checksum */
     270} PACKED libtrace_udp_t;
    271271
    272272/** ICMP Header for dealing with icmp packets */
    273273typedef struct libtrace_icmp
    274274{
    275   u_int8_t type;                /**< message type */
    276   u_int8_t code;                /**< type sub-code */
    277   u_int16_t checksum;           /**< checksum */
     275  uint8_t type;         /**< message type */
     276  uint8_t code;         /**< type sub-code */
     277  uint16_t checksum;            /**< checksum */
    278278  union
    279279  {
    280280    struct
    281281    {
    282       u_int16_t id;
    283       u_int16_t sequence;
     282      uint16_t  id;
     283      uint16_t  sequence;
    284284    } echo;                     /**< echo datagram */
    285     u_int32_t   gateway;        /**< gateway address */
     285    uint32_t    gateway;        /**< gateway address */
    286286    struct
    287287    {
    288       u_int16_t unused;
    289       u_int16_t mtu;
     288      uint16_t  unused;
     289      uint16_t  mtu;
    290290    } frag;                     /**< path mtu discovery */
    291291  } un;                         /**< Union for payloads of various icmp codes */
    292 } __attribute__ ((packed)) libtrace_icmp_t;
     292} PACKED libtrace_icmp_t;
    293293
    294294/** LLC/SNAP header */
    295295typedef struct libtrace_llcsnap
    296296{
    297   u_int8_t dsap;
    298   u_int8_t ssap;
    299   u_int8_t control;
    300   u_int32_t oui:24;
    301   u_int16_t type;
    302 } __attribute__ ((packed)) libtrace_llcsnap_t;
     297  uint8_t dsap;
     298  uint8_t ssap;
     299  uint8_t control;
     300  uint32_t oui:24;
     301  uint16_t type;
     302} PACKED libtrace_llcsnap_t;
    303303
    304304/** 802.3 frame */
    305305typedef struct libtrace_ether
    306306{
    307   u_int8_t ether_dhost[6];      /**< destination ether addr */
    308   u_int8_t ether_shost[6];      /**< source ether addr */
    309   u_int16_t ether_type;         /**< packet type ID field (next-header) */
    310 } __attribute__ ((packed)) libtrace_ether_t;
     307  uint8_t ether_dhost[6];       /**< destination ether addr */
     308  uint8_t ether_shost[6];       /**< source ether addr */
     309  uint16_t ether_type;          /**< packet type ID field (next-header) */
     310} PACKED libtrace_ether_t;
    311311
    312312/** 802.1Q frame */
    313313typedef struct libtrace_8021q
    314314{
    315   u_int8_t  ether_dhost[6];      /**< destination eth addr */
    316   u_int8_t  ether_shost[6];      /**< source ether addr    */
    317   u_int16_t ether_type;          /**< packet type ID field , 0x8100 for VLAN */
     315  uint8_t  ether_dhost[6];      /**< destination eth addr */
     316  uint8_t  ether_shost[6];      /**< source ether addr    */
     317  uint16_t ether_type;          /**< packet type ID field , 0x8100 for VLAN */
    318318  unsigned int vlan_pri:3;       /**< vlan user priority */
    319319  unsigned int vlan_cfi:1;       /**< vlan format indicator,
    320320                                   * 0 for ethernet, 1 for token ring */
    321321  unsigned int vlan_id:12;       /**< vlan id */
    322   u_int16_t vlan_ether_type;     /**< vlan sub-packet type ID field
     322  uint16_t vlan_ether_type;      /**< vlan sub-packet type ID field
    323323                                   * (next-header)*/
    324 } __attribute__ ((packed)) libtrace_8021q_t;
     324} PACKED libtrace_8021q_t;
    325325
    326326/** ATM cell */
     
    328328{
    329329  unsigned int gfc:4;
    330   u_int8_t vpi;
    331   u_int16_t vci;
     330  uint8_t vpi;
     331  uint16_t vci;
    332332  unsigned int pt:3;
    333333  unsigned int clp:1;
    334334  unsigned int hec;
    335 } __attribute__ ((packed)) libtrace_atm_cell_t;
     335} PACKED libtrace_atm_cell_t;
    336336
    337337/** POS header */
    338338typedef struct libtrace_pos
    339339{
    340  u_int16_t header;
    341  u_int16_t ether_type;          /**< ether type */
    342 } __attribute__ ((packed)) libtrace_pos_t;
     340 uint16_t header;
     341 uint16_t ether_type;           /**< ether type */
     342} PACKED libtrace_pos_t;
    343343
    344344/** 802.11 header */
     
    361361        uint16_t     SeqCtl;
    362362        uint8_t      mac4[6];
    363 } libtrace_80211_t;
     363} PACKED libtrace_80211_t;
     364
     365#ifdef WIN32
     366#pragma pack(pop)
     367#endif
    364368
    365369
     
    11961200enum base_format_t trace_get_format(struct libtrace_packet_t *packet);
    11971201
    1198 
    11991202#ifdef __cplusplus
    12001203} /* extern "C" */
  • lib/malloc.c

    rdb06c9d re7bc155  
    55
    66#include <sys/types.h>
     7#include <stdlib.h>
    78
    89void *malloc ();
Note: See TracChangeset for help on using the changeset viewer.