1518678f8Sopenharmony_ci/* 2518678f8Sopenharmony_ci * Copyright (C) 2021 Huawei Device Co., Ltd. 3518678f8Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 4518678f8Sopenharmony_ci * you may not use this file except in compliance with the License. 5518678f8Sopenharmony_ci * You may obtain a copy of the License at 6518678f8Sopenharmony_ci * 7518678f8Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 8518678f8Sopenharmony_ci * 9518678f8Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 10518678f8Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 11518678f8Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12518678f8Sopenharmony_ci * See the License for the specific language governing permissions and 13518678f8Sopenharmony_ci * limitations under the License. 14518678f8Sopenharmony_ci */ 15518678f8Sopenharmony_ci#ifndef OHOS_DHCP_OPTIONS_H 16518678f8Sopenharmony_ci#define OHOS_DHCP_OPTIONS_H 17518678f8Sopenharmony_ci 18518678f8Sopenharmony_ci 19518678f8Sopenharmony_ci#include <stdint.h> 20518678f8Sopenharmony_ci#include <stdbool.h> 21518678f8Sopenharmony_ci 22518678f8Sopenharmony_ci#include "dhcp_client_def.h" 23518678f8Sopenharmony_ci 24518678f8Sopenharmony_ci#ifdef __cplusplus 25518678f8Sopenharmony_ciextern "C" { 26518678f8Sopenharmony_ci#endif 27518678f8Sopenharmony_ci 28518678f8Sopenharmony_ciuint8_t GetDhcpOptionDataLen(const uint8_t code); 29518678f8Sopenharmony_ciconst uint8_t *GetDhcpOption(const struct DhcpPacket *packet, int code, size_t *length); 30518678f8Sopenharmony_cibool GetDhcpOptionUint8(const struct DhcpPacket *packet, int code, uint8_t *data); 31518678f8Sopenharmony_cibool GetDhcpOptionUint32(const struct DhcpPacket *packet, int code, uint32_t *data); 32518678f8Sopenharmony_cibool GetDhcpOptionUint32n(const struct DhcpPacket *packet, int code, uint32_t *data1, uint32_t *data2); 33518678f8Sopenharmony_cichar *GetDhcpOptionString(const struct DhcpPacket *packet, int code); 34518678f8Sopenharmony_ciint GetEndOptionIndex(const uint8_t *pOpts); 35518678f8Sopenharmony_ciint AddOptStrToOpts(uint8_t *pOpts, uint8_t *pOpt, int nOptLen); 36518678f8Sopenharmony_ciint AddOptValueToOpts(uint8_t *pOpts, uint8_t code, uint32_t value); 37518678f8Sopenharmony_ci 38518678f8Sopenharmony_ci#ifdef __cplusplus 39518678f8Sopenharmony_ci} 40518678f8Sopenharmony_ci#endif 41518678f8Sopenharmony_ci#endif 42