Netservices modded to read fragmented HTTP respsonse/payload from special purpose server - 180 bytes only

Committer:
RodColeman
Date:
Thu Sep 08 10:48:09 2011 +0000
Revision:
0:850eacf3e945
revised fixed length to 178 bytes

Who changed what in which revision?

UserRevisionLine numberNew contents of line
RodColeman 0:850eacf3e945 1 /**
RodColeman 0:850eacf3e945 2 * @file
RodColeman 0:850eacf3e945 3 * SNMP Agent message handling structures.
RodColeman 0:850eacf3e945 4 */
RodColeman 0:850eacf3e945 5
RodColeman 0:850eacf3e945 6 /*
RodColeman 0:850eacf3e945 7 * Copyright (c) 2006 Axon Digital Design B.V., The Netherlands.
RodColeman 0:850eacf3e945 8 * All rights reserved.
RodColeman 0:850eacf3e945 9 *
RodColeman 0:850eacf3e945 10 * Redistribution and use in source and binary forms, with or without modification,
RodColeman 0:850eacf3e945 11 * are permitted provided that the following conditions are met:
RodColeman 0:850eacf3e945 12 *
RodColeman 0:850eacf3e945 13 * 1. Redistributions of source code must retain the above copyright notice,
RodColeman 0:850eacf3e945 14 * this list of conditions and the following disclaimer.
RodColeman 0:850eacf3e945 15 * 2. Redistributions in binary form must reproduce the above copyright notice,
RodColeman 0:850eacf3e945 16 * this list of conditions and the following disclaimer in the documentation
RodColeman 0:850eacf3e945 17 * and/or other materials provided with the distribution.
RodColeman 0:850eacf3e945 18 * 3. The name of the author may not be used to endorse or promote products
RodColeman 0:850eacf3e945 19 * derived from this software without specific prior written permission.
RodColeman 0:850eacf3e945 20 *
RodColeman 0:850eacf3e945 21 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
RodColeman 0:850eacf3e945 22 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
RodColeman 0:850eacf3e945 23 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
RodColeman 0:850eacf3e945 24 * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
RodColeman 0:850eacf3e945 25 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
RodColeman 0:850eacf3e945 26 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
RodColeman 0:850eacf3e945 27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
RodColeman 0:850eacf3e945 28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
RodColeman 0:850eacf3e945 29 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
RodColeman 0:850eacf3e945 30 * OF SUCH DAMAGE.
RodColeman 0:850eacf3e945 31 *
RodColeman 0:850eacf3e945 32 * Author: Christiaan Simons <christiaan.simons@axon.tv>
RodColeman 0:850eacf3e945 33 */
RodColeman 0:850eacf3e945 34
RodColeman 0:850eacf3e945 35 #ifndef __LWIP_SNMP_MSG_H__
RodColeman 0:850eacf3e945 36 #define __LWIP_SNMP_MSG_H__
RodColeman 0:850eacf3e945 37
RodColeman 0:850eacf3e945 38 #include "lwip/opt.h"
RodColeman 0:850eacf3e945 39 #include "lwip/snmp.h"
RodColeman 0:850eacf3e945 40 #include "lwip/snmp_structs.h"
RodColeman 0:850eacf3e945 41 #include "lwip/ip_addr.h"
RodColeman 0:850eacf3e945 42 #include "lwip/err.h"
RodColeman 0:850eacf3e945 43
RodColeman 0:850eacf3e945 44 #if LWIP_SNMP
RodColeman 0:850eacf3e945 45
RodColeman 0:850eacf3e945 46 #if SNMP_PRIVATE_MIB
RodColeman 0:850eacf3e945 47 /* When using a private MIB, you have to create a file 'private_mib.h' that contains
RodColeman 0:850eacf3e945 48 * a 'struct mib_array_node mib_private' which contains your MIB. */
RodColeman 0:850eacf3e945 49 #include "private_mib.h"
RodColeman 0:850eacf3e945 50 #endif
RodColeman 0:850eacf3e945 51
RodColeman 0:850eacf3e945 52 #ifdef __cplusplus
RodColeman 0:850eacf3e945 53 extern "C" {
RodColeman 0:850eacf3e945 54 #endif
RodColeman 0:850eacf3e945 55
RodColeman 0:850eacf3e945 56 /* The listen port of the SNMP agent. Clients have to make their requests to
RodColeman 0:850eacf3e945 57 this port. Most standard clients won't work if you change this! */
RodColeman 0:850eacf3e945 58 #ifndef SNMP_IN_PORT
RodColeman 0:850eacf3e945 59 #define SNMP_IN_PORT 161
RodColeman 0:850eacf3e945 60 #endif
RodColeman 0:850eacf3e945 61 /* The remote port the SNMP agent sends traps to. Most standard trap sinks won't
RodColeman 0:850eacf3e945 62 work if you change this! */
RodColeman 0:850eacf3e945 63 #ifndef SNMP_TRAP_PORT
RodColeman 0:850eacf3e945 64 #define SNMP_TRAP_PORT 162
RodColeman 0:850eacf3e945 65 #endif
RodColeman 0:850eacf3e945 66
RodColeman 0:850eacf3e945 67 #define SNMP_ES_NOERROR 0
RodColeman 0:850eacf3e945 68 #define SNMP_ES_TOOBIG 1
RodColeman 0:850eacf3e945 69 #define SNMP_ES_NOSUCHNAME 2
RodColeman 0:850eacf3e945 70 #define SNMP_ES_BADVALUE 3
RodColeman 0:850eacf3e945 71 #define SNMP_ES_READONLY 4
RodColeman 0:850eacf3e945 72 #define SNMP_ES_GENERROR 5
RodColeman 0:850eacf3e945 73
RodColeman 0:850eacf3e945 74 #define SNMP_GENTRAP_COLDSTART 0
RodColeman 0:850eacf3e945 75 #define SNMP_GENTRAP_WARMSTART 1
RodColeman 0:850eacf3e945 76 #define SNMP_GENTRAP_AUTHFAIL 4
RodColeman 0:850eacf3e945 77 #define SNMP_GENTRAP_ENTERPRISESPC 6
RodColeman 0:850eacf3e945 78
RodColeman 0:850eacf3e945 79 struct snmp_varbind
RodColeman 0:850eacf3e945 80 {
RodColeman 0:850eacf3e945 81 /* next pointer, NULL for last in list */
RodColeman 0:850eacf3e945 82 struct snmp_varbind *next;
RodColeman 0:850eacf3e945 83 /* previous pointer, NULL for first in list */
RodColeman 0:850eacf3e945 84 struct snmp_varbind *prev;
RodColeman 0:850eacf3e945 85
RodColeman 0:850eacf3e945 86 /* object identifier length (in s32_t) */
RodColeman 0:850eacf3e945 87 u8_t ident_len;
RodColeman 0:850eacf3e945 88 /* object identifier array */
RodColeman 0:850eacf3e945 89 s32_t *ident;
RodColeman 0:850eacf3e945 90
RodColeman 0:850eacf3e945 91 /* object value ASN1 type */
RodColeman 0:850eacf3e945 92 u8_t value_type;
RodColeman 0:850eacf3e945 93 /* object value length (in u8_t) */
RodColeman 0:850eacf3e945 94 u8_t value_len;
RodColeman 0:850eacf3e945 95 /* object value */
RodColeman 0:850eacf3e945 96 void *value;
RodColeman 0:850eacf3e945 97
RodColeman 0:850eacf3e945 98 /* encoding varbind seq length length */
RodColeman 0:850eacf3e945 99 u8_t seqlenlen;
RodColeman 0:850eacf3e945 100 /* encoding object identifier length length */
RodColeman 0:850eacf3e945 101 u8_t olenlen;
RodColeman 0:850eacf3e945 102 /* encoding object value length length */
RodColeman 0:850eacf3e945 103 u8_t vlenlen;
RodColeman 0:850eacf3e945 104 /* encoding varbind seq length */
RodColeman 0:850eacf3e945 105 u16_t seqlen;
RodColeman 0:850eacf3e945 106 /* encoding object identifier length */
RodColeman 0:850eacf3e945 107 u16_t olen;
RodColeman 0:850eacf3e945 108 /* encoding object value length */
RodColeman 0:850eacf3e945 109 u16_t vlen;
RodColeman 0:850eacf3e945 110 };
RodColeman 0:850eacf3e945 111
RodColeman 0:850eacf3e945 112 struct snmp_varbind_root
RodColeman 0:850eacf3e945 113 {
RodColeman 0:850eacf3e945 114 struct snmp_varbind *head;
RodColeman 0:850eacf3e945 115 struct snmp_varbind *tail;
RodColeman 0:850eacf3e945 116 /* number of variable bindings in list */
RodColeman 0:850eacf3e945 117 u8_t count;
RodColeman 0:850eacf3e945 118 /* encoding varbind-list seq length length */
RodColeman 0:850eacf3e945 119 u8_t seqlenlen;
RodColeman 0:850eacf3e945 120 /* encoding varbind-list seq length */
RodColeman 0:850eacf3e945 121 u16_t seqlen;
RodColeman 0:850eacf3e945 122 };
RodColeman 0:850eacf3e945 123
RodColeman 0:850eacf3e945 124 /** output response message header length fields */
RodColeman 0:850eacf3e945 125 struct snmp_resp_header_lengths
RodColeman 0:850eacf3e945 126 {
RodColeman 0:850eacf3e945 127 /* encoding error-index length length */
RodColeman 0:850eacf3e945 128 u8_t erridxlenlen;
RodColeman 0:850eacf3e945 129 /* encoding error-status length length */
RodColeman 0:850eacf3e945 130 u8_t errstatlenlen;
RodColeman 0:850eacf3e945 131 /* encoding request id length length */
RodColeman 0:850eacf3e945 132 u8_t ridlenlen;
RodColeman 0:850eacf3e945 133 /* encoding pdu length length */
RodColeman 0:850eacf3e945 134 u8_t pdulenlen;
RodColeman 0:850eacf3e945 135 /* encoding community length length */
RodColeman 0:850eacf3e945 136 u8_t comlenlen;
RodColeman 0:850eacf3e945 137 /* encoding version length length */
RodColeman 0:850eacf3e945 138 u8_t verlenlen;
RodColeman 0:850eacf3e945 139 /* encoding sequence length length */
RodColeman 0:850eacf3e945 140 u8_t seqlenlen;
RodColeman 0:850eacf3e945 141
RodColeman 0:850eacf3e945 142 /* encoding error-index length */
RodColeman 0:850eacf3e945 143 u16_t erridxlen;
RodColeman 0:850eacf3e945 144 /* encoding error-status length */
RodColeman 0:850eacf3e945 145 u16_t errstatlen;
RodColeman 0:850eacf3e945 146 /* encoding request id length */
RodColeman 0:850eacf3e945 147 u16_t ridlen;
RodColeman 0:850eacf3e945 148 /* encoding pdu length */
RodColeman 0:850eacf3e945 149 u16_t pdulen;
RodColeman 0:850eacf3e945 150 /* encoding community length */
RodColeman 0:850eacf3e945 151 u16_t comlen;
RodColeman 0:850eacf3e945 152 /* encoding version length */
RodColeman 0:850eacf3e945 153 u16_t verlen;
RodColeman 0:850eacf3e945 154 /* encoding sequence length */
RodColeman 0:850eacf3e945 155 u16_t seqlen;
RodColeman 0:850eacf3e945 156 };
RodColeman 0:850eacf3e945 157
RodColeman 0:850eacf3e945 158 /** output response message header length fields */
RodColeman 0:850eacf3e945 159 struct snmp_trap_header_lengths
RodColeman 0:850eacf3e945 160 {
RodColeman 0:850eacf3e945 161 /* encoding timestamp length length */
RodColeman 0:850eacf3e945 162 u8_t tslenlen;
RodColeman 0:850eacf3e945 163 /* encoding specific-trap length length */
RodColeman 0:850eacf3e945 164 u8_t strplenlen;
RodColeman 0:850eacf3e945 165 /* encoding generic-trap length length */
RodColeman 0:850eacf3e945 166 u8_t gtrplenlen;
RodColeman 0:850eacf3e945 167 /* encoding agent-addr length length */
RodColeman 0:850eacf3e945 168 u8_t aaddrlenlen;
RodColeman 0:850eacf3e945 169 /* encoding enterprise-id length length */
RodColeman 0:850eacf3e945 170 u8_t eidlenlen;
RodColeman 0:850eacf3e945 171 /* encoding pdu length length */
RodColeman 0:850eacf3e945 172 u8_t pdulenlen;
RodColeman 0:850eacf3e945 173 /* encoding community length length */
RodColeman 0:850eacf3e945 174 u8_t comlenlen;
RodColeman 0:850eacf3e945 175 /* encoding version length length */
RodColeman 0:850eacf3e945 176 u8_t verlenlen;
RodColeman 0:850eacf3e945 177 /* encoding sequence length length */
RodColeman 0:850eacf3e945 178 u8_t seqlenlen;
RodColeman 0:850eacf3e945 179
RodColeman 0:850eacf3e945 180 /* encoding timestamp length */
RodColeman 0:850eacf3e945 181 u16_t tslen;
RodColeman 0:850eacf3e945 182 /* encoding specific-trap length */
RodColeman 0:850eacf3e945 183 u16_t strplen;
RodColeman 0:850eacf3e945 184 /* encoding generic-trap length */
RodColeman 0:850eacf3e945 185 u16_t gtrplen;
RodColeman 0:850eacf3e945 186 /* encoding agent-addr length */
RodColeman 0:850eacf3e945 187 u16_t aaddrlen;
RodColeman 0:850eacf3e945 188 /* encoding enterprise-id length */
RodColeman 0:850eacf3e945 189 u16_t eidlen;
RodColeman 0:850eacf3e945 190 /* encoding pdu length */
RodColeman 0:850eacf3e945 191 u16_t pdulen;
RodColeman 0:850eacf3e945 192 /* encoding community length */
RodColeman 0:850eacf3e945 193 u16_t comlen;
RodColeman 0:850eacf3e945 194 /* encoding version length */
RodColeman 0:850eacf3e945 195 u16_t verlen;
RodColeman 0:850eacf3e945 196 /* encoding sequence length */
RodColeman 0:850eacf3e945 197 u16_t seqlen;
RodColeman 0:850eacf3e945 198 };
RodColeman 0:850eacf3e945 199
RodColeman 0:850eacf3e945 200 /* Accepting new SNMP messages. */
RodColeman 0:850eacf3e945 201 #define SNMP_MSG_EMPTY 0
RodColeman 0:850eacf3e945 202 /* Search for matching object for variable binding. */
RodColeman 0:850eacf3e945 203 #define SNMP_MSG_SEARCH_OBJ 1
RodColeman 0:850eacf3e945 204 /* Perform SNMP operation on in-memory object.
RodColeman 0:850eacf3e945 205 Pass-through states, for symmetry only. */
RodColeman 0:850eacf3e945 206 #define SNMP_MSG_INTERNAL_GET_OBJDEF 2
RodColeman 0:850eacf3e945 207 #define SNMP_MSG_INTERNAL_GET_VALUE 3
RodColeman 0:850eacf3e945 208 #define SNMP_MSG_INTERNAL_SET_TEST 4
RodColeman 0:850eacf3e945 209 #define SNMP_MSG_INTERNAL_GET_OBJDEF_S 5
RodColeman 0:850eacf3e945 210 #define SNMP_MSG_INTERNAL_SET_VALUE 6
RodColeman 0:850eacf3e945 211 /* Perform SNMP operation on object located externally.
RodColeman 0:850eacf3e945 212 In theory this could be used for building a proxy agent.
RodColeman 0:850eacf3e945 213 Practical use is for an enterprise spc. app. gateway. */
RodColeman 0:850eacf3e945 214 #define SNMP_MSG_EXTERNAL_GET_OBJDEF 7
RodColeman 0:850eacf3e945 215 #define SNMP_MSG_EXTERNAL_GET_VALUE 8
RodColeman 0:850eacf3e945 216 #define SNMP_MSG_EXTERNAL_SET_TEST 9
RodColeman 0:850eacf3e945 217 #define SNMP_MSG_EXTERNAL_GET_OBJDEF_S 10
RodColeman 0:850eacf3e945 218 #define SNMP_MSG_EXTERNAL_SET_VALUE 11
RodColeman 0:850eacf3e945 219
RodColeman 0:850eacf3e945 220 #define SNMP_COMMUNITY_STR_LEN 64
RodColeman 0:850eacf3e945 221 struct snmp_msg_pstat
RodColeman 0:850eacf3e945 222 {
RodColeman 0:850eacf3e945 223 /* lwIP local port (161) binding */
RodColeman 0:850eacf3e945 224 struct udp_pcb *pcb;
RodColeman 0:850eacf3e945 225 /* source IP address */
RodColeman 0:850eacf3e945 226 ip_addr_t sip;
RodColeman 0:850eacf3e945 227 /* source UDP port */
RodColeman 0:850eacf3e945 228 u16_t sp;
RodColeman 0:850eacf3e945 229 /* request type */
RodColeman 0:850eacf3e945 230 u8_t rt;
RodColeman 0:850eacf3e945 231 /* request ID */
RodColeman 0:850eacf3e945 232 s32_t rid;
RodColeman 0:850eacf3e945 233 /* error status */
RodColeman 0:850eacf3e945 234 s32_t error_status;
RodColeman 0:850eacf3e945 235 /* error index */
RodColeman 0:850eacf3e945 236 s32_t error_index;
RodColeman 0:850eacf3e945 237 /* community name (zero terminated) */
RodColeman 0:850eacf3e945 238 u8_t community[SNMP_COMMUNITY_STR_LEN + 1];
RodColeman 0:850eacf3e945 239 /* community string length (exclusive zero term) */
RodColeman 0:850eacf3e945 240 u8_t com_strlen;
RodColeman 0:850eacf3e945 241 /* one out of MSG_EMPTY, MSG_DEMUX, MSG_INTERNAL, MSG_EXTERNAL_x */
RodColeman 0:850eacf3e945 242 u8_t state;
RodColeman 0:850eacf3e945 243 /* saved arguments for MSG_EXTERNAL_x */
RodColeman 0:850eacf3e945 244 struct mib_external_node *ext_mib_node;
RodColeman 0:850eacf3e945 245 struct snmp_name_ptr ext_name_ptr;
RodColeman 0:850eacf3e945 246 struct obj_def ext_object_def;
RodColeman 0:850eacf3e945 247 struct snmp_obj_id ext_oid;
RodColeman 0:850eacf3e945 248 /* index into input variable binding list */
RodColeman 0:850eacf3e945 249 u8_t vb_idx;
RodColeman 0:850eacf3e945 250 /* ptr into input variable binding list */
RodColeman 0:850eacf3e945 251 struct snmp_varbind *vb_ptr;
RodColeman 0:850eacf3e945 252 /* list of variable bindings from input */
RodColeman 0:850eacf3e945 253 struct snmp_varbind_root invb;
RodColeman 0:850eacf3e945 254 /* list of variable bindings to output */
RodColeman 0:850eacf3e945 255 struct snmp_varbind_root outvb;
RodColeman 0:850eacf3e945 256 /* output response lengths used in ASN encoding */
RodColeman 0:850eacf3e945 257 struct snmp_resp_header_lengths rhl;
RodColeman 0:850eacf3e945 258 };
RodColeman 0:850eacf3e945 259
RodColeman 0:850eacf3e945 260 struct snmp_msg_trap
RodColeman 0:850eacf3e945 261 {
RodColeman 0:850eacf3e945 262 /* lwIP local port (161) binding */
RodColeman 0:850eacf3e945 263 struct udp_pcb *pcb;
RodColeman 0:850eacf3e945 264 /* destination IP address in network order */
RodColeman 0:850eacf3e945 265 ip_addr_t dip;
RodColeman 0:850eacf3e945 266
RodColeman 0:850eacf3e945 267 /* source enterprise ID (sysObjectID) */
RodColeman 0:850eacf3e945 268 struct snmp_obj_id *enterprise;
RodColeman 0:850eacf3e945 269 /* source IP address, raw network order format */
RodColeman 0:850eacf3e945 270 u8_t sip_raw[4];
RodColeman 0:850eacf3e945 271 /* generic trap code */
RodColeman 0:850eacf3e945 272 u32_t gen_trap;
RodColeman 0:850eacf3e945 273 /* specific trap code */
RodColeman 0:850eacf3e945 274 u32_t spc_trap;
RodColeman 0:850eacf3e945 275 /* timestamp */
RodColeman 0:850eacf3e945 276 u32_t ts;
RodColeman 0:850eacf3e945 277 /* list of variable bindings to output */
RodColeman 0:850eacf3e945 278 struct snmp_varbind_root outvb;
RodColeman 0:850eacf3e945 279 /* output trap lengths used in ASN encoding */
RodColeman 0:850eacf3e945 280 struct snmp_trap_header_lengths thl;
RodColeman 0:850eacf3e945 281 };
RodColeman 0:850eacf3e945 282
RodColeman 0:850eacf3e945 283 /** Agent Version constant, 0 = v1 oddity */
RodColeman 0:850eacf3e945 284 extern const s32_t snmp_version;
RodColeman 0:850eacf3e945 285 /** Agent default "public" community string */
RodColeman 0:850eacf3e945 286 extern const char snmp_publiccommunity[7];
RodColeman 0:850eacf3e945 287
RodColeman 0:850eacf3e945 288 extern struct snmp_msg_trap trap_msg;
RodColeman 0:850eacf3e945 289
RodColeman 0:850eacf3e945 290 /** Agent setup, start listening to port 161. */
RodColeman 0:850eacf3e945 291 void snmp_init(void);
RodColeman 0:850eacf3e945 292 void snmp_trap_dst_enable(u8_t dst_idx, u8_t enable);
RodColeman 0:850eacf3e945 293 void snmp_trap_dst_ip_set(u8_t dst_idx, ip_addr_t *dst);
RodColeman 0:850eacf3e945 294
RodColeman 0:850eacf3e945 295 /** Varbind-list functions. */
RodColeman 0:850eacf3e945 296 struct snmp_varbind* snmp_varbind_alloc(struct snmp_obj_id *oid, u8_t type, u8_t len);
RodColeman 0:850eacf3e945 297 void snmp_varbind_free(struct snmp_varbind *vb);
RodColeman 0:850eacf3e945 298 void snmp_varbind_list_free(struct snmp_varbind_root *root);
RodColeman 0:850eacf3e945 299 void snmp_varbind_tail_add(struct snmp_varbind_root *root, struct snmp_varbind *vb);
RodColeman 0:850eacf3e945 300 struct snmp_varbind* snmp_varbind_tail_remove(struct snmp_varbind_root *root);
RodColeman 0:850eacf3e945 301
RodColeman 0:850eacf3e945 302 /** Handle an internal (recv) or external (private response) event. */
RodColeman 0:850eacf3e945 303 void snmp_msg_event(u8_t request_id);
RodColeman 0:850eacf3e945 304 err_t snmp_send_response(struct snmp_msg_pstat *m_stat);
RodColeman 0:850eacf3e945 305 err_t snmp_send_trap(s8_t generic_trap, struct snmp_obj_id *eoid, s32_t specific_trap);
RodColeman 0:850eacf3e945 306 void snmp_coldstart_trap(void);
RodColeman 0:850eacf3e945 307 void snmp_authfail_trap(void);
RodColeman 0:850eacf3e945 308
RodColeman 0:850eacf3e945 309 #ifdef __cplusplus
RodColeman 0:850eacf3e945 310 }
RodColeman 0:850eacf3e945 311 #endif
RodColeman 0:850eacf3e945 312
RodColeman 0:850eacf3e945 313 #endif /* LWIP_SNMP */
RodColeman 0:850eacf3e945 314
RodColeman 0:850eacf3e945 315 #endif /* __LWIP_SNMP_MSG_H__ */