summaryrefslogtreecommitdiff
path: root/src/socket.h
blob: 6c0b2d50eb46a0aad36764b94f9ef4cfd734d977 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/*
 * ZMap Copyright 2013 Regents of the University of Michigan
 *
 * XMap Copyright 2021 Xiang Li from Network and Information Security Lab
 * Tsinghua University
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy
 * of the License at http://www.apache.org/licenses/LICENSE-2.0
 */

#ifndef XMAP_SOCKET_H
#define XMAP_SOCKET_H

#include <stdint.h>

#include "../lib/includes.h"

#ifdef PFRING
#include <pfring_zc.h>

typedef union {
    int sock;
    struct {
        pfring_zc_queue     *queue;
        pfring_zc_pkt_buff **buffers;
        int                  idx;
    } pf;
} sock_t;

#else

typedef struct {
    int sock;
} sock_t;
#endif // PFRING

sock_t get_dryrun_socket(void);

sock_t get_socket(uint32_t id);

#endif // XMAP_SOCKET_H