Ignore:
Timestamp:
Jan 21, 2018, 12:10:09 AM (6 years ago)
Author:
coas-nagasima
Message:

prototoolに関連するプロジェクトをnewlibからmuslを使うよう変更・更新
ntshellをnewlibの下位の実装から、muslのsyscallの実装に変更・更新
以下のOSSをアップデート
・mruby-1.3.0
・musl-1.1.18
・onigmo-6.1.3
・tcc-0.9.27
以下のOSSを追加
・openssl-1.1.0e
・curl-7.57.0
・zlib-1.2.11
以下のmrbgemsを追加
・iij/mruby-digest
・iij/mruby-env
・iij/mruby-errno
・iij/mruby-iijson
・iij/mruby-ipaddr
・iij/mruby-mock
・iij/mruby-require
・iij/mruby-tls-openssl

File:
1 edited

Legend:

Unmodified
Added
Removed
  • EcnlProtoTool/trunk/asp3_dcre/tinet/netinet/udp_subr.c

    r321 r331  
    22 *  TINET (UDP/IP Protocol Stack)
    33 *
    4  *  Copyright (C) 2001-2009 by Dep. of Computer Science and Engineering
     4 *  Copyright (C) 2001-2017 by Dep. of Computer Science and Engineering
    55 *                   Tomakomai National College of Technology, JAPAN
    66 *
     
    7171#include <kernel.h>
    7272#include <sil.h>
     73#include <t_syslog.h>
    7374#include "kernel_cfg.h"
     75#include "tinet_cfg.h"
    7476
    7577#endif  /* of #ifdef TARGET_KERNEL_ASP */
     
    8082#include <t_services.h>
    8183#include "kernel_id.h"
     84#include "tinet_id.h"
    8285
    8386#endif  /* of #ifdef TARGET_KERNEL_JSP */
     
    9194#include <net/ethernet.h>
    9295#include <net/net.h>
     96#include <net/net_endian.h>
    9397#include <net/net_buf.h>
    9498#include <net/net_count.h>
     
    96100
    97101#include <netinet/in.h>
    98 #include <netinet6/in6.h>
    99102#include <netinet/in_var.h>
    100103#include <netinet/in_itron.h>
     
    102105#include <netinet/ip_var.h>
    103106#include <netinet/ip_icmp.h>
    104 #include <netinet6/in6_var.h>
    105 #include <netinet/ip6.h>
    106 #include <netinet6/ip6_var.h>
    107 #include <netinet6/nd6.h>
    108 #include <netinet/icmp6.h>
    109107#include <netinet/udp.h>
    110108#include <netinet/udp_var.h>
     109#include <netinet/ip_igmp.h>
     110
     111#include <net/if_var.h>
    111112
    112113#ifdef SUPPORT_UDP
     
    116117 */
    117118
     119#if (defined(_IP6_CFG) && TNUM_UDP6_CEPID > 0) || (defined(_IP4_CFG) && TNUM_UDP4_CEPID > 0)
     120
    118121static uint16_t udp_port_auto = UDP_PORT_FIRST_AUTO;    /* 自動割り当て番号     */
    119122
     123#endif  /* of #if (defined(_IP6_CFG) && TNUM_UDP6_CEPID > 0) || (defined(_IP4_CFG) && TNUM_UDP4_CEPID > 0) */
     124
    120125/*
    121  *  udp_alloc_auto_port -- 自動割り当てポート番号を設定する。
     126 *  IPv6 と IPv4 で引数が異なる関数のコンパイル
    122127 */
    123128
    124 ER
    125 udp_alloc_auto_port (T_UDP_CEP *cep)
    126 {
    127         int_t   ix;
    128         uint16_t        portno, portno_start;
     129#if defined(_IP6_CFG) && TNUM_UDP6_CEPID > 0
    129130
    130         portno_start = udp_port_auto;
    131         do {
    132                 portno = udp_port_auto ++;
    133                 if (udp_port_auto > UDP_PORT_LAST_AUTO)
    134                         udp_port_auto = UDP_PORT_FIRST_AUTO;
     131#if defined(_IP4_CFG) && defined(API_CFG_IP4MAPPED_ADDR)
    135132
    136                 syscall(wai_sem(SEM_UDP_CEP));
    137                 for (ix = tmax_udp_ccepid; ix -- > 0; ) {
    138                         if (VALID_UDP_CEP(&udp_cep[ix]) && udp_cep[ix].myaddr.portno == portno) {
    139                                 portno = UDP_PORTANY;
    140                                 break;
    141                                 }
    142                         }
     133#define UDP_IS_DSTADDR_ACCEPT   udpn_is_dstaddr_accept
    143134
    144                 if (portno != UDP_PORTANY) {
    145                         cep->myaddr.portno = portno;
    146                         syscall(sig_sem(SEM_UDP_CEP));
    147                         return E_OK;
    148                         }
    149                 syscall(sig_sem(SEM_UDP_CEP));
     135#else   /* of #if defined(_IP4_CFG) */
    150136
    151                 } while (portno_start != udp_port_auto);
     137#define UDP_IS_DSTADDR_ACCEPT   udp6_is_dstaddr_accept
    152138
    153         return E_NOID;
    154         }
     139#endif  /* of #if defined(_IP4_CFG) */
    155140
    156 /*
    157  *  udp_alloc_port -- 指定されたポート番号を設定する。
    158  */
     141#define UDP_SEND_DATA           udp6_send_data
     142#define UDP_CAN_SND             udp6_can_snd
     143#define UDP_CAN_RCV             udp6_can_rcv
     144#define UDP_ALLOC_AUTO_PORT     udp6_alloc_auto_port
     145#define UDP_ALLOC_PORT          udp6_alloc_port
     146#define UDP_FIND_CEP            udp6_find_cep
     147#define UDP_NOTIFY              udp6_notify
     148#define TMAX_UDP_CEPID          tmax_udp6_cepid
     149#define UDP_CEP                 udp6_cep
     150#define T_UDP_CEP               T_UDP6_CEP
     151#define T_IPEP                  T_IPV6EP
     152#define API_PROTO               API_PROTO_IPV6
    159153
    160 ER
    161 udp_alloc_port (T_UDP_CEP *cep, uint16_t portno)
    162 {
    163         int_t   ix;
     154#include <netinet6/udp6_subr.c>
     155#include <netinet/udpn_subr.c>
    164156
    165         syscall(wai_sem(SEM_UDP_CEP));
    166         for (ix = tmax_udp_ccepid; ix -- > 0; )
    167                 if (VALID_UDP_CEP(&udp_cep[ix]) && udp_cep[ix].myaddr.portno == portno) {
    168                         syscall(sig_sem(SEM_UDP_CEP));
    169                         return E_PAR;
    170                         }
    171         cep->myaddr.portno = portno;
    172         syscall(sig_sem(SEM_UDP_CEP));
    173         return E_OK;
    174         }
     157#undef  UDP_SEND_DATA
     158#undef  UDP_CAN_SND
     159#undef  UDP_CAN_RCV
     160#undef  UDP_ALLOC_AUTO_PORT
     161#undef  UDP_ALLOC_PORT
     162#undef  UDP_FIND_CEP
     163#undef  UDP_NOTIFY
     164#undef  UDP_IS_DSTADDR_ACCEPT
     165#undef  TMAX_UDP_CEPID
     166#undef  UDP_CEP
     167#undef  T_UDP_CEP
     168#undef  T_IPEP
     169#undef  API_PROTO
     170
     171#endif  /* of #if defined(_IP6_CFG) && TNUM_UDP6_CEPID > 0 */
     172
     173#if defined(_IP4_CFG) && ( (TNUM_UDP4_CEPID > 0) || \
     174                          ((TNUM_UDP6_CEPID > 0) && defined(API_CFG_IP4MAPPED_ADDR)))
     175
     176#define UDP_IS_DSTADDR_ACCEPT   udp4_is_dstaddr_accept
     177
     178#define UDP_SEND_DATA           udp4_send_data
     179#define UDP_CAN_SND             udp4_can_snd
     180#define UDP_CAN_RCV             udp4_can_rcv
     181#define UDP_ALLOC_AUTO_PORT     udp4_alloc_auto_port
     182#define UDP_ALLOC_PORT          udp4_alloc_port
     183#define UDP_FIND_CEP            udp4_find_cep
     184#define UDP_NOTIFY              udp4_notify
     185#define TMAX_UDP_CEPID          tmax_udp4_cepid
     186#define T_UDP_CEP               T_UDP4_CEP
     187#define UDP_CEP                 udp4_cep
     188#define T_IPEP                  T_IPV4EP
     189#define API_PROTO               API_PROTO_IPV4
     190
     191#include <netinet/udp4_subr.c>
     192#include <netinet/udpn_subr.c>
     193
     194#endif  /* of #if defined(_IP4_CFG) && TNUM_UDP4_CEPID > 0 */
    175195
    176196#endif  /* of #ifdef SUPPORT_UDP */
Note: See TracChangeset for help on using the changeset viewer.