1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License").  You may not use this file except in compliance
7 * with the License.
8 *
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
13 *
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
19 *
20 * CDDL HEADER END
21 */
22/*
23 * Copyright 1996 Sun Microsystems, Inc.  All rights reserved.
24 * Use is subject to license terms.
25 */
26#pragma ident	"%Z%%M%	%I%	%E% SMI"
27
28#include <stdio.h>
29#include <netinet/in.h>
30#include <sys/types.h>
31
32#include "error.h"
33#include "trace.h"
34#include "snmp.h"
35#include "madman_trap.h"
36
37
38
39#define BUF_SZ		1000
40
41
42static Subid agents_subids[] = { 1, 3, 6, 1, 4, 1, 42, 2, 8, 1 };
43static Oid sysObjectID_value = { agents_subids, 10 };
44
45
46/******************************************************************/
47
48void test1()
49{
50	char buffer[BUF_SZ + 1];
51	int i, j;
52
53
54	for(i = 500; i < BUF_SZ; i++)
55	{
56		for(j = 0; j < i; j++)
57		{
58			buffer[j] = 'a';
59		}
60		buffer[i] = '\0';
61
62		send_trap_appl_alarm(99, "toto application name",
63			i, SEVERITY_LOW, buffer);
64	}
65}
66
67
68/******************************************************************/
69
70void test2()
71{
72	int i;
73
74
75	for(i = 0; i < 10000; i++)
76	{
77		fprintf(stderr, "%d\n", i);
78		send_trap_appl_alarm(1, "Solstice X.400 MTA:",
79			i, SEVERITY_LOW, "Just a test message");
80	}
81}
82
83
84/******************************************************************/
85
86void test3()
87{
88	send_trap_appl_alarm(1, "Solstice X.400 MTA:",
89		1, SEVERITY_LOW, "Just a test message: LOW");
90	sleep(5);
91
92	send_trap_appl_alarm(1, "Solstice X.400 MTA:",
93		2, SEVERITY_MEDIUM, "Just a test message: MEDIUM");
94	sleep(5);
95
96	send_trap_appl_alarm(1, "Solstice X.400 MTA:",
97		3, SEVERITY_HIGH, "Just a test message: HIGH");
98}
99
100
101/******************************************************************/
102
103main()
104{
105/*
106	trace_flags = 0xFFF;
107*/
108
109	if(trap_init(&sysObjectID_value, error_label))
110	{
111		fprintf(stderr, "trap_init() failed: %s\n", error_label);
112		exit(1);
113	}
114
115	if(trap_destinator_add("panda", error_label))
116	{
117		fprintf(stderr, "trap_destinator_add() failed: %s\n",
118			error_label);
119		exit(1);
120	}
121
122	test3();
123
124	exit(0);
125}
126