From 47d4bee63265257984db5a18e3b9ed9fdeec56b0 Mon Sep 17 00:00:00 2001 From: Radim Kolar Date: Fri, 5 Jun 2020 17:10:27 +0200 Subject: [PATCH] removed EXOS_IPC udp io code --- common/udp_io.c | 69 ------------------------------------------------- 1 file changed, 69 deletions(-) diff --git a/common/udp_io.c b/common/udp_io.c index fa127a2..f9c5fd8 100644 --- a/common/udp_io.c +++ b/common/udp_io.c @@ -18,7 +18,6 @@ #define SAVE_ERRNO(A) { int sav; sav = errno; A; errno = sav; } -#ifndef EXOS_IPC #include #include @@ -100,72 +99,4 @@ int _x_select (fd_set * rf, long tt) /* tt is in unit of ms */ return(select(FD_SETSIZE, rf, NULL, NULL , (struct timeval *) 0)); } -#endif /* not EXOS_IPC */ -#ifdef EXOS_IPC - -extern long rhost(); - -int _x_udp PROTO1(int *, port) -{ - struct sockaddr_in sin; int f; - - sin = INET_ZERO; - sin.sin_family = AF_INET; - sin.sin_port = htons((unsigned short) *port); - if((f = socket(SOCK_DGRAM, (struct sockproto *) 0, &sin, - SO_REUSEADDR)) == -1) - return(-1); - sin = INET_ZERO; - if(socketaddr(f,&sin) == -1) { - SAVE(((void) close(f))); - return(-1); - } - if(!*port) *port = ntohs((unsigned short) sin.sin_port); - return(f); -} - -int _x_adr PROTO3(char *, host, int, port, struct sockaddr_in *, his) -{ - char myhost[128]; - int f; - - *his = INET_ZERO; - if(!host) (void) gethostname(host = myhost,sizeof(myhost)); - - his->sin_family = AF_INET; - his->sin_port = htons((unsigned short) port); - - if((his->sin_addr.s_addr = rhost(&host)) == -1) return(-1); - - return(0); -} - -int _x_select PROTO2(unsigned int *, readfds, long, tt) -{ - int code; - long mask = *readfds; - - if(tt & 0xc0000000) tt = 0x3fffffff;/* It does not like 0x7fffffff. */ - - code = select(DSIZE, &mask, (long *) 0, tt); - - *readfds = mask; - - return(code); -} - -int recvfrom PROTO6(int, s, char *, msg, int, len, int, flags, - struct sockaddr_in *, from, int *, fromlen) -{ - return(receive(s,from,msg,len)); -} - -int sendto PROTO6(int, s, char *, msg, int, len, int, flags, - struct sockaddr_in *, to, int *, tolen) -{ - to->sin_family = AF_INET; - return(send(s,to,msg,len)); -} - -#endif /* EXOS_IPC */