Changeset 994
- Timestamp:
- 09/17/06 18:36:13 (7 years ago)
- Location:
- trunk/lib
- Files:
-
- 3 edited
-
libtrace.h.in (modified) (2 diffs)
-
link_wireless.c (modified) (1 diff)
-
protocols.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/libtrace.h.in
r983 r994 495 495 * specified in the it_present bitmask. If bit 31 of it_present is set, then 496 496 * another bitmask follows. 497 * NB:All of the radiotap data fields are in little-endian byte-order.497 * @note All of the radiotap data fields are in little-endian byte-order. 498 498 */ 499 499 typedef struct libtrace_radiotap_t { … … 851 851 DLLEXPORT void *trace_get_payload_from_ip(libtrace_ip_t *ip, uint8_t *proto, 852 852 uint32_t *remaining); 853 854 855 /** Gets a pointer to the payload given a pointer to the Radiotap header856 * @param link a pointer to the Radiotap header857 * @param[out] type An output variable of the ethernet type858 * @param[in,out] remaining Updated with the number of bytes remaining859 *860 * @return a pointer to the 802.11 header, or NULL if header isn't861 * present.862 *863 * Remaining may be NULL. If Remaining is not NULL it must point to the number864 * of bytes captured of the linklayer and beyond. It will be updated after865 * this function to the number of bytes remaining after the Radiotap header has been866 * removed.867 *868 * type may be NULL if not needed.869 */870 DLLEXPORT void *trace_get_payload_from_radiotap(void *link,871 uint16_t *type, uint32_t *remaining);872 873 874 /** Gets a pointer to the payload given a pointer to the Prism monitoring header875 * @param link a pointer to the Prism monitoring header876 * @param[out] type An output variable of the ethernet type877 * @param[in,out] remaining Updated with the number of bytes remaining878 *879 * @return a pointer to the 802.11 header, or NULL if header isn't880 * present.881 *882 * Remaining may be NULL. If Remaining is not NULL it must point to the number883 * of bytes captured of the linklayer and beyond. It will be updated after884 * this function to the number of bytes remaining after the Radiotap header has been885 * removed.886 *887 * type may be NULL if not needed.888 */889 DLLEXPORT void *trace_get_payload_from_prism(void *link,890 uint16_t *type, uint32_t *remaining);891 892 853 893 854 /** Gets a pointer to the payload given a pointer to the link header -
trunk/lib/link_wireless.c
r985 r994 48 48 * @note Radiotap fields are always little-endian 49 49 */ 50 DLLEXPORTvoid *trace_get_radiotap_field(void *link, libtrace_radiotap_field_t field)50 static void *trace_get_radiotap_field(void *link, libtrace_radiotap_field_t field) 51 51 { 52 52 struct libtrace_radiotap_t *rtap = (struct libtrace_radiotap_t *)link; -
trunk/lib/protocols.c
r982 r994 190 190 /* Returns the 'payload' of the prism header, which is the 802.11 frame */ 191 191 static void *trace_get_payload_from_prism (void *link, 192 uint16_t *type, uint32_t *remaining)193 { 194 if (remaining) {195 if (*remaining<144)196 return NULL;197 *remaining-=144;198 }199 200 if (type) *type = 0;201 202 return (void *) ((char*)link+144);192 uint16_t *type, uint32_t *remaining) 193 { 194 if (remaining) { 195 if (*remaining<144) 196 return NULL; 197 *remaining-=144; 198 } 199 200 if (type) *type = 0; 201 202 return (void *) ((char*)link+144); 203 203 } 204 204 205 205 /* Returns the 'payload' of the radiotap header, which is the 802.11 frame */ 206 206 static void *trace_get_payload_from_radiotap (void *link, 207 uint16_t *type, uint32_t *remaining) 208 { 209 struct libtrace_radiotap_t *rtap = (struct libtrace_radiotap_t*)link; 210 if (remaining) { 211 if (*remaining<rtap->it_len) 212 return NULL; 213 *remaining-=rtap->it_len; 207 uint16_t *type, uint32_t *remaining) 208 { 209 struct libtrace_radiotap_t *rtap = (struct libtrace_radiotap_t*)link; 210 uint16_t rtaplen = bswap_le_to_host16(rtap->it_len); 211 if (remaining) { 212 if (*remaining < rtaplen) 213 return NULL; 214 *remaining -= rtaplen; 214 215 } 215 216 216 217 if (type) *type = 0; 217 218 return (void*) ((char*)link + rtap ->it_len);219 } 220 218 219 return (void*) ((char*)link + rtaplen); 220 } 221 221 222 void *trace_get_payload_from_link(void *link, libtrace_linktype_t linktype, 222 223 uint16_t *type, uint32_t *remaining) 223 224 { 224 void *l;225 225 void *l = NULL; 226 226 227 switch(linktype) { 227 228 case TRACE_TYPE_80211_PRISM: 228 l = trace_get_payload_from_prism(link,type,remaining);229 l ? trace_get_payload_from_80211(l,type,remaining) : NULL;230 case TRACE_TYPE_80211_RADIO:231 l = trace_get_payload_from_radiotap(link,type,remaining);232 l ? trace_get_payload_from_80211(l,type,remaining) : NULL;229 l = trace_get_payload_from_prism(link,type,remaining); 230 return(l ? trace_get_payload_from_80211(l,type,remaining) : NULL); 231 case TRACE_TYPE_80211_RADIO: 232 l = trace_get_payload_from_radiotap(link,type,remaining); 233 return(l ? trace_get_payload_from_80211(l,type,remaining) : NULL); 233 234 case TRACE_TYPE_80211: 234 235 return trace_get_payload_from_80211(link,type,remaining);
Note: See TracChangeset
for help on using the changeset viewer.
