📄 inetnettomediatable.c
字号:
* @remark * This function sets the mib indexs, then updates the oid indexs * from the mib index. */intinetNetToMediaTable_indexes_set(inetNetToMediaTable_rowreq_ctx * rowreq_ctx, long inetNetToMediaIfIndex_val, u_long inetNetToMediaNetAddressType_val, char *inetNetToMediaNetAddress_val_ptr, size_t inetNetToMediaNetAddress_val_ptr_len){ DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaTable_indexes_set", "called\n")); if (MFD_SUCCESS != inetNetToMediaTable_indexes_set_tbl_idx(&rowreq_ctx->tbl_idx, inetNetToMediaIfIndex_val, inetNetToMediaNetAddressType_val, inetNetToMediaNetAddress_val_ptr, inetNetToMediaNetAddress_val_ptr_len)) return MFD_ERROR; /* * convert mib index to oid index */ rowreq_ctx->oid_idx.len = sizeof(rowreq_ctx->oid_tmp) / sizeof(oid); if (0 != inetNetToMediaTable_index_to_oid(&rowreq_ctx->oid_idx, &rowreq_ctx->tbl_idx)) { return MFD_ERROR; } return MFD_SUCCESS;} /* inetNetToMediaTable_indexes_set *//*--------------------------------------------------------------------- * IP-MIB::inetNetToMediaEntry.inetNetToMediaPhysAddress * inetNetToMediaPhysAddress is subid 4 of inetNetToMediaEntry. * Its status is Current, and its access level is Create. * OID: .1.3.6.1.2.1.4.35.1.4 * Description:The media-dependent `physical' address. As the entries in this table are typically not persistent when this object is written the entity SHOULD NOT save the change to non-volatile storage. * * Attributes: * accessible 1 isscalar 0 enums 0 hasdefval 0 * readable 1 iscolumn 1 ranges 1 hashint 1 * settable 1 * hint: 1x: * * Ranges: 0 - 65535; * * Its syntax is PhysAddress (based on perltype OCTETSTR) * The net-snmp type is ASN_OCTET_STR. The C type decl is char (char) * This data type requires a length. (Max 65535) *//** * Extract the current value of the inetNetToMediaPhysAddress data. * * Set a value using the data context for the row. * * @param rowreq_ctx * Pointer to the row request context. * @param inetNetToMediaPhysAddress_val_ptr_ptr * Pointer to storage for a char variable * @param inetNetToMediaPhysAddress_val_ptr_len_ptr * Pointer to a size_t. On entry, it will contain the size (in bytes) * pointed to by inetNetToMediaPhysAddress. * 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 (*inetNetToMediaPhysAddress_val_ptr_len_ptr) bytes of memory, * allocate it using malloc() and update inetNetToMediaPhysAddress_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.) */intinetNetToMediaPhysAddress_get(inetNetToMediaTable_rowreq_ctx * rowreq_ctx, char **inetNetToMediaPhysAddress_val_ptr_ptr, size_t * inetNetToMediaPhysAddress_val_ptr_len_ptr){ /** we should have a non-NULL pointer and enough storage */ netsnmp_assert((NULL != inetNetToMediaPhysAddress_val_ptr_ptr) && (NULL != *inetNetToMediaPhysAddress_val_ptr_ptr)); netsnmp_assert(NULL != inetNetToMediaPhysAddress_val_ptr_len_ptr); DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaPhysAddress_get", "called\n")); netsnmp_assert(NULL != rowreq_ctx); /* * TODO:231:o: |-> Extract the current value of the inetNetToMediaPhysAddress data. * copy (* inetNetToMediaPhysAddress_val_ptr_ptr ) data and (* inetNetToMediaPhysAddress_val_ptr_len_ptr ) from rowreq_ctx->data */ if ((*inetNetToMediaPhysAddress_val_ptr_len_ptr) < rowreq_ctx->data->arp_physaddress_len) return MFD_SKIP; memcpy((*inetNetToMediaPhysAddress_val_ptr_ptr), rowreq_ctx->data->arp_physaddress, rowreq_ctx->data->arp_physaddress_len); (*inetNetToMediaPhysAddress_val_ptr_len_ptr) = rowreq_ctx->data->arp_physaddress_len; return MFD_SUCCESS;} /* inetNetToMediaPhysAddress_get *//*--------------------------------------------------------------------- * IP-MIB::inetNetToMediaEntry.inetNetToMediaLastUpdated * inetNetToMediaLastUpdated is subid 5 of inetNetToMediaEntry. * Its status is Current, and its access level is ReadOnly. * OID: .1.3.6.1.2.1.4.35.1.5 * Description:The value of sysUpTime at the time this entry was last updated. If this entry was updated prior to the last re- initialization of the local network management subsystem, then this object contains a zero value. * * Attributes: * accessible 1 isscalar 0 enums 0 hasdefval 0 * readable 1 iscolumn 1 ranges 0 hashint 0 * settable 0 * * * Its syntax is TimeStamp (based on perltype TICKS) * The net-snmp type is ASN_TIMETICKS. The C type decl is u_long (u_long) *//** * Extract the current value of the inetNetToMediaLastUpdated data. * * Set a value using the data context for the row. * * @param rowreq_ctx * Pointer to the row request context. * @param inetNetToMediaLastUpdated_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 */intinetNetToMediaLastUpdated_get(inetNetToMediaTable_rowreq_ctx * rowreq_ctx, u_long * inetNetToMediaLastUpdated_val_ptr){ /** we should have a non-NULL pointer */ netsnmp_assert(NULL != inetNetToMediaLastUpdated_val_ptr); DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaLastUpdated_get", "called\n")); netsnmp_assert(NULL != rowreq_ctx); /* * TODO:231:o: |-> Extract the current value of the inetNetToMediaLastUpdated data. * copy (* inetNetToMediaLastUpdated_val_ptr ) from rowreq_ctx->data */ /* * xxx-rks: get this value? */ return MFD_SKIP; return MFD_SUCCESS;} /* inetNetToMediaLastUpdated_get *//*--------------------------------------------------------------------- * IP-MIB::inetNetToMediaEntry.inetNetToMediaType * inetNetToMediaType is subid 6 of inetNetToMediaEntry. * Its status is Current, and its access level is Create. * OID: .1.3.6.1.2.1.4.35.1.6 * Description:The type of mapping. Setting this object to the value invalid(2) has the effect of invalidating the corresponding entry in the inetNetToMediaTable. That is, it effectively dis- associates the interface identified with said entry from the mapping identified with said entry. It is an implementation- specific matter as to whether the agent removes an invalidated entry from the table. Accordingly, management stations must be prepared to receive tabular information from agents that corresponds to entries not currently in use. Proper interpretation of such entries requires examination of the relevant inetNetToMediaType object. The 'dynamic(3)' type indicates that the IP address to physical addresses mapping has been dynamically resolved using e.g. IPv4 ARP or the IPv6 Neighbor Discovery protocol. The 'static(4)' type indicates that the mapping has been statically configured. Both of these refer to entries that provide mappings for other entities addresses. The 'local(5)' type indicates that the mapping is provided for an entity's own interface address. As the entries in this table are typically not persistent when this object is written the entity SHOULD NOT save the change to non-volatile storage. * * Attributes: * accessible 1 isscalar 0 enums 1 hasdefval 1 * readable 1 iscolumn 1 ranges 0 hashint 0 * settable 1 * defval: static * * Enum range: 5/8. Values: other(1), invalid(2), dynamic(3), static(4), local(5) * * 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 inetNetToMediaType data. * * Set a value using the data context for the row. * * @param rowreq_ctx * Pointer to the row request context. * @param inetNetToMediaType_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 */intinetNetToMediaType_get(inetNetToMediaTable_rowreq_ctx * rowreq_ctx, u_long * inetNetToMediaType_val_ptr){ /** we should have a non-NULL pointer */ netsnmp_assert(NULL != inetNetToMediaType_val_ptr); DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaType_get", "called\n")); netsnmp_assert(NULL != rowreq_ctx); /* * TODO:231:o: |-> Extract the current value of the inetNetToMediaType data. * copy (* inetNetToMediaType_val_ptr ) from rowreq_ctx->data */ (*inetNetToMediaType_val_ptr) = rowreq_ctx->data->arp_type; return MFD_SUCCESS;} /* inetNetToMediaType_get *//*--------------------------------------------------------------------- * IP-MIB::inetNetToMediaEntry.inetNetToMediaState * inetNetToMediaState is subid 7 of inetNetToMediaEntry. * Its status is Current, and its access level is ReadOnly. * OID: .1.3.6.1.2.1.4.35.1.7 * Description:The Neighbor Unreachability Detection [4] state for the interface when the address mapping in this entry is used. If Neighbor Unreachability Detection is not in use (e.g. for IPv4), this object is always unknown(6). * * Attributes: * accessible 1 isscalar 0 enums 1 hasdefval 0 * readable 1 iscolumn 1 ranges 0 hashint 0 * settable 0 * * Enum range: 6/8. Values: reachable(1), stale(2), delay(3), probe(4), invalid(5), unknown(6), incomplete(7) * * 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 inetNetToMediaState data. * * Set a value using the data context for the row. * * @param rowreq_ctx * Pointer to the row request context. * @param inetNetToMediaState_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 */intinetNetToMediaState_get(inetNetToMediaTable_rowreq_ctx * rowreq_ctx, u_long * inetNetToMediaState_val_ptr){ /** we should have a non-NULL pointer */ netsnmp_assert(NULL != inetNetToMediaState_val_ptr); DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaState_get", "called\n")); netsnmp_assert(NULL != rowreq_ctx); /* * TODO:231:o: |-> Extract the current value of the inetNetToMediaState data. * copy (* inetNetToMediaState_val_ptr ) from rowreq_ctx->data */ (*inetNetToMediaState_val_ptr) = rowreq_ctx->data->arp_state; return MFD_SUCCESS;} /* inetNetToMediaState_get *//*--------------------------------------------------------------------- * IP-MIB::inetNetToMediaEntry.inetNetToMediaRowStatus * inetNetToMediaRowStatus is subid 8 of inetNetToMediaEntry. * Its status is Current, and its access level is Create. * OID: .1.3.6.1.2.1.4.35.1.8 * Description:The status of this conceptual row. The RowStatus TC requires that this DESCRIPTION clause states under which circumstances other objects in this row can be modified. The value of this object has no effect on whether other objects in this conceptual row can be modified. A conceptual row can not be made active until the inetNetToMediaPhysAddress object has been set. Note that if the inetNetToMediaType is set to 'invalid' the managed node may delete the entry independent of the state of this object. * * Attributes: * accessible 1 isscalar 0 enums 1 hasdefval 0 * readable 1 iscolumn 1 ranges 0 hashint 0 * settable 1 * * Enum range: 3/8. Values: active(1), notInService(2), notReady(3), createAndGo(4), createAndWait(5), destroy(6) * * Its syntax is RowStatus (based on perltype INTEGER) * The net-snmp type is ASN_INTEGER. The C type decl is long (u_long) */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -