blob: 2b19f8da71f122ceac2ad167b86e10542775e7e3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
|
############################################################# -*- c -*-
## generic include for XXX. Do not use directly.
##
## $Id: syntax-InetAddress-get.m2i 11795 2005-01-06 14:49:39Z rstory $
########################################################################
@if $m2c_mark_boundary == 1@
/** START code generated by $RCSfile$ $Revision: 11795 $ */
@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 $RCSfile$ $Revision: 11795 $ */
@end@
|