[270] | 1 | /*
|
---|
| 2 | * TINET (UDP/IP Protocol Stack)
|
---|
| 3 | *
|
---|
| 4 | * Copyright (C) 2001-2009 by Dep. of Computer Science and Engineering
|
---|
| 5 | * Tomakomai National College of Technology, JAPAN
|
---|
| 6 | *
|
---|
| 7 | * ä¸è¨èä½æ¨©è
|
---|
| 8 | ã¯ï¼ä»¥ä¸ã® (1)ï½(4) ã®æ¡ä»¶ãï¼Free Software Foundation
|
---|
| 9 | * ã«ãã£ã¦å
|
---|
| 10 | ¬è¡¨ããã¦ãã GNU General Public License ã® Version 2 ã«è¨
|
---|
| 11 | * è¿°ããã¦ããæ¡ä»¶ãæºããå ´åã«éãï¼æ¬ã½ããã¦ã§ã¢ï¼æ¬ã½ããã¦ã§ã¢
|
---|
| 12 | * ãæ¹å¤ãããã®ãå«ãï¼ä»¥ä¸åãï¼ã使ç¨ã»è¤è£½ã»æ¹å¤ã»åé
|
---|
| 13 | å¸ï¼ä»¥ä¸ï¼
|
---|
| 14 | * å©ç¨ã¨å¼ã¶ï¼ãããã¨ãç¡åã§è¨±è«¾ããï¼
|
---|
| 15 | * (1) æ¬ã½ããã¦ã§ã¢ãã½ã¼ã¹ã³ã¼ãã®å½¢ã§å©ç¨ããå ´åã«ã¯ï¼ä¸è¨ã®èä½
|
---|
| 16 | * 権表示ï¼ãã®å©ç¨æ¡ä»¶ããã³ä¸è¨ã®ç¡ä¿è¨¼è¦å®ãï¼ãã®ã¾ã¾ã®å½¢ã§ã½ã¼
|
---|
| 17 | * ã¹ã³ã¼ãä¸ã«å«ã¾ãã¦ãããã¨ï¼
|
---|
| 18 | * (2) æ¬ã½ããã¦ã§ã¢ãï¼ã©ã¤ãã©ãªå½¢å¼ãªã©ï¼ä»ã®ã½ããã¦ã§ã¢éçºã«ä½¿
|
---|
| 19 | * ç¨ã§ããå½¢ã§åé
|
---|
| 20 | å¸ããå ´åã«ã¯ï¼åé
|
---|
| 21 | å¸ã«ä¼´ãããã¥ã¡ã³ãï¼å©ç¨
|
---|
| 22 | * è
|
---|
| 23 | ããã¥ã¢ã«ãªã©ï¼ã«ï¼ä¸è¨ã®èä½æ¨©è¡¨ç¤ºï¼ãã®å©ç¨æ¡ä»¶ããã³ä¸è¨
|
---|
| 24 | * ã®ç¡ä¿è¨¼è¦å®ãæ²è¼ãããã¨ï¼
|
---|
| 25 | * (3) æ¬ã½ããã¦ã§ã¢ãï¼æ©å¨ã«çµã¿è¾¼ããªã©ï¼ä»ã®ã½ããã¦ã§ã¢éçºã«ä½¿
|
---|
| 26 | * ç¨ã§ããªãå½¢ã§åé
|
---|
| 27 | å¸ããå ´åã«ã¯ï¼æ¬¡ã®æ¡ä»¶ãæºãããã¨ï¼
|
---|
| 28 | * (a) åé
|
---|
| 29 | å¸ã«ä¼´ãããã¥ã¡ã³ãï¼å©ç¨è
|
---|
| 30 | ããã¥ã¢ã«ãªã©ï¼ã«ï¼ä¸è¨ã®è
|
---|
| 31 | * ä½æ¨©è¡¨ç¤ºï¼ãã®å©ç¨æ¡ä»¶ããã³ä¸è¨ã®ç¡ä¿è¨¼è¦å®ãæ²è¼ãããã¨ï¼
|
---|
| 32 | * (4) æ¬ã½ããã¦ã§ã¢ã®å©ç¨ã«ããç´æ¥çã¾ãã¯éæ¥çã«çãããããªãæ
|
---|
| 33 | * 害ãããï¼ä¸è¨èä½æ¨©è
|
---|
| 34 | ããã³TOPPERSããã¸ã§ã¯ããå
|
---|
| 35 | 責ãããã¨ï¼
|
---|
| 36 | *
|
---|
| 37 | * æ¬ã½ããã¦ã§ã¢ã¯ï¼ç¡ä¿è¨¼ã§æä¾ããã¦ãããã®ã§ããï¼ä¸è¨èä½æ¨©è
|
---|
| 38 | ã
|
---|
| 39 | * ãã³TOPPERSããã¸ã§ã¯ãã¯ï¼æ¬ã½ããã¦ã§ã¢ã«é¢ãã¦ï¼ãã®é©ç¨å¯è½æ§ã
|
---|
| 40 | * å«ãã¦ï¼ãããªãä¿è¨¼ãè¡ããªãï¼ã¾ãï¼æ¬ã½ããã¦ã§ã¢ã®å©ç¨ã«ããç´
|
---|
| 41 | * æ¥çã¾ãã¯éæ¥çã«çãããããªãæ害ã«é¢ãã¦ãï¼ãã®è²¬ä»»ãè² ããªãï¼
|
---|
| 42 | *
|
---|
| 43 | * @(#) $Id: udp_usrreq.c 270 2017-02-09 04:03:47Z coas-nagasima $
|
---|
| 44 | */
|
---|
| 45 |
|
---|
| 46 | /*
|
---|
| 47 | * Copyright (c) 1982, 1986, 1988, 1990, 1993, 1995
|
---|
| 48 | * The Regents of the University of California. All rights reserved.
|
---|
| 49 | *
|
---|
| 50 | * Redistribution and use in source and binary forms, with or without
|
---|
| 51 | * modification, are permitted provided that the following conditions
|
---|
| 52 | * are met:
|
---|
| 53 | * 1. Redistributions of source code must retain the above copyright
|
---|
| 54 | * notice, this list of conditions and the following disclaimer.
|
---|
| 55 | * 2. Redistributions in binary form must ceproduce the above copyright
|
---|
| 56 | * notice, this list of conditions and the following disclaimer in the
|
---|
| 57 | * documentation and/or other materials provided with the distribution.
|
---|
| 58 | * 3. All advertising materials mentioning features or use of this software
|
---|
| 59 | * must display the following acknowledgement:
|
---|
| 60 | * This product includes software developed by the University of
|
---|
| 61 | * California, Berkeley and its contributors.
|
---|
| 62 | * 4. Neither the name of the University nor the names of its contributors
|
---|
| 63 | * may be used to endorse or promote products derived from this software
|
---|
| 64 | * without specific prior written permission.
|
---|
| 65 | *
|
---|
| 66 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
---|
| 67 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
---|
| 68 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
---|
| 69 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
---|
| 70 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
---|
| 71 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
---|
| 72 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
---|
| 73 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
---|
| 74 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
---|
| 75 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
---|
| 76 | * SUCH DAMAGE.
|
---|
| 77 | *
|
---|
| 78 | * @(#)udp_usrreq.c 8.6 (Berkeley) 5/23/95
|
---|
| 79 | * $FreeBSD: src/sys/netinet/udp_usrreq.c,v 1.49.2.2 1999/08/29 16:29:58 peter Exp $
|
---|
| 80 | */
|
---|
| 81 |
|
---|
| 82 | /*
|
---|
| 83 | * ãã³ããããã³ã°ã³ã¼ã«ãçµè¾¼ã¾ãªãå ´åã«ãªã³ã¯ãããé¢æ°ã®å®ç¾©
|
---|
| 84 | */
|
---|
| 85 |
|
---|
| 86 | #include <string.h>
|
---|
| 87 |
|
---|
| 88 | #ifdef TARGET_KERNEL_ASP
|
---|
| 89 |
|
---|
| 90 | #include <kernel.h>
|
---|
| 91 | #include <sil.h>
|
---|
| 92 |
|
---|
| 93 | #endif /* of #ifdef TARGET_KERNEL_ASP */
|
---|
| 94 |
|
---|
| 95 | #ifdef TARGET_KERNEL_JSP
|
---|
| 96 |
|
---|
| 97 | #include <s_services.h>
|
---|
| 98 | #include <t_services.h>
|
---|
| 99 | #include "kernel_id.h"
|
---|
| 100 |
|
---|
| 101 | #endif /* of #ifdef TARGET_KERNEL_JSP */
|
---|
| 102 |
|
---|
| 103 | #include <tinet_defs.h>
|
---|
| 104 | #include <tinet_config.h>
|
---|
| 105 |
|
---|
| 106 | #include <net/if.h>
|
---|
| 107 | #include <net/if_ppp.h>
|
---|
| 108 | #include <net/if_loop.h>
|
---|
| 109 | #include <net/ethernet.h>
|
---|
| 110 | #include <net/net.h>
|
---|
| 111 | #include <net/net_buf.h>
|
---|
| 112 | #include <net/net_count.h>
|
---|
| 113 | #include <net/ppp_ipcp.h>
|
---|
| 114 |
|
---|
| 115 | #include <netinet/in.h>
|
---|
| 116 | #include <netinet6/in6.h>
|
---|
| 117 | #include <netinet/in_var.h>
|
---|
| 118 | #include <netinet/in_itron.h>
|
---|
| 119 | #include <netinet/ip.h>
|
---|
| 120 | #include <netinet/ip_var.h>
|
---|
| 121 | #include <netinet/ip_icmp.h>
|
---|
| 122 | #include <netinet6/in6_var.h>
|
---|
| 123 | #include <netinet/ip6.h>
|
---|
| 124 | #include <netinet6/ip6_var.h>
|
---|
| 125 | #include <netinet6/nd6.h>
|
---|
| 126 | #include <netinet/icmp6.h>
|
---|
| 127 | #include <netinet/udp.h>
|
---|
| 128 | #include <netinet/udp_var.h>
|
---|
| 129 |
|
---|
| 130 | #ifdef SUPPORT_UDP
|
---|
| 131 |
|
---|
| 132 | /*
|
---|
| 133 | * IPv4 㨠IPv6 ã®åãæ¿ããã¯ã
|
---|
| 134 | */
|
---|
| 135 |
|
---|
| 136 | #if defined(SUPPORT_INET4)
|
---|
| 137 |
|
---|
| 138 | #define UDP_CRE_CEP udp_cre_cep
|
---|
| 139 | #define UDP_SND_DAT udp_snd_dat
|
---|
| 140 | #define UDP_RCV_DAT udp_rcv_dat
|
---|
| 141 |
|
---|
| 142 | #endif /* of #if defined(SUPPORT_INET4) */
|
---|
| 143 |
|
---|
| 144 | #if defined(SUPPORT_INET6)
|
---|
| 145 |
|
---|
| 146 | #define UDP_CRE_CEP udp6_cre_cep
|
---|
| 147 | #define UDP_SND_DAT udp6_snd_dat
|
---|
| 148 | #define UDP_RCV_DAT udp6_rcv_dat
|
---|
| 149 |
|
---|
| 150 | #endif /* of #if defined(SUPPORT_INET6) */
|
---|
| 151 |
|
---|
| 152 | /*
|
---|
| 153 | * TINET ãã©ã¤ãã©ãªåããªãå ´åã¯ãå
|
---|
| 154 | ¨ã¦ã®æ©è½ã
|
---|
| 155 | * ãªãã¸ã§ã¯ããã¡ã¤ã«ã«åºåããããããã¯ããæå¹ã«ããã
|
---|
| 156 | */
|
---|
| 157 |
|
---|
| 158 | #ifndef UDP_CFG_LIBRARY
|
---|
| 159 |
|
---|
| 160 | #define __udp_send_data
|
---|
| 161 | #define __udp_cre_cep
|
---|
| 162 | #define __udp_del_cep
|
---|
| 163 | #define __udp_can_cep
|
---|
| 164 | #define __udp_set_opt
|
---|
| 165 | #define __udp_get_opt
|
---|
| 166 | #define __udp_can_snd
|
---|
| 167 | #define __udp_can_rcv
|
---|
| 168 | #define __udp_snd_dat
|
---|
| 169 | #define __udp_rcv_dat
|
---|
| 170 |
|
---|
| 171 | #endif /* of #ifndef UDP_CFG_LIBRARY */
|
---|
| 172 |
|
---|
| 173 | #ifdef __udp_send_data
|
---|
| 174 |
|
---|
| 175 | /*
|
---|
| 176 | * udp_send_data -- ãã±ããéä¿¡ã®ä¸»è¦é¨
|
---|
| 177 | */
|
---|
| 178 |
|
---|
| 179 | ER_UINT
|
---|
| 180 | udp_send_data (T_UDP_CEP *cep, T_IPEP *p_dstaddr, void *data, int_t len, TMO tmout)
|
---|
| 181 | {
|
---|
| 182 | T_NET_BUF *output;
|
---|
| 183 | T_UDP_HDR *udph;
|
---|
| 184 | SYSTIM before, after;
|
---|
| 185 | ER error = E_OK;
|
---|
| 186 |
|
---|
| 187 | #ifdef UDP_CFG_OUT_CHECKSUM
|
---|
| 188 | uint16_t sum;
|
---|
| 189 | #endif /* of #ifdef UDP_CFG_OUT_CHECKSUM */
|
---|
| 190 |
|
---|
| 191 | NET_COUNT_UDP(net_count_udp.out_octets, len);
|
---|
| 192 | NET_COUNT_UDP(net_count_udp.out_packets, 1);
|
---|
| 193 |
|
---|
| 194 | /* IP ãã¼ã¿ã°ã©ã å²ãå½ã¦ã®æéã tmout ããæ¸ããã*/
|
---|
| 195 | if (!(tmout == TMO_POL || tmout == TMO_FEVR))
|
---|
| 196 | syscall(get_tim(&before));
|
---|
| 197 |
|
---|
| 198 | /* IP ãã¼ã¿ã°ã©ã ãå²ãå½ã¦ãã*/
|
---|
| 199 | if ((error = IN_GET_DATAGRAM(&output, (uint_t)(UDP_HDR_SIZE + len), 0,
|
---|
| 200 | &p_dstaddr->ipaddr,
|
---|
| 201 | &cep->myaddr.ipaddr,
|
---|
| 202 | IPPROTO_UDP, IP_DEFTTL,
|
---|
| 203 | NBA_SEARCH_ASCENT, tmout)) != E_OK)
|
---|
| 204 | goto err_ret;
|
---|
| 205 |
|
---|
| 206 | /* IP ãã¼ã¿ã°ã©ã å²ãå½ã¦ã®æéã tmout ããæ¸ããã*/
|
---|
| 207 | if (!(tmout == TMO_POL || tmout == TMO_FEVR)) {
|
---|
| 208 | syscall(get_tim(&after));
|
---|
| 209 | if (after - before > tmout) {
|
---|
| 210 | syscall(rel_net_buf(output));
|
---|
| 211 | error = E_TMOUT;
|
---|
| 212 | goto err_ret;
|
---|
| 213 | }
|
---|
| 214 | tmout -= (TMO)(after - before);
|
---|
| 215 | }
|
---|
| 216 |
|
---|
| 217 | /* UDP ãããã«æ
|
---|
| 218 | å ±ãè¨å®ããã*/
|
---|
| 219 | udph = GET_UDP_HDR(output, IF_IP_UDP_HDR_OFFSET);
|
---|
| 220 | udph->sport = htons(cep->myaddr.portno);
|
---|
| 221 | udph->dport = htons(p_dstaddr->portno);
|
---|
| 222 | udph->ulen = htons(UDP_HDR_SIZE + len);
|
---|
| 223 | udph->sum = 0;
|
---|
| 224 |
|
---|
| 225 | /* ãã¼ã¿ãã³ãã¼ããã*/
|
---|
| 226 | memcpy((void*)GET_UDP_SDU(output, IF_IP_UDP_HDR_OFFSET), data, (size_t)len);
|
---|
| 227 |
|
---|
| 228 | #ifdef UDP_CFG_OUT_CHECKSUM
|
---|
| 229 |
|
---|
| 230 | sum = IN_CKSUM(output, IPPROTO_UDP, IF_IP_UDP_HDR_OFFSET, (uint_t)(UDP_HDR_SIZE + len));
|
---|
| 231 |
|
---|
| 232 | /* è¨ç®ãããã§ãã¯ãµã ã®å¤ã 0 ãªã 0xffff ãå
|
---|
| 233 | ¥ããã*/
|
---|
| 234 | if (sum == 0)
|
---|
| 235 | sum = 0xffff;
|
---|
| 236 | udph->sum = sum;
|
---|
| 237 |
|
---|
| 238 | #endif /* of #ifdef UDP_CFG_OUT_CHECKSUM */
|
---|
| 239 |
|
---|
| 240 | /* ãããã¯ã¼ã¯ãããã¡é·ã調æ´ããã*/
|
---|
| 241 | output->len = (uint16_t)(IF_IP_UDP_HDR_SIZE + len);
|
---|
| 242 |
|
---|
| 243 | /* ãããã¯ã¼ã¯å±¤ (IP) ã®åºåé¢æ°ãå¼ã³åºãã*/
|
---|
| 244 | if ((error = IP_OUTPUT(output, tmout)) == E_OK) {
|
---|
| 245 | NET_COUNT_MIB(udp_stats.udpOutDatagrams, 1);
|
---|
| 246 | cep->snd_tskid = TA_NULL;
|
---|
| 247 | return len;
|
---|
| 248 | }
|
---|
| 249 |
|
---|
| 250 | err_ret:
|
---|
| 251 | NET_COUNT_UDP(net_count_udp.out_err_packets, 1);
|
---|
| 252 | cep->snd_tskid = TA_NULL;
|
---|
| 253 | return error;
|
---|
| 254 | }
|
---|
| 255 |
|
---|
| 256 | #endif /* of #ifdef __udp_send_data */
|
---|
| 257 |
|
---|
| 258 | /*
|
---|
| 259 | * udp_cre_cep -- UDP é信端ç¹ã®çæãæ¡å¼µæ©è½ã
|
---|
| 260 | */
|
---|
| 261 |
|
---|
| 262 | #ifdef __udp_cre_cep
|
---|
| 263 |
|
---|
| 264 | #ifdef UDP_CFG_EXTENTIONS
|
---|
| 265 |
|
---|
| 266 | ER
|
---|
| 267 | UDP_CRE_CEP (ID cepid, T_UDP_CCEP *pk_ccep)
|
---|
| 268 | {
|
---|
| 269 | T_UDP_CEP *cep;
|
---|
| 270 | ER error;
|
---|
| 271 |
|
---|
| 272 | /* UDP éä¿¡ç«¯ç¹ ID ããã§ãã¯ããã*/
|
---|
| 273 | if (!VALID_UDP_CEPID(cepid))
|
---|
| 274 | return E_ID;
|
---|
| 275 |
|
---|
| 276 | /* pk_ccep ã NULL ãªãã¨ã©ã¼ */
|
---|
| 277 | if (pk_ccep == NULL)
|
---|
| 278 | return E_PAR;
|
---|
| 279 |
|
---|
| 280 | /* UDP é信端ç¹ãå¾ãã*/
|
---|
| 281 | cep = GET_UDP_CEP(cepid);
|
---|
| 282 |
|
---|
| 283 | /* UDP é信端ç¹ããã§ãã¯ããã*/
|
---|
| 284 | if (VALID_UDP_CEP(cep))
|
---|
| 285 | return E_OBJ;
|
---|
| 286 |
|
---|
| 287 | /* UDP é信端ç¹ããåççæç¨ã§ãªããã°ã¨ã©ã¼ */
|
---|
| 288 | if (!DYNAMIC_UDP_CEP(cep))
|
---|
| 289 | return E_ID;
|
---|
| 290 |
|
---|
| 291 | /* é信端ç¹ãããã¯ããã*/
|
---|
| 292 | syscall(wai_sem(cep->semid_lock));
|
---|
| 293 |
|
---|
| 294 | /*
|
---|
| 295 | * UDP é信端ç¹ããã§ãã¯ãããçææ¸ã¿ã§ããã°ã¨ã©ã¼
|
---|
| 296 | */
|
---|
| 297 | if (VALID_UDP_CEP(cep))
|
---|
| 298 | error = E_OBJ;
|
---|
| 299 | else {
|
---|
| 300 |
|
---|
| 301 | /*
|
---|
| 302 | * èªãã¼ãçªå·ã UDP_PORTANY ãªããèªåã§å²ãå½ã¦ãã
|
---|
| 303 | */
|
---|
| 304 | if (pk_ccep->myaddr.portno == UDP_PORTANY)
|
---|
| 305 | error = udp_alloc_auto_port(cep);
|
---|
| 306 | else
|
---|
| 307 | error = udp_alloc_port(cep, pk_ccep->myaddr.portno);
|
---|
| 308 |
|
---|
| 309 | if (error == E_OK) {
|
---|
| 310 |
|
---|
| 311 | /* UDP é信端ç¹çææ
|
---|
| 312 | å ±ãã³ãã¼ããã*/
|
---|
| 313 | cep->cepatr = pk_ccep->cepatr; /* é信端ç¹å±æ§ */
|
---|
| 314 | cep->myaddr.ipaddr = pk_ccep->myaddr.ipaddr; /* èªåã®ã¢ãã¬ã¹ */
|
---|
| 315 | cep->callback = (void*)pk_ccep->callback; /* ã³ã¼ã«ãã㯠*/
|
---|
| 316 |
|
---|
| 317 | /* UDP é信端ç¹ãçææ¸ã¿ã«ããã*/
|
---|
| 318 | cep->flags |= UDP_CEP_FLG_VALID;
|
---|
| 319 | }
|
---|
| 320 | }
|
---|
| 321 |
|
---|
| 322 | /* é信端ç¹ã®ããã¯ã解é¤ããã*/
|
---|
| 323 | syscall(sig_sem(cep->semid_lock));
|
---|
| 324 |
|
---|
| 325 | return error;
|
---|
| 326 | }
|
---|
| 327 |
|
---|
| 328 | #endif /* of #ifdef UDP_CFG_EXTENTIONS */
|
---|
| 329 |
|
---|
| 330 | #endif /* of #ifdef __udp_cre_cep */
|
---|
| 331 |
|
---|
| 332 | /*
|
---|
| 333 | * udp_del_cep -- UDP é信端ç¹ã®åé¤ãæ¡å¼µæ©è½ã
|
---|
| 334 | */
|
---|
| 335 |
|
---|
| 336 | #ifdef __udp_del_cep
|
---|
| 337 |
|
---|
| 338 | #ifdef UDP_CFG_EXTENTIONS
|
---|
| 339 |
|
---|
| 340 | ER
|
---|
| 341 | udp_del_cep (ID cepid)
|
---|
| 342 | {
|
---|
| 343 | T_UDP_CEP *cep;
|
---|
| 344 | ER error;
|
---|
| 345 |
|
---|
| 346 | /* UDP éä¿¡ç«¯ç¹ ID ããã§ãã¯ããã*/
|
---|
| 347 | if (!VALID_UDP_CEPID(cepid))
|
---|
| 348 | return E_ID;
|
---|
| 349 |
|
---|
| 350 | /* UDP é信端ç¹ãå¾ãã*/
|
---|
| 351 | cep = GET_UDP_CEP(cepid);
|
---|
| 352 |
|
---|
| 353 | /* UDP é信端ç¹ããã§ãã¯ããã*/
|
---|
| 354 | if (!VALID_UDP_CEP(cep))
|
---|
| 355 | return E_NOEXS;
|
---|
| 356 |
|
---|
| 357 | /* UDP é信端ç¹ããåççæç¨ã§ãªããã°ã¨ã©ã¼ */
|
---|
| 358 | if (!DYNAMIC_UDP_CEP(cep))
|
---|
| 359 | return E_ID;
|
---|
| 360 |
|
---|
| 361 | /* é信端ç¹ãããã¯ããã*/
|
---|
| 362 | syscall(wai_sem(cep->semid_lock));
|
---|
| 363 |
|
---|
| 364 | /*
|
---|
| 365 | * UDP é信端ç¹ããã§ãã¯ãããæªçæã®å ´åã¯ã¨ã©ã¼
|
---|
| 366 | * ã»æªçæã
|
---|
| 367 | */
|
---|
| 368 | if (!VALID_UDP_CEP(cep))
|
---|
| 369 | error = E_NOEXS;
|
---|
| 370 | else {
|
---|
| 371 | udp_can_snd(cep, E_DLT);
|
---|
| 372 | udp_can_rcv(cep, E_DLT);
|
---|
| 373 |
|
---|
| 374 | /* UDP é信端ç¹ãæªçæã«ããã*/
|
---|
| 375 | cep->flags &= ~UDP_CEP_FLG_VALID;
|
---|
| 376 | error = E_OK;
|
---|
| 377 | }
|
---|
| 378 |
|
---|
| 379 | /* é信端ç¹ã®ããã¯ã解é¤ããã*/
|
---|
| 380 | syscall(sig_sem(cep->semid_lock));
|
---|
| 381 |
|
---|
| 382 | return error;
|
---|
| 383 | }
|
---|
| 384 |
|
---|
| 385 | #endif /* of #ifdef UDP_CFG_EXTENTIONS */
|
---|
| 386 |
|
---|
| 387 | #endif /* of #ifdef __udp_del_cep */
|
---|
| 388 |
|
---|
| 389 | #ifdef __udp_can_cep
|
---|
| 390 |
|
---|
| 391 | /*
|
---|
| 392 | * udp_can_cep -- ãã³ãã£ã³ã°ãã¦ããå¦çã®ãã£ã³ã»ã«ãæ¨æºæ©è½ã
|
---|
| 393 | */
|
---|
| 394 |
|
---|
| 395 | ER
|
---|
| 396 | udp_can_cep (ID cepid, FN fncd)
|
---|
| 397 | {
|
---|
| 398 | T_UDP_CEP *cep;
|
---|
| 399 | ER error = E_OK, snd_err, rcv_err;
|
---|
| 400 |
|
---|
| 401 | /* API æ©è½ã³ã¼ãããã§ãã¯ããã*/
|
---|
| 402 | if (!VALID_TFN_UDP_CAN(fncd))
|
---|
| 403 | return E_PAR;
|
---|
| 404 |
|
---|
| 405 | /* UDP éä¿¡ç«¯ç¹ ID ããã§ãã¯ããã*/
|
---|
| 406 | if (!VALID_UDP_CEPID(cepid))
|
---|
| 407 | return E_ID;
|
---|
| 408 |
|
---|
| 409 | /* UDP é信端ç¹ãå¾ãã*/
|
---|
| 410 | cep = GET_UDP_CEP(cepid);
|
---|
| 411 |
|
---|
| 412 | /* UDP é信端ç¹ããã§ãã¯ããã*/
|
---|
| 413 | if (!VALID_UDP_CEP(cep))
|
---|
| 414 | return E_NOEXS;
|
---|
| 415 |
|
---|
| 416 | /* é信端ç¹ãããã¯ããã*/
|
---|
| 417 | syscall(wai_sem(cep->semid_lock));
|
---|
| 418 |
|
---|
| 419 | if (fncd == TFN_UDP_ALL) { /* TFN_UDP_ALL ã®å¦ç */
|
---|
| 420 |
|
---|
| 421 | snd_err = udp_can_snd(cep, E_RLWAI);
|
---|
| 422 | rcv_err = udp_can_rcv(cep, E_RLWAI);
|
---|
| 423 |
|
---|
| 424 | /*
|
---|
| 425 | * snd_err 㨠rcv_err ã®ã©ã¡ãã EV_NOPND
|
---|
| 426 | * ãªãããã³ãã£ã³ã°ãã¦ããªãã®ã§ã¨ã©ã¼
|
---|
| 427 | */
|
---|
| 428 | if (snd_err == EV_NOPND && rcv_err == EV_NOPND)
|
---|
| 429 | error = E_OBJ;
|
---|
| 430 | else {
|
---|
| 431 | if (snd_err == EV_NOPND)
|
---|
| 432 | snd_err = E_OK;
|
---|
| 433 | if (rcv_err == EV_NOPND)
|
---|
| 434 | rcv_err = E_OK;
|
---|
| 435 |
|
---|
| 436 | if (snd_err != E_OK)
|
---|
| 437 | error = snd_err;
|
---|
| 438 | else if (rcv_err != E_OK)
|
---|
| 439 | error = rcv_err;
|
---|
| 440 | }
|
---|
| 441 | }
|
---|
| 442 | else if (fncd == TFN_UDP_SND_DAT) { /* éä¿¡å¦çã®ãã£ã³ã»ã« */
|
---|
| 443 | if ((error = udp_can_snd(cep, E_RLWAI)) == EV_NOPND)
|
---|
| 444 | error = E_OBJ;
|
---|
| 445 | }
|
---|
| 446 | else if (fncd == TFN_UDP_RCV_DAT) { /* åä¿¡å¦çã®ãã£ã³ã»ã« */
|
---|
| 447 | if ((error = udp_can_rcv(cep, E_RLWAI)) == EV_NOPND)
|
---|
| 448 | error = E_OBJ;
|
---|
| 449 | }
|
---|
| 450 | else
|
---|
| 451 | error = E_PAR;
|
---|
| 452 |
|
---|
| 453 | /* é信端ç¹ãããã¯ã解é¤ããã*/
|
---|
| 454 | syscall(sig_sem(cep->semid_lock));
|
---|
| 455 |
|
---|
| 456 | return error;
|
---|
| 457 | }
|
---|
| 458 |
|
---|
| 459 | #endif /* of #ifdef __udp_can_cep */
|
---|
| 460 |
|
---|
| 461 | /*
|
---|
| 462 | * udp_set_opt -- UDP é信端ç¹ãªãã·ã§ã³ã®è¨å®ãæ¡å¼µæ©è½ã
|
---|
| 463 | *
|
---|
| 464 | * 注æ: è¨å®å¯è½ãª UDP é信端ç¹ãªãã·ã§ã³ã¯ç¡ããããE_PAR ãè¿ãããã
|
---|
| 465 | */
|
---|
| 466 |
|
---|
| 467 | #ifdef __udp_set_opt
|
---|
| 468 |
|
---|
| 469 | #ifdef UDP_CFG_EXTENTIONS
|
---|
| 470 |
|
---|
| 471 | ER
|
---|
| 472 | udp_set_opt (ID cepid, int_t optname, void *optval, int_t optlen)
|
---|
| 473 | {
|
---|
| 474 | T_UDP_CEP *cep;
|
---|
| 475 |
|
---|
| 476 | /* UDP éä¿¡ç«¯ç¹ ID ããã§ãã¯ããã*/
|
---|
| 477 | if (!VALID_UDP_CEPID(cepid))
|
---|
| 478 | return E_ID;
|
---|
| 479 |
|
---|
| 480 | /* UDP é信端ç¹ãå¾ãã*/
|
---|
| 481 | cep = GET_UDP_CEP(cepid);
|
---|
| 482 |
|
---|
| 483 | /* UDP é信端ç¹ããã§ãã¯ããã*/
|
---|
| 484 | if (!VALID_UDP_CEP(cep))
|
---|
| 485 | return E_NOEXS;
|
---|
| 486 |
|
---|
| 487 | return E_PAR;
|
---|
| 488 | }
|
---|
| 489 |
|
---|
| 490 | #endif /* of #ifdef UDP_CFG_EXTENTIONS */
|
---|
| 491 |
|
---|
| 492 | #endif /* of #ifdef __udp_set_opt */
|
---|
| 493 |
|
---|
| 494 | /*
|
---|
| 495 | * udp_get_opt -- UDP é信端ç¹ãªãã·ã§ã³ã®è¨å®ãæ¡å¼µæ©è½ã
|
---|
| 496 | *
|
---|
| 497 | * 注æ: è¨å®å¯è½ãª UDP é信端ç¹ãªãã·ã§ã³ã¯ç¡ããããE_PAR ãè¿ãããã
|
---|
| 498 | */
|
---|
| 499 |
|
---|
| 500 | #ifdef __udp_get_opt
|
---|
| 501 |
|
---|
| 502 | #ifdef UDP_CFG_EXTENTIONS
|
---|
| 503 |
|
---|
| 504 | ER
|
---|
| 505 | udp_get_opt (ID cepid, int_t optname, void *optval, int_t optlen)
|
---|
| 506 | {
|
---|
| 507 | T_UDP_CEP *cep;
|
---|
| 508 |
|
---|
| 509 | /* UDP éä¿¡ç«¯ç¹ ID ããã§ãã¯ããã*/
|
---|
| 510 | if (!VALID_UDP_CEPID(cepid))
|
---|
| 511 | return E_ID;
|
---|
| 512 |
|
---|
| 513 | /* UDP é信端ç¹ãå¾ãã*/
|
---|
| 514 | cep = GET_UDP_CEP(cepid);
|
---|
| 515 |
|
---|
| 516 | /* UDP é信端ç¹ããã§ãã¯ããã*/
|
---|
| 517 | if (!VALID_UDP_CEP(cep))
|
---|
| 518 | return E_NOEXS;
|
---|
| 519 |
|
---|
| 520 | return E_PAR;
|
---|
| 521 | }
|
---|
| 522 |
|
---|
| 523 | #endif /* of #ifdef UDP_CFG_EXTENTIONS */
|
---|
| 524 |
|
---|
| 525 | #endif /* of #ifdef __udp_get_opt */
|
---|
| 526 |
|
---|
| 527 | #ifdef UDP_CFG_NON_BLOCKING
|
---|
| 528 |
|
---|
| 529 | #include "udp_usrreq_nblk.c"
|
---|
| 530 |
|
---|
| 531 | #else /* of #ifdef UDP_CFG_NON_BLOCKING */
|
---|
| 532 |
|
---|
| 533 | #ifdef __udp_can_snd
|
---|
| 534 |
|
---|
| 535 | /*
|
---|
| 536 | * udp_can_snd -- ãã³ãã£ã³ã°ãã¦ããéä¿¡ã®ãã£ã³ã»ã«
|
---|
| 537 | */
|
---|
| 538 |
|
---|
| 539 | ER
|
---|
| 540 | udp_can_snd (T_UDP_CEP *cep, ER error)
|
---|
| 541 | {
|
---|
| 542 | if (cep->snd_tskid != TA_NULL) { /* éãã³ããããã³ã°ã³ã¼ã«ã§ãã³ãã£ã³ã°ä¸ */
|
---|
| 543 |
|
---|
| 544 | #ifdef UDP_CFG_EXTENTIONS
|
---|
| 545 |
|
---|
| 546 | /* å¾
|
---|
| 547 | ã¡ä¸ã«çºçããã¨ã©ã¼æ
|
---|
| 548 | å ±ãè¨å®ããã*/
|
---|
| 549 | cep->error = error;
|
---|
| 550 |
|
---|
| 551 | #endif /* of #ifdef UDP_CFG_EXTENTIONS */
|
---|
| 552 |
|
---|
| 553 | error = rel_wai(cep->snd_tskid);
|
---|
| 554 | cep->snd_tskid = TA_NULL;
|
---|
| 555 | }
|
---|
| 556 | else /* ã©ã¡ãã§ããªããªããã³ãã£ã³ã°ãã¦ããªã */
|
---|
| 557 | error = EV_NOPND;
|
---|
| 558 |
|
---|
| 559 | return error;
|
---|
| 560 | }
|
---|
| 561 |
|
---|
| 562 | #endif /* of #ifdef __udp_can_snd */
|
---|
| 563 |
|
---|
| 564 | #ifdef __udp_can_rcv
|
---|
| 565 |
|
---|
| 566 | /*
|
---|
| 567 | * udp_can_rcv -- ãã³ãã£ã³ã°ãã¦ããåä¿¡ã®ãã£ã³ã»ã«
|
---|
| 568 | */
|
---|
| 569 |
|
---|
| 570 | ER
|
---|
| 571 | udp_can_rcv (T_UDP_CEP *cep, ER error)
|
---|
| 572 | {
|
---|
| 573 | if (cep->rcv_tskid != TA_NULL) { /* éãã³ããããã³ã°ã³ã¼ã«ã§ãã³ãã£ã³ã°ä¸ */
|
---|
| 574 |
|
---|
| 575 | #ifdef UDP_CFG_EXTENTIONS
|
---|
| 576 |
|
---|
| 577 | /* å¾
|
---|
| 578 | ã¡ä¸ã«çºçããã¨ã©ã¼æ
|
---|
| 579 | å ±ãè¨å®ããã*/
|
---|
| 580 | cep->error = error;
|
---|
| 581 |
|
---|
| 582 | #endif /* of #ifdef UDP_CFG_EXTENTIONS */
|
---|
| 583 |
|
---|
| 584 | error = rel_wai(cep->rcv_tskid);
|
---|
| 585 | cep->rcv_tskid = TA_NULL;
|
---|
| 586 | }
|
---|
| 587 | else /* ã©ã¡ãã§ããªããªããã³ãã£ã³ã°ãã¦ããªã */
|
---|
| 588 | error = EV_NOPND;
|
---|
| 589 |
|
---|
| 590 | return error;
|
---|
| 591 | }
|
---|
| 592 |
|
---|
| 593 | #endif /* of #ifdef __udp_can_rcv */
|
---|
| 594 |
|
---|
| 595 | #ifdef __udp_snd_dat
|
---|
| 596 |
|
---|
| 597 | /*
|
---|
| 598 | * udp_snd_dat -- ãã±ããã®éä¿¡ãæ¨æºæ©è½ã
|
---|
| 599 | */
|
---|
| 600 |
|
---|
| 601 | ER_UINT
|
---|
| 602 | UDP_SND_DAT (ID cepid, T_IPEP *p_dstaddr, void *data, int_t len, TMO tmout)
|
---|
| 603 | {
|
---|
| 604 | T_UDP_CEP *cep;
|
---|
| 605 | ER error;
|
---|
| 606 |
|
---|
| 607 | /* p_dstaddr ã¾ã㯠data ã NULL ããtmout ã TMO_NBLK ãªãã¨ã©ã¼ */
|
---|
| 608 | if (p_dstaddr == NULL || data == NULL || tmout == TMO_NBLK)
|
---|
| 609 | return E_PAR;
|
---|
| 610 |
|
---|
| 611 | /* ãã¼ã¿é·ããã§ãã¯ããã*/
|
---|
| 612 | if (len < 0 || len + IP_HDR_SIZE + UDP_HDR_SIZE > IF_MTU)
|
---|
| 613 | return E_PAR;
|
---|
| 614 |
|
---|
| 615 | /* UDP éä¿¡ç«¯ç¹ ID ããã§ãã¯ããã*/
|
---|
| 616 | if (!VALID_UDP_CEPID(cepid))
|
---|
| 617 | return E_ID;
|
---|
| 618 |
|
---|
| 619 | /* UDP é信端ç¹ãå¾ãã*/
|
---|
| 620 | cep = GET_UDP_CEP(cepid);
|
---|
| 621 |
|
---|
| 622 | /* UDP é信端ç¹ããã§ãã¯ããã*/
|
---|
| 623 | if (!VALID_UDP_CEP(cep))
|
---|
| 624 | return E_NOEXS;
|
---|
| 625 |
|
---|
| 626 | /*
|
---|
| 627 | * èªãã¼ãçªå·ã UDP_PORTANY ãªããèªåã§å²ãå½ã¦ãã
|
---|
| 628 | */
|
---|
| 629 | if (cep->myaddr.portno == UDP_PORTANY) {
|
---|
| 630 | if ((error = udp_alloc_auto_port(cep)) != E_OK)
|
---|
| 631 | return error;
|
---|
| 632 | }
|
---|
| 633 |
|
---|
| 634 | /* é信端ç¹ãããã¯ããã*/
|
---|
| 635 | syscall(wai_sem(cep->semid_lock));
|
---|
| 636 |
|
---|
| 637 | if (cep->snd_tskid != TA_NULL) {
|
---|
| 638 |
|
---|
| 639 | /* éãã³ããããã³ã°ã³ã¼ã«ã§ãã³ãã£ã³ã°ä¸ */
|
---|
| 640 | error = E_QOVR;
|
---|
| 641 |
|
---|
| 642 | /* é信端ç¹ãããã¯ã解é¤ããã*/
|
---|
| 643 | syscall(sig_sem(cep->semid_lock));
|
---|
| 644 | }
|
---|
| 645 | else {
|
---|
| 646 | /* ç¾å¨ã®ã¿ã¹ã¯èå¥åãè¨é²ããã*/
|
---|
| 647 | get_tid(&(cep->snd_tskid));
|
---|
| 648 |
|
---|
| 649 | #ifdef UDP_CFG_EXTENTIONS
|
---|
| 650 |
|
---|
| 651 | /* å¾
|
---|
| 652 | ã¡ä¸ã«çºçããã¨ã©ã¼æ
|
---|
| 653 | å ±ããªã»ããããã*/
|
---|
| 654 | cep->error = E_OK;
|
---|
| 655 |
|
---|
| 656 | #endif /* of #ifdef UDP_CFG_EXTENTIONS */
|
---|
| 657 |
|
---|
| 658 | /* é信端ç¹ãããã¯ã解é¤ããã*/
|
---|
| 659 | syscall(sig_sem(cep->semid_lock));
|
---|
| 660 |
|
---|
| 661 | /* ãã±ãããéä¿¡ããã*/
|
---|
| 662 | error = udp_send_data(cep, p_dstaddr, data, len, tmout);
|
---|
| 663 |
|
---|
| 664 | #ifdef UDP_CFG_EXTENTIONS
|
---|
| 665 |
|
---|
| 666 | /* å¾
|
---|
| 667 | ã¡ä¸ã«çºçããã¨ã©ã¼æ
|
---|
| 668 | å ±ãè¿ãã*/
|
---|
| 669 | if (error == E_RLWAI)
|
---|
| 670 | error = cep->error;
|
---|
| 671 |
|
---|
| 672 | #endif /* of #ifdef UDP_CFG_EXTENTIONS */
|
---|
| 673 | }
|
---|
| 674 |
|
---|
| 675 | return error;
|
---|
| 676 | }
|
---|
| 677 |
|
---|
| 678 | #endif /* of #ifdef __udp_snd_dat */
|
---|
| 679 |
|
---|
| 680 | #ifdef __udp_rcv_dat
|
---|
| 681 |
|
---|
| 682 | /*
|
---|
| 683 | * udp_rcv_dat -- ãã±ããã®åä¿¡ãæ¨æºæ©è½ã
|
---|
| 684 | */
|
---|
| 685 |
|
---|
| 686 | ER_UINT
|
---|
| 687 | UDP_RCV_DAT (ID cepid, T_IPEP *p_dstaddr, void *data, int_t len, TMO tmout)
|
---|
| 688 | {
|
---|
| 689 | T_NET_BUF *input;
|
---|
| 690 | T_UDP_CEP *cep;
|
---|
| 691 | T_UDP_HDR *udph;
|
---|
| 692 | ER_UINT error;
|
---|
| 693 | uint_t ulen, uhoff;
|
---|
| 694 |
|
---|
| 695 | /* p_dstaddr ã¾ã㯠data ã NULL ãlen < 0 ããtmout ã TMO_NBLK ãªãã¨ã©ã¼ */
|
---|
| 696 | if (p_dstaddr == NULL || data == NULL || len < 0 || tmout == TMO_NBLK)
|
---|
| 697 | return E_PAR;
|
---|
| 698 |
|
---|
| 699 | /* UDP éä¿¡ç«¯ç¹ ID ããã§ãã¯ããã*/
|
---|
| 700 | if (!VALID_UDP_CEPID(cepid))
|
---|
| 701 | return E_ID;
|
---|
| 702 |
|
---|
| 703 | /* UDP é信端ç¹ãå¾ãã*/
|
---|
| 704 | cep = GET_UDP_CEP(cepid);
|
---|
| 705 |
|
---|
| 706 | /* UDP é信端ç¹ããã§ãã¯ããã*/
|
---|
| 707 | if (!VALID_UDP_CEP(cep))
|
---|
| 708 | return E_NOEXS;
|
---|
| 709 |
|
---|
| 710 | /* é信端ç¹ãããã¯ããã*/
|
---|
| 711 | syscall(wai_sem(cep->semid_lock));
|
---|
| 712 |
|
---|
| 713 | if (cep->rcv_tskid != TA_NULL) {
|
---|
| 714 |
|
---|
| 715 | /* éãã³ããããã³ã°ã³ã¼ã«ã§ãã³ãã£ã³ã°ä¸ */
|
---|
| 716 | error = E_QOVR;
|
---|
| 717 |
|
---|
| 718 | /* é信端ç¹ãããã¯ã解é¤ããã*/
|
---|
| 719 | syscall(sig_sem(cep->semid_lock));
|
---|
| 720 | }
|
---|
| 721 | else {
|
---|
| 722 |
|
---|
| 723 | /* ç¾å¨ã®ã¿ã¹ã¯èå¥åãè¨é²ããã*/
|
---|
| 724 | get_tid(&(cep->rcv_tskid));
|
---|
| 725 |
|
---|
| 726 | #ifdef UDP_CFG_EXTENTIONS
|
---|
| 727 |
|
---|
| 728 | /* å¾
|
---|
| 729 | ã¡ä¸ã«çºçããã¨ã©ã¼æ
|
---|
| 730 | å ±ããªã»ããããã*/
|
---|
| 731 | cep->error = E_OK;
|
---|
| 732 |
|
---|
| 733 | #endif /* of #ifdef UDP_CFG_EXTENTIONS */
|
---|
| 734 |
|
---|
| 735 | /* é信端ç¹ãããã¯ã解é¤ããã*/
|
---|
| 736 | syscall(sig_sem(cep->semid_lock));
|
---|
| 737 |
|
---|
| 738 | /* å
|
---|
| 739 | ¥åãããã¾ã§å¾
|
---|
| 740 | ã¤ã*/
|
---|
| 741 | if (cep->cb_netbuf != NULL) {
|
---|
| 742 |
|
---|
| 743 | /*
|
---|
| 744 | * ããã«ããå ´åã¯ãã³ã¼ã«ããã¯é¢æ°ã®ä¸ãã
|
---|
| 745 | * udp_rcv_dat ãå¼ã³åºãã¦ãããã¨ã«ãªãã
|
---|
| 746 | * ãã§ã«å
|
---|
| 747 | ¥åæ¸ã¿ã§ããã
|
---|
| 748 | */
|
---|
| 749 | input = cep->cb_netbuf;
|
---|
| 750 | cep->cb_netbuf = NULL;
|
---|
| 751 | }
|
---|
| 752 | else if ((error = trcv_dtq(cep->rcvqid, (intptr_t*)&input, tmout)) != E_OK) {
|
---|
| 753 |
|
---|
| 754 | #ifdef UDP_CFG_EXTENTIONS
|
---|
| 755 |
|
---|
| 756 | /* å¾
|
---|
| 757 | ã¡ä¸ã«çºçããã¨ã©ã¼æ
|
---|
| 758 | å ±ãè¿ãã*/
|
---|
| 759 | if (error == E_RLWAI)
|
---|
| 760 | error = cep->error;
|
---|
| 761 |
|
---|
| 762 | #endif /* of #ifdef UDP_CFG_EXTENTIONS */
|
---|
| 763 |
|
---|
| 764 | cep->rcv_tskid = TA_NULL;
|
---|
| 765 | return error;
|
---|
| 766 | }
|
---|
| 767 |
|
---|
| 768 | /* p_dstaddr ãè¨å®ããã*/
|
---|
| 769 | uhoff = (uint_t)GET_UDP_HDR_OFFSET(input);
|
---|
| 770 | udph = GET_UDP_HDR(input, uhoff);
|
---|
| 771 | p_dstaddr->portno = ntohs(udph->sport);
|
---|
| 772 | IN_COPY_TO_HOST(&p_dstaddr->ipaddr, &GET_IP_HDR(input)->src);
|
---|
| 773 |
|
---|
| 774 | /* ãã¼ã¿ããããã¡ã«ç§»ãã*/
|
---|
| 775 | ulen = ntohs(udph->ulen);
|
---|
| 776 | if (ulen - UDP_HDR_SIZE > len)
|
---|
| 777 | error = E_BOVR;
|
---|
| 778 | else {
|
---|
| 779 | len = (uint_t)(ulen - UDP_HDR_SIZE);
|
---|
| 780 | error = (ER_UINT)(ulen - UDP_HDR_SIZE);
|
---|
| 781 | }
|
---|
| 782 |
|
---|
| 783 | memcpy(data, GET_UDP_SDU(input, uhoff), (size_t)len);
|
---|
| 784 |
|
---|
| 785 | syscall(rel_net_buf(input));
|
---|
| 786 |
|
---|
| 787 | cep->rcv_tskid = TA_NULL;
|
---|
| 788 | }
|
---|
| 789 |
|
---|
| 790 | return error;
|
---|
| 791 | }
|
---|
| 792 |
|
---|
| 793 | #endif /* of #ifdef __udp_rcv_dat */
|
---|
| 794 |
|
---|
| 795 | #endif /* of #ifdef UDP_CFG_NON_BLOCKING */
|
---|
| 796 |
|
---|
| 797 | #endif /* of #ifdef SUPPORT_UDP */
|
---|