Changeset 6eab537d in mainline for uspace/lib


Ignore:
Timestamp:
2024-03-10T09:38:44Z (19 months ago)
Author:
Nataliia Korop <n.corop08@…>
Children:
e846bec
Parents:
192019f
Message:

moved to nic, fixed all except addressing

Location:
uspace/lib
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/nic/include/nic.h

    r192019f r6eab537d  
    4444#include <device/hw_res_parsed.h>
    4545#include <ops/nic.h>
    46 
    47 #include "pcap_iface.h"
     46#include <pcap_iface.h>
    4847
    4948#define DEVICE_CATEGORY_NIC "nic"
  • uspace/lib/nic/src/nic_driver.c

    r192019f r6eab537d  
    4747#include <ops/nic.h>
    4848#include <errno.h>
     49#include <pcapdump_iface.h>
    4950
    5051#include "nic_driver.h"
     
    522523         *               calls it inside send_frame handler (with locked main lock)
    523524         */
     525        pcapdump_packet(nic_get_pcap_iface(nic_data), frame->data, frame->size);
    524526        fibril_rwlock_read_lock(&nic_data->rxc_lock);
    525527        nic_frame_type_t frame_type;
     
    560562                fibril_rwlock_write_unlock(&nic_data->stats_lock);
    561563        }
     564        //pcapdump_packet(nic_get_pcap_iface(nic_data), frame->data, frame->size);
    562565        nic_release_frame(nic_data, frame);
    563566}
     
    647650
    648651        nic_data->dev = device;
     652        errno_t pcap_rc  = pcapdump_init(nic_get_pcap_iface(nic_data));
     653
     654        if (pcap_rc != EOK) {
     655                printf("Failed creating pcapdump port\n");
     656        }
    649657
    650658        return nic_data;
  • uspace/lib/nic/src/nic_impl.c

    r192019f r6eab537d  
    4040#include <ipc/services.h>
    4141#include <ns.h>
     42#include <pcapdump_iface.h>
    4243#include "nic_driver.h"
    4344#include "nic_ev.h"
     
    179180                return EBUSY;
    180181        }
    181 
     182        pcapdump_packet(nic_get_pcap_iface(nic_data), data, size);
    182183        nic_data->send_frame(nic_data, data, size);
    183184        fibril_rwlock_read_unlock(&nic_data->main_lock);
  • uspace/lib/pcap/include/pcap.h

    r192019f r6eab537d  
    6464        uint32_t snaplen;
    6565        uint32_t additional; /** The LinkType and additional information field is in the form */
    66 } __attribute__((packed, aligned(4))) pcap_file_header_t;
     66} pcap_file_header_t;
    6767
    6868typedef struct pcap_packet_header {
  • uspace/lib/pcap/src/pcap.c

    r192019f r6eab537d  
    3535 * @brief Headers and functions for .pcap file and packets to be dumped
    3636 */
    37 
    38 #define LOGGER(msg, ...) \
    39      fprintf(stderr, \
    40          "[PCAP %s:%d]: " msg "\n", \
    41          __FILE__, __LINE__, \
    42          ##__VA_ARGS__\
    43      )
    4437
    4538#include "pcap.h"
     
    108101        if (writer->data == NULL) {
    109102                rc = EINVAL;
    110                 LOGGER("Failed to create %s: %s.", filename, str_error(rc));
    111103                return rc;
    112104        }
  • uspace/lib/pcap/src/pcap_iface.c

    r192019f r6eab537d  
    8282}
    8383
    84 void pcap_close_file()
     84void pcap_close_file(void)
    8585{
    8686        pcap_writer.ops->close(&pcap_writer);
Note: See TracChangeset for help on using the changeset viewer.