1 #ifndef __VQP__
2 
3 #define	__VQP__
4 
5 #include <sys/types.h>
6 #include <sys/socket.h>
7 #include <netinet/in.h>
8 #include <arpa/inet.h>
9 
10 #include "data.h"
11 
12 #define	SERVER_UDP_PORT	22222
13 #define	MAX_PACKET_SIZE	2048
14 
15 #define VQP_CLI_ADDR	0x00000c01
16 #define VQP_PORT_NAME	0x00000c02
17 #define VQP_VLAN_NAME	0x00000c03
18 #define VQP_DOMAIN_NAME	0x00000c04
19 #define VQP_ETH_PACKET	0x00000c05
20 #define VQP_MAC_NULL	0x00000c06
21 #define VQP_UNKNOWN	0x00000c07
22 #define VQP_MAC_ADDR	0x00000c08
23 
24 #define VQP_REQ_JOIN	0x01
25 #define VQP_REQ_RECONF	0x03
26 
27 #define	VQP_RSP_NERR	0x00
28 #define	VQP_RSP_DENY	0x03
29 #define	VQP_RSP_SHUT	0x04
30 #define	VQP_RSP_DOMA	0x05
31 
32 typedef	struct {
33 	u_char	unkn1;	/* const 0x01 ?? */
34 	u_char	req_type;
35 	u_char	response;
36 	u_char	nitems;
37 	unsigned int 	seq_no;
38 } VQP_HEADER;
39 
40 typedef struct {
41 	VQP_HEADER	head;
42 	struct in_addr	client_ip;
43 	char		port[PORT_NAME_MAX+1];
44 	char		vlan[VLAN_NAME_MAX+1];
45 	char		domain[DOMAIN_NAME_MAX+1];
46 	u_char		mac[ETH_ALEN];
47 	struct sockaddr_in 	cli;
48 } VQP_REQUEST;
49 
50 extern int      default_behaviour;
51 
52 int get_request(int sock, VQP_REQUEST *r);
53 void print_request(VQP_REQUEST *r);
54 void do_request(int sock, VQP_REQUEST *r );
55 void send_response(int sock, u_char action, VQP_REQUEST *r, char *vlan_name);
56 void print_action(VQP_REQUEST *r, char *str, char *vlan_name);
57 
58 #endif
59