Changeset a857389
- Timestamp:
- 02/15/18 17:59:50 (3 years ago)
- Branches:
- cachetimestamps, develop, etsilive, master, rc-4.0.3, rc-4.0.4, ringdecrementfix, ringperformance
- Children:
- 5a70a80
- Parents:
- 3004d6c
- git-author:
- Anthony Coddington <anthony.coddington@…> (02/14/18 16:03:04)
- git-committer:
- Shane Alcock <salcock@…> (02/15/18 17:59:50)
- Location:
- lib
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
lib/erftypes.h
ree6e802 ra857389 162 162 #endif 163 163 164 /** Provenance Metadata Record */ 165 #ifndef ERF_TYPE_META 166 #define ERF_TYPE_META 27 167 #endif 168 /* TODO: Endace has deprecated TYPE_* in favour of ERF_TYPE_*. New types do not have TYPE_* aliases. */ 169 #ifndef TYPE_META 170 #define TYPE_META ERF_TYPE_META 171 #endif 172 164 173 /** Padding record */ 165 174 #ifndef TYPE_PAD … … 167 176 #endif 168 177 178 #ifndef ERF_TYPE_MAX 179 #define ERF_TYPE_MAX TYPE_PAD 180 #endif 169 181 170 182 #endif /* _ERFTYPES_H_ */ -
lib/format_dag25.c
rfd1b63e ra857389 187 187 switch(erfptr->type) { 188 188 case TYPE_ETH: 189 case TYPE_COLOR_ETH: 189 190 case TYPE_DSM_COLOR_ETH: 191 case TYPE_COLOR_HASH_ETH: 190 192 return 2; 191 193 default: return 0; … … 1050 1052 /* No loss counter for DSM coloured records - have to use some 1051 1053 * other API */ 1052 if (erf ptr->type == TYPE_DSM_COLOR_ETH) {1054 if (erf_is_color_type(erfptr->type)) { 1053 1055 /* TODO */ 1054 1056 } else { -
lib/format_erf.c
r7ff881a ra857389 120 120 } erf_index_t; 121 121 122 123 122 /* Ethernet packets have a 2 byte padding before the packet 124 123 * so that the IP header is aligned on a 32 bit boundary. … … 132 131 dag_record_t *erfptr = (dag_record_t *)packet->header; 133 132 switch((erfptr->type & 0x7f)) { 134 case TYPE_ETH: 133 case TYPE_ETH: 134 case TYPE_COLOR_ETH: 135 135 case TYPE_DSM_COLOR_ETH: 136 case TYPE_COLOR_HASH_ETH: 136 137 return 2; 137 138 default: return 0; … … 144 145 } 145 146 } 147 } 148 149 int erf_is_color_type(uint8_t erf_type) 150 { 151 switch(erf_type & 0x7f) { 152 case TYPE_COLOR_HDLC_POS: 153 case TYPE_DSM_COLOR_HDLC_POS: 154 case TYPE_COLOR_ETH: 155 case TYPE_DSM_COLOR_ETH: 156 case TYPE_COLOR_HASH_POS: 157 case TYPE_COLOR_HASH_ETH: 158 return 1; 159 } 160 161 return 0; 146 162 } 147 163 … … 200 216 } 201 217 /* Is this a proper typed packet */ 202 if ((erf->type & 0x7f) > TYPE_AAL2) {218 if ((erf->type & 0x7f) > ERF_TYPE_MAX) { 203 219 return 0; 204 220 } … … 464 480 465 481 /* Check for loss */ 466 if ( (erfptr->type & 0x7f) == TYPE_DSM_COLOR_ETH) {482 if (erf_is_color_type(erfptr->type)) { 467 483 /* No idea how we get this yet */ 468 484 … … 521 537 522 538 /* Unknown/corrupt */ 523 if ((((dag_record_t *)packet->buffer)->type & 0x7f) > = TYPE_RAW_LINK) {539 if ((((dag_record_t *)packet->buffer)->type & 0x7f) > ERF_TYPE_MAX) { 524 540 trace_set_err(libtrace, TRACE_ERR_BAD_PACKET, 525 541 "Corrupt or Unknown ERF type"); … … 758 774 dag_record_t *erfptr = 0; 759 775 erfptr = (dag_record_t *)packet->header; 776 777 if ((erfptr->type & 0x7f) == TYPE_META) 778 return 0; 779 760 780 return ntohs(erfptr->wlen); 761 781 } … … 764 784 dag_record_t *erfptr = 0; 765 785 assert(packet); 766 if(size > trace_get_capture_length(packet)) { 786 erfptr = (dag_record_t *)packet->header; 787 788 if(size > trace_get_capture_length(packet) || (erfptr->type & 0x7f) == TYPE_META) { 767 789 /* Can't make a packet larger */ 768 790 return trace_get_capture_length(packet); 769 791 } 792 770 793 /* Reset cached capture length - otherwise we will both return the 771 794 * wrong value here and subsequent get_capture_length() calls will 772 795 * return the wrong value. */ 773 796 packet->capture_length = -1; 774 erfptr = (dag_record_t *)packet->header;775 797 erfptr->rlen = htons(size + erf_get_framing_length(packet)); 776 798 return trace_get_capture_length(packet); -
lib/format_erf.h
ree6e802 ra857389 53 53 int erf_get_wire_length(const libtrace_packet_t *packet); 54 54 size_t erf_set_capture_length(libtrace_packet_t *packet, size_t size); 55 int erf_is_color_type(uint8_t erf_type); 55 56 56 57 #endif -
lib/libtrace.h.in
rc7e547e ra857389 369 369 TRACE_TYPE_METADATA = 18, /**< WDCAP-style meta-data */ 370 370 TRACE_TYPE_NONDATA = 19, /**< Not a data packet */ 371 TRACE_TYPE_OPENBSD_LOOP = 20 /**< OpenBSD loopback */ 371 TRACE_TYPE_OPENBSD_LOOP = 20, /**< OpenBSD loopback */ 372 TRACE_TYPE_ERF_META = 21 /**< ERF Provenance metadata record */ 372 373 } libtrace_linktype_t; 373 374 -
lib/linktypes.c
r4697684 ra857389 102 102 /* Used for test traces within WAND */ 103 103 case TRACE_TYPE_80211_PRISM: 104 /* Could use DLT_ERF, but would only really make sense with PCAP-NG */ 105 case TRACE_TYPE_ERF_META: 104 106 /* Probably == PPP */ 105 107 /* TODO: We haven't researched these yet */ … … 169 171 case TYPE_ATM: return TRACE_TYPE_ATM; 170 172 case TYPE_AAL5: return TRACE_TYPE_AAL5; 173 case TYPE_COLOR_ETH:return TRACE_TYPE_ETH; 171 174 case TYPE_DSM_COLOR_ETH:return TRACE_TYPE_ETH; 175 case TYPE_COLOR_HASH_ETH:return TRACE_TYPE_ETH; 172 176 case TYPE_IPV4: return TRACE_TYPE_NONE; 173 177 case TYPE_IPV6: return TRACE_TYPE_NONE; 178 case TYPE_META: return TRACE_TYPE_ERF_META; 174 179 } 175 180 return ~0U; … … 183 188 case TRACE_TYPE_ATM: return TYPE_ATM; 184 189 case TRACE_TYPE_AAL5: return TYPE_AAL5; 190 case TRACE_TYPE_ERF_META: return TYPE_META; 185 191 186 192 /* Not technically correct! Could be IPv6 packet -
lib/protocols_l2.c
r99351e3 ra857389 482 482 case TRACE_TYPE_80211_PRISM: 483 483 case TRACE_TYPE_PFLOG: 484 case TRACE_TYPE_ERF_META: 484 485 break; 485 486 case TRACE_TYPE_UNKNOWN: … … 517 518 case TRACE_TYPE_80211_PRISM: 518 519 case TRACE_TYPE_PFLOG: 520 case TRACE_TYPE_ERF_META: 519 521 break; 520 522 case TRACE_TYPE_UNKNOWN: … … 583 585 case TRACE_TYPE_METADATA: 584 586 case TRACE_TYPE_NONDATA: 587 case TRACE_TYPE_ERF_META: 585 588 case TRACE_TYPE_UNKNOWN: 586 589 return NULL; … … 685 688 case TRACE_TYPE_NONDATA: 686 689 case TRACE_TYPE_OPENBSD_LOOP: 690 case TRACE_TYPE_ERF_META: 687 691 case TRACE_TYPE_UNKNOWN: 688 692 return NULL; … … 734 738 case TRACE_TYPE_NONDATA: 735 739 case TRACE_TYPE_OPENBSD_LOOP: 740 case TRACE_TYPE_ERF_META: 736 741 case TRACE_TYPE_UNKNOWN: 737 742 /* No MAC address */ -
lib/protocols_pktmeta.c
ree6e802 ra857389 138 138 case TRACE_TYPE_80211_RADIO: 139 139 case TRACE_TYPE_80211_PRISM: 140 case TRACE_TYPE_ERF_META: 140 141 return pktbuf; 141 142 /* Non metadata packets */ … … 211 212 case TRACE_TYPE_NONDATA: 212 213 case TRACE_TYPE_OPENBSD_LOOP: 214 case TRACE_TYPE_ERF_META: 213 215 case TRACE_TYPE_UNKNOWN: 214 216 /* In this case, the pointer passed in does not point
Note: See TracChangeset
for help on using the changeset viewer.