snmp_maAdvConfigEntry.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright (c) 1999-2001 by Sun Microsystems, Inc.
* All rights reserved.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* file: mipagentsnmp_maAdvConfigEntry.c
*
* This file contains the SNMP routines used to retrieve
* the Mobility Agent's Interface Information.
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <impl.h>
#include <snmp.h>
#include "snmp_stub.h"
#include "agent.h"
extern HashTable maAdvConfigHash;
/*
* Function: get_maAdvConfigEntry
*
* Arguments: search_type - The type of search (first, next, exact)
* maAdvConfigEntry_data - Pointer to a pointer which
* will contain the interface entry upon
* successful completion.
* index - Pointer to the current index
*
* Description: This function will allocate the memory required for
* the interface entry, and will find the appropriate
* interface entry based on the index provided. If the
* search type is set to FIRST_ENTRY, we will return
* the first interface entry in the Hash Table, otherwise
* the index is used.
*
* The interface entry is then setup with the values found
* in the entry from the hash table and returned to the
* caller.
*
* Note, the caller is responsible for either freeing the
* memory, or calling free_maAdvConfigEntry()
*
* Returns: int, 0 if successful
*/
extern int
{
int i;
int j;
int len;
int return_code = SNMP_ERR_NOERROR;
char buffer[258];
if (maAdvConfigEntry_data == NULL) {
return (SNMP_ERR_GENERR);
}
/*
* In the case, the search_type is FIRST_ENTRY or NEXT_ENTRY
* this function should modify the index argument to the
* appropriate value
*/
switch (search_type) {
case FIRST_ENTRY:
/*
* We are looking for the first entry in the list.
*/
break;
case NEXT_ENTRY:
/*
* Increment the index value.
*/
break;
case EXACT_ENTRY:
/*
* We don't need to play around with the
* index for this search type.
*/
break;
default:
goto the_end;
}
/*
* Now search for the entry...
*/
if (maAdvConfigHash.buckets[i]) {
/*
* Lock the bucket
*/
/*
* Lock the node
*/
(void) rw_rdlock(&maAdvConfigEntry->
break;
}
j++;
}
/*
* Unlock the bucket
*/
}
}
if (maAdvConfigEntry == NULL) {
goto the_end;
}
/*
* And now we return the Maximum Registration Lifetime.
*/
/*
* And now we return the Prefix Length Inclusion.
*/
*integer = 1;
} else {
/* I need to validate this one. Should this be 2 or 0 ? */
*integer = 2;
}
/*
* Get the Advertised Address.
*/
goto the_end;
}
/*
* And now we return the Maximum Advertisement Interval.
*/
/*
* And now we return the Minimum Advertisement Interval.
*/
#if 0
/*
* And now we return whether we only advertise if we receive
* a soliciation.
*/
*integer = 1;
} else {
/* I need to validate this one. Should this be 2 or 0 ? */
*integer = 2;
}
#endif
/*
* And now we return whether the entry is active. In our case,
* all entries are active, so we can hardcode the value.
*/
*integer = 1;
if (maAdvConfigEntry != NULL) {
/*
* Unlock the node
*/
}
if (return_code != SNMP_ERR_NOERROR) {
}
return_code, (void *)*maAdvConfigEntry_data);
return (return_code);
}
/*
* Function: free_maAdvConfigEntry
*
* Arguments: maAdvConfigEntry - Pointer to a previously
* allocated SNMP interface entry
*
* Description: This function is called to free a previously
* allocated SNMP interface entry.
*
* Returns:
*/
void
{
if (maAdvConfigEntry) {
/*
* The template generates code that checks both
* the pointer, and the length. I am not sure
* if this is excessive, so I will leave it as is.
*/
}
}
}