Lines Matching defs:packet
26 /* Check packet option OPTION_OVERLOAD_OPTION. */
27 static bool CheckOptSoverloaded(const struct DhcpPacket *packet, int code, int maxLen, int *over, int *index)
29 if (packet == nullptr) {
30 DHCP_LOGE("CheckOptSoverloaded failed, packet == nullptr!");
34 const uint8_t *pOption = packet->options;
45 /* Check packet options based on the code and index. */
46 static int CheckOptionsData(const struct DhcpPacket *packet, int code, int index, int maxLen)
48 if (packet == nullptr) {
49 DHCP_LOGE("CheckOptionsData failed, packet == nullptr!");
59 const uint8_t *pOption = packet->options;
152 /* Obtains the data pointer and length from the packet based on the code. */
153 const uint8_t *GetDhcpOption(const struct DhcpPacket *packet, int code, size_t *length)
156 if (packet == nullptr) {
157 DHCP_LOGE("GetDhcpOption failed, packet == nullptr!");
161 const uint8_t *pOption = packet->options;
164 int nRet = CheckOptionsData(packet, code, nIndex, maxLen);
177 if (!CheckOptSoverloaded(packet, code, maxLen, &nOver, &nIndex)) {
183 pOption = packet->file;
188 pOption = packet->sname;
205 /* Obtains the uint8 data from the packet based on the code. */
206 bool GetDhcpOptionUint8(const struct DhcpPacket *packet, int code, uint8_t *data)
209 const uint8_t *p = GetDhcpOption(packet, code, &len);
225 /* Obtains the uint32 data from the packet based on the code. */
226 bool GetDhcpOptionUint32(const struct DhcpPacket *packet, int code, uint32_t *data)
229 const uint8_t *p = GetDhcpOption(packet, code, &len);
249 /* Obtains the uint32n data from the packet based on the code. */
250 bool GetDhcpOptionUint32n(const struct DhcpPacket *packet, int code, uint32_t *data1, uint32_t *data2)
253 const uint8_t *p = GetDhcpOption(packet, code, &len);
283 /* Obtains the string data from the packet based on the code. */
284 char *GetDhcpOptionString(const struct DhcpPacket *packet, int code)
287 const uint8_t *p = GetDhcpOption(packet, code, &len);
336 DHCP_LOGE("AddOptStrToOpts() code:%{public}u did not fit into the packet!", pOpt[DHCP_OPT_CODE_INDEX]);