Changeset 1332 for trunk/lib/libtrace_int.h
- Timestamp:
- 03/26/08 10:45:36 (5 years ago)
- File:
-
- 1 edited
-
trunk/lib/libtrace_int.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/libtrace_int.h
r1330 r1332 167 167 PRINTF(3,4); 168 168 169 170 /* 171 * 172 * The basic idea of this function is that it will take the data pointed to 173 * by 'buffer' and treat it as a packet of the same format type as the 174 * libtrace_t pointed to by 'trace', including the format framing (e.g. an 175 * erf header for erf and dag formats, a pcap header for pcap formats). 176 * 177 * The libtrace packet pointed to by 'packet' will then have its internal 178 * pointers and values replaced with ones that describe the packet in 'buffer'. 179 * 180 * 'rt_type' is used to set packet->type while 'flags' is relatively 181 * self-explanatory. Definitions of the accepted flags will be provided below. 182 * 183 * The primary use of this function is to allow rt_read_packet to nicely 184 * convert packets from the RT format back to the format that they were 185 * originally captured with, as RT essentially encapsulates the original trace 186 * format. We've decided to not make this function available via the API 187 * because there are a number of issues that can arise if it is not used 188 * very carefully and there are few situations outside of the RT case where 189 * you'd want to do something like this anyway. 190 * 191 * Returns 0 if successful, -1 if something goes horribly wrong 192 */ 193 int trace_prepare_packet(libtrace_t *trace, libtrace_packet_t *packet, 194 void *buffer, libtrace_rt_types_t rt_type, uint32_t flags); 195 196 /* Flags for prepare_packet functions */ 197 /*-------------------------------------*/ 198 /* If set, the memory pointed to by 'buffer' is malloc()'d and libtrace should 199 * undertake ownership of that memory. If not set, the memory is treated as 200 * externally-owned and will not be freed by libtrace when the packet is 201 * destroyed. */ 202 #define TRACE_PREP_OWN_BUFFER 1 203 204 169 205 typedef struct libtrace_sll_header_t { 170 206 uint16_t pkttype; /* packet type */ … … 247 283 */ 248 284 int (*read_packet)(libtrace_t *libtrace, libtrace_packet_t *packet); 285 /** prepares a packet for general libtrace usage 286 * updates internal trace and packet details, such as payload pointers, 287 * loss counters and packet types. 288 * Intended (at this stage) only for internal use, particularly by 289 * RT which needs to decapsulate RT packets */ 290 int (*prepare_packet)(libtrace_t *libtrace, libtrace_packet_t *packet, 291 void *buffer, libtrace_rt_types_t rt_type, 292 uint32_t flags); 249 293 /** finalise a packet 250 294 * cleanup any resources used by a packet that can't be reused for
Note: See TracChangeset
for help on using the changeset viewer.
