Import version 1.8.3
[s390-tools.git] / osasnmpd / ibmOSAMibDefs.h
blobd4f067a400773e7c2e8fbfde88b208db0049ce5d
1 /*
2 * File...........: ibmOSAMibDefs.h
3 * Author(s)......: Thomas Weber <tweber@de.ibm.com>
4 * Copyright IBM Corp. 2002,2007
6 * History of changes:
7 * none
8 *
9 * Defines constants and data structures used by the OSA-E subagent.
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2, or (at your option)
14 * any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26 #ifdef IN_UCD_SNMP_SOURCE
27 /* If we're compiling this file inside the ucd-snmp source tree */
29 /* This should always be included first before anything else */
30 #include <config.h>
32 /* minimal include directives */
33 #include "mibincl.h"
34 #include "util_funcs.h"
36 #else /* !IN_UCD_SNMP_SOURCE */
38 #ifdef NETSNMP5
39 #include <net-snmp/net-snmp-config.h>
40 #include <net-snmp/net-snmp-includes.h>
41 #include <net-snmp/agent/net-snmp-agent-includes.h>
42 #else
43 #include <ucd-snmp/ucd-snmp-config.h>
44 #include <ucd-snmp/ucd-snmp-includes.h>
45 #include <ucd-snmp/ucd-snmp-agent-includes.h>
46 #endif
48 #endif /* !IN_UCD_SNMP_SOURCE */
49 #ifndef NETSNMP_DS_APPLICATION_ID
50 #define NETSNMP_DS_APPLICATION_ID DS_APPLICATION_ID
51 #endif
52 #ifndef NETSNMP_DS_AGENT_ROLE
53 #define NETSNMP_DS_AGENT_ROLE DS_AGENT_ROLE
54 #endif
55 #ifndef NETSNMP_DS_AGENT_X_SOCKET
56 #define NETSNMP_DS_AGENT_X_SOCKET DS_AGENT_X_SOCKET
57 #endif
58 /* version number of this agent */
60 /* default log file - don't change it here, use parameter -l */
61 #define OSAE_LOGFILE "/var/log/osasnmpd.log"
63 /* definitions for subagent to master agent definition */
64 #define NET_SNMP_PEERNAME "localhost"
65 #define NET_SNMP_COMMUNITY "public"
67 /* need this for OSA Express ioctl's */
68 #define QETH_PROCFILE "/proc/qeth"
69 #define QETH_IOC_MAGIC 'Z'
70 #define QETH_IOCPROC_REGISTER _IOW(QETH_IOC_MAGIC, 1, int)
71 #define QETH_UPDATE_MIB_SIGNAL SIGUSR1
72 #define QETH_QUERY_IPA_DATA _IOWR(QETH_IOC_MAGIC, 7, int )
73 #define QETH_CHECK_OSA_DEVICE _IOWR(QETH_IOC_MAGIC, 8, int )
74 #define IFNAME_MAXLEN 16 /* max length for linux interface names */
75 #define SUFFIX_MAXLEN 13 /* max length of suffix length for ucd-snmp */
76 #define MIB_AREA_LEN 25000 /* default size for register MIB data */
77 #define MAX_GET_DATA 4094 /* maximum GET reponse data length */
78 #define GET_AREA_LEN MAX_GET_DATA + 512 /* size for GET command area length */
79 #define TIME_BUF_SIZE 128 /* buffer size for date and time string */
80 #define MAX_OID_STR_LEN MAX_OID_LEN * 5 /* max OID string size */
81 /* definitions for 2.6 qeth */
82 #define QETH_SYSFILE "/sys/bus/ccwgroup/drivers/qeth/notifier_register"
83 #define SIOC_QETH_ADP_SET_SNMP_CONTROL (SIOCDEVPRIVATE + 5)
84 #define SIOC_QETH_GET_CARD_TYPE (SIOCDEVPRIVATE + 6)
86 /* some definitions for the linked lists compare and delete functions */
87 #define OID_FOUND 0
88 #define OID_NOT_FOUND 1
89 #define UNEXP_ERROR -1
90 #define INDEX_FOUND 0
91 #define INDEX_NOT_FOUND 1
92 #define IF_ENTRY 0
93 #define IND_LIST 1
95 /* additional access types and data types used by IPAssists */
96 #define IPA_WRONLY 0xF2
97 #define IPA_DISPLAYSTR ((u_char)0x09)
99 /* IPAssists SNMP subcommand codes */
100 #define IPA_REG_MIB 0x04
101 #define IPA_GET_OID 0x10
102 #define IPA_SET_OID 0x11
103 /*#define IPA_QUERY_ALERT 0x20*/
104 /*#define IPA_SET_TRAP 0x21*/
106 /* IPAssists command return codes */
107 #define IPA_SUCCESS 0x00
108 #define IPA_FAILED 0x01
109 #define IPA_NOT_SUPP 0x04
110 #define IPA_NO_DATA 0x08
112 /* IPAssists SNMP subcommand return codes */
113 #define IPA_SNMP_SUCCESS 0x00
114 #define IPA_SNMP_INV_TOPOID 0x01
115 #define IPA_SNMP_INV_GROUP 0x02
116 #define IPA_SNMP_INV_SUFFIX 0x04
117 #define IPA_SNMP_INV_INST 0x08
118 #define IPA_SNMP_OID_NREAD 0x10
119 #define IPA_SNMP_OID_NWRIT 0x20
120 #define IPA_SNMP_NOT_SUPP 0x40
121 #define IPA_SNMP_NO_DATA 0x80
123 #define PTR_ALIGN4(addr) ((long)((addr))+3)&(~3) /* align ptr 4-byte bdy */
126 /***************************************************************/
127 /* structure used for getting OSA-Express interfaces via ioctl */
128 /***************************************************************/
129 #define NAME_FILLED_IN 0x00000001
130 #define IFINDEX_FILLED_IN 0x00000002
132 /* version 0 */
133 typedef struct dev_list
135 char device_name[IFNAME_MAXLEN]; /* OSA-Exp device name (e.g. eth0) */
136 int if_index; /* interface index from kernel */
137 __u32 flags; /* device charateristics */
138 } __attribute__((packed)) DEV_LIST;
140 typedef struct osaexp_dev_ver0
142 __u32 version; /* structure version */
143 __u32 valid_fields; /* bitmask of fields that are really filled */
144 __u32 qeth_version; /* qeth driver version */
145 __u32 number_of_devices; /* number of OSA Express devices */
146 struct dev_list devices[0]; /* list of OSA Express devices */
147 } __attribute__((packed)) OSAEXP_DEV_VER0;
150 /***************************************************************/
151 /* ioctl data structure for IPAssists SNMP processing */
152 /***************************************************************/
153 typedef struct ioctl_cmd_hdr
155 int data_len; /* total length of buffer passed to ioctl */
156 /* following the first 16 bytes */
157 /* in this structure (i.e. starts at token) */
158 int req_len; /* length of IPAssists SNMP request */
159 int reserved1; /* unused */
160 int reserved2; /* unused */
162 struct {
163 char token[16]; /* not used */
164 int request; /* IPA subcommand code */
165 int ifIndex; /* IF-MIB ifIndex value for interface */
166 int ret_code; /* IPA return code */
167 int ipa_ver; /* IPA microcode level (4 hex digits to be shown as xx.yy) */
168 int seq_num; /* sequence number (currently not used) */
169 } ipa_cmd_hdr;
171 } __attribute__((packed)) IOCTL_CMD_HDR;
174 /***************************************************************/
175 /* structures for GET/GETNEXT IPAssists processing */
176 /***************************************************************/
177 typedef struct ipa_cmd_get
179 IOCTL_CMD_HDR ioctl_cmd; /* IOCTL command header */
180 char full_oid[0]; /* fully qualified OID for GET/GETNEXT */
181 } __attribute__((packed)) IPA_CMD_GET;
183 typedef struct ipa_get_data
185 int len; /* length of returned data from IPA */
186 char data[0]; /* data returned by IPA */
187 } __attribute__((packed)) IPA_GET_DATA;
190 /******************************************************************/
191 /* struct for IPAssists register MIB data processing */
192 /******************************************************************/
193 typedef struct ipa_cmd_reg
195 IOCTL_CMD_HDR ioctl_cmd; /* IPA subcommand header */
196 int table_cnt; /* number of table toplevel OIDs */
197 } __attribute__((packed)) IPA_CMD_REG;
200 /***************************************************************/
201 /* linked list for table OID housekeeping */
202 /***************************************************************/
203 typedef struct table_oid
205 oid *pObjid; /* registered table OID */
206 size_t length; /* length of subtree OID */
207 struct variable13 *var13ptr; /* ptr to variable_x list */
208 struct reg_indices *ind_list; /* ptr to registered indices */
209 struct table_oid *next; /* ptr to next entry in list */
210 } TABLE_OID;
213 /***************************************************************/
214 /* linked list for OSA Express interfaces housekeeping */
215 /***************************************************************/
216 typedef struct reg_indices
218 char *full_index; /* full index portion from IPA */
219 int ifIndex; /* ifIndex from IF-MIB */
220 struct reg_indices *next; /* ptr to next entry in list */
221 } REG_INDICES;
224 /*******************************************************************/
225 /* this list keeps information queried from the IF-MIB */
226 /*******************************************************************/
227 typedef struct if_List
229 int kerIndex; /* Linux kernel ifIndex */
230 int ifIndex; /* IF-MIB ifIndex */
231 short is_OSAEXP; /* TRUE if an OSA Express device */
232 char if_Name[IFNAME_MAXLEN]; /* interface name (e.g. eth0) */
233 int ipa_ver; /* IPA microcode level */
234 } IF_LIST;