Home | Documentation | Development | Download
#include <rssnmp/query.h>
Function | Description |
---|---|
rssnmp_query_New() | Variable initializer. |
rssnmp_query_Free() | Variable destructor. |
rssnmp_query_Print() | Variable print method. |
rssnmp_query_SetRequestID() | Set query request ID, that will be used in the SNMP packets. |
rssnmp_query_AddVariable() | Add a new varbind to the query. |
rssnmp_query_Exec() | Execute query. |
rssnmp_query_GetResult() | Get the query result. |
rssnmp_query_t rssnmp_query_New(rssnmp_device_t d, int type);
void rssnmp_query_Free(rssnmp_query_t q);
void rssnmp_query_Print(rssnmp_query_t q, FILE *fp, char *offset);
The only parameters needed to instance a query are the device and the query type (GET, WALK or BULK).
Returns NULL
on error.
#define RSSNMP_QUERY_TYPE_GET 1
#define RSSNMP_QUERY_TYPE_WALK 2
#define RSSNMP_QUERY_TYPE_BULK 3
int rssnmp_query_SetRequestID(rssnmp_query_t q, uint32_t request_id);
int rssnmp_query_AddVariable(rssnmp_query_t q, rssnmp_oid_t *oid, int oid_size);
Set the request ID that will be used in the SNMP packet with the rssnmp_query_SetRequestID()
method and add variables to the query using the rssnmp_query_AddVariable()
method.
Both methods will return 0 upon success.
rssnmp_result_t rssnmp_query_Exec(rssnmp_query_t q, int sockfd);
rssnmp_result_t rssnmp_query_GetResult(rssnmp_query_t q);
Once the query is created and all variables of interested added to it, you can execute the query using the rssnmp_query_Exec()
method, providing a UDP socket in sockfd
. It will return the query result in a rssnmp_result_t
variable, that can also be obtained using the method rssnmp_query_GetResult()
.
Both methods will return a rssnmp_result_t
variable containing the query result or NULL
on error.
Copyright (c) 2011, Alain-Jacques L. de Burlet - All rights reserved.