]> git.sur5r.net Git - gsconf/blob - gs105e.h
A bunch of fixes for various compiler warnings
[gsconf] / gs105e.h
1 #ifndef GS105E_H
2 #define GS105E_H
3 #include <stdio.h>
4
5 #define GS_MODEL 0x0001
6 #define GS_NAME 0x0003
7 #define GS_MAC 0x0004
8 #define GS_IP 0x0006
9 #define GS_SUBNETMSK 0x0007
10 #define GS_GATEWAY 0x0008
11
12 #define GS_NEWPASSWORD 0x0009
13 #define GS_PASSWORD 0x000a
14
15 #define GS_FIRMWAREVER 0x000d
16
17 #define GS_PACKETSTATISTICS 0x1000
18
19 #define GS_VLAN 0x2800
20 #define GS_PORTSTATUS 0x0c00
21 #define GS_PORTDIAG 0x1c00
22 #define ACT_DHCP 0x000b
23
24 #define GS_VLANSETTING 0x2000
25
26
27 #define ACT_ADDVLAN 0x2800
28 #define ACT_DELVLAN 0x2c00
29 #define ACT_RESTART 0x0013
30 #define ACT_PORTMIRROR 0x5c00
31
32
33
34 #define QR_REQ 0x0101
35 #define QR_ANSWER 0x0102
36 #define QR_EXEC 0x0103
37 #define QR_EXECUTED 0x0104
38
39 #define MSK_PORT1 0x80
40 #define MSK_PORT2 0x40
41 #define MSK_PORT3 0x20
42 #define MSK_PORT4 0x10
43 #define MSK_PORT5 0x08
44
45
46 #define DHCP_ON 0x01
47 #define DHCP_OFF 0x00
48 #define DHCP_RENEW 0x02
49
50 int packetId;
51
52 struct vlan {
53         int id;
54         char members;
55         char tag;
56         struct vlan * next;
57 };
58
59 struct portSniffing {
60         char ports;
61         char output;
62 };
63
64 struct portStatistic {
65         char portId;
66         unsigned long bytesIn;
67         unsigned long bytesOut;
68         unsigned long errors;
69         char state;
70         char cableError;
71         char errorDist;
72 };
73
74 struct gs105e_settings {
75         
76         char * password;
77         char * model;
78         
79         char mac[6];
80         char ip[4];
81         char subnetmask[4];
82         char gateway[4];
83         
84         char * name;
85         char * swVersion;
86         
87         char dhcp;
88         
89         struct vlan * vlans;
90         char vlanType;
91         
92
93         
94         struct portStatistic portStatistics[5];
95         
96         struct portSniffing portMonitor;
97         
98         
99 };
100
101
102 struct gs105e_discovered {     
103         int id;
104         char * model;
105         
106         char mac[6];
107         char ip[4];
108         char subnetmask[4];
109         char gateway[4];
110         
111         char * name;
112         struct gs105e_discovered * next;
113 };
114
115 static char passwordSecret[19] = {0x4e , 0x74 , 0x67 , 0x72 , 0x53 , 0x6d , 0x61 , 0x72 , 0x74 , 0x53 , 0x77 , 0x69 , 0x74 , 0x63 , 0x68 , 0x52 , 0x6f , 0x63 , 0x6b};
116
117 struct gs105e_discovered * gs105e_devs ;
118
119 struct gs105e_settings settings;
120
121 void debug(void);
122 int gs105e_setPassword(char * data);
123
124 void gs105e_init(void) ;
125 void makeHeader(unsigned int queryType);
126
127 void gs105e_query (void);
128 void gs105e_queryAll(void);
129
130 int gs105e_addVlan(int vlanId) ;
131 int gs105e_delVlan(int vlanId) ;
132 int gs105e_setVlanMembers(unsigned int vlanId, unsigned int members, unsigned int tagged);
133 int gs105e_vlanEnable();
134 int gs105e_discover(void);
135 int gs105e_restart(void);
136
137 int gs105e_setName(char * data);
138 int gs105e_dhcpSettings(int action);
139
140 int gs105e_cableDiagnostics(int port);
141 int gs105e_mirrorPorts(int outputPort, int mirrorMask);
142 #endif