xref: /onnv-gate/usr/src/cmd/agents/snmp/snmprelayd/agent.h (revision 0:68f95e015346)
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  * Copyright 1997 Sun Microsystems, Inc.  All Rights Reserved.
23  * Use is subject to license terms.
24  */
25 
26 /* HISTORY
27  * 5-20-96	Jerry Yeung	add mib-handling data structure
28  * 9-20-96	Jerry Yeung	change agent structure
29  */
30 
31 #ifndef _AGENT_H_
32 #define _AGENT_H_
33 
34 #pragma ident	"%Z%%M%	%I%	%E% SMI"
35 
36 #include "snmpdx_stub.h"
37 
38 #define SSA_OPER_STATUS_ACTIVE	1
39 #define SSA_OPER_STATUS_NOT_IN_SERVICE	2
40 #define SSA_OPER_STATUS_INIT 	3
41 #define SSA_OPER_STATUS_LOAD	4
42 #define SSA_OPER_STATUS_DESTROY	5
43 
44 typedef struct _Agent {
45 
46 	/* extra elements */
47         Integer agentID;
48         Integer agentStatus;
49         Integer agentTimeOut;
50         Integer agentPortNumber; /* same as address.sin_port */
51         String agentPersonalFile;
52         String agentConfigFile;
53         String agentExecutable;
54         String agentVersionNum;
55         Integer agentProcessID;
56         String agentName; /* it points to name */
57 	Integer agentSystemUpTime;
58         Integer agentWatchDogTime;
59         String agentProtocol;
60 
61 	Integer	agentTreeIndex;
62 	Integer	agentTblIndex;
63 
64 	struct _Manager	*first_manager;
65 	struct _Agent	*next_agent;
66 	Address		address;
67 	char		*name;
68 	u_long		timeout;
69 	struct _Subtree	*first_agent_subtree;
70 	int		numOfFailRequest;
71 } Agent;
72 
73 extern int sap_agent_id;
74 
75 /* the agent list */
76 extern Agent *first_agent;
77 
78 /* the address is a unique key for an agent */
79 extern Agent *agent_find(Address *address);
80 extern Agent *agent_find_by_name(char* name);
81 extern Agent *agent_find_by_id(int id);
82 
83 /* We must invoke subtree_list_delete() before invoking */
84 /* this function because the first_agent_subtree member */
85 /* of the agent structures should be NULL               */
86 extern void agent_list_delete();
87 
88 extern void agent_update_subtree(Agent* agent);
89 
90 extern void agent_detach_from_list(Agent* agent);
91 
92 extern void agent_destroy(Agent* agent);
93 
94 extern void trace_agents();
95 extern void agent_free(Agent *ap);
96 
97 #endif
98 
99