/*---------------------------------------------------------------------------*/ static void send_discover(void) { uint8_t *end; struct dhcp_msg *m = (struct dhcp_msg *)uip_appdata; create_msg(m); end = add_msg_type(&m->options[4], DHCPDISCOVER); end = add_req_options(end); end = add_end(end); uip_send(uip_appdata, end - (uint8_t *)uip_appdata); }
static void send_discover(void) { uint8_t *end; struct dhcp_msg *m = (struct dhcp_msg *)&dhcp_msg_buf; create_msg(m); end = add_msg_type(&m->options[4], DHCPDISCOVER); end = add_req_options(end); end = add_end(end); uosFileWrite(s.conn, (void*)m, end - (uint8_t*)m); }
/* Prepare DHCPv4 Discover message and broadcast it */ static void send_discover(struct net_if *iface) { struct net_buf *buf; iface->dhcpv4.xid++; buf = prepare_message(iface, DHCPV4_MSG_TYPE_DISCOVER); if (!buf) { goto fail; } if (!add_req_options(buf) || !add_end(buf)) { goto fail; } setup_header(buf); if (net_send_data(buf) < 0) { goto fail; } iface->dhcpv4.state = NET_DHCPV4_DISCOVER; k_delayed_work_init(&iface->dhcpv4_timeout, dhcpv4_timeout); k_delayed_work_submit(&iface->dhcpv4_timeout, get_dhcpv4_timeout()); return; fail: NET_DBG("Message preparation failed"); if (!buf) { net_nbuf_unref(buf); } }