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/net/ip/uip.h

    r157 r158  
    5454#define __UIP_H__
    5555
    56 #include "uipopt.h"
     56#include "net/ip/uipopt.h"
    5757
    5858/**
     
    6060 *
    6161 */
    62 typedef u16_t uip_ip4addr_t[2];
    63 typedef u16_t uip_ip6addr_t[8];
     62typedef uint16_t uip_ip4addr_t[2];
     63typedef uint16_t uip_ip6addr_t[8];
    6464#if UIP_CONF_IPV6
    6565typedef uip_ip6addr_t uip_ipaddr_t;
     
    193193 * This function may be used at boot time to set the initial ip_id.
    194194 */
    195 void uip_setipid(u16_t id);
     195void uip_setipid(uint16_t id);
    196196
    197197/** @} */
     
    421421 */
    422422#if 0
    423 extern u8_t uip_buf[UIP_BUFSIZE+2];
     423extern uint8_t uip_buf[UIP_BUFSIZE+2];
    424424#else
    425 extern u8_t *uip_buf;
     425extern uint8_t *uip_buf;
    426426#endif
    427427
     
    452452 * \param port A 16-bit port number in network byte order.
    453453 */
    454 void uip_listen(u16_t port);
     454void uip_listen(uint16_t port);
    455455
    456456/**
     
    466466 * \param port A 16-bit port number in network byte order.
    467467 */
    468 void uip_unlisten(u16_t port);
     468void uip_unlisten(uint16_t port);
    469469
    470470/**
     
    500500 *
    501501 */
    502 struct uip_conn *uip_connect(uip_ipaddr_t *ripaddr, u16_t port);
     502struct uip_conn *uip_connect(uip_ipaddr_t *ripaddr, uint16_t port);
    503503
    504504
     
    768768 * if no connection could be allocated.
    769769 */
    770 struct uip_udp_conn *uip_udp_new(uip_ipaddr_t *ripaddr, u16_t rport);
     770struct uip_udp_conn *uip_udp_new(uip_ipaddr_t *ripaddr, uint16_t rport);
    771771
    772772/**
     
    843843 */
    844844#define uip_ipaddr(addr, addr0,addr1,addr2,addr3) do { \
    845                      ((u16_t *)(addr))[0] = HTONS(((addr0) << 8) | (addr1)); \
    846                      ((u16_t *)(addr))[1] = HTONS(((addr2) << 8) | (addr3)); \
     845                     ((uint16_t *)(addr))[0] = HTONS(((addr0) << 8) | (addr1)); \
     846                     ((uint16_t *)(addr))[1] = HTONS(((addr2) << 8) | (addr3)); \
    847847                  } while(0)
    848848
     
    855855 */
    856856#define uip_ip6addr(addr, addr0,addr1,addr2,addr3,addr4,addr5,addr6,addr7) do { \
    857                      ((u16_t *)(addr))[0] = HTONS((addr0)); \
    858                      ((u16_t *)(addr))[1] = HTONS((addr1)); \
    859                      ((u16_t *)(addr))[2] = HTONS((addr2)); \
    860                      ((u16_t *)(addr))[3] = HTONS((addr3)); \
    861                      ((u16_t *)(addr))[4] = HTONS((addr4)); \
    862                      ((u16_t *)(addr))[5] = HTONS((addr5)); \
    863                      ((u16_t *)(addr))[6] = HTONS((addr6)); \
    864                      ((u16_t *)(addr))[7] = HTONS((addr7)); \
     857                     ((uint16_t *)(addr))[0] = HTONS((addr0)); \
     858                     ((uint16_t *)(addr))[1] = HTONS((addr1)); \
     859                     ((uint16_t *)(addr))[2] = HTONS((addr2)); \
     860                     ((uint16_t *)(addr))[3] = HTONS((addr3)); \
     861                     ((uint16_t *)(addr))[4] = HTONS((addr4)); \
     862                     ((uint16_t *)(addr))[5] = HTONS((addr5)); \
     863                     ((uint16_t *)(addr))[6] = HTONS((addr6)); \
     864                     ((uint16_t *)(addr))[7] = HTONS((addr7)); \
    865865                  } while(0)
    866866
     
    885885#if !UIP_CONF_IPV6
    886886#define uip_ipaddr_copy(dest, src) do { \
    887                      ((u16_t *)dest)[0] = ((u16_t *)src)[0]; \
    888                      ((u16_t *)dest)[1] = ((u16_t *)src)[1]; \
     887                     ((uint16_t *)dest)[0] = ((uint16_t *)src)[0]; \
     888                     ((uint16_t *)dest)[1] = ((uint16_t *)src)[1]; \
    889889                  } while(0)
    890890#else /* !UIP_CONF_IPV6 */
     
    913913 */
    914914#if !UIP_CONF_IPV6
    915 #define uip_ipaddr_cmp(addr1, addr2) (((u16_t *)addr1)[0] == ((u16_t *)addr2)[0] && \
    916                                       ((u16_t *)addr1)[1] == ((u16_t *)addr2)[1])
     915#define uip_ipaddr_cmp(addr1, addr2) (((uint16_t *)addr1)[0] == ((uint16_t *)addr2)[0] && \
     916                                      ((uint16_t *)addr1)[1] == ((uint16_t *)addr2)[1])
    917917#else /* !UIP_CONF_IPV6 */
    918918#define uip_ipaddr_cmp(addr1, addr2) (memcmp(addr1, addr2, sizeof(uip_ip6addr_t)) == 0)
     
    944944 */
    945945#define uip_ipaddr_maskcmp(addr1, addr2, mask) \
    946                           (((((u16_t *)addr1)[0] & ((u16_t *)mask)[0]) == \
    947                             (((u16_t *)addr2)[0] & ((u16_t *)mask)[0])) && \
    948                            ((((u16_t *)addr1)[1] & ((u16_t *)mask)[1]) == \
    949                             (((u16_t *)addr2)[1] & ((u16_t *)mask)[1])))
     946                          (((((uint16_t *)addr1)[0] & ((uint16_t *)mask)[0]) == \
     947                            (((uint16_t *)addr2)[0] & ((uint16_t *)mask)[0])) && \
     948                           ((((uint16_t *)addr1)[1] & ((uint16_t *)mask)[1]) == \
     949                            (((uint16_t *)addr2)[1] & ((uint16_t *)mask)[1])))
    950950
    951951
     
    975975 */
    976976#define uip_ipaddr_mask(dest, src, mask) do { \
    977                      ((u16_t *)dest)[0] = ((u16_t *)src)[0] & ((u16_t *)mask)[0]; \
    978                      ((u16_t *)dest)[1] = ((u16_t *)src)[1] & ((u16_t *)mask)[1]; \
     977                     ((uint16_t *)dest)[0] = ((uint16_t *)src)[0] & ((uint16_t *)mask)[0]; \
     978                     ((uint16_t *)dest)[1] = ((uint16_t *)src)[1] & ((uint16_t *)mask)[1]; \
    979979                  } while(0)
    980980
     
    987987 \code
    988988 uip_ipaddr_t ipaddr;
    989  u8_t octet;
     989 uint8_t octet;
    990990
    991991 uip_ipaddr(&ipaddr, 1,2,3,4);
     
    997997 * \hideinitializer
    998998 */
    999 #define uip_ipaddr1(addr) (htons(((u16_t *)(addr))[0]) >> 8)
     999#define uip_ipaddr1(addr) (htons(((uint16_t *)(addr))[0]) >> 8)
    10001000
    10011001/**
     
    10071007 \code
    10081008 uip_ipaddr_t ipaddr;
    1009  u8_t octet;
     1009 uint8_t octet;
    10101010
    10111011 uip_ipaddr(&ipaddr, 1,2,3,4);
     
    10171017 * \hideinitializer
    10181018 */
    1019 #define uip_ipaddr2(addr) (htons(((u16_t *)(addr))[0]) & 0xff)
     1019#define uip_ipaddr2(addr) (htons(((uint16_t *)(addr))[0]) & 0xff)
    10201020
    10211021/**
     
    10271027 \code
    10281028 uip_ipaddr_t ipaddr;
    1029  u8_t octet;
     1029 uint8_t octet;
    10301030
    10311031 uip_ipaddr(&ipaddr, 1,2,3,4);
     
    10371037 * \hideinitializer
    10381038 */
    1039 #define uip_ipaddr3(addr) (htons(((u16_t *)(addr))[1]) >> 8)
     1039#define uip_ipaddr3(addr) (htons(((uint16_t *)(addr))[1]) >> 8)
    10401040
    10411041/**
     
    10471047 \code
    10481048 uip_ipaddr_t ipaddr;
    1049  u8_t octet;
     1049 uint8_t octet;
    10501050
    10511051 uip_ipaddr(&ipaddr, 1,2,3,4);
     
    10571057 * \hideinitializer
    10581058 */
    1059 #define uip_ipaddr4(addr) (htons(((u16_t *)(addr))[1]) & 0xff)
     1059#define uip_ipaddr4(addr) (htons(((uint16_t *)(addr))[1]) & 0xff)
    10601060
    10611061/**
     
    10721072#      define HTONS(n) (n)
    10731073#   else /* UIP_BYTE_ORDER == UIP_BIG_ENDIAN */
    1074 #      define HTONS(n) (u16_t)((((u16_t) (n)) << 8) | (((u16_t) (n)) >> 8))
     1074#      define HTONS(n) (uint16_t)((((uint16_t) (n)) << 8) | (((uint16_t) (n)) >> 8))
    10751075#   endif /* UIP_BYTE_ORDER == UIP_BIG_ENDIAN */
    10761076#else
     
    10861086 */
    10871087#ifndef htons
    1088 u16_t htons(u16_t val);
     1088uint16_t htons(uint16_t val);
    10891089#endif /* htons */
    10901090#ifndef ntohs
     
    11041104
    11051105#if UIP_URGDATA > 0
    1106 /* u8_t *uip_urgdata:
     1106/* uint8_t *uip_urgdata:
    11071107 *
    11081108 * This pointer points to any urgent data that has been received. Only
     
    11361136 *
    11371137 */
    1138 extern u16_t uip_len;
     1138extern uint16_t uip_len;
    11391139
    11401140/** @} */
    11411141
    11421142#if UIP_URGDATA > 0
    1143 extern u16_t uip_urglen, uip_surglen;
     1143extern uint16_t uip_urglen, uip_surglen;
    11441144#endif /* UIP_URGDATA > 0 */
    11451145
     
    11581158  uip_ipaddr_t ripaddr;   /**< The IP address of the remote host. */
    11591159
    1160   u16_t lport;        /**< The local TCP port, in network byte order. */
    1161   u16_t rport;        /**< The local remote TCP port, in network byte
     1160  uint16_t lport;        /**< The local TCP port, in network byte order. */
     1161  uint16_t rport;        /**< The local remote TCP port, in network byte
    11621162                         order. */
    11631163
    1164   u8_t rcv_nxt[4];    /**< The sequence number that we expect to
     1164  uint8_t rcv_nxt[4];    /**< The sequence number that we expect to
    11651165                         receive next. */
    1166   u8_t snd_nxt[4];    /**< The sequence number that was last sent by
     1166  uint8_t snd_nxt[4];    /**< The sequence number that was last sent by
    11671167                         us. */
    1168   u16_t len;          /**< Length of the data that was previously sent. */
    1169   u16_t mss;          /**< Current maximum segment size for the
     1168  uint16_t len;          /**< Length of the data that was previously sent. */
     1169  uint16_t mss;          /**< Current maximum segment size for the
    11701170                         connection. */
    1171   u16_t initialmss;   /**< Initial maximum segment size for the
     1171  uint16_t initialmss;   /**< Initial maximum segment size for the
    11721172                         connection. */
    1173   u8_t sa;            /**< Retransmission time-out calculation state
     1173  uint8_t sa;            /**< Retransmission time-out calculation state
    11741174                         variable. */
    1175   u8_t sv;            /**< Retransmission time-out calculation state
     1175  uint8_t sv;            /**< Retransmission time-out calculation state
    11761176                         variable. */
    1177   u8_t rto;           /**< Retransmission time-out. */
    1178   u8_t tcpstateflags; /**< TCP state and flags. */
    1179   u8_t timer;         /**< The retransmission timer. */
    1180   u8_t nrtx;          /**< The number of retransmissions for the last
     1177  uint8_t rto;           /**< Retransmission time-out. */
     1178  uint8_t tcpstateflags; /**< TCP state and flags. */
     1179  uint8_t timer;         /**< The retransmission timer. */
     1180  uint8_t nrtx;          /**< The number of retransmissions for the last
    11811181                         segment sent. */
    11821182
     
    12031203 * 4-byte array used for the 32-bit sequence number calculations.
    12041204 */
    1205 extern u8_t uip_acc32[4];
     1205extern uint8_t uip_acc32[4];
    12061206
    12071207/** @} */
     
    12141214struct uip_udp_conn {
    12151215  uip_ipaddr_t ripaddr;   /**< The IP address of the remote peer. */
    1216   u16_t lport;        /**< The local port number in network byte order. */
    1217   u16_t rport;        /**< The remote port number in network byte order. */
    1218   u8_t  ttl;          /**< Default time-to-live. */
     1216  uint16_t lport;        /**< The local port number in network byte order. */
     1217  uint16_t rport;        /**< The remote port number in network byte order. */
     1218  uint8_t  ttl;          /**< Default time-to-live. */
    12191219
    12201220  /** The application state. */
     
    13011301 */
    13021302/*---------------------------------------------------------------------------*/
    1303 /* u8_t uip_flags:
     1303/* uint8_t uip_flags:
    13041304 *
    13051305 * When the application is called, uip_flags will contain the flags
     
    13071307 * infomation.
    13081308 */
    1309 extern u8_t uip_flags;
     1309extern uint8_t uip_flags;
    13101310
    13111311/* The following flags may be set in the global variable uip_flags
     
    13491349 * The actual uIP function which does all the work.
    13501350 */
    1351 void uip_process(u8_t flag);
     1351void uip_process(uint8_t flag);
    13521352
    13531353/* The following flags are passed as an argument to the uip_process()
     
    13971397#if UIP_CONF_IPV6
    13981398  /* IPv6 header. */
    1399   u8_t vtc,
     1399  uint8_t vtc,
    14001400    tcflow;
    1401   u16_t flow;
    1402   u8_t len[2];
    1403   u8_t proto, ttl;
     1401  uint16_t flow;
     1402  uint8_t len[2];
     1403  uint8_t proto, ttl;
    14041404  uip_ip6addr_t srcipaddr, destipaddr;
    14051405#else /* UIP_CONF_IPV6 */
    14061406  /* IPv4 header. */
    1407   u8_t vhl,
     1407  uint8_t vhl,
    14081408    tos,
    14091409    len[2],
     
    14121412    ttl,
    14131413    proto;
    1414   u16_t ipchksum;
    1415   u16_t srcipaddr[2],
     1414  uint16_t ipchksum;
     1415  uint16_t srcipaddr[2],
    14161416    destipaddr[2];
    14171417#endif /* UIP_CONF_IPV6 */
    14181418
    14191419  /* TCP header. */
    1420   u16_t srcport,
     1420  uint16_t srcport,
    14211421    destport;
    1422   u8_t seqno[4],
     1422  uint8_t seqno[4],
    14231423    ackno[4],
    14241424    tcpoffset,
    14251425    flags,
    14261426    wnd[2];
    1427   u16_t tcpchksum;
    1428   u8_t urgp[2];
    1429   u8_t optdata[4];
     1427  uint16_t tcpchksum;
     1428  uint8_t urgp[2];
     1429  uint8_t optdata[4];
    14301430};
    14311431
     
    14341434#if UIP_CONF_IPV6
    14351435  /* IPv6 header. */
    1436   u8_t vtc,
     1436  uint8_t vtc,
    14371437    tcf;
    1438   u16_t flow;
    1439   u8_t len[2];
    1440   u8_t proto, ttl;
     1438  uint16_t flow;
     1439  uint8_t len[2];
     1440  uint8_t proto, ttl;
    14411441  uip_ip6addr_t srcipaddr, destipaddr;
    14421442#else /* UIP_CONF_IPV6 */
    14431443  /* IPv4 header. */
    1444   u8_t vhl,
     1444  uint8_t vhl,
    14451445    tos,
    14461446    len[2],
     
    14491449    ttl,
    14501450    proto;
    1451   u16_t ipchksum;
    1452   u16_t srcipaddr[2],
     1451  uint16_t ipchksum;
     1452  uint16_t srcipaddr[2],
    14531453    destipaddr[2];
    14541454#endif /* UIP_CONF_IPV6 */
    14551455
    14561456  /* ICMP (echo) header. */
    1457   u8_t type, icode;
    1458   u16_t icmpchksum;
     1457  uint8_t type, icode;
     1458  uint16_t icmpchksum;
    14591459#if !UIP_CONF_IPV6
    1460   u16_t id, seqno;
     1460  uint16_t id, seqno;
    14611461#else /* !UIP_CONF_IPV6 */
    1462   u8_t flags, reserved1, reserved2, reserved3;
    1463   u8_t icmp6data[16];
    1464   u8_t options[1];
     1462  uint8_t flags, reserved1, reserved2, reserved3;
     1463  uint8_t icmp6data[16];
     1464  uint8_t options[1];
    14651465#endif /* !UIP_CONF_IPV6 */
    14661466};
     
    14711471#if UIP_CONF_IPV6
    14721472  /* IPv6 header. */
    1473   u8_t vtc,
     1473  uint8_t vtc,
    14741474    tcf;
    1475   u16_t flow;
    1476   u8_t len[2];
    1477   u8_t proto, ttl;
     1475  uint16_t flow;
     1476  uint8_t len[2];
     1477  uint8_t proto, ttl;
    14781478  uip_ip6addr_t srcipaddr, destipaddr;
    14791479#else /* UIP_CONF_IPV6 */
    14801480  /* IP header. */
    1481   u8_t vhl,
     1481  uint8_t vhl,
    14821482    tos,
    14831483    len[2],
     
    14861486    ttl,
    14871487    proto;
    1488   u16_t ipchksum;
    1489   u16_t srcipaddr[2],
     1488  uint16_t ipchksum;
     1489  uint16_t srcipaddr[2],
    14901490    destipaddr[2];
    14911491#endif /* UIP_CONF_IPV6 */
    14921492
    14931493  /* UDP header. */
    1494   u16_t srcport,
     1494  uint16_t srcport,
    14951495    destport;
    1496   u16_t udplen;
    1497   u16_t udpchksum;
     1496  uint16_t udplen;
     1497  uint16_t udpchksum;
    14981498};
    14991499
     
    15551555 */
    15561556struct uip_eth_addr {
    1557   u8_t addr[6];
     1557  uint8_t addr[6];
    15581558};
    15591559
     
    15741574 * \return The Internet checksum of the buffer.
    15751575 */
    1576 u16_t uip_chksum(u16_t *buf, u16_t len);
     1576uint16_t uip_chksum(uint16_t *buf, uint16_t len);
    15771577
    15781578/**
     
    15851585 * buffer.
    15861586 */
    1587 u16_t uip_ipchksum(void);
     1587uint16_t uip_ipchksum(void);
    15881588
    15891589/**
     
    15961596 * to by uip_appdata.
    15971597 */
    1598 u16_t uip_tcpchksum(void);
     1598uint16_t uip_tcpchksum(void);
    15991599
    16001600/**
     
    16071607 * to by uip_appdata.
    16081608 */
    1609 u16_t uip_udpchksum(void);
     1609uint16_t uip_udpchksum(void);
    16101610
    16111611
Note: See TracChangeset for help on using the changeset viewer.