snmp_timeout(snmp_s, 1);
}
+/* Assume that everything is registered under 1.3.* */
+void
+backend_getbulk_endofmibview(void)
+{
+ struct sockaddr_storage ss;
+ struct sockaddr *sa = (struct sockaddr *)&ss;
+ socklen_t salen;
+ int snmp_s, ax_s;
+ uint32_t sessionid;
+ struct varbind varbind = {
+ .type = TYPE_NULL,
+ .name = OID_STRUCT(2, 0),
+ };
+ struct searchrange searchrange = {
+ .start = OID_STRUCT(2, 0),
+ .end = OID_STRUCT(2, 1)
+ };
+ int32_t requestid;
+ char buf[1024];
+ size_t n;
+
+ ax_s = agentx_connect(axsocket);
+ sessionid = agentx_open(ax_s, 0, 0,
+ OID_ARG(MIB_SUBAGENT_BACKEND_GETBULK, 7), __func__);
+ agentx_register(ax_s, sessionid, 0, 0, 127, 0,
+ OID_ARG(2, 0), 0);
+
+ salen = snmp_resolve(SOCK_DGRAM, hostname, servname, sa);
+ snmp_s = snmp_connect(SOCK_DGRAM, sa, salen);
+ requestid = snmpv2_getbulk(snmp_s, community, 0, 0, 2, &varbind, 1);
+
+ varbind.name.subid[varbind.name.n_subid++] = 0;
+ varbind.type = TYPE_ENDOFMIBVIEW;
+ n = agentx_read(ax_s, buf, sizeof(buf), 1000);
+ agentx_getnext_handle(__func__, buf, n, 0, sessionid, &searchrange,
+ &varbind, 1);
+ varbind.name.n_subid--;
+
+ agentx_response(ax_s, buf, NOERROR, 0, &varbind, 1);
+
+ snmpv2_response_validate(snmp_s, 1000, community, requestid, NOERROR, 0,
+ &varbind, 1);
+}
+
+void
+backend_getbulk_endofmibview_second_rep(void)
+{
+ struct sockaddr_storage ss;
+ struct sockaddr *sa = (struct sockaddr *)&ss;
+ socklen_t salen;
+ int snmp_s, ax_s;
+ uint32_t sessionid;
+ struct varbind request[] = {
+ {
+ .type = TYPE_NULL,
+ .name = OID_STRUCT(2 ,0),
+ .data.int32 = 1
+ },
+ {
+ .type = TYPE_ENDOFMIBVIEW,
+ .name = OID_STRUCT(2, 0, 0),
+ }
+ };
+ struct searchrange searchrange = {
+ .start = OID_STRUCT(2, 0),
+ .end = OID_STRUCT(2, 1)
+ };
+ int32_t requestid;
+ char buf[1024];
+ size_t n;
+
+ ax_s = agentx_connect(axsocket);
+ sessionid = agentx_open(ax_s, 0, 0,
+ OID_ARG(MIB_SUBAGENT_BACKEND_GETBULK, 8), __func__);
+ agentx_register(ax_s, sessionid, 0, 0, 127, 0,
+ OID_ARG(2, 0), 0);
+
+ salen = snmp_resolve(SOCK_DGRAM, hostname, servname, sa);
+ snmp_s = snmp_connect(SOCK_DGRAM, sa, salen);
+ requestid = snmpv2_getbulk(snmp_s, community, 0, 0, 2, request, 1);
+
+ request[0].name.subid[request[0].name.n_subid++] = 0;
+ request[0].type = TYPE_INTEGER;
+ n = agentx_read(ax_s, buf, sizeof(buf), 1000);
+ agentx_getnext_handle(__func__, buf, n, 0, sessionid, &searchrange,
+ request, 1);
+ agentx_response(ax_s, buf, NOERROR, 0, request, 1);
+
+ searchrange.start = request[0].name;
+ n = agentx_read(ax_s, buf, sizeof(buf), 1000);
+ agentx_getnext_handle(__func__, buf, n, 0, sessionid, &searchrange,
+ &request[1], 1);
+ agentx_response(ax_s, buf, NOERROR, 0, &request[1], 1);
+
+ snmpv2_response_validate(snmp_s, 1000, community, requestid, NOERROR, 0,
+ request, 2);
+}
+
+void
+backend_getbulk_endofmibview_two_varbinds(void)
+{
+ struct sockaddr_storage ss;
+ struct sockaddr *sa = (struct sockaddr *)&ss;
+ socklen_t salen;
+ int snmp_s, ax_s;
+ uint32_t sessionid;
+ struct varbind request[] = {
+ {
+ .type = TYPE_NULL,
+ .name = OID_STRUCT(2 ,0),
+ .data.int32 = 1
+ },
+ {
+ .type = TYPE_NULL,
+ .name = OID_STRUCT(2, 0, 0),
+ },
+ {
+ .type = TYPE_ENDOFMIBVIEW,
+ .name = OID_STRUCT(2, 0, 0),
+ },
+ {
+ .type = TYPE_ENDOFMIBVIEW,
+ .name = OID_STRUCT(2, 0, 0),
+ }
+ };
+ struct searchrange searchrange[] = {
+ {
+ .start = OID_STRUCT(2, 0),
+ .end = OID_STRUCT(2, 1)
+ },
+ {
+ .start = OID_STRUCT(2, 0, 0),
+ .end = OID_STRUCT(2, 1)
+ },
+ };
+ int32_t requestid;
+ char buf[1024];
+ size_t n;
+
+ ax_s = agentx_connect(axsocket);
+ sessionid = agentx_open(ax_s, 0, 0,
+ OID_ARG(MIB_SUBAGENT_BACKEND_GETBULK, 9), __func__);
+ agentx_register(ax_s, sessionid, 0, 0, 127, 0,
+ OID_ARG(2, 0), 0);
+
+ salen = snmp_resolve(SOCK_DGRAM, hostname, servname, sa);
+ snmp_s = snmp_connect(SOCK_DGRAM, sa, salen);
+ requestid = snmpv2_getbulk(snmp_s, community, 0, 0, 2, request, 2);
+
+ request[0].name.subid[request[0].name.n_subid++] = 0;
+ request[0].type = TYPE_INTEGER;
+ request[1].type = TYPE_ENDOFMIBVIEW;
+ n = agentx_read(ax_s, buf, sizeof(buf), 1000);
+ agentx_getnext_handle(__func__, buf, n, 0, sessionid, searchrange,
+ request, 2);
+ agentx_response(ax_s, buf, NOERROR, 0, request, 2);
+
+ n = agentx_read(ax_s, buf, sizeof(buf), 1000);
+ agentx_getnext_handle(__func__, buf, n, 0, sessionid, &searchrange[1],
+ &request[1], 1);
+ agentx_response(ax_s, buf, NOERROR, 0, &request[1], 1);
+
+ snmpv2_response_validate(snmp_s, 1000, community, requestid, NOERROR, 0,
+ request, 4);
+}
+
void
backend_error_get_toobig(void)
{