]> git.sur5r.net Git - ngadmin/blob - raw/include/attr.h
dfbdce0e58d17279fa6b8b02b6e0cc0bd4ecc9a7
[ngadmin] / raw / include / attr.h
1
2 #ifndef DEF_ATTR
3 #define DEF_ATTR
4
5
6 #include <stdbool.h>
7
8 #include "protocol.h"
9
10
11 #define ATTR_PRODUCT            0x0001
12 #define ATTR_UNK_0002           0x0002
13 #define ATTR_NAME               0x0003
14 #define ATTR_MAC                0x0004
15 #define ATTR_UNK_0005           0x0005
16 #define ATTR_IP                 0x0006
17 #define ATTR_NETMASK            0x0007
18 #define ATTR_GATEWAY            0x0008
19 #define ATTR_NEW_PASSWORD       0x0009
20 #define ATTR_PASSWORD           0x000A
21 #define ATTR_DHCP               0x000B
22 #define ATTR_UNK_000C           0x000C
23 #define ATTR_FIRM_VER           0x000D
24 #define ATTR_UNK_000E           0x000E
25 #define ATTR_UNK_000F           0x000F
26 #define ATTR_FIRM_UPGRADE       0x0010
27 #define ATTR_RESTART            0x0013
28 #define ATTR_ENCPASS            0x0014
29 #define ATTR_DEFAULTS           0x0400
30 #define ATTR_PORT_STATUS        0x0C00
31 #define ATTR_PORT_STATISTICS    0x1000
32 #define ATTR_STATS_RESET        0x1400
33 #define ATTR_CABLETEST_DO       0x1800
34 #define ATTR_CABLETEST_RESULT   0x1C00
35 #define ATTR_VLAN_TYPE          0x2000
36 #define ATTR_VLAN_PORT_CONF     0x2400
37 #define ATTR_VLAN_DOT_CONF      0x2800
38 #define ATTR_VLAN_DESTROY       0x2C00
39 #define ATTR_VLAN_PVID          0x3000
40 #define ATTR_QOS_TYPE           0x3400
41 #define ATTR_QOS_CONFIG         0x3800
42 #define ATTR_BITRATE_INPUT      0x4C00
43 #define ATTR_BITRATE_OUTPUT     0x5000
44 #define ATTR_STORM_ENABLE       0x5400
45 #define ATTR_STORM_BITRATE      0x5800
46 #define ATTR_MIRROR             0x5C00
47 #define ATTR_PORTS_COUNT        0x6000
48 #define ATTR_MAX_VLAN           0x6400
49 #define ATTR_IGMP_ENABLE_VLAN   0x6800
50 #define ATTR_IGMP_BLOCK_UNK     0x6C00
51 #define ATTR_IGMP_VALID_V3      0x7000
52 #define ATTR_TLV_BITMAP         0x7400
53 #define ATTR_END                0xFFFF
54
55 #define UNUSED                  __attribute__((unused))
56
57
58 struct attr_handler {
59         unsigned short attr;                                    /* attribute code */
60         unsigned int size;                                      /* expected data size */
61         bool (*encode)(struct attr *at, unsigned char ports);   /* encode function */
62         bool (*decode)(struct attr *at, unsigned char ports);   /* decode function */
63 };
64
65
66 const struct attr_handler* getAttrHandler (unsigned short attrcode);
67
68
69
70
71 struct attr_port_status {
72         unsigned char port;
73         unsigned char status;
74         unsigned char unk;
75 } __attribute__((packed));
76
77
78 struct attr_port_stat {
79         unsigned char port;
80         unsigned long long recv;
81         unsigned long long sent;
82         unsigned long long unk1;
83         unsigned long long unk2;
84         unsigned long long unk3;
85         unsigned long long crc;
86 } __attribute__((packed));
87
88
89 struct attr_bitrate {
90         unsigned char port;
91         int bitrate;
92 } __attribute__((packed));
93
94
95 struct attr_qos {
96         unsigned char port;
97         unsigned char prio;
98 } __attribute__((packed));
99
100
101 struct attr_pvid {
102         unsigned char port;
103         unsigned short vlan;
104 } __attribute__((packed));
105
106
107 struct attr_igmp_vlan {
108         unsigned short enable;
109         unsigned short vlan;
110 } __attribute__((packed));
111
112
113 struct attr_cabletest_do {
114         unsigned char port;
115         unsigned char action;
116 } __attribute__((packed));
117
118
119 struct attr_cabletest_result {
120         unsigned char port;
121         unsigned int v1;
122         unsigned int v2;
123 } __attribute__((packed));
124
125
126 struct attr_vlan_conf {
127         unsigned short vlan;
128         unsigned char ports[0];
129 };
130
131
132 #endif
133