1 /*
2  * Copyright (C) 2005  Hugo Santos <hugo@fivebits.net>
3  * $Id: protocol.h 399 2007-06-25 00:32:38Z hugo $
4  *
5  * This program is free software; you can redistribute it and/or modify it
6  * under the terms of the GNU General Public License as published by the Free
7  * Software Foundation; either version 2 of the License, or any later version.
8  *
9  * This program is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
12  * more details.
13  */
14 
15 #ifndef _protocol_h_
16 #define _protocol_h_
17 
18 #include "address.h"
19 
20 #define PROTO_VER 1
21 
22 // Protocol TLV types
23 enum {
24 	T_BEAC_NAME = 'n',
25 	T_ADMIN_CONTACT = 'a',
26 	T_SOURCE_INFO_IPv4 = 'i',
27 	T_SOURCE_INFO = 'I',
28 	T_ASM_STATS = 'A',
29 	T_SSM_STATS = 'S',
30 
31 	T_SOURCE_FLAGS = 'F',
32 
33 	T_WEBSITE_GENERIC = 'G',
34 	T_WEBSITE_MATRIX = 'M',
35 	T_WEBSITE_LG = 'L',
36 	T_CC = 'C',
37 
38 	T_LEAVE = 'Q'
39 };
40 
41 // Report types
42 enum {
43 	STATS_REPORT = 'R',
44 	SSM_REPORT,
45 	MAP_REPORT,
46 	WEBSITE_REPORT,
47 	LEAVE_REPORT
48 };
49 
50 // Known Flags
51 enum {
52 	SSM_CAPABLE = 1,
53 	SSMPING_CAPABLE = 2
54 };
55 
56 int build_probe(uint8_t *, int, uint32_t, uint64_t);
57 int build_report(uint8_t *, int, int, bool);
58 
59 void handle_nmsg(const address &from, uint64_t recvdts, int ttl, uint8_t *buffer, int len, bool);
60 
61 #endif
62 
63