request.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 2004 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <unistd.h>
#include <stdio.h>
#include <errno.h>
#include <syslog.h>
#include <string.h>
#include <netdb.h>
#include <nlist.h>
#include "snmp_msg.h"
#include "impl.h"
#include "trace.h"
#include "snmp.h"
#include "pdu.h"
#include "request.h"
#include "error.h"
/***** GLOBAL VARIABLES *****/
/***** LOCAL VARIABLES *****/
static uint32_t request_id = 0;
/********************************************************************/
{
error_label[0] = '\0';
switch(type)
{
case GET_REQ_MSG:
case GETNEXT_REQ_MSG:
case SET_REQ_MSG:
break;
default:
type);
return NULL;
}
{
return NULL;
}
{
return NULL;
}
return request;
}
/********************************************************************/
SNMP_pdu *request_send_to_port_time_out_blocking(IPAddress *ip_address, int port,struct timeval *timeout,SNMP_pdu *request, char *error_label)
{
int sd;
int numfds;
int count;
error_label[0] = '\0';
{
return NULL;
}
{
case GET_REQ_MSG:
case GETNEXT_REQ_MSG:
case SET_REQ_MSG:
break;
default:
return NULL;
}
/* sd */
if(sd < 0)
{
errno_string());
return (NULL);
}
else
{
errno_string());
return NULL;
}
/* address */
/* LINTED */
{
return NULL;
}
for (;;)
{
numfds = 0;
if(count > 0)
{
{
{
return NULL;
}
return response;
}
}
else
{
switch(count)
{
case 0:
return NULL;
case -1:
{
continue;
}
else
{
errno_string());
return NULL;
}
}
}
}
/* NOTREACHED */
}
SNMP_pdu *request_send_to_port_blocking(IPAddress *ip_address, int port,SNMP_pdu *request, char *error_label)
{
}
/*static*/ SNMP_pdu *request_send_blocking(IPAddress *ip_address, SNMP_pdu *request, char *error_label)
{
}
/********************************************************************/
/*
* if the request failed, this function returns 0
* otherwise it returns sysUpTime
*/
{
static int my_ip_address_initialized = False;
static IPAddress my_ip_address;
error_label[0] = '\0';
{
if(my_ip_address_initialized == False)
{
{
return 0;
}
}
if(community_name == NULL)
else
{
return 0;
}
{
return 0;
}
{
return 0;
}
if(response->error_status)
{
return 0;
}
{
return 0;
}
if(trace_level > 0)
{
}
return sysUpTime;
}
/* LINTED */
}
/********************************************************************/
/*
* if the request failed, this function returns -1
* otherwise it returns True or False accordind to the
* value of snmpEnableAuthTraps
*/
int request_snmpEnableAuthTraps(char *error_label)
{
static int my_ip_address_initialized = False;
static IPAddress my_ip_address;
int snmpEnableAuthTraps;
error_label[0] = '\0';
if(my_ip_address_initialized == False)
{
{
return -1;
}
}
{
return -1;
}
{
return -1;
}
{
return -1;
}
if(response->error_status)
{
return -1;
}
{
return -1;
}
if(trace_level > 0)
{
trace("snmpAuthTraps: %s\n\n",
}
switch(snmpEnableAuthTraps)
{
case 1: /* enabled(1) */
return TRUE;
case 2: /* disable(2) */
return FALSE;
default:
return -1;
}
}
/********************************************************************/