Ignore:
Timestamp:
Feb 20, 2016, 10:43:32 PM (8 years ago)
Author:
coas-nagasima
Message:

インクルードのパス指定をContikiに合わせ変更。
整数型の型名をContikiに合わせ変更。

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uKadecot/trunk/uip/apps/dhcpc/dhcpc.c

    r125 r158  
    3535#include <string.h>
    3636
    37 #include "uip.h"
    38 #include "dhcpc.h"
    39 #include "timer.h"
    40 #include "pt.h"
     37#include "net/ip/uip.h"
     38#include "dhcpc/dhcpc.h"
     39#include "sys/timer.h"
     40#include "sys/pt.h"
    4141
    4242#define STATE_INITIAL         0
     
    5353
    5454struct dhcp_msg {
    55   u8_t op, htype, hlen, hops;
    56   u8_t xid[4];
    57   u16_t secs, flags;
    58   u8_t ciaddr[4];
    59   u8_t yiaddr[4];
    60   u8_t siaddr[4];
    61   u8_t giaddr[4];
    62   u8_t chaddr[16];
     55  uint8_t op, htype, hlen, hops;
     56  uint8_t xid[4];
     57  uint16_t secs, flags;
     58  uint8_t ciaddr[4];
     59  uint8_t yiaddr[4];
     60  uint8_t siaddr[4];
     61  uint8_t giaddr[4];
     62  uint8_t chaddr[16];
    6363#ifndef UIP_CONF_DHCP_LIGHT
    64   u8_t sname[64];
    65   u8_t file[128];
    66 #endif
    67   u8_t options[312];
     64  uint8_t sname[64];
     65  uint8_t file[128];
     66#endif
     67  uint8_t options[312];
    6868};
    6969
     
    103103#define DHCP_OPTION_END         255
    104104
    105 static const u8_t xid[4] = {0xad, 0xde, 0x12, 0x23};
    106 static const u8_t magic_cookie[4] = {99, 130, 83, 99};
    107 /*---------------------------------------------------------------------------*/
    108 static u8_t *
    109 add_msg_type(u8_t *optptr, u8_t type)
     105static const uint8_t xid[4] = {0xad, 0xde, 0x12, 0x23};
     106static const uint8_t magic_cookie[4] = {99, 130, 83, 99};
     107/*---------------------------------------------------------------------------*/
     108static uint8_t *
     109add_msg_type(uint8_t *optptr, uint8_t type)
    110110{
    111111  *optptr++ = DHCP_OPTION_MSG_TYPE;
     
    115115}
    116116/*---------------------------------------------------------------------------*/
    117 static u8_t *
    118 add_server_id(struct dhcpc_state *s, u8_t *optptr)
     117static uint8_t *
     118add_server_id(struct dhcpc_state *s, uint8_t *optptr)
    119119{
    120120  *optptr++ = DHCP_OPTION_SERVER_ID;
     
    124124}
    125125/*---------------------------------------------------------------------------*/
    126 static u8_t *
    127 add_req_ipaddr(struct dhcpc_state *s, u8_t *optptr)
     126static uint8_t *
     127add_req_ipaddr(struct dhcpc_state *s, uint8_t *optptr)
    128128{
    129129  *optptr++ = DHCP_OPTION_REQ_IPADDR;
     
    133133}
    134134/*---------------------------------------------------------------------------*/
    135 static u8_t *
    136 add_req_options(u8_t *optptr)
     135static uint8_t *
     136add_req_options(uint8_t *optptr)
    137137{
    138138  *optptr++ = DHCP_OPTION_REQ_LIST;
     
    144144}
    145145/*---------------------------------------------------------------------------*/
    146 static u8_t *
    147 add_end(u8_t *optptr)
     146static uint8_t *
     147add_end(uint8_t *optptr)
    148148{
    149149  *optptr++ = DHCP_OPTION_END;
     
    179179send_discover(struct dhcpc_state *s)
    180180{
    181   u8_t *end;
     181  uint8_t *end;
    182182  struct dhcp_msg *m = (struct dhcp_msg *)uip_appdata;
    183183
     
    188188  end = add_end(end);
    189189
    190   uip_send(uip_appdata, end - (u8_t *)uip_appdata);
     190  uip_send(uip_appdata, end - (uint8_t *)uip_appdata);
    191191}
    192192/*---------------------------------------------------------------------------*/
     
    194194send_request(struct dhcpc_state *s)
    195195{
    196   u8_t *end;
     196  uint8_t *end;
    197197  struct dhcp_msg *m = (struct dhcp_msg *)uip_appdata;
    198198
     
    204204  end = add_end(end);
    205205
    206   uip_send(uip_appdata, end - (u8_t *)uip_appdata);
    207 }
    208 /*---------------------------------------------------------------------------*/
    209 static u8_t
    210 parse_options(struct dhcpc_state *s, u8_t *optptr, int len)
    211 {
    212   u8_t *end = optptr + len;
    213   u8_t type = 0;
     206  uip_send(uip_appdata, end - (uint8_t *)uip_appdata);
     207}
     208/*---------------------------------------------------------------------------*/
     209static uint8_t
     210parse_options(struct dhcpc_state *s, uint8_t *optptr, int len)
     211{
     212  uint8_t *end = optptr + len;
     213  uint8_t type = 0;
    214214
    215215  while(optptr < end) {
     
    242242}
    243243/*---------------------------------------------------------------------------*/
    244 static u8_t
     244static uint8_t
    245245parse_msg(struct dhcpc_state *s)
    246246{
     
    386386dhcpc_request(struct dhcpc_state *s)
    387387{
    388   u16_t ipaddr[2];
     388  uint16_t ipaddr[2];
    389389
    390390  s->state = STATE_REQUEST;
Note: See TracChangeset for help on using the changeset viewer.