📄 ipv6interfacetable.c
字号:
* Pointer to storage for a char variable * @param ipv6InterfaceIdentifier_val_ptr_len_ptr * Pointer to a size_t. On entry, it will contain the size (in bytes) * pointed to by ipv6InterfaceIdentifier. * On exit, this value should contain the data size (in bytes). * * @retval MFD_SUCCESS : success * @retval MFD_SKIP : skip this node (no value for now) * @retval MFD_ERROR : Any other error* * @note If you need more than (*ipv6InterfaceIdentifier_val_ptr_len_ptr) bytes of memory, * allocate it using malloc() and update ipv6InterfaceIdentifier_val_ptr_ptr. * <b>DO NOT</b> free the previous pointer. * The MFD helper will release the memory you allocate. * * @remark If you call this function yourself, you are responsible * for checking if the pointer changed, and freeing any * previously allocated memory. (Not necessary if you pass * in a pointer to static memory, obviously.) */intipv6InterfaceIdentifier_get(ipv6InterfaceTable_rowreq_ctx * rowreq_ctx, char **ipv6InterfaceIdentifier_val_ptr_ptr, size_t * ipv6InterfaceIdentifier_val_ptr_len_ptr){ /** we should have a non-NULL pointer and enough storage */ netsnmp_assert((NULL != ipv6InterfaceIdentifier_val_ptr_ptr) && (NULL != *ipv6InterfaceIdentifier_val_ptr_ptr)); netsnmp_assert(NULL != ipv6InterfaceIdentifier_val_ptr_len_ptr); DEBUGMSGTL(("verbose:ipv6InterfaceTable:ipv6InterfaceIdentifier_get", "called\n")); netsnmp_assert(NULL != rowreq_ctx); if (! (rowreq_ctx->data.ifentry-> ns_flags & NETSNMP_INTERFACE_FLAGS_HAS_V6_IFID)) return MFD_SKIP; /* * TODO:231:o: |-> Extract the current value of the ipv6InterfaceIdentifier data. * copy (* ipv6InterfaceIdentifier_val_ptr_ptr ) data and (* ipv6InterfaceIdentifier_val_ptr_len_ptr ) from rowreq_ctx->data */ /* * make sure there is enough space for ipv6InterfaceIdentifier data */ if ((NULL == (*ipv6InterfaceIdentifier_val_ptr_ptr)) || ((*ipv6InterfaceIdentifier_val_ptr_len_ptr) < (rowreq_ctx->data.ipv6InterfaceIdentifier_len * sizeof(rowreq_ctx->data.ipv6InterfaceIdentifier[0])))) { /* * allocate space for ipv6InterfaceIdentifier data */ (*ipv6InterfaceIdentifier_val_ptr_ptr) = malloc(rowreq_ctx->data.ipv6InterfaceIdentifier_len * sizeof(rowreq_ctx->data.ipv6InterfaceIdentifier[0])); if (NULL == (*ipv6InterfaceIdentifier_val_ptr_ptr)) { snmp_log(LOG_ERR, "could not allocate memory\n"); return MFD_ERROR; } } (*ipv6InterfaceIdentifier_val_ptr_len_ptr) = rowreq_ctx->data.ipv6InterfaceIdentifier_len * sizeof(rowreq_ctx->data.ipv6InterfaceIdentifier[0]); memcpy((*ipv6InterfaceIdentifier_val_ptr_ptr), rowreq_ctx->data.ipv6InterfaceIdentifier, rowreq_ctx->data.ipv6InterfaceIdentifier_len * sizeof(rowreq_ctx->data.ipv6InterfaceIdentifier[0])); return MFD_SUCCESS;} /* ipv6InterfaceIdentifier_get *//*--------------------------------------------------------------------- * IP-MIB::ipv6InterfaceEntry.ipv6InterfaceEnableStatus * ipv6InterfaceEnableStatus is subid 5 of ipv6InterfaceEntry. * Its status is Current, and its access level is ReadWrite. * OID: .1.3.6.1.2.1.4.30.1.5 * Description:The indication of whether IPv6 is enabled (up) or disabled (down) on this interface. This object does not affect the state of the interface itself, only its connection to an IPv6 stack. The IF-MIB should be used to control the state of the interface. When this object is written the entity SHOULD save the change to non-volatile storage and restore the object from non-volatile storage upon re-initialization of the system. * * Attributes: * accessible 1 isscalar 0 enums 1 hasdefval 0 * readable 1 iscolumn 1 ranges 0 hashint 0 * settable 1 * * Enum range: 1/8. Values: up(1), down(2) * * Its syntax is INTEGER (based on perltype INTEGER) * The net-snmp type is ASN_INTEGER. The C type decl is long (u_long) *//** * Extract the current value of the ipv6InterfaceEnableStatus data. * * Set a value using the data context for the row. * * @param rowreq_ctx * Pointer to the row request context. * @param ipv6InterfaceEnableStatus_val_ptr * Pointer to storage for a long variable * * @retval MFD_SUCCESS : success * @retval MFD_SKIP : skip this node (no value for now) * @retval MFD_ERROR : Any other error */intipv6InterfaceEnableStatus_get(ipv6InterfaceTable_rowreq_ctx * rowreq_ctx, u_long * ipv6InterfaceEnableStatus_val_ptr){ /** we should have a non-NULL pointer */ netsnmp_assert(NULL != ipv6InterfaceEnableStatus_val_ptr); DEBUGMSGTL(("verbose:ipv6InterfaceTable:ipv6InterfaceEnableStatus_get", "called\n")); netsnmp_assert(NULL != rowreq_ctx); /* * TODO:231:o: |-> Extract the current value of the ipv6InterfaceEnableStatus data. * copy (* ipv6InterfaceEnableStatus_val_ptr ) from rowreq_ctx->data */ (*ipv6InterfaceEnableStatus_val_ptr) = rowreq_ctx->data.ipv6InterfaceEnableStatus; return MFD_SUCCESS;} /* ipv6InterfaceEnableStatus_get *//*--------------------------------------------------------------------- * IP-MIB::ipv6InterfaceEntry.ipv6InterfaceReachableTime * ipv6InterfaceReachableTime is subid 6 of ipv6InterfaceEntry. * Its status is Current, and its access level is ReadOnly. * OID: .1.3.6.1.2.1.4.30.1.6 * Description:The time a neighbor is considered reachable after receiving a reachability confirmation. * * Attributes: * accessible 1 isscalar 0 enums 0 hasdefval 0 * readable 1 iscolumn 1 ranges 0 hashint 0 * settable 0 * * * Its syntax is UNSIGNED32 (based on perltype UNSIGNED32) * The net-snmp type is ASN_UNSIGNED. The C type decl is u_long (u_long) *//** * Extract the current value of the ipv6InterfaceReachableTime data. * * Set a value using the data context for the row. * * @param rowreq_ctx * Pointer to the row request context. * @param ipv6InterfaceReachableTime_val_ptr * Pointer to storage for a u_long variable * * @retval MFD_SUCCESS : success * @retval MFD_SKIP : skip this node (no value for now) * @retval MFD_ERROR : Any other error */intipv6InterfaceReachableTime_get(ipv6InterfaceTable_rowreq_ctx * rowreq_ctx, u_long * ipv6InterfaceReachableTime_val_ptr){ /** we should have a non-NULL pointer */ netsnmp_assert(NULL != ipv6InterfaceReachableTime_val_ptr); DEBUGMSGTL(("verbose:ipv6InterfaceTable:ipv6InterfaceReachableTime_get", "called\n")); netsnmp_assert(NULL != rowreq_ctx); if (! (rowreq_ctx->data.ifentry-> ns_flags & NETSNMP_INTERFACE_FLAGS_HAS_V6_REACHABLE)) return MFD_SKIP; /* * TODO:231:o: |-> Extract the current value of the ipv6InterfaceReachableTime data. * copy (* ipv6InterfaceReachableTime_val_ptr ) from rowreq_ctx->data */ (*ipv6InterfaceReachableTime_val_ptr) = rowreq_ctx->data.ipv6InterfaceReachableTime; return MFD_SUCCESS;} /* ipv6InterfaceReachableTime_get *//*--------------------------------------------------------------------- * IP-MIB::ipv6InterfaceEntry.ipv6InterfaceRetransmitTime * ipv6InterfaceRetransmitTime is subid 7 of ipv6InterfaceEntry. * Its status is Current, and its access level is ReadOnly. * OID: .1.3.6.1.2.1.4.30.1.7 * Description:The time between retransmissions of Neighbor Solicitation messages to a neighbor when resolving the address or when probing the reachability of a neighbor. * * Attributes: * accessible 1 isscalar 0 enums 0 hasdefval 0 * readable 1 iscolumn 1 ranges 0 hashint 0 * settable 0 * * * Its syntax is UNSIGNED32 (based on perltype UNSIGNED32) * The net-snmp type is ASN_UNSIGNED. The C type decl is u_long (u_long) *//** * Extract the current value of the ipv6InterfaceRetransmitTime data. * * Set a value using the data context for the row. * * @param rowreq_ctx * Pointer to the row request context. * @param ipv6InterfaceRetransmitTime_val_ptr * Pointer to storage for a u_long variable * * @retval MFD_SUCCESS : success * @retval MFD_SKIP : skip this node (no value for now) * @retval MFD_ERROR : Any other error */intipv6InterfaceRetransmitTime_get(ipv6InterfaceTable_rowreq_ctx * rowreq_ctx, u_long * ipv6InterfaceRetransmitTime_val_ptr){ /** we should have a non-NULL pointer */ netsnmp_assert(NULL != ipv6InterfaceRetransmitTime_val_ptr); DEBUGMSGTL(("verbose:ipv6InterfaceTable:ipv6InterfaceRetransmitTime_get", "called\n")); netsnmp_assert(NULL != rowreq_ctx); if (! (rowreq_ctx->data.ifentry-> ns_flags & NETSNMP_INTERFACE_FLAGS_HAS_V6_RETRANSMIT)) return MFD_SKIP; /* * TODO:231:o: |-> Extract the current value of the ipv6InterfaceRetransmitTime data. * copy (* ipv6InterfaceRetransmitTime_val_ptr ) from rowreq_ctx->data */ (*ipv6InterfaceRetransmitTime_val_ptr) = rowreq_ctx->data.ipv6InterfaceRetransmitTime; return MFD_SUCCESS;} /* ipv6InterfaceRetransmitTime_get *//*--------------------------------------------------------------------- * IP-MIB::ipv6InterfaceEntry.ipv6InterfaceForwarding * ipv6InterfaceForwarding is subid 8 of ipv6InterfaceEntry. * Its status is Current, and its access level is ReadWrite. * OID: .1.3.6.1.2.1.4.30.1.8 * Description:The indication of whether this entity is acting as an IPv6 router on this interface with respect to the forwarding of datagrams received by, but not addressed to, this entity. IPv6 routers forward datagrams. IPv6 hosts do not (except those source-routed via the host). This object is constrained by ipv6IpForwarding and is ignored if ipv6IpForwarding is set to notForwarding. Those systems that do not provide per-interface control of the forwarding function should set this object to forwarding for all interfaces and allow the ipv6IpForwarding object to control the forwarding capability. When this object is written the entity SHOULD save the change to non-volatile storage and restore the object from non-volatile storage upon re-initialization of the system. * * Attributes: * accessible 1 isscalar 0 enums 1 hasdefval 0 * readable 1 iscolumn 1 ranges 0 hashint 0 * settable 1 * * Enum range: 2/8. Values: forwarding(1), notForwarding(2) * * Its syntax is INTEGER (based on perltype INTEGER) * The net-snmp type is ASN_INTEGER. The C type decl is long (u_long) *//** * Extract the current value of the ipv6InterfaceForwarding data. * * Set a value using the data context for the row. * * @param rowreq_ctx * Pointer to the row request context. * @param ipv6InterfaceForwarding_val_ptr * Pointer to storage for a long variable * * @retval MFD_SUCCESS : success * @retval MFD_SKIP : skip this node (no value for now) * @retval MFD_ERROR : Any other error */intipv6InterfaceForwarding_get(ipv6InterfaceTable_rowreq_ctx * rowreq_ctx, u_long * ipv6InterfaceForwarding_val_ptr){ /** we should have a non-NULL pointer */ netsnmp_assert(NULL != ipv6InterfaceForwarding_val_ptr); DEBUGMSGTL(("verbose:ipv6InterfaceTable:ipv6InterfaceForwarding_get", "called\n")); netsnmp_assert(NULL != rowreq_ctx); if (! (rowreq_ctx->data.ifentry-> ns_flags & NETSNMP_INTERFACE_FLAGS_HAS_V6_FORWARDING)) return MFD_SKIP; /* * TODO:231:o: |-> Extract the current value of the ipv6InterfaceForwarding data. * copy (* ipv6InterfaceForwarding_val_ptr ) from rowreq_ctx->data */ (*ipv6InterfaceForwarding_val_ptr) = rowreq_ctx->data.ipv6InterfaceForwarding; return MFD_SUCCESS;} /* ipv6InterfaceForwarding_get *//** @} *//********************************************************************** ********************************************************************** *** *** Table ipv6InterfaceTable *** ********************************************************************** **********************************************************************//* * IP-MIB::ipv6InterfaceTable is subid 30 of ip. * Its status is Current. * OID: .1.3.6.1.2.1.4.30, length: 8 */ /*
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -