3 //! @brief snmpagent - l7vsd message header
5 // Copyright (C) 2008 NTT COMWARE Corporation.
7 // Distributed under the Boost Software License, Version 1.0. (See accompanying
8 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
14 #define PADDINGSIZE (1)
16 #define OIDDATASIZE (128) // must 64 multiple number for structure byte offset
17 #define COMMANDDATASIZE (256)
18 #define TRAPREQUESTMESSAGESIZE (64) // must 64 multiple number for structure byte offset
19 #define MIBREQUESTDATASIZE (64) // must 64 multiple number for structure byte offset
20 #define L7VS_MODNAME_LEN (256) // l7vs.h remove this numeric. define this,
21 #define L7VS_PROTOMOD_OPT_LEN (512) // l7vs.h remove this numeric, define this,
23 //message id definitions(l7vsd to subagent)
24 #define MESSAGE_ID_COMMANDREQUEST (0)
25 #define MESSAGE_ID_TRAPREQUEST (1)
26 #define MESSAGE_ID_MIBCOLLECTRESPONSE_VS (2)
27 #define MESSAGE_ID_MIBCOLLECTRESPONSE_RS (3)
29 //message id definitions(subagent to l7vsd)
30 #define MESSAGE_ID_MIBCOLLECTREQUEST (100)
32 //setting command definitions
33 #define COMMAND_LOGLEVEL_CHANGE (0x1)
34 #define COMMAND_SETTINGFILE_RELOAD (0x2)
36 #define MIBDATA_CATEGORY_VS (1)
37 #define MIBDATA_CATEGORY_RS (2)
39 #define MAGIC_NUMBER_LENGTH (2)
40 #define MAGIC_MESSAGE_HEADER "MG" // 0x4D 0x47
41 #define MAGIC_PAYLOAD_HEADER "PY" // 0x50 0x59
42 #define MAGIC_SETTING_COMMAND "ST" // 0x53 0x54
43 #define MAGIC_CHANGE_LOGLEVEL "LL" // 0x4c 0x4c
44 #define MAGIC_TRAP_REQUEST "TR" // 0x54 0x52
45 #define MAGIC_VIRTUAL_SERVICE "VS" // 0x56 0x53
46 #define MAGIC_REAL_SERVER "RS" // 0x52 0x53
47 #define MAGIC_MIB_REQUEST "RQ" // 0x52 0x51
50 struct l7ag_message_header {
51 char magic[MAGIC_NUMBER_LENGTH]; //! Magic number
52 unsigned long long version; //! Version
53 unsigned long long time; //! Created time
54 unsigned long long size; //! Message size
55 unsigned long long payload_count; //! Payload count
61 struct l7ag_payload_header {
62 char magic[MAGIC_NUMBER_LENGTH]; //! Magic number
63 unsigned long long message_id;
64 unsigned long long payload_datasize;
70 struct l7ag_settingcommand_message {
71 char magic[MAGIC_NUMBER_LENGTH]; //! Magic number
72 unsigned long long command_id; //! 0 when change log level, 1 when reload config
73 unsigned char data[COMMANDDATASIZE]; //! command parameter (set category when change log level)
77 * command parameter of change log level
79 struct l7ag_changeloglevel_parameter {
80 char magic[MAGIC_NUMBER_LENGTH]; //! Magic number
81 unsigned long long log_category;
82 unsigned long long log_level;
86 * Request message of Trap
88 struct l7ag_traprequest_message {
89 char magic[MAGIC_NUMBER_LENGTH]; //! Magic number
90 char oid[OIDDATASIZE]; //! OID (must "1.3.6.1.4.1.60000.1.0.2")
91 char message[TRAPREQUESTMESSAGESIZE]; //! Errno
95 * Message for collect MIB data (VirtualService)
97 struct l7ag_mibdata_payload_vs {
98 char magic[MAGIC_NUMBER_LENGTH]; //! Magic number
99 int index; //! VirtualService index
100 uint8_t protocol; //! Protocol
101 uint32_t ipAddress; //! IP
102 uint16_t portNumber; //! Port
103 char scheduleModule[L7VS_MODNAME_LEN]; //! schedule module
104 char protocolModule[L7VS_MODNAME_LEN]; //! protocol module
105 char protocolModuleOption[L7VS_PROTOMOD_OPT_LEN]; //! protomod option
106 int reschedule; //! reschedule flag
107 uint32_t sorryIpAddress; //! sorry IP
108 uint16_t sorryPortNumber; //! sorry port
109 int sorryThreshold; //! sorry threshold
110 int sorryForceFlag; //! sorry flag
111 unsigned long long QoSThresholdUp; //! QoS Threashold value for up stream
112 unsigned long long QoSThresholdDown; //! QoS Threashold value for down stream
113 unsigned long long throughputUp; //! Throughput for up stream
114 unsigned long long throughputDown; //! Throughput for down stream
115 int vs_count; //! VirtualService count
117 bool operator==(const l7ag_mibdata_payload_vs &in_data) {
118 if (index == in_data.index) {
124 l7ag_mibdata_payload_vs &operator=(const l7ag_mibdata_payload_vs &in_data) {
125 index = in_data.index;
126 protocol = in_data.protocol;
127 ipAddress = in_data.ipAddress;
128 strncpy(scheduleModule, in_data.scheduleModule, L7VS_MODNAME_LEN);
129 strncpy(protocolModule, in_data.protocolModule, L7VS_MODNAME_LEN);
130 strncpy(protocolModuleOption, in_data.protocolModuleOption, L7VS_PROTOMOD_OPT_LEN);
131 reschedule = in_data.reschedule;
132 sorryIpAddress = in_data.sorryIpAddress;
133 sorryPortNumber = in_data.sorryPortNumber;
134 sorryThreshold = in_data.sorryThreshold;
135 sorryForceFlag = in_data.sorryForceFlag;
136 QoSThresholdUp = in_data.QoSThresholdUp;
137 QoSThresholdDown = in_data.QoSThresholdDown;
138 throughputUp = in_data.throughputUp;
139 throughputDown = in_data.throughputDown;
140 vs_count = in_data.vs_count;
148 * Message for collect MIB data (RealServer)
150 struct l7ag_mibdata_payload_rs {
151 char magic[MAGIC_NUMBER_LENGTH]; //! Magic number
152 int index; //! RealServer index
153 int virtualServiceIndex; //! Relation VirtualService index
154 uint32_t ipAddress; //! IP
155 uint16_t portNumber; //! Port
156 int forwardMode; //! forward mode
157 unsigned long long weight; //! weight
158 unsigned long long activeConn; //! active connection
159 unsigned long long inactiveConn; //! inactive connection
162 bool operator==(const l7ag_mibdata_payload_rs &in_data) {
163 if (index == in_data.index) {
169 l7ag_mibdata_payload_rs &operator=(const l7ag_mibdata_payload_rs &in_data) {
170 index = in_data.index;
171 virtualServiceIndex = in_data.virtualServiceIndex;
172 ipAddress = in_data.ipAddress;
173 portNumber = in_data.portNumber;
174 forwardMode = in_data.forwardMode;
175 weight = in_data.weight;
176 activeConn = in_data.activeConn;
177 inactiveConn = in_data.inactiveConn;
178 rs_count = in_data.rs_count;
185 * Request message of collect MIB data
187 struct l7ag_mibrequest_message {
188 char magic[MAGIC_NUMBER_LENGTH]; //! Magic number
189 unsigned char oid[OIDDATASIZE]; //! OID. Get all data when set oid to 0
190 unsigned char data[MIBREQUESTDATASIZE]; //! Expansion