Systemwalker Centric Manager API・スクリプトガイド - UNIX/Windows(R)共通 - |
目次
索引
![]() ![]() |
第2部 API | > 第3章 APIの機能概要 | > 3.3 ネットワーク管理のAPI |
ネットワーク管理のAPIで使用する共通パラメタについて説明します。
SNMPのデータ設定、または受信時に使用する構造体です。
typedef struct { int version; #define NWSNMP_VERSION_1 0 char *community; int community_len; int pdu_type; #define NWSNMP_GET 0 #define NWSNMP_GET_NEXT 1 #define NWSNMP_RESPONSE 2 #define NWSNMP_SET 3 #define NWSNMP_TRAP 4 int request_id; int error_status; #define NWSNMP_NOERROR 0 #define NWSNMP_TOOBIG 1 #define NWSNMP_NOSUCHNAME 2 #define NWSNMP_BADVALUE 3 #define NWSNMP_READONLY 4 #define NWSNMP_GENERR 5 int error_index; char *enterprise; unsigned long agent_addr; int generic_trap; #define NWSNMP_COLDSTART 0 #define NWSNMP_WARMSTART 1 #define NWSNMP_LINKDOWN 2 #define NWSNMP_LINKUP 3 #define NWSNMP_AUTHENTICATIONFAILURE 4 #define NWSNMP_EGPNEIGHBORLOSS 5 #define NWSNMP_ENTERPRISESPECIFIC 6 int specific_trap; int time_stamp; NWsnmp_Varbind *var_bind; } NWsnmp_pdu; |
typedef struct { int version; #define NWSNMP_VERSION_1 0 char *community; int community_len; int pdu_type; #define NWSNMP_GET 0 #define NWSNMP_GET_NEXT 1 #define NWSNMP_RESPONSE 2 #define NWSNMP_SET 3 #define NWSNMP_TRAP 4 int request_id; int error_status; #define NWSNMP_NOERROR 0 #define NWSNMP_TOOBIG 1 #define NWSNMP_NOSUCHNAME 2 #define NWSNMP_BADVALUE 3 #define NWSNMP_READONLY 4 #define NWSNMP_GENERR 5 int error_index; char *enterprise; NWSNMP_ULONG agent_addr; int generic_trap; #define NWSNMP_COLDSTART 0 #define NWSNMP_WARMSTART 1 #define NWSNMP_LINKDOWN 2 #define NWSNMP_LINKUP 3 #define NWSNMP_AUTHENTICATIONFAILURE 4 #define NWSNMP_EGPNEIGHBORLOSS 5 #define NWSNMP_ENTERPRISESPECIFIC 6 int specific_trap; int time_stamp; NWsnmp_Varbind *var_bind; } NWsnmp_pdu; |
各PDUタイプの符号化時に設定するメンバを以下に示します。
メンバ名 |
GET |
GETNEXT |
SET |
TRAP |
備 考 |
version |
○ |
○ |
○ |
○ |
0だけ設定可 |
community |
○ |
○ |
○ |
○ |
NULLは設定不可 |
community_len |
○ |
○ |
○ |
○ |
1以上だけ設定可 |
pdu_type |
○ |
○ |
○ |
○ |
0、1、3、4だけ設定可 |
request_id |
○ |
○ |
○ |
× |
PDUの識別に使用 |
error_status |
× |
× |
× |
× |
符号化時に0を設定 |
error_index |
× |
× |
× |
× |
符号化時に0を設定 |
enterprise |
× |
× |
× |
○ |
エージェントのsysObjectIDを設定 |
agent_addr |
× |
× |
× |
○ |
32ビットのhostid/netidを設定 |
generic_trap |
× |
× |
× |
○ |
0〜6だけ設定可 |
specific_trap |
× |
× |
× |
○ |
generic_trapが6のときに設定 |
var_bind |
○ |
○ |
○ |
△ |
省略時はNULLを設定 |
○:設定必須
×:省略不可
△:省略可
各項目の設定を以下に示します。
#define NWSNMP_GET 0 #define NWSNMP_GET_NEXT 1 #define NWSNMP_RESPONSE 2 #define NWSNMP_SET 3 #define NWSNMP_TRAP 4 |
#define NWSNMP_NOERROR 0 #define NWSNMP_TOOBIG 1 #define NWSNMP_NOSUCHNAME 2 #define NWSNMP_BADVALUE 3 #define NWSNMP_READONLY 4 #define NWSNMP_GENERR 5 |
#define NWSNMP_COLDSTART 0 #define NWSNMP_WARMSTART 1 #define NWSNMP_LINKDOWN 2 #define NWSNMP_LINKUP 3 #define NWSNMP_AUTHENTICATIONFAILURE 4 #define NWSNMP_EGPNEIGHBORLOSS 5 #define NWSNMP_ENTERPRISESPECIFIC 6 |
GET/GET−NEXT/SETオペレーションの受信と、それに対応する応答に使用します。また、SNMPトラップを送信する場合にも使用します。
typedef struct _old { char *string; int len; } NWsnmp_oid; typedef union _nwsnmp_var_val { NWSNMP_LONG val_integer; NWsnmp_oid val_octet_string; char *val_object_identidier; unsigned long val_ip_addr; unsigned long val_counter; unsigned long val_gauge; unsigned long val_timeticks; NWsnmp_oid val_opaque; } NWsnmp_var_val; typedef struct _nwsnmp_varbind { char *obj_name; int obj_type; #define NWSNMP_INTEGER 1 #define NWSNMP_OCTET_STRING 2 #define NWSNMP_OBJECT_IDENTIFIER 3 #define NWSNMP_NULL 4 #define NWSNMP_IPADDRESS 5 #define NWSNMP_COUNTER 6 #define NWSNMP_GAUGE 7 #define NWSNMP_TIMETICKS 8 #define NWSNMP_OPAQUE 9 NWsnmp_var_val obj_syntax; struct _nwsnmp_varbind *next; } NWsnmp_Varbind; |
typedef struct _old { char *string; int len; } NWsnmp_oid; typedef union _nwsnmp_var_val { NWSNMP_LONG val_integer; NWsnmp_oid val_octet_string; char *val_object_identidier; NWSNMP_ULONG val_ip_addr; NWSNMP_ULONG val_counter; NWSNMP_ULONG val_gauge; NWSNMP_ULONG val_timeticks; NWsnmp_oid val_opaque; } NWsnmp_var_val; typedef struct _nwsnmp_varbind { char *obj_name; int obj_type; #define NWSNMP_INTEGER 1 #define NWSNMP_OCTET_STRING 2 #define NWSNMP_OBJECT_IDENTIFIER 3 #define NWSNMP_NULL 4 #define NWSNMP_IPADDRESS 5 #define NWSNMP_COUNTER 6 #define NWSNMP_GAUGE 7 #define NWSNMP_TIMETICKS 8 #define NWSNMP_OPAQUE 9 NWsnmp_var_val obj_syntax; struct _nwsnmp_varbind *next; } NWsnmp_Varbind; |
各項目の設定を以下に示します。
#define NWSNMP_INTEGER 1 #define NWSNMP_OCTET_STRING 2 #define NWSNMP_OBJECT_IDENTIFIER 3 #define NWSNMP_NULL 4 #define NWSNMP_IPADDRESS 5 #define NWSNMP_COUNTER 6 #define NWSNMP_GAUGE 7 #define NWSNMP_TIMETICKS 8 #define NWSNMP_OPAQUE 9 |
ネットワークAPIで発生したエラー情報を設定する構造体です。
typedef struct _nwsnmp_errinfo { int NWErrorCode; unsigned long NWErrorDetail; unsigned long NWErrorCause; } NWsnmpErrinfo; |
typedef struct _nwsnmp_errinfo { int NWErrorCode; NWSNMP_ULONG NWErrorDetail; NWSNMP_ULONG NWErrorCause; } NWsnmpErrinfo; |
各項目の設定を以下に示します。
この情報から、エラーメッセージを標準エラーに出力するNWsnmpPerror()関数と、エラーメッセージを作成するNWsnmpSerror()関数を用意しています。
目次
索引
![]() ![]() |