Lines Matching refs:optptr
833 static uint8_t *dhcpc_addclientid(uint8_t *optptr) in dhcpc_addclientid() argument
835 *optptr++ = DHCP_OPTION_CLIENTID; in dhcpc_addclientid()
836 *optptr++ = 7; in dhcpc_addclientid()
837 *optptr++ = 1; in dhcpc_addclientid()
838 memcpy(optptr, &state->macaddr, 6); in dhcpc_addclientid()
839 return optptr + 6; in dhcpc_addclientid()
843 static uint8_t *dhcpc_addmsgtype(uint8_t *optptr, uint8_t type) in dhcpc_addmsgtype() argument
845 *optptr++ = DHCP_OPTION_MSG_TYPE; in dhcpc_addmsgtype()
846 *optptr++ = 1; in dhcpc_addmsgtype()
847 *optptr++ = type; in dhcpc_addmsgtype()
848 return optptr; in dhcpc_addmsgtype()
852 static uint8_t *dhcpc_addmaxsize(uint8_t *optptr, uint16_t size) in dhcpc_addmaxsize() argument
854 *optptr++ = DHCP_OPTION_MAX_SIZE; in dhcpc_addmaxsize()
855 *optptr++ = 2; in dhcpc_addmaxsize()
856 memcpy(optptr, &size, 2); in dhcpc_addmaxsize()
857 return optptr + 2; in dhcpc_addmaxsize()
860 static uint8_t *dhcpc_addstropt(uint8_t *optptr, uint8_t opcode, char* str, int len) in dhcpc_addstropt() argument
862 *optptr++ = opcode; in dhcpc_addstropt()
863 *optptr++ = len; in dhcpc_addstropt()
864 memcpy(optptr, str, len); in dhcpc_addstropt()
865 return optptr + len; in dhcpc_addstropt()
869 static uint8_t *dhcpc_addserverid(struct in_addr *serverid, uint8_t *optptr) in dhcpc_addserverid() argument
871 *optptr++ = DHCP_OPTION_SERVER_ID; in dhcpc_addserverid()
872 *optptr++ = 4; in dhcpc_addserverid()
873 memcpy(optptr, &serverid->s_addr, 4); in dhcpc_addserverid()
874 return optptr + 4; in dhcpc_addserverid()
878 static uint8_t *dhcpc_addreqipaddr(struct in_addr *ipaddr, uint8_t *optptr) in dhcpc_addreqipaddr() argument
880 *optptr++ = DHCP_OPTION_REQ_IPADDR; in dhcpc_addreqipaddr()
881 *optptr++ = 4; in dhcpc_addreqipaddr()
882 memcpy(optptr, &ipaddr->s_addr, 4); in dhcpc_addreqipaddr()
883 return optptr + 4; in dhcpc_addreqipaddr()
887 static uint8_t *dhcpc_addfdnname(uint8_t *optptr, char *hname) in dhcpc_addfdnname() argument
891 *optptr++ = DHCP_OPTION_FQDN; in dhcpc_addfdnname()
892 *optptr++ = size + 3; in dhcpc_addfdnname()
893 *optptr++ = 0x1; //flags in dhcpc_addfdnname()
894 optptr += 2; // two blank bytes in dhcpc_addfdnname()
895 strcpy((char*)optptr, hname); // name in dhcpc_addfdnname()
897 return optptr + size; in dhcpc_addfdnname()
901 static uint8_t *dhcpc_addreqoptions(uint8_t *optptr) in dhcpc_addreqoptions() argument
905 *optptr++ = DHCP_OPTION_REQ_LIST; in dhcpc_addreqoptions()
906 len = optptr; in dhcpc_addreqoptions()
908 optptr++; in dhcpc_addreqoptions()
912 *optptr++ = DHCP_OPTION_SUBNET_MASK; in dhcpc_addreqoptions()
913 *optptr++ = DHCP_OPTION_ROUTER; in dhcpc_addreqoptions()
914 *optptr++ = DHCP_OPTION_DNS_SERVER; in dhcpc_addreqoptions()
915 *optptr++ = DHCP_OPTION_BROADCAST; in dhcpc_addreqoptions()
918 memcpy(optptr++, raw_opt, raw_optcount); in dhcpc_addreqoptions()
921 return optptr; in dhcpc_addreqoptions()
924 static uint8_t *dhcpc_addend(uint8_t *optptr) in dhcpc_addend() argument
926 *optptr++ = DHCP_OPTION_END; in dhcpc_addend()
927 return optptr; in dhcpc_addend()
931 static uint8_t* set_xopt(uint8_t *optptr) in set_xopt() argument
937 *optptr++ = (uint8_t) (options_list[count].code & 0x00FF); in set_xopt()
938 *optptr++ = (uint8_t) options_list[count].len; in set_xopt()
939 memcpy(optptr, options_list[count].val, options_list[count].len); in set_xopt()
940 optptr += options_list[count].len; in set_xopt()
942 return optptr; in set_xopt()
1056 static uint8_t dhcpc_parseoptions(dhcpc_result_t *presult, uint8_t *optptr) in dhcpc_parseoptions() argument
1089 while (*optptr != DHCP_OPTION_END) { in dhcpc_parseoptions()
1090 if (*optptr == DHCP_OPTION_PADDING) { in dhcpc_parseoptions()
1091 optptr++; in dhcpc_parseoptions()
1094 if (*optptr == DHCP_OPTION_OVERLOAD) { in dhcpc_parseoptions()
1095 overloaded = optptr[2]; in dhcpc_parseoptions()
1096 optptr += optptr[1] + 2; in dhcpc_parseoptions()
1100 if ((msgopt_list[count].code & 0X00FF) == *optptr) { in dhcpc_parseoptions()
1107 memcpy(&convtmp, &optptr[2], sizeof(uint32_t)); in dhcpc_parseoptions()
1114 memcpy(&convtmp, &optptr[2], sizeof(uint16_t)); in dhcpc_parseoptions()
1121 memcpy(&convtmp, &optptr[2], sizeof(uint8_t)); in dhcpc_parseoptions()
1127 memcpy(&convtmp, &optptr[2], sizeof(uint32_t)); in dhcpc_parseoptions()
1134 sprintf(toybuf, "%.*s", optptr[1], &optptr[2]); in dhcpc_parseoptions()
1139 optlen = optptr[1]; in dhcpc_parseoptions()
1142 memcpy(&convtmp, &optptr[2], sizeof(uint32_t)); in dhcpc_parseoptions()
1157 options = &optptr[2]; in dhcpc_parseoptions()
1158 optlen = optptr[1]; in dhcpc_parseoptions()
1188 optptr += optptr[1] + 2; in dhcpc_parseoptions()
1190 if ((overloaded == 1) || (overloaded == 3)) dhcpc_parseoptions(presult, optptr); in dhcpc_parseoptions()
1191 if ((overloaded == 2) || (overloaded == 3)) dhcpc_parseoptions(presult, optptr); in dhcpc_parseoptions()