impl.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) 1998 by Sun Microsystems, Inc.
* All rights reserved.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include <string.h>
#include <errno.h>
#include <netdb.h>
#include "snmp_msg.h"
#include "impl.h"
#include "asn1.h"
#include "snmp.h"
#include "error.h"
/********************************************************************/
{
static char buffer[50];
switch(type)
{
case GET_REQ_MSG:
break;
case GETNEXT_REQ_MSG:
break;
case GET_RSP_MSG:
break;
case SET_REQ_MSG:
break;
case TRP_REQ_MSG:
break;
default:
break;
}
return buffer;
}
/********************************************************************/
{
static char buffer[50];
switch(type)
{
case ASN_INTEGER:
break;
case COUNTER:
break;
case GAUGE:
break;
case TIMETICKS:
break;
case ASN_OCTET_STR:
break;
case IPADDRESS:
break;
case OPAQUE:
break;
case ASN_OBJECT_ID:
break;
case ASN_NULL:
break;
default:
break;
}
return buffer;
}
/********************************************************************/
char *error_status_string(int status)
{
static char buffer[50];
switch(status)
{
case SNMP_ERR_NOERROR:
break;
case SNMP_ERR_TOOBIG:
break;
case SNMP_ERR_NOSUCHNAME:
break;
case SNMP_ERR_BADVALUE:
break;
case SNMP_ERR_READONLY:
break;
case SNMP_ERR_GENERR:
break;
default:
break;
}
return buffer;
}
/********************************************************************/
char *generic_trap_string(int generic)
{
static char buffer[50];
switch(generic)
{
case SNMP_TRAP_COLDSTART:
break;
case SNMP_TRAP_WARMSTART:
break;
case SNMP_TRAP_LINKDOWN:
break;
case SNMP_TRAP_LINKUP:
break;
case SNMP_TRAP_AUTHFAIL:
break;
break;
break;
default:
break;
}
return buffer;
}
/********************************************************************/
/* we should check if the buffer is not too small */
{
static char buffer[1000];
int i;
{
return buffer;
}
{
return buffer;
}
/* LINTED */
}
/* LINTED */
return buffer;
}
/********************************************************************/
{
static char buffer[50];
{
return buffer;
}
return buffer;
}
/********************************************************************/
{
static char buffer[50];
if(ip_address == NULL)
{
return buffer;
}
if(hp)
{
}
else
{
}
return buffer;
}
/********************************************************************/
{
static char buffer[50];
{
return buffer;
}
if(hp)
{
}
else
{
}
return buffer;
}
/********************************************************************/
{
error_label[0] = '\0';
{
return -1;
}
{
return -1;
}
{
return -1;
}
{
return -1;
}
{
return 0;
}
{
return -1;
}
return 0;
}
/********************************************************************/
{
{
return;
}
{
}
return;
}
/********************************************************************/
{
error_label[0] = '\0';
{
return -1;
}
{
return -1;
}
{
return -1;
}
if(len != 0)
{
{
return -1;
}
}
return 0;
}
/********************************************************************/
/*
* SSAOidCmp() returns:
*
* 0 if oid1 == oid2
* 1 if oid1 > oid2
* -1 if oid1 < oid2
*/
{
int min;
int i;
{
return -2;
}
{
return -2;
}
for(i = 0; i < min; i++)
{
{
return 1;
}
{
return -1;
}
}
{
return 0;
}
else
{
return 1;
}
else
{
return -1;
}
}
/********************************************************************/
{
error_label[0] = '\0';
return -1;
}
return -1;
}
return 0;
}
return -1;
}
return -1;
}
return -1;
}
return 0;
}
/********************************************************************/
{
error_label[0] = '\0';
{
return NULL;
}
{
return NULL;
}
{
return NULL;
}
return new;
}
/********************************************************************/
{
return (oid);
}
/********************************************************************/
{
{
return;
}
{
}
}
/********************************************************************/
{
return;
}
}
/********************************************************************/
{
error_label[0] = '\0';
{
return -1;
}
{
return -1;
}
{
return -1;
}
if(len != 0)
{
{
return -1;
}
}
return 0;
}
/********************************************************************/
{
error_label[0] = '\0';
{
errno_string());
return -1;
}
{
return -1;
}
{
return -1;
}
{
return -1;
}
return 0;
}
/********************************************************************/
{
error_label[0] = '\0';
{
return -1;
}
if(ip_address == NULL)
{
return -1;
}
/* try to find the IP address from the name */
{
{
return -1;
}
}
else
{
{
return -1;
}
{
return -1;
}
{
return -1;
}
}
return 0;
}
{
static char buffer[100];
buffer[0] = '\0';
return buffer;
}
/* error return NULL, success return Oid ptr */
{
int len = 0;
int i;
char *num_c;
for (i=0; name[i] != '\0'; i++) {
if (name[i] == '.')
len++;
return(NULL);
}
}
if (!len ) {
return (NULL); /* not a valid name */
}
len++;
return (NULL) ;
}
return (NULL);
}
i = 0;
/* LINTED */
i++;
/* LINTED */
i++;
}
return(name_oid);
}