]> git.sur5r.net Git - ngadmin/blob - raw/include/attr.h
Separated lib in two parts : low level and high level.
[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_DEFAULTS           0x0400
29 #define ATTR_PORT_STATUS        0x0C00
30 #define ATTR_PORT_STATISTICS    0x1000
31 #define ATTR_STATS_RESET        0x1400
32 #define ATTR_CABLETEST_DO       0x1800
33 #define ATTR_CABLETEST_RESULT   0x1C00
34 #define ATTR_VLAN_TYPE          0x2000
35 #define ATTR_VLAN_PORT_CONF     0x2400
36 #define ATTR_VLAN_DOT_CONF      0x2800
37 #define ATTR_VLAN_DESTROY       0x2C00
38 #define ATTR_VLAN_PVID          0x3000
39 #define ATTR_QOS_TYPE           0x3400
40 #define ATTR_QOS_CONFIG         0x3800
41 #define ATTR_BITRATE_INPUT      0x4C00
42 #define ATTR_BITRATE_OUTPUT     0x5000
43 #define ATTR_STORM_ENABLE       0x5400
44 #define ATTR_STORM_BITRATE      0x5800
45 #define ATTR_MIRROR             0x5C00
46 #define ATTR_PORTS_COUNT        0x6000
47 #define ATTR_MAX_VLAN           0x6400
48 #define ATTR_IGMP_ENABLE_VLAN   0x6800
49 #define ATTR_IGMP_BLOCK_UNK     0x6C00
50 #define ATTR_IGMP_VALID_V3      0x7000
51 #define ATTR_TLV_BITMAP         0x7400
52 #define ATTR_END                0xFFFF
53
54 #define UNUSED                  __attribute__((unused))
55
56
57 struct attr_handler {
58         unsigned short attr;                                    /* attribute code */
59         unsigned int size;                                      /* expected data size */
60         bool (*encode)(struct attr *at, unsigned char ports);   /* encode function */
61         bool (*decode)(struct attr *at, unsigned char ports);   /* decode function */
62 };
63
64
65 const struct attr_handler* getAttrHandler (unsigned short attrcode);
66
67
68
69
70 struct attr_port_status {
71         unsigned char port;
72         unsigned char status;
73         unsigned char unk;
74 } __attribute__((packed));
75
76
77 struct attr_port_stat {
78         unsigned char port;
79         unsigned long long recv;
80         unsigned long long sent;
81         unsigned long long unk1;
82         unsigned long long unk2;
83         unsigned long long unk3;
84         unsigned long long crc;
85 } __attribute__((packed));
86
87
88 struct attr_bitrate {
89         unsigned char port;
90         int bitrate;
91 } __attribute__((packed));
92
93
94 struct attr_qos {
95         unsigned char port;
96         unsigned char prio;
97 } __attribute__((packed));
98
99
100 struct attr_pvid {
101         unsigned char port;
102         unsigned short vlan;
103 } __attribute__((packed));
104
105
106 struct attr_igmp_vlan {
107         unsigned short enable;
108         unsigned short vlan;
109 } __attribute__((packed));
110
111
112 struct attr_cabletest_do {
113         unsigned char port;
114         unsigned char action;
115 } __attribute__((packed));
116
117
118 struct attr_cabletest_result {
119         unsigned char port;
120         unsigned int v1;
121         unsigned int v2;
122 } __attribute__((packed));
123
124
125 struct attr_vlan_dot {
126         unsigned short vlan;
127         unsigned char ports[0];
128 };
129
130
131 #endif
132