Lines Matching defs:client_msg
110 LWIP_STATIC struct pbuf *dhcps_create_base_msg(struct dhcp_msg *client_msg);
112 LWIP_STATIC void add_client_entry(struct dhcps *dhcps, unsigned int idx, struct dhcp_msg *client_msg);
114 LWIP_STATIC struct dyn_lease_addr *find_client_lease(struct dhcps *dhcps, struct dhcp_msg *client_msg);
115 LWIP_STATIC ip4_addr_t validate_discover(struct dhcps *dhcps, struct dhcp_msg *client_msg,
117 LWIP_STATIC void handle_discover(struct netif *netif, struct dhcps *dhcps, struct dhcp_msg *client_msg,
119 LWIP_STATIC ip4_addr_t validate_request_message(struct netif *netif, struct dhcp_msg *client_msg,
121 LWIP_STATIC void handle_request(struct netif *netif, struct dhcps *dhcps, struct dhcp_msg *client_msg,
123 LWIP_STATIC void handle_decline(struct netif *netif, struct dhcps *dhcps, struct dhcp_msg *client_msg,
125 LWIP_STATIC void handle_inform(struct netif *netif, struct dhcps *dhcps, struct dhcp_msg *client_msg);
127 struct dhcp_msg *client_msg, ip4_addr_t serverid, u8_t msg_type);
131 LWIP_STATIC struct pbuf *dhcps_create_base_msg(struct dhcp_msg *client_msg)
151 srvr_msg->htype = client_msg->htype;
152 srvr_msg->hlen = client_msg->hlen;
154 srvr_msg->xid = client_msg->xid;
156 srvr_msg->flags = client_msg->flags;
160 ip4_addr_copy(srvr_msg->giaddr, client_msg->giaddr);
161 if (memcpy_s(srvr_msg->chaddr, sizeof(srvr_msg->chaddr), client_msg->chaddr, DHCP_CHADDR_LEN) != EOK) {
190 LWIP_STATIC void add_client_entry(struct dhcps *dhcps, unsigned int idx, struct dhcp_msg *client_msg)
204 client_msg->chaddr, sizeof(client_msg->chaddr)) != EOK) {
230 LWIP_STATIC struct dyn_lease_addr *find_client_lease(struct dhcps *dhcps, struct dhcp_msg *client_msg)
235 if (memcmp(dhcps->leasearr[i].cli_hwaddr, client_msg->chaddr, client_msg->hlen) == 0) {
246 LWIP_STATIC ip4_addr_t validate_discover(struct dhcps *dhcps, struct dhcp_msg *client_msg,
293 add_client_entry(dhcps, (unsigned int)idx, client_msg);
336 struct dhcp_msg *client_msg, struct dyn_lease_addr *client_lease)
354 client_ip = validate_discover(dhcps, client_msg, &client_lease);
361 out_msg = dhcps_create_base_msg(client_msg);
399 if (client_msg->ciaddr.addr != 0) {
401 ip_addr_set_ip4_u32_val(dst_addr, (u32_t)(client_msg->ciaddr.addr));
405 else if (ntohs(client_msg->flags) & DHCP_BROADCAST_FLAG) {
414 if (memcpy_s(ethaddr.addr, ETHARP_HWADDR_LEN, client_msg->chaddr, client_msg->hlen) != EOK) {
451 LWIP_STATIC ip4_addr_t validate_request_message(struct netif *netif, struct dhcp_msg *client_msg,
464 if ((serverid.addr == 0) || (client_msg->ciaddr.addr != 0) ||
496 if (client_msg->ciaddr.addr != 0) {
507 if (client_msg->ciaddr.addr == 0) {
513 requested_ip.addr = ntohl(client_msg->ciaddr.addr);
528 LWIP_STATIC void handle_request(struct netif *netif, struct dhcps *dhcps, struct dhcp_msg *client_msg,
543 requested_ip = validate_request_message(netif, client_msg, client_lease, serverid);
550 out_msg = dhcps_create_base_msg(client_msg);
605 client_msg->flags |= htons(DHCP_BROADCAST_FLAG);
606 client_msg->ciaddr.addr = 0; /* This is done so that NAK Gets brcasted */
616 if (client_msg->ciaddr.addr != 0) {
618 ip_addr_set_ip4_u32_val(dst_addr, (u32_t)(client_msg->ciaddr.addr));
620 } else if (ntohs(client_msg->flags) & DHCP_BROADCAST_FLAG) {
626 if (memcpy_s(ethaddr.addr, ETHARP_HWADDR_LEN, client_msg->chaddr, client_msg->hlen) != EOK) {
659 LWIP_STATIC void handle_decline(struct netif *netif, struct dhcps *dhcps, struct dhcp_msg *client_msg,
665 (client_msg->ciaddr.addr == 0)) {
680 LWIP_STATIC void handle_inform(struct netif *netif, struct dhcps *dhcps, struct dhcp_msg *client_msg)
689 if (client_msg->ciaddr.addr == 0) {
694 out_msg = dhcps_create_base_msg(client_msg);
708 ("handle_inform: Send ACK to Client. Client is=%"U32_F"\n", client_msg->ciaddr.addr));
710 ip_addr_set_ip4_u32_val(dst_addr, client_msg->ciaddr.addr);
720 struct dhcp_msg *client_msg, ip4_addr_t serverid, u8_t msg_type)
724 client_lease = find_client_lease(dhcps, client_msg);
727 handle_discover(netif, dhcps, client_msg, client_lease);
730 handle_request(netif, dhcps, client_msg, client_lease, serverid);
733 handle_decline(netif, dhcps, client_msg, client_lease);
736 if ((client_lease != NULL) && (client_lease->cli_addr.addr == ntohl(client_msg->ciaddr.addr))) {
738 LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE, ("DHCP Release: Client IPAdd =%"U32_F"\n", client_msg->ciaddr.addr));
745 handle_inform(netif, dhcps, client_msg);
762 struct dhcp_msg *client_msg = (struct dhcp_msg *)p->payload;
767 if (client_msg == NULL) {
796 if (client_msg->op != DHCP_BOOTREQUEST) {
798 ("Not a DHCP reply message, Type %"U16_F"\n", (u16_t)client_msg->op));
802 if (client_msg->cookie != PP_HTONL(DHCP_MAGIC_COOKIE)) {
804 ("DHCP Server. Cookie Value is incorrect. %"U32_F"\n", (u32_t)client_msg->cookie));
808 if (client_msg->hlen != ETHARP_HWADDR_LEN) {
810 ("DHCP Server. Invalid hardware address length %"U16_F"\n", (u16_t)client_msg->hlen));
851 handle_client_messages(netif, dhcps, client_msg, serverid, msg_type);