Changeset 1353

Show
Ignore:
Timestamp:
08/05/08 17:06:50 (8 months ago)
Author:
spa1
Message:
  • Made trace_get_mpls_payload_from_ethernet_payload available via the API
  • Added assert to trace_get_vlan_payload_from_ethernet_payload so that its behaviour matches the documentation
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/lib/libtrace.h.in

    r1337 r1353  
    12241224                void *ethernet_payload, uint16_t *type, uint32_t *remaining); 
    12251225 
     1226/** Skips over any MPLS headers, if present. 
     1227 * @param ethernet_payload      A pointer to the payload following an ethernet 
     1228 * header - usually the result of calling trace_get_payload_from_link 
     1229 * @param[in,out] type  The ethernet type, replaced by the ether type of the 
     1230 * following header - 0x0000 if an Ethernet header is deemed to be next 
     1231 * @param[in,out] remaining     Updated with the number of bytes remaining 
     1232 * 
     1233 * @return a pointer to the header beyond the MPLS label, if present. Will 
     1234 * return NULL if there is not enough bytes remaining to skip past the MPLS 
     1235 * label or if the ether type is not MPLS. 
     1236 * 
     1237 * Remaining may be NULL. If remaining is not NULL it must point to the number 
     1238 * of bytes captured past (but not including) the link layer. This function 
     1239 * will decrement it by the length of the topmost MPLS label if present. 
     1240 * 
     1241 * Type must point to the value of the ethernet type. Libtrace will assert 
     1242 * fail if type is NULL. 
     1243 * 
     1244 * NOTE that this function will only remove one MPLS label at a time - the type 
     1245 * will be set to 0x8847 if there is another MPLS label after the one 
     1246 * removed by this function. 
     1247 * 
     1248 */ 
     1249DLLEXPORT void *trace_get_mpls_payload_from_ethernet_payload( 
     1250                void *ethernet_payload, uint16_t *type, uint32_t *remaining); 
     1251 
    12261252/** Gets a pointer to the payload given a pointer to a tcp header 
    12271253 * @param tcp           The tcp Header 
  • trunk/lib/protocols_l2.c

    r1340 r1353  
    3232                uint32_t *remaining) 
    3333{ 
     34        assert(type != NULL); 
    3435        if (*type == 0x8100) { 
    3536                libtrace_8021q_t *vlanhdr = (libtrace_8021q_t *)ethernet; 
     
    5758                uint16_t *type, uint32_t *remaining) 
    5859{ 
     60        assert(type != NULL); 
     61         
    5962        if (*type == 0x8847) { 
    6063                if ((((char*)ethernet)[2]&0x01)==0) {