xref: /onnv-gate/usr/src/cmd/agents/snmp/snmplib/impl.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 /*
23*0Sstevel@tonic-gate  * Copyright (c) 1998, 2001 by Sun Microsystems, Inc.
24*0Sstevel@tonic-gate  * All rights reserved.
25*0Sstevel@tonic-gate  */
26*0Sstevel@tonic-gate 
27*0Sstevel@tonic-gate #ifndef _IMPL_H
28*0Sstevel@tonic-gate #define	_IMPL_H
29*0Sstevel@tonic-gate 
30*0Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
31*0Sstevel@tonic-gate 
32*0Sstevel@tonic-gate #ifdef	__cplusplus
33*0Sstevel@tonic-gate extern "C" {
34*0Sstevel@tonic-gate #endif
35*0Sstevel@tonic-gate 
36*0Sstevel@tonic-gate #include <sys/types.h>
37*0Sstevel@tonic-gate 
38*0Sstevel@tonic-gate /* Exported Constants */
39*0Sstevel@tonic-gate 
40*0Sstevel@tonic-gate #ifndef	NULL
41*0Sstevel@tonic-gate #define	NULL 0
42*0Sstevel@tonic-gate #endif
43*0Sstevel@tonic-gate 
44*0Sstevel@tonic-gate #ifndef	TRUE
45*0Sstevel@tonic-gate #define	TRUE	1
46*0Sstevel@tonic-gate #endif
47*0Sstevel@tonic-gate #ifndef	FALSE
48*0Sstevel@tonic-gate #define	FALSE	0
49*0Sstevel@tonic-gate #endif
50*0Sstevel@tonic-gate 
51*0Sstevel@tonic-gate #ifndef	True
52*0Sstevel@tonic-gate #define	True	1
53*0Sstevel@tonic-gate #endif
54*0Sstevel@tonic-gate #ifndef	False
55*0Sstevel@tonic-gate #define	False	0
56*0Sstevel@tonic-gate #endif
57*0Sstevel@tonic-gate 
58*0Sstevel@tonic-gate #ifndef	MIN
59*0Sstevel@tonic-gate #define	MIN(x, y)	((x) < (y)? (x) : (y))
60*0Sstevel@tonic-gate #endif
61*0Sstevel@tonic-gate #ifndef	MAX
62*0Sstevel@tonic-gate #define	MAX(x, y)	((x) > (y)? (x) : (y))
63*0Sstevel@tonic-gate #endif
64*0Sstevel@tonic-gate 
65*0Sstevel@tonic-gate #define	NOT_IMPLEMENTED		-1
66*0Sstevel@tonic-gate #define	END_OF_TABLE		-2
67*0Sstevel@tonic-gate #define	OTHER_ERROR		-3
68*0Sstevel@tonic-gate 
69*0Sstevel@tonic-gate #define	EXACT_ENTRY		1
70*0Sstevel@tonic-gate #define	FIRST_ENTRY		2
71*0Sstevel@tonic-gate #define	NEXT_ENTRY		3
72*0Sstevel@tonic-gate 
73*0Sstevel@tonic-gate #define	FIRST_PASS		1
74*0Sstevel@tonic-gate #define	SECOND_PASS		2
75*0Sstevel@tonic-gate 
76*0Sstevel@tonic-gate 
77*0Sstevel@tonic-gate /* Exported Types */
78*0Sstevel@tonic-gate 
79*0Sstevel@tonic-gate typedef int32_t Integer;
80*0Sstevel@tonic-gate 
81*0Sstevel@tonic-gate 
82*0Sstevel@tonic-gate typedef struct _String {
83*0Sstevel@tonic-gate 	uchar_t *chars;
84*0Sstevel@tonic-gate 	int len;
85*0Sstevel@tonic-gate } String;
86*0Sstevel@tonic-gate 
87*0Sstevel@tonic-gate 
88*0Sstevel@tonic-gate typedef uint32_t Subid;
89*0Sstevel@tonic-gate 
90*0Sstevel@tonic-gate typedef struct _Oid {
91*0Sstevel@tonic-gate 	Subid *subids;
92*0Sstevel@tonic-gate 	int len;
93*0Sstevel@tonic-gate } Oid;
94*0Sstevel@tonic-gate 
95*0Sstevel@tonic-gate typedef struct _IndexType {
96*0Sstevel@tonic-gate 	int type;
97*0Sstevel@tonic-gate 	int len;
98*0Sstevel@tonic-gate 	int *value;
99*0Sstevel@tonic-gate } IndexType;
100*0Sstevel@tonic-gate 
101*0Sstevel@tonic-gate typedef struct in_addr IPAddress;
102*0Sstevel@tonic-gate typedef struct sockaddr_in Address;
103*0Sstevel@tonic-gate 
104*0Sstevel@tonic-gate 
105*0Sstevel@tonic-gate /* Exported Functions */
106*0Sstevel@tonic-gate 
107*0Sstevel@tonic-gate extern char *pdu_type_string(uchar_t type);
108*0Sstevel@tonic-gate extern char *asn1_type_string(uchar_t type);
109*0Sstevel@tonic-gate extern char *error_status_string(int status);
110*0Sstevel@tonic-gate extern char *generic_trap_string(int generic);
111*0Sstevel@tonic-gate extern char *SSAOidString(Oid *oid);
112*0Sstevel@tonic-gate extern char *timeval_string(struct timeval *tv);
113*0Sstevel@tonic-gate extern char *ip_address_string(IPAddress *ip_address);
114*0Sstevel@tonic-gate extern char *address_string(Address *address);
115*0Sstevel@tonic-gate 
116*0Sstevel@tonic-gate /* Conversion Routines */
117*0Sstevel@tonic-gate extern char *SSAStringToChar(String str);
118*0Sstevel@tonic-gate extern Oid *SSAOidStrToOid(char *name, char *error_label);
119*0Sstevel@tonic-gate 
120*0Sstevel@tonic-gate extern void SSAStringZero(String *string);
121*0Sstevel@tonic-gate extern int SSAStringInit(String *string, uchar_t *chars, int len,
122*0Sstevel@tonic-gate     char *error_label);
123*0Sstevel@tonic-gate extern int SSAStringCpy(String *string1, String *string2, char *error_label);
124*0Sstevel@tonic-gate 
125*0Sstevel@tonic-gate extern Oid *SSAOidNew(void);
126*0Sstevel@tonic-gate extern void SSAOidZero(Oid *oid);
127*0Sstevel@tonic-gate extern void SSAOidFree(Oid *oid);
128*0Sstevel@tonic-gate extern int SSAOidInit(Oid *oid, Subid *subids, int len, char *error_label);
129*0Sstevel@tonic-gate extern int SSAOidCpy(Oid *oid1, Oid *oid2, char *error_label);
130*0Sstevel@tonic-gate extern Oid *SSAOidDup(Oid *oid, char *error_label);
131*0Sstevel@tonic-gate extern int SSAOidCmp(Oid *oid1, Oid *oid2);
132*0Sstevel@tonic-gate 
133*0Sstevel@tonic-gate extern int name_to_ip_address(char *name, IPAddress *ip_address,
134*0Sstevel@tonic-gate     char *error_label);
135*0Sstevel@tonic-gate extern int get_my_ip_address(IPAddress *my_ip_address, char *error_label);
136*0Sstevel@tonic-gate 
137*0Sstevel@tonic-gate #ifdef	__cplusplus
138*0Sstevel@tonic-gate }
139*0Sstevel@tonic-gate #endif
140*0Sstevel@tonic-gate 
141*0Sstevel@tonic-gate #endif	/* _IMPL_H */
142