dhcp-option.c revision 2688ef60de061bf188c1153c58fb41a78919b97e
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering This file is part of systemd.
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering Copyright (C) 2013 Intel Corporation. All rights reserved.
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering systemd is free software; you can redistribute it and/or modify it
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering under the terms of the GNU Lesser General Public License as published by
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering the Free Software Foundation; either version 2.1 of the License, or
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering (at your option) any later version.
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering systemd is distributed in the hope that it will be useful, but
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering WITHOUT ANY WARRANTY; without even the implied warranty of
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering Lesser General Public License for more details.
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering You should have received a copy of the GNU Lesser General Public License
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering along with systemd; If not, see <http://www.gnu.org/licenses/>.
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poetteringint dhcp_option_append(uint8_t options[], size_t size, size_t *offset,
07630cea1f3a845c09309f197ac7c4f11edd3b62Lennart Poettering uint8_t code, size_t optlen, const void *optval) {
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering /* always make sure there is space for an END option */
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering memcpy(&options[*offset + 2], optval, optlen);
97e5d693c04e50605d438af1c8a965fd2963bbe9Lennart Poetteringstatic int parse_options(const uint8_t options[], size_t buflen, uint8_t *overload,
97e5d693c04e50605d438af1c8a965fd2963bbe9Lennart Poettering uint8_t *message_type, dhcp_option_cb_t cb,
dfc1091b2f5f21f69e0aa6d3c4536b8990d4b100Lennart Poettering cb(code, len, &options[offset], user_data);
af49ca27ffd790d78dbbb465b978266dfd5c93daLennart Poetteringint dhcp_option_parse(DHCPMessage *message, size_t len,
b4f1862df2e45aba90386887d685b8bf3c840e10Daniel Mack r = parse_options(message->options, len, &overload, &message_type,
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering r = parse_options(message->file, sizeof(message->file),