Changeset 03cd7a9e in mainline for uspace/lib/pcap/src/pcap.c
- Timestamp:
- 2024-12-13T08:44:05Z (10 months ago)
- Children:
- f08447b
- Parents:
- 59fe16d
- git-author:
- Nataliia Korop <n.corop08@…> (2024-10-28 09:57:08)
- git-committer:
- Nataliia Korop <n.corop08@…> (2024-12-13 08:44:05)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/pcap/src/pcap.c
r59fe16d r03cd7a9e 43 43 * 44 44 */ 45 void pcap_set_time(pcap_packet_header_t *header , bool nano) // maybe without bool nano as nano is in pcapng45 void pcap_set_time(pcap_packet_header_t *header) 46 46 { 47 47 struct timespec ts; 48 48 getrealtime(&ts); 49 49 header->seconds_stamp = (uint32_t)ts.tv_sec; 50 header->magic_stamp = (uint32_t)ts.tv_nsec / 1000;50 header->magic_stamp = (uint32_t)ts.tv_nsec; 51 51 } 52 52 … … 58 58 void pcap_writer_add_header(pcap_writer_t *writer) 59 59 { 60 pcap_file_header_t file_header = { PCAP_MAGIC_ MICRO, PCAP_MAJOR_VERSION, PCAP_MINOR_VERSION,60 pcap_file_header_t file_header = { PCAP_MAGIC_NANO, PCAP_MAJOR_VERSION, PCAP_MINOR_VERSION, 61 61 0x00000000, 0x00000000, (uint32_t)PCAP_SNAP_LEN, (uint32_t)PCAP_LINKTYPE_ETHERNET }; 62 62 writer->ops->write_buffer(writer, &file_header, sizeof(file_header)); … … 75 75 return; 76 76 pcap_packet_header_t pcap_packet; 77 pcap_set_time(&pcap_packet , false);78 pcap_packet.original_length = (uint32_t)size;77 pcap_set_time(&pcap_packet); 78 pcap_packet.original_length = size; 79 79 80 80 if (PCAP_SNAP_LEN < size) { … … 98 98 { 99 99 errno_t rc; 100 printf("File: %s\n", filename);101 100 writer->data = fopen(filename, "a"); 102 101 if (writer->data == NULL) {
Note:
See TracChangeset
for help on using the changeset viewer.