Changeset 2e223eca


Ignore:
Timestamp:
02/24/06 14:31:30 (15 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:
0d768c8
Parents:
c6a6c3a
Message:

Documentation, and cleanup use of 64bit constants

Location:
lib
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • lib/libtrace.h

    r0ea3526 r2e223eca  
    8686typedef struct libtrace_filter_t libtrace_filter_t;
    8787
    88 /* the letters p and e are magic numbers used to detect if the packet
     88/** if a packet has memory allocated
     89 * If the packet has allocated it's own memory it's buffer_control should
     90 * be TRACE_CTRL_PACKET, when the packet is destroyed it's memory will be
     91 * free()'d.  If it's doing zerocopy out of memory owned by something else
     92 * it should be TRACE_CTRL_EXTERNAL.
     93 * @note the letters p and e are magic numbers used to detect if the packet
    8994 * wasn't created properly
    9095 */
    91 typedef enum {TRACE_CTRL_PACKET='p', TRACE_CTRL_EXTERNAL='e' } buf_control_t;
     96typedef enum {
     97        TRACE_CTRL_PACKET='p',
     98        TRACE_CTRL_EXTERNAL='e'
     99} buf_control_t;
    92100/** Structure holding information about a packet */
    93101#define LIBTRACE_PACKET_BUFSIZE 65536
     
    247255typedef struct libtrace_ether
    248256{
    249   u_int8_t ether_dhost[6];      /* destination ether addr */
    250   u_int8_t ether_shost[6];      /* source ether addr */
    251   u_int16_t ether_type;         /* packet type ID field (next-header) */
     257  u_int8_t ether_dhost[6];      /**< destination ether addr */
     258  u_int8_t ether_shost[6];      /**< source ether addr */
     259  u_int16_t ether_type;         /**< packet type ID field (next-header) */
    252260} __attribute__ ((packed)) libtrace_ether_t;
    253261
     
    255263typedef struct libtrace_8021q
    256264{
    257   u_int8_t  ether_dhost[6];      /* destination eth addr */
    258   u_int8_t  ether_shost[6];      /* source ether addr    */
    259   u_int16_t ether_type;          /* packet type ID field , 0x8100 for VLAN */
    260   unsigned int vlan_pri:3;       /* vlan user priority */
    261   unsigned int vlan_cfi:1;       /* vlan format indicator, 0 for ethernet, 1 for token ring */
    262   unsigned int vlan_id:12;       /* vlan id */
    263   u_int16_t vlan_ether_type;     /* vlan sub-packet type ID field (next-header)*/
     265  u_int8_t  ether_dhost[6];      /**< destination eth addr */
     266  u_int8_t  ether_shost[6];      /**< source ether addr    */
     267  u_int16_t ether_type;          /**< packet type ID field , 0x8100 for VLAN */
     268  unsigned int vlan_pri:3;       /**< vlan user priority */
     269  unsigned int vlan_cfi:1;       /**< vlan format indicator,
     270                                   * 0 for ethernet, 1 for token ring */
     271  unsigned int vlan_id:12;       /**< vlan id */
     272  u_int16_t vlan_ether_type;     /**< vlan sub-packet type ID field
     273                                   * (next-header)*/
    264274} __attribute__ ((packed)) libtrace_8021q_t;
    265275
     
    326336 *  - wag:/path/to/wag/socket
    327337 *
    328  *  If an error occured when attempting to open the trace file, NULL is returned
    329  *  and trace_errno is set. Use trace_perror() to get more information. 
    330  *  The trace is created in the configuration state, you must call trace_start
    331  *  to start the capture.
    332  */
    333 struct libtrace_t *trace_create(const char *uri);
     338 *  If an error occured when attempting to open the trace file, an error
     339 *  trace is returned and trace_get_error should be called to find out
     340 *  if an error occured, and what that error was.  The trace is created in the
     341 *  configuration state, you must call trace_start to start the capture.
     342 */
     343libtrace_t *trace_create(const char *uri);
    334344
    335345/** Creates a "dummy" trace file that has only the format type set.
     
    337347 * @return opaque pointer to a (sparsely initialised) libtrace_t
    338348 *
    339  * IMPORTANT: Do not attempt to call trace_read_packet or other such functions with
    340  * the dummy trace. Its intended purpose is to act as a packet->trace for libtrace_packet_t's
    341  * that are not associated with a libtrace_t structure.
    342  */
    343 struct libtrace_t *trace_create_dead(const char *uri);
     349 * IMPORTANT: Do not attempt to call trace_read_packet or other such functions
     350 * with the dummy trace. Its intended purpose is to act as a packet->trace for
     351 * libtrace_packet_t's that are not associated with a libtrace_t structure.
     352 */
     353libtrace_t *trace_create_dead(const char *uri);
    344354
    345355/** Creates a trace output file from a URI.
     
    927937const char *trace_parse_uri(const char *uri, char **format);
    928938
    929 /* Base format type definitions */
     939/** RT protocol base format identifiers
     940 * This is used to say what kind of packet is being sent over the rt protocol
     941 */
    930942enum base_format_t {
    931943        TRACE_FORMAT_ERF          =1,
  • lib/libtrace_int.h

    r0ea3526 r2e223eca  
    9494        struct libtrace_format_t *format; /**< format driver pointer */
    9595        struct libtrace_format_data_t *format_data; /**<format data pointer */
    96         bool started;
    97         libtrace_err_t err;
    98         struct libtrace_event_t event;
    99         char *uridata;
    100         struct tracefifo_t *fifo;   
     96        bool started;                   /**< if this trace has started */
     97        libtrace_err_t err;             /**< error information */
     98        struct libtrace_event_t event;  /**< the next event */
     99        char *uridata;                  /**< the uri of this trace */
     100        struct tracefifo_t *fifo;       /**< fifo used in this trace */
    101101        struct libtrace_filter_t *filter; /**< used by libtrace if the module
    102102                                            * doesn't support filters natively
     
    107107};
    108108
     109/** Information about output traces
     110 * @internal
     111 */
    109112struct libtrace_out_t {
    110         struct libtrace_format_t *format;
    111         struct libtrace_format_data_out_t *format_data;
     113        struct libtrace_format_t *format;       /**< format driver */
     114        struct libtrace_format_data_out_t *format_data; /**< format data */
    112115        bool started;
    113         libtrace_err_t err;
    114         char *uridata;
    115         struct tracefifo_t *fifo;
     116        libtrace_err_t err;             /**< Associated error */
     117        char *uridata;                  /**< URI associated with this trace */
    116118};
    117119
  • lib/trace.c

    r0ea3526 r2e223eca  
    386386
    387387
    388         libtrace->fifo = create_tracefifo(1048576);
    389         assert( libtrace->fifo);
    390388        free(scan);
    391389        libtrace->started=false;
     
    511509        libtrace->format->fin_output(libtrace);
    512510        free(libtrace->uridata);
    513         destroy_tracefifo(libtrace->fifo);
    514511        free(libtrace);
    515512}
     
    10741071#error "What on earth are you running this on?"
    10751072#endif
    1076                 ts = (1000000 * (ts & 0xffffffffULL));
    1077                 ts += (ts & 0x80000000ULL) << 1;
    1078                 tv.tv_usec = ts >> 32;
     1073                tv.tv_usec = ((ts&0xFFFFFFFF)*1000000)>>32;
    10791074                if (tv.tv_usec >= 1000000) {
    10801075                        tv.tv_usec -= 1000000;
Note: See TracChangeset for help on using the changeset viewer.