trapsend.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 2003 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#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 "trap.h"
#include "error.h"
#include "oid.h"
#include "usage.h"
#include "sea_i18n.h"
int argc;
char *argv[];
{
extern char *optarg;
extern int optind;
int opt;
char hostname[MAXHOSTNAMELEN];
int trap_port = -1;
optind = 1;
/* the default host name is local host */
/* default Oid for enterprise is sun */
enterprise = &sun_oid;
/* generic, specific */
generic = 6;
specific = 1;
{
char domain_path[MAXPATHLEN];
}
/* get command-line options */
switch (opt) {
case 'T':
level);
usage();
}
break;
case 'h': /* host to send trap to */
> MAXHOSTNAMELEN) {
\n", optarg);
exit(1);
}
case 'c':
break;
case 'e':
if (enterprise_flag) {
usage();
}
if (!enterprise){ /* error */
"%s: not a valid enterprise oid string!\n",
optarg);
usage();
}
enterprise_flag = 1;
break;
case 'E':
if (enterprise_flag) {
usage();
}
if (!enterprise) {
usage();
}
enterprise_flag = 1;
break;
case 'g': /* generic trap type */
usage();
usage();
break;
case 's': /* specific trap type */
usage();
break;
case 'i':
if (name_to_ip_address(optarg,
error_label)) {
usage();
}
i_flag = 1;
break;
case 't': /* timestamp */
break;
case 'p':
usage();
break;
case 'a': /* attribute information */
"%s: not a valid variable!\n", optarg);
usage();
}
a_flag = 1;
break;
case '?': /* usage help */
usage();
break;
default:
usage();
break;
} /* switch */
}/* while */
usage();
usage();
}
}
/* some trace message */
error_label)) {
return (-1);
} else {
return (0);
}
/* if (trap_send(&ip_address,
enterprise,
generic,
specific,
variables,
error_label)) {
fprintf(stderr, "trap_send not success!\n\n");
} */
}
char *buf;
{
int len, i;
return (-1);
for (i= 0; i < len; i++)
return(-1);
}
return (0);
}