Files
m241Neelima/components/ip_net2-6.9/wrsnmp/src/mip6mn_mth.c
T
2026-07-30 11:19:44 +05:30

4453 lines
159 KiB
C

/******************************************************************************
******************************************************************************
**** This file was automatically generated by Wind River's
**** MIB Compiler, version 10.1.
**** This file was generated using the -stub switch.
****
**** This file contains stub function declarations to aid in building
**** the agent MIB interface. It creates all the MIB get, set, test, and
**** next method routines that you will need to supply. However,
**** since it doesn't know your system, several things are left to you.
**** Look for comments with `!!!' in them for places you're likely to want
**** to change for your system. Also, while the layout of the method
**** routines is a commonly useful one, it will not fit all data structures
**** and systems. Look at this output as a guide to how to write your
**** method routines; a guide that will, in most cases, significantly reduce
**** the amount of typing you need to do.
****
**** The code here assumes you've created a file called `mibleaf.h' with
**** the -leaf option to the mibcompiler.
****
**** YOU WILL PROBABLY MODIFY THIS FILE BUT BEWARE ACCIDENTALLY
**** OVERWRITING IT BY REGENERATING IT WITH THE MIB COMPILER.
****
**** Last build date: Mon May 14 15:51:03 2007
**** from files:
**** /usr/share/mibs/ietf/INET-ADDRESS-MIB, /usr/share/mibs/ietf/SNMPv2-MIB,
**** ../../IANAifType-MIB, /usr/share/mibs/ietf/IF-MIB,
**** /usr/share/mibs/ietf/IP-MIB, rfc4295.mib
**** starting from node: mip6MIB
******************************************************************************
******************************************************************************
*/
#ifdef WRSNMP
#ifdef IPMIP6MN
#include <wrn/wm/snmp/engine/asn1conf.h>
#include <wrn/wm/snmp/engine/asn1.h>
#include <wrn/wm/snmp/engine/buffer.h>
#include <wrn/wm/snmp/engine/mib.h>
#include <wrn/wm/snmp/engine/localio.h>
#include <wrn/wm/snmp/engine/snmpdefs.h>
#include <wrn/wm/snmp/engine/snmp.h>
#include <wrn/wm/snmp/engine/auxfuncs.h>
#include "mip6_mth.h"
#if 1
#include <ipcom_type.h>
#include <ipcom_cstyle.h>
#include <ipcom_clib.h>
#include <ipcom_syslog.h>
#include <ipcom_err.h>
#include <ipmip6mn_cli.h>
#include <private/ipmip_context.h>
#include <private/ipmip_cli.h>
#include <ipmip6_mib.h>
#include <ipcom_ipd.h>
#include <ipmip6mn_attr.h>
/* Information regarding one mobile node network */
typedef struct Ipmip6_io_network_info
{
struct Ipmip6_mib_mip6MnHomeAddressEntry ini_mip6MnHomeAddressEntry;
struct Ipmip6_mib_mip6MnConf ini_mip6MnConf;
struct Ipmip6_mib_mip6MnRegnCounters ini_mip6MnRegnCounters;
struct Ipmip6_mib_mip6TotalTraffic ini_mip6TotalTraffic;
struct Ipmip6_mib_mip6MnBLTable ini_mip6MnBLTable;
int ind_ro_mip6MnBLTableSize;
struct Ipmip6_mib_mip6MnBLTable ind_ro_mip6MnBLTable[1];
}
Ipmip6_io_network_info_t;
#define IPMIP6MN_MIB_InetAddressType_ipv6 (2)
#define IPMIP6MN_MIB_ipv6_ntop_len 23
IMPORT struct Ip_tm *ipcom_localtime_r(const Ip_time_t *timep, struct Ip_tm *tm);
IMPORT Ip_size_t ipcom_strftime(char *buf, Ip_size_t maxsize, const char *format, const struct Ip_tm *tm);
/*
*===========================================================================
* ipmip6mn_mib_get
*===========================================================================
* Description:
* Parameters:
* Returns: IP_NULL on error, otherwise all data.
* Call ipmip6mn_mib_free(data) afterwards.
*
*/
IP_STATIC Ip_bool
ipmip6mn_mib_get(Ipmip6_io_network_info_t *data)
{
Ipmip_cli_daemon_t daemon;
Ipmip_cli_daemon_req_t req;
Ipmip_proc_t *proc;
Ip_bool ret = IP_FALSE;
const char *name = NULL;
daemon.fd = IP_INVALID_SOCKET;
ipmip_cli_daemon_request_init(&req);
proc = ipmip_proc_alloc();
if (proc == IP_NULL)
return IP_FALSE;
if (!ipmip6mn_cli_connect(&daemon))
goto cleanup;
if (ipmip6mn_cli_network_list(&daemon, &req, name) == IPCOM_SUCCESS)
{
Ipmip_attr_iter_t riter;
/**/
ipmip_cli_daemon_iter_request_init(&req, &riter);
while (ret == IP_FALSE && (name = ipmip6mn_cli_network_next(&riter)) != IP_NULL)
{
Ipmip_cli_daemon_req_t breq;
ipmip_cli_daemon_request_init(&breq);
/* Retrieve network */
if (ipmip6mn_cli_network_get(&daemon, &breq, name) == IPCOM_SUCCESS)
{
const struct Ipmip6_mib_mip6MnConf *mip6MnConf = ipmip6mn_cli_network_get_mip6MnConf(&breq);
const struct Ipmip6_mib_mip6MnRegnCounters *mip6MnRegnCounters = ipmip6mn_cli_network_get_mip6MnRegnCounters(&breq);
const struct Ipmip6_mib_mip6TotalTraffic *mip6TotalTraffic = ipmip6mn_cli_network_get_mip6TotalTraffic(&breq);
const struct Ipmip6_mib_mip6MnHomeAddressEntry *mip6MnHomeAddressEntry = ipmip6mn_cli_network_get_mip6MnHomeAddressEntry(&breq);
Ipmip_attr_iter_t biter;
ipcom_memcpy(&data->ini_mip6MnHomeAddressEntry,
mip6MnHomeAddressEntry,
sizeof(data->ini_mip6MnHomeAddressEntry));
ipcom_memcpy(&data->ini_mip6MnConf,
mip6MnConf,
sizeof(data->ini_mip6MnConf));
ipcom_memcpy(&data->ini_mip6MnRegnCounters,
mip6MnRegnCounters,
sizeof(data->ini_mip6MnRegnCounters));
ipcom_memcpy(&data->ini_mip6TotalTraffic,
mip6TotalTraffic,
sizeof(data->ini_mip6TotalTraffic));
if (ipmip6mn_cli_network_get_ha_bindings_iter(&breq, &biter))
{
struct Ipmip_attr *rta = ipmip6mn_cli_network_get_bindings_next(&biter);
if (rta)
{
const struct Ipmip6_mib_mip6MnBLTable *table = ipmip6mn_cli_network_get_bindings_mip6MnBLTable(rta);
ipcom_memcpy(&data->ini_mip6MnBLTable,
table,
sizeof(data->ini_mip6MnBLTable));
ret = IP_TRUE;
}
}
}
ipmip_cli_daemon_request_release(&breq);
}
}
cleanup:
ipmip_cli_daemon_disconnect(&daemon);
ipmip_cli_daemon_request_release(&req);
if (proc)
ipmip_proc_destroy(proc);
return ret;
}
/*IP_EXTERN Ipmip6_io_network_info_t *ipmip6mn_mib_get(void);
IP_EXTERN void ipmip6mn_mib_free(Ipmip6_io_network_info_t *data);*/
#define IPMIP6MN_MIB_GET(var, from) \
{ \
Ipmip6_io_network_info_t data; \
if ((ipmip6mn_mib_get(&data))) \
var = data.ini_mip6##from.var; \
} \
#define IPMIP6MN_MIB_GET2(var, from, dest) \
{ \
Ipmip6_io_network_info_t data; \
if ((ipmip6mn_mib_get(&data))) \
dest = data.ini_mip6##from.var; \
} \
#define IPMIP6MN_MIB_ntop(dest, destlen, strct) \
{ \
struct Ip_in6_addr v6; \
Ip_u8 tmp[IPMIP6MN_MIB_ipv6_ntop_len+1]; \
IPMIP6MN_MIB_GET2(dest, strct, v6); \
if (ipcom_inet_ntop(IP_AF_INET6, (void *)&v6, (char *)tmp, (Ip_size_t)sizeof(tmp)) == IP_NULL) \
return -2; \
destlen = (Ip_s32)ipcom_strlen((char *)tmp); \
dest = tmp; \
}
#if 0
#define IPMIP6MN_MIB_ntop2(dest, destlen, var, strct) \
{ \
struct Ip_in6_addr v6; \
Ip_u8 tmp[IPMIP6MN_MIB_ipv6_ntop_len+1]; \
IPMIP6MN_MIB_GET2(var, strct, v6); \
if (ipcom_inet_ntop(IP_AF_INET6, &v6, tmp, sizeof(tmp)) == IP_NULL) \
return -2; \
destlen = ipcom_strlen((Ip_s8*)tmp); \
dest = tmp; \
}
#endif
#define IPMIP6MN_MIB_strftime(dest, destlen, strct) \
{ \
struct Ip_tm tm; \
Ip_u8 stmp[32]; \
Ip_time_t u32t; \
IPMIP6MN_MIB_GET2(dest, strct, u32t); \
ipcom_localtime_r(&u32t, &tm); \
ipcom_strftime((char *)stmp, sizeof(stmp), "%b %d %H:%M:%S", &tm); \
dest = stmp; \
}
/*
*===========================================================================
* ipmip6mn_mib_free
*===========================================================================
* Description:
* Parameters: Ipmip6_io_network_info_t *data
* Returns:
*
*/
/*IP_STATIC void
ipmip6mn_mib_free(Ipmip6_io_network_info_t *data)
{
if (data != IP_NULL)
ipcom_free(data);
}*/
int mip6System_lookup()
{
Ipmip6_io_network_info_t data; \
return ipmip6mn_mib_get(&data);
}
#if 0
int mip6MnRegnCounters_lookup()
{
*data = ipmip6mn_mib_get();
return !(*data);
}
int mip6TotalTraffic_lookup(Ipmip6_io_network_info_t **data)
{
*data = ipmip6mn_mib_get();
return !(*data);
}
int mip6MnConf_lookup(Ipmip6_io_network_info_t **data)
{
*data = ipmip6mn_mib_get();
return !(*data);
}
Ipmip6_io_network_info_t *mip6MnBLEntry_lookup(int tcount, OIDC_T *tlist)
{
return ipmip6mn_mib_get();
}
Ipmip6_io_network_info_t *mip6MnBLEntry_first()
{
return ipmip6mn_mib_get();
}
Ipmip6_io_network_info_t *mip6MnHomeAddressEntry_first()
{
return ipmip6mn_mib_get();
}
Ipmip6_io_network_info_t *mip6MnBLEntry_int_next(Ipmip6_io_network_info_t *data)
{
(void)data;
return IP_NULL;
}
Ipmip6_io_network_info_t *mip6MnHomeAddressEntry_int_next(Ipmip6_io_network_info_t *data)
{
(void)data;
return IP_NULL;
}
#endif
unsigned mip6MnBLEntry_build_instance(Ipmip6_io_network_info_t *data, OIDC_T tmp_inst[])
{
int i = 0;
tmp_inst[i] = 2;
i++;
tmp_inst[i] = 16;
i++;
#if 0
string_to_oid(16,
&data->ini_mip6MnHomeAddressEntry.mip6MnHomeAddress,
16,
(OIDC_T *)&(tmp_inst[i]),
1);
i += 16;
tmp_inst[i] = 2;
i++;
tmp_inst[i] = 16;
i++;
string_to_oid(16,
&data->ini_mip6MnBLTable.mip6MnBLNodeAddress,
16,
&(tmp_inst[i]),
1);
#endif
i += 16;
return i;
}
#define STRUCT_mip6MnRegnCounters Ipmip6_io_network_info_t
#define STRUCT_mip6MnBLEntry Ipmip6_io_network_info_t
#define STRUCT_mip6System Ipmip6_io_network_info_t
#define STRUCT_mip6TotalTraffic Ipmip6_io_network_info_t
#define STRUCT_mip6MnHomeAddressEntry Ipmip6_io_network_info_t
#define STRUCT_mip6MnConf Ipmip6_io_network_info_t
#define STRUCT_mip6MnBLEntry Ipmip6_io_network_info_t
/*
* Method routines for the mip6System variables:
*
* mip6Capabilities -- read-only
* This object indicates the Mobile IPv6 functions that
* are supported by this managed entity. Multiple
* Mobile IPv6 functions may be supported by a single
* entity.
*
* mip6Status -- read-write
* This object indicates whether the Mobile IPv6
* function is enabled for the managed entity. If it
* is enabled, the agent discovery and registration
* functions will be operational.
* Changing the status from enabled(1) to disabled(2)
* will terminate the agent discovery and registration
* functions. On the other hand, changing the status
* from disabled(2) to enabled(1) will start the agent
* discovery and registration functions.
*
* The value of this object SHOULD remain unchanged
* across reboots of the managed entity.
*/
/* An internal routine to retrieve the values of the variables, used
* by the method routines mip6System_get and mip6System_next.
* You need to replace the type STRUCT_mip6System with something
* appropriate to your system. */
static int
mip6System_get_value(OIDC_T lastmatch,
SNMP_PKT_T *pktp,
VB_T *vbp,
STRUCT_mip6System *data) /* !!! */
{
char *mip6Capabilities = "1";
switch(lastmatch) {
case LEAF_mip6Capabilities:
/* !!! This code uses the getproc_got_octet_string() API,
* which always allocates a new buffer to store the data
* provided. For more control over memory allocations,
* use getproc_got_string() instead.
*/
/* if the data being returned is in dynamic storage and needs
* to be free'd, change the 0 argument to a 1. */
getproc_got_string(pktp, vbp, 1, (unsigned char*)mip6Capabilities, 0, VT_STRING); /* !!! */
break;
case LEAF_mip6Status:
/* Values:
* enabled(1) = VAL_mip6Status_enabled
* disabled(2) = VAL_mip6Status_disabled
*/
getproc_got_int32(pktp, vbp, 1);
break;
default:
return GEN_ERR;
}
return NO_ERROR;
}
void
mip6System_get(OIDC_T lastmatch,
int tcount,
OIDC_T *tlist,
SNMP_PKT_T *pktp,
VB_T *vbp)
{
int error;
/* find all the varbinds that share the same getproc and instance */
group_by_getproc_and_instance(pktp, vbp, tcount, tlist);
/* check that the instance is exactly .0 */
if (!((tcount == 1) && (*tlist == 0)))
for ( ; vbp; vbp = vbp->vb_link)
getproc_nosuchins(pktp, vbp);
/* grab the actual data for this variable. this lookup routine will
* probably have to be changed for your system. for scalar variables
* there might not even be any lookup routine. */
else if (mip6System_lookup() != IP_TRUE) /* !!! */
for ( ; vbp; vbp = vbp->vb_link)
getproc_error(pktp, vbp, GEN_ERR);
else {
/* retrieve all the values from the same data structure */
for ( ; vbp; vbp = vbp->vb_link) {
if ((error = mip6System_get_value(vbp->vb_ml.ml_last_match, pktp, vbp, NULL)) != NO_ERROR)
getproc_error(pktp, vbp, error);
}
}
}
void
mip6System_next(OIDC_T lastmatch,
int tcount,
OIDC_T *tlist,
SNMP_PKT_T *pktp,
VB_T *vbp)
{
OIDC_T instance = 0;
/* the only time there's a next for a scalar is if we're given
* no instance at all. */
if (tcount != 0)
nextproc_no_next(pktp, vbp);
/* grab the data for these variables. you'll probably have to change
* this lookup routine for your system. for scalar variables there
* might not even be any lookup routine. */
else if (mip6System_lookup() != IP_TRUE) /* !!! */
getproc_error(pktp, vbp, GEN_ERR);
else {
/* find all the varbinds in this group and retrieve their
* values from the same data structure */
for (group_by_getproc_and_instance(pktp, vbp, tcount, tlist);
vbp; vbp = vbp->vb_link) {
nextproc_next_instance(pktp, vbp, 1, &instance);
mip6System_get_value(vbp->vb_ml.ml_last_match, pktp, vbp, NULL);
}
}
}
void
mip6System_test(OIDC_T lastmatch,
int tcount,
OIDC_T *tlist,
SNMP_PKT_T *pktp,
VB_T *vbp)
{
VB_T *group_vbp;
/* Only scalar variables here, check for .0 */
if (!((tcount == 1) && (*tlist == 0))) {
testproc_error(pktp, vbp, NO_SUCH_NAME);
return;
}
/* find all the varbinds that share the same getproc and instance and
* group them together. */
group_by_getproc_and_instance(pktp, vbp, tcount, tlist);
/* now check each varbind */
for (group_vbp = vbp;
group_vbp;
group_vbp = group_vbp->vb_link) {
/* !!! Add any value checking you wish to do. */
switch (group_vbp->vb_ml.ml_last_match) {
case LEAF_mip6Status:
/* !!! modify this switch to give an error for values your
* implementation doesn't allow */
switch (VB_GET_INT32(group_vbp)) {
case VAL_mip6Status_enabled:
case VAL_mip6Status_disabled:
break;
default:
testproc_error(pktp, group_vbp, WRONG_VALUE);
continue;
}
testproc_good(pktp, group_vbp);
break;
default:
testproc_error(pktp, group_vbp, GEN_ERR);
return;
}
}
}
void
mip6System_set(OIDC_T lastmatch,
int tcount,
OIDC_T *tlist,
SNMP_PKT_T *pktp,
VB_T *vbp)
{
for ( ; vbp; vbp = vbp->vb_link) {
switch (vbp->vb_ml.ml_last_match) {
case LEAF_mip6Status:
break;
default:
setproc_error(pktp, vbp, COMMIT_FAILED);
return;
}
}
}
#if 0
/*
* Method routines for the mip6BindingCacheTable:
*
* mip6BindingHomeAddressType -- not-accessible
* The InetAddressType of the mip6BindingHomeAddress
* that follows.
*
* mip6BindingHomeAddress -- not-accessible
* The home address of the mobile node corresponding
* to the Binding Cache entry. This field is used as
* the key for searching the mobile node's current
* care-of address in the Binding Cache.
*
* The type of the address represented by this object
* is specified by the corresponding
* mip6BindingHomeAddressType object.
*
* mip6BindingCOAType -- read-only
* The InetAddressType of the mip6BindingCOA that
* follows.
*
* mip6BindingCOA -- read-only
* The care-of address of the mobile node indicated by
* the home address field (mip6BindingHomeAddress) in
* this Binding Cache entry.
*
* The type of the address represented by this object
* is specified by the corresponding mip6BindingCOAType
* object.
*
* mip6BindingTimeRegistered -- read-only
* The timestamp when this Binding Cache entry was
* created.
*
* mip6BindingTimeGranted -- read-only
* The lifetime in seconds granted to the mobile node
* for this registration.
*
* mip6BindingTimeRemaining -- read-only
* The lifetime in seconds remaining for this
* registration.
*
* mip6BindingHomeRegn -- read-only
* This object indicates whether or not this Binding
* Cache entry is a home registration entry (applicable
* only on nodes that support home agent
* functionality).
*
* mip6BindingMaxSeq -- read-only
* The maximum value of the Sequence Number field
* received in previous Binding Updates for this home
* address (mip6BindingHomeAddress).
*
* mip6BindingUsageTS -- read-only
* The timestamp when this entry was last looked up.
*
* mip6BindingUsageCount -- read-only
* The number of times this entry was looked up.
*
* mip6BindingAdminStatus -- read-write
* This is an administrative object used to control
* the status of a binding cache entry. By default
* the value will be 'active'(1).
* A value of 'inactive'(2) will indicate that the
* validity of the entry is suspended. It does not
* exist in the binding cache for all practical
* purposes.
* The state can be changed from 'active' to
* 'inactive' by operator intervention.
* Causing the state to change to 'inactive' results
* in the entry being deleted from the cache.
* Attempts to change the status from 'inactive'
* to 'active' will be rejected.
*/
/* An internal routine to retrieve the values of the variables, used
* by the method routines mip6BindingCacheEntry_get and mip6BindingCacheEntry_next.
* You need to replace the type STRUCT_mip6BindingCacheEntry with something
* appropriate to your system. */
static int
mip6BindingCacheEntry_get_value(OIDC_T lastmatch,
SNMP_PKT_T *pktp,
VB_T *vbp,
STRUCT_mip6BindingCacheEntry *data) /* !!! */
{
switch(lastmatch) {
case LEAF_mip6BindingCOAType:
/* Values:
* unknown(0) = VAL_mip6BindingCOAType_unknown
* ipv4(1) = VAL_mip6BindingCOAType_ipv4
* ipv6(2) = VAL_mip6BindingCOAType_ipv6
* ipv4z(3) = VAL_mip6BindingCOAType_ipv4z
* ipv6z(4) = VAL_mip6BindingCOAType_ipv6z
* dns(16) = VAL_mip6BindingCOAType_dns
*/
getproc_got_int32(pktp, vbp, data->mip6BindingCOAType); /* !!! */
break;
case LEAF_mip6BindingCOA:
/* !!! This code uses the getproc_got_octet_string() API,
* which always allocates a new buffer to store the data
* provided. For more control over memory allocations,
* use getproc_got_string() instead.
*/
getproc_got_octet_string(pktp, vbp, octet_string_length(data->mip6BindingCOA), data->mip6BindingCOA, VT_STRING); /* !!! */
break;
case LEAF_mip6BindingTimeRegistered:
/* !!! This code uses the getproc_got_octet_string() API,
* which always allocates a new buffer to store the data
* provided. For more control over memory allocations,
* use getproc_got_string() instead.
*/
getproc_got_octet_string(pktp, vbp, octet_string_length(data->mip6BindingTimeRegistered), data->mip6BindingTimeRegistered, VT_STRING); /* !!! */
break;
case LEAF_mip6BindingTimeGranted:
getproc_got_uint32(pktp, vbp, data->mip6BindingTimeGranted, VT_GAUGE); /* !!! */
break;
case LEAF_mip6BindingTimeRemaining:
getproc_got_uint32(pktp, vbp, data->mip6BindingTimeRemaining, VT_GAUGE); /* !!! */
break;
case LEAF_mip6BindingHomeRegn:
/* Values:
* true(1) = VAL_mip6BindingHomeRegn_true
* false(2) = VAL_mip6BindingHomeRegn_false
*/
getproc_got_int32(pktp, vbp, data->mip6BindingHomeRegn); /* !!! */
break;
case LEAF_mip6BindingMaxSeq:
getproc_got_uint32(pktp, vbp, data->mip6BindingMaxSeq, VT_GAUGE); /* !!! */
break;
case LEAF_mip6BindingUsageTS:
/* !!! This code uses the getproc_got_octet_string() API,
* which always allocates a new buffer to store the data
* provided. For more control over memory allocations,
* use getproc_got_string() instead.
*/
getproc_got_octet_string(pktp, vbp, octet_string_length(data->mip6BindingUsageTS), data->mip6BindingUsageTS, VT_STRING); /* !!! */
break;
case LEAF_mip6BindingUsageCount:
getproc_got_uint32(pktp, vbp, data->mip6BindingUsageCount, VT_GAUGE); /* !!! */
break;
case LEAF_mip6BindingAdminStatus:
/* Values:
* active(1) = VAL_mip6BindingAdminStatus_active
* inactive(2) = VAL_mip6BindingAdminStatus_inactive
*/
getproc_got_int32(pktp, vbp, data->mip6BindingAdminStatus); /* !!! */
break;
default:
return GEN_ERR;
}
return NO_ERROR;
}
void
mip6BindingCacheEntry_get(OIDC_T lastmatch,
int tcount,
OIDC_T *tlist,
SNMP_PKT_T *pktp,
VB_T *vbp)
{
STRUCT_mip6BindingCacheEntry data; /* !!! */
int error;
/* find all the varbinds that share the same getproc and instance */
group_by_getproc_and_instance(pktp, vbp, tcount, tlist);
/* use the instance (tcount and tlist) to look up the entry in the
* table. This lookup routine will probably have to be changed to
* suit your system. */
if ((data = mip6BindingCacheEntry_lookup(tcount, tlist)) == 0) /* !!! */
for ( ; vbp; vbp = vbp->vb_link)
getproc_nosuchins(pktp, vbp);
else {
/* retrieve all the values from the same data structure */
for ( ; vbp; vbp = vbp->vb_link) {
if ((error = mip6BindingCacheEntry_get_value(vbp->vb_ml.ml_last_match, pktp, vbp, &data)) != NO_ERROR)
getproc_error(pktp, vbp, error);
}
}
}
void
mip6BindingCacheEntry_next(OIDC_T lastmatch,
int tcount,
OIDC_T *tlist,
SNMP_PKT_T *pktp,
VB_T *vbp)
{
#define mip6BindingCacheEntry_INSTANCE_LEN 257 /* !!! */
STRUCT_mip6BindingCacheEntry *data; /* !!! */
STRUCT_mip6BindingCacheEntry *best; /* !!! */
OIDC_T tmp_inst[mip6BindingCacheEntry_INSTANCE_LEN];
OIDC_T best_inst[mip6BindingCacheEntry_INSTANCE_LEN];
int i;
int error;
unsigned inst_len;
unsigned best_inst_len;
/* find all the varbinds that share the same getproc and instance */
group_by_getproc_and_instance(pktp, vbp, tcount, tlist);
/* generate the instance of each table entry and find the
* smallest instance that's larger than tcount/tlist */
best = 0;
/* This loop needs to iterate over each entry in your table */
for (data = mip6BindingCacheEntry_first(); data; /* !!! */
data = mip6BindingCacheEntry_int_next(data)) { /* !!! */
inst_len = mip6BindingCacheEntry_build_instance(data, tmp_inst);
if ((oidcmp2(inst_len, tmp_inst, tcount, tlist) > 0) &&
((!best || (oidcmp2(inst_len, tmp_inst,
inst_len, best_inst) < 0)))) {
best = data;
for (i = 0; i < inst_len; i++)
best_inst[i] = tmp_inst[i];
best_inst_len = inst_len;
}
}
if (best) {
/* we found a next so get the values and set the instance for all
* the varbinds for this row of this table.
* NOTE: if you allow holes in the table then this code will have to
* change significantly to accomodate that. */
for ( ; vbp ; vbp = vbp->vb_link) {
if ((error = mip6BindingCacheEntry_get_value(vbp->vb_ml.ml_last_match, pktp, vbp, best)) == NO_ERROR)
nextproc_next_instance(pktp, vbp, best_inst_len, best_inst);
else
nextproc_error(pktp, vbp, error);
}
}
else /* there's no more in this table */
for ( ; vbp ; vbp = vbp->vb_link )
nextproc_no_next(pktp, vbp);
}
void
mip6BindingCacheEntry_test(OIDC_T lastmatch,
int tcount,
OIDC_T *tlist,
SNMP_PKT_T *pktp,
VB_T *vbp)
{
/* Change the appropriate definition to 1 if you want row creation
* or consistency checking. If you will never need these it's
* probably best to just delete the code to make the testproc a
* little more readable. */
#define mip6BindingCacheEntry_CONSISTENCY_CHECK 0 /* !!! */
#define mip6BindingCacheEntry_ROW_CREATION 0 /* !!! */
STRUCT_mip6BindingCacheEntry *data; /* !!! */
#if mip6BindingCacheEntry_CONSISTENCY_CHECK
STRUCT_mip6BindingCacheEntry check_data; /* !!! */
#endif
int error;
VB_T *group_vbp;
if ((data = mip6BindingCacheEntry_lookup(tcount, tlist)) == 0) { /* !!! */
/* optionally do row creation here !!! */
testproc_error(pktp, vbp, NO_SUCH_NAME);
return;
}
#if mip6BindingCacheEntry_CONSISTENCY_CHECK
/* get a copy of the data to modify for now to see if we end up with
* something that's consistent after doing all the sets */
check_data = *data;
#endif
/* stash the looked up information here for the setproc */
vbp->vb_priv = data;
/* find all the varbinds that share the same getproc and instance and
* group them together. */
group_by_getproc_and_instance(pktp, vbp, tcount, tlist);
/* now check each varbind */
for (group_vbp = vbp;
group_vbp;
group_vbp = group_vbp->vb_link) {
/* !!! Add any value checking you wish to do. */
switch (group_vbp->vb_ml.ml_last_match) {
case LEAF_mip6BindingAdminStatus:
/* !!! modify this switch to give an error for values your
* implementation doesn't allow */
switch (VB_GET_INT32(group_vbp)) {
case VAL_mip6BindingAdminStatus_active:
case VAL_mip6BindingAdminStatus_inactive:
break;
default:
testproc_error(pktp, group_vbp, WRONG_VALUE);
continue;
}
#if mip6BindingAdminStatus_CONSISTENCY_CHECK
check_data.mip6BindingAdminStatus = VB_GET_INT32(group_vbp); /* !!! */
#endif
testproc_good(pktp, group_vbp);
break;
default:
testproc_error(pktp, group_vbp, GEN_ERR);
return;
}
}
#if mip6BindingCacheEntry_CONSISTENCY_CHECK
/* check that the result of all the sets will work */
if (!error && (mip6BindingCacheEntry_consistency_check(&check_data) != 0)) /* !!! */
testproc_error(pktp, vbp, INCONSISTENT_VALUE);
#endif
}
void
mip6BindingCacheEntry_set(OIDC_T lastmatch,
int tcount,
OIDC_T *tlist,
SNMP_PKT_T *pktp,
VB_T *vbp)
{
STRUCT_mip6BindingCacheEntry *data = vbp->vb_priv; /* !!! */
for ( ; vbp; vbp = vbp->vb_link) {
switch (vbp->vb_ml.ml_last_match) {
case LEAF_mip6BindingAdminStatus:
data->mip6BindingAdminStatus = VB_GET_INT32(vbp); /* !!! */
setproc_good(pktp, vbp);
break;
default:
setproc_error(pktp, vbp, COMMIT_FAILED);
return;
}
}
}
/*
* Method routines for the mip6BindingHistoryTable:
*
* mip6BindingHstHomeAddressType -- not-accessible
* The InetAddressType of the
* mip6BindingHstHomeAddress that follows.
*
* mip6BindingHstHomeAddress -- not-accessible
* Mobile node's home address.
*
* The type of the address represented by this object
* is specified by the corresponding
* mip6BindingHstHomeAddressType object.
*
* mip6BindingHstIndex -- not-accessible
* The index to uniquely identify this record along
* with the mobile node's HomeAddress type and
* HomeAddress. It should be monotonically increasing.
* It may wrap after reaching its max value.
*
* mip6BindingHstCOAType -- read-only
* The InetAddressType of the mip6BindingHstCOA that
* follows.
*
* mip6BindingHstCOA -- read-only
* Mobile node's care-of address. One mobile node can
* have multiple bindings with different
* care-of addresses.
* The type of the address represented by this object
* is specified by the corresponding
* mip6BindingHstCOAType object.
*
* mip6BindingHstTimeRegistered -- read-only
* The timestamp when this Binding Cache entry was
* created.
*
* mip6BindingHstTimeExpired -- read-only
* The timestamp when this Binding Cache entry expired.
*
* mip6BindingHstHomeRegn -- read-only
* This object indicates whether or not this Binding
* Cache entry is a home registration entry (applicable
* only on nodes that support home agent
* functionality).
*
* mip6BindingHstUsageTS -- read-only
* The timestamp when this entry was last looked up.
*
* mip6BindingHstUsageCount -- read-only
* The number of times this entry was looked up.
*/
/* An internal routine to retrieve the values of the variables, used
* by the method routines mip6BindingHistoryEntry_get and mip6BindingHistoryEntry_next.
* You need to replace the type STRUCT_mip6BindingHistoryEntry with something
* appropriate to your system. */
static int
mip6BindingHistoryEntry_get_value(OIDC_T lastmatch,
SNMP_PKT_T *pktp,
VB_T *vbp,
STRUCT_mip6BindingHistoryEntry *data) /* !!! */
{
switch(lastmatch) {
case LEAF_mip6BindingHstCOAType:
/* Values:
* unknown(0) = VAL_mip6BindingHstCOAType_unknown
* ipv4(1) = VAL_mip6BindingHstCOAType_ipv4
* ipv6(2) = VAL_mip6BindingHstCOAType_ipv6
* ipv4z(3) = VAL_mip6BindingHstCOAType_ipv4z
* ipv6z(4) = VAL_mip6BindingHstCOAType_ipv6z
* dns(16) = VAL_mip6BindingHstCOAType_dns
*/
getproc_got_int32(pktp, vbp, data->mip6BindingHstCOAType); /* !!! */
break;
case LEAF_mip6BindingHstCOA:
/* !!! This code uses the getproc_got_octet_string() API,
* which always allocates a new buffer to store the data
* provided. For more control over memory allocations,
* use getproc_got_string() instead.
*/
getproc_got_octet_string(pktp, vbp, octet_string_length(data->mip6BindingHstCOA), data->mip6BindingHstCOA, VT_STRING); /* !!! */
break;
case LEAF_mip6BindingHstTimeRegistered:
/* !!! This code uses the getproc_got_octet_string() API,
* which always allocates a new buffer to store the data
* provided. For more control over memory allocations,
* use getproc_got_string() instead.
*/
getproc_got_octet_string(pktp, vbp, octet_string_length(data->mip6BindingHstTimeRegistered), data->mip6BindingHstTimeRegistered, VT_STRING); /* !!! */
break;
case LEAF_mip6BindingHstTimeExpired:
/* !!! This code uses the getproc_got_octet_string() API,
* which always allocates a new buffer to store the data
* provided. For more control over memory allocations,
* use getproc_got_string() instead.
*/
getproc_got_octet_string(pktp, vbp, octet_string_length(data->mip6BindingHstTimeExpired), data->mip6BindingHstTimeExpired, VT_STRING); /* !!! */
break;
case LEAF_mip6BindingHstHomeRegn:
/* Values:
* true(1) = VAL_mip6BindingHstHomeRegn_true
* false(2) = VAL_mip6BindingHstHomeRegn_false
*/
getproc_got_int32(pktp, vbp, data->mip6BindingHstHomeRegn); /* !!! */
break;
case LEAF_mip6BindingHstUsageTS:
/* !!! This code uses the getproc_got_octet_string() API,
* which always allocates a new buffer to store the data
* provided. For more control over memory allocations,
* use getproc_got_string() instead.
*/
getproc_got_octet_string(pktp, vbp, octet_string_length(data->mip6BindingHstUsageTS), data->mip6BindingHstUsageTS, VT_STRING); /* !!! */
break;
case LEAF_mip6BindingHstUsageCount:
getproc_got_uint32(pktp, vbp, data->mip6BindingHstUsageCount, VT_GAUGE); /* !!! */
break;
default:
return GEN_ERR;
}
return NO_ERROR;
}
void
mip6BindingHistoryEntry_get(OIDC_T lastmatch,
int tcount,
OIDC_T *tlist,
SNMP_PKT_T *pktp,
VB_T *vbp)
{
STRUCT_mip6BindingHistoryEntry data; /* !!! */
int error;
/* find all the varbinds that share the same getproc and instance */
group_by_getproc_and_instance(pktp, vbp, tcount, tlist);
/* use the instance (tcount and tlist) to look up the entry in the
* table. This lookup routine will probably have to be changed to
* suit your system. */
if ((data = mip6BindingHistoryEntry_lookup(tcount, tlist)) == 0) /* !!! */
for ( ; vbp; vbp = vbp->vb_link)
getproc_nosuchins(pktp, vbp);
else {
/* retrieve all the values from the same data structure */
for ( ; vbp; vbp = vbp->vb_link) {
if ((error = mip6BindingHistoryEntry_get_value(vbp->vb_ml.ml_last_match, pktp, vbp, &data)) != NO_ERROR)
getproc_error(pktp, vbp, error);
}
}
}
void
mip6BindingHistoryEntry_next(OIDC_T lastmatch,
int tcount,
OIDC_T *tlist,
SNMP_PKT_T *pktp,
VB_T *vbp)
{
#define mip6BindingHistoryEntry_INSTANCE_LEN 258 /* !!! */
STRUCT_mip6BindingHistoryEntry *data; /* !!! */
STRUCT_mip6BindingHistoryEntry *best; /* !!! */
OIDC_T tmp_inst[mip6BindingHistoryEntry_INSTANCE_LEN];
OIDC_T best_inst[mip6BindingHistoryEntry_INSTANCE_LEN];
int i;
int error;
unsigned inst_len;
unsigned best_inst_len;
/* find all the varbinds that share the same getproc and instance */
group_by_getproc_and_instance(pktp, vbp, tcount, tlist);
/* generate the instance of each table entry and find the
* smallest instance that's larger than tcount/tlist */
best = 0;
/* This loop needs to iterate over each entry in your table */
for (data = mip6BindingHistoryEntry_first(); data; /* !!! */
data = mip6BindingHistoryEntry_int_next(data)) { /* !!! */
inst_len = mip6BindingHistoryEntry_build_instance(data, tmp_inst);
if ((oidcmp2(inst_len, tmp_inst, tcount, tlist) > 0) &&
((!best || (oidcmp2(inst_len, tmp_inst,
inst_len, best_inst) < 0)))) {
best = data;
for (i = 0; i < inst_len; i++)
best_inst[i] = tmp_inst[i];
best_inst_len = inst_len;
}
}
if (best) {
/* we found a next so get the values and set the instance for all
* the varbinds for this row of this table.
* NOTE: if you allow holes in the table then this code will have to
* change significantly to accomodate that. */
for ( ; vbp ; vbp = vbp->vb_link) {
if ((error = mip6BindingHistoryEntry_get_value(vbp->vb_ml.ml_last_match, pktp, vbp, best)) == NO_ERROR)
nextproc_next_instance(pktp, vbp, best_inst_len, best_inst);
else
nextproc_error(pktp, vbp, error);
}
}
else /* there's no more in this table */
for ( ; vbp ; vbp = vbp->vb_link )
nextproc_no_next(pktp, vbp);
}
#endif
/*
* Method routines for the mip6TotalTraffic variables:
*
* mip6InOctets -- read-only
* The total number of octets in the MIPv6 datagrams
* received by the MIPv6 entity. This will include
* datagrams with the Mobility Header, the Home Address
* option in the Destination Option extension header
* (Next Header value = 60), or the type 2 Routing
* Header. It will also include the IPv6 datagrams that
* are reverse tunneled to a home agent from a mobile
* node's home address.
* Discontinuities in the value of this counter can
* occur at re-initialization of the management system,
* and at other times as indicated by the value of
* mip6CounterDiscontinuityTime.
*
* mip6HCInOctets -- read-only
* The total number of octets in the MIPv6 datagrams
* received by the MIPv6 entity. This will include
* datagrams with the Mobility Header, the Home Address
* option in the Destination Option extension header
* (Next Header value = 60), or the type 2 Routing
* Header. It will also include the IPv6 datagrams that
* are reverse tunneled to a home agent from a mobile
* node's home address.
* This object is a 64-bit version of mip6InOctets.
* Discontinuities in the value of this counter can
* occur at re-initialization of the management system,
* and at other times as indicated by the value of
* mip6CounterDiscontinuityTime.
*
* mip6InPkts -- read-only
* The number of MIPv6 datagrams received by the MIPv6
* entity. This will include datagrams with the
* Mobility Header, the Home Address option in the
* Destination Option extension header (Next Header
* value = 60), or the type 2 Routing Header.
* It will also include the IPv6 datagrams that are
* reverse tunneled to a home agent from a mobile
* node's home address.
* Discontinuities in the value of this counter can
* occur at re-initialization of the management system,
* and at other times as indicated by the value of
* mip6CounterDiscontinuityTime.
*
* mip6HCInPkts -- read-only
* The number of MIPv6 datagrams received by the MIPv6
* entity. This will include datagrams with the
* Mobility Header, the Home Address option in the
* Destination Option extension header (Next Header
* value = 60), or the type 2 Routing Header. It will
* also include the IPv6 datagrams that are reverse
* tunneled to a home agent from a mobile node's home
* address.
* This object is a 64-bit version of mip6InPkts.
* Discontinuities in the value of this counter can
* occur at re-initialization of the management system,
* and at other times as indicated by the value of
* mip6CounterDiscontinuityTime.
*
* mip6OutOctets -- read-only
* The total number of octets in the MIPv6 datagrams
* sent by the MIPv6 entity. This will include
* datagrams with the Mobility Header, the Home Address
* option in the Destination Option extension header
* (Next Header value = 60), or the type 2 Routing
* Header. It will also include the IPv6 datagrams that
* are reverse tunneled to a home agent from a mobile
* node's home address.
* Discontinuities in the value of this counter can
* occur at re-initialization of the management system,
* and at other times as indicated by the value of
* mip6CounterDiscontinuityTime.
*
* mip6HCOutOctets -- read-only
* The total number of octets in the MIPv6 datagrams
* sent by the MIPv6 entity. This will include
* datagrams with the Mobility Header, the Home Address
* option in the Destination Option extension header
* (Next Header value = 60), or the type 2 Routing
* Header. It will also include the IPv6 datagrams that
* are reverse tunneled to a home agent from a mobile
* node's home address.
* This object is a 64-bit version of mip6OutOctets.
* Discontinuities in the value of this counter can
* occur at re-initialization of the management system,
* and at other times as indicated by the value of
* mip6CounterDiscontinuityTime.
*
* mip6OutPkts -- read-only
* The number of MIPv6 datagrams sent by the MIPv6
* entity. This will include the datagrams with
* Mobility Header, the Home Address option in the
* Destination Option extension header (Next Header
* value = 60), or the type 2 Routing Header. It will
* also include the IPv6 datagrams that are reverse
* tunneled to a home agent from a mobile node's home
* address.
* Discontinuities in the value of this counter can
* occur at re-initialization of the management system,
* and at other times as indicated by the value of
* mip6CounterDiscontinuityTime.
*
* mip6HCOutPkts -- read-only
* The number of MIPv6 datagrams sent by the MIPv6
* entity. This will include datagrams with the
* Mobility Header, the Home Address option in the
* Destination Option extension header (Next Header
* value = 60), or the type 2 Routing Header. It will
* also include the IPv6 datagrams that are reverse
* tunneled to a home agent from a mobile node's home
* address.
* This object is a 64-bit version of mip6OutPkts.
* Discontinuities in the value of this counter can
* occur at re-initialization of the management system,
* and at other times as indicated by the value of
* mip6CounterDiscontinuityTime.
*
* mip6CounterDiscontinuityTime -- read-only
* The value of sysUpTime on the most recent occasion
* at which any one or more of this MIPv6 entities
* global counters, viz., counters with OID prefix
* 'mip6TotalTraffic' or 'mip6CnGlobalStats' or
* 'mip6HaGlobalStats' suffered a discontinuity.
* If no such discontinuities have occurred since the
* last re-initialization of the local management
* subsystem, then this object will have a zero value.
*/
/* An internal routine to retrieve the values of the variables, used
* by the method routines mip6TotalTraffic_get and mip6TotalTraffic_next.
* You need to replace the type STRUCT_mip6TotalTraffic with something
* appropriate to your system. */
static int
mip6TotalTraffic_get_value(OIDC_T lastmatch,
SNMP_PKT_T *pktp,
VB_T *vbp,
STRUCT_mip6TotalTraffic *data) /* !!! */
{
switch(lastmatch) {
case LEAF_mip6InOctets:
getproc_got_uint32(pktp, vbp, data->ini_mip6TotalTraffic.mip6InOctets, VT_COUNTER); /* !!! */
break;
case LEAF_mip6HCInOctets:
getproc_got_uint64(pktp, vbp, (UINT_64_T*)&data->ini_mip6TotalTraffic.mip6HCInOctets); /* !!! */
break;
case LEAF_mip6InPkts:
getproc_got_uint32(pktp, vbp, data->ini_mip6TotalTraffic.mip6InPkts, VT_COUNTER); /* !!! */
break;
case LEAF_mip6HCInPkts:
getproc_got_uint64(pktp, vbp, (UINT_64_T*)&data->ini_mip6TotalTraffic.mip6HCInPkts); /* !!! */
break;
case LEAF_mip6OutOctets:
getproc_got_uint32(pktp, vbp, data->ini_mip6TotalTraffic.mip6OutOctets, VT_COUNTER); /* !!! */
break;
case LEAF_mip6HCOutOctets:
getproc_got_uint64(pktp, vbp, (UINT_64_T*)&data->ini_mip6TotalTraffic.mip6HCOutOctets); /* !!! */
break;
case LEAF_mip6OutPkts:
getproc_got_uint32(pktp, vbp, data->ini_mip6TotalTraffic.mip6OutPkts, VT_COUNTER); /* !!! */
break;
case LEAF_mip6HCOutPkts:
getproc_got_uint64(pktp, vbp, (UINT_64_T*)&data->ini_mip6TotalTraffic.mip6HCOutPkts); /* !!! */
break;
case LEAF_mip6CounterDiscontinuityTime:
getproc_got_uint32(pktp, vbp, data->ini_mip6TotalTraffic.mip6CounterDiscontinuityTime, VT_TIMETICKS); /* !!! */
break;
default:
return GEN_ERR;
}
return NO_ERROR;
}
void
mip6TotalTraffic_get(OIDC_T lastmatch,
int tcount,
OIDC_T *tlist,
SNMP_PKT_T *pktp,
VB_T *vbp)
{
Ipmip6_io_network_info_t data;
int error;
/* find all the varbinds that share the same getproc and instance */
group_by_getproc_and_instance(pktp, vbp, tcount, tlist);
/* check that the instance is exactly .0 */
if (!((tcount == 1) && (*tlist == 0)))
for ( ; vbp; vbp = vbp->vb_link)
getproc_nosuchins(pktp, vbp);
/* grab the actual data for this variable. this lookup routine will
* probably have to be changed for your system. for scalar variables
* there might not even be any lookup routine. */
else if ((ipmip6mn_mib_get(&data)) != IP_TRUE) /* !!! */
for ( ; vbp; vbp = vbp->vb_link)
getproc_error(pktp, vbp, GEN_ERR);
else {
/* retrieve all the values from the same data structure */
for ( ; vbp; vbp = vbp->vb_link) {
if ((error = mip6TotalTraffic_get_value(vbp->vb_ml.ml_last_match, pktp, vbp, &data)) != NO_ERROR)
getproc_error(pktp, vbp, error);
}
}
}
void
mip6TotalTraffic_next(OIDC_T lastmatch,
int tcount,
OIDC_T *tlist,
SNMP_PKT_T *pktp,
VB_T *vbp)
{
Ipmip6_io_network_info_t data;
OIDC_T instance = 0;
/* the only time there's a next for a scalar is if we're given
* no instance at all. */
if (tcount != 0)
nextproc_no_next(pktp, vbp);
/* grab the data for these variables. you'll probably have to change
* this lookup routine for your system. for scalar variables there
* might not even be any lookup routine. */
else if ((ipmip6mn_mib_get(&data)) != IP_TRUE) /* !!! */
getproc_error(pktp, vbp, GEN_ERR);
else {
/* find all the varbinds in this group and retrieve their
* values from the same data structure */
for (group_by_getproc_and_instance(pktp, vbp, tcount, tlist);
vbp; vbp = vbp->vb_link) {
nextproc_next_instance(pktp, vbp, 1, &instance);
mip6TotalTraffic_get_value(vbp->vb_ml.ml_last_match, pktp, vbp, &data);
}
}
}
#if 0
/*
* Method routines for the mip6NodeTrafficTable:
*
* mip6NodeInOctets -- read-only
* The total number of octets in the MIPv6 datagrams
* received from the mobile node by the MIPv6 entity.
* This will include datagrams with the Mobility
* Header or the Home Address option in the Destination
* Option extension header (Next Header value = 60).
* It will also include the IPv6 datagrams that are
* reverse tunneled to a home agent from the mobile
* node's home address.
* Discontinuities in the value of this counter can
* occur at re-initialization of the management system,
* and at other times as indicated by the value of
* mip6NodeCtrDiscontinuityTime.
*
* mip6HCNodeInOctets -- read-only
* The total number of octets in the MIPv6 datagrams
* received from the mobile node by the MIPv6 entity.
* This will include datagrams with the Mobility
* Header or the Home Address option in the Destination
* Option extension header (Next Header value = 60).
* It will also include the IPv6 datagrams that are
* reverse tunneled to a home agent from the mobile
* node's home address.
* This object is a 64-bit version of mip6NodeInOctets.
* Discontinuities in the value of this counter can
* occur at re-initialization of the management system,
* and at other times as indicated by the value of
* mip6NodeCtrDiscontinuityTime.
*
* mip6NodeInPkts -- read-only
* The number of MIPv6 datagrams received from the
* mobile node by the MIPv6 entity. This will include
* the datagrams with the Mobility Header or
* the Home Address option in the Destination
* Option extension header (Next Header value = 60).
* It will also include the IPv6 datagrams that are
* reverse tunneled to a home agent from the mobile
* node's home address.
* Discontinuities in the value of this counter can
* occur at re-initialization of the management system,
* and at other times as indicated by the value of
* mip6NodeCtrDiscontinuityTime.
*
* mip6HCNodeInPkts -- read-only
* The number of MIPv6 datagrams received from the
* mobile node by the MIPv6 entity. This will include
* datagrams with the Mobility Header or the Home
* Address option in the Destination Option extension
* header (Next Header value = 60). It will also
* include the IPv6 datagrams that are reverse tunneled
* to a home agent from the mobile node's home address.
* This object is a 64-bit version of mip6NodeInPkts.
* Discontinuities in the value of this counter can
* occur at re-initialization of the management system,
* and at other times as indicated by the value of
* mip6NodeCtrDiscontinuityTime.
*
* mip6NodeOutOctets -- read-only
* The total number of octets in the MIPv6 datagrams
* sent to the mobile node by the MIPv6 entity. This
* will include datagrams with the Mobility Header
* or the type 2 Routing Header. It will also include
* the IPv6 datagrams that are tunneled by a home agent
* to the mobile node.
* Discontinuities in the value of this counter can
* occur at re-initialization of the management system,
* and at other times as indicated by the value of
* mip6NodeCtrDiscontinuityTime.
*
* mip6HCNodeOutOctets -- read-only
* The total number of octets in the MIPv6 datagrams
* sent to the mobile node by the MIPv6 entity. This
* will include datagrams with the Mobility Header
* or the type 2 Routing Header. It will also include
* the IPv6 datagrams that are tunneled by a home agent
* to the mobile node.
* This object is a 64-bit version of mip6NodeOutOctets.
* Discontinuities in the value of this counter can
* occur at re-initialization of the management system,
* and at other times as indicated by the value of
* mip6NodeCtrDiscontinuityTime.
*
* mip6NodeOutPkts -- read-only
* The number of MIPv6 datagrams sent to the mobile
* node by the MIPv6 entity. This will include
* datagrams with the Mobility Header or the type 2
* Routing Header. It will also include the IPv6
* datagrams that are tunneled by a home agent to the
* mobile node.
* Discontinuities in the value of this counter can
* occur at re-initialization of the management system,
* and at other times as indicated by the value of
* mip6NodeCtrDiscontinuityTime.
*
* mip6HCNodeOutPkts -- read-only
* The number of MIPv6 datagrams sent to the mobile
* node by the MIPv6 entity. This will include
* datagrams with the Mobility Header or the type 2
* Routing Header. It will also include the IPv6
* datagrams that are tunneled by a home agent to the
* mobile node.
* This object is a 64-bit version of mip6NodeOutOctets.
* Discontinuities in the value of this counter can
* occur at re-initialization of the management system,
* and at other times as indicated by the value of
* mip6NodeCtrDiscontinuityTime.
*
* mip6NodeCtrDiscontinuityTime -- read-only
* The value of sysUpTime on the most recent occasion
* at which any one or more of the counters in this row
* suffered a discontinuity. The relevant counters are
* the specific instances of any Counter32 or Counter64
* objects in this row.
* If no such discontinuities have occurred since the
* last re-initialization of the local management
* subsystem, then this object contains a zero value.
*/
/* An internal routine to retrieve the values of the variables, used
* by the method routines mip6NodeTrafficEntry_get and mip6NodeTrafficEntry_next.
* You need to replace the type STRUCT_mip6NodeTrafficEntry with something
* appropriate to your system. */
static int
mip6NodeTrafficEntry_get_value(OIDC_T lastmatch,
SNMP_PKT_T *pktp,
VB_T *vbp,
STRUCT_mip6NodeTrafficEntry *data) /* !!! */
{
switch(lastmatch) {
case LEAF_mip6NodeInOctets:
getproc_got_uint32(pktp, vbp, data->mip6NodeInOctets, VT_COUNTER); /* !!! */
break;
case LEAF_mip6HCNodeInOctets:
getproc_got_uint64(pktp, vbp, data->mip6HCNodeInOctets); /* !!! */
break;
case LEAF_mip6NodeInPkts:
getproc_got_uint32(pktp, vbp, data->mip6NodeInPkts, VT_COUNTER); /* !!! */
break;
case LEAF_mip6HCNodeInPkts:
getproc_got_uint64(pktp, vbp, data->mip6HCNodeInPkts); /* !!! */
break;
case LEAF_mip6NodeOutOctets:
getproc_got_uint32(pktp, vbp, data->mip6NodeOutOctets, VT_COUNTER); /* !!! */
break;
case LEAF_mip6HCNodeOutOctets:
getproc_got_uint64(pktp, vbp, data->mip6HCNodeOutOctets); /* !!! */
break;
case LEAF_mip6NodeOutPkts:
getproc_got_uint32(pktp, vbp, data->mip6NodeOutPkts, VT_COUNTER); /* !!! */
break;
case LEAF_mip6HCNodeOutPkts:
getproc_got_uint64(pktp, vbp, data->mip6HCNodeOutPkts); /* !!! */
break;
case LEAF_mip6NodeCtrDiscontinuityTime:
getproc_got_uint32(pktp, vbp, data->mip6NodeCtrDiscontinuityTime, VT_TIMETICKS); /* !!! */
break;
default:
return GEN_ERR;
}
return NO_ERROR;
}
void
mip6NodeTrafficEntry_get(OIDC_T lastmatch,
int tcount,
OIDC_T *tlist,
SNMP_PKT_T *pktp,
VB_T *vbp)
{
STRUCT_mip6NodeTrafficEntry data; /* !!! */
int error;
/* find all the varbinds that share the same getproc and instance */
group_by_getproc_and_instance(pktp, vbp, tcount, tlist);
/* use the instance (tcount and tlist) to look up the entry in the
* table. This lookup routine will probably have to be changed to
* suit your system. */
if ((data = mip6NodeTrafficEntry_lookup(tcount, tlist)) == 0) /* !!! */
for ( ; vbp; vbp = vbp->vb_link)
getproc_nosuchins(pktp, vbp);
else {
/* retrieve all the values from the same data structure */
for ( ; vbp; vbp = vbp->vb_link) {
if ((error = mip6NodeTrafficEntry_get_value(vbp->vb_ml.ml_last_match, pktp, vbp, &data)) != NO_ERROR)
getproc_error(pktp, vbp, error);
}
}
}
void
mip6NodeTrafficEntry_next(OIDC_T lastmatch,
int tcount,
OIDC_T *tlist,
SNMP_PKT_T *pktp,
VB_T *vbp)
{
#define mip6NodeTrafficEntry_INSTANCE_LEN 257 /* !!! */
STRUCT_mip6NodeTrafficEntry *data; /* !!! */
STRUCT_mip6NodeTrafficEntry *best; /* !!! */
OIDC_T tmp_inst[mip6NodeTrafficEntry_INSTANCE_LEN];
OIDC_T best_inst[mip6NodeTrafficEntry_INSTANCE_LEN];
int i;
int error;
unsigned inst_len;
unsigned best_inst_len;
/* find all the varbinds that share the same getproc and instance */
group_by_getproc_and_instance(pktp, vbp, tcount, tlist);
/* generate the instance of each table entry and find the
* smallest instance that's larger than tcount/tlist */
best = 0;
/* This loop needs to iterate over each entry in your table */
for (data = mip6NodeTrafficEntry_first(); data; /* !!! */
data = mip6NodeTrafficEntry_int_next(data)) { /* !!! */
inst_len = mip6NodeTrafficEntry_build_instance(data, tmp_inst);
if ((oidcmp2(inst_len, tmp_inst, tcount, tlist) > 0) &&
((!best || (oidcmp2(inst_len, tmp_inst,
inst_len, best_inst) < 0)))) {
best = data;
for (i = 0; i < inst_len; i++)
best_inst[i] = tmp_inst[i];
best_inst_len = inst_len;
}
}
if (best) {
/* we found a next so get the values and set the instance for all
* the varbinds for this row of this table.
* NOTE: if you allow holes in the table then this code will have to
* change significantly to accomodate that. */
for ( ; vbp ; vbp = vbp->vb_link) {
if ((error = mip6NodeTrafficEntry_get_value(vbp->vb_ml.ml_last_match, pktp, vbp, best)) == NO_ERROR)
nextproc_next_instance(pktp, vbp, best_inst_len, best_inst);
else
nextproc_error(pktp, vbp, error);
}
}
else /* there's no more in this table */
for ( ; vbp ; vbp = vbp->vb_link )
nextproc_no_next(pktp, vbp);
}
#endif
/*
* Method routines for the mip6MnHomeAddressTable:
*
* mip6MnHomeAddressType -- not-accessible
* The InetAddressType of the mip6MnHomeAddress that
* follows.
*
* mip6MnHomeAddress -- not-accessible
* A unicast routable address assigned to the mobile
* node. This is used as the 'permanent address' of the
* mobile node in the sense that it remains unchanged
* regardless of the mobile node's current point of
* attachment. If mobile node doesn't have a home
* address assigned yet, then this object will take the
* default 'unspecified' value ::0.
*
* The type of the address represented by this object
* is specified by the corresponding
* mip6MnHomeAddressType object.
*
* mip6MnHomeAddressState -- read-only
* This object indicates the state of the mobile node:
* unknown -- The state of the mobile node
* cannot be determined.
* home -- mobile node is on the home network.
* registered -- mobile node is on a foreign network
* and is registered with the home
* agent.
* pending -- mobile node has sent registration
* request to the home agent and is
* waiting for the reply.
* isolated -- mobile node is isolated from network,
* i.e., it is not in its home network,
* it is not registered, and no
* registration ack is pending.
*/
/* An internal routine to retrieve the values of the variables, used
* by the method routines mip6MnHomeAddressEntry_get and mip6MnHomeAddressEntry_next.
* You need to replace the type STRUCT_mip6MnHomeAddressEntry with something
* appropriate to your system. */
#define mip6MnHomeAddressEntry_INSTANCE_LEN 257
static int
mip6MnHomeAddressEntry_get_value(OIDC_T lastmatch,
SNMP_PKT_T *pktp,
VB_T *vbp,
STRUCT_mip6MnHomeAddressEntry *data) /* !!! */
{
switch(lastmatch) {
case LEAF_mip6MnHomeAddressState:
/* Values:
* unknown(1) = VAL_mip6MnHomeAddressState_unknown
* home(2) = VAL_mip6MnHomeAddressState_home
* registered(3) = VAL_mip6MnHomeAddressState_registered
* pending(4) = VAL_mip6MnHomeAddressState_pending
* isolated(5) = VAL_mip6MnHomeAddressState_isolated
*/
{
Ip_s32 mip6MnHomeAddressState = 0;
IPMIP6MN_MIB_GET(mip6MnHomeAddressState, MnHomeAddressEntry);
getproc_got_int32(pktp, vbp, mip6MnHomeAddressState); /* !!! */
break;
}
default:
return GEN_ERR;
}
return NO_ERROR;
}
static int mip6MnHomeAddressEntry_lookup(int tcount,
OIDC_T *tlist,
OIDC_T *best,
boolean_t getnext)
{
Ip_s32 mip6MnHomeAddressType = 0;
Ip_u8 *mip6MnHomeAddress = (Ip_u8 *)"";
Ip_s32 mip6MnHomeAddress_len = 0;
Ip_s32 mip6MnHomeAddressTable_num_entries = 0;
Ip_s32 i, bestindex = -1;
char buf[mip6MnHomeAddressEntry_INSTANCE_LEN];
/*
*
* mip6MnHomeAddressTable_num_entries := Number_Of_Entries_In_Current_mip6MnHomeAddressTable
*/
mip6MnHomeAddressTable_num_entries = 1;
for(i=0; i<mip6MnHomeAddressTable_num_entries; i++)
{
Ip_s32 j;
Ip_size_t len = 0;
buf[0] = '\0';
/*
*
* mip6MnHomeAddressType := Current_MIB_Variable_mip6MnHomeAddressType in row no. i
*/
mip6MnHomeAddressType = IPMIP6MN_MIB_InetAddressType_ipv6;
if(ipcom_snprintf(&buf[len], mip6MnHomeAddressEntry_INSTANCE_LEN-len, "%d.", mip6MnHomeAddressType) < 0)
return -2;
len = ipcom_strlen(buf);
/*
*
* mip6MnHomeAddress := Current_MIB_Variable_mip6MnHomeAddress in row no. i
* mip6MnHomeAddress_len := Length_Of_Current_MIB_Variable_mip6MnHomeAddress in row no. i
*/
IPMIP6MN_MIB_ntop(mip6MnHomeAddress, mip6MnHomeAddress_len, MnHomeAddressEntry)
if(ipcom_snprintf(&buf[len], mip6MnHomeAddressEntry_INSTANCE_LEN-len, "%d.", mip6MnHomeAddress_len) < 0)
return -2;
len = ipcom_strlen(buf);
for(j=0; j<mip6MnHomeAddress_len; j++)
{
if(ipcom_snprintf(&buf[len], mip6MnHomeAddressEntry_INSTANCE_LEN-len, "%d.", mip6MnHomeAddress[j]) < 0)
return -2;
len = ipcom_strlen(buf);
}
len = ipcom_strlen(buf);
if(len)
buf[len-1] = '\0';
#if 0
lex = oidcmp2 (len, buf,tcount, tlist);
if(getnext == TRUE)
{
if(lex > 0)
{
if(bestindex == -1 || oidcmp2 (len, buf,len, best) < 0)
{
ipcom_strcpy(best, buf);
bestindex = i;
}
}
}
else
{
if(lex == 0)
{
ipcom_strcpy(best, buf);
bestindex = i;
break;
}
}
#endif
}
return bestindex;
}
void
mip6MnHomeAddressEntry_get(OIDC_T lastmatch,
int tcount,
OIDC_T *tlist,
SNMP_PKT_T *pktp,
VB_T *vbp)
{
Ipmip6_io_network_info_t data; /* !!! */
int error;
/* find all the varbinds that share the same getproc and instance */
group_by_getproc_and_instance(pktp, vbp, tcount, tlist);
/* use the instance (tcount and tlist) to look up the entry in the
* table. This lookup routine will probably have to be changed to
* suit your system. */
if ((ipmip6mn_mib_get(&data)) != IP_TRUE) /* !!! */
for ( ; vbp; vbp = vbp->vb_link)
getproc_nosuchins(pktp, vbp);
else {
/* retrieve all the values from the same data structure */
for ( ; vbp; vbp = vbp->vb_link) {
if ((error = mip6MnHomeAddressEntry_get_value(vbp->vb_ml.ml_last_match, pktp, vbp, &data)) != NO_ERROR)
getproc_error(pktp, vbp, error);
}
}
}
void
mip6MnHomeAddressEntry_next(OIDC_T lastmatch,
int tcount,
OIDC_T *tlist,
SNMP_PKT_T *pktp,
VB_T *vbp)
{
OIDC_T best[mip6MnHomeAddressEntry_INSTANCE_LEN];
int error;
/* find all the varbinds that share the same getproc and instance */
group_by_getproc_and_instance(pktp, vbp, tcount, tlist);
mip6MnHomeAddressEntry_lookup(tcount,tlist,best,TRUE);
if (best[0]) {
/* we found a next so get the values and set the instance for all
* the varbinds for this row of this table.
* NOTE: if you allow holes in the table then this code will have to
* change significantly to accomodate that. */
for ( ; vbp ; vbp = vbp->vb_link) {
if ((error = mip6MnHomeAddressEntry_get_value(vbp->vb_ml.ml_last_match, pktp, vbp, NULL)) == NO_ERROR)
nextproc_next_instance(pktp, vbp, mip6MnHomeAddressEntry_INSTANCE_LEN, best);
else
nextproc_error(pktp, vbp, error);
}
}
else /* there's no more in this table */
for ( ; vbp ; vbp = vbp->vb_link )
nextproc_no_next(pktp, vbp);
}
/*
* Method routines for the mip6MnConf variables:
*
* mip6MnDiscoveryRequests -- read-only
* Total number of ICMP Dynamic Home Agent Address
* Discovery Requests sent by the mobile node.
* Discontinuities in the value of this counter can
* occur at re-initialization of the management system,
* and at other times as indicated by the value of
* mip6CounterDiscontinuityTime.
*
* mip6MnDiscoveryReplies -- read-only
* Total number of ICMP Dynamic Home Agent Address
* Discovery Replies received by the mobile node.
* Discontinuities in the value of this counter can
* occur at re-initialization of the management system,
* and at other times as indicated by the value of
* mip6CounterDiscontinuityTime.
*
* mip6MnDiscoveryTimeouts -- read-only
* Total number of ICMP Dynamic Home Agent Address
* Discovery Requests that timed out.
* Discontinuities in the value of this counter can
* occur at re-initialization of the management system,
* and at other times as indicated by the value of
* mip6CounterDiscontinuityTime.
*
* mip6MnPrefixSolicitationsSent -- read-only
* Total number of ICMP Mobile Prefix Solicitations
* sent by the mobile node.
* Discontinuities in the value of this counter can
* occur at re-initialization of the management system,
* and at other times as indicated by the value of
* mip6CounterDiscontinuityTime.
*
* mip6MnPrefixAdvsRecd -- read-only
* Total number of ICMP Mobile Prefix Advertisements
* received by the mobile node. This will include the
* ICMP Mobile Prefix Advertisements that failed the
* validity checks.
* Discontinuities in the value of this counter can
* occur at re-initialization of the management system,
* and at other times as indicated by the value of
* mip6CounterDiscontinuityTime.
*
* mip6MnPrefixAdvsIgnored -- read-only
* Total number of Mobile Prefix Advertisements
* discarded by the validity check.
* Discontinuities in the value of this counter can
* occur at re-initialization of the management system,
* and at other times as indicated by the value of
* mip6CounterDiscontinuityTime.
*
* mip6MnMovedToFN -- read-only
* Number of times the mobile node has detected
* movement to a foreign network from another
* foreign network or from the home network, has
* reconstructed its care-of address and has initiated
* the care-of address registration process.
* Discontinuities in the value of this counter can
* occur at re-initialization of the management system,
* and at other times as indicated by the value of
* mip6CounterDiscontinuityTime.
*
* mip6MnMovedToHN -- read-only
* Number of times the mobile node has detected
* movement from a foreign network to its home
* network.
* Discontinuities in the value of this counter can
* occur at re-initialization of the management system,
* and at other times as indicated by the value of
* mip6CounterDiscontinuityTime.
*/
/* An internal routine to retrieve the values of the variables, used
* by the method routines mip6MnConf_get and mip6MnConf_next.
* You need to replace the type STRUCT_mip6MnConf with something
* appropriate to your system. */
static int
mip6MnConf_get_value(OIDC_T lastmatch,
SNMP_PKT_T *pktp,
VB_T *vbp,
STRUCT_mip6MnConf *data) /* !!! */
{
switch(lastmatch) {
case LEAF_mip6MnDiscoveryRequests:
getproc_got_uint32(pktp, vbp, data->ini_mip6MnConf.mip6MnDiscoveryRequests, VT_COUNTER); /* !!! */
break;
case LEAF_mip6MnDiscoveryReplies:
getproc_got_uint32(pktp, vbp, data->ini_mip6MnConf.mip6MnDiscoveryReplies, VT_COUNTER); /* !!! */
break;
case LEAF_mip6MnDiscoveryTimeouts:
getproc_got_uint32(pktp, vbp, data->ini_mip6MnConf.mip6MnDiscoveryTimeouts, VT_COUNTER); /* !!! */
break;
case LEAF_mip6MnPrefixSolicitationsSent:
getproc_got_uint32(pktp, vbp, data->ini_mip6MnConf.mip6MnPrefixSolicitationsSent, VT_COUNTER); /* !!! */
break;
case LEAF_mip6MnPrefixAdvsRecd:
getproc_got_uint32(pktp, vbp, data->ini_mip6MnConf.mip6MnPrefixAdvsRecd, VT_COUNTER); /* !!! */
break;
case LEAF_mip6MnPrefixAdvsIgnored:
getproc_got_uint32(pktp, vbp, data->ini_mip6MnConf.mip6MnPrefixAdvsIgnored, VT_COUNTER); /* !!! */
break;
case LEAF_mip6MnMovedToFN:
getproc_got_uint32(pktp, vbp, data->ini_mip6MnConf.mip6MnMovedToFN, VT_COUNTER); /* !!! */
break;
case LEAF_mip6MnMovedToHN:
getproc_got_uint32(pktp, vbp, data->ini_mip6MnConf.mip6MnMovedToHN, VT_COUNTER); /* !!! */
break;
default:
return GEN_ERR;
}
return NO_ERROR;
}
void
mip6MnConf_get(OIDC_T lastmatch,
int tcount,
OIDC_T *tlist,
SNMP_PKT_T *pktp,
VB_T *vbp)
{
Ipmip6_io_network_info_t data; /* !!! */
int error;
/* find all the varbinds that share the same getproc and instance */
group_by_getproc_and_instance(pktp, vbp, tcount, tlist);
/* check that the instance is exactly .0 */
if (!((tcount == 1) && (*tlist == 0)))
for ( ; vbp; vbp = vbp->vb_link)
getproc_nosuchins(pktp, vbp);
/* grab the actual data for this variable. this lookup routine will
* probably have to be changed for your system. for scalar variables
* there might not even be any lookup routine. */
else if ((ipmip6mn_mib_get(&data)) != IP_TRUE) /* !!! */
for ( ; vbp; vbp = vbp->vb_link)
getproc_error(pktp, vbp, GEN_ERR);
else {
/* retrieve all the values from the same data structure */
for ( ; vbp; vbp = vbp->vb_link) {
if ((error = mip6MnConf_get_value(vbp->vb_ml.ml_last_match, pktp, vbp, &data)) != NO_ERROR)
getproc_error(pktp, vbp, error);
}
}
}
void
mip6MnConf_next(OIDC_T lastmatch,
int tcount,
OIDC_T *tlist,
SNMP_PKT_T *pktp,
VB_T *vbp)
{
Ipmip6_io_network_info_t data; /* !!! */
OIDC_T instance = 0;
/* the only time there's a next for a scalar is if we're given
* no instance at all. */
if (tcount != 0)
nextproc_no_next(pktp, vbp);
/* grab the data for these variables. you'll probably have to change
* this lookup routine for your system. for scalar variables there
* might not even be any lookup routine. */
else if ((ipmip6mn_mib_get(&data)) != IP_TRUE) /* !!! */
getproc_error(pktp, vbp, GEN_ERR);
else {
/* find all the varbinds in this group and retrieve their
* values from the same data structure */
for (group_by_getproc_and_instance(pktp, vbp, tcount, tlist);
vbp; vbp = vbp->vb_link) {
nextproc_next_instance(pktp, vbp, 1, &instance);
mip6MnConf_get_value(vbp->vb_ml.ml_last_match, pktp, vbp, &data);
}
}
}
/*
* Method routines for the mip6MnBLTable:
*
* mip6MnBLNodeAddressType -- not-accessible
* The InetAddressType of the mip6MnBLNodeAddress
* that follows.
*
* mip6MnBLNodeAddress -- not-accessible
* The address of the agent as used in the destination
* address of the Binding Update. The agent
* may be a home agent or a correspondent node.
*
* The type of the address represented by this object
* is specified by the corresponding
* mip6MnBLNodeAddressType object.
*
*
* mip6MnBLCOAType -- read-only
* The InetAddressType of the mip6MnBLCOA that follows.
*
* mip6MnBLCOA -- read-only
* Care-of address that the mobile node intends to
* register in the Binding Update request.
*
* The type of the address represented by this object
* is specified by the corresponding mip6MnBLCOAType
* object.
*
* mip6MnBLLifeTimeRequested -- read-only
* The lifetime requested by the mobile node (in
* seconds) in the Binding Update.
*
* mip6MnBLLifeTimeGranted -- read-only
* The lifetime granted to the mobile node for this
* binding. This field will be inaccessible if the
* Binding Update request has not been accepted.
* The lifetime remaining (lR) can be calculated using
* the current time (cT), mip6MnBLAcceptedTime (aT) and
* mip6MnBLLifeTimeGranted (lG) as follows:
* lR = lG - (cT - aT).
* When lR is zero, this entry will be deleted from the
* Binding Update List and consequently from this
* table.
*
* mip6MnBLMaxSeq -- read-only
* The maximum value of the Sequence Number field sent
* in previous Binding Updates to this destination.
*
* mip6MnBLTimeSent -- read-only
* The time when the last (re-)transmission occurred.
*
* mip6MnBLAccepted -- read-only
* true(1) if the mobile node has received a
* binding acknowledgment indicating that service has
* been accepted (status code 0 or 1); false(2)
* otherwise. false(2) implies that the registration
* is still pending.
*
* mip6MnBLAcceptedTime -- read-only
* The time at which the mobile node receives a binding
* acknowledgment indicating that Binding Update has
* been accepted (status code 0 or 1);
* This object will be inaccessible if the Binding
* Update request is still pending.
*
* mip6MnBLRetransmissions -- read-only
* The number of Binding Update retransmissions.
*
* mip6MnBLDontSendBUFlag -- read-only
* true(1) indicates that future binding updates
* will not be sent to mip6MnBLNodeAddress.
* false(2) implies that binding updates will be
* sent to mip6MnBLNodeAddress.
* The mobile node sets this flag in the when it
* receives an ICMP Parameter Problem, Code 1,
* error message in response to a return
* routability message or Binding Update sent to
* mip6MnBLNodeAddress.
*/
/* An internal routine to retrieve the values of the variables, used
* by the method routines mip6MnBLEntry_get and mip6MnBLEntry_next.
* You need to replace the type STRUCT_mip6MnBLEntry with something
* appropriate to your system. */
#if 1
#define mip6MnBLEntry_INSTANCE_LEN 514
static int
mip6MnBLEntry_get_value(OIDC_T lastmatch,
SNMP_PKT_T *pktp,
VB_T *vbp,
STRUCT_mip6MnBLEntry *data) /* !!! */
{
Ip_s32 mip6MnBLCOAType = 2;
switch(lastmatch) {
case LEAF_mip6MnBLCOAType:
/* Values:
* unknown(0) = VAL_mip6MnBLCOAType_unknown
* ipv4(1) = VAL_mip6MnBLCOAType_ipv4
* ipv6(2) = VAL_mip6MnBLCOAType_ipv6
* ipv4z(3) = VAL_mip6MnBLCOAType_ipv4z
* ipv6z(4) = VAL_mip6MnBLCOAType_ipv6z
* dns(16) = VAL_mip6MnBLCOAType_dns
*/
getproc_got_int32(pktp, vbp, mip6MnBLCOAType); /* !!! */
break;
case LEAF_mip6MnBLCOA:
/* !!! This code uses the getproc_got_octet_string() API,
* which always allocates a new buffer to store the data
* provided. For more control over memory allocations,
* use getproc_got_string() instead.
*/
{
Ip_u8 *mip6MnBLCOA = (Ip_u8 *)"";
ALENGTH_T len = 0;
/*IPMIP6MN_MIB_ntop(mip6MnBLCOA, len, MnBLTable)*/
getproc_got_octet_string(pktp, vbp, len, mip6MnBLCOA, VT_STRING); /* !!! */
break;}
case LEAF_mip6MnBLLifeTimeRequested:
{Ip_u32 mip6MnBLLifeTimeRequested = 0;
IPMIP6MN_MIB_GET(mip6MnBLLifeTimeRequested, MnBLTable)
getproc_got_uint32(pktp, vbp, mip6MnBLLifeTimeRequested, VT_GAUGE); /* !!! */
break;}
case LEAF_mip6MnBLLifeTimeGranted:
{Ip_u32 mip6MnBLLifeTimeGranted = 0;
IPMIP6MN_MIB_GET(mip6MnBLLifeTimeGranted, MnBLTable)
getproc_got_uint32(pktp, vbp, mip6MnBLLifeTimeGranted, VT_GAUGE); /* !!! */
break;}
case LEAF_mip6MnBLMaxSeq:
{Ip_u32 mip6MnBLMaxSeq = 0;
IPMIP6MN_MIB_GET(mip6MnBLMaxSeq, MnBLTable)
getproc_got_uint32(pktp, vbp, mip6MnBLMaxSeq, VT_GAUGE); /* !!! */
break;}
case LEAF_mip6MnBLTimeSent:
/* !!! This code uses the getproc_got_octet_string() API,
* which always allocates a new buffer to store the data
* provided. For more control over memory allocations,
* use getproc_got_string() instead.
*/
{Ip_u8 *mip6MnBLTimeSent = (Ip_u8 *)"";
ALENGTH_T len = 0;
IPMIP6MN_MIB_strftime(mip6MnBLTimeSent, len, MnBLTable)
getproc_got_octet_string(pktp, vbp, len, mip6MnBLTimeSent, VT_STRING); /* !!! */
break;}
case LEAF_mip6MnBLAccepted:
/* Values:
* true(1) = VAL_mip6MnBLAccepted_true
* false(2) = VAL_mip6MnBLAccepted_false
*/
{Ip_s32 mip6MnBLAccepted = 0;
IPMIP6MN_MIB_GET(mip6MnBLAccepted, MnBLTable)
getproc_got_int32(pktp, vbp, mip6MnBLAccepted); /* !!! */
break;}
case LEAF_mip6MnBLAcceptedTime:
/* !!! This code uses the getproc_got_octet_string() API,
* which always allocates a new buffer to store the data
* provided. For more control over memory allocations,
* use getproc_got_string() instead.
*/
{Ip_u8 *mip6MnBLAcceptedTime = (Ip_u8 *)"";
ALENGTH_T len = 0;
IPMIP6MN_MIB_strftime(mip6MnBLAcceptedTime, len, MnBLTable)
getproc_got_octet_string(pktp, vbp, len, mip6MnBLAcceptedTime, VT_STRING); /* !!! */
break;}
case LEAF_mip6MnBLRetransmissions:
{Ip_u32 mip6MnBLRetransmissions = 0;
IPMIP6MN_MIB_GET(mip6MnBLRetransmissions, MnBLTable)
getproc_got_uint32(pktp, vbp, mip6MnBLRetransmissions, VT_GAUGE); /* !!! */
break;}
case LEAF_mip6MnBLDontSendBUFlag:
/* Values:
* true(1) = VAL_mip6MnBLDontSendBUFlag_true
* false(2) = VAL_mip6MnBLDontSendBUFlag_false
*/
{Ip_s32 mip6MnBLDontSendBUFlag = 0;
IPMIP6MN_MIB_GET(mip6MnBLDontSendBUFlag, MnBLTable)
getproc_got_int32(pktp, vbp, mip6MnBLDontSendBUFlag);
break;}
default:
return GEN_ERR;
}
return NO_ERROR;
}
static int mip6MnBLEntry_lookup(int tcount,
OIDC_T *tlist,
OIDC_T *best,
boolean_t getnext)
{
Ip_s32 mip6MnHomeAddressType = 0;
Ip_u8 *mip6MnHomeAddress = (Ip_u8 *)"";
Ip_s32 mip6MnHomeAddress_len = 0;
Ip_s32 mip6MnBLNodeAddressType = 0;
Ip_u8 *mip6MnBLNodeAddress = (Ip_u8 *)"";
Ip_s32 mip6MnBLNodeAddress_len = 0;
Ip_s32 mip6MnBLTable_num_entries = 0;
Ip_s32 i;
char buf[mip6MnBLEntry_INSTANCE_LEN];
/*
*
* mip6MnBLTable_num_entries := Number_Of_Entries_In_Current_mip6MnBLTable
*/
mip6MnBLTable_num_entries = 1;
for(i=0; i<mip6MnBLTable_num_entries; i++)
{
int j;
Ip_size_t len = 0;
buf[0] = '\0';
/*
*
* mip6MnHomeAddressType := Current_MIB_Variable_mip6MnHomeAddressType in row no. i
*/
mip6MnHomeAddressType = IPMIP6MN_MIB_InetAddressType_ipv6;
if(ipcom_snprintf(&buf[len], mip6MnBLEntry_INSTANCE_LEN-len, "%d.", mip6MnHomeAddressType) < 0)
return -2;
len = ipcom_strlen(buf);
/*
*
* mip6MnHomeAddress := Current_MIB_Variable_mip6MnHomeAddress in row no. i
* mip6MnHomeAddress_len := Length_Of_Current_MIB_Variable_mip6MnHomeAddress in row no. i
*/
IPMIP6MN_MIB_ntop(mip6MnHomeAddress, mip6MnHomeAddress_len, MnHomeAddressEntry)
if(ipcom_snprintf(&buf[len], mip6MnBLEntry_INSTANCE_LEN-len, "%d.", mip6MnHomeAddress_len) < 0)
return -2;
len = ipcom_strlen(buf);
for(j=0; j<mip6MnHomeAddress_len; j++)
{
if(ipcom_snprintf(&buf[len], mip6MnBLEntry_INSTANCE_LEN-len, "%d.", mip6MnHomeAddress[j]) < 0)
return -2;
len = ipcom_strlen(buf);
}
len = ipcom_strlen(buf);
/*
*
* mip6MnBLNodeAddressType := Current_MIB_Variable_mip6MnBLNodeAddressType in row no. i
*/
mip6MnBLNodeAddressType = IPMIP6MN_MIB_InetAddressType_ipv6;
if(ipcom_snprintf(&buf[len], mip6MnBLEntry_INSTANCE_LEN-len, "%d.", mip6MnBLNodeAddressType) < 0)
return -2;
len = ipcom_strlen(buf);
/*
*
* mip6MnBLNodeAddress := Current_MIB_Variable_mip6MnBLNodeAddress in row no. i
* mip6MnBLNodeAddress_len := Length_Of_Current_MIB_Variable_mip6MnBLNodeAddress in row no. i
*/
/*IPMIP6MN_MIB_ntop(mip6MnBLNodeAddress, mip6MnBLNodeAddress_len, MnBLTable)*/
if(ipcom_snprintf(&buf[len], mip6MnBLEntry_INSTANCE_LEN-len, "%d.", mip6MnBLNodeAddress_len) < 0)
return -2;
len = ipcom_strlen(buf);
for(j=0; j<mip6MnBLNodeAddress_len; j++)
{
if(ipcom_snprintf(&buf[len], mip6MnBLEntry_INSTANCE_LEN-len, "%d.", mip6MnBLNodeAddress[j]) < 0)
return -2;
len = ipcom_strlen(buf);
}
len = ipcom_strlen(buf);
if(len)
buf[len-1] = '\0';
#if 0
lex = STRCMP(buf,tlist);
if(getnext == TRUE)
{
if(lex > 0)
{
if(bestindex == -1 || strcmp(buf,best) < 0)
{
ipcom_strcpy(best, buf);
bestindex = i;
}
}
}
else
{
if(lex == 0)
{
ipcom_strcpy(best, buf);
bestindex = i;
break;
}
}
#endif
}
return 0;
}
void
mip6MnBLEntry_get(OIDC_T lastmatch,
int tcount,
OIDC_T *tlist,
SNMP_PKT_T *pktp,
VB_T *vbp)
{
Ipmip6_io_network_info_t data; /* !!! */
int error;
/* find all the varbinds that share the same getproc and instance */
group_by_getproc_and_instance(pktp, vbp, tcount, tlist);
/* use the instance (tcount and tlist) to look up the entry in the
* table. This lookup routine will probably have to be changed to
* suit your system. */
if ((ipmip6mn_mib_get(&data)) != IP_TRUE) /* !!! */
for ( ; vbp; vbp = vbp->vb_link)
getproc_nosuchins(pktp, vbp);
else {
/* retrieve all the values from the same data structure */
for ( ; vbp; vbp = vbp->vb_link) {
if ((error = mip6MnBLEntry_get_value(vbp->vb_ml.ml_last_match, pktp, vbp, &data)) != NO_ERROR)
getproc_error(pktp, vbp, error);
}
}
}
void
mip6MnBLEntry_next(OIDC_T lastmatch,
int tcount,
OIDC_T *tlist,
SNMP_PKT_T *pktp,
VB_T *vbp)
{
OIDC_T best[mip6MnBLEntry_INSTANCE_LEN];
int error;
/* find all the varbinds that share the same getproc and instance */
group_by_getproc_and_instance(pktp, vbp, tcount, tlist);
/* generate the instance of each table entry and find the
* smallest instance that's larger than tcount/tlist */
mip6MnBLEntry_lookup(tcount,tlist,best,TRUE);
if (best[0]) {
/* we found a next so get the values and set the instance for all
* the varbinds for this row of this table.
* NOTE: if you allow holes in the table then this code will have to
* change significantly to accomodate that. */
for ( ; vbp ; vbp = vbp->vb_link) {
if ((error = mip6MnBLEntry_get_value(vbp->vb_ml.ml_last_match, pktp, vbp, NULL)) == NO_ERROR)
nextproc_next_instance(pktp, vbp, mip6MnBLEntry_INSTANCE_LEN, best);
else
nextproc_error(pktp, vbp, error);
}
}
else /* there's no more in this table */
for ( ; vbp ; vbp = vbp->vb_link )
nextproc_no_next(pktp, vbp);
}
#endif
/*
* Method routines for the mip6MnRegnCounters variables:
*
* mip6MnMobilityMessagesSent -- read-only
* The total number of mobility messages, i.e., IPv6
* datagrams with Mobility Header, sent by the mobile
* node. There are 3 types of mobility messages, viz.,
* Home Test Init, Care-of Test Init, and Binding
* Updates, that are sent by mobile nodes.
* Discontinuities in the value of this counter can
* occur at re-initialization of the management system,
* and at other times as indicated by the value of
* mip6CounterDiscontinuityTime.
*
* mip6MnMobilityMessagesRecd -- read-only
* The total number of mobility messages, i.e., IPv6
* datagrams with Mobility Header, received by the
* mobile node. There are 5 types of mobility
* messages, viz., Home Test, Care-of Test, Binding
* Acknowledgment, Binding Refresh Request, and Binding
* Error, that are sent to mobile nodes.
* Discontinuities in the value of this counter can
* occur at re-initialization of the management system,
* and at other times as indicated by the value of
* mip6CounterDiscontinuityTime.
*
* mip6MnBUsToHA -- read-only
* Total number of Binding Updates sent to the mobile
* node's home agent(s).
* Discontinuities in the value of this counter can
* occur at re-initialization of the management system,
* and at other times as indicated by the value of
* mip6CounterDiscontinuityTime.
*
* mip6MnBUAcksFromHA -- read-only
* Total number of valid binding acknowledgments
* received from the mobile node's home agent(s).
* Discontinuities in the value of this counter can
* occur at re-initialization of the management system,
* and at other times as indicated by the value of
* mip6CounterDiscontinuityTime.
*
* mip6MnBUsToCN -- read-only
* Total number of Binding Updates sent to
* correspondent nodes by the mobile node.
* Discontinuities in the value of this counter can
* occur at re-initialization of the management system,
* and at other times as indicated by the value of
* mip6CounterDiscontinuityTime.
*
* mip6MnBUAcksFromCN -- read-only
* Total number of valid Binding Update acks
* received from all the correspondent nodes.
* Discontinuities in the value of this counter can
* occur at re-initialization of the management system,
* and at other times as indicated by the value of
* mip6CounterDiscontinuityTime.
*
* mip6MnBindingErrorsFromCN -- read-only
* Total number of Binding Error messages received
* by mobile node from CN.
* Discontinuities in the value of this counter can
* occur at re-initialization of the management system,
* and at other times as indicated by the value of
* mip6CounterDiscontinuityTime.
*
* mip6MnICMPErrorsRecd -- read-only
* Total number of ICMP Error messages of type ICMP
* Parameter Problem, Code 1 or Code 2, received by
* the mobile node from a correspondent node in
* response to a return routability procedure, a
* Binding Update, or a packet with the Home Address
* option.
* Discontinuities in the value of this counter can
* occur at re-initialization of the management system,
* and at other times as indicated by the value of
* mip6CounterDiscontinuityTime.
*
* mip6MnBRRequestsRecd -- read-only
* The total number of Binding Refresh requests
* received by the mobile node from correspondent
* nodes.
* Discontinuities in the value of this counter can
* occur at re-initialization of the management system,
* and at other times as indicated by the value of
* mip6CounterDiscontinuityTime.
*/
/* An internal routine to retrieve the values of the variables, used
* by the method routines mip6MnRegnCounters_get and mip6MnRegnCounters_next.
* You need to replace the type STRUCT_mip6MnRegnCounters with something
* appropriate to your system. */
static int
mip6MnRegnCounters_get_value(OIDC_T lastmatch,
SNMP_PKT_T *pktp,
VB_T *vbp,
STRUCT_mip6MnRegnCounters *data) /* !!! */
{
switch(lastmatch) {
case LEAF_mip6MnMobilityMessagesSent:
getproc_got_uint32(pktp, vbp, data->ini_mip6MnRegnCounters.mip6MnMobilityMessagesSent, VT_COUNTER); /* !!! */
break;
case LEAF_mip6MnMobilityMessagesRecd:
getproc_got_uint32(pktp, vbp, data->ini_mip6MnRegnCounters.mip6MnMobilityMessagesRecd, VT_COUNTER);
break;
case LEAF_mip6MnBUsToHA:
getproc_got_uint32(pktp, vbp, data->ini_mip6MnRegnCounters.mip6MnBUsToHA, VT_COUNTER);
break;
case LEAF_mip6MnBUAcksFromHA:
getproc_got_uint32(pktp, vbp, data->ini_mip6MnRegnCounters.mip6MnBUAcksFromHA, VT_COUNTER);
break;
case LEAF_mip6MnBUsToCN:
getproc_got_uint32(pktp, vbp, data->ini_mip6MnRegnCounters.mip6MnBUsToCN, VT_COUNTER);
break;
case LEAF_mip6MnBUAcksFromCN:
getproc_got_uint32(pktp, vbp, data->ini_mip6MnRegnCounters.mip6MnBUAcksFromCN, VT_COUNTER);
break;
case LEAF_mip6MnBindingErrorsFromCN:
getproc_got_uint32(pktp, vbp, data->ini_mip6MnRegnCounters.mip6MnBindingErrorsFromCN, VT_COUNTER);
break;
case LEAF_mip6MnICMPErrorsRecd:
getproc_got_uint32(pktp, vbp, data->ini_mip6MnRegnCounters.mip6MnICMPErrorsRecd, VT_COUNTER);
break;
case LEAF_mip6MnBRRequestsRecd:
getproc_got_uint32(pktp, vbp, data->ini_mip6MnRegnCounters.mip6MnBRRequestsRecd, VT_COUNTER);
break;
default:
return GEN_ERR;
}
return NO_ERROR;
}
void
mip6MnRegnCounters_get(OIDC_T lastmatch,
int tcount,
OIDC_T *tlist,
SNMP_PKT_T *pktp,
VB_T *vbp)
{
Ipmip6_io_network_info_t data; /* n!!! */
int error;
/* find all the varbinds that share the same getproc and instance */
group_by_getproc_and_instance(pktp, vbp, tcount, tlist);
/* check that the instance is exactly .0 */
if (!((tcount == 1) && (*tlist == 0)))
for ( ; vbp; vbp = vbp->vb_link)
getproc_nosuchins(pktp, vbp);
/* grab the actual data for this variable. this lookup routine will
* probably have to be changed for your system. for scalar variables
* there might not even be any lookup routine. */
else if ((ipmip6mn_mib_get(&data)) != IP_TRUE) /* !!! */
for ( ; vbp; vbp = vbp->vb_link)
getproc_error(pktp, vbp, GEN_ERR);
else {
/* retrieve all the values from the same data structure */
for ( ; vbp; vbp = vbp->vb_link) {
if ((error = mip6MnRegnCounters_get_value(vbp->vb_ml.ml_last_match, pktp, vbp, &data)) != NO_ERROR)
getproc_error(pktp, vbp, error);
}
}
}
void
mip6MnRegnCounters_next(OIDC_T lastmatch,
int tcount,
OIDC_T *tlist,
SNMP_PKT_T *pktp,
VB_T *vbp)
{
Ipmip6_io_network_info_t data; /* !!! */
OIDC_T instance = 0;
/* the only time there's a next for a scalar is if we're given
* no instance at all. */
if (tcount != 0)
nextproc_no_next(pktp, vbp);
/* grab the data for these variables. you'll probably have to change
* this lookup routine for your system. for scalar variables there
* might not even be any lookup routine. */
else if ((ipmip6mn_mib_get(&data)) != IP_TRUE) /* !!! */
getproc_error(pktp, vbp, GEN_ERR);
else {
/* find all the varbinds in this group and retrieve their
* values from the same data structure */
for (group_by_getproc_and_instance(pktp, vbp, tcount, tlist);
vbp; vbp = vbp->vb_link) {
nextproc_next_instance(pktp, vbp, 1, &instance);
mip6MnRegnCounters_get_value(vbp->vb_ml.ml_last_match, pktp, vbp, &data);
}
}
}
#if 0
/*
* Method routines for the mip6CnGlobalStats variables:
*
* mip6CnHomeTestInitsRecd -- read-only
* Total number of Home Test Init messages received.
* Discontinuities in the value of this counter can
* occur at re-initialization of the management system,
* and at other times as indicated by the value of
* mip6CounterDiscontinuityTime.
*
* mip6CnHomeTestsSent -- read-only
* Total number of Home Test messages sent. If a Home
* Test Init message is found to be valid, a Home Test
* message will be generated and sent. Otherwise the
* Home Test message is silently discarded.
* Discontinuities in the value of this counter can
* occur at re-initialization of the management system,
* and at other times as indicated by the value of
* mip6CounterDiscontinuityTime.
*
* mip6CnCareOfTestInitsRecd -- read-only
* Total number of Care-of Test Init messages received.
*
* mip6CnCareOfTestsSent -- read-only
* Total number of Care-of Test messages sent. If a
* Care-of Test Init message is found to be valid, a
* Care-of Test message will be generated and sent.
* Otherwise the Care-of Test message is silently
* discarded.
* Discontinuities in the value of this counter can
* occur at re-initialization of the management system,
* and at other times as indicated by the value of
* mip6CounterDiscontinuityTime.
*
* mip6CnBUsRecd -- read-only
* Total number of Binding Updates received by the
* correspondent node from mobile nodes.
* Discontinuities in the value of this counter can
* occur at re-initialization of the management system,
* and at other times as indicated by the value of
* mip6CounterDiscontinuityTime.
*
* mip6CnBUAcksSent -- read-only
* Total number of acknowledgments sent by the
* correspondent node for the Binding Updates received.
* Discontinuities in the value of this counter can
* occur at re-initialization of the management system,
* and at other times as indicated by the value of
* mip6CounterDiscontinuityTime.
*
* mip6CnBRsSent -- read-only
* Total number of Binding Refresh Request messages
* sent by the correspondent node.
* Discontinuities in the value of this counter can
* occur at re-initialization of the management system,
* and at other times as indicated by the value of
* mip6CounterDiscontinuityTime.
*
* mip6CnBindingErrors -- read-only
* Total number of Binding Error messages sent by the
* correspondent node to the mobile node.
* Discontinuities in the value of this counter can
* occur at re-initialization of the management system,
* and at other times as indicated by the value of
* mip6CounterDiscontinuityTime.
*
* mip6CnBUsAccepted -- read-only
* Total number of Binding Updates accepted by the
* correspondent node. If a Binding Acknowledgment
* message is sent for the Binding Update request,
* the Status code field in the message will have
* a value less than 128.
* Discontinuities in the value of this counter can
* occur at re-initialization of the management system,
* and at other times as indicated by the value of
* mip6CounterDiscontinuityTime.
*
* mip6CnBUsRejected -- read-only
* Total number of Binding Update requests rejected
* by the correspondent node. If a Binding
* Acknowledgment message has been sent for the Binding
* Update request, the Status code field in the
* message will have a value greater than or equal to
* 128. Otherwise the Binding Update request will be
* silently discarded.
* Discontinuities in the value of this counter can
* occur at re-initialization of the management system,
* and at other times as indicated by the value of
* mip6CounterDiscontinuityTime.
*
* mip6CnReasonUnspecified -- read-only
* Total number of Binding Update requests rejected by
* the correspondent node with status code in the
* Binding Acknowledgment message indicating 'reason
* unspecified' (Code 128).
* Discontinuities in the value of this counter can
* occur at re-initialization of the management system,
* and at other times as indicated by the value of
* mip6CounterDiscontinuityTime.
*
* mip6CnInsufficientResource -- read-only
* Total number of Binding Update requests rejected by
* the correspondent node with status code in the
* Binding Acknowledgment message indicating
* 'insufficient resources' (Code 130).
* Discontinuities in the value of this counter can
* occur at re-initialization of the management system,
* and at other times as indicated by the value of
* mip6CounterDiscontinuityTime.
*
* mip6CnHomeRegnNotSupported -- read-only
* Total number of Binding Update requests rejected by
* correspondent node with status code in the Binding
* Acknowledgment message indicating 'home registration
* not supported' (Code 131).
* Discontinuities in the value of this counter can
* occur at re-initialization of the management system,
* and at other times as indicated by the value of
* mip6CounterDiscontinuityTime.
*
* mip6CnSeqNumberOutOfWindow -- read-only
* Total number of Binding Updates rejected by
* correspondent node with status code in the Binding
* Acknowledgment message indicating 'sequence number
* out of window' (Code 135).
* Discontinuities in the value of this counter can
* occur at re-initialization of the management system,
* and at other times as indicated by the value of
* mip6CounterDiscontinuityTime.
*
* mip6CnExpiredHomeNonceIndex -- read-only
* The total number of Binding Updates rejected by
* correspondent node with status code in the Binding
* Acknowledgment message indicating 'expired home
* nonce index' (Code 136).
* Discontinuities in the value of this counter can
* occur at re-initialization of the management system,
* and at other times as indicated by the value of
* mip6CounterDiscontinuityTime.
*
* mip6CnExpiredCareOfNonceIndex -- read-only
* The total number of Binding Updates rejected by
* correspondent node with status code in the Binding
* Acknowledgment message indicating 'expired
* care-of nonce index' (Code 137).
* Discontinuities in the value of this counter can
* occur at re-initialization of the management system,
* and at other times as indicated by the value of
* mip6CounterDiscontinuityTime.
*
* mip6CnExpiredNonce -- read-only
* The total number of Binding Updates rejected by
* correspondent node with status code in the Binding
* Acknowledgment message indicating 'expired nonces'
* (Code 138), i.e., the correspondent node no longer
* recognizes the Home Nonce Index value and the
* Care-of Nonce Index value.
* Discontinuities in the value of this counter can
* occur at re-initialization of the management system,
* and at other times as indicated by the value of
* mip6CounterDiscontinuityTime.
*
* mip6CnRegTypeChangeDisallowed -- read-only
* The total number of Binding Updates rejected by
* correspondent node with status code in the Binding
* Acknowledgment message indicating 'registration
* type change disallowed' (Code 139), i.e., a binding
* already exists for the given home address and the
* home registration flag has a different value than
* the Home Registration (H) bit in the Binding Update.
* Discontinuities in the value of this counter can
* occur at re-initialization of the management system,
* and at other times as indicated by the value of
* mip6CounterDiscontinuityTime.
*/
/* An internal routine to retrieve the values of the variables, used
* by the method routines mip6CnGlobalStats_get and mip6CnGlobalStats_next.
* You need to replace the type STRUCT_mip6CnGlobalStats with something
* appropriate to your system. */
static int
mip6CnGlobalStats_get_value(OIDC_T lastmatch,
SNMP_PKT_T *pktp,
VB_T *vbp,
STRUCT_mip6CnGlobalStats *data) /* !!! */
{
switch(lastmatch) {
case LEAF_mip6CnHomeTestInitsRecd:
getproc_got_uint32(pktp, vbp, data->mip6CnHomeTestInitsRecd, VT_COUNTER); /* !!! */
break;
case LEAF_mip6CnHomeTestsSent:
getproc_got_uint32(pktp, vbp, data->mip6CnHomeTestsSent, VT_COUNTER); /* !!! */
break;
case LEAF_mip6CnCareOfTestInitsRecd:
getproc_got_uint32(pktp, vbp, data->mip6CnCareOfTestInitsRecd, VT_COUNTER); /* !!! */
break;
case LEAF_mip6CnCareOfTestsSent:
getproc_got_uint32(pktp, vbp, data->mip6CnCareOfTestsSent, VT_COUNTER); /* !!! */
break;
case LEAF_mip6CnBUsRecd:
getproc_got_uint32(pktp, vbp, data->mip6CnBUsRecd, VT_COUNTER); /* !!! */
break;
case LEAF_mip6CnBUAcksSent:
getproc_got_uint32(pktp, vbp, data->mip6CnBUAcksSent, VT_COUNTER); /* !!! */
break;
case LEAF_mip6CnBRsSent:
getproc_got_uint32(pktp, vbp, data->mip6CnBRsSent, VT_COUNTER); /* !!! */
break;
case LEAF_mip6CnBindingErrors:
getproc_got_uint32(pktp, vbp, data->mip6CnBindingErrors, VT_COUNTER); /* !!! */
break;
case LEAF_mip6CnBUsAccepted:
getproc_got_uint32(pktp, vbp, data->mip6CnBUsAccepted, VT_COUNTER); /* !!! */
break;
case LEAF_mip6CnBUsRejected:
getproc_got_uint32(pktp, vbp, data->mip6CnBUsRejected, VT_COUNTER); /* !!! */
break;
case LEAF_mip6CnReasonUnspecified:
getproc_got_uint32(pktp, vbp, data->mip6CnReasonUnspecified, VT_COUNTER); /* !!! */
break;
case LEAF_mip6CnInsufficientResource:
getproc_got_uint32(pktp, vbp, data->mip6CnInsufficientResource, VT_COUNTER); /* !!! */
break;
case LEAF_mip6CnHomeRegnNotSupported:
getproc_got_uint32(pktp, vbp, data->mip6CnHomeRegnNotSupported, VT_COUNTER); /* !!! */
break;
case LEAF_mip6CnSeqNumberOutOfWindow:
getproc_got_uint32(pktp, vbp, data->mip6CnSeqNumberOutOfWindow, VT_COUNTER); /* !!! */
break;
case LEAF_mip6CnExpiredHomeNonceIndex:
getproc_got_uint32(pktp, vbp, data->mip6CnExpiredHomeNonceIndex, VT_COUNTER); /* !!! */
break;
case LEAF_mip6CnExpiredCareOfNonceIndex:
getproc_got_uint32(pktp, vbp, data->mip6CnExpiredCareOfNonceIndex, VT_COUNTER); /* !!! */
break;
case LEAF_mip6CnExpiredNonce:
getproc_got_uint32(pktp, vbp, data->mip6CnExpiredNonce, VT_COUNTER); /* !!! */
break;
case LEAF_mip6CnRegTypeChangeDisallowed:
getproc_got_uint32(pktp, vbp, data->mip6CnRegTypeChangeDisallowed, VT_COUNTER); /* !!! */
break;
default:
return GEN_ERR;
}
return NO_ERROR;
}
void
mip6CnGlobalStats_get(OIDC_T lastmatch,
int tcount,
OIDC_T *tlist,
SNMP_PKT_T *pktp,
VB_T *vbp)
{
STRUCT_mip6CnGlobalStats data; /* !!! */
int error;
/* find all the varbinds that share the same getproc and instance */
group_by_getproc_and_instance(pktp, vbp, tcount, tlist);
/* check that the instance is exactly .0 */
if (!((tcount == 1) && (*tlist == 0)))
for ( ; vbp; vbp = vbp->vb_link)
getproc_nosuchins(pktp, vbp);
/* grab the actual data for this variable. this lookup routine will
* probably have to be changed for your system. for scalar variables
* there might not even be any lookup routine. */
else if (mip6CnGlobalStats_lookup(&data) != 0) /* !!! */
for ( ; vbp; vbp = vbp->vb_link)
getproc_error(pktp, vbp, GEN_ERR);
else {
/* retrieve all the values from the same data structure */
for ( ; vbp; vbp = vbp->vb_link) {
if ((error = mip6CnGlobalStats_get_value(vbp->vb_ml.ml_last_match, pktp, vbp, &data)) != NO_ERROR)
getproc_error(pktp, vbp, error);
}
}
}
void
mip6CnGlobalStats_next(OIDC_T lastmatch,
int tcount,
OIDC_T *tlist,
SNMP_PKT_T *pktp,
VB_T *vbp)
{
STRUCT_mip6CnGlobalStats data; /* !!! */
OIDC_T instance = 0;
/* the only time there's a next for a scalar is if we're given
* no instance at all. */
if (tcount != 0)
nextproc_no_next(pktp, vbp);
/* grab the data for these variables. you'll probably have to change
* this lookup routine for your system. for scalar variables there
* might not even be any lookup routine. */
else if (mip6CnGlobalStats_lookup(&data)) /* !!! */
getproc_error(pktp, vbp, GEN_ERR);
else {
/* find all the varbinds in this group and retrieve their
* values from the same data structure */
for (group_by_getproc_and_instance(pktp, vbp, tcount, tlist);
vbp; vbp = vbp->vb_link) {
nextproc_next_instance(pktp, vbp, 1, &instance);
mip6CnGlobalStats_get_value(vbp->vb_ml.ml_last_match, pktp, vbp, &data);
}
}
}
/*
* Method routines for the mip6CnCounterTable:
*
* mip6CnBURequestsAccepted -- read-only
* Total number of Binding Update requests from the
* mobile node accepted by the correspondent node.
* If Binding Acknowledgment messages are sent, then
* the status code in the message will have a value
* less than 128.
* Discontinuities in the value of this counter can
* occur at re-initialization of the management system,
* and at other times as indicated by the value of
* mip6CnCtrDiscontinuityTime.
*
* mip6CnBURequestsRejected -- read-only
* Total number of Binding Update requests from the
* mobile node that have been rejected by the
* correspondent node. This includes the Binding Update
* requests for which a Binding Acknowledgment message
* has been sent with status code value greater than or
* equal to 128 and the Binding Acknowledgment requests
* that have been silently discarded.
* Discontinuities in the value of this counter can
* occur at re-initialization of the management system,
* and at other times as indicated by the value of
* mip6CnCtrDiscontinuityTime.
*
* mip6CnBCEntryCreationTime -- read-only
* The time when the current Binding Cache entry was
* created for the mobile node.
*
* mip6CnBUAcceptedTime -- read-only
* The time at which the last Binding Update was
* accepted by the correspondent node and the
* corresponding Binding Cache entry was updated.
*
* mip6CnBURejectionTime -- read-only
* The time at which the last Binding Update message
* was rejected by the correspondent node.
* If there have been no rejections, then this object
* will be inaccessible.
*
* mip6CnBURejectionCode -- read-only
* If a Binding Acknowledgment is sent to the mobile
* node, this is the status code (> 128) that is
* returned in the Binding Acknowledgment.
* In case a Binding Acknowledgment is not sent to
* the mobile node, then this will be the value
* of the Status code that corresponds to the reason
* of the rejection. If there have been no
* rejections, then this object will be inaccessible.
*
* mip6CnCtrDiscontinuityTime -- read-only
* The value of sysUpTime on the most recent occasion
* at which any one or more of counters in this row,
* viz., instances of 'mip6CnBURequestsAccepted' and
* 'mip6CnBURequestsRejected', suffered a discontinuity.
* If no such discontinuities have occurred since the
* last re-initialization of the local management
* subsystem, then this object will have a zero value.
*/
/* An internal routine to retrieve the values of the variables, used
* by the method routines mip6CnCounterEntry_get and mip6CnCounterEntry_next.
* You need to replace the type STRUCT_mip6CnCounterEntry with something
* appropriate to your system. */
static int
mip6CnCounterEntry_get_value(OIDC_T lastmatch,
SNMP_PKT_T *pktp,
VB_T *vbp,
STRUCT_mip6CnCounterEntry *data) /* !!! */
{
switch(lastmatch) {
case LEAF_mip6CnBURequestsAccepted:
getproc_got_uint32(pktp, vbp, data->mip6CnBURequestsAccepted, VT_COUNTER); /* !!! */
break;
case LEAF_mip6CnBURequestsRejected:
getproc_got_uint32(pktp, vbp, data->mip6CnBURequestsRejected, VT_COUNTER); /* !!! */
break;
case LEAF_mip6CnBCEntryCreationTime:
/* !!! This code uses the getproc_got_octet_string() API,
* which always allocates a new buffer to store the data
* provided. For more control over memory allocations,
* use getproc_got_string() instead.
*/
getproc_got_octet_string(pktp, vbp, octet_string_length(data->mip6CnBCEntryCreationTime), data->mip6CnBCEntryCreationTime, VT_STRING); /* !!! */
break;
case LEAF_mip6CnBUAcceptedTime:
/* !!! This code uses the getproc_got_octet_string() API,
* which always allocates a new buffer to store the data
* provided. For more control over memory allocations,
* use getproc_got_string() instead.
*/
getproc_got_octet_string(pktp, vbp, octet_string_length(data->mip6CnBUAcceptedTime), data->mip6CnBUAcceptedTime, VT_STRING); /* !!! */
break;
case LEAF_mip6CnBURejectionTime:
/* !!! This code uses the getproc_got_octet_string() API,
* which always allocates a new buffer to store the data
* provided. For more control over memory allocations,
* use getproc_got_string() instead.
*/
getproc_got_octet_string(pktp, vbp, octet_string_length(data->mip6CnBURejectionTime), data->mip6CnBURejectionTime, VT_STRING); /* !!! */
break;
case LEAF_mip6CnBURejectionCode:
/* Values:
* reasonUnspecified(1) = VAL_mip6CnBURejectionCode_reasonUnspecified
* admProhibited(2) = VAL_mip6CnBURejectionCode_admProhibited
* insufficientResource(3) = VAL_mip6CnBURejectionCode_insufficientResource
* homeRegistrationNotSupported(4) = VAL_mip6CnBURejectionCode_homeRegistrationNotSupported
* notHomeSubnet(5) = VAL_mip6CnBURejectionCode_notHomeSubnet
* notHomeAgentForThisMobileNode(6) = VAL_mip6CnBURejectionCode_notHomeAgentForThisMobileNode
* duplicateAddressDetectionFailed(7) = VAL_mip6CnBURejectionCode_duplicateAddressDetectionFailed
* sequenceNumberOutOfWindow(8) = VAL_mip6CnBURejectionCode_sequenceNumberOutOfWindow
* expiredHomeNonceIndex(9) = VAL_mip6CnBURejectionCode_expiredHomeNonceIndex
* expiredCareofNonceIndex(10) = VAL_mip6CnBURejectionCode_expiredCareofNonceIndex
* expiredNonces(11) = VAL_mip6CnBURejectionCode_expiredNonces
* registrationTypeChangeDisallowed(12) = VAL_mip6CnBURejectionCode_registrationTypeChangeDisallowed
*/
getproc_got_int32(pktp, vbp, data->mip6CnBURejectionCode); /* !!! */
break;
case LEAF_mip6CnCtrDiscontinuityTime:
getproc_got_uint32(pktp, vbp, data->mip6CnCtrDiscontinuityTime, VT_TIMETICKS); /* !!! */
break;
default:
return GEN_ERR;
}
return NO_ERROR;
}
void
mip6CnCounterEntry_get(OIDC_T lastmatch,
int tcount,
OIDC_T *tlist,
SNMP_PKT_T *pktp,
VB_T *vbp)
{
STRUCT_mip6CnCounterEntry data; /* !!! */
int error;
/* find all the varbinds that share the same getproc and instance */
group_by_getproc_and_instance(pktp, vbp, tcount, tlist);
/* use the instance (tcount and tlist) to look up the entry in the
* table. This lookup routine will probably have to be changed to
* suit your system. */
if ((data = mip6CnCounterEntry_lookup(tcount, tlist)) == 0) /* !!! */
for ( ; vbp; vbp = vbp->vb_link)
getproc_nosuchins(pktp, vbp);
else {
/* retrieve all the values from the same data structure */
for ( ; vbp; vbp = vbp->vb_link) {
if ((error = mip6CnCounterEntry_get_value(vbp->vb_ml.ml_last_match, pktp, vbp, &data)) != NO_ERROR)
getproc_error(pktp, vbp, error);
}
}
}
void
mip6CnCounterEntry_next(OIDC_T lastmatch,
int tcount,
OIDC_T *tlist,
SNMP_PKT_T *pktp,
VB_T *vbp)
{
#define mip6CnCounterEntry_INSTANCE_LEN 257 /* !!! */
STRUCT_mip6CnCounterEntry *data; /* !!! */
STRUCT_mip6CnCounterEntry *best; /* !!! */
OIDC_T tmp_inst[mip6CnCounterEntry_INSTANCE_LEN];
OIDC_T best_inst[mip6CnCounterEntry_INSTANCE_LEN];
int i;
int error;
unsigned inst_len;
unsigned best_inst_len;
/* find all the varbinds that share the same getproc and instance */
group_by_getproc_and_instance(pktp, vbp, tcount, tlist);
/* generate the instance of each table entry and find the
* smallest instance that's larger than tcount/tlist */
best = 0;
/* This loop needs to iterate over each entry in your table */
for (data = mip6CnCounterEntry_first(); data; /* !!! */
data = mip6CnCounterEntry_int_next(data)) { /* !!! */
inst_len = mip6CnCounterEntry_build_instance(data, tmp_inst);
if ((oidcmp2(inst_len, tmp_inst, tcount, tlist) > 0) &&
((!best || (oidcmp2(inst_len, tmp_inst,
inst_len, best_inst) < 0)))) {
best = data;
for (i = 0; i < inst_len; i++)
best_inst[i] = tmp_inst[i];
best_inst_len = inst_len;
}
}
if (best) {
/* we found a next so get the values and set the instance for all
* the varbinds for this row of this table.
* NOTE: if you allow holes in the table then this code will have to
* change significantly to accomodate that. */
for ( ; vbp ; vbp = vbp->vb_link) {
if ((error = mip6CnCounterEntry_get_value(vbp->vb_ml.ml_last_match, pktp, vbp, best)) == NO_ERROR)
nextproc_next_instance(pktp, vbp, best_inst_len, best_inst);
else
nextproc_error(pktp, vbp, error);
}
}
else /* there's no more in this table */
for ( ; vbp ; vbp = vbp->vb_link )
nextproc_no_next(pktp, vbp);
}
/*
* Method routines for the mip6HaConfTable:
*
* mip6HaAdvPreference -- read-write
* The preference value for the home agent to
* be used in the Router Advertisements. Higher
* value denotes greater preference.
*
* mip6HaAdvLifetime -- read-write
* The lifetime value for the home agent to be
* used in the Router Advertisements.
*
* mip6HaPrefixAdv -- read-write
* Indicates whether the home agent should support
* sending of the ICMP Mobile Prefix Advertisements.
* If it is disabled(2), the home agent will not
* send ICMP Mobile Prefix Advertisements to the
* mobile nodes.
* The state can be changed from enabled(1) to
* disabled(2) and vice versa by operator
* intervention.
* Causing the state to change from enabled(1) to
* disabled(2) will result in the home agent
* disabling the Prefix advertisement function.
* On the other hand, changing the status from
* disabled(2) to enabled(1) will start the prefix
* advertisement function.
*
* mip6HaPrefixSolicitation -- read-write
* Indicates whether the home agent should respond
* to ICMP Mobile Prefix Solicitation messages it
* receives from the mobile nodes. By default, the
* value will be set to enabled(1). If it is
* disabled(2), the home agent will not respond to
* any ICMP Mobile Prefix Solicitation messages.
* The state can be changed from enabled(1) to
* disabled(2), by operator intervention. Causing
* the state to change from enabled(1) to
* disabled(2) will result in the home agent not
* responding to any ICMP Mobile Prefix
* Solicitation messages it receives from the
* mobile nodes.
*
* mip6HaMCastCtlMsgSupport -- read-write
* Indicates whether the home agent should enable
* support for the processing of the multicast
* group membership control messages it receives
* from the mobile nodes. By default, the value
* will be set to enabled(1). If it is
* disabled(2), the home agent will not process
* any multicast group control messages it receives
* from the mobile nodes.
* The state can be changed from enabled(1) to
* disabled(2), by operator intervention. Causing
* the state to change from enabled(1) to
* disabled(2) will result in the home agent
* disabling the processing of the multicast group
* control messages it received from the mobile
* nodes.
*/
/* An internal routine to retrieve the values of the variables, used
* by the method routines mip6HaConfEntry_get and mip6HaConfEntry_next.
* You need to replace the type STRUCT_mip6HaConfEntry with something
* appropriate to your system. */
static int
mip6HaConfEntry_get_value(OIDC_T lastmatch,
SNMP_PKT_T *pktp,
VB_T *vbp,
STRUCT_mip6HaConfEntry *data) /* !!! */
{
switch(lastmatch) {
case LEAF_mip6HaAdvPreference:
getproc_got_int32(pktp, vbp, data->mip6HaAdvPreference); /* !!! */
break;
case LEAF_mip6HaAdvLifetime:
getproc_got_int32(pktp, vbp, data->mip6HaAdvLifetime); /* !!! */
break;
case LEAF_mip6HaPrefixAdv:
/* Values:
* enabled(1) = VAL_mip6HaPrefixAdv_enabled
* disabled(2) = VAL_mip6HaPrefixAdv_disabled
*/
getproc_got_int32(pktp, vbp, data->mip6HaPrefixAdv); /* !!! */
break;
case LEAF_mip6HaPrefixSolicitation:
/* Values:
* enabled(1) = VAL_mip6HaPrefixSolicitation_enabled
* disabled(2) = VAL_mip6HaPrefixSolicitation_disabled
*/
getproc_got_int32(pktp, vbp, data->mip6HaPrefixSolicitation); /* !!! */
break;
case LEAF_mip6HaMCastCtlMsgSupport:
/* Values:
* enabled(1) = VAL_mip6HaMCastCtlMsgSupport_enabled
* disabled(2) = VAL_mip6HaMCastCtlMsgSupport_disabled
*/
getproc_got_int32(pktp, vbp, data->mip6HaMCastCtlMsgSupport); /* !!! */
break;
default:
return GEN_ERR;
}
return NO_ERROR;
}
void
mip6HaConfEntry_get(OIDC_T lastmatch,
int tcount,
OIDC_T *tlist,
SNMP_PKT_T *pktp,
VB_T *vbp)
{
STRUCT_mip6HaConfEntry data; /* !!! */
int error;
/* find all the varbinds that share the same getproc and instance */
group_by_getproc_and_instance(pktp, vbp, tcount, tlist);
/* use the instance (tcount and tlist) to look up the entry in the
* table. This lookup routine will probably have to be changed to
* suit your system. */
if ((data = mip6HaConfEntry_lookup(tcount, tlist)) == 0) /* !!! */
for ( ; vbp; vbp = vbp->vb_link)
getproc_nosuchins(pktp, vbp);
else {
/* retrieve all the values from the same data structure */
for ( ; vbp; vbp = vbp->vb_link) {
if ((error = mip6HaConfEntry_get_value(vbp->vb_ml.ml_last_match, pktp, vbp, &data)) != NO_ERROR)
getproc_error(pktp, vbp, error);
}
}
}
void
mip6HaConfEntry_next(OIDC_T lastmatch,
int tcount,
OIDC_T *tlist,
SNMP_PKT_T *pktp,
VB_T *vbp)
{
#define mip6HaConfEntry_INSTANCE_LEN 1 /* !!! */
STRUCT_mip6HaConfEntry *data; /* !!! */
STRUCT_mip6HaConfEntry *best; /* !!! */
OIDC_T tmp_inst[mip6HaConfEntry_INSTANCE_LEN];
OIDC_T best_inst[mip6HaConfEntry_INSTANCE_LEN];
int i;
int error;
unsigned inst_len;
unsigned best_inst_len;
/* find all the varbinds that share the same getproc and instance */
group_by_getproc_and_instance(pktp, vbp, tcount, tlist);
/* generate the instance of each table entry and find the
* smallest instance that's larger than tcount/tlist */
best = 0;
/* This loop needs to iterate over each entry in your table */
for (data = mip6HaConfEntry_first(); data; /* !!! */
data = mip6HaConfEntry_int_next(data)) { /* !!! */
inst_len = mip6HaConfEntry_build_instance(data, tmp_inst);
if ((oidcmp2(inst_len, tmp_inst, tcount, tlist) > 0) &&
((!best || (oidcmp2(inst_len, tmp_inst,
inst_len, best_inst) < 0)))) {
best = data;
for (i = 0; i < inst_len; i++)
best_inst[i] = tmp_inst[i];
best_inst_len = inst_len;
}
}
if (best) {
/* we found a next so get the values and set the instance for all
* the varbinds for this row of this table.
* NOTE: if you allow holes in the table then this code will have to
* change significantly to accomodate that. */
for ( ; vbp ; vbp = vbp->vb_link) {
if ((error = mip6HaConfEntry_get_value(vbp->vb_ml.ml_last_match, pktp, vbp, best)) == NO_ERROR)
nextproc_next_instance(pktp, vbp, best_inst_len, best_inst);
else
nextproc_error(pktp, vbp, error);
}
}
else /* there's no more in this table */
for ( ; vbp ; vbp = vbp->vb_link )
nextproc_no_next(pktp, vbp);
}
void
mip6HaConfEntry_test(OIDC_T lastmatch,
int tcount,
OIDC_T *tlist,
SNMP_PKT_T *pktp,
VB_T *vbp)
{
/* Change the appropriate definition to 1 if you want row creation
* or consistency checking. If you will never need these it's
* probably best to just delete the code to make the testproc a
* little more readable. */
#define mip6HaConfEntry_CONSISTENCY_CHECK 0 /* !!! */
#define mip6HaConfEntry_ROW_CREATION 0 /* !!! */
STRUCT_mip6HaConfEntry *data; /* !!! */
#if mip6HaConfEntry_CONSISTENCY_CHECK
STRUCT_mip6HaConfEntry check_data; /* !!! */
#endif
int error;
VB_T *group_vbp;
if ((data = mip6HaConfEntry_lookup(tcount, tlist)) == 0) { /* !!! */
/* optionally do row creation here !!! */
testproc_error(pktp, vbp, NO_SUCH_NAME);
return;
}
#if mip6HaConfEntry_CONSISTENCY_CHECK
/* get a copy of the data to modify for now to see if we end up with
* something that's consistent after doing all the sets */
check_data = *data;
#endif
/* stash the looked up information here for the setproc */
vbp->vb_priv = data;
/* find all the varbinds that share the same getproc and instance and
* group them together. */
group_by_getproc_and_instance(pktp, vbp, tcount, tlist);
/* now check each varbind */
for (group_vbp = vbp;
group_vbp;
group_vbp = group_vbp->vb_link) {
/* !!! Add any value checking you wish to do. */
switch (group_vbp->vb_ml.ml_last_match) {
case LEAF_mip6HaAdvPreference:
{ bits32_t value = VB_GET_INT32(group_vbp);
/* !!! These are the ranges from the MIB. Modify if your
* implementation differs. */
if (!((value >= MIN_mip6HaAdvPreference) &&
(value <= MAX_mip6HaAdvPreference))) {
testproc_error(pktp, group_vbp, WRONG_VALUE);
break;
}
}
#if mip6HaAdvPreference_CONSISTENCY_CHECK
check_data.mip6HaAdvPreference = VB_GET_INT32(group_vbp); /* !!! */
#endif
testproc_good(pktp, group_vbp);
break;
case LEAF_mip6HaAdvLifetime:
{ bits32_t value = VB_GET_INT32(group_vbp);
/* !!! These are the ranges from the MIB. Modify if your
* implementation differs. */
if (!((value >= MIN_mip6HaAdvLifetime) &&
(value <= MAX_mip6HaAdvLifetime))) {
testproc_error(pktp, group_vbp, WRONG_VALUE);
break;
}
}
#if mip6HaAdvLifetime_CONSISTENCY_CHECK
check_data.mip6HaAdvLifetime = VB_GET_INT32(group_vbp); /* !!! */
#endif
testproc_good(pktp, group_vbp);
break;
case LEAF_mip6HaPrefixAdv:
/* !!! modify this switch to give an error for values your
* implementation doesn't allow */
switch (VB_GET_INT32(group_vbp)) {
case VAL_mip6HaPrefixAdv_enabled:
case VAL_mip6HaPrefixAdv_disabled:
break;
default:
testproc_error(pktp, group_vbp, WRONG_VALUE);
continue;
}
#if mip6HaPrefixAdv_CONSISTENCY_CHECK
check_data.mip6HaPrefixAdv = VB_GET_INT32(group_vbp); /* !!! */
#endif
testproc_good(pktp, group_vbp);
break;
case LEAF_mip6HaPrefixSolicitation:
/* !!! modify this switch to give an error for values your
* implementation doesn't allow */
switch (VB_GET_INT32(group_vbp)) {
case VAL_mip6HaPrefixSolicitation_enabled:
case VAL_mip6HaPrefixSolicitation_disabled:
break;
default:
testproc_error(pktp, group_vbp, WRONG_VALUE);
continue;
}
#if mip6HaPrefixSolicitation_CONSISTENCY_CHECK
check_data.mip6HaPrefixSolicitation = VB_GET_INT32(group_vbp); /* !!! */
#endif
testproc_good(pktp, group_vbp);
break;
case LEAF_mip6HaMCastCtlMsgSupport:
/* !!! modify this switch to give an error for values your
* implementation doesn't allow */
switch (VB_GET_INT32(group_vbp)) {
case VAL_mip6HaMCastCtlMsgSupport_enabled:
case VAL_mip6HaMCastCtlMsgSupport_disabled:
break;
default:
testproc_error(pktp, group_vbp, WRONG_VALUE);
continue;
}
#if mip6HaMCastCtlMsgSupport_CONSISTENCY_CHECK
check_data.mip6HaMCastCtlMsgSupport = VB_GET_INT32(group_vbp); /* !!! */
#endif
testproc_good(pktp, group_vbp);
break;
default:
testproc_error(pktp, group_vbp, GEN_ERR);
return;
}
}
#if mip6HaConfEntry_CONSISTENCY_CHECK
/* check that the result of all the sets will work */
if (!error && (mip6HaConfEntry_consistency_check(&check_data) != 0)) /* !!! */
testproc_error(pktp, vbp, INCONSISTENT_VALUE);
#endif
}
void
mip6HaConfEntry_set(OIDC_T lastmatch,
int tcount,
OIDC_T *tlist,
SNMP_PKT_T *pktp,
VB_T *vbp)
{
STRUCT_mip6HaConfEntry *data = vbp->vb_priv; /* !!! */
for ( ; vbp; vbp = vbp->vb_link) {
switch (vbp->vb_ml.ml_last_match) {
case LEAF_mip6HaAdvPreference:
data->mip6HaAdvPreference = VB_GET_INT32(vbp); /* !!! */
setproc_good(pktp, vbp);
break;
case LEAF_mip6HaAdvLifetime:
data->mip6HaAdvLifetime = VB_GET_INT32(vbp); /* !!! */
setproc_good(pktp, vbp);
break;
case LEAF_mip6HaPrefixAdv:
data->mip6HaPrefixAdv = VB_GET_INT32(vbp); /* !!! */
setproc_good(pktp, vbp);
break;
case LEAF_mip6HaPrefixSolicitation:
data->mip6HaPrefixSolicitation = VB_GET_INT32(vbp); /* !!! */
setproc_good(pktp, vbp);
break;
case LEAF_mip6HaMCastCtlMsgSupport:
data->mip6HaMCastCtlMsgSupport = VB_GET_INT32(vbp); /* !!! */
setproc_good(pktp, vbp);
break;
default:
setproc_error(pktp, vbp, COMMIT_FAILED);
return;
}
}
}
/*
* Method routines for the mip6HaListTable:
*
* mip6HaLinkLocalAddressType -- not-accessible
* The address type for the link-local address
* of the home agent that follows.
*
* mip6HaLinkLocalAddress -- not-accessible
* The link local address of the home agent.
*
* The type of the address represented by this object
* is specified by the corresponding
* mip6HaLinkLocalAddressType object.
*
* mip6HaPreference -- read-only
* The preference value of this home agent.
* Higher values indicate a more preferable home
* agent. The preference value is obtained from
* the preference field of the received Router
* Advertisement.
*
* mip6HaRecvLifeTime -- read-only
* The lifetime for this home agent.
*
* mip6HaRecvTimeStamp -- read-only
* The time when the home agent advertisement was
* received.
*/
/* An internal routine to retrieve the values of the variables, used
* by the method routines mip6HaListEntry_get and mip6HaListEntry_next.
* You need to replace the type STRUCT_mip6HaListEntry with something
* appropriate to your system. */
static int
mip6HaListEntry_get_value(OIDC_T lastmatch,
SNMP_PKT_T *pktp,
VB_T *vbp,
STRUCT_mip6HaListEntry *data) /* !!! */
{
switch(lastmatch) {
case LEAF_mip6HaPreference:
getproc_got_int32(pktp, vbp, data->mip6HaPreference); /* !!! */
break;
case LEAF_mip6HaRecvLifeTime:
getproc_got_uint32(pktp, vbp, data->mip6HaRecvLifeTime, VT_GAUGE); /* !!! */
break;
case LEAF_mip6HaRecvTimeStamp:
/* !!! This code uses the getproc_got_octet_string() API,
* which always allocates a new buffer to store the data
* provided. For more control over memory allocations,
* use getproc_got_string() instead.
*/
getproc_got_octet_string(pktp, vbp, octet_string_length(data->mip6HaRecvTimeStamp), data->mip6HaRecvTimeStamp, VT_STRING); /* !!! */
break;
default:
return GEN_ERR;
}
return NO_ERROR;
}
void
mip6HaListEntry_get(OIDC_T lastmatch,
int tcount,
OIDC_T *tlist,
SNMP_PKT_T *pktp,
VB_T *vbp)
{
STRUCT_mip6HaListEntry data; /* !!! */
int error;
/* find all the varbinds that share the same getproc and instance */
group_by_getproc_and_instance(pktp, vbp, tcount, tlist);
/* use the instance (tcount and tlist) to look up the entry in the
* table. This lookup routine will probably have to be changed to
* suit your system. */
if ((data = mip6HaListEntry_lookup(tcount, tlist)) == 0) /* !!! */
for ( ; vbp; vbp = vbp->vb_link)
getproc_nosuchins(pktp, vbp);
else {
/* retrieve all the values from the same data structure */
for ( ; vbp; vbp = vbp->vb_link) {
if ((error = mip6HaListEntry_get_value(vbp->vb_ml.ml_last_match, pktp, vbp, &data)) != NO_ERROR)
getproc_error(pktp, vbp, error);
}
}
}
void
mip6HaListEntry_next(OIDC_T lastmatch,
int tcount,
OIDC_T *tlist,
SNMP_PKT_T *pktp,
VB_T *vbp)
{
#define mip6HaListEntry_INSTANCE_LEN 258 /* !!! */
STRUCT_mip6HaListEntry *data; /* !!! */
STRUCT_mip6HaListEntry *best; /* !!! */
OIDC_T tmp_inst[mip6HaListEntry_INSTANCE_LEN];
OIDC_T best_inst[mip6HaListEntry_INSTANCE_LEN];
int i;
int error;
unsigned inst_len;
unsigned best_inst_len;
/* find all the varbinds that share the same getproc and instance */
group_by_getproc_and_instance(pktp, vbp, tcount, tlist);
/* generate the instance of each table entry and find the
* smallest instance that's larger than tcount/tlist */
best = 0;
/* This loop needs to iterate over each entry in your table */
for (data = mip6HaListEntry_first(); data; /* !!! */
data = mip6HaListEntry_int_next(data)) { /* !!! */
inst_len = mip6HaListEntry_build_instance(data, tmp_inst);
if ((oidcmp2(inst_len, tmp_inst, tcount, tlist) > 0) &&
((!best || (oidcmp2(inst_len, tmp_inst,
inst_len, best_inst) < 0)))) {
best = data;
for (i = 0; i < inst_len; i++)
best_inst[i] = tmp_inst[i];
best_inst_len = inst_len;
}
}
if (best) {
/* we found a next so get the values and set the instance for all
* the varbinds for this row of this table.
* NOTE: if you allow holes in the table then this code will have to
* change significantly to accomodate that. */
for ( ; vbp ; vbp = vbp->vb_link) {
if ((error = mip6HaListEntry_get_value(vbp->vb_ml.ml_last_match, pktp, vbp, best)) == NO_ERROR)
nextproc_next_instance(pktp, vbp, best_inst_len, best_inst);
else
nextproc_error(pktp, vbp, error);
}
}
else /* there's no more in this table */
for ( ; vbp ; vbp = vbp->vb_link )
nextproc_no_next(pktp, vbp);
}
/*
* Method routines for the mip6HaGlAddrTable:
*
* mip6HaGaAddrSeqNo -- not-accessible
* The index that along with ipv6InterfaceIfIndex,
* mip6HaLinkLocalAddressType, and
* mip6HaLinkLocalAddress uniquely identifies this row.
*
* mip6HaGaGlobalAddressType -- read-only
* The address type for the global address of the
* home agent that follows.
*
* mip6HaGaGlobalAddress -- read-only
* A global address of the home agent.
*
* The type of the address represented by this object
* is specified by the corresponding
* mip6HaGaGlobalAddressType object.
*/
/* An internal routine to retrieve the values of the variables, used
* by the method routines mip6HaGlAddrEntry_get and mip6HaGlAddrEntry_next.
* You need to replace the type STRUCT_mip6HaGlAddrEntry with something
* appropriate to your system. */
static int
mip6HaGlAddrEntry_get_value(OIDC_T lastmatch,
SNMP_PKT_T *pktp,
VB_T *vbp,
STRUCT_mip6HaGlAddrEntry *data) /* !!! */
{
switch(lastmatch) {
case LEAF_mip6HaGaGlobalAddressType:
/* Values:
* unknown(0) = VAL_mip6HaGaGlobalAddressType_unknown
* ipv4(1) = VAL_mip6HaGaGlobalAddressType_ipv4
* ipv6(2) = VAL_mip6HaGaGlobalAddressType_ipv6
* ipv4z(3) = VAL_mip6HaGaGlobalAddressType_ipv4z
* ipv6z(4) = VAL_mip6HaGaGlobalAddressType_ipv6z
* dns(16) = VAL_mip6HaGaGlobalAddressType_dns
*/
getproc_got_int32(pktp, vbp, data->mip6HaGaGlobalAddressType); /* !!! */
break;
case LEAF_mip6HaGaGlobalAddress:
/* !!! This code uses the getproc_got_octet_string() API,
* which always allocates a new buffer to store the data
* provided. For more control over memory allocations,
* use getproc_got_string() instead.
*/
getproc_got_octet_string(pktp, vbp, octet_string_length(data->mip6HaGaGlobalAddress), data->mip6HaGaGlobalAddress, VT_STRING); /* !!! */
break;
default:
return GEN_ERR;
}
return NO_ERROR;
}
void
mip6HaGlAddrEntry_get(OIDC_T lastmatch,
int tcount,
OIDC_T *tlist,
SNMP_PKT_T *pktp,
VB_T *vbp)
{
STRUCT_mip6HaGlAddrEntry data; /* !!! */
int error;
/* find all the varbinds that share the same getproc and instance */
group_by_getproc_and_instance(pktp, vbp, tcount, tlist);
/* use the instance (tcount and tlist) to look up the entry in the
* table. This lookup routine will probably have to be changed to
* suit your system. */
if ((data = mip6HaGlAddrEntry_lookup(tcount, tlist)) == 0) /* !!! */
for ( ; vbp; vbp = vbp->vb_link)
getproc_nosuchins(pktp, vbp);
else {
/* retrieve all the values from the same data structure */
for ( ; vbp; vbp = vbp->vb_link) {
if ((error = mip6HaGlAddrEntry_get_value(vbp->vb_ml.ml_last_match, pktp, vbp, &data)) != NO_ERROR)
getproc_error(pktp, vbp, error);
}
}
}
void
mip6HaGlAddrEntry_next(OIDC_T lastmatch,
int tcount,
OIDC_T *tlist,
SNMP_PKT_T *pktp,
VB_T *vbp)
{
#define mip6HaGlAddrEntry_INSTANCE_LEN 259 /* !!! */
STRUCT_mip6HaGlAddrEntry *data; /* !!! */
STRUCT_mip6HaGlAddrEntry *best; /* !!! */
OIDC_T tmp_inst[mip6HaGlAddrEntry_INSTANCE_LEN];
OIDC_T best_inst[mip6HaGlAddrEntry_INSTANCE_LEN];
int i;
int error;
unsigned inst_len;
unsigned best_inst_len;
/* find all the varbinds that share the same getproc and instance */
group_by_getproc_and_instance(pktp, vbp, tcount, tlist);
/* generate the instance of each table entry and find the
* smallest instance that's larger than tcount/tlist */
best = 0;
/* This loop needs to iterate over each entry in your table */
for (data = mip6HaGlAddrEntry_first(); data; /* !!! */
data = mip6HaGlAddrEntry_int_next(data)) { /* !!! */
inst_len = mip6HaGlAddrEntry_build_instance(data, tmp_inst);
if ((oidcmp2(inst_len, tmp_inst, tcount, tlist) > 0) &&
((!best || (oidcmp2(inst_len, tmp_inst,
inst_len, best_inst) < 0)))) {
best = data;
for (i = 0; i < inst_len; i++)
best_inst[i] = tmp_inst[i];
best_inst_len = inst_len;
}
}
if (best) {
/* we found a next so get the values and set the instance for all
* the varbinds for this row of this table.
* NOTE: if you allow holes in the table then this code will have to
* change significantly to accomodate that. */
for ( ; vbp ; vbp = vbp->vb_link) {
if ((error = mip6HaGlAddrEntry_get_value(vbp->vb_ml.ml_last_match, pktp, vbp, best)) == NO_ERROR)
nextproc_next_instance(pktp, vbp, best_inst_len, best_inst);
else
nextproc_error(pktp, vbp, error);
}
}
else /* there's no more in this table */
for ( ; vbp ; vbp = vbp->vb_link )
nextproc_no_next(pktp, vbp);
}
/*
* Method routines for the mip6HaAdvertisement variables:
*
* mip6HaAdvsRecd -- read-only
* Total number of valid Router Advertisements
* received with the Home Agent (H) bit set, on
* all the links on which it is serving as a Home
* Agent.
* Discontinuities in the value of this counter can
* occur at re-initialization of the management system,
* and at other times as indicated by the value of
* mip6CounterDiscontinuityTime.
*
* mip6HaAdvsSent -- read-only
* Total number of unsolicited multicast Router
* Advertisements sent with the Home Agent (H) bit set,
* on all the links on which the router is serving as
* a Home Agent.
* Discontinuities in the value of this counter can
* occur at re-initialization of the management system,
* and at other times as indicated by the value of
* mip6CounterDiscontinuityTime.
*/
/* An internal routine to retrieve the values of the variables, used
* by the method routines mip6HaAdvertisement_get and mip6HaAdvertisement_next.
* You need to replace the type STRUCT_mip6HaAdvertisement with something
* appropriate to your system. */
static int
mip6HaAdvertisement_get_value(OIDC_T lastmatch,
SNMP_PKT_T *pktp,
VB_T *vbp,
STRUCT_mip6HaAdvertisement *data) /* !!! */
{
switch(lastmatch) {
case LEAF_mip6HaAdvsRecd:
getproc_got_uint32(pktp, vbp, data->mip6HaAdvsRecd, VT_COUNTER); /* !!! */
break;
case LEAF_mip6HaAdvsSent:
getproc_got_uint32(pktp, vbp, data->mip6HaAdvsSent, VT_COUNTER); /* !!! */
break;
default:
return GEN_ERR;
}
return NO_ERROR;
}
void
mip6HaAdvertisement_get(OIDC_T lastmatch,
int tcount,
OIDC_T *tlist,
SNMP_PKT_T *pktp,
VB_T *vbp)
{
STRUCT_mip6HaAdvertisement data; /* !!! */
int error;
/* find all the varbinds that share the same getproc and instance */
group_by_getproc_and_instance(pktp, vbp, tcount, tlist);
/* check that the instance is exactly .0 */
if (!((tcount == 1) && (*tlist == 0)))
for ( ; vbp; vbp = vbp->vb_link)
getproc_nosuchins(pktp, vbp);
/* grab the actual data for this variable. this lookup routine will
* probably have to be changed for your system. for scalar variables
* there might not even be any lookup routine. */
else if (mip6HaAdvertisement_lookup(&data) != 0) /* !!! */
for ( ; vbp; vbp = vbp->vb_link)
getproc_error(pktp, vbp, GEN_ERR);
else {
/* retrieve all the values from the same data structure */
for ( ; vbp; vbp = vbp->vb_link) {
if ((error = mip6HaAdvertisement_get_value(vbp->vb_ml.ml_last_match, pktp, vbp, &data)) != NO_ERROR)
getproc_error(pktp, vbp, error);
}
}
}
void
mip6HaAdvertisement_next(OIDC_T lastmatch,
int tcount,
OIDC_T *tlist,
SNMP_PKT_T *pktp,
VB_T *vbp)
{
STRUCT_mip6HaAdvertisement data; /* !!! */
OIDC_T instance = 0;
/* the only time there's a next for a scalar is if we're given
* no instance at all. */
if (tcount != 0)
nextproc_no_next(pktp, vbp);
/* grab the data for these variables. you'll probably have to change
* this lookup routine for your system. for scalar variables there
* might not even be any lookup routine. */
else if (mip6HaAdvertisement_lookup(&data)) /* !!! */
getproc_error(pktp, vbp, GEN_ERR);
else {
/* find all the varbinds in this group and retrieve their
* values from the same data structure */
for (group_by_getproc_and_instance(pktp, vbp, tcount, tlist);
vbp; vbp = vbp->vb_link) {
nextproc_next_instance(pktp, vbp, 1, &instance);
mip6HaAdvertisement_get_value(vbp->vb_ml.ml_last_match, pktp, vbp, &data);
}
}
}
/*
* Method routines for the mip6HaGlobalStats variables:
*
* mip6HaHomeTestInitsRecd -- read-only
* Total number of Home Test Init messages received by
* the home agent. This will include Home Test Init
* messages that failed the validity checks.
* Discontinuities in the value of this counter can
* occur at re-initialization of the management system,
* and at other times as indicated by the value of
* mip6CounterDiscontinuityTime.
*
* mip6HaHomeTestsSent -- read-only
* Total number of Home Test messages sent by the
* home agent.
* Discontinuities in the value of this counter can
* occur at re-initialization of the management system,
* and at other times as indicated by the value of
* mip6CounterDiscontinuityTime.
*
* mip6HaBUsRecd -- read-only
* Total number of Binding Updates received by the
* home agent.
* Discontinuities in the value of this counter can
* occur at re-initialization of the management system,
* and at other times as indicated by the value of
* mip6CounterDiscontinuityTime.
*
* mip6HaBUAcksSent -- read-only
* Total number of Binding Acknowledgments sent
* by the home agent.
* Discontinuities in the value of this counter can
* occur at re-initialization of the management system,
* and at other times as indicated by the value of
* mip6CounterDiscontinuityTime.
*
* mip6HaBRAdviceSent -- read-only
* Total number of Binding Acknowledgments sent
* by the home agent with Binding Refresh Advice
* mobility option included.
* Discontinuities in the value of this counter can
* occur at re-initialization of the management system,
* and at other times as indicated by the value of
* mip6CounterDiscontinuityTime.
*
* mip6HaBUsAccepted -- read-only
* Total number of Binding Updates accepted by this HA.
* Binding Acknowledgment with status code of 0 or 1.
* Discontinuities in the value of this counter can
* occur at re-initialization of the management system,
* and at other times as indicated by the value of
* mip6CounterDiscontinuityTime.
*
* mip6HaPrefDiscoverReqd -- read-only
* The total number of Binding Acknowledgments sent by
* the home agent with status code indicating 'accepted
* but prefix discovery necessary' (Code 1).
* Discontinuities in the value of this counter can
* occur at re-initialization of the management system,
* and at other times as indicated by the value of
* mip6CounterDiscontinuityTime.
*
* mip6HaReasonUnspecified -- read-only
* Total number of Binding Update requests rejected by
* the home agent with status code in the Binding
* Acknowledgment message indicating 'reason
* unspecified' (Code 128).
* Discontinuities in the value of this counter can
* occur at re-initialization of the management system,
* and at other times as indicated by the value of
* mip6CounterDiscontinuityTime.
*
* mip6HaAdmProhibited -- read-only
* Total number of Binding Update requests rejected by
* the home agent with status code in the Binding
* Acknowledgment message indicating 'administratively
* prohibited' (Code 129).
* Discontinuities in the value of this counter can
* occur at re-initialization of the management system,
* and at other times as indicated by the value of
* mip6CounterDiscontinuityTime.
*
* mip6HaInsufficientResource -- read-only
* Total number of Binding Update requests rejected by
* the home agent with status code in the Binding
* Acknowledgment message indicating 'insufficient
* resources' (Code 130).
* Discontinuities in the value of this counter can
* occur at re-initialization of the management system,
* and at other times as indicated by the value of
* mip6CounterDiscontinuityTime.
*
* mip6HaHomeRegnNotSupported -- read-only
* Total number of Binding Update requests rejected by
* the home agent with status code in the Binding
* Acknowledgment message indicating 'home
* registration not supported' (Code 131).
* Discontinuities in the value of this counter can
* occur at re-initialization of the management system,
* and at other times as indicated by the value of
* mip6CounterDiscontinuityTime.
*
* mip6HaNotHomeSubnet -- read-only
* Total number of Binding Update requests rejected by
* the home agent with status code in the Binding
* Acknowledgment message indicating 'not home subnet'
* (Code 132).
* Discontinuities in the value of this counter can
* occur at re-initialization of the management system,
* and at other times as indicated by the value of
* mip6CounterDiscontinuityTime.
*
* mip6HaNotHomeAgentForThisMN -- read-only
* Total number of Binding Update requests rejected by
* the home agent with status code in the Binding
* Acknowledgment message indicating 'not home agent
* for this mobile node' (Code 133).
* Discontinuities in the value of this counter can
* occur at re-initialization of the management system,
* and at other times as indicated by the value of
* mip6CounterDiscontinuityTime.
*
* mip6HaDupAddrDetectionFailed -- read-only
* Total number of Binding Update requests rejected by
* the home agent with status code in the Binding
* Acknowledgment message indicating 'Duplicate
* Address Detection failed' (Code 134).
* Discontinuities in the value of this counter can
* occur at re-initialization of the management system,
* and at other times as indicated by the value of
* mip6CounterDiscontinuityTime.
*
* mip6HaSeqNumberOutOfWindow -- read-only
* Total number of Binding Update requests rejected by
* the home agent with status code in the Binding
* Acknowledgment message indicating 'sequence number
* out of window' (Code 135).
* Discontinuities in the value of this counter can
* occur at re-initialization of the management system,
* and at other times as indicated by the value of
* mip6CounterDiscontinuityTime.
*
* mip6HaExpiredHomeNonceIndex -- read-only
* Total number of Binding Update requests rejected by
* the home agent with status code in the Binding
* Acknowledgment message indicating 'expired home
* nonce index' (Code 136).
* Discontinuities in the value of this counter can
* occur at re-initialization of the management system,
* and at other times as indicated by the value of
* mip6CounterDiscontinuityTime.
*
* mip6HaRegTypeChangeDisallowed -- read-only
* Total number of Binding Update requests rejected by
* the home agent with status code in the Binding
* Acknowledgment message indicating 'registration
* type change disallowed' (Code 139), i.e., a binding
* already exists for the given home address and the
* home registration flag has a different value than
* the Home Registration (H) bit in the Binding Update.
* Discontinuities in the value of this counter can
* occur at re-initialization of the management system,
* and at other times as indicated by the value of
* mip6CounterDiscontinuityTime.
*/
/* An internal routine to retrieve the values of the variables, used
* by the method routines mip6HaGlobalStats_get and mip6HaGlobalStats_next.
* You need to replace the type STRUCT_mip6HaGlobalStats with something
* appropriate to your system. */
static int
mip6HaGlobalStats_get_value(OIDC_T lastmatch,
SNMP_PKT_T *pktp,
VB_T *vbp,
STRUCT_mip6HaGlobalStats *data) /* !!! */
{
switch(lastmatch) {
case LEAF_mip6HaHomeTestInitsRecd:
getproc_got_uint32(pktp, vbp, data->mip6HaHomeTestInitsRecd, VT_COUNTER); /* !!! */
break;
case LEAF_mip6HaHomeTestsSent:
getproc_got_uint32(pktp, vbp, data->mip6HaHomeTestsSent, VT_COUNTER); /* !!! */
break;
case LEAF_mip6HaBUsRecd:
getproc_got_uint32(pktp, vbp, data->mip6HaBUsRecd, VT_COUNTER); /* !!! */
break;
case LEAF_mip6HaBUAcksSent:
getproc_got_uint32(pktp, vbp, data->mip6HaBUAcksSent, VT_COUNTER); /* !!! */
break;
case LEAF_mip6HaBRAdviceSent:
getproc_got_uint32(pktp, vbp, data->mip6HaBRAdviceSent, VT_COUNTER); /* !!! */
break;
case LEAF_mip6HaBUsAccepted:
getproc_got_uint32(pktp, vbp, data->mip6HaBUsAccepted, VT_COUNTER); /* !!! */
break;
case LEAF_mip6HaPrefDiscoverReqd:
getproc_got_uint32(pktp, vbp, data->mip6HaPrefDiscoverReqd, VT_COUNTER); /* !!! */
break;
case LEAF_mip6HaReasonUnspecified:
getproc_got_uint32(pktp, vbp, data->mip6HaReasonUnspecified, VT_COUNTER); /* !!! */
break;
case LEAF_mip6HaAdmProhibited:
getproc_got_uint32(pktp, vbp, data->mip6HaAdmProhibited, VT_COUNTER); /* !!! */
break;
case LEAF_mip6HaInsufficientResource:
getproc_got_uint32(pktp, vbp, data->mip6HaInsufficientResource, VT_COUNTER); /* !!! */
break;
case LEAF_mip6HaHomeRegnNotSupported:
getproc_got_uint32(pktp, vbp, data->mip6HaHomeRegnNotSupported, VT_COUNTER); /* !!! */
break;
case LEAF_mip6HaNotHomeSubnet:
getproc_got_uint32(pktp, vbp, data->mip6HaNotHomeSubnet, VT_COUNTER); /* !!! */
break;
case LEAF_mip6HaNotHomeAgentForThisMN:
getproc_got_uint32(pktp, vbp, data->mip6HaNotHomeAgentForThisMN, VT_COUNTER); /* !!! */
break;
case LEAF_mip6HaDupAddrDetectionFailed:
getproc_got_uint32(pktp, vbp, data->mip6HaDupAddrDetectionFailed, VT_COUNTER); /* !!! */
break;
case LEAF_mip6HaSeqNumberOutOfWindow:
getproc_got_uint32(pktp, vbp, data->mip6HaSeqNumberOutOfWindow, VT_COUNTER); /* !!! */
break;
case LEAF_mip6HaExpiredHomeNonceIndex:
getproc_got_uint32(pktp, vbp, data->mip6HaExpiredHomeNonceIndex, VT_COUNTER); /* !!! */
break;
case LEAF_mip6HaRegTypeChangeDisallowed:
getproc_got_uint32(pktp, vbp, data->mip6HaRegTypeChangeDisallowed, VT_COUNTER); /* !!! */
break;
default:
return GEN_ERR;
}
return NO_ERROR;
}
void
mip6HaGlobalStats_get(OIDC_T lastmatch,
int tcount,
OIDC_T *tlist,
SNMP_PKT_T *pktp,
VB_T *vbp)
{
STRUCT_mip6HaGlobalStats data; /* !!! */
int error;
/* find all the varbinds that share the same getproc and instance */
group_by_getproc_and_instance(pktp, vbp, tcount, tlist);
/* check that the instance is exactly .0 */
if (!((tcount == 1) && (*tlist == 0)))
for ( ; vbp; vbp = vbp->vb_link)
getproc_nosuchins(pktp, vbp);
/* grab the actual data for this variable. this lookup routine will
* probably have to be changed for your system. for scalar variables
* there might not even be any lookup routine. */
else if (mip6HaGlobalStats_lookup(&data) != 0) /* !!! */
for ( ; vbp; vbp = vbp->vb_link)
getproc_error(pktp, vbp, GEN_ERR);
else {
/* retrieve all the values from the same data structure */
for ( ; vbp; vbp = vbp->vb_link) {
if ((error = mip6HaGlobalStats_get_value(vbp->vb_ml.ml_last_match, pktp, vbp, &data)) != NO_ERROR)
getproc_error(pktp, vbp, error);
}
}
}
void
mip6HaGlobalStats_next(OIDC_T lastmatch,
int tcount,
OIDC_T *tlist,
SNMP_PKT_T *pktp,
VB_T *vbp)
{
STRUCT_mip6HaGlobalStats data; /* !!! */
OIDC_T instance = 0;
/* the only time there's a next for a scalar is if we're given
* no instance at all. */
if (tcount != 0)
nextproc_no_next(pktp, vbp);
/* grab the data for these variables. you'll probably have to change
* this lookup routine for your system. for scalar variables there
* might not even be any lookup routine. */
else if (mip6HaGlobalStats_lookup(&data)) /* !!! */
getproc_error(pktp, vbp, GEN_ERR);
else {
/* find all the varbinds in this group and retrieve their
* values from the same data structure */
for (group_by_getproc_and_instance(pktp, vbp, tcount, tlist);
vbp; vbp = vbp->vb_link) {
nextproc_next_instance(pktp, vbp, 1, &instance);
mip6HaGlobalStats_get_value(vbp->vb_ml.ml_last_match, pktp, vbp, &data);
}
}
}
/*
* Method routines for the mip6HaCounterTable:
*
* mip6HaBURequestsAccepted -- read-only
* Total number of service requests for the mobile node
* accepted by the home agent.
* Discontinuities in the value of this counter can
* occur at re-initialization of the management system,
* and at other times as indicated by the value of
* mip6HaCtrDiscontinuityTime.
*
* mip6HaBURequestsDenied -- read-only
* Total number of service requests for the mobile node
* rejected by the home agent.
* Discontinuities in the value of this counter can
* occur at re-initialization of the management system,
* and at other times as indicated by the value of
* mip6HaCtrDiscontinuityTime.
*
* mip6HaBCEntryCreationTime -- read-only
* The time when the current Binding Cache entry was
* created for the mobile node.
*
* mip6HaBUAcceptedTime -- read-only
* The time at which the last Binding Update was
* accepted by the home agent for this mobile node.
*
* mip6HaBURejectionTime -- read-only
* The time at which the last Binding Update was
* rejected by the home agent for this mobile node.
* If there have been no rejections, then this object
* will be inaccessible.
*
* mip6HaRecentBURejectionCode -- read-only
* If a Binding Acknowledgment is sent to the mobile
* node, this is the status code (> 128) that is
* returned in the Binding Acknowledgment.
* In case a Binding Acknowledgment is not sent to the
* mobile node, then this will be the value of the
* status code that corresponds to the reason of the
* rejection.
* If there have been no rejections, then this object
* will be inaccessible.
*
* mip6HaCtrDiscontinuityTime -- read-only
* The value of sysUpTime on the most recent occasion
* at which any one or more of counters in this row,
* viz., instances of 'mip6HaBURequestsAccepted' and
* 'mip6HaBURequestsRejected', suffered a discontinuity.
* If no such discontinuities have occurred since the
* last re-initialization of the local management
* subsystem, then this object will have a zero value.
*/
/* An internal routine to retrieve the values of the variables, used
* by the method routines mip6HaCounterEntry_get and mip6HaCounterEntry_next.
* You need to replace the type STRUCT_mip6HaCounterEntry with something
* appropriate to your system. */
static int
mip6HaCounterEntry_get_value(OIDC_T lastmatch,
SNMP_PKT_T *pktp,
VB_T *vbp,
STRUCT_mip6HaCounterEntry *data) /* !!! */
{
switch(lastmatch) {
case LEAF_mip6HaBURequestsAccepted:
getproc_got_uint32(pktp, vbp, data->mip6HaBURequestsAccepted, VT_COUNTER); /* !!! */
break;
case LEAF_mip6HaBURequestsDenied:
getproc_got_uint32(pktp, vbp, data->mip6HaBURequestsDenied, VT_COUNTER); /* !!! */
break;
case LEAF_mip6HaBCEntryCreationTime:
/* !!! This code uses the getproc_got_octet_string() API,
* which always allocates a new buffer to store the data
* provided. For more control over memory allocations,
* use getproc_got_string() instead.
*/
getproc_got_octet_string(pktp, vbp, octet_string_length(data->mip6HaBCEntryCreationTime), data->mip6HaBCEntryCreationTime, VT_STRING); /* !!! */
break;
case LEAF_mip6HaBUAcceptedTime:
/* !!! This code uses the getproc_got_octet_string() API,
* which always allocates a new buffer to store the data
* provided. For more control over memory allocations,
* use getproc_got_string() instead.
*/
getproc_got_octet_string(pktp, vbp, octet_string_length(data->mip6HaBUAcceptedTime), data->mip6HaBUAcceptedTime, VT_STRING); /* !!! */
break;
case LEAF_mip6HaBURejectionTime:
/* !!! This code uses the getproc_got_octet_string() API,
* which always allocates a new buffer to store the data
* provided. For more control over memory allocations,
* use getproc_got_string() instead.
*/
getproc_got_octet_string(pktp, vbp, octet_string_length(data->mip6HaBURejectionTime), data->mip6HaBURejectionTime, VT_STRING); /* !!! */
break;
case LEAF_mip6HaRecentBURejectionCode:
/* Values:
* reasonUnspecified(1) = VAL_mip6HaRecentBURejectionCode_reasonUnspecified
* admProhibited(2) = VAL_mip6HaRecentBURejectionCode_admProhibited
* insufficientResource(3) = VAL_mip6HaRecentBURejectionCode_insufficientResource
* homeRegistrationNotSupported(4) = VAL_mip6HaRecentBURejectionCode_homeRegistrationNotSupported
* notHomeSubnet(5) = VAL_mip6HaRecentBURejectionCode_notHomeSubnet
* notHomeAgentForThisMobileNode(6) = VAL_mip6HaRecentBURejectionCode_notHomeAgentForThisMobileNode
* duplicateAddressDetectionFailed(7) = VAL_mip6HaRecentBURejectionCode_duplicateAddressDetectionFailed
* sequenceNumberOutOfWindow(8) = VAL_mip6HaRecentBURejectionCode_sequenceNumberOutOfWindow
* expiredHomeNonceIndex(9) = VAL_mip6HaRecentBURejectionCode_expiredHomeNonceIndex
* expiredCareofNonceIndex(10) = VAL_mip6HaRecentBURejectionCode_expiredCareofNonceIndex
* expiredNonces(11) = VAL_mip6HaRecentBURejectionCode_expiredNonces
* registrationTypeChangeDisallowed(12) = VAL_mip6HaRecentBURejectionCode_registrationTypeChangeDisallowed
*/
getproc_got_int32(pktp, vbp, data->mip6HaRecentBURejectionCode); /* !!! */
break;
case LEAF_mip6HaCtrDiscontinuityTime:
getproc_got_uint32(pktp, vbp, data->mip6HaCtrDiscontinuityTime, VT_TIMETICKS); /* !!! */
break;
default:
return GEN_ERR;
}
return NO_ERROR;
}
void
mip6HaCounterEntry_get(OIDC_T lastmatch,
int tcount,
OIDC_T *tlist,
SNMP_PKT_T *pktp,
VB_T *vbp)
{
STRUCT_mip6HaCounterEntry data; /* !!! */
int error;
/* find all the varbinds that share the same getproc and instance */
group_by_getproc_and_instance(pktp, vbp, tcount, tlist);
/* use the instance (tcount and tlist) to look up the entry in the
* table. This lookup routine will probably have to be changed to
* suit your system. */
if ((data = mip6HaCounterEntry_lookup(tcount, tlist)) == 0) /* !!! */
for ( ; vbp; vbp = vbp->vb_link)
getproc_nosuchins(pktp, vbp);
else {
/* retrieve all the values from the same data structure */
for ( ; vbp; vbp = vbp->vb_link) {
if ((error = mip6HaCounterEntry_get_value(vbp->vb_ml.ml_last_match, pktp, vbp, &data)) != NO_ERROR)
getproc_error(pktp, vbp, error);
}
}
}
void
mip6HaCounterEntry_next(OIDC_T lastmatch,
int tcount,
OIDC_T *tlist,
SNMP_PKT_T *pktp,
VB_T *vbp)
{
#define mip6HaCounterEntry_INSTANCE_LEN 257 /* !!! */
STRUCT_mip6HaCounterEntry *data; /* !!! */
STRUCT_mip6HaCounterEntry *best; /* !!! */
OIDC_T tmp_inst[mip6HaCounterEntry_INSTANCE_LEN];
OIDC_T best_inst[mip6HaCounterEntry_INSTANCE_LEN];
int i;
int error;
unsigned inst_len;
unsigned best_inst_len;
/* find all the varbinds that share the same getproc and instance */
group_by_getproc_and_instance(pktp, vbp, tcount, tlist);
/* generate the instance of each table entry and find the
* smallest instance that's larger than tcount/tlist */
best = 0;
/* This loop needs to iterate over each entry in your table */
for (data = mip6HaCounterEntry_first(); data; /* !!! */
data = mip6HaCounterEntry_int_next(data)) { /* !!! */
inst_len = mip6HaCounterEntry_build_instance(data, tmp_inst);
if ((oidcmp2(inst_len, tmp_inst, tcount, tlist) > 0) &&
((!best || (oidcmp2(inst_len, tmp_inst,
inst_len, best_inst) < 0)))) {
best = data;
for (i = 0; i < inst_len; i++)
best_inst[i] = tmp_inst[i];
best_inst_len = inst_len;
}
}
if (best) {
/* we found a next so get the values and set the instance for all
* the varbinds for this row of this table.
* NOTE: if you allow holes in the table then this code will have to
* change significantly to accomodate that. */
for ( ; vbp ; vbp = vbp->vb_link) {
if ((error = mip6HaCounterEntry_get_value(vbp->vb_ml.ml_last_match, pktp, vbp, best)) == NO_ERROR)
nextproc_next_instance(pktp, vbp, best_inst_len, best_inst);
else
nextproc_error(pktp, vbp, error);
}
}
else /* there's no more in this table */
for ( ; vbp ; vbp = vbp->vb_link )
nextproc_no_next(pktp, vbp);
}
#endif /* WRSNMP */
#endif
#endif
#endif