/* ****************************************************************************** * INTERPEAK SOURCE FILE * * Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmipfa_mip_mib.c,v $ $Revision: 1.2 $ * $Source: /home/interpeak/CVSRoot/ipmipfa/src/ipmipfa_mip_mib.c,v $ * $Author: joel $ * $State: Exp $ $Locker: $ * * Copyright Interpeak AB 2000-2003 . All rights reserved. * Design and implementation by Markus Carlstedt ****************************************************************************** */ /* **************************************************************************** * 1 DESCRIPTION **************************************************************************** */ /* *=========================================================================== * MIP-MIB *=========================================================================== * * Autogenerated by 'ipmibc' with 'smidump 0.4.5' on 2007-04-10 at 13:11:58 * * This file includes initialization code and stubs for MIB variables defined * in MIP-MIB. Without any changes it should compile and run with the * behaviour that GetRequests succeed with the returned value being * zero. SetRequests also succeed but without any actual variables * being updated. * * Modifications to this file are necessary in order to enable read and * write operations on actual variables presented in the MIB interface. * Each segment in the code where a change is proposed is marked with a * 'MIB_TODO' comment together with a pseudo code example describing the * modification. * * This file shall normally be compiled together with the product to which * SNMP support is to be added and then linked with the IPSNMP libraries. * The MIB is initialized by calling the public initialization function defined * at the end of this file. Since no header files are generated its function * prototype should be copied into the the product that initializes the MIB. * */ /* **************************************************************************** * 2 CONFIGURATION **************************************************************************** */ /* **************************************************************************** * 3 INCLUDE FILES **************************************************************************** */ #define IPCOM_USE_CLIB_PROTO #include #include #include #include #include #ifdef IPSNMP #include #include #include "ipmipfa_attr.h" /* **************************************************************************** * 4 DEFINES **************************************************************************** */ #ifdef IPCOM_SYSLOG_FACILITY #undef IPCOM_SYSLOG_FACILITY #endif #define IPCOM_SYSLOG_FACILITY IPCOM_LOG_IPSNMP #ifdef IPCOM_SYSLOG_PRIORITY #undef IPCOM_SYSLOG_PRIORITY #endif #define IPCOM_SYSLOG_PRIORITY IPCOM_LOG_DEBUG /* **************************************************************************** * 5 TYPES **************************************************************************** */ /* **************************************************************************** * 6 EXTERNAL PROTOTYPES **************************************************************************** */ /* **************************************************************************** * 7 LOCAL PROTOTYPES **************************************************************************** */ /* Initialization function */ IP_PUBLIC Ip_err ipmipfa_mip_mib_init(void); /* **************************************************************************** * 8 DATA **************************************************************************** */ /* **************************************************************************** * 9 STATIC FUNCTIONS **************************************************************************** */ #define IPMIPFA_MIB_GET_TABLE_LEN(table, len) \ { \ struct Ipmipfa_mib_##table **hdr = ipmipfa_attr_mib_##table(); \ int ii = 0; \ if (hdr) \ { \ for (ii = 0; hdr[ii] != IP_NULL; ii++) \ ; \ ipcom_free(hdr); \ } \ len = ii; \ } #define IPMIPFA_MIB_GET_ENTRY2(table, var, i, dest) \ { \ struct Ipmipfa_mib_##table **hdr = ipmipfa_attr_mib_##table(); \ if (hdr) \ { \ dest = hdr[i]->var; \ ipcom_free(hdr); \ } \ } #define IPMIPFA_MIB_GET_ENTRY(table, var, i) \ IPMIPFA_MIB_GET_ENTRY2(table, var, i, var) #define IPMIPFA_MIB_GET_ADDR(table, var, i) \ IPMIPFA_MIB_GET_ENTRY2(table, var.s_addr, i, var) /* { \ struct Ipmipfa_mib_##table **hdr = ipmipfa_attr_mib_##table(); \ if (hdr) \ { \ var = hdr[i]->var.s_addr; \ ipcom_free(hdr); \ } \ } */ #define IPMIPFA_MIB_GET(var, strct) \ { \ struct Ipmipfa_mib_##strct *entry = ipmipfa_attr_mib_##strct(); \ if (entry) \ { \ var = entry->var; \ ipcom_free(entry); \ } \ } #define IPMIPFA_MIB_GET2(var, strct, dst) \ { \ struct Ipmipfa_mib_##strct *entry = ipmipfa_attr_mib_##strct(); \ dst = entry->var; \ ipcom_free(entry); \ } #if 0 /* *=========================================================================== * ipmipfa_mip_mib_handler_faIsBusy *=========================================================================== * Description: MIB handler for faIsBusy * Parameters: See file 'ipsnmp.h' * Returns: IPSNMP_ERROR_XXX * */ IP_STATIC Ip_s32 ipmipfa_mip_mib_handler_faIsBusy(Ip_s32 cmd, char *id, Ipsnmp_varbind *vb, Ip_s32 magic, struct Ipsnmp_node_object *nodeobj) { Ip_s32 ret = -1; Ip_s32 faIsBusy = 0; char *iid; (void)id; (void)vb; if(cmd == IPSNMP_MIB_COMMAND_GET || cmd == IPSNMP_MIB_COMMAND_NEXT) { iid = ipsnmp_create_iid_integer(nodeobj->id, 0); if(iid == IP_NULL) return IPSNMP_ERROR_GENERROR; /* * * faIsBusy := Current_MIB_Variable_faIsBusy */ IPMIPFA_MIB_GET(faIsBusy,faAdvertisement) ret = ipsnmp_util_put_integer(magic, iid, faIsBusy); ipcom_free(iid); } return ret; } /* *=========================================================================== * ipmipfa_mip_mib_handler_faRegistrationRequired *=========================================================================== * Description: MIB handler for faRegistrationRequired * Parameters: See file 'ipsnmp.h' * Returns: IPSNMP_ERROR_XXX * */ IP_STATIC Ip_s32 ipmipfa_mip_mib_handler_faRegistrationRequired(Ip_s32 cmd, char *id, Ipsnmp_varbind *vb, Ip_s32 magic, struct Ipsnmp_node_object *nodeobj) { Ip_s32 ret = -1; Ip_s32 faRegistrationRequired = 0; char *iid; (void)id; if(cmd == IPSNMP_MIB_COMMAND_GET || cmd == IPSNMP_MIB_COMMAND_NEXT) { iid = ipsnmp_create_iid_integer(nodeobj->id, 0); if(iid == IP_NULL) return IPSNMP_ERROR_GENERROR; /* * * faRegistrationRequired := Current_MIB_Variable_faRegistrationRequired */ IPMIPFA_MIB_GET(faRegistrationRequired,faAdvertisement) ret = ipsnmp_util_put_integer(magic, iid, faRegistrationRequired); ipcom_free(iid); } if(cmd == IPSNMP_MIB_COMMAND_TEST || cmd == IPSNMP_MIB_COMMAND_SET) { ret = ipsnmp_util_get_integer(vb, &faRegistrationRequired); if(ret == IPSNMP_ERROR_NOERROR) { /* todo * * if New_Value_Of_MIB_Variable_faRegistrationRequired_Is_Invalid = true then * ret := IPSNMP_ERROR_WRONGVALUE * endif */ ret = IPSNMP_ERROR_READONLY; } if(ret == IPSNMP_ERROR_NOERROR && cmd == IPSNMP_MIB_COMMAND_SET) { /* todo * * Current_MIB_Variable_faRegistrationRequired := faRegistrationRequired */ ret = IPSNMP_ERROR_READONLY; } } return ret; } #endif /* *=========================================================================== * ipmipfa_mip_mib_handler_faRegRequestsReceived *=========================================================================== * Description: MIB handler for faRegRequestsReceived * Parameters: See file 'ipsnmp.h' * Returns: IPSNMP_ERROR_XXX * */ IP_STATIC Ip_s32 ipmipfa_mip_mib_handler_faRegRequestsReceived(Ip_s32 cmd, char *id, Ipsnmp_varbind *vb, Ip_s32 magic, struct Ipsnmp_node_object *nodeobj) { Ip_s32 ret = -1; Ip_u32 faRegRequestsReceived = 0; char *iid; (void)id; (void)vb; if(cmd == IPSNMP_MIB_COMMAND_GET || cmd == IPSNMP_MIB_COMMAND_NEXT) { iid = ipsnmp_create_iid_integer(nodeobj->id, 0); if(iid == IP_NULL) return IPSNMP_ERROR_GENERROR; /* * * faRegRequestsReceived := Current_MIB_Variable_faRegRequestsReceived */ IPMIPFA_MIB_GET(faRegRequestsReceived, RegistrationCounters) ret = ipsnmp_util_put_counter32(magic, iid, faRegRequestsReceived); ipcom_free(iid); } return ret; } /* *=========================================================================== * ipmipfa_mip_mib_handler_faRegRequestsRelayed *=========================================================================== * Description: MIB handler for faRegRequestsRelayed * Parameters: See file 'ipsnmp.h' * Returns: IPSNMP_ERROR_XXX * */ IP_STATIC Ip_s32 ipmipfa_mip_mib_handler_faRegRequestsRelayed(Ip_s32 cmd, char *id, Ipsnmp_varbind *vb, Ip_s32 magic, struct Ipsnmp_node_object *nodeobj) { Ip_s32 ret = -1; Ip_u32 faRegRequestsRelayed = 0; char *iid; (void)id; (void)vb; if(cmd == IPSNMP_MIB_COMMAND_GET || cmd == IPSNMP_MIB_COMMAND_NEXT) { iid = ipsnmp_create_iid_integer(nodeobj->id, 0); if(iid == IP_NULL) return IPSNMP_ERROR_GENERROR; /* * * faRegRequestsRelayed := Current_MIB_Variable_faRegRequestsRelayed */ IPMIPFA_MIB_GET(faRegRequestsRelayed, RegistrationCounters) ret = ipsnmp_util_put_counter32(magic, iid, faRegRequestsRelayed); ipcom_free(iid); } return ret; } /* *=========================================================================== * ipmipfa_mip_mib_handler_faReasonUnspecified *=========================================================================== * Description: MIB handler for faReasonUnspecified * Parameters: See file 'ipsnmp.h' * Returns: IPSNMP_ERROR_XXX * */ IP_STATIC Ip_s32 ipmipfa_mip_mib_handler_faReasonUnspecified(Ip_s32 cmd, char *id, Ipsnmp_varbind *vb, Ip_s32 magic, struct Ipsnmp_node_object *nodeobj) { Ip_s32 ret = -1; Ip_u32 faReasonUnspecified = 0; char *iid; (void)id; (void)vb; if(cmd == IPSNMP_MIB_COMMAND_GET || cmd == IPSNMP_MIB_COMMAND_NEXT) { iid = ipsnmp_create_iid_integer(nodeobj->id, 0); if(iid == IP_NULL) return IPSNMP_ERROR_GENERROR; /* * * faReasonUnspecified := Current_MIB_Variable_faReasonUnspecified */ IPMIPFA_MIB_GET(faReasonUnspecified, RegistrationCounters) ret = ipsnmp_util_put_counter32(magic, iid, faReasonUnspecified); ipcom_free(iid); } return ret; } /* *=========================================================================== * ipmipfa_mip_mib_handler_faAdmProhibited *=========================================================================== * Description: MIB handler for faAdmProhibited * Parameters: See file 'ipsnmp.h' * Returns: IPSNMP_ERROR_XXX * */ IP_STATIC Ip_s32 ipmipfa_mip_mib_handler_faAdmProhibited(Ip_s32 cmd, char *id, Ipsnmp_varbind *vb, Ip_s32 magic, struct Ipsnmp_node_object *nodeobj) { Ip_s32 ret = -1; Ip_u32 faAdmProhibited = 0; char *iid; (void)id; (void)vb; if(cmd == IPSNMP_MIB_COMMAND_GET || cmd == IPSNMP_MIB_COMMAND_NEXT) { iid = ipsnmp_create_iid_integer(nodeobj->id, 0); if(iid == IP_NULL) return IPSNMP_ERROR_GENERROR; /* * * faAdmProhibited := Current_MIB_Variable_faAdmProhibited */ IPMIPFA_MIB_GET(faAdmProhibited,RegistrationCounters) ret = ipsnmp_util_put_counter32(magic, iid, faAdmProhibited); ipcom_free(iid); } return ret; } /* *=========================================================================== * ipmipfa_mip_mib_handler_faInsufficientResource *=========================================================================== * Description: MIB handler for faInsufficientResource * Parameters: See file 'ipsnmp.h' * Returns: IPSNMP_ERROR_XXX * */ IP_STATIC Ip_s32 ipmipfa_mip_mib_handler_faInsufficientResource(Ip_s32 cmd, char *id, Ipsnmp_varbind *vb, Ip_s32 magic, struct Ipsnmp_node_object *nodeobj) { Ip_s32 ret = -1; Ip_u32 faInsufficientResource = 0; char *iid; (void)id; (void)vb; if(cmd == IPSNMP_MIB_COMMAND_GET || cmd == IPSNMP_MIB_COMMAND_NEXT) { iid = ipsnmp_create_iid_integer(nodeobj->id, 0); if(iid == IP_NULL) return IPSNMP_ERROR_GENERROR; /* * * faInsufficientResource := Current_MIB_Variable_faInsufficientResource */ IPMIPFA_MIB_GET(faInsufficientResource,RegistrationCounters) ret = ipsnmp_util_put_counter32(magic, iid, faInsufficientResource); ipcom_free(iid); } return ret; } /* *=========================================================================== * ipmipfa_mip_mib_handler_faMNAuthenticationFailure *=========================================================================== * Description: MIB handler for faMNAuthenticationFailure * Parameters: See file 'ipsnmp.h' * Returns: IPSNMP_ERROR_XXX * */ IP_STATIC Ip_s32 ipmipfa_mip_mib_handler_faMNAuthenticationFailure(Ip_s32 cmd, char *id, Ipsnmp_varbind *vb, Ip_s32 magic, struct Ipsnmp_node_object *nodeobj) { Ip_s32 ret = -1; Ip_u32 faMNAuthenticationFailure = 0; char *iid; (void)id; (void)vb; if(cmd == IPSNMP_MIB_COMMAND_GET || cmd == IPSNMP_MIB_COMMAND_NEXT) { iid = ipsnmp_create_iid_integer(nodeobj->id, 0); if(iid == IP_NULL) return IPSNMP_ERROR_GENERROR; /* * * faMNAuthenticationFailure := Current_MIB_Variable_faMNAuthenticationFailure */ IPMIPFA_MIB_GET(faMNAuthenticationFailure,RegistrationCounters) ret = ipsnmp_util_put_counter32(magic, iid, faMNAuthenticationFailure); ipcom_free(iid); } return ret; } /* *=========================================================================== * ipmipfa_mip_mib_handler_faRegLifetimeTooLong *=========================================================================== * Description: MIB handler for faRegLifetimeTooLong * Parameters: See file 'ipsnmp.h' * Returns: IPSNMP_ERROR_XXX * */ IP_STATIC Ip_s32 ipmipfa_mip_mib_handler_faRegLifetimeTooLong(Ip_s32 cmd, char *id, Ipsnmp_varbind *vb, Ip_s32 magic, struct Ipsnmp_node_object *nodeobj) { Ip_s32 ret = -1; Ip_u32 faRegLifetimeTooLong = 0; char *iid; (void)id; (void)vb; if(cmd == IPSNMP_MIB_COMMAND_GET || cmd == IPSNMP_MIB_COMMAND_NEXT) { iid = ipsnmp_create_iid_integer(nodeobj->id, 0); if(iid == IP_NULL) return IPSNMP_ERROR_GENERROR; /* * * faRegLifetimeTooLong := Current_MIB_Variable_faRegLifetimeTooLong */ IPMIPFA_MIB_GET(faRegLifetimeTooLong,RegistrationCounters) ret = ipsnmp_util_put_counter32(magic, iid, faRegLifetimeTooLong); ipcom_free(iid); } return ret; } /* *=========================================================================== * ipmipfa_mip_mib_handler_faPoorlyFormedRequests *=========================================================================== * Description: MIB handler for faPoorlyFormedRequests * Parameters: See file 'ipsnmp.h' * Returns: IPSNMP_ERROR_XXX * */ IP_STATIC Ip_s32 ipmipfa_mip_mib_handler_faPoorlyFormedRequests(Ip_s32 cmd, char *id, Ipsnmp_varbind *vb, Ip_s32 magic, struct Ipsnmp_node_object *nodeobj) { Ip_s32 ret = -1; Ip_u32 faPoorlyFormedRequests = 0; char *iid; (void)id; (void)vb; if(cmd == IPSNMP_MIB_COMMAND_GET || cmd == IPSNMP_MIB_COMMAND_NEXT) { iid = ipsnmp_create_iid_integer(nodeobj->id, 0); if(iid == IP_NULL) return IPSNMP_ERROR_GENERROR; /* * * faPoorlyFormedRequests := Current_MIB_Variable_faPoorlyFormedRequests */ IPMIPFA_MIB_GET(faPoorlyFormedRequests,RegistrationCounters) ret = ipsnmp_util_put_counter32(magic, iid, faPoorlyFormedRequests); ipcom_free(iid); } return ret; } /* *=========================================================================== * ipmipfa_mip_mib_handler_faEncapsulationUnavailable *=========================================================================== * Description: MIB handler for faEncapsulationUnavailable * Parameters: See file 'ipsnmp.h' * Returns: IPSNMP_ERROR_XXX * */ IP_STATIC Ip_s32 ipmipfa_mip_mib_handler_faEncapsulationUnavailable(Ip_s32 cmd, char *id, Ipsnmp_varbind *vb, Ip_s32 magic, struct Ipsnmp_node_object *nodeobj) { Ip_s32 ret = -1; Ip_u32 faEncapsulationUnavailable = 0; char *iid; (void)id; (void)vb; if(cmd == IPSNMP_MIB_COMMAND_GET || cmd == IPSNMP_MIB_COMMAND_NEXT) { iid = ipsnmp_create_iid_integer(nodeobj->id, 0); if(iid == IP_NULL) return IPSNMP_ERROR_GENERROR; /* * * faEncapsulationUnavailable := Current_MIB_Variable_faEncapsulationUnavailable */ IPMIPFA_MIB_GET(faEncapsulationUnavailable,RegistrationCounters) ret = ipsnmp_util_put_counter32(magic, iid, faEncapsulationUnavailable); ipcom_free(iid); } return ret; } /* *=========================================================================== * ipmipfa_mip_mib_handler_faVJCompressionUnavailable *=========================================================================== * Description: MIB handler for faVJCompressionUnavailable * Parameters: See file 'ipsnmp.h' * Returns: IPSNMP_ERROR_XXX * */ IP_STATIC Ip_s32 ipmipfa_mip_mib_handler_faVJCompressionUnavailable(Ip_s32 cmd, char *id, Ipsnmp_varbind *vb, Ip_s32 magic, struct Ipsnmp_node_object *nodeobj) { Ip_s32 ret = -1; Ip_u32 faVJCompressionUnavailable = 0; char *iid; (void)id; (void)vb; if(cmd == IPSNMP_MIB_COMMAND_GET || cmd == IPSNMP_MIB_COMMAND_NEXT) { iid = ipsnmp_create_iid_integer(nodeobj->id, 0); if(iid == IP_NULL) return IPSNMP_ERROR_GENERROR; /* * * faVJCompressionUnavailable := Current_MIB_Variable_faVJCompressionUnavailable */ IPMIPFA_MIB_GET(faVJCompressionUnavailable,RegistrationCounters) ret = ipsnmp_util_put_counter32(magic, iid, faVJCompressionUnavailable); ipcom_free(iid); } return ret; } /* *=========================================================================== * ipmipfa_mip_mib_handler_faHAUnreachable *=========================================================================== * Description: MIB handler for faHAUnreachable * Parameters: See file 'ipsnmp.h' * Returns: IPSNMP_ERROR_XXX * */ IP_STATIC Ip_s32 ipmipfa_mip_mib_handler_faHAUnreachable(Ip_s32 cmd, char *id, Ipsnmp_varbind *vb, Ip_s32 magic, struct Ipsnmp_node_object *nodeobj) { Ip_s32 ret = -1; Ip_u32 faHAUnreachable = 0; char *iid; (void)id; (void)vb; if(cmd == IPSNMP_MIB_COMMAND_GET || cmd == IPSNMP_MIB_COMMAND_NEXT) { iid = ipsnmp_create_iid_integer(nodeobj->id, 0); if(iid == IP_NULL) return IPSNMP_ERROR_GENERROR; /* * * */ IPMIPFA_MIB_GET(faHAUnreachable,RegistrationCounters) ret = ipsnmp_util_put_counter32(magic, iid, faHAUnreachable); ipcom_free(iid); } return ret; } /* *=========================================================================== * ipmipfa_mip_mib_handler_faRegRepliesRecieved *=========================================================================== * Description: MIB handler for faRegRepliesRecieved * Parameters: See file 'ipsnmp.h' * Returns: IPSNMP_ERROR_XXX * */ IP_STATIC Ip_s32 ipmipfa_mip_mib_handler_faRegRepliesRecieved(Ip_s32 cmd, char *id, Ipsnmp_varbind *vb, Ip_s32 magic, struct Ipsnmp_node_object *nodeobj) { Ip_s32 ret = -1; Ip_u32 faRegRepliesRecieved = 0; char *iid; (void)id; (void)vb; if(cmd == IPSNMP_MIB_COMMAND_GET || cmd == IPSNMP_MIB_COMMAND_NEXT) { iid = ipsnmp_create_iid_integer(nodeobj->id, 0); if(iid == IP_NULL) return IPSNMP_ERROR_GENERROR; /* * * faRegRepliesRecieved := Current_MIB_Variable_faRegRepliesRecieved */ IPMIPFA_MIB_GET(faRegRepliesRecieved,RegistrationCounters) ret = ipsnmp_util_put_counter32(magic, iid, faRegRepliesRecieved); ipcom_free(iid); } return ret; } /* *=========================================================================== * ipmipfa_mip_mib_handler_faRegRepliesRelayed *=========================================================================== * Description: MIB handler for faRegRepliesRelayed * Parameters: See file 'ipsnmp.h' * Returns: IPSNMP_ERROR_XXX * */ IP_STATIC Ip_s32 ipmipfa_mip_mib_handler_faRegRepliesRelayed(Ip_s32 cmd, char *id, Ipsnmp_varbind *vb, Ip_s32 magic, struct Ipsnmp_node_object *nodeobj) { Ip_s32 ret = -1; Ip_u32 faRegRepliesRelayed = 0; char *iid; (void)id; (void)vb; if(cmd == IPSNMP_MIB_COMMAND_GET || cmd == IPSNMP_MIB_COMMAND_NEXT) { iid = ipsnmp_create_iid_integer(nodeobj->id, 0); if(iid == IP_NULL) return IPSNMP_ERROR_GENERROR; /* * * faRegRepliesRelayed := Current_MIB_Variable_faRegRepliesRelayed */ IPMIPFA_MIB_GET(faRegRepliesRelayed,RegistrationCounters) ret = ipsnmp_util_put_counter32(magic, iid, faRegRepliesRelayed); ipcom_free(iid); } return ret; } /* *=========================================================================== * ipmipfa_mip_mib_handler_faHAAuthenticationFailure *=========================================================================== * Description: MIB handler for faHAAuthenticationFailure * Parameters: See file 'ipsnmp.h' * Returns: IPSNMP_ERROR_XXX * */ IP_STATIC Ip_s32 ipmipfa_mip_mib_handler_faHAAuthenticationFailure(Ip_s32 cmd, char *id, Ipsnmp_varbind *vb, Ip_s32 magic, struct Ipsnmp_node_object *nodeobj) { Ip_s32 ret = -1; Ip_u32 faHAAuthenticationFailure = 0; char *iid; (void)id; (void)vb; if(cmd == IPSNMP_MIB_COMMAND_GET || cmd == IPSNMP_MIB_COMMAND_NEXT) { iid = ipsnmp_create_iid_integer(nodeobj->id, 0); if(iid == IP_NULL) return IPSNMP_ERROR_GENERROR; /* * * faHAAuthenticationFailure := Current_MIB_Variable_faHAAuthenticationFailure */ IPMIPFA_MIB_GET(faHAAuthenticationFailure,RegistrationCounters) ret = ipsnmp_util_put_counter32(magic, iid, faHAAuthenticationFailure); ipcom_free(iid); } return ret; } /* *=========================================================================== * ipmipfa_mip_mib_handler_faPoorlyFormedReplies *=========================================================================== * Description: MIB handler for faPoorlyFormedReplies * Parameters: See file 'ipsnmp.h' * Returns: IPSNMP_ERROR_XXX * */ IP_STATIC Ip_s32 ipmipfa_mip_mib_handler_faPoorlyFormedReplies(Ip_s32 cmd, char *id, Ipsnmp_varbind *vb, Ip_s32 magic, struct Ipsnmp_node_object *nodeobj) { Ip_s32 ret = -1; Ip_u32 faPoorlyFormedReplies = 0; char *iid; (void)id; (void)vb; if(cmd == IPSNMP_MIB_COMMAND_GET || cmd == IPSNMP_MIB_COMMAND_NEXT) { iid = ipsnmp_create_iid_integer(nodeobj->id, 0); if(iid == IP_NULL) return IPSNMP_ERROR_GENERROR; /* * * faPoorlyFormedReplies := Current_MIB_Variable_faPoorlyFormedReplies */ IPMIPFA_MIB_GET(faPoorlyFormedReplies,RegistrationCounters) ret = ipsnmp_util_put_counter32(magic, iid, faPoorlyFormedReplies); ipcom_free(iid); } return ret; } #if 0 /* *=========================================================================== * ipmipfa_mip_mib_table_search_faCOATable *=========================================================================== * Description: Searches faCOATable for a matching entry * Parameters: id, buf, best, cmd * Returns: Row index of the found entry OR -1 if not found OR -2 for error * */ IP_STATIC Ip_s32 ipmipfa_mip_mib_table_search_faCOATable(char *id, char *buf, char *best, Ip_s32 cmd) { Ip_u32 faSupportedCOA = 0; Ip_s32 faCOATable_num_entries = 0; Ip_s32 i, bestindex = -1; /* * * faCOATable_num_entries := Number_Of_Entries_In_Current_faCOATable */ IPMIPFA_MIB_GET_TABLE_LEN(faCOAEntry, faCOATable_num_entries) for(i=0; i 0) { if(bestindex == -1 || ipsnmp_util_lexcmp_oid(buf, best) < 0) { ipcom_strcpy(best, buf); bestindex = i; } } } else { if(lex == 0) { ipcom_strcpy(best, buf); bestindex = i; break; } } } return bestindex; } /* *=========================================================================== * ipmipfa_mip_mib_table_search_faVisitorTable *=========================================================================== * Description: Searches faVisitorTable for a matching entry * Parameters: id, buf, best, cmd * Returns: Row index of the found entry OR -1 if not found OR -2 for error * */ IP_STATIC Ip_s32 ipmipfa_mip_mib_table_search_faVisitorTable(char *id, char *buf, char *best, Ip_s32 cmd) { Ip_u32 faVisitorIPAddress = 0; Ip_s32 faVisitorTable_num_entries = 0; Ip_s32 i, bestindex = -1; /* * * faVisitorTable_num_entries := Number_Of_Entries_In_Current_faVisitorTable */ IPMIPFA_MIB_GET_TABLE_LEN(faVisitorEntry, faVisitorTable_num_entries) for(i=0; i 0) { if(bestindex == -1 || ipsnmp_util_lexcmp_oid(buf, best) < 0) { ipcom_strcpy(best, buf); bestindex = i; } } } else { if(lex == 0) { ipcom_strcpy(best, buf); bestindex = i; break; } } } return bestindex; } /* *=========================================================================== * ipmipfa_mip_mib_handler_faCOATable *=========================================================================== * Description: MIB handler for faCOATable * Parameters: See file 'ipsnmp.h' * Returns: IPSNMP_ERROR_XXX * */ IP_STATIC Ip_s32 ipmipfa_mip_mib_handler_faCOATable(Ip_s32 cmd, char *id, Ipsnmp_varbind *vb, Ip_s32 magic, struct Ipsnmp_node_object *nodeobj) { Ip_s32 lid, bestindex, ret = -1; char *iid = IP_NULL; char *buf = ipcom_malloc(IPSNMP_CONFIG_MAX_OBJECT_ID); char *best = ipcom_malloc(IPSNMP_CONFIG_MAX_OBJECT_ID); if(buf == IP_NULL || best == IP_NULL) { ret = IPSNMP_ERROR_GENERROR; goto exit; } lid = ipsnmp_util_last_subid(nodeobj->id); bestindex = ipmipfa_mip_mib_table_search_faCOATable(id, buf, best, cmd); if(bestindex == -2) { ret = IPSNMP_ERROR_GENERROR; goto exit; } else if(bestindex == -1) { ret = IPSNMP_ERROR_NOSUCHNAME; goto exit; } iid = ipsnmp_create_iid_direct(nodeobj->id, best); if(iid == IP_NULL) { ret = IPSNMP_ERROR_GENERROR; goto exit; } switch(lid) { case 2: /* faCOAStatus */ { Ip_s32 faCOAStatus = 0; if(cmd == IPSNMP_MIB_COMMAND_GET || cmd == IPSNMP_MIB_COMMAND_NEXT) { /* * * faCOAStatus := Current_MIB_Variable_faCOAStatus in row no. bestindex */ IPMIPFA_MIB_GET_ENTRY(faCOAEntry, faCOAStatus, bestindex) ret = ipsnmp_util_put_integer(magic, iid, faCOAStatus); } if(cmd == IPSNMP_MIB_COMMAND_TEST || cmd == IPSNMP_MIB_COMMAND_SET) { ret = ipsnmp_util_get_integer(vb, &faCOAStatus); if(ret == IPSNMP_ERROR_NOERROR) { /* todo * * if New_Value_Of_MIB_Variable_faCOAStatus_Is_Invalid = true then * ret := IPSNMP_ERROR_WRONGVALUE * endif */ ret = IPSNMP_ERROR_READONLY; } if(ret == IPSNMP_ERROR_NOERROR && cmd == IPSNMP_MIB_COMMAND_SET) { /* todo * * Current_MIB_Variable_faCOAStatus in row no. bestindex := faCOAStatus */ ret = IPSNMP_ERROR_READONLY; } } break; } default: IP_PANIC(); ret = IPSNMP_ERROR_GENERROR; break; } exit: if(iid != IP_NULL) ipcom_free(iid); if(buf != IP_NULL) ipcom_free(buf); if(best != IP_NULL) ipcom_free(best); return ret; } /* *=========================================================================== * ipmipfa_mip_mib_handler_faVisitorTable *=========================================================================== * Description: MIB handler for faVisitorTable * Parameters: See file 'ipsnmp.h' * Returns: IPSNMP_ERROR_XXX * */ IP_STATIC Ip_s32 ipmipfa_mip_mib_handler_faVisitorTable(Ip_s32 cmd, char *id, Ipsnmp_varbind *vb, Ip_s32 magic, struct Ipsnmp_node_object *nodeobj) { Ip_s32 lid, bestindex, ret = -1; char *iid = IP_NULL; char *buf = ipcom_malloc(IPSNMP_CONFIG_MAX_OBJECT_ID); char *best = ipcom_malloc(IPSNMP_CONFIG_MAX_OBJECT_ID); if(buf == IP_NULL || best == IP_NULL) { ret = IPSNMP_ERROR_GENERROR; goto exit; } lid = ipsnmp_util_last_subid(nodeobj->id); bestindex = ipmipfa_mip_mib_table_search_faVisitorTable(id, buf, best, cmd); if(bestindex == -2) { ret = IPSNMP_ERROR_GENERROR; goto exit; } else if(bestindex == -1) { ret = IPSNMP_ERROR_NOSUCHNAME; goto exit; } iid = ipsnmp_create_iid_direct(nodeobj->id, best); if(iid == IP_NULL) { ret = IPSNMP_ERROR_GENERROR; goto exit; } switch(lid) { case 1: /* faVisitorIPAddress */ { Ip_u32 faVisitorIPAddress = 0; if(cmd == IPSNMP_MIB_COMMAND_GET || cmd == IPSNMP_MIB_COMMAND_NEXT) { /* * * faVisitorIPAddress := Current_MIB_Variable_faVisitorIPAddress in row no. bestindex */ IPMIPFA_MIB_GET_FAVISITOR_addr(faVisitorIPAddress, bestindex) ret = ipsnmp_util_put_ipaddress(magic, iid, faVisitorIPAddress); } break; } case 2: /* faVisitorHomeAddress */ { Ip_u32 faVisitorHomeAddress = 0; if(cmd == IPSNMP_MIB_COMMAND_GET || cmd == IPSNMP_MIB_COMMAND_NEXT) { /* * * faVisitorHomeAddress := Current_MIB_Variable_faVisitorHomeAddress in row no. bestindex */ IPMIPFA_MIB_GET_FAVISITOR_addr(faVisitorHomeAddress, bestindex) ret = ipsnmp_util_put_ipaddress(magic, iid, faVisitorHomeAddress); } break; } case 3: /* faVisitorHomeAgentAddress */ { Ip_u32 faVisitorHomeAgentAddress = 0; if(cmd == IPSNMP_MIB_COMMAND_GET || cmd == IPSNMP_MIB_COMMAND_NEXT) { /* * * faVisitorHomeAgentAddress := Current_MIB_Variable_faVisitorHomeAgentAddress in row no. bestindex */ IPMIPFA_MIB_GET_FAVISITOR_addr(faVisitorHomeAgentAddress, bestindex) ret = ipsnmp_util_put_ipaddress(magic, iid, faVisitorHomeAgentAddress); } break; } case 4: /* faVisitorTimeGranted */ { Ip_s32 faVisitorTimeGranted = 0; if(cmd == IPSNMP_MIB_COMMAND_GET || cmd == IPSNMP_MIB_COMMAND_NEXT) { /* * * faVisitorTimeGranted := Current_MIB_Variable_faVisitorTimeGranted in row no. bestindex */ IPMIPFA_MIB_GET_ENTRY(faVisitorEntry, faVisitorTimeGranted, bestindex) ret = ipsnmp_util_put_integer(magic, iid, faVisitorTimeGranted); } break; } case 5: /* faVisitorTimeRemaining */ { Ip_u32 faVisitorTimeRemaining = 0; if(cmd == IPSNMP_MIB_COMMAND_GET || cmd == IPSNMP_MIB_COMMAND_NEXT) { /* * * faVisitorTimeRemaining := Current_MIB_Variable_faVisitorTimeRemaining in row no. bestindex */ IPMIPFA_MIB_GET_ENTRY(faVisitorEntry, faVisitorTimeRemaining, bestindex) ret = ipsnmp_util_put_gauge32(magic, iid, faVisitorTimeRemaining); } break; } case 6: /* faVisitorRegFlags */ { char *faVisitorRegFlags = ""; if(cmd == IPSNMP_MIB_COMMAND_GET || cmd == IPSNMP_MIB_COMMAND_NEXT) { /* * * faVisitorRegFlags := Current_MIB_Variable_faVisitorRegFlags in row no. bestindex */ { Ip_u32 tmp; chas f[2] = {0,0}; int i; IPMIPFA_MIB_GET_ENTRY2(faVisitorEntry, faVisitorRegFlags, bestindex, tmp); for (i=0; i<6; i++) /* reverse bits */ f[0] |= (tmp & (1<