- Timestamp:
- 11/01/05 13:34:32 (17 years ago)
- 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:
- 77509e9
- Parents:
- d18312c
- Location:
- lib
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
lib/format_erf.c
r78f750e r8013711 486 486 memcpy(packet->buffer, erfptr, size); 487 487 488 packet->status = 0; 488 packet->status.type = RT_DATA; 489 packet->status.message = 0; 489 490 packet->size = size; 490 491 DAG.offset += size; … … 526 527 return -1; 527 528 } 528 packet->status = 0; 529 packet->status.type = RT_DATA; 530 packet->status.message = 0; 529 531 packet->size = rlen; 530 532 return rlen; … … 565 567 return -1; 566 568 } 567 packet->status = 0; 569 packet->status.type = RT_DATA; 570 packet->status.message = 0; 568 571 packet->size = rlen; 569 572 return rlen; … … 619 622 // Read status byte 620 623 if (tracefifo_out_read(libtrace->fifo, 621 &packet->status, sizeof( uint32_t)) == 0) {624 &packet->status, sizeof(rt_status_t)) == 0) { 622 625 read_required = 1; 623 626 continue; 624 627 } 625 tracefifo_out_update(libtrace->fifo,sizeof( uint32_t));628 tracefifo_out_update(libtrace->fifo,sizeof(rt_status_t)); 626 629 627 630 // read in the ERF header … … 633 636 } 634 637 635 if (packet->status >= S_MESSAGE_ONLY) {638 if (packet->status.type == RT_MSG) { 636 639 // Need to skip this packet as it is a message packet 637 640 tracefifo_out_update(libtrace->fifo, dag_record_size); 638 tracefifo_ack_update(libtrace->fifo, dag_record_size + sizeof( uint32_t));641 tracefifo_ack_update(libtrace->fifo, dag_record_size + sizeof(rt_status_t)); 639 642 continue; 640 643 } … … 653 656 tracefifo_out_update(libtrace->fifo,size); 654 657 655 tracefifo_ack_update(libtrace->fifo,size + sizeof( uint32_t));658 tracefifo_ack_update(libtrace->fifo,size + sizeof(rt_status_t)); 656 659 657 660 packet->size = numbytes; -
lib/format_pcap.c
r7c8eacf r8013711 228 228 return pcapbytes; 229 229 } 230 packet->status = 0; 230 packet->status.type = RT_DATA; 231 packet->status.message = 0; 231 232 return (packet->size - sizeof(struct pcap_pkthdr)); 232 233 } -
lib/format_wag.c
r7c8eacf r8013711 326 326 tracefifo_ack_update(libtrace->fifo,size); 327 327 328 packet->status = 0; 328 packet->status.type = RT_DATA; 329 packet->status.message = 0; 329 330 packet->size = numbytes; 330 331 return numbytes; -
lib/libtrace.h
r61ecfb6 r8013711 34 34 #include <sys/types.h> 35 35 #include <netinet/in.h> 36 36 #include "rt_protocol.h" 37 37 /** API version as 2 byte hex digits, eg 0xXXYYZZ */ 38 38 #define LIBTRACE_API_VERSION 0x020016 /* 2.0.22 */ … … 95 95 char buffer[LIBTRACE_PACKET_BUFSIZE]; 96 96 size_t size; 97 uint32_t status;97 rt_status_t status; 98 98 }; 99 99 -
lib/rt_protocol.h
r9c61e13 r8013711 39 39 #endif 40 40 41 #include <libfifo.h>42 43 #define CAPTURE_PORT 343444 #define COLLECTOR_PORT 343545 46 41 #define MAXDATASIZE 65536 47 42 48 // Server status codes 49 #define S_KEYCHANGE 1 // Encryption key has changed, flush collection to disk 50 #define S_DISKWARN 2 // Disk-backed fifo is > 75% used 51 #define S_DISKCRIT 4 // Disk-backed fifo is > 90% used 52 #define S_DISKFULL 8 // Disk-backed fifo is > 95% used 53 #define S_STATUS 16 // Packet is a fifo_status packet 54 #define S_LOSTDATA 32 // capture restarted, flush collection to disk 55 #define S_LOSTCONN 64 // connection to collector restarted, flush collection to disk 56 /* ----------------------*/ 57 /* Codes for messages that cannot be parsed by libtrace */ 58 #define S_ALLCONN 128 // Already someone connected. Go away 59 #define S_DUCKINFO 256 // Duck information packet 60 #define S_FINISH 512 // No more data - close connection 61 #define S_ACCEPT 1024 // Connection accepted 43 #define RT_DATA 1 44 #define RT_MSG 2 62 45 63 #define S_MESSAGE_ONLY S_ALLCONN 46 typedef struct rt_status { 47 uint8_t type; 48 uint8_t reserved; 49 uint16_t message; 50 } rt_status_t; 64 51 65 // fifo_state_t is a tricky data type to transmit and receive so66 // it's easier to create a specialised structure67 typedef struct fifo_info {68 fifo_offset_t length;69 fifo_offset_t used;70 fifo_offset_t in;71 fifo_offset_t out;72 fifo_offset_t ack;73 } fifo_info_t;74 75 typedef struct fifo_status {76 fifo_info_t fifo;77 } fifo_status_t;78 79 typedef struct duck_info {80 duck_inf duck;81 } duck_info_t;82 52 83 53 typedef struct packet_header { 84 uint32_t message;54 rt_status_t header; 85 55 dag_record_t erf; 86 56 } packet_header_t; 87 57 88 58 typedef struct ack_packet { 89 uint32_t header;59 rt_status_t header; 90 60 long long int ts; 91 61 } ack_packet_t; 92 62 93 // Client message codes94 #define M_HALT_CAPTURE 1 // Request to halt capture95 #define M_START_CAPTURE 2 // Request to restart capture96 #define M_CONFIGURE 4 // Configuration info follows97 #define M_ACK 8 // Ack98 99 63 #endif // _RT_PROTOCOL_H_
Note: See TracChangeset
for help on using the changeset viewer.