1/* 2 * Copyright (C) 2021 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15#ifndef OHOS_DHCP_OPTIONS_H 16#define OHOS_DHCP_OPTIONS_H 17 18 19#include <stdint.h> 20#include <stdbool.h> 21 22#include "dhcp_client_def.h" 23 24#ifdef __cplusplus 25extern "C" { 26#endif 27 28uint8_t GetDhcpOptionDataLen(const uint8_t code); 29const uint8_t *GetDhcpOption(const struct DhcpPacket *packet, int code, size_t *length); 30bool GetDhcpOptionUint8(const struct DhcpPacket *packet, int code, uint8_t *data); 31bool GetDhcpOptionUint32(const struct DhcpPacket *packet, int code, uint32_t *data); 32bool GetDhcpOptionUint32n(const struct DhcpPacket *packet, int code, uint32_t *data1, uint32_t *data2); 33char *GetDhcpOptionString(const struct DhcpPacket *packet, int code); 34int GetEndOptionIndex(const uint8_t *pOpts); 35int AddOptStrToOpts(uint8_t *pOpts, uint8_t *pOpt, int nOptLen); 36int AddOptValueToOpts(uint8_t *pOpts, uint8_t code, uint32_t value); 37 38#ifdef __cplusplus 39} 40#endif 41#endif 42