-
Notifications
You must be signed in to change notification settings - Fork 0
/
gs105e.h
141 lines (99 loc) · 2.61 KB
/
gs105e.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
#ifndef GS105E_H
#define GS105E_H
#include <stdio.h>
#include <stdint.h>
#define GS_MODEL 0x0001
#define GS_NAME 0x0003
#define GS_MAC 0x0004
#define GS_IP 0x0006
#define GS_SUBNETMSK 0x0007
#define GS_GATEWAY 0x0008
#define GS_NEWPASSWORD 0x0009
#define GS_PASSWORD 0x000a
#define GS_FIRMWAREVER 0x000d
#define GS_PACKETSTATISTICS 0x1000
#define GS_VLAN 0x2800
#define GS_PORTSTATUS 0x0c00
#define GS_PORTDIAG 0x1c00
#define ACT_DHCP 0x000b
#define GS_VLANSETTING 0x2000
#define ACT_ADDVLAN 0x2800
#define ACT_DELVLAN 0x2c00
#define ACT_RESTART 0x0013
#define ACT_PORTMIRROR 0x5c00
#define QR_REQ 0x0101
#define QR_ANSWER 0x0102
#define QR_EXEC 0x0103
#define QR_EXECUTED 0x0104
#define MSK_PORT1 0x80
#define MSK_PORT2 0x40
#define MSK_PORT3 0x20
#define MSK_PORT4 0x10
#define MSK_PORT5 0x08
#define DHCP_ON 0x01
#define DHCP_OFF 0x00
#define DHCP_RENEW 0x02
int packetId;
struct vlan {
uint16_t id;
char members;
char tag;
struct vlan * next;
};
struct portSniffing {
char ports;
char output;
};
struct portStatistic {
char portId;
unsigned long bytesIn;
unsigned long bytesOut;
unsigned long errors;
char state;
char cableError;
char errorDist;
};
struct gs105e_settings {
char * password;
char * model;
char mac[6];
char ip[4];
char subnetmask[4];
char gateway[4];
char * name;
char * swVersion;
char dhcp;
struct vlan * vlans;
char vlanType;
struct portStatistic portStatistics[5];
struct portSniffing portMonitor;
};
struct gs105e_discovered {
int id;
char * model;
char mac[6];
char ip[4];
char subnetmask[4];
char gateway[4];
char * name;
struct gs105e_discovered * next;
};
struct gs105e_discovered * gs105e_devs ;
struct gs105e_settings settings;
void debug(void);
int gs105e_setPassword(char * data);
void gs105e_init(void) ;
void makeHeader(unsigned int queryType);
void gs105e_query (void);
void gs105e_queryAll (void);
int gs105e_addVlan(uint16_t vlanId) ;
int gs105e_delVlan(uint16_t vlanId) ;
int gs105e_vlanEnable(void);
int gs105e_setVlanMembers(uint16_t vlanId, unsigned int members, unsigned int tagged) ;
int gs105e_discover(void);
int gs105e_setName(char * data);
int gs105e_dhcpSettings(int action);
int gs105e_cableDiagnostics(int port);
int gs105e_restart(void);
int gs105e_mirrorPorts(int outputPort, int mirrorMask);
#endif