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