Changeset 03cd7a9e in mainline for uspace/lib/pcap/src/pcap.c


Ignore:
Timestamp:
2024-12-13T08:44:05Z (10 months ago)
Author:
Nataliia Korop <n.corop08@…>
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)
Message:

refactoring after 23.10

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/pcap/src/pcap.c

    r59fe16d r03cd7a9e  
    4343 *
    4444 */
    45 void pcap_set_time(pcap_packet_header_t *header, bool nano) // maybe without bool nano as nano is in pcapng
     45void pcap_set_time(pcap_packet_header_t *header)
    4646{
    4747        struct timespec ts;
    4848        getrealtime(&ts);
    4949        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;
    5151}
    5252
     
    5858void pcap_writer_add_header(pcap_writer_t *writer)
    5959{
    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,
    6161                0x00000000, 0x00000000, (uint32_t)PCAP_SNAP_LEN, (uint32_t)PCAP_LINKTYPE_ETHERNET };
    6262        writer->ops->write_buffer(writer, &file_header, sizeof(file_header));
     
    7575                return;
    7676        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;
    7979
    8080        if (PCAP_SNAP_LEN < size) {
     
    9898{
    9999        errno_t rc;
    100         printf("File: %s\n", filename);
    101100        writer->data = fopen(filename, "a");
    102101        if (writer->data == NULL) {
Note: See TracChangeset for help on using the changeset viewer.