xref: /onnv-gate/usr/src/cmd/agents/snmp/snmprelayd/agent.h (revision 0:68f95e015346)
1*0Sstevel@tonic-gate /*
2*0Sstevel@tonic-gate  * CDDL HEADER START
3*0Sstevel@tonic-gate  *
4*0Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*0Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*0Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*0Sstevel@tonic-gate  * with the License.
8*0Sstevel@tonic-gate  *
9*0Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*0Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*0Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*0Sstevel@tonic-gate  * and limitations under the License.
13*0Sstevel@tonic-gate  *
14*0Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*0Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*0Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*0Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*0Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*0Sstevel@tonic-gate  *
20*0Sstevel@tonic-gate  * CDDL HEADER END
21*0Sstevel@tonic-gate  *
22*0Sstevel@tonic-gate  * Copyright 1997 Sun Microsystems, Inc.  All Rights Reserved.
23*0Sstevel@tonic-gate  * Use is subject to license terms.
24*0Sstevel@tonic-gate  */
25*0Sstevel@tonic-gate 
26*0Sstevel@tonic-gate /* HISTORY
27*0Sstevel@tonic-gate  * 5-20-96	Jerry Yeung	add mib-handling data structure
28*0Sstevel@tonic-gate  * 9-20-96	Jerry Yeung	change agent structure
29*0Sstevel@tonic-gate  */
30*0Sstevel@tonic-gate 
31*0Sstevel@tonic-gate #ifndef _AGENT_H_
32*0Sstevel@tonic-gate #define _AGENT_H_
33*0Sstevel@tonic-gate 
34*0Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
35*0Sstevel@tonic-gate 
36*0Sstevel@tonic-gate #include "snmpdx_stub.h"
37*0Sstevel@tonic-gate 
38*0Sstevel@tonic-gate #define SSA_OPER_STATUS_ACTIVE	1
39*0Sstevel@tonic-gate #define SSA_OPER_STATUS_NOT_IN_SERVICE	2
40*0Sstevel@tonic-gate #define SSA_OPER_STATUS_INIT 	3
41*0Sstevel@tonic-gate #define SSA_OPER_STATUS_LOAD	4
42*0Sstevel@tonic-gate #define SSA_OPER_STATUS_DESTROY	5
43*0Sstevel@tonic-gate 
44*0Sstevel@tonic-gate typedef struct _Agent {
45*0Sstevel@tonic-gate 
46*0Sstevel@tonic-gate 	/* extra elements */
47*0Sstevel@tonic-gate         Integer agentID;
48*0Sstevel@tonic-gate         Integer agentStatus;
49*0Sstevel@tonic-gate         Integer agentTimeOut;
50*0Sstevel@tonic-gate         Integer agentPortNumber; /* same as address.sin_port */
51*0Sstevel@tonic-gate         String agentPersonalFile;
52*0Sstevel@tonic-gate         String agentConfigFile;
53*0Sstevel@tonic-gate         String agentExecutable;
54*0Sstevel@tonic-gate         String agentVersionNum;
55*0Sstevel@tonic-gate         Integer agentProcessID;
56*0Sstevel@tonic-gate         String agentName; /* it points to name */
57*0Sstevel@tonic-gate 	Integer agentSystemUpTime;
58*0Sstevel@tonic-gate         Integer agentWatchDogTime;
59*0Sstevel@tonic-gate         String agentProtocol;
60*0Sstevel@tonic-gate 
61*0Sstevel@tonic-gate 	Integer	agentTreeIndex;
62*0Sstevel@tonic-gate 	Integer	agentTblIndex;
63*0Sstevel@tonic-gate 
64*0Sstevel@tonic-gate 	struct _Manager	*first_manager;
65*0Sstevel@tonic-gate 	struct _Agent	*next_agent;
66*0Sstevel@tonic-gate 	Address		address;
67*0Sstevel@tonic-gate 	char		*name;
68*0Sstevel@tonic-gate 	u_long		timeout;
69*0Sstevel@tonic-gate 	struct _Subtree	*first_agent_subtree;
70*0Sstevel@tonic-gate 	int		numOfFailRequest;
71*0Sstevel@tonic-gate } Agent;
72*0Sstevel@tonic-gate 
73*0Sstevel@tonic-gate extern int sap_agent_id;
74*0Sstevel@tonic-gate 
75*0Sstevel@tonic-gate /* the agent list */
76*0Sstevel@tonic-gate extern Agent *first_agent;
77*0Sstevel@tonic-gate 
78*0Sstevel@tonic-gate /* the address is a unique key for an agent */
79*0Sstevel@tonic-gate extern Agent *agent_find(Address *address);
80*0Sstevel@tonic-gate extern Agent *agent_find_by_name(char* name);
81*0Sstevel@tonic-gate extern Agent *agent_find_by_id(int id);
82*0Sstevel@tonic-gate 
83*0Sstevel@tonic-gate /* We must invoke subtree_list_delete() before invoking */
84*0Sstevel@tonic-gate /* this function because the first_agent_subtree member */
85*0Sstevel@tonic-gate /* of the agent structures should be NULL               */
86*0Sstevel@tonic-gate extern void agent_list_delete();
87*0Sstevel@tonic-gate 
88*0Sstevel@tonic-gate extern void agent_update_subtree(Agent* agent);
89*0Sstevel@tonic-gate 
90*0Sstevel@tonic-gate extern void agent_detach_from_list(Agent* agent);
91*0Sstevel@tonic-gate 
92*0Sstevel@tonic-gate extern void agent_destroy(Agent* agent);
93*0Sstevel@tonic-gate 
94*0Sstevel@tonic-gate extern void trace_agents();
95*0Sstevel@tonic-gate extern void agent_free(Agent *ap);
96*0Sstevel@tonic-gate 
97*0Sstevel@tonic-gate #endif
98*0Sstevel@tonic-gate 
99