Fixed const'ness in snmp (design of sys contact/name/location and snmpenableauthentraps is broken!)

This commit is contained in:
goldsimon 2015-04-22 15:39:56 +02:00
parent b16316ae37
commit 02dee05c16
8 changed files with 201 additions and 201 deletions

View File

@ -559,7 +559,7 @@ snmp_asn1_enc_oid(struct pbuf *p, u16_t ofs, u8_t ident_len, const s32_t *ident)
* @return ERR_OK if successful, ERR_ARG if we can't (or won't) encode * @return ERR_OK if successful, ERR_ARG if we can't (or won't) encode
*/ */
err_t err_t
snmp_asn1_enc_raw(struct pbuf *p, u16_t ofs, u16_t raw_len, u8_t *raw) snmp_asn1_enc_raw(struct pbuf *p, u16_t ofs, u16_t raw_len, const u8_t *raw)
{ {
u16_t plen, base; u16_t plen, base;
u8_t *msg_ptr; u8_t *msg_ptr;

View File

@ -134,21 +134,21 @@ const s32_t snmp_ids[28] = {
1, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13, 14, 15, 16, 1, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13, 14, 15, 16,
17, 18, 19, 20, 21, 22, 24, 25, 26, 27, 28, 29, 30 17, 18, 19, 20, 21, 22, 24, 25, 26, 27, 28, 29, 30
}; };
struct mib_node* const snmp_nodes[28] = { const struct mib_node* const snmp_nodes[28] = {
(struct mib_node*)&snmp_scalar, (struct mib_node*)&snmp_scalar, (const struct mib_node*)&snmp_scalar, (const struct mib_node*)&snmp_scalar,
(struct mib_node*)&snmp_scalar, (struct mib_node*)&snmp_scalar, (const struct mib_node*)&snmp_scalar, (const struct mib_node*)&snmp_scalar,
(struct mib_node*)&snmp_scalar, (struct mib_node*)&snmp_scalar, (const struct mib_node*)&snmp_scalar, (const struct mib_node*)&snmp_scalar,
(struct mib_node*)&snmp_scalar, (struct mib_node*)&snmp_scalar, (const struct mib_node*)&snmp_scalar, (const struct mib_node*)&snmp_scalar,
(struct mib_node*)&snmp_scalar, (struct mib_node*)&snmp_scalar, (const struct mib_node*)&snmp_scalar, (const struct mib_node*)&snmp_scalar,
(struct mib_node*)&snmp_scalar, (struct mib_node*)&snmp_scalar, (const struct mib_node*)&snmp_scalar, (const struct mib_node*)&snmp_scalar,
(struct mib_node*)&snmp_scalar, (struct mib_node*)&snmp_scalar, (const struct mib_node*)&snmp_scalar, (const struct mib_node*)&snmp_scalar,
(struct mib_node*)&snmp_scalar, (struct mib_node*)&snmp_scalar, (const struct mib_node*)&snmp_scalar, (const struct mib_node*)&snmp_scalar,
(struct mib_node*)&snmp_scalar, (struct mib_node*)&snmp_scalar, (const struct mib_node*)&snmp_scalar, (const struct mib_node*)&snmp_scalar,
(struct mib_node*)&snmp_scalar, (struct mib_node*)&snmp_scalar, (const struct mib_node*)&snmp_scalar, (const struct mib_node*)&snmp_scalar,
(struct mib_node*)&snmp_scalar, (struct mib_node*)&snmp_scalar, (const struct mib_node*)&snmp_scalar, (const struct mib_node*)&snmp_scalar,
(struct mib_node*)&snmp_scalar, (struct mib_node*)&snmp_scalar, (const struct mib_node*)&snmp_scalar, (const struct mib_node*)&snmp_scalar,
(struct mib_node*)&snmp_scalar, (struct mib_node*)&snmp_scalar, (const struct mib_node*)&snmp_scalar, (const struct mib_node*)&snmp_scalar,
(struct mib_node*)&snmp_scalar, (struct mib_node*)&snmp_scalar (const struct mib_node*)&snmp_scalar, (const struct mib_node*)&snmp_scalar
}; };
const struct mib_array_node snmp = { const struct mib_array_node snmp = {
&noleafs_get_object_def, &noleafs_get_object_def,
@ -179,10 +179,10 @@ struct mib_list_rootnode udp_root = {
0 0
}; };
const s32_t udpentry_ids[2] = { 1, 2 }; const s32_t udpentry_ids[2] = { 1, 2 };
struct mib_node* const udpentry_nodes[2] = { const struct mib_node* const udpentry_nodes[2] = {
(struct mib_node*)&udp_root, (struct mib_node*)&udp_root, (const struct mib_node*)&udp_root, (const struct mib_node*)&udp_root,
}; };
const struct mib_array_node udpentry = { struct mib_array_node udpentry = {
&noleafs_get_object_def, &noleafs_get_object_def,
&noleafs_get_value, &noleafs_get_value,
&noleafs_set_test, &noleafs_set_test,
@ -215,10 +215,10 @@ const mib_scalar_node udp_scalar = {
0 0
}; };
const s32_t udp_ids[5] = { 1, 2, 3, 4, 5 }; const s32_t udp_ids[5] = { 1, 2, 3, 4, 5 };
struct mib_node* const udp_nodes[5] = { const struct mib_node* const udp_nodes[5] = {
(struct mib_node*)&udp_scalar, (struct mib_node*)&udp_scalar, (const struct mib_node*)&udp_scalar, (const struct mib_node*)&udp_scalar,
(struct mib_node*)&udp_scalar, (struct mib_node*)&udp_scalar, (const struct mib_node*)&udp_scalar, (const struct mib_node*)&udp_scalar,
(struct mib_node*)&udptable (const struct mib_node*)&udptable
}; };
const struct mib_array_node udp = { const struct mib_array_node udp = {
&noleafs_get_object_def, &noleafs_get_object_def,
@ -247,12 +247,12 @@ struct mib_list_rootnode tcpconntree_root = {
0 0
}; };
const s32_t tcpconnentry_ids[5] = { 1, 2, 3, 4, 5 }; const s32_t tcpconnentry_ids[5] = { 1, 2, 3, 4, 5 };
struct mib_node* const tcpconnentry_nodes[5] = { const struct mib_node* const tcpconnentry_nodes[5] = {
(struct mib_node*)&tcpconntree_root, (struct mib_node*)&tcpconntree_root, (struct mib_node*)&tcpconntree_root, (struct mib_node*)&tcpconntree_root,
(struct mib_node*)&tcpconntree_root, (struct mib_node*)&tcpconntree_root, (struct mib_node*)&tcpconntree_root, (struct mib_node*)&tcpconntree_root,
(struct mib_node*)&tcpconntree_root (struct mib_node*)&tcpconntree_root
}; };
const struct mib_array_node tcpconnentry = { struct mib_array_node tcpconnentry = {
&noleafs_get_object_def, &noleafs_get_object_def,
&noleafs_get_value, &noleafs_get_value,
&noleafs_set_test, &noleafs_set_test,
@ -287,15 +287,15 @@ const mib_scalar_node tcp_scalar = {
0 0
}; };
const s32_t tcp_ids[15] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }; const s32_t tcp_ids[15] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 };
struct mib_node* const tcp_nodes[15] = { const struct mib_node* const tcp_nodes[15] = {
(struct mib_node*)&tcp_scalar, (struct mib_node*)&tcp_scalar, (const struct mib_node*)&tcp_scalar, (const struct mib_node*)&tcp_scalar,
(struct mib_node*)&tcp_scalar, (struct mib_node*)&tcp_scalar, (const struct mib_node*)&tcp_scalar, (const struct mib_node*)&tcp_scalar,
(struct mib_node*)&tcp_scalar, (struct mib_node*)&tcp_scalar, (const struct mib_node*)&tcp_scalar, (const struct mib_node*)&tcp_scalar,
(struct mib_node*)&tcp_scalar, (struct mib_node*)&tcp_scalar, (const struct mib_node*)&tcp_scalar, (const struct mib_node*)&tcp_scalar,
(struct mib_node*)&tcp_scalar, (struct mib_node*)&tcp_scalar, (const struct mib_node*)&tcp_scalar, (const struct mib_node*)&tcp_scalar,
(struct mib_node*)&tcp_scalar, (struct mib_node*)&tcp_scalar, (const struct mib_node*)&tcp_scalar, (const struct mib_node*)&tcp_scalar,
(struct mib_node*)&tcpconntable, (struct mib_node*)&tcp_scalar, (const struct mib_node*)&tcpconntable, (const struct mib_node*)&tcp_scalar,
(struct mib_node*)&tcp_scalar (const struct mib_node*)&tcp_scalar
}; };
const struct mib_array_node tcp = { const struct mib_array_node tcp = {
&noleafs_get_object_def, &noleafs_get_object_def,
@ -319,20 +319,20 @@ const mib_scalar_node icmp_scalar = {
0 0
}; };
const s32_t icmp_ids[26] = { 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 }; const s32_t icmp_ids[26] = { 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 };
struct mib_node* const icmp_nodes[26] = { const struct mib_node* const icmp_nodes[26] = {
(struct mib_node*)&icmp_scalar, (struct mib_node*)&icmp_scalar, (const struct mib_node*)&icmp_scalar, (const struct mib_node*)&icmp_scalar,
(struct mib_node*)&icmp_scalar, (struct mib_node*)&icmp_scalar, (const struct mib_node*)&icmp_scalar, (const struct mib_node*)&icmp_scalar,
(struct mib_node*)&icmp_scalar, (struct mib_node*)&icmp_scalar, (const struct mib_node*)&icmp_scalar, (const struct mib_node*)&icmp_scalar,
(struct mib_node*)&icmp_scalar, (struct mib_node*)&icmp_scalar, (const struct mib_node*)&icmp_scalar, (const struct mib_node*)&icmp_scalar,
(struct mib_node*)&icmp_scalar, (struct mib_node*)&icmp_scalar, (const struct mib_node*)&icmp_scalar, (const struct mib_node*)&icmp_scalar,
(struct mib_node*)&icmp_scalar, (struct mib_node*)&icmp_scalar, (const struct mib_node*)&icmp_scalar, (const struct mib_node*)&icmp_scalar,
(struct mib_node*)&icmp_scalar, (struct mib_node*)&icmp_scalar, (const struct mib_node*)&icmp_scalar, (const struct mib_node*)&icmp_scalar,
(struct mib_node*)&icmp_scalar, (struct mib_node*)&icmp_scalar, (const struct mib_node*)&icmp_scalar, (const struct mib_node*)&icmp_scalar,
(struct mib_node*)&icmp_scalar, (struct mib_node*)&icmp_scalar, (const struct mib_node*)&icmp_scalar, (const struct mib_node*)&icmp_scalar,
(struct mib_node*)&icmp_scalar, (struct mib_node*)&icmp_scalar, (const struct mib_node*)&icmp_scalar, (const struct mib_node*)&icmp_scalar,
(struct mib_node*)&icmp_scalar, (struct mib_node*)&icmp_scalar, (const struct mib_node*)&icmp_scalar, (const struct mib_node*)&icmp_scalar,
(struct mib_node*)&icmp_scalar, (struct mib_node*)&icmp_scalar, (const struct mib_node*)&icmp_scalar, (const struct mib_node*)&icmp_scalar,
(struct mib_node*)&icmp_scalar, (struct mib_node*)&icmp_scalar (const struct mib_node*)&icmp_scalar, (const struct mib_node*)&icmp_scalar
}; };
const struct mib_array_node icmp = { const struct mib_array_node icmp = {
&noleafs_get_object_def, &noleafs_get_object_def,
@ -358,11 +358,11 @@ struct mib_list_rootnode ipntomtree_root = {
0 0
}; };
const s32_t ipntomentry_ids[4] = { 1, 2, 3, 4 }; const s32_t ipntomentry_ids[4] = { 1, 2, 3, 4 };
struct mib_node* const ipntomentry_nodes[4] = { const struct mib_node* const ipntomentry_nodes[4] = {
(struct mib_node*)&ipntomtree_root, (struct mib_node*)&ipntomtree_root, (struct mib_node*)&ipntomtree_root, (struct mib_node*)&ipntomtree_root,
(struct mib_node*)&ipntomtree_root, (struct mib_node*)&ipntomtree_root (struct mib_node*)&ipntomtree_root, (struct mib_node*)&ipntomtree_root
}; };
const struct mib_array_node ipntomentry = { struct mib_array_node ipntomentry = {
&noleafs_get_object_def, &noleafs_get_object_def,
&noleafs_get_value, &noleafs_get_value,
&noleafs_set_test, &noleafs_set_test,
@ -399,7 +399,7 @@ struct mib_list_rootnode iprtetree_root = {
0 0
}; };
const s32_t iprteentry_ids[13] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 }; const s32_t iprteentry_ids[13] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 };
struct mib_node* const iprteentry_nodes[13] = { const struct mib_node* const iprteentry_nodes[13] = {
(struct mib_node*)&iprtetree_root, (struct mib_node*)&iprtetree_root, (struct mib_node*)&iprtetree_root, (struct mib_node*)&iprtetree_root,
(struct mib_node*)&iprtetree_root, (struct mib_node*)&iprtetree_root, (struct mib_node*)&iprtetree_root, (struct mib_node*)&iprtetree_root,
(struct mib_node*)&iprtetree_root, (struct mib_node*)&iprtetree_root, (struct mib_node*)&iprtetree_root, (struct mib_node*)&iprtetree_root,
@ -408,7 +408,7 @@ struct mib_node* const iprteentry_nodes[13] = {
(struct mib_node*)&iprtetree_root, (struct mib_node*)&iprtetree_root, (struct mib_node*)&iprtetree_root, (struct mib_node*)&iprtetree_root,
(struct mib_node*)&iprtetree_root (struct mib_node*)&iprtetree_root
}; };
const struct mib_array_node iprteentry = { struct mib_array_node iprteentry = {
&noleafs_get_object_def, &noleafs_get_object_def,
&noleafs_get_value, &noleafs_get_value,
&noleafs_set_test, &noleafs_set_test,
@ -445,14 +445,14 @@ struct mib_list_rootnode ipaddrtree_root = {
0 0
}; };
const s32_t ipaddrentry_ids[5] = { 1, 2, 3, 4, 5 }; const s32_t ipaddrentry_ids[5] = { 1, 2, 3, 4, 5 };
struct mib_node* const ipaddrentry_nodes[5] = { const struct mib_node* const ipaddrentry_nodes[5] = {
(struct mib_node*)&ipaddrtree_root, (const struct mib_node*)&ipaddrtree_root,
(struct mib_node*)&ipaddrtree_root, (const struct mib_node*)&ipaddrtree_root,
(struct mib_node*)&ipaddrtree_root, (const struct mib_node*)&ipaddrtree_root,
(struct mib_node*)&ipaddrtree_root, (const struct mib_node*)&ipaddrtree_root,
(struct mib_node*)&ipaddrtree_root (const struct mib_node*)&ipaddrtree_root
}; };
const struct mib_array_node ipaddrentry = { struct mib_array_node ipaddrentry = {
&noleafs_get_object_def, &noleafs_get_object_def,
&noleafs_get_value, &noleafs_get_value,
&noleafs_set_test, &noleafs_set_test,
@ -486,19 +486,19 @@ const mib_scalar_node ip_scalar = {
0 0
}; };
const s32_t ip_ids[23] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23 }; const s32_t ip_ids[23] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23 };
struct mib_node* const ip_nodes[23] = { const struct mib_node* const ip_nodes[23] = {
(struct mib_node*)&ip_scalar, (struct mib_node*)&ip_scalar, (const struct mib_node*)&ip_scalar, (const struct mib_node*)&ip_scalar,
(struct mib_node*)&ip_scalar, (struct mib_node*)&ip_scalar, (const struct mib_node*)&ip_scalar, (const struct mib_node*)&ip_scalar,
(struct mib_node*)&ip_scalar, (struct mib_node*)&ip_scalar, (const struct mib_node*)&ip_scalar, (const struct mib_node*)&ip_scalar,
(struct mib_node*)&ip_scalar, (struct mib_node*)&ip_scalar, (const struct mib_node*)&ip_scalar, (const struct mib_node*)&ip_scalar,
(struct mib_node*)&ip_scalar, (struct mib_node*)&ip_scalar, (const struct mib_node*)&ip_scalar, (const struct mib_node*)&ip_scalar,
(struct mib_node*)&ip_scalar, (struct mib_node*)&ip_scalar, (const struct mib_node*)&ip_scalar, (const struct mib_node*)&ip_scalar,
(struct mib_node*)&ip_scalar, (struct mib_node*)&ip_scalar, (const struct mib_node*)&ip_scalar, (const struct mib_node*)&ip_scalar,
(struct mib_node*)&ip_scalar, (struct mib_node*)&ip_scalar, (const struct mib_node*)&ip_scalar, (const struct mib_node*)&ip_scalar,
(struct mib_node*)&ip_scalar, (struct mib_node*)&ip_scalar, (const struct mib_node*)&ip_scalar, (const struct mib_node*)&ip_scalar,
(struct mib_node*)&ip_scalar, (struct mib_node*)&ipaddrtable, (const struct mib_node*)&ip_scalar, (const struct mib_node*)&ipaddrtable,
(struct mib_node*)&iprtetable, (struct mib_node*)&ipntomtable, (const struct mib_node*)&iprtetable, (const struct mib_node*)&ipntomtable,
(struct mib_node*)&ip_scalar (const struct mib_node*)&ip_scalar
}; };
const struct mib_array_node mib2_ip = { const struct mib_array_node mib2_ip = {
&noleafs_get_object_def, &noleafs_get_object_def,
@ -524,10 +524,10 @@ struct mib_list_rootnode arptree_root = {
0 0
}; };
const s32_t atentry_ids[3] = { 1, 2, 3 }; const s32_t atentry_ids[3] = { 1, 2, 3 };
struct mib_node* const atentry_nodes[3] = { const struct mib_node* const atentry_nodes[3] = {
(struct mib_node*)&arptree_root, (const struct mib_node*)&arptree_root,
(struct mib_node*)&arptree_root, (const struct mib_node*)&arptree_root,
(struct mib_node*)&arptree_root (const struct mib_node*)&arptree_root
}; };
const struct mib_array_node atentry = { const struct mib_array_node atentry = {
&noleafs_get_object_def, &noleafs_get_object_def,
@ -541,8 +541,8 @@ const struct mib_array_node atentry = {
}; };
const s32_t attable_id = 1; const s32_t attable_id = 1;
struct mib_node* const attable_node = (struct mib_node*)&atentry; const struct mib_node* const attable_node = (const struct mib_node*)&atentry;
const struct mib_array_node attable = { struct mib_array_node attable = {
&noleafs_get_object_def, &noleafs_get_object_def,
&noleafs_get_value, &noleafs_get_value,
&noleafs_set_test, &noleafs_set_test,
@ -585,20 +585,20 @@ struct mib_list_rootnode iflist_root = {
0 0
}; };
const s32_t ifentry_ids[22] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22 }; const s32_t ifentry_ids[22] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22 };
struct mib_node* const ifentry_nodes[22] = { const struct mib_node* const ifentry_nodes[22] = {
(struct mib_node*)&iflist_root, (struct mib_node*)&iflist_root, (const struct mib_node*)&iflist_root, (const struct mib_node*)&iflist_root,
(struct mib_node*)&iflist_root, (struct mib_node*)&iflist_root, (const struct mib_node*)&iflist_root, (const struct mib_node*)&iflist_root,
(struct mib_node*)&iflist_root, (struct mib_node*)&iflist_root, (const struct mib_node*)&iflist_root, (const struct mib_node*)&iflist_root,
(struct mib_node*)&iflist_root, (struct mib_node*)&iflist_root, (const struct mib_node*)&iflist_root, (const struct mib_node*)&iflist_root,
(struct mib_node*)&iflist_root, (struct mib_node*)&iflist_root, (const struct mib_node*)&iflist_root, (const struct mib_node*)&iflist_root,
(struct mib_node*)&iflist_root, (struct mib_node*)&iflist_root, (const struct mib_node*)&iflist_root, (const struct mib_node*)&iflist_root,
(struct mib_node*)&iflist_root, (struct mib_node*)&iflist_root, (const struct mib_node*)&iflist_root, (const struct mib_node*)&iflist_root,
(struct mib_node*)&iflist_root, (struct mib_node*)&iflist_root, (const struct mib_node*)&iflist_root, (const struct mib_node*)&iflist_root,
(struct mib_node*)&iflist_root, (struct mib_node*)&iflist_root, (const struct mib_node*)&iflist_root, (const struct mib_node*)&iflist_root,
(struct mib_node*)&iflist_root, (struct mib_node*)&iflist_root, (const struct mib_node*)&iflist_root, (const struct mib_node*)&iflist_root,
(struct mib_node*)&iflist_root, (struct mib_node*)&iflist_root (const struct mib_node*)&iflist_root, (const struct mib_node*)&iflist_root
}; };
const struct mib_array_node ifentry = { struct mib_array_node ifentry = {
&noleafs_get_object_def, &noleafs_get_object_def,
&noleafs_get_value, &noleafs_get_value,
&noleafs_set_test, &noleafs_set_test,
@ -632,8 +632,8 @@ const mib_scalar_node interfaces_scalar = {
0 0
}; };
const s32_t interfaces_ids[2] = { 1, 2 }; const s32_t interfaces_ids[2] = { 1, 2 };
struct mib_node* const interfaces_nodes[2] = { const struct mib_node* const interfaces_nodes[2] = {
(struct mib_node*)&interfaces_scalar, (struct mib_node*)&iftable (const struct mib_node*)&interfaces_scalar, (const struct mib_node*)&iftable
}; };
const struct mib_array_node interfaces = { const struct mib_array_node interfaces = {
&noleafs_get_object_def, &noleafs_get_object_def,
@ -658,11 +658,11 @@ const mib_scalar_node sys_tem_scalar = {
0 0
}; };
const s32_t sys_tem_ids[7] = { 1, 2, 3, 4, 5, 6, 7 }; const s32_t sys_tem_ids[7] = { 1, 2, 3, 4, 5, 6, 7 };
struct mib_node* const sys_tem_nodes[7] = { const struct mib_node* const sys_tem_nodes[7] = {
(struct mib_node*)&sys_tem_scalar, (struct mib_node*)&sys_tem_scalar, (const struct mib_node*)&sys_tem_scalar, (const struct mib_node*)&sys_tem_scalar,
(struct mib_node*)&sys_tem_scalar, (struct mib_node*)&sys_tem_scalar, (const struct mib_node*)&sys_tem_scalar, (const struct mib_node*)&sys_tem_scalar,
(struct mib_node*)&sys_tem_scalar, (struct mib_node*)&sys_tem_scalar, (const struct mib_node*)&sys_tem_scalar, (const struct mib_node*)&sys_tem_scalar,
(struct mib_node*)&sys_tem_scalar (const struct mib_node*)&sys_tem_scalar
}; };
/* work around name issue with 'sys_tem', some compiler(s?) seem to reserve 'system' */ /* work around name issue with 'sys_tem', some compiler(s?) seem to reserve 'system' */
const struct mib_array_node sys_tem = { const struct mib_array_node sys_tem = {
@ -695,17 +695,17 @@ const s32_t mib2_ids[MIB2_GROUPS] =
7, 7,
11 11
}; };
struct mib_node* const mib2_nodes[MIB2_GROUPS] = { const struct mib_node* const mib2_nodes[MIB2_GROUPS] = {
(struct mib_node*)&sys_tem, (const struct mib_node*)&sys_tem,
(struct mib_node*)&interfaces, (const struct mib_node*)&interfaces,
(struct mib_node*)&at, (const struct mib_node*)&at,
(struct mib_node*)&mib2_ip, (const struct mib_node*)&mib2_ip,
(struct mib_node*)&icmp, (const struct mib_node*)&icmp,
#if LWIP_TCP #if LWIP_TCP
(struct mib_node*)&tcp, (const struct mib_node*)&tcp,
#endif #endif
(struct mib_node*)&udp, (const struct mib_node*)&udp,
(struct mib_node*)&snmp (const struct mib_node*)&snmp
}; };
const struct mib_array_node mib2 = { const struct mib_array_node mib2 = {
@ -721,7 +721,7 @@ const struct mib_array_node mib2 = {
/* mgmt .1.3.6.1.2 */ /* mgmt .1.3.6.1.2 */
const s32_t mgmt_ids[1] = { 1 }; const s32_t mgmt_ids[1] = { 1 };
struct mib_node* const mgmt_nodes[1] = { (struct mib_node*)&mib2 }; const struct mib_node* const mgmt_nodes[1] = { (const struct mib_node*)&mib2 };
const struct mib_array_node mgmt = { const struct mib_array_node mgmt = {
&noleafs_get_object_def, &noleafs_get_object_def,
&noleafs_get_value, &noleafs_get_value,
@ -751,7 +751,7 @@ const struct mib_array_node internet = {
}; };
#else #else
const s32_t internet_ids[1] = { 2 }; const s32_t internet_ids[1] = { 2 };
struct mib_node* const internet_nodes[1] = { (struct mib_node*)&mgmt }; const struct mib_node* const internet_nodes[1] = { (const struct mib_node*)&mgmt };
const struct mib_array_node internet = { const struct mib_array_node internet = {
&noleafs_get_object_def, &noleafs_get_object_def,
&noleafs_get_value, &noleafs_get_value,
@ -777,24 +777,24 @@ static const u8_t sysdescr_len_default = 4;
static const u8_t sysdescr_default[] = "lwIP"; static const u8_t sysdescr_default[] = "lwIP";
static const u8_t* sysdescr_len_ptr = &sysdescr_len_default; static const u8_t* sysdescr_len_ptr = &sysdescr_len_default;
static const u8_t* sysdescr_ptr = &sysdescr_default[0]; static const u8_t* sysdescr_ptr = &sysdescr_default[0];
/** mib-2.system.sysContact */ /** mib-2.system.sysContact @todo: this design is broken (SNMP-set writes without known buffer size) */
static const u8_t syscontact_len_default = 0; static u8_t syscontact_len_default = 0;
static const u8_t syscontact_default[] = ""; static u8_t syscontact_default[] = "";
static u8_t* syscontact_len_ptr = (u8_t*)&syscontact_len_default; static u8_t* syscontact_len_ptr = &syscontact_len_default;
static u8_t* syscontact_ptr = (u8_t*)&syscontact_default[0]; static u8_t* syscontact_ptr = &syscontact_default[0];
/** mib-2.system.sysName */ /** mib-2.system.sysName @todo: this design is broken (SNMP-set writes without known buffer size) */
static const u8_t sysname_len_default = 8; static u8_t sysname_len_default = 8;
static const u8_t sysname_default[] = "FQDN-unk"; static u8_t sysname_default[] = "FQDN-unk";
static u8_t* sysname_len_ptr = (u8_t*)&sysname_len_default; static u8_t* sysname_len_ptr = &sysname_len_default;
static u8_t* sysname_ptr = (u8_t*)&sysname_default[0]; static u8_t* sysname_ptr = &sysname_default[0];
/** mib-2.system.sysLocation */ /** mib-2.system.sysLocation @todo: this design is broken (SNMP-set writes without known buffer size) */
static const u8_t syslocation_len_default = 0; static u8_t syslocation_len_default = 0;
static const u8_t syslocation_default[] = ""; static u8_t syslocation_default[] = "";
static u8_t* syslocation_len_ptr = (u8_t*)&syslocation_len_default; static u8_t* syslocation_len_ptr = &syslocation_len_default;
static u8_t* syslocation_ptr = (u8_t*)&syslocation_default[0]; static u8_t* syslocation_ptr = &syslocation_default[0];
/** mib-2.snmp.snmpEnableAuthenTraps */ /** mib-2.snmp.snmpEnableAuthenTraps @todo: this design is broken (SNMP-set writes without known buffer size) */
static const u8_t snmpenableauthentraps_default = 2; /* disabled */ static u8_t snmpenableauthentraps_default = 2; /* disabled */
static u8_t* snmpenableauthentraps_ptr = (u8_t*)&snmpenableauthentraps_default; static u8_t* snmpenableauthentraps_ptr = &snmpenableauthentraps_default;
/** mib-2.interfaces.ifTable.ifEntry.ifSpecific (zeroDotZero) */ /** mib-2.interfaces.ifTable.ifEntry.ifSpecific (zeroDotZero) */
static const struct snmp_obj_id ifspecific = {2, {0, 0}}; static const struct snmp_obj_id ifspecific = {2, {0, 0}};

View File

@ -48,7 +48,7 @@ const s32_t prefix[4] = {1, 3, 6, 1};
struct nse struct nse
{ {
/** right child */ /** right child */
struct mib_node* r_ptr; const struct mib_node* r_ptr;
/** right child identifier */ /** right child identifier */
s32_t r_id; s32_t r_id;
/** right child next level */ /** right child next level */
@ -65,7 +65,7 @@ static void
push_node(const struct nse* node) push_node(const struct nse* node)
{ {
LWIP_ASSERT("node_stack_cnt < NODE_STACK_SIZE",node_stack_cnt < NODE_STACK_SIZE); LWIP_ASSERT("node_stack_cnt < NODE_STACK_SIZE",node_stack_cnt < NODE_STACK_SIZE);
LWIP_DEBUGF(SNMP_MIB_DEBUG,("push_node() node=%p id=%"S32_F"\n",(void*)(node->r_ptr),node->r_id)); LWIP_DEBUGF(SNMP_MIB_DEBUG,("push_node() node=%p id=%"S32_F"\n",(const void*)(node->r_ptr),node->r_id));
if (node_stack_cnt < NODE_STACK_SIZE) if (node_stack_cnt < NODE_STACK_SIZE)
{ {
node_stack[node_stack_cnt] = *node; node_stack[node_stack_cnt] = *node;
@ -84,7 +84,7 @@ pop_node(struct nse* node)
node_stack_cnt--; node_stack_cnt--;
*node = node_stack[node_stack_cnt]; *node = node_stack[node_stack_cnt];
} }
LWIP_DEBUGF(SNMP_MIB_DEBUG,("pop_node() node=%p id=%"S32_F"\n",(void *)(node->r_ptr),node->r_id)); LWIP_DEBUGF(SNMP_MIB_DEBUG,("pop_node() node=%p id=%"S32_F"\n",(const void *)(node->r_ptr),node->r_id));
} }
/** /**
@ -449,25 +449,25 @@ snmp_mib_node_delete(struct mib_list_rootnode *rn, struct mib_list_node *n)
* @param np points to the found object instance (return) * @param np points to the found object instance (return)
* @return pointer to the requested parent (!) node if success, NULL otherwise * @return pointer to the requested parent (!) node if success, NULL otherwise
*/ */
struct mib_node * const struct mib_node *
snmp_search_tree(struct mib_node *node, u8_t ident_len, s32_t *ident, struct snmp_name_ptr *np) snmp_search_tree(const struct mib_node *node, u8_t ident_len, s32_t *ident, struct snmp_name_ptr *np)
{ {
u8_t node_type, ext_level; u8_t node_type, ext_level;
ext_level = 0; ext_level = 0;
LWIP_DEBUGF(SNMP_MIB_DEBUG,("node==%p *ident==%"S32_F"\n",(void*)node,*ident)); LWIP_DEBUGF(SNMP_MIB_DEBUG,("node==%p *ident==%"S32_F"\n",(const void*)node,*ident));
while (node != NULL) while (node != NULL)
{ {
node_type = node->node_type; node_type = node->node_type;
if ((node_type == MIB_NODE_AR) || (node_type == MIB_NODE_RA)) if ((node_type == MIB_NODE_AR) || (node_type == MIB_NODE_RA))
{ {
struct mib_array_node *an; const struct mib_array_node *an;
u16_t i; u16_t i;
if (ident_len > 0) if (ident_len > 0)
{ {
/* array node (internal ROM or RAM, fixed length) */ /* array node (internal ROM or RAM, fixed length) */
an = (struct mib_array_node *)node; an = (const struct mib_array_node *)node;
i = 0; i = 0;
while ((i < an->maxlength) && (an->objid[i] != *ident)) while ((i < an->maxlength) && (an->objid[i] != *ident))
{ {
@ -483,7 +483,7 @@ snmp_search_tree(struct mib_node *node, u8_t ident_len, s32_t *ident, struct snm
inspect remaining instance number / table index */ inspect remaining instance number / table index */
np->ident_len = ident_len; np->ident_len = ident_len;
np->ident = ident; np->ident = ident;
return (struct mib_node*)an; return (const struct mib_node*)an;
} }
else else
{ {
@ -509,13 +509,13 @@ snmp_search_tree(struct mib_node *node, u8_t ident_len, s32_t *ident, struct snm
} }
else if(node_type == MIB_NODE_LR) else if(node_type == MIB_NODE_LR)
{ {
struct mib_list_rootnode *lrn; const struct mib_list_rootnode *lrn;
struct mib_list_node *ln; struct mib_list_node *ln;
if (ident_len > 0) if (ident_len > 0)
{ {
/* list root node (internal 'RAM', variable length) */ /* list root node (internal 'RAM', variable length) */
lrn = (struct mib_list_rootnode *)node; lrn = (const struct mib_list_rootnode *)node;
ln = lrn->head; ln = lrn->head;
/* iterate over list, head to tail */ /* iterate over list, head to tail */
while ((ln != NULL) && (ln->objid != *ident)) while ((ln != NULL) && (ln->objid != *ident))
@ -530,7 +530,7 @@ snmp_search_tree(struct mib_node *node, u8_t ident_len, s32_t *ident, struct snm
{ {
np->ident_len = ident_len; np->ident_len = ident_len;
np->ident = ident; np->ident = ident;
return (struct mib_node*)lrn; return (const struct mib_node*)lrn;
} }
else else
{ {
@ -556,13 +556,13 @@ snmp_search_tree(struct mib_node *node, u8_t ident_len, s32_t *ident, struct snm
} }
else if(node_type == MIB_NODE_EX) else if(node_type == MIB_NODE_EX)
{ {
struct mib_external_node *en; const struct mib_external_node *en;
u16_t i, len; u16_t i, len;
if (ident_len > 0) if (ident_len > 0)
{ {
/* external node (addressing and access via functions) */ /* external node (addressing and access via functions) */
en = (struct mib_external_node *)node; en = (const struct mib_external_node *)node;
i = 0; i = 0;
len = en->level_length(en->addr_inf,ext_level); len = en->level_length(en->addr_inf,ext_level);
@ -580,7 +580,7 @@ snmp_search_tree(struct mib_node *node, u8_t ident_len, s32_t *ident, struct snm
{ {
np->ident_len = ident_len; np->ident_len = ident_len;
np->ident = ident; np->ident = ident;
return (struct mib_node*)en; return (const struct mib_node*)en;
} }
else else
{ {
@ -606,14 +606,14 @@ snmp_search_tree(struct mib_node *node, u8_t ident_len, s32_t *ident, struct snm
} }
else if (node_type == MIB_NODE_SC) else if (node_type == MIB_NODE_SC)
{ {
mib_scalar_node *sn; const mib_scalar_node *sn;
sn = (mib_scalar_node *)node; sn = (const mib_scalar_node *)node;
if ((ident_len == 1) && (*ident == 0)) if ((ident_len == 1) && (*ident == 0))
{ {
np->ident_len = ident_len; np->ident_len = ident_len;
np->ident = ident; np->ident = ident;
return (struct mib_node*)sn; return (const struct mib_node*)sn;
} }
else else
{ {
@ -630,7 +630,7 @@ snmp_search_tree(struct mib_node *node, u8_t ident_len, s32_t *ident, struct snm
} }
} }
/* done, found nothing */ /* done, found nothing */
LWIP_DEBUGF(SNMP_MIB_DEBUG,("search failed node==%p\n",(void*)node)); LWIP_DEBUGF(SNMP_MIB_DEBUG,("search failed node==%p\n",(const void*)node));
return NULL; return NULL;
} }
@ -638,7 +638,7 @@ snmp_search_tree(struct mib_node *node, u8_t ident_len, s32_t *ident, struct snm
* Test table for presence of at least one table entry. * Test table for presence of at least one table entry.
*/ */
static u8_t static u8_t
empty_table(struct mib_node *node) empty_table(const struct mib_node *node)
{ {
u8_t node_type; u8_t node_type;
u8_t empty = 0; u8_t empty = 0;
@ -648,8 +648,8 @@ empty_table(struct mib_node *node)
node_type = node->node_type; node_type = node->node_type;
if (node_type == MIB_NODE_LR) if (node_type == MIB_NODE_LR)
{ {
struct mib_list_rootnode *lrn; const struct mib_list_rootnode *lrn;
lrn = (struct mib_list_rootnode *)node; lrn = (const struct mib_list_rootnode *)node;
if ((lrn->count == 0) || (lrn->head == NULL)) if ((lrn->count == 0) || (lrn->head == NULL))
{ {
empty = 1; empty = 1;
@ -657,8 +657,8 @@ empty_table(struct mib_node *node)
} }
else if ((node_type == MIB_NODE_AR) || (node_type == MIB_NODE_RA)) else if ((node_type == MIB_NODE_AR) || (node_type == MIB_NODE_RA))
{ {
struct mib_array_node *an; const struct mib_array_node *an;
an = (struct mib_array_node *)node; an = (const struct mib_array_node *)node;
if ((an->maxlength == 0) || (an->nptr == NULL)) if ((an->maxlength == 0) || (an->nptr == NULL))
{ {
empty = 1; empty = 1;
@ -666,8 +666,8 @@ empty_table(struct mib_node *node)
} }
else if (node_type == MIB_NODE_EX) else if (node_type == MIB_NODE_EX)
{ {
struct mib_external_node *en; const struct mib_external_node *en;
en = (struct mib_external_node *)node; en = (const struct mib_external_node *)node;
if (en->tree_levels == 0) if (en->tree_levels == 0)
{ {
empty = 1; empty = 1;
@ -680,8 +680,8 @@ empty_table(struct mib_node *node)
/** /**
* Tree expansion. * Tree expansion.
*/ */
struct mib_node * const struct mib_node *
snmp_expand_tree(struct mib_node *node, u8_t ident_len, s32_t *ident, struct snmp_obj_id *oidret) snmp_expand_tree(const struct mib_node *node, u8_t ident_len, s32_t *ident, struct snmp_obj_id *oidret)
{ {
u8_t node_type, ext_level, climb_tree; u8_t node_type, ext_level, climb_tree;
@ -694,11 +694,11 @@ snmp_expand_tree(struct mib_node *node, u8_t ident_len, s32_t *ident, struct snm
node_type = node->node_type; node_type = node->node_type;
if ((node_type == MIB_NODE_AR) || (node_type == MIB_NODE_RA)) if ((node_type == MIB_NODE_AR) || (node_type == MIB_NODE_RA))
{ {
struct mib_array_node *an; const struct mib_array_node *an;
u16_t i; u16_t i;
/* array node (internal ROM or RAM, fixed length) */ /* array node (internal ROM or RAM, fixed length) */
an = (struct mib_array_node *)node; an = (const struct mib_array_node *)node;
if (ident_len > 0) if (ident_len > 0)
{ {
i = 0; i = 0;
@ -719,7 +719,7 @@ snmp_expand_tree(struct mib_node *node, u8_t ident_len, s32_t *ident, struct snm
/* leaf node (e.g. in a fixed size table) */ /* leaf node (e.g. in a fixed size table) */
if (an->objid[i] > *ident) if (an->objid[i] > *ident)
{ {
return (struct mib_node*)an; return (const struct mib_node*)an;
} }
else if ((i + 1) < an->maxlength) else if ((i + 1) < an->maxlength)
{ {
@ -727,7 +727,7 @@ snmp_expand_tree(struct mib_node *node, u8_t ident_len, s32_t *ident, struct snm
(oidret->len)--; (oidret->len)--;
oidret->id[oidret->len] = an->objid[i + 1]; oidret->id[oidret->len] = an->objid[i + 1];
(oidret->len)++; (oidret->len)++;
return (struct mib_node*)an; return (const struct mib_node*)an;
} }
else else
{ {
@ -797,7 +797,7 @@ snmp_expand_tree(struct mib_node *node, u8_t ident_len, s32_t *ident, struct snm
if (an->nptr[j] == NULL) if (an->nptr[j] == NULL)
{ {
/* leaf node */ /* leaf node */
return (struct mib_node*)an; return (const struct mib_node*)an;
} }
else else
{ {
@ -814,11 +814,11 @@ snmp_expand_tree(struct mib_node *node, u8_t ident_len, s32_t *ident, struct snm
} }
else if(node_type == MIB_NODE_LR) else if(node_type == MIB_NODE_LR)
{ {
struct mib_list_rootnode *lrn; const struct mib_list_rootnode *lrn;
struct mib_list_node *ln; struct mib_list_node *ln;
/* list root node (internal 'RAM', variable length) */ /* list root node (internal 'RAM', variable length) */
lrn = (struct mib_list_rootnode *)node; lrn = (const struct mib_list_rootnode *)node;
if (ident_len > 0) if (ident_len > 0)
{ {
ln = lrn->head; ln = lrn->head;
@ -837,7 +837,7 @@ snmp_expand_tree(struct mib_node *node, u8_t ident_len, s32_t *ident, struct snm
/* leaf node */ /* leaf node */
if (ln->objid > *ident) if (ln->objid > *ident)
{ {
return (struct mib_node*)lrn; return (const struct mib_node*)lrn;
} }
else if (ln->next != NULL) else if (ln->next != NULL)
{ {
@ -845,7 +845,7 @@ snmp_expand_tree(struct mib_node *node, u8_t ident_len, s32_t *ident, struct snm
(oidret->len)--; (oidret->len)--;
oidret->id[oidret->len] = ln->next->objid; oidret->id[oidret->len] = ln->next->objid;
(oidret->len)++; (oidret->len)++;
return (struct mib_node*)lrn; return (const struct mib_node*)lrn;
} }
else else
{ {
@ -915,7 +915,7 @@ snmp_expand_tree(struct mib_node *node, u8_t ident_len, s32_t *ident, struct snm
{ {
/* leaf node */ /* leaf node */
LWIP_DEBUGF(SNMP_MIB_DEBUG,("jn->nptr == NULL\n")); LWIP_DEBUGF(SNMP_MIB_DEBUG,("jn->nptr == NULL\n"));
return (struct mib_node*)lrn; return (const struct mib_node*)lrn;
} }
else else
{ {
@ -932,11 +932,11 @@ snmp_expand_tree(struct mib_node *node, u8_t ident_len, s32_t *ident, struct snm
} }
else if(node_type == MIB_NODE_EX) else if(node_type == MIB_NODE_EX)
{ {
struct mib_external_node *en; const struct mib_external_node *en;
s32_t ex_id; s32_t ex_id;
/* external node (addressing and access via functions) */ /* external node (addressing and access via functions) */
en = (struct mib_external_node *)node; en = (const struct mib_external_node *)node;
if (ident_len > 0) if (ident_len > 0)
{ {
u16_t i, len; u16_t i, len;
@ -961,7 +961,7 @@ snmp_expand_tree(struct mib_node *node, u8_t ident_len, s32_t *ident, struct snm
/* leaf node */ /* leaf node */
if (ex_id > *ident) if (ex_id > *ident)
{ {
return (struct mib_node*)en; return (const struct mib_node*)en;
} }
else if ((i + 1) < len) else if ((i + 1) < len)
{ {
@ -970,7 +970,7 @@ snmp_expand_tree(struct mib_node *node, u8_t ident_len, s32_t *ident, struct snm
(oidret->len)--; (oidret->len)--;
oidret->id[oidret->len] = ex_id; oidret->id[oidret->len] = ex_id;
(oidret->len)++; (oidret->len)++;
return (struct mib_node*)en; return (const struct mib_node*)en;
} }
else else
{ {
@ -1031,7 +1031,7 @@ snmp_expand_tree(struct mib_node *node, u8_t ident_len, s32_t *ident, struct snm
{ {
/* leaf node */ /* leaf node */
LWIP_DEBUGF(SNMP_MIB_DEBUG,("(ext_level + 1) == en->tree_levels\n")); LWIP_DEBUGF(SNMP_MIB_DEBUG,("(ext_level + 1) == en->tree_levels\n"));
return (struct mib_node*)en; return (const struct mib_node*)en;
} }
else else
{ {
@ -1042,10 +1042,10 @@ snmp_expand_tree(struct mib_node *node, u8_t ident_len, s32_t *ident, struct snm
} }
else if(node_type == MIB_NODE_SC) else if(node_type == MIB_NODE_SC)
{ {
mib_scalar_node *sn; const mib_scalar_node *sn;
/* scalar node */ /* scalar node */
sn = (mib_scalar_node *)node; sn = (const mib_scalar_node *)node;
if (ident_len > 0) if (ident_len > 0)
{ {
/* at .0 */ /* at .0 */
@ -1058,7 +1058,7 @@ snmp_expand_tree(struct mib_node *node, u8_t ident_len, s32_t *ident, struct snm
(oidret->len)++; (oidret->len)++;
/* leaf node */ /* leaf node */
LWIP_DEBUGF(SNMP_MIB_DEBUG,("completed scalar leaf\n")); LWIP_DEBUGF(SNMP_MIB_DEBUG,("completed scalar leaf\n"));
return (struct mib_node*)sn; return (const struct mib_node*)sn;
} }
} }
else else
@ -1100,7 +1100,7 @@ snmp_expand_tree(struct mib_node *node, u8_t ident_len, s32_t *ident, struct snm
} }
} }
/* done, found nothing */ /* done, found nothing */
LWIP_DEBUGF(SNMP_MIB_DEBUG,("expand failed node==%p\n",(void*)node)); LWIP_DEBUGF(SNMP_MIB_DEBUG,("expand failed node==%p\n",(const void*)node));
return NULL; return NULL;
} }

View File

@ -249,7 +249,7 @@ snmp_msg_get_event(u8_t request_id, struct snmp_msg_pstat *msg_ps)
if (msg_ps->state == SNMP_MSG_EXTERNAL_GET_OBJDEF) if (msg_ps->state == SNMP_MSG_EXTERNAL_GET_OBJDEF)
{ {
struct mib_external_node *en; const struct mib_external_node *en;
struct snmp_name_ptr np; struct snmp_name_ptr np;
/* get_object_def() answer*/ /* get_object_def() answer*/
@ -272,7 +272,7 @@ snmp_msg_get_event(u8_t request_id, struct snmp_msg_pstat *msg_ps)
} }
else if (msg_ps->state == SNMP_MSG_EXTERNAL_GET_VALUE) else if (msg_ps->state == SNMP_MSG_EXTERNAL_GET_VALUE)
{ {
struct mib_external_node *en; const struct mib_external_node *en;
struct snmp_varbind *vb; struct snmp_varbind *vb;
/* get_value() answer */ /* get_value() answer */
@ -339,7 +339,7 @@ snmp_msg_get_event(u8_t request_id, struct snmp_msg_pstat *msg_ps)
while ((msg_ps->state == SNMP_MSG_SEARCH_OBJ) && while ((msg_ps->state == SNMP_MSG_SEARCH_OBJ) &&
(msg_ps->vb_idx < msg_ps->invb.count)) (msg_ps->vb_idx < msg_ps->invb.count))
{ {
struct mib_node *mn; const struct mib_node *mn;
struct snmp_name_ptr np; struct snmp_name_ptr np;
if (msg_ps->vb_idx == 0) if (msg_ps->vb_idx == 0)
@ -353,14 +353,14 @@ snmp_msg_get_event(u8_t request_id, struct snmp_msg_pstat *msg_ps)
/** test object identifier for .iso.org.dod.internet prefix */ /** test object identifier for .iso.org.dod.internet prefix */
if (snmp_iso_prefix_tst(msg_ps->vb_ptr->ident_len, msg_ps->vb_ptr->ident)) if (snmp_iso_prefix_tst(msg_ps->vb_ptr->ident_len, msg_ps->vb_ptr->ident))
{ {
mn = snmp_search_tree((struct mib_node*)&internet, msg_ps->vb_ptr->ident_len - 4, mn = snmp_search_tree((const struct mib_node*)&internet, msg_ps->vb_ptr->ident_len - 4,
msg_ps->vb_ptr->ident + 4, &np); msg_ps->vb_ptr->ident + 4, &np);
if (mn != NULL) if (mn != NULL)
{ {
if (mn->node_type == MIB_NODE_EX) if (mn->node_type == MIB_NODE_EX)
{ {
/* external object */ /* external object */
struct mib_external_node *en = (struct mib_external_node*)mn; const struct mib_external_node *en = (const struct mib_external_node*)mn;
msg_ps->state = SNMP_MSG_EXTERNAL_GET_OBJDEF; msg_ps->state = SNMP_MSG_EXTERNAL_GET_OBJDEF;
/* save en && args in msg_ps!! */ /* save en && args in msg_ps!! */
@ -478,7 +478,7 @@ snmp_msg_getnext_event(u8_t request_id, struct snmp_msg_pstat *msg_ps)
if (msg_ps->state == SNMP_MSG_EXTERNAL_GET_OBJDEF) if (msg_ps->state == SNMP_MSG_EXTERNAL_GET_OBJDEF)
{ {
struct mib_external_node *en; const struct mib_external_node *en;
/* get_object_def() answer*/ /* get_object_def() answer*/
en = msg_ps->ext_mib_node; en = msg_ps->ext_mib_node;
@ -499,7 +499,7 @@ snmp_msg_getnext_event(u8_t request_id, struct snmp_msg_pstat *msg_ps)
} }
else if (msg_ps->state == SNMP_MSG_EXTERNAL_GET_VALUE) else if (msg_ps->state == SNMP_MSG_EXTERNAL_GET_VALUE)
{ {
struct mib_external_node *en; const struct mib_external_node *en;
struct snmp_varbind *vb; struct snmp_varbind *vb;
/* get_value() answer */ /* get_value() answer */
@ -527,7 +527,7 @@ snmp_msg_getnext_event(u8_t request_id, struct snmp_msg_pstat *msg_ps)
while ((msg_ps->state == SNMP_MSG_SEARCH_OBJ) && while ((msg_ps->state == SNMP_MSG_SEARCH_OBJ) &&
(msg_ps->vb_idx < msg_ps->invb.count)) (msg_ps->vb_idx < msg_ps->invb.count))
{ {
struct mib_node *mn; const struct mib_node *mn;
struct snmp_obj_id oid; struct snmp_obj_id oid;
if (msg_ps->vb_idx == 0) if (msg_ps->vb_idx == 0)
@ -543,14 +543,14 @@ snmp_msg_getnext_event(u8_t request_id, struct snmp_msg_pstat *msg_ps)
if (msg_ps->vb_ptr->ident_len > 3) if (msg_ps->vb_ptr->ident_len > 3)
{ {
/* can offset ident_len and ident */ /* can offset ident_len and ident */
mn = snmp_expand_tree((struct mib_node*)&internet, mn = snmp_expand_tree((const struct mib_node*)&internet,
msg_ps->vb_ptr->ident_len - 4, msg_ps->vb_ptr->ident_len - 4,
msg_ps->vb_ptr->ident + 4, &oid); msg_ps->vb_ptr->ident + 4, &oid);
} }
else else
{ {
/* can't offset ident_len -4, ident + 4 */ /* can't offset ident_len -4, ident + 4 */
mn = snmp_expand_tree((struct mib_node*)&internet, 0, NULL, &oid); mn = snmp_expand_tree((const struct mib_node*)&internet, 0, NULL, &oid);
} }
} }
else else
@ -562,7 +562,7 @@ snmp_msg_getnext_event(u8_t request_id, struct snmp_msg_pstat *msg_ps)
if (mn->node_type == MIB_NODE_EX) if (mn->node_type == MIB_NODE_EX)
{ {
/* external object */ /* external object */
struct mib_external_node *en = (struct mib_external_node*)mn; const struct mib_external_node *en = (const struct mib_external_node*)mn;
msg_ps->state = SNMP_MSG_EXTERNAL_GET_OBJDEF; msg_ps->state = SNMP_MSG_EXTERNAL_GET_OBJDEF;
/* save en && args in msg_ps!! */ /* save en && args in msg_ps!! */
@ -623,7 +623,7 @@ snmp_msg_set_event(u8_t request_id, struct snmp_msg_pstat *msg_ps)
if (msg_ps->state == SNMP_MSG_EXTERNAL_GET_OBJDEF) if (msg_ps->state == SNMP_MSG_EXTERNAL_GET_OBJDEF)
{ {
struct mib_external_node *en; const struct mib_external_node *en;
struct snmp_name_ptr np; struct snmp_name_ptr np;
/* get_object_def() answer*/ /* get_object_def() answer*/
@ -646,7 +646,7 @@ snmp_msg_set_event(u8_t request_id, struct snmp_msg_pstat *msg_ps)
} }
else if (msg_ps->state == SNMP_MSG_EXTERNAL_SET_TEST) else if (msg_ps->state == SNMP_MSG_EXTERNAL_SET_TEST)
{ {
struct mib_external_node *en; const struct mib_external_node *en;
/* set_test() answer*/ /* set_test() answer*/
en = msg_ps->ext_mib_node; en = msg_ps->ext_mib_node;
@ -676,7 +676,7 @@ snmp_msg_set_event(u8_t request_id, struct snmp_msg_pstat *msg_ps)
} }
else if (msg_ps->state == SNMP_MSG_EXTERNAL_GET_OBJDEF_S) else if (msg_ps->state == SNMP_MSG_EXTERNAL_GET_OBJDEF_S)
{ {
struct mib_external_node *en; const struct mib_external_node *en;
struct snmp_name_ptr np; struct snmp_name_ptr np;
/* get_object_def() answer*/ /* get_object_def() answer*/
@ -700,7 +700,7 @@ snmp_msg_set_event(u8_t request_id, struct snmp_msg_pstat *msg_ps)
} }
else if (msg_ps->state == SNMP_MSG_EXTERNAL_SET_VALUE) else if (msg_ps->state == SNMP_MSG_EXTERNAL_SET_VALUE)
{ {
struct mib_external_node *en; const struct mib_external_node *en;
/** set_value_a() */ /** set_value_a() */
en = msg_ps->ext_mib_node; en = msg_ps->ext_mib_node;
@ -716,7 +716,7 @@ snmp_msg_set_event(u8_t request_id, struct snmp_msg_pstat *msg_ps)
while ((msg_ps->state == SNMP_MSG_SEARCH_OBJ) && while ((msg_ps->state == SNMP_MSG_SEARCH_OBJ) &&
(msg_ps->vb_idx < msg_ps->invb.count)) (msg_ps->vb_idx < msg_ps->invb.count))
{ {
struct mib_node *mn; const struct mib_node *mn;
struct snmp_name_ptr np; struct snmp_name_ptr np;
if (msg_ps->vb_idx == 0) if (msg_ps->vb_idx == 0)
@ -730,14 +730,14 @@ snmp_msg_set_event(u8_t request_id, struct snmp_msg_pstat *msg_ps)
/** test object identifier for .iso.org.dod.internet prefix */ /** test object identifier for .iso.org.dod.internet prefix */
if (snmp_iso_prefix_tst(msg_ps->vb_ptr->ident_len, msg_ps->vb_ptr->ident)) if (snmp_iso_prefix_tst(msg_ps->vb_ptr->ident_len, msg_ps->vb_ptr->ident))
{ {
mn = snmp_search_tree((struct mib_node*)&internet, msg_ps->vb_ptr->ident_len - 4, mn = snmp_search_tree((const struct mib_node*)&internet, msg_ps->vb_ptr->ident_len - 4,
msg_ps->vb_ptr->ident + 4, &np); msg_ps->vb_ptr->ident + 4, &np);
if (mn != NULL) if (mn != NULL)
{ {
if (mn->node_type == MIB_NODE_EX) if (mn->node_type == MIB_NODE_EX)
{ {
/* external object */ /* external object */
struct mib_external_node *en = (struct mib_external_node*)mn; const struct mib_external_node *en = (const struct mib_external_node*)mn;
msg_ps->state = SNMP_MSG_EXTERNAL_GET_OBJDEF; msg_ps->state = SNMP_MSG_EXTERNAL_GET_OBJDEF;
/* save en && args in msg_ps!! */ /* save en && args in msg_ps!! */
@ -811,7 +811,7 @@ snmp_msg_set_event(u8_t request_id, struct snmp_msg_pstat *msg_ps)
while ((msg_ps->state == SNMP_MSG_INTERNAL_SET_VALUE) && while ((msg_ps->state == SNMP_MSG_INTERNAL_SET_VALUE) &&
(msg_ps->vb_idx < msg_ps->invb.count)) (msg_ps->vb_idx < msg_ps->invb.count))
{ {
struct mib_node *mn; const struct mib_node *mn;
struct snmp_name_ptr np; struct snmp_name_ptr np;
if (msg_ps->vb_idx == 0) if (msg_ps->vb_idx == 0)
@ -823,7 +823,7 @@ snmp_msg_set_event(u8_t request_id, struct snmp_msg_pstat *msg_ps)
msg_ps->vb_ptr = msg_ps->vb_ptr->next; msg_ps->vb_ptr = msg_ps->vb_ptr->next;
} }
/* skip iso prefix test, was done previously while settesting() */ /* skip iso prefix test, was done previously while settesting() */
mn = snmp_search_tree((struct mib_node*)&internet, msg_ps->vb_ptr->ident_len - 4, mn = snmp_search_tree((const struct mib_node*)&internet, msg_ps->vb_ptr->ident_len - 4,
msg_ps->vb_ptr->ident + 4, &np); msg_ps->vb_ptr->ident + 4, &np);
/* check if object is still available /* check if object is still available
(e.g. external hot-plug thingy present?) */ (e.g. external hot-plug thingy present?) */
@ -832,7 +832,7 @@ snmp_msg_set_event(u8_t request_id, struct snmp_msg_pstat *msg_ps)
if (mn->node_type == MIB_NODE_EX) if (mn->node_type == MIB_NODE_EX)
{ {
/* external object */ /* external object */
struct mib_external_node *en = (struct mib_external_node*)mn; const struct mib_external_node *en = (const struct mib_external_node*)mn;
msg_ps->state = SNMP_MSG_EXTERNAL_GET_OBJDEF_S; msg_ps->state = SNMP_MSG_EXTERNAL_GET_OBJDEF_S;
/* save en && args in msg_ps!! */ /* save en && args in msg_ps!! */

View File

@ -571,7 +571,7 @@ snmp_trap_header_enc(struct snmp_msg_trap *m_trap, struct pbuf *p)
ofs += 1; ofs += 1;
snmp_asn1_enc_length(p, ofs, m_trap->thl.comlen); snmp_asn1_enc_length(p, ofs, m_trap->thl.comlen);
ofs += m_trap->thl.comlenlen; ofs += m_trap->thl.comlenlen;
snmp_asn1_enc_raw(p, ofs, m_trap->thl.comlen, (u8_t *)&snmp_community_trap[0]); snmp_asn1_enc_raw(p, ofs, m_trap->thl.comlen, (const u8_t *)&snmp_community_trap[0]);
ofs += m_trap->thl.comlen; ofs += m_trap->thl.comlen;
snmp_asn1_enc_type(p, ofs, (SNMP_ASN1_CONTXT | SNMP_ASN1_CONSTR | SNMP_ASN1_PDU_TRAP)); snmp_asn1_enc_type(p, ofs, (SNMP_ASN1_CONTXT | SNMP_ASN1_CONSTR | SNMP_ASN1_PDU_TRAP));

View File

@ -90,7 +90,7 @@ err_t snmp_asn1_enc_length(struct pbuf *p, u16_t ofs, u16_t length);
err_t snmp_asn1_enc_u32t(struct pbuf *p, u16_t ofs, u16_t octets_needed, u32_t value); err_t snmp_asn1_enc_u32t(struct pbuf *p, u16_t ofs, u16_t octets_needed, u32_t value);
err_t snmp_asn1_enc_s32t(struct pbuf *p, u16_t ofs, u16_t octets_needed, s32_t value); err_t snmp_asn1_enc_s32t(struct pbuf *p, u16_t ofs, u16_t octets_needed, s32_t value);
err_t snmp_asn1_enc_oid(struct pbuf *p, u16_t ofs, u8_t ident_len, const s32_t *ident); err_t snmp_asn1_enc_oid(struct pbuf *p, u16_t ofs, u8_t ident_len, const s32_t *ident);
err_t snmp_asn1_enc_raw(struct pbuf *p, u16_t ofs, u16_t raw_len, u8_t *raw); err_t snmp_asn1_enc_raw(struct pbuf *p, u16_t ofs, u16_t raw_len, const u8_t *raw);
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -241,7 +241,7 @@ struct snmp_msg_pstat
/* one out of MSG_EMPTY, MSG_DEMUX, MSG_INTERNAL, MSG_EXTERNAL_x */ /* one out of MSG_EMPTY, MSG_DEMUX, MSG_INTERNAL, MSG_EXTERNAL_x */
u8_t state; u8_t state;
/* saved arguments for MSG_EXTERNAL_x */ /* saved arguments for MSG_EXTERNAL_x */
struct mib_external_node *ext_mib_node; const struct mib_external_node *ext_mib_node;
struct snmp_name_ptr ext_name_ptr; struct snmp_name_ptr ext_name_ptr;
struct obj_def ext_object_def; struct obj_def ext_object_def;
struct snmp_obj_id ext_oid; struct snmp_obj_id ext_oid;

View File

@ -138,7 +138,7 @@ struct mib_array_node
/* additional struct members */ /* additional struct members */
const s32_t *objid; const s32_t *objid;
struct mib_node* const *nptr; const struct mib_node* const *nptr;
}; };
/** derived node, points to a fixed size mem_malloced array /** derived node, points to a fixed size mem_malloced array
@ -254,8 +254,8 @@ s8_t snmp_mib_node_insert(struct mib_list_rootnode *rn, s32_t objid, struct mib_
s8_t snmp_mib_node_find(struct mib_list_rootnode *rn, s32_t objid, struct mib_list_node **fn); s8_t snmp_mib_node_find(struct mib_list_rootnode *rn, s32_t objid, struct mib_list_node **fn);
struct mib_list_rootnode *snmp_mib_node_delete(struct mib_list_rootnode *rn, struct mib_list_node *n); struct mib_list_rootnode *snmp_mib_node_delete(struct mib_list_rootnode *rn, struct mib_list_node *n);
struct mib_node* snmp_search_tree(struct mib_node *node, u8_t ident_len, s32_t *ident, struct snmp_name_ptr *np); const struct mib_node* snmp_search_tree(const struct mib_node *node, u8_t ident_len, s32_t *ident, struct snmp_name_ptr *np);
struct mib_node* snmp_expand_tree(struct mib_node *node, u8_t ident_len, s32_t *ident, struct snmp_obj_id *oidret); const struct mib_node* snmp_expand_tree(const struct mib_node *node, u8_t ident_len, s32_t *ident, struct snmp_obj_id *oidret);
u8_t snmp_iso_prefix_tst(u8_t ident_len, s32_t *ident); u8_t snmp_iso_prefix_tst(u8_t ident_len, s32_t *ident);
u8_t snmp_iso_prefix_expand(u8_t ident_len, s32_t *ident, struct snmp_obj_id *oidret); u8_t snmp_iso_prefix_expand(u8_t ident_len, s32_t *ident, struct snmp_obj_id *oidret);