           TOPPERS/JSP  TCP/IP ץȥ륹å (TINET)
                       ꡼ 1.1 [2004/2/16]

1.  TOPPERS/JSP  TCP/IP ץȥ륹å (TINET)

  ITRON 4.0 ɥץե򥵥ݡȤ TOPPERS/JSP Ѥ
TCP/IP ץȥ륹åǤꡢITRON TCP/IP API ͤɸൡǽ򥵥ݡ
ȤƤ롣
  ߡưǧƤ륷ƥʲ˼ 

   [1]   Ż̾ H8/3048F
   [2]   Ż̾ H8/3068F ͥåб
   [3]   Ż̾ H8/3069F ͥåб

  ߡ ݡȤƤͥåȥ󥿥եʲ˼ 

   [1]   롼ץХå
   [2]   ꥢݡȤѤ PPP ǡľ³ȥǥ³
   [3]   ͥåȡNIC  NE2000 ߴ

ʤܼ TCP/IP ץȥ륹åǤϡ嵭Υͥåȥ
եΤȤ߹ळȤǤ˥åȿ 1 Ǥ롣 
  ʲ˥꡼ 1.1 Ҥ٤롣

   [1]   TOPPERS/JSP ͥΥ꡼ 1.4 ѤǤ롣
   [2]   Υ֥å󥰥ˤơ ̿ü¾Τᡢû
         ֤Ǥ뤬֥å뤳Ȥ롣 
   [3]   ץȥ륹åǡ TCP ΥɥХåեݤ뵡ǽ
         ʤᡢŪ API  TCP ̿üˤơ 
         ɥХåեƬɥ쥹Ȥ NADR Ǥʤ

2.  ǥ쥯ȥ깽

  TOPPERS/JSP  TCP/IP ץȥ륹å (TINET) Υǥ쥯ȥϡ
JSP 롼ȥǥ쥯ȥβ֤ȤꤷƤꡢʲΥǥ쥯ȥ
鹽Ƥ롣

   tinet               TINET Υ롼ȥǥ쥯ȥ
   tinet/cfg           TINET ե졼
   tinet/doc           ɥ
   tinet/net           ѥͥåȥ
   tinet/netapp        ץΥͥåȥץ
   tinet/netdev        ͥåȥ󥿥եΥɥ饤
   tinet/netdev/if_ed  NE2000 ߴͥåȥ󥿥եΥɥ饤
   tinet/netinet       TINET 

3.  ɥ

  ɥʲ˼

   tinet.txt               Υե
   tinet_install.txt       󥹥ȡ
   tinet_config.txt        ѥե졼
   tinet_defs.txt          ץåƥ¸
   tinet_sample.txt        ץ륢ץꥱ
   tinet_chg.txt           ѹ

4.  եκˤĤ

  ץꥱץ¾ˡ ѹ٤ե
TINET ե졼եʲ˼  JSP 롼
ȥǥ쥯ȥ꤫ХѥǤꡢMakefile ޥΰ̣ʲ˼

   $(CPU)          å CPU
   $(SYS)          åȥƥ
   $(NIC)          ͥåȥ󥿥ե
   $(APP_DIR)      ץꥱץΥǥ쥯ȥ
   $(UNAME)        ץꥱץ̾

   (1)   config/$(CPU)/tinet_cpu_config.hڿ
         ץå˰¸ TINET ե졼󡦥ѥ᡼
         եǤ롣 ƤˤĤƤ tinet_config.txt 
         Ȥ뤳ȡ

   (2)   config/$(CPU)/$(SYS)/tinet_sys_config.hڿ
         ƥ˰¸ TINET ե졼󡦥ѥ᡼
         եǤ롣 ƤˤĤƤ tinet_config.txt 
         Ȥ뤳ȡ

   (3)   $(APP_DIR)/tinet_app_config.hڿ
         ץꥱ˰¸ TINET ե졼󡦥ѥ
         ᡼եǤ롣 ƤˤĤƤ
         tinet_config.txt 򻲾Ȥ뤳ȡ

   (4)   /tinet/netdev/$(NIC)/tinet_nic_config.hڿ
         ͥåȥ󥿥ե˰¸ TINET ե졼
         󡦥ѥ᡼եǤ롣 

   (5)   config/$(CPU)/tinet_cpu_defs.hڿ
         ץå˰¸ TCP/IP ѥ᡼եǤ
         롣ƤˤĤƤ tinet_defs.txt 򻲾Ȥ뤳ȡ

   (6)   /tinet/netdev/$(NIC)/tinet_nic_defs.hڿ
         ͥåȥ󥿥ե˰¸ TCP/IP ѥ᡼
         եǤ롣

   (7)   $(APP_DIR)/tinet_$(UNAME).cfgڿ
         TINET ե졼եǤ롣 ƤˤĤƤ
         5. TINET ե졼 TINET ե졼ե
          פ򻲾Ȥ뤳ȡ 

   (8)   $(APP_DIR)/route_cfg.cڿ
         Ū롼ƥ󥰤ꤹեǤ롣 ƤˤĤƤϡ6.
         Ū롼ƥե פ򻲾Ȥ뤳ȡ 

   (9)   $(APP_DIR)/$(UNAME).cѹ
         TINET Ѥ뤿ˡ ʲΥ󥯥롼ɥեꤹ
         ɬפ롣

            #include "tinet_id.h"
            #include <netinet/in.h>
            #include <netinet/in_itron.h>

   (10)  $(APP_DIR)/$(UNAME).cfgѹ
         TINET ǻѤ륫ͥ륪֥Ȥिˡ
         TINET ե졼ե򥤥󥯥롼ɤ롣

            #include "../tinet/tinet.cfg"

   (11)  $(APP_DIR)/Makefileѹ
         ѹˤĤƤϡ7. ץꥱ Makefileפ򻲾Ȥ뤳
         ȡ

   (12)  $(APP_DIR)/tinet_cfg.cڼư
         TCP ոTCP ̿üڤ UDP ̿üб빽¤Τ
         եǡ TINET ե졼ˤ롣
         ץꥱץࡢ TINET ȶ˥ѥ뤷ƥ
         롣

   (13)  $(APP_DIR)/tinet_kern.cfgڼư
         TINET ǻѤ륫ͥ륪֥ȤŪ API 
         եǡTINET ե졼ˤ롣 JSP 
         ƥॳե졼ե (ɸǤ
         $(UNAME).cfg) ˥󥯥롼ɤ롣

   (14)  $(APP_DIR)/tinet_id.hڼư
         TCP ոTCP ̿üڤ UDP ̿ü ID ưշ
         եǡTINET ե졼ˤ롣

5.  TINET ե졼 TINET ե졼ե

  TINET ե졼 tinet/cfg/tinet_cfg (cygwin Ǥ
tinet_cfg.exe) Ǥꡢ åȤˤϰ¸ƤʤTINET ե
졼ˤĤƤ tinet_install.txt 򻲾Ȥ뤳ȡ

5. 1  ե

  TINET ե졼 TINET ե졼ե (ɸ
 tinet_$(UNAME).cfg) ʲΥե롣

   (1)   tinet_cfg.c
         TINET ͥ빽եǡ ץꥱץࡢ
         TINET ȶ˥ѥ뤷ƥ󥯤롣

   (2)   tinet_kern.cfg
         TINET ǻѤ륫ͥ륪֥ȤŪ API 졢
         JSP ƥॳե졼ե (ɸ
         $(UNAME).cfg) ˥󥯥롼ɤ롣

   (3)   tinet_id.h
         TINET ǻѤ륫ͥ륪֥Ȥ ID ưշ̥ե
         Ǥ롣

5. 2  ݡȤ륪֥Ȥ

  ݡȤ륪֥Ȥϡʲ˼ ITRON TCP/IP API ͤ
Ū API ȡեΥ󥯥롼ɤǤ롣

   (1)   TCP ո

         [1]   

                  TCP_CRE_REP(ID repid, { ATR repatr,
                                          { UW myipaddr, UH myportno } } );

         [2]   ѥ᡼
               ѥ᡼ˤĤƤϡITRON TCP/IP API ͤƱǤꡢ
               ¸ TCP ո°Ϥʤ
         [3]   TCP ո
               TINET ե졼ϡ TCP ոץ
               ץåǥ쥯ƥ֤ tinet_cfg.c 롣

                  #define TNUM_TCP_CREPID <TCPո>

         [4]    TCP ո ID ѿ
               TINET ե졼ϡ TCP ո ID ѿ
                tinet_cfg.c 롣

                  const ID tmax_tcp_crepid =
                           (TMIN_TCP_CREPID + TNUM_TCP_CREPID - 1);

   (2)   TCP ̿ü

         [1]   

                  TCP_CRE_CEP(ID cepid, { ATR cepatr, VP sbuf, INT sbufsz,
                                                      VP rbuf, INT rbufsz,
                                                      FP callback } );

         [2]   ѥ᡼
               ѥ᡼ˤĤƤϡITRON TCP/IP API ͤƱǤꡢ
               ¸ TCP ̿ü°Ϥʤ
         [3]   TCP ̿ü
               TINET ե졼ϡ TCP ̿ü
               ץåǥ쥯ƥ֤ tinet_cfg.c 롣

                  #define TNUM_TCP_CCEPID <TCP̿ü>

         [4]    TCP ̿ü ID ѿ
               TINET ե졼ϡ TCP ̿ü ID 
                tinet_cfg.c 롣

                  const ID tmax_tcp_ccepid =
                           (TMIN_TCP_CCEPID + TNUM_TCP_CCEPID - 1);

   (3)   UDP ̿ü

         [1]   

                  UDP_CRE_CEP(ID cepid, { ATR cepatr,
                                          { UW myipaddr, UH myportno },
                                          FP callback } );

         [2]   ѥ᡼
               ѥ᡼ˤĤƤϡITRON UDP/IP API ͤƱǤꡢ
               ¸ UDP ̿ü°Ϥʤ
         [3]   UDP ̿ü
               TINET ե졼ϡ UDP ̿ü
               ץåǥ쥯ƥ֤ tinet_cfg.c 롣

                  #define TNUM_UDP_CCEPID <UDP̿ü>

         [4]    UDP ̿ü ID ѿ
               TINET ե졼ϡ UDP ̿ü ID 
                tinet_cfg.c 롣

                  const ID tmax_tcp_ccepid =
                           (TMIN_UDP_CCEPID + TNUM_UDP_CCEPID - 1);

   (4)   󥯥롼ɥե
         JSP Υ󥯥롼ɥեƱǤ롣

5. 3  TINETͥ빽ե

  ߤΤȤ¸ط鼫ưŪ褦ˤϤʤäƤʤ
ᡢ TINET ե졼ե (ɸ tinet_$(UNAME).cfg)
ѹϡ ʲΥޥɤ TINET ͥ빽ե
롣

   make tinet

θ塢

   make depend
   make

¹Ԥ롣

6.  Ū롼ƥե

  IP Ū롼ƥ󥰤ꤹեǤ롣

   (1)   󥯥롼ɥե
           ʲΥ󥯥롼ɥեꤹ뤳ȡ 

            #include <t_services.h>
            #include <tinet_defs.h>
            #include <tinet_config.h>
            #include <net/route.h>

   (2)   롼ƥɽȥ
           ʲΤ褦˻ꤹ뤳ȡ

            T_RT_ENTRY routing_tbl[NUM_ROUTE_ENTRY] = {
                <롼ƥɽȥ깽¤ 1>,
                <롼ƥɽȥ깽¤ 2>,
                ...
                <롼ƥɽȥ깽¤ n>,
                };

   (3)   롼ƥɽȥ깽¤
           #include <net/route.h> Ƥ롣ƥեɤΰ̣
         ʲ˼

            UW      targe           ɸͥåȥIPɥ쥹
                                    ǥեȥȥǤ0ꤹ롣
            UW      mask            ɸͥåȥΥ֥ͥåȥޥ
                                    ǥեȥȥǤ0ꤹ롣
            UW      gateway         ȥ IP ɥ쥹
                                    ͥåȥǤ0ꤹ롣

   (4)   õ
           õϡ ǥå礭ʽ硢Ĥޤꡢ롼ƥɽ
         ȥκǸ <롼ƥɽȥ깽¤ n> 顢 ǽ
          <롼ƥɽȥ깽¤ 1> ˸äƹԤ롣

7.  ץꥱ Makefile

  ֥եΥǥ쥯ȥפθˡ ʲιԤɲä롣 

   #
   #  ͥåȥӥ
   #
   
   #  ͥåȥ󥿥ե򡢲줫򤹤롣
   
   #NET_IF = loop
   #NET_IF = ppp
   NET_IF = ether
   
   #PPP_CFG_MODEM = true   # PPP ǡǥ³ξ
   
   #  ȥ󥹥ݡؤ
   
   SUPPORT_TCP = true
   #SUPPORT_UDP = true
   
   #
   #  TINET  Makefile.config Υ󥯥롼
   #

   include $(SRCDIR)/tinet/Makefile.config

8.  ITRON TCP/IP API ߴؿ

  ѥץफ TINET ˥ؿȡ TINET ƤӽФ
ѥץबѰդؿǤ롣 ITRON TCP/IP API 
ߴδؿǤꡢ衢ѹޤϺǽ뤳Ȥդ뤳
ȡ

   (1)   󥿥ե IP ɥ쥹ɲä롣

         [1]   :

                  ER in4_add_ifaddr (UW addr, UW mask);

         [2]    addr: IP ɥ쥹
         [3]    mask: ֥ͥåȥޥ
         [4]   : ͥåȥ󥿥եͥåȤΤȤ
               ͭǤ
         [5]   :  E_OK

   (2)   ϩɽ˥ȥɲä롣

         [1]   :

                  ER in4_add_route (int index, UW target, UW mask, UW gateway);

         [2]    index: ȥΥǥå
         [3]    target: ɸͥåȥ IP ɥ쥹
         [4]    mask: ɸͥåȥΥ֥ͥåȥޥ
         [5]    gateway: ȥ IP ɥ쥹
         [6]   : ͥåȥ󥿥եͥåȤΤȤ
               ͭǤ
         [7]   :  index ͤͤѥե
               졼ѥ᡼ NUM_ROUTE_ENTRY ʾΤȤ
               E_PAR

   (3)   IP ɥ쥹ʣлΥХåؿ

         [1]   :

                  BOOL arp_callback_duplicated(UB *shost);

         [2]    shost: ʣ MAC ɥ쥹
         [3]   : ѥե졼ѥ᡼
               ARP_CFG_CALLBACK_DUPLICATED ꤵ줿ȤΤͭ
               
         [4]   : TRUE ꤹȡ TINET ǽʣ MAC 
               쥹 syslog ˽Ϥ ʣˤʣȤ
               롣FALSE ꤹȲ⤷ʤ

9.  ռ

   TCP/IP ץȥ륹åϡȿγͤθٱˤ긦桦
ȯԤޤ طư̤˴դޤ

   (1)   ˡƻȵѿ

         [1]   ̾
               ٵѳȯ
         [2]   ơ̾
               ȹ߷楷ƥ TCP/IP ץȥ륹åγȯ

   (2)    NTT ɥ̳ƻѾһŹ

   (3)   кѻȾ̷кѻȶ (ˡ: ˡͤߤ䤮
         )

         [1]   ̾
               ϰ迷󥽡ฦ泫ȯ
         [2]   ơ̾
               ȹߥƥࡦץץåȥۡιۤȤμ
               ȯ

   (4)   ܾ븩ȵ祻󥿡

   (5)   TOPPERS ץ

10.  饤

  TINET  FreeBSD 򸵤˳ȯԤäᡢ TINET ޤॽեȥ
¾Υեȥȯ˻ѤǤʤǺۤ (TOPPERS 饤
 (3) ˵Ƥ) ϡ TOPPERS 饤 (3)  (b) 
ǤԽʬǡ(a) ˤˡɬפǤ롣
  ʲ˼ TOPPERS FreeBSD  FreeBSD ؤΥեȥδ£
Υ饤󥹵˽äơۤȼɥ (Ѽԥޥ˥奢
) ˡ饤ɽԤȡ

(1)FreeBSD

   /*
    * Copyright (c) 1980, 1986, 1993
    *      The Regents of the University of California.  All rights reserved.
    *
    * Redistribution and use in source and binary forms, with or without
    * modification, are permitted provided that the following conditions
    * are met:
    * 1. Redistributions of source code must retain the above copyright
    *    notice, this list of conditions and the following disclaimer.
    * 2. Redistributions in binary form must reproduce the above copyright
    *    notice, this list of conditions and the following disclaimer in the
    *    documentation and/or other materials provided with the distribution.
    * 3. All advertising materials mentioning features or use of this software
    *    must display the following acknowledgement:
    *      This product includes software developed by the University of
    *      California, Berkeley and its contributors.
    * 4. Neither the name of the University nor the names of its contributors
    *    may be used to endorse or promote products derived from this software
    *    without specific prior written permission.
    *
    * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
    * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
    * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
    * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
    * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
    * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
    * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
    * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
    * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    * SUCH DAMAGE.
    */

(2)ͥåȡǥХɥ饤

   /*
    * Copyright (c) 1995, David Greenman
    * All rights reserved.
    *
    * Redistribution and use in source and binary forms, with or without
    * modification, are permitted provided that the following conditions
    * are met:
    * 1. Redistributions of source code must retain the above copyright
    *    notice unmodified, this list of conditions, and the following
    *    disclaimer.
    * 2. Redistributions in binary form must reproduce the above copyright
    *    notice, this list of conditions and the following disclaimer in the
    *    documentation and/or other materials provided with the distribution.
    *
    * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
    * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
    * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
    * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
    * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
    * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
    * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
    * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
    * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    * SUCH DAMAGE.
    *
    * $FreeBSD: src/sys/i386/isa/if_ed.c,v 1.148.2.4 1999/09/25 13:08:18 nyan Exp $
    */
   
   /*
    * Device driver for National Semiconductor DS8390/WD83C690 based ethernet
    *   adapters. By David Greenman, 29-April-1993
    *
    * Currently supports the Western Digital/SMC 8003 and 8013 series,
    *   the SMC Elite Ultra (8216), the 3Com 3c503, the NE1000 and NE2000,
    *   and a variety of similar clones.
    *
    */

(3)/usr/sbin/ppp

   /*
    *                      User Process PPP
    *
    *          Written by Toshiharu OHNO (tony-o@iij.ad.jp)
    *
    *   Copyright (C) 1993, Internet Initiative Japan, Inc. All rights reserverd.
    *
    * Redistribution and use in source and binary forms are permitted
    * provided that the above copyright notice and this paragraph are
    * duplicated in all such forms and that any documentation,
    * advertising materials, and other materials related to such
    * distribution and use acknowledge that the software was developed
    * by the Internet Initiative Japan, Inc.  The name of the
    * IIJ may not be used to endorse or promote products derived
    * from this software without specific prior written permission.
    * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
    * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
    * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
    */

(4)/usr/sbin/pppd

   /*
    * main.c - Point-to-Point Protocol main module
    *
    * Copyright (c) 1989 Carnegie Mellon University.
    * All rights reserved.
    *
    * Redistribution and use in source and binary forms are permitted
    * provided that the above copyright notice and this paragraph are
    * duplicated in all such forms and that any documentation,
    * advertising materials, and other materials related to such
    * distribution and use acknowledge that the software was developed
    * by Carnegie Mellon University.  The name of the
    * University may not be used to endorse or promote products derived
    * from this software without specific prior written permission.
    * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
    * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
    * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
    */

(5)TOPPERS

   /*
    *  TOPPERS/JSP Kernel
    *      Toyohashi Open Platform for Embedded Real-Time Systems/
    *      Just Standard Profile Kernel
    * 
    *  Copyright (C) 2000-2004 by Embedded and Real-Time Systems Laboratory
    *                              Toyohashi Univ. of Technology, JAPAN
    *  Copyright (C) 2001-2004 by Dep. of Computer Science and Engineering
    *                   Tomakomai National College of Technology, JAPAN
    *
    *  嵭Ԥϡʲ (1)(4) ξ狼Free Software Foundation 
    *  ˤäƸɽƤ GNU General Public License  Version 2 ˵
    *  ҤƤ˸¤ꡤܥեȥܥեȥ
    *  ѤΤޤࡥʲƱˤѡʣѡۡʰʲ
    *  ѤȸƤ֡ˤ뤳Ȥ̵ǵ롥
    *  (1) ܥեȥ򥽡ɤηѤˤϡ嵭
    *      ɽѾ浪Ӳ̵ݾڵ꤬Τޤޤηǥ
    *      ˴ޤޤƤ뤳ȡ
    *  (2) ܥեȥ򡤥饤֥ʤɡ¾Υեȥȯ˻
    *      ѤǤǺۤˤϡۤȼɥȡ
    *      ԥޥ˥奢ʤɡˤˡ嵭ɽѾ浪Ӳ
    *      ̵ݾڵǺܤ뤳ȡ
    *  (3) ܥեȥ򡤵Ȥ߹ʤɡ¾Υեȥȯ˻
    *      ѤǤʤǺۤˤϡΤ줫ξ
    *      ȡ
    *    (a) ۤȼɥȡѼԥޥ˥奢ʤɡˤˡ嵭
    *        ɽѾ浪Ӳ̵ݾڵǺܤ뤳ȡ
    *    (b) ۤη֤̤ˡˤäơTOPPERSץȤ
    *        𤹤뤳ȡ
    *  (4) ܥեȥѤˤľŪޤϴŪ뤤ʤ»
    *      ⡤嵭ԤTOPPERSץȤդ뤳ȡ
    *
    *  ܥեȥϡ̵ݾڤ󶡤ƤΤǤ롥嵭Ԥ
    *  TOPPERSץȤϡܥեȥ˴ؤơŬѲǽ
    *  ޤơʤݾڤԤʤޤܥեȥѤˤľ
    *  ŪޤϴŪʤ»˴ؤƤ⡤Ǥʤ
    * 
    *  @(#) $Id: $
    */
