Changeset c37ab9f


Ignore:
Timestamp:
05/02/06 00:58:09 (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:
998bee5
Parents:
ca2887e
Message:

More documentation, add some enum's documenting the convention for directions

Location:
lib
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • lib/libtrace.h

    re093e5c rc37ab9f  
    194194} libtrace_dlt_t ;
    195195
     196/** Link layer types
     197 * This enumates the various different link types that libtrace understands
     198 */
     199typedef enum {
     200       TRACE_TYPE_HDLC_POS = 1,
     201       TRACE_TYPE_ETH,                  /**< 802.3 style Ethernet */
     202       TRACE_TYPE_ATM,
     203       TRACE_TYPE_AAL5,
     204       TRACE_TYPE_80211,                /**< 802.11 frames */
     205       TRACE_TYPE_NONE,                 /**< Raw IP frames */
     206       TRACE_TYPE_LINUX_SLL,            /**< Linux "null" framing */
     207       TRACE_TYPE_PFLOG,                /**< FreeBSD's PFlug */
     208       TRACE_TYPE_POS,
     209       TRACE_TYPE_80211_PRISM = 12
     210     } libtrace_linktype_t;
     211
     212/** Trace directions
     213 * Note that these are the directions used by convention, more directions
     214 * are possible, not just these 3, and that they may not conform to this
     215 * convention.
     216 */
     217typedef enum {
     218        TRACE_DIR_OUTGOING = 0,         /**< Packets originating "outside" */
     219        TRACE_DIR_INCOMING = 1,         /**< Packets originating "inside" */
     220        TRACE_DIR_OTHER    = 2          /**< Packets with an unknown direction, or one that's unknown */
     221} libtrace_direction_t;
    196222
    197223/** @name Protocol structures
     
    10541080
    10551081
    1056 /** Link layer types
    1057  * This enumates the various different link types that libtrace understands
    1058  */
    1059 typedef enum {
    1060        TRACE_TYPE_HDLC_POS = 1,
    1061        TRACE_TYPE_ETH,                  /**< 802.3 style Ethernet */
    1062        TRACE_TYPE_ATM,
    1063        TRACE_TYPE_AAL5,
    1064        TRACE_TYPE_80211,                /**< 802.11 frames */
    1065        TRACE_TYPE_NONE,
    1066        TRACE_TYPE_LINUX_SLL,            /**< Linux "null" framing */
    1067        TRACE_TYPE_PFLOG,                /**< FreeBSD's PFlug */
    1068        TRACE_TYPE_POS,
    1069        TRACE_TYPE_80211_PRISM = 12
    1070      } libtrace_linktype_t;
    1071 
    10721082/** Get the type of the link layer
    10731083 * @param packet        the packet opaque pointer
     
    10811091/** Set the direction flag, if it has one
    10821092 * @param packet        the packet opaque pointer
    1083  * @param direction     the new direction (0,1,2,3)
    1084  * @return a signed value containing the direction flag, or -1 if this is not supported
    1085  * @author Daniel Lawson
    1086  */
    1087 DLLEXPORT int8_t trace_set_direction(libtrace_packet_t *packet, int8_t direction);
     1093 * @param direction     the new direction
     1094 * @returns -1 on error, or the direction that was set.
     1095 */
     1096DLLEXPORT libtrace_direction_t trace_set_direction(libtrace_packet_t *packet, libtrace_direction_t direction);
    10881097
    10891098/** Get the direction flag, if it has one
    10901099 * @param packet        the packet opaque pointer
    1091  * @return a signed value containing the direction flag, or -1 if this is not supported
     1100 * @return a value containing the direction flag, or -1 if this is not supported
    10921101 * The direction is defined as 0 for packets originating locally (ie, outbound)
    10931102 * and 1 for packets originating remotely (ie, inbound).
     
    10971106 */
    10981107DLLEXPORT SIMPLE_FUNCTION
    1099 int8_t trace_get_direction(const libtrace_packet_t *packet);
     1108libtrace_direction_t trace_get_direction(const libtrace_packet_t *packet);
    11001109
    11011110/** @name BPF
  • lib/trace.c

    re6d963c rc37ab9f  
    10311031 * @param direction the new direction (0,1,2,3)
    10321032 * @returns a signed value containing the direction flag, or -1 if this is not supported
    1033  * @author Daniel Lawson
    1034  */
    1035 DLLEXPORT int8_t trace_set_direction(libtrace_packet_t *packet, int8_t direction) {
     1033 */
     1034DLLEXPORT libtrace_direction_t trace_set_direction(libtrace_packet_t *packet,
     1035                libtrace_direction_t direction)
     1036{
    10361037        assert(packet);
    10371038        assert(packet->size>0 && packet->size<65536);
     
    10511052 * @author Daniel Lawson
    10521053 */
    1053 DLLEXPORT int8_t trace_get_direction(const libtrace_packet_t *packet) {
     1054DLLEXPORT libtrace_direction_t trace_get_direction(const libtrace_packet_t *packet)
     1055{
    10541056        assert(packet);
    10551057        assert(packet->size>0 && packet->size<65536);
Note: See TracChangeset for help on using the changeset viewer.