forked from dancrossnyc/44ripd
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrip.h
42 lines (33 loc) · 784 Bytes
/
rip.h
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
#ifndef RIPD_RIP_H
#define RIPD_RIP_H
#include <inttypes.h>
#include <stdbool.h>
#include "dat.h"
typedef struct RIPPacket RIPPacket;
typedef struct RIPResponse RIPResponse;
enum {
MIN_RIP_PACKET_SIZE = 4,
};
struct RIPPacket {
octet command;
octet version;
uint16_t nbz;
size_t datalen;
size_t nresponse;
const octet *data;
};
enum {
RIP_RESPONSE_SIZE = 20,
};
struct RIPResponse {
uint16_t addrfamily;
uint16_t routetag;
uint32_t ipaddr;
uint32_t subnetmask;
uint32_t nexthop;
uint32_t metric;
};
int parserippkt(const octet *restrict data, size_t len, RIPPacket *restrict packet);
int verifyripauth(RIPPacket *restrict packet, const char *restrict password);
int parseripresponse(const RIPPacket *restrict pkt, int k, RIPResponse *restrict response);
#endif