2
* File...........: ibmOSAMibDefs.h
3
* Author(s)......: Thomas Weber <tweber@de.ibm.com>
4
* (C) IBM Corporation, IBM Deutschland Entwicklung GmbH, 2002
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)
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 */
32
/* minimal include directives */
34
#include "util_funcs.h"
36
#else /* !IN_UCD_SNMP_SOURCE */
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>
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>
48
#define STRINGIFY_1(x) #x
49
#define STRINGIFY(x) STRINGIFY_1(x)
50
#define RELEASE_STRING STRINGIFY (S390_TOOLS_RELEASE)
52
#endif /* !IN_UCD_SNMP_SOURCE */
53
#ifndef NETSNMP_DS_APPLICATION_ID
54
#define NETSNMP_DS_APPLICATION_ID DS_APPLICATION_ID
56
#ifndef NETSNMP_DS_AGENT_ROLE
57
#define NETSNMP_DS_AGENT_ROLE DS_AGENT_ROLE
59
#ifndef NETSNMP_DS_AGENT_X_SOCKET
60
#define NETSNMP_DS_AGENT_X_SOCKET DS_AGENT_X_SOCKET
62
/* version number of this agent */
64
/* default log file - don't change it here, use parameter -l */
65
#define OSAE_LOGFILE "/var/log/osasnmpd.log"
67
/* definitions for subagent to master agent definition */
68
#define NET_SNMP_PEERNAME "localhost"
69
#define NET_SNMP_COMMUNITY "public"
71
/* need this for OSA Express ioctl's */
72
#define QETH_PROCFILE "/proc/qeth"
73
#define QETH_IOC_MAGIC 'Z'
74
#define QETH_IOCPROC_REGISTER _IOW(QETH_IOC_MAGIC, 1, int)
75
#define QETH_UPDATE_MIB_SIGNAL SIGUSR1
76
#define QETH_QUERY_IPA_DATA _IOWR(QETH_IOC_MAGIC, 7, int )
77
#define QETH_CHECK_OSA_DEVICE _IOWR(QETH_IOC_MAGIC, 8, int )
78
#define IFNAME_MAXLEN 16 /* max length for linux interface names */
79
#define SUFFIX_MAXLEN 13 /* max length of suffix length for ucd-snmp */
80
#define MIB_AREA_LEN 25000 /* default size for register MIB data */
81
#define MAX_GET_DATA 4094 /* maximum GET reponse data length */
82
#define GET_AREA_LEN MAX_GET_DATA + 512 /* size for GET command area length */
83
#define TIME_BUF_SIZE 128 /* buffer size for date and time string */
84
#define MAX_OID_STR_LEN MAX_OID_LEN * 5 /* max OID string size */
85
/* definitions for 2.6 qeth */
86
#define QETH_SYSFILE "/sys/bus/ccwgroup/drivers/qeth/notifier_register"
87
#define SIOC_QETH_ADP_SET_SNMP_CONTROL (SIOCDEVPRIVATE + 5)
88
#define SIOC_QETH_GET_CARD_TYPE (SIOCDEVPRIVATE + 6)
90
/* some definitions for the linked lists compare and delete functions */
92
#define OID_NOT_FOUND 1
93
#define UNEXP_ERROR -1
95
#define INDEX_NOT_FOUND 1
99
/* additional access types and data types used by IPAssists */
100
#define IPA_WRONLY 0xF2
101
#define IPA_DISPLAYSTR ((u_char)0x09)
103
/* IPAssists SNMP subcommand codes */
104
#define IPA_REG_MIB 0x04
105
#define IPA_GET_OID 0x10
106
#define IPA_SET_OID 0x11
107
/*#define IPA_QUERY_ALERT 0x20*/
108
/*#define IPA_SET_TRAP 0x21*/
110
/* IPAssists command return codes */
111
#define IPA_SUCCESS 0x00
112
#define IPA_FAILED 0x01
113
#define IPA_NOT_SUPP 0x04
114
#define IPA_NO_DATA 0x08
116
/* IPAssists SNMP subcommand return codes */
117
#define IPA_SNMP_SUCCESS 0x00
118
#define IPA_SNMP_INV_TOPOID 0x01
119
#define IPA_SNMP_INV_GROUP 0x02
120
#define IPA_SNMP_INV_SUFFIX 0x04
121
#define IPA_SNMP_INV_INST 0x08
122
#define IPA_SNMP_OID_NREAD 0x10
123
#define IPA_SNMP_OID_NWRIT 0x20
124
#define IPA_SNMP_NOT_SUPP 0x40
125
#define IPA_SNMP_NO_DATA 0x80
127
#define PTR_ALIGN4(addr) ((long)((addr))+3)&(~3) /* align ptr 4-byte bdy */
130
/***************************************************************/
131
/* structure used for getting OSA-Express interfaces via ioctl */
132
/***************************************************************/
133
#define NAME_FILLED_IN 0x00000001
134
#define IFINDEX_FILLED_IN 0x00000002
137
typedef struct dev_list
139
char device_name[IFNAME_MAXLEN]; /* OSA-Exp device name (e.g. eth0) */
140
int if_index; /* interface index from kernel */
141
__u32 flags; /* device charateristics */
142
} __attribute__((packed)) DEV_LIST;
144
typedef struct osaexp_dev_ver0
146
__u32 version; /* structure version */
147
__u32 valid_fields; /* bitmask of fields that are really filled */
148
__u32 qeth_version; /* qeth driver version */
149
__u32 number_of_devices; /* number of OSA Express devices */
150
struct dev_list devices[0]; /* list of OSA Express devices */
151
} __attribute__((packed)) OSAEXP_DEV_VER0;
154
/***************************************************************/
155
/* ioctl data structure for IPAssists SNMP processing */
156
/***************************************************************/
157
typedef struct ioctl_cmd_hdr
159
int data_len; /* total length of buffer passed to ioctl */
160
/* following the first 16 bytes */
161
/* in this structure (i.e. starts at token) */
162
int req_len; /* length of IPAssists SNMP request */
163
int reserved1; /* unused */
164
int reserved2; /* unused */
167
char token[16]; /* not used */
168
int request; /* IPA subcommand code */
169
int ifIndex; /* IF-MIB ifIndex value for interface */
170
int ret_code; /* IPA return code */
171
int ipa_ver; /* IPA microcode level (4 hex digits to be shown as xx.yy) */
172
int seq_num; /* sequence number (currently not used) */
175
} __attribute__((packed)) IOCTL_CMD_HDR;
178
/***************************************************************/
179
/* structures for GET/GETNEXT IPAssists processing */
180
/***************************************************************/
181
typedef struct ipa_cmd_get
183
IOCTL_CMD_HDR ioctl_cmd; /* IOCTL command header */
184
char full_oid[0]; /* fully qualified OID for GET/GETNEXT */
185
} __attribute__((packed)) IPA_CMD_GET;
187
typedef struct ipa_get_data
189
int len; /* length of returned data from IPA */
190
char data[0]; /* data returned by IPA */
191
} __attribute__((packed)) IPA_GET_DATA;
194
/******************************************************************/
195
/* struct for IPAssists register MIB data processing */
196
/******************************************************************/
197
typedef struct ipa_cmd_reg
199
IOCTL_CMD_HDR ioctl_cmd; /* IPA subcommand header */
200
int table_cnt; /* number of table toplevel OIDs */
201
} __attribute__((packed)) IPA_CMD_REG;
204
/***************************************************************/
205
/* linked list for table OID housekeeping */
206
/***************************************************************/
207
typedef struct table_oid
209
oid *pObjid; /* registered table OID */
210
size_t length; /* length of subtree OID */
211
struct variable13 *var13ptr; /* ptr to variable_x list */
212
struct reg_indices *ind_list; /* ptr to registered indices */
213
struct table_oid *next; /* ptr to next entry in list */
217
/***************************************************************/
218
/* linked list for OSA Express interfaces housekeeping */
219
/***************************************************************/
220
typedef struct reg_indices
222
char *full_index; /* full index portion from IPA */
223
int ifIndex; /* ifIndex from IF-MIB */
224
struct reg_indices *next; /* ptr to next entry in list */
228
/*******************************************************************/
229
/* this list keeps information queried from the IF-MIB */
230
/*******************************************************************/
231
typedef struct if_List
233
int kerIndex; /* Linux kernel ifIndex */
234
int ifIndex; /* IF-MIB ifIndex */
235
short is_OSAEXP; /* TRUE if an OSA Express device */
236
char if_Name[IFNAME_MAXLEN]; /* interface name (e.g. eth0) */
237
int ipa_ver; /* IPA microcode level */