Changeset 58e9e02 for lib/libtrace.h


Ignore:
Timestamp:
04/28/05 15:22:40 (17 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:
a6badc2
Parents:
48cfaed
Message:

Added trace_get_{source,destination}_port
Added an API version #define
Consitification fixes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/libtrace.h

    r7bb7dda r58e9e02  
    3434#include <sys/types.h>
    3535#include <netinet/in.h>
     36
     37/** API version as 3 byte hex digits */
     38#define LIBTRACE_API_VERSION 0x010010
    3639
    3740#ifdef __cplusplus
     
    239242 * @returns a pointer to the IP header, or NULL if there is not an IP packet
    240243 */
    241 struct libtrace_ip *trace_get_ip(struct libtrace_packet_t *packet);
     244struct libtrace_ip *trace_get_ip(const struct libtrace_packet_t *packet);
    242245
    243246/** get a pointer to the TCP header (if any)
     
    246249 * @returns a pointer to the TCP header, or NULL if there is not a TCP packet
    247250 */
    248 struct libtrace_tcp *trace_get_tcp(struct libtrace_packet_t *packet);
     251struct libtrace_tcp *trace_get_tcp(const struct libtrace_packet_t *packet);
    249252
    250253/** get a pointer to the TCP header (if any) given a pointer to the IP header
     
    265268 * @returns a pointer to the UDP header, or NULL if this is not a UDP packet
    266269 */
    267 struct libtrace_udp *trace_get_udp(struct libtrace_packet_t *packet);
     270struct libtrace_udp *trace_get_udp(const struct libtrace_packet_t *packet);
    268271
    269272/** get a pointer to the UDP header (if any) given a pointer to the IP header
     
    282285 * @returns a pointer to the ICMP header, or NULL if this is not a ICMP packet
    283286 */
    284 struct libtrace_icmp *trace_get_icmp(struct libtrace_packet_t *packet);
     287struct libtrace_icmp *trace_get_icmp(const struct libtrace_packet_t *packet);
    285288
    286289/** get a pointer to the ICMP header (if any) given a pointer to the IP header
     
    479482 */
    480483int trace_bpf_filter(struct libtrace_filter_t *filter,
    481                 struct libtrace_packet_t *packet);
     484                const struct libtrace_packet_t *packet);
    482485
    483486
    484487typedef enum {USE_DEST, USE_SOURCE} serverport_t;
     488
     489/** Get the source port
     490 * @param packet        the packet to read from
     491 * @returns a port in \em HOST byte order, or equivilent to ports for this
     492 * protocol, or 0 if this protocol has no ports.
     493 * @author Perry Lorier
     494 */
     495uint16_t trace_get_source_port(const struct libtrace_packet_t *);
     496
     497/** Get the destination port
     498 * @param packet        the packet to read from
     499 * @returns a port in \em HOST byte order, or equivilent to ports for this
     500 * protocol, or 0 if this protocol has no ports.
     501 * @author Perry Lorier
     502 */
     503uint16_t trace_get_destination_port(const struct libtrace_packet_t *);
    485504
    486505/** hint at the server port in specified protocol
Note: See TracChangeset for help on using the changeset viewer.