netsnmp_table_container.3
上传用户:wxp200602
上传日期:2007-10-30
资源大小:4028k
文件大小:5k
源码类别:
SNMP编程
开发平台:
Unix_Linux
- .TH "table_container: Helps you implement a table when data can be found via a netsnmp_container." 3 "28 Nov 2005" "Version 5.2.1.rc3" "net-snmp" " -*- nroff -*-
- .ad l
- .nh
- .SH NAME
- table_container: Helps you implement a table when data can be found via a netsnmp_container. - The table_container handler is used (automatically) in conjuntion with the fBtablefP handler.
- .PP
- .SS "Functions"
- .in +1c
- .ti -1c
- .RI "fBnetsnmp_mib_handlerfP * fBnetsnmp_container_table_handler_getfP (fBnetsnmp_table_registration_infofP *tabreg, fBnetsnmp_containerfP *container, char key_type)"
- .br
- .RI "fIregister specified callbacks for the specified table/oid. fP"
- .ti -1c
- .RI "int fBnetsnmp_container_table_registerfP (fBnetsnmp_handler_registrationfP *reginfo, fBnetsnmp_table_registration_infofP *tabreg, fBnetsnmp_containerfP *container, char key_type)"
- .br
- .in -1c
- .SH "Detailed Description"
- .PP
- The table_container handler is used (automatically) in conjuntion with the fBtablefP handler.
- .PP
- This handler will use the index information provided by the fBfP handler to find the row needed to process the request.
- .PP
- The container must use one of 3 key types. It is the sub-handler's responsibility to ensure that the container and key type match (unless neither is specified, in which case a default will be used.)
- .PP
- The current key types are:
- .PP
- TABLE_CONTAINER_KEY_NETSNMP_INDEX The container should do comparisons based on a key that may be cast to a netsnmp index (netsnmp_index *). This index contains only the index portion of the OID, not the entire OID.
- .PP
- TABLE_CONTAINER_KEY_VARBIND_INDEX The container should do comparisons based on a key that may be cast to a netsnmp variable list (netsnmp_variable_list *). This variable list will contain one varbind for each index component.
- .PP
- TABLE_CONTAINER_KEY_VARBIND_RAW (NOTE: unimplemented) While not yet implemented, future plans include passing the request varbind with the full OID to a container.
- .PP
- If a key type is not specified at registration time, the default key type of TABLE_CONTAINER_KEY_NETSNMP_INDEX will be used. If a container is provided, or the handler name is aliased to a container type, the container must use a netsnmp index.
- .PP
- If no container is provided, a lookup will be made based on the sub-handler's name, or if that isn't found, 'table_container'. The table_container key type will be netsnmp_index.
- .PP
- The container must, at a minimum, implement find and find_next. If a NULL key is passed to the container, it must return the first item, if any. All containers provided by net-snmp fulfil this requirement.
- .PP
- This handler will only register to process 'data lookup' modes. In traditional net-snmp modes, that is any GET-like mode (GET, GET-NEXT, GET-BULK) or the first phase of a SET (RESERVE1). In the new baby-steps mode, DATA_LOOKUP is it's own mode, and is a pre-cursor to other modes.
- .PP
- When called, the handler will call the appropriate container method with the appropriate key type. If a row was not found, the result depends on the mode.
- .PP
- GET Processing An exact match must be found. If one is not, the error NOSUCHINSTANCE is set.
- .PP
- GET-NEXT / GET-BULK If no row is found, the column number will be increased (using any valid_columns structure that may have been provided), and the first row will be retrieved. If no first row is found, the processed flag will be set, so that the sub-handler can skip any processing related to the request. The agent will notice this unsatisfied request, and attempt to pass it to the next appropriate handler.
- .PP
- SET If the hander did not register with the HANDLER_CAN_NOT_CREATE flag set in the registration modes, it is assumed that this is a row creation request and a NULL row is added to the request's data list. The sub-handler is responsbile for dealing with any row creation contraints and inserting any newly created rows into the container and the request's data list.
- .PP
- If a row is found, it will be inserted into the request's data list. The sub-handler may retrieve it by calling netsnmp_container_table_extract_context(request); * NOTE NOTE NOTE:
- .PP
- This helper and it's API are still being tested and are subject to change.
- .SH "Function Documentation"
- .PP
- .SS "fBnetsnmp_mib_handlerfP* netsnmp_container_table_handler_get (fBnetsnmp_table_registration_infofP * tabreg, fBnetsnmp_containerfP * container, char key_type)"
- .PP
- register specified callbacks for the specified table/oid.
- .PP
- Definition at line 156 of file table_container.c.
- .PP
- References netsnmp_container_s::compare, netsnmp_mib_handler_s::flags, container_table_data_s::key_type, MIB_HANDLER_AUTO_NEXT, netsnmp_mib_handler_s::myvoid, netsnmp_container_s::ncompare, netsnmp_create_handler(), NULL, snmp_log(), SNMP_MALLOC_TYPEDEF, container_table_data_s::table, and container_table_data_s::tblreg_info.
- .PP
- Referenced by netsnmp_container_table_register().