aboutsummaryrefslogtreecommitdiff
path: root/src/pdesc.h
blob: dcba3038c8f027aebdf11bfc6430f6122c2ce310 (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
#ifndef PDESC_H
#define PDESC_H

#include <netinet/in.h>
#include <stdint.h>

struct psock;

enum pdesc_remote_errno {
    REMOTE_EXISTS,
    REMOTE_NOT_FOUND,
    REMOTE_PACKET_INVALID,
    REMOTE_ICMP_ECHO_CLIENT,
    REMOTE_ICMP_REPLY_SERVER,
    REMOTE_MAX_DESCRIPTORS,
};

enum pdesc_state { PDESC_STATE_AUTH, PDESC_STATE_DATA };

struct pdesc {
    enum pdesc_state state;
    struct sockaddr_storage peer;
    char peer_str[INET6_ADDRSTRLEN];
    uint16_t identifier;
    uint16_t sequence;
};

enum pdesc_remote_errno pdesc_find_current_remote(struct psock *, struct pdesc ** const);

#endif