100 lines
2.9 KiB
Plaintext
100 lines
2.9 KiB
Plaintext
|
############################################################# -*- c -*-
|
||
|
## generic include for XXX. Do not use directly.
|
||
|
##
|
||
|
########################################################################
|
||
|
@if $m2c_mark_boundary == 1@
|
||
|
/** START code generated by syntax-InetAddress-get.m2i */
|
||
|
@end@
|
||
|
########################################################################
|
||
|
##
|
||
|
/*
|
||
|
* TODO:231:M: |-> copy $node data.
|
||
|
* TODO:231:M: | |-> get address type from your context pointer.
|
||
|
*/
|
||
|
int addressType = -1;
|
||
|
size_t actual_size = 0;
|
||
|
|
||
|
return MFD_SKIP; /* TODO:235:M: |-> Remove SKIP once you've set $node data */
|
||
|
|
||
|
switch (addressType) {
|
||
|
case INETADDRESSTYPE_UNKNOWN:
|
||
|
/*
|
||
|
* An unknown address type. This value MUST be used if the value
|
||
|
* of the InetAddress object is a zero-length string. It may also be
|
||
|
* used to indicate an IP address which is not in one of the formats
|
||
|
* defined below.
|
||
|
*/
|
||
|
actual_size = ${m2c_ctx_rhs};
|
||
|
break;
|
||
|
|
||
|
case INETADDRESSTYPE_IPV4:
|
||
|
/*
|
||
|
* Represents an IPv4 network address:
|
||
|
* octets contents encoding
|
||
|
* 1-4 IPv4 address network-byte order
|
||
|
*/
|
||
|
actual_size = 4;
|
||
|
break;
|
||
|
|
||
|
case INETADDRESSTYPE_IPV6:
|
||
|
/*
|
||
|
* Represents an IPv6 network address:
|
||
|
*
|
||
|
* octets contents encoding
|
||
|
* 1-16 IPv6 address network-byte order
|
||
|
*/
|
||
|
actual_size = 16;
|
||
|
break;
|
||
|
|
||
|
case INETADDRESSTYPE_IPV4Z:
|
||
|
/*
|
||
|
* Represents a non-global IPv4 network address together
|
||
|
* with its zone index:
|
||
|
*
|
||
|
* octets contents encoding
|
||
|
* 1-4 IPv4 address network-byte order
|
||
|
* 5-8 zone index network-byte order
|
||
|
*/
|
||
|
actual_size = 8;
|
||
|
break;
|
||
|
|
||
|
case INETADDRESSTYPE_IPV6Z:
|
||
|
/*
|
||
|
* Represents a non-global IPv6 network address together
|
||
|
* with its zone index:
|
||
|
*
|
||
|
* octets contents encoding
|
||
|
* 1-16 IPv6 address network-byte order
|
||
|
* 17-20 zone index network-byte order
|
||
|
*/
|
||
|
actual_size = 20;
|
||
|
break;
|
||
|
|
||
|
case INETADDRESSTYPE_DNS:
|
||
|
/*
|
||
|
* Represents a DNS domain name. The name SHOULD be fully
|
||
|
* qualified whenever possible.
|
||
|
*/
|
||
|
actual_size = ${m2c_ctx_rhs};
|
||
|
break;
|
||
|
|
||
|
default:
|
||
|
snmp_log(LOG_ERR, "unknown InetAddressType %d for $node\n",
|
||
|
addressType);
|
||
|
return SNMP_ERR_GENERR;
|
||
|
}
|
||
|
|
||
|
if ( actual_size > ${m2c_ctx_lhs} ) {
|
||
|
snmp_log(LOG_ERR, "actual size %d too big for $node\n",
|
||
|
addressType);
|
||
|
return SNMP_ERR_GENERR;
|
||
|
}
|
||
|
|
||
|
memcpy( ${m2c_ctx_lh}, ${m2c_ctx_rh}, actual_size);
|
||
|
${m2c_ctx_lhs} = actual_size;
|
||
|
##
|
||
|
########################################################################
|
||
|
@if $m2c_mark_boundary == 1@
|
||
|
/** END code generated by syntax-InetAddress-get.m2i */
|
||
|
@end@
|