4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright 2003 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 #pragma ident "%Z%%M% %I% %E% SMI"
29 #include <sys/types.h>
33 #include <netinet/in.h>
34 #include <netinet/dhcp.h>
35 #include "dhcp_impl.h"
38 * Fetch a copy of the DHCP-supplied value of the parameter requested
39 * by code in value, and the parameter value length in *vallenp.
43 * B_FALSE If invalid code, or no parameter value.
45 * B_TRUE Valid code which has a parameter value.
46 * *vallenp is set to the parameter value length.
47 * If the parameter value length is less than or
48 * equal to *vallenp, value is set to the parameter
53 dhcp_getinfo_pl(PKT_LIST
*pl
, uchar_t optcat
, uint16_t code
, uint16_t optsize
,
54 void *value
, size_t *vallenp
)
60 if (optcat
== DSYM_STANDARD
) {
61 if (code
> DHCP_LAST_OPT
)
64 if (pl
->opts
[code
] == NULL
)
67 if (*vallenp
< pl
->opts
[code
]->len
) {
68 *vallenp
= pl
->opts
[code
]->len
;
72 bcopy(pl
->opts
[code
]->value
, value
, pl
->opts
[code
]->len
);
73 *vallenp
= pl
->opts
[code
]->len
;
75 } else if (optcat
== DSYM_VENDOR
) {
76 if (code
> VS_OPTION_END
)
79 if (pl
->vs
[code
] == NULL
)
82 if (*vallenp
< pl
->vs
[code
]->len
) {
83 *vallenp
= pl
->vs
[code
]->len
;
87 bcopy(pl
->vs
[code
]->value
, value
, pl
->vs
[code
]->len
);
88 *vallenp
= pl
->vs
[code
]->len
;
90 } else if (optcat
== DSYM_FIELD
) {
91 if (code
+ optsize
> sizeof (PKT
))
94 if (*vallenp
< optsize
) {
100 bcopy((caddr_t
)pl
->pkt
+ code
, value
, optsize
);