ooRexx  4.2.0-source
About: ooRexx (Open Object Rexx) is a free implementation of Object Rexx. Object Rexx is an enhancement of the classic Rexx interpreter; a full-featured programming language with a human-oriented syntax.
  Fossies Dox: ooRexx-4.2.0-source.tar.gz  ("inofficial" and yet experimental doxygen-generated source code documentation)  

rxsockfn.cpp
Go to the documentation of this file.
1 /*----------------------------------------------------------------------------*/
2 /* */
3 /* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */
4 /* Copyright (c) 2005-2009 Rexx Language Association. All rights reserved. */
5 /* */
6 /* This program and the accompanying materials are made available under */
7 /* the terms of the Common Public License v1.0 which accompanies this */
8 /* distribution. A copy is also available at the following address: */
9 /* http://www.oorexx.org/license.html */
10 /* */
11 /* Redistribution and use in source and binary forms, with or */
12 /* without modification, are permitted provided that the following */
13 /* conditions are met: */
14 /* */
15 /* Redistributions of source code must retain the above copyright */
16 /* notice, this list of conditions and the following disclaimer. */
17 /* Redistributions in binary form must reproduce the above copyright */
18 /* notice, this list of conditions and the following disclaimer in */
19 /* the documentation and/or other materials provided with the distribution. */
20 /* */
21 /* Neither the name of Rexx Language Association nor the names */
22 /* of its contributors may be used to endorse or promote products */
23 /* derived from this software without specific prior written permission. */
24 /* */
25 /* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
26 /* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
27 /* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS */
28 /* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT */
29 /* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */
30 /* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED */
31 /* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, */
32 /* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY */
33 /* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING */
34 /* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS */
35 /* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
36 /* */
37 /*----------------------------------------------------------------------------*/
38 /***************************************************************************/
39 /* REXX sockets function support rxsockfn.c */
40 /* sockets utility function package */
41 /***************************************************************************/
42 #ifdef HAVE_CONFIG_H
43 # include "config.h"
44 #endif
45 
46 #include <stdio.h>
47 #include <stdlib.h>
48 #include <string.h>
49 
50 #include <ctype.h>
51 #include <setjmp.h>
52 
53 /*------------------------------------------------------------------
54  * rexx includes
55  *------------------------------------------------------------------*/
56 # include "oorexxapi.h"
57 /*------------------------------------------------------------------
58  * tcp/ip includes
59  *------------------------------------------------------------------*/
60 #include <sys/types.h>
61 #include <errno.h>
62 
63 #if !defined(WIN32)
64 #include <netdb.h>
65 #include <netinet/in.h>
66 #include <arpa/inet.h>
67 # ifdef __APPLE__
68  // need to define this for Mac OSX 10.2
69 #define _BSD_SOCKLEN_T_
70 #endif
71 #include <sys/socket.h>
72 #include <sys/ioctl.h>
73 #include <sys/time.h>
74 #include <unistd.h>
75 
76 #if defined( HAVE_SYS_SELECT_H )
77 #include <sys/select.h>
78 #endif
79 #if defined( HAVE_SYS_FILIO_H )
80 #include <sys/filio.h>
81 #endif
82 #endif
83 
84 #if defined(WIN32) // define errno equivalents for windows
85  #define sock_errno() WSAGetLastError()
86  #define psock_errno(s) fprintf(stderr, "RxSOCK Error: %s\n", s)
87 #endif
88 
89 #if defined(OPSYS_AIX) || defined(OPSYS_LINUX)
90  #define sock_errno() errno
91  #define psock_errno(s) printf("\nSocket error %s\n",s)
92 #endif
93 
94 /*------------------------------------------------------------------
95  * include for this app
96  *------------------------------------------------------------------*/
97 #include "rxsock.h"
98 
99 /*-/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\-*/
100 //#if !defined(WIN32)
101 //extern int h_errno; // where is this used?
102 //#endif
103 /*-\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/-*/
104 
105 /*------------------------------------------------------------------
106  * sock_errno()
107  *------------------------------------------------------------------*/
108 RexxRoutine0(int, SockSock_Errno)
109 {
110  return sock_errno();
111 }
112 
113 
114 /*-/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\-*/
115 /*-\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/-*/
116 
117 /*------------------------------------------------------------------
118  * psock_errno()
119  *------------------------------------------------------------------*/
120 RexxRoutine1(CSTRING, SockPSock_Errno, OPTIONAL_CSTRING, type)
121 {
122  if (type == NULL)
123  {
124  type = "";
125  }
126  psock_errno(type);
127  return "";
128 }
129 
130 
131 /*-/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\-*/
132 /*-\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/-*/
133 
134 /*------------------------------------------------------------------------------
135  * accept()
136  *
137  * @remarks The sockAddrToStem() function calls both htons() and inet_ntoa().
138  * On Windows, one or both, of those functions sets errno back to 0.
139  * This prevents the Rexx programmer from ever seeing the errno if
140  * accept fails. Because of this, we call cleanup() immediately after
141  * the accept call in the belief that the Rexx programmer is more
142  * interested in the result of accept().
143 * ----------------------------------------------------------------------------*/
144 RexxRoutine2(int, SockAccept, int, sock, OPTIONAL_RexxObjectPtr, stemSource)
145 {
146  sockaddr_in addr;
147  socklen_t nameLen;
148 
149  nameLen = sizeof(addr);
150  int rc = accept(sock, (struct sockaddr *)&addr, &nameLen);
151 
152  // set the errno variables
153  cleanup(context);
154 
155  /*---------------------------------------------------------------
156  * set addr, if asked for
157  *---------------------------------------------------------------*/
158  if (stemSource != NULLOBJECT)
159  {
160  StemManager stem(context);
161 
162  if (!stem.resolveStem(stemSource))
163  {
164  return 0;
165  }
166  sockAddrToStem(context, &addr, stem);
167  }
168 
169  return rc;
170 }
171 
172 
173 /*-/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\-*/
174 /*-\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/-*/
175 
176 /*------------------------------------------------------------------
177  * bind()
178  *------------------------------------------------------------------*/
179 RexxRoutine2(int, SockBind, int, sock, RexxObjectPtr, stemSource)
180 {
181  StemManager stem(context);
182 
183  if (!stem.resolveStem(stemSource))
184  {
185  return 0;
186  }
187 
188  sockaddr_in addr;
189 
190  /*---------------------------------------------------------------
191  * get addr
192  *---------------------------------------------------------------*/
193  stemToSockAddr(context, stem, &addr);
194 
195  /*---------------------------------------------------------------
196  * call function
197  *---------------------------------------------------------------*/
198  int rc = bind(sock, (struct sockaddr *)&addr, sizeof(addr));
199  // make sure the errno variables are set
200  cleanup(context);
201  return rc;
202 }
203 
204 
205 /*-/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\-*/
206 /*-\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/-*/
207 
208 /*------------------------------------------------------------------
209  * close()
210  *------------------------------------------------------------------*/
211 RexxRoutine1(int, SockClose, int, sock)
212 {
213  /*---------------------------------------------------------------
214  * call function
215  *---------------------------------------------------------------*/
216 #if defined(WIN32)
217  int rc = closesocket(sock);
218 #else
219  int rc = close(sock);
220 #endif
221  // set the errno information
222  cleanup(context);
223 
224  return rc;
225 }
226 
227 /*-/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\-*/
228 /*-\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/-*/
229 
230 /*------------------------------------------------------------------
231  * connect()
232  *------------------------------------------------------------------*/
233 RexxRoutine2(int, SockConnect, int, sock, RexxObjectPtr, stemSource)
234 {
235  StemManager stem(context);
236 
237  if (!stem.resolveStem(stemSource))
238  {
239  return 0;
240  }
241 
242  sockaddr_in addr;
243 
244  /*---------------------------------------------------------------
245  * get addr
246  *---------------------------------------------------------------*/
247  stemToSockAddr(context, stem, &addr);
248 
249  /*---------------------------------------------------------------
250  * call function
251  *---------------------------------------------------------------*/
252  int rc = connect(sock,(struct sockaddr *)&addr, sizeof(addr));
253  // set the errno information
254  cleanup(context);
255 
256  return rc;
257 }
258 
259 /*-/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\-*/
260 /*-\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/-*/
261 
262 /*------------------------------------------------------------------
263  * gethostbyaddr()
264  *------------------------------------------------------------------*/
265 RexxRoutine3(int, SockGetHostByAddr, CSTRING, addrArg, RexxObjectPtr, stemSource, OPTIONAL_int, domain)
266 {
267  struct hostent *pHostEnt;
268  in_addr addr;
269 
270  StemManager stem(context);
271 
272  if (!stem.resolveStem(stemSource))
273  {
274  return 0;
275  }
276 
277  addr.s_addr = inet_addr(addrArg);
278 
279  if (argumentOmitted(3))
280  {
281  domain = AF_INET;
282  }
283 
284  /*---------------------------------------------------------------
285  * call function
286  *---------------------------------------------------------------*/
287  pHostEnt = gethostbyaddr((char*)&addr, sizeof(addr), domain);
288  // set the errno information
289  cleanup(context);
290 
291  if (!pHostEnt)
292  {
293  return 0;
294  }
295  else
296  {
297  hostEntToStem(context, pHostEnt, stem);
298  return 1;
299  }
300 }
301 
302 /*-/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\-*/
303 /*-\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/-*/
304 
305 /*------------------------------------------------------------------
306  * gethostbyname()
307  *------------------------------------------------------------------*/
308 RexxRoutine2(int, SockGetHostByName, CSTRING, name, RexxObjectPtr, stemSource)
309 {
310  StemManager stem(context);
311 
312  if (!stem.resolveStem(stemSource))
313  {
314  return 0;
315  }
316  struct hostent *pHostEnt;
317 
318  /*---------------------------------------------------------------
319  * call function
320  *---------------------------------------------------------------*/
321  pHostEnt = gethostbyname(name);
322  // set the errno information
323  cleanup(context);
324 
325  if (!pHostEnt)
326  {
327  return 0;
328  }
329  else
330  {
331  hostEntToStem(context, pHostEnt, stem);
332  return 1;
333  }
334 }
335 
336 /*-/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\-*/
337 /*-\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/-*/
338 
339 /*------------------------------------------------------------------
340  * gethostid()
341  *------------------------------------------------------------------*/
343 {
344  in_addr ia;
345 #ifdef WIN32
346  char pszBuff[64]; // buffer for ip address
347  PHOSTENT pHostEnt; // ptr to hostent structure
348  /*
349  * Retrieve my ip address. Assuming the hosts file in
350  * in %systemroot%/system/drivers/etc/hosts contains my computer name.
351  */ //get our name
352  if (gethostname(pszBuff, sizeof(pszBuff)))
353  {
354  // set the errno information
355  cleanup(context);
356  return context->String("0.0.0.0");
357  }
358  pHostEnt = gethostbyname(pszBuff); // get our ip address
359  if (!pHostEnt)
360  {
361  // set the errno information
362  cleanup(context);
363  return context->String("0.0.0.0");
364  }
365  ia.s_addr = (*(uint32_t *)pHostEnt->h_addr);// in network byte order already
366  return context->String(inet_ntoa(ia));
367 #else
368 #if defined(OPSYS_AIX) || defined(OPSYS_LINUX)
369 #define h_addr h_addr_list[0]
370 
371  char pszBuff[64]; /* buffer for ip address*/
372  struct hostent * pHostEnt; /* ptr to hostent structure*/
373 
374  /*get our name*/
375  if (gethostname(pszBuff, sizeof(pszBuff)))
376  {
377  // set the errno information
378  cleanup(context);
379  return context->String("0.0.0.0");
380  }
381  pHostEnt = gethostbyname(pszBuff); /* get our ip address */
382  // set the errno information
383  cleanup(context);
384  if (!pHostEnt)
385  {
386  return context->String("0.0.0.0");
387  }
388  ia.s_addr = (*(uint32_t *)pHostEnt->h_addr);// in network byte order already
389  return context->String(inet_ntoa(ia));
390 #else
391  ia.s_addr = htonl(gethostid());
392  // set the errno information
393  cleanup(context);
394  return context->String(inet_ntoa(ia));
395 #endif
396 #endif
397 }
398 
399 /*-/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\-*/
400 /*-\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/-*/
401 
402 /*------------------------------------------------------------------
403  * gethostname()
404  *------------------------------------------------------------------*/
406 {
407  char pszBuff[256]; /* host names are limited to 255 bytes */
408  *pszBuff = '\0';
409 
410  /*
411  * Assuming the hosts file in
412  * in %systemroot%/system/drivers/etc/hosts contains my computer name.
413  */
414  int rc = gethostname(pszBuff, sizeof(pszBuff));
415 
416  // set the errno information
417  cleanup(context);
418 
419  return context->String(pszBuff);
420 }
421 
422 /*-/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\-*/
423 /*-\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/-*/
424 
425 /*------------------------------------------------------------------
426  * getpeername()
427  *------------------------------------------------------------------*/
428 RexxRoutine2(int, SockGetPeerName, int, sock, RexxObjectPtr, stemSource)
429 {
430  StemManager stem(context);
431 
432  if (!stem.resolveStem(stemSource))
433  {
434  return 0;
435  }
436  sockaddr_in addr;
437  socklen_t nameLen;
438 
439  /*---------------------------------------------------------------
440  * call function
441  *---------------------------------------------------------------*/
442  nameLen = sizeof(addr);
443  int rc = getpeername(sock,(struct sockaddr *)&addr,&nameLen);
444 
445  // set the errno information
446  cleanup(context);
447 
448  /*---------------------------------------------------------------
449  * write address to stem
450  *---------------------------------------------------------------*/
451  sockAddrToStem(context, &addr, stem);
452 
453  /*---------------------------------------------------------------
454  * set return code
455  *---------------------------------------------------------------*/
456  return rc;
457 }
458 
459 /*-/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\-*/
460 /*-\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/-*/
461 
462 /*------------------------------------------------------------------
463  * getsockname()
464  *------------------------------------------------------------------*/
465 RexxRoutine2(int, SockGetSockName, int, sock, RexxObjectPtr, stemSource)
466 {
467  StemManager stem(context);
468 
469  if (!stem.resolveStem(stemSource))
470  {
471  return 0;
472  }
473  sockaddr_in addr;
474  socklen_t nameLen;
475 
476  /*---------------------------------------------------------------
477  * call function
478  *---------------------------------------------------------------*/
479  nameLen = sizeof(addr);
480  int rc = getsockname(sock,(struct sockaddr *)&addr,&nameLen);
481  // set the errno information
482  cleanup(context);
483 
484  /*---------------------------------------------------------------
485  * write address to stem
486  *---------------------------------------------------------------*/
487  sockAddrToStem(context, &addr, stem);
488 
489  /*---------------------------------------------------------------
490  * set return code
491  *---------------------------------------------------------------*/
492  return rc;
493 }
494 
495 /*-/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\-*/
496 /*-\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/-*/
497 
498 /*------------------------------------------------------------------
499  * getsockopt()
500  *------------------------------------------------------------------*/
501 RexxRoutine4(int, SockGetSockOpt, int, sock, CSTRING, level, CSTRING, option, CSTRING, var)
502 {
503  struct linger lingStruct;
504  socklen_t len;
505  void *ptr;
506  char buffer[30];
507 
508 
509  if (caselessCompare("SOL_SOCKET", level) != 0)
510  {
511  context->InvalidRoutine();
512  return 0;
513  }
514 
515  /*---------------------------------------------------------------
516  * get option name
517  *---------------------------------------------------------------*/
518  int opt = stringToSockOpt(option);
519 
520  /*---------------------------------------------------------------
521  * set up buffer
522  *---------------------------------------------------------------*/
523  int intVal = 0;
524 
525  switch (opt)
526  {
527  case SO_LINGER:
528  ptr = &lingStruct;
529  len = sizeof(lingStruct);
530  break;
531 
532  default:
533  ptr = &intVal;
534  len = sizeof(int);
535  }
536 
537  /*---------------------------------------------------------------
538  * make call
539  *---------------------------------------------------------------*/
540  int rc = getsockopt(sock,SOL_SOCKET,opt,(char *)ptr,&len);
541 
542  // set the errno information
543  cleanup(context);
544 
545  /*---------------------------------------------------------------
546  * set return value
547  *---------------------------------------------------------------*/
548  switch (opt)
549  {
550  case SO_LINGER:
551  sprintf(buffer,"%d %d", lingStruct.l_onoff, lingStruct.l_linger);
552  break;
553 
554  case SO_TYPE:
555  switch (intVal)
556  {
557  case SOCK_STREAM: strcpy(buffer,"STREAM"); break;
558  case SOCK_DGRAM: strcpy(buffer,"DGRAM"); break;
559  case SOCK_RAW: strcpy(buffer,"RAW"); break;
560  default: strcpy(buffer,"UNKNOWN");
561  }
562  break;
563 
564  default:
565  sprintf(buffer,"%d", intVal);
566  }
567 
568  // set the variable
569  context->SetContextVariable(var, context->String(buffer));
570  return rc;
571 }
572 
573 /*-/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\-*/
574 /*-\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/-*/
575 
576 /*------------------------------------------------------------------
577  * ioctl()
578  *------------------------------------------------------------------*/
579 RexxRoutine3(int, SockIoctl, int, sock, CSTRING, command, RexxObjectPtr, var)
580 {
581  int cmd = 0;
582  void *data;
583  int dataBuff;
584  int len;
585  int rc;
586 
587  if (!caselessCompare(command, "FIONBIO"))
588  {
589  cmd = FIONBIO;
590  int32_t temp;
591 
592  if (!context->Int32(var, &temp))
593  {
594  context->InvalidRoutine();
595  return 0;
596  }
597  dataBuff = (int)temp;
598  data = &dataBuff;
599  len = sizeof(int);
600  }
601  else if (!caselessCompare(command, "FIONREAD"))
602  {
603  cmd = FIONREAD;
604  data = &dataBuff;
605  len = sizeof(dataBuff);
606  }
607  else
608  {
609  return -1;
610  }
611 
612  /*---------------------------------------------------------------
613  * make call
614  *---------------------------------------------------------------*/
615 #ifdef WIN32
616  rc = ioctlsocket(sock,cmd,(u_long *)data);
617 #else
618  rc = ioctl(sock,cmd,data,len);
619 #endif
620 
621  // set the errno information
622  cleanup(context);
623 
624  /*---------------------------------------------------------------
625  * set output for FIONREAD
626  *---------------------------------------------------------------*/
627  if (cmd == FIONREAD)
628  {
629  context->SetContextVariable(context->ObjectToStringValue(var), context->Int32(dataBuff));
630  }
631 
632  return rc;
633 }
634 
635 /*-/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\-*/
636 /*-\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/-*/
637 
638 /*------------------------------------------------------------------
639  * listen()
640  *------------------------------------------------------------------*/
641 RexxRoutine2(int, SockListen, int, sock, int, backlog)
642 {
643  /*---------------------------------------------------------------
644  * call function
645  *---------------------------------------------------------------*/
646  int rc = listen(sock, backlog);
647 
648  // set the errno information
649  cleanup(context);
650  return rc;
651 }
652 
653 /*-/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\-*/
654 /*-\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/-*/
655 
656 /*------------------------------------------------------------------
657  * recv()
658  *------------------------------------------------------------------*/
659 RexxRoutine4(int, SockRecv, int, sock, CSTRING, var, int, dataLen, OPTIONAL_CSTRING, flagVal)
660 {
661  int flags;
662  long rc;
663  char *pBuffer;
664 
665  /*---------------------------------------------------------------
666  * get flags
667  *---------------------------------------------------------------*/
668  flags = 0;
669  if (flagVal != NULL)
670  {
671  char *flagStr = strdup(flagVal);
672  if (flagStr == NULL)
673  {
674  context->InvalidRoutine();
675  return 0;
676  }
677  const char *pszWord = strtok(flagStr, " ");
678  while (pszWord)
679  {
680  if (!caselessCompare(pszWord,"MSG_OOB")) flags |= MSG_OOB;
681  else if (!caselessCompare(pszWord,"MSG_PEEK")) flags |= MSG_PEEK;
682  pszWord = strtok(NULL," ");
683  }
684  free(flagStr);
685  }
686 
687  /*---------------------------------------------------------------
688  * allocate memory for data
689  *---------------------------------------------------------------*/
690  pBuffer = (char *)malloc(dataLen);
691  if (!pBuffer)
692  {
693  context->InvalidRoutine();
694  return 0;
695  }
696 
697  /*---------------------------------------------------------------
698  * call function
699  *---------------------------------------------------------------*/
700  rc = recv(sock, pBuffer, dataLen, flags);
701 
702  // set the errno information
703  cleanup(context);
704 
705  if (-1 == rc)
706  {
707  dataLen = 0;
708  }
709  else
710  {
711  dataLen = rc;
712  }
713 
714  context->SetContextVariable(var, context->String(pBuffer, dataLen));
715 
716  free(pBuffer);
717 
718  /*---------------------------------------------------------------
719  * set return code
720  *---------------------------------------------------------------*/
721  return rc;
722 }
723 
724 
725 /*-/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\-*/
726 /*-\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/-*/
727 
728 /*------------------------------------------------------------------
729  * recvfrom()
730  *------------------------------------------------------------------*/
731 RexxRoutine5(int, SockRecvFrom, int, sock, CSTRING, var, int, dataLen, RexxObjectPtr, flagArg, OPTIONAL_RexxObjectPtr, stemSource)
732 {
733  StemManager stem(context);
734  sockaddr_in addr;
735  socklen_t addr_size;
736 
737 
738  /*---------------------------------------------------------------
739  * get flags
740  *---------------------------------------------------------------*/
741  int flags = 0;
742  // if we have a 5th argument, then the 4th argument is a flag value
743  if (stemSource != NULL)
744  {
745  if (!stem.resolveStem(stemSource))
746  {
747  return 0;
748  }
749 
750  char *flagStr = strdup(context->ObjectToStringValue(flagArg));
751 
752  const char *pszWord = strtok(flagStr, " ");
753  while (pszWord)
754  {
755  if (!caselessCompare(pszWord,"MSG_OOB"))
756  {
757  flags |= MSG_OOB;
758  }
759  else if (!caselessCompare(pszWord,"MSG_PEEK"))
760  {
761  flags |= MSG_PEEK;
762  }
763  pszWord = strtok(NULL," ");
764  }
765  free(flagStr);
766  }
767  else
768  {
769  // the 4th argument is a stem variable
770  if (!stem.resolveStem(flagArg))
771  {
772  return 0;
773  }
774  }
775 
776  stemToSockAddr(context, stem, &addr);
777  addr_size=sizeof(addr);
778 
779  /*---------------------------------------------------------------
780  * allocate memory for data
781  *---------------------------------------------------------------*/
782  char *pBuffer = (char *)malloc(dataLen);
783  if (!pBuffer)
784  {
785  context->InvalidRoutine();
786  return 0;
787  }
788 
789  /*---------------------------------------------------------------
790  * call function
791  *---------------------------------------------------------------*/
792  int rc = recvfrom(sock,pBuffer,dataLen,flags,(struct sockaddr *)&addr,&addr_size);
793 
794  // set the errno information
795  cleanup(context);
796 
797  if (-1 == rc)
798  {
799  dataLen = 0;
800  }
801  else
802  {
803  dataLen = rc;
804  }
805 
806  sockAddrToStem(context, &addr, stem);
807 
808  context->SetContextVariable(var, context->String(pBuffer, dataLen));
809 
810  free(pBuffer);
811 
812  /*---------------------------------------------------------------
813  * set return code
814  *---------------------------------------------------------------*/
815  return rc;
816 }
817 
818 
819 
820 /*-/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\-*/
821 /*-\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/-*/
822 /*------------------------------------------------------------------
823  * select()
824  *------------------------------------------------------------------*/
825 RexxRoutine4(int, SockSelect, OPTIONAL_RexxObjectPtr, array1, OPTIONAL_RexxObjectPtr, array2, OPTIONAL_RexxObjectPtr, array3, OPTIONAL_int, timeout)
826 {
827  struct timeval timeOutS;
828  struct timeval *timeOutP;
829  int rCount = 0;
830  int wCount = 0;
831  int eCount = 0;
832  int *rArray = NULL;
833  int *wArray = NULL;
834  int *eArray = NULL;
835  int i;
836  int j;
837  int rc;
838 #if defined(OPSYS_LINUX)
839  fd_set rSetS, *rSet = &rSetS;
840  fd_set wSetS, *wSet = &wSetS;
841  fd_set eSetS, *eSet = &eSetS;
842 #else
843  struct fd_set rSetS, *rSet = &rSetS;
844  struct fd_set wSetS, *wSet = &wSetS;
845  struct fd_set eSetS, *eSet = &eSetS;
846 #endif
847  int max;
848 
849  /*---------------------------------------------------------------
850  * get timeout value
851  *---------------------------------------------------------------*/
852  if (argumentOmitted(4))
853  {
854  timeOutP = NULL;
855  }
856  else
857  {
858  if (timeout < 0)
859  {
860  timeout = 0;
861  }
862 
863  timeOutS.tv_sec = timeout;
864  timeOutS.tv_usec = 0;
865  timeOutP = &timeOutS;
866  }
867 
868  /*---------------------------------------------------------------
869  * get arrays of sockets
870  *---------------------------------------------------------------*/
871  stemToIntArray(context, array1, rCount, rArray);
872  stemToIntArray(context, array2, wCount, wArray);
873  stemToIntArray(context, array3, eCount, eArray);
874 
875 /*------------------------------------------------------------------
876  * unix-specific stuff
877  *------------------------------------------------------------------*/
878  /*---------------------------------------------------------------
879  * fill in fd_set's
880  *---------------------------------------------------------------*/
881  FD_ZERO(rSet);
882  FD_ZERO(wSet);
883  FD_ZERO(eSet);
884 
885  for (i=0; i<rCount; i++)
886  {
887  FD_SET(rArray[i],rSet);
888  }
889  for (i=0; i<wCount; i++)
890  {
891  FD_SET(wArray[i],wSet);
892  }
893  for (i=0; i<eCount; i++)
894  {
895  FD_SET(eArray[i],eSet);
896  }
897 
898  /*---------------------------------------------------------------
899  * get max number
900  *---------------------------------------------------------------*/
901  max = 0;
902  for (i=0; i<rCount; i++)
903  {
904  if (rArray[i] > max)
905  {
906  max = rArray[i];
907  }
908  }
909 
910  for (i=0; i<wCount; i++)
911  {
912  if (wArray[i] > max)
913  {
914  max = wArray[i];
915  }
916  }
917 
918  for (i=0; i<eCount; i++)
919  {
920  if (eArray[i] > max)
921  {
922  max = eArray[i];
923  }
924  }
925 
926  /*---------------------------------------------------------------
927  * make the call
928  *---------------------------------------------------------------*/
929  rc = select(max+1,rSet,wSet,eSet,timeOutP);
930 
931  // set the errno information
932  cleanup(context);
933 
934  /*---------------------------------------------------------------
935  * fix up the socket arrays
936  *---------------------------------------------------------------*/
937  if (rc != 0)
938  {
939  j = 0;
940  for (i=0; i<rCount; i++)
941  {
942  if (FD_ISSET(rArray[i],rSet))
943  {
944  rArray[j] = rArray[i];
945  j++;
946  }
947  }
948  rCount = j;
949 
950  j = 0;
951  for (i=0; i<wCount; i++)
952  {
953  if (FD_ISSET(wArray[i],wSet))
954  {
955  wArray[j] = wArray[i];
956  j++;
957  }
958  }
959  wCount = j;
960 
961  j = 0;
962  for (i=0; i<eCount; i++)
963  {
964  if (FD_ISSET(eArray[i],eSet))
965  {
966  eArray[j] = eArray[i];
967  j++;
968  }
969  }
970  eCount = j;
971  }
972 
973 
974  /*---------------------------------------------------------------
975  * reset the stem variables
976  *---------------------------------------------------------------*/
977  if (rArray)
978  {
979  intArrayToStem(context, array1, rCount, rArray);
980  }
981  if (wArray)
982  {
983  intArrayToStem(context, array2, wCount, wArray);
984  }
985  if (eArray)
986  {
987  intArrayToStem(context, array3, eCount, eArray);
988  }
989 
990  /*---------------------------------------------------------------
991  * free arrays
992  *---------------------------------------------------------------*/
993  if (rArray)
994  {
995  free(rArray);
996  }
997  if (wArray)
998  {
999  free(wArray);
1000  }
1001  if (eArray)
1002  {
1003  free(eArray);
1004  }
1005 
1006  /*---------------------------------------------------------------
1007  * set return code
1008  *---------------------------------------------------------------*/
1009  return rc;
1010 }
1011 
1012 /*-/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\-*/
1013 /*-\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/-*/
1014 
1015 /*------------------------------------------------------------------
1016  * send()
1017  *------------------------------------------------------------------*/
1018 RexxRoutine3(int, SockSend, int, sock, RexxStringObject, dataObj, OPTIONAL_CSTRING, flagArg)
1019 {
1020  /*---------------------------------------------------------------
1021  * get data length
1022  *---------------------------------------------------------------*/
1023  size_t dataLen = context->StringLength(dataObj);
1024  const char *data = context->StringData(dataObj);
1025 
1026  /*---------------------------------------------------------------
1027  * get flags
1028  *---------------------------------------------------------------*/
1029  int flags = 0;
1030  if (flagArg != NULL)
1031  {
1032  char *flagStr = strdup(flagArg);
1033  if (flagStr == NULL)
1034  {
1035  context->InvalidRoutine();
1036  return 0;
1037  }
1038 
1039  const char *pszWord = strtok(flagStr, " ");
1040  while (pszWord)
1041  {
1042  if (!caselessCompare(pszWord,"MSG_OOB"))
1043  {
1044  flags |= MSG_OOB;
1045  }
1046  else if (!caselessCompare(pszWord,"MSG_DONTROUTE"))
1047  {
1048  flags |= MSG_DONTROUTE;
1049  }
1050 
1051  pszWord = strtok(NULL," ");
1052  }
1053  free(flagStr);
1054  }
1055 
1056  /*---------------------------------------------------------------
1057  * call function
1058  *---------------------------------------------------------------*/
1059  int rc = send(sock,data,dataLen,flags);
1060 
1061  // set the errno information
1062  cleanup(context);
1063 
1064  /*---------------------------------------------------------------
1065  * set return code
1066  *---------------------------------------------------------------*/
1067  return rc;
1068 }
1069 
1070 /*-/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\-*/
1071 /*-\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/-*/
1072 
1073 /*------------------------------------------------------------------
1074  * sendto()
1075  *------------------------------------------------------------------*/
1076 RexxRoutine4(int, SockSendTo, int, sock, RexxStringObject, dataObj, RexxObjectPtr, flagsOrStem, OPTIONAL_RexxObjectPtr, stemSource)
1077 {
1078  StemManager stem(context);
1079 
1080  sockaddr_in addr;
1081 
1082  /*---------------------------------------------------------------
1083  * get data length
1084  *---------------------------------------------------------------*/
1085  int dataLen = context->StringLength(dataObj);
1086  const char *data = context->StringData(dataObj);
1087 
1088  /*---------------------------------------------------------------
1089  * get flags
1090  *---------------------------------------------------------------*/
1091  int flags = 0;
1092  if (stemSource != NULLOBJECT)
1093  {
1094  if (!stem.resolveStem(stemSource))
1095  {
1096  return 0;
1097  }
1098 
1099  char *flagStr = strdup(context->ObjectToStringValue(flagsOrStem));
1100  if (flagStr == NULL)
1101  {
1102  context->InvalidRoutine();
1103  return 0;
1104  }
1105 
1106  const char *pszWord = strtok(flagStr, " ");
1107  while (pszWord)
1108  {
1109  if (!caselessCompare(pszWord,"MSG_DONTROUTE"))
1110  {
1111  flags |= MSG_DONTROUTE;
1112  }
1113  pszWord = strtok(NULL," ");
1114  }
1115 
1116  }
1117  else
1118  {
1119  if (!stem.resolveStem(flagsOrStem))
1120  {
1121  return 0;
1122  }
1123  }
1124 
1125  stemToSockAddr(context, stem, &addr);
1126 
1127  /*---------------------------------------------------------------
1128  * call function
1129  *---------------------------------------------------------------*/
1130  int rc = sendto(sock,data,dataLen,flags,(struct sockaddr *)&addr,sizeof(addr));
1131 
1132  // set the errno information
1133  cleanup(context);
1134 
1135  /*---------------------------------------------------------------
1136  * set return code
1137  *---------------------------------------------------------------*/
1138  return rc;
1139 }
1140 
1141 /*-/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\-*/
1142 /*-\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/-*/
1143 /*------------------------------------------------------------------
1144  * setsockopt()
1145  *------------------------------------------------------------------*/
1146 RexxRoutine4(int, SockSetSockOpt, int, sock, CSTRING, target, CSTRING, option, CSTRING, arg)
1147 {
1148  struct linger lingStruct;
1149  int intVal;
1150  int intVal2;
1151  socklen_t lenVal;
1152  int len;
1153  void *ptr;
1154 
1155 
1156  if (caselessCompare("SOL_SOCKET", target))
1157  {
1158  context->InvalidRoutine();
1159  return 0;
1160  }
1161 
1162  /*---------------------------------------------------------------
1163  * get option name
1164  *---------------------------------------------------------------*/
1165  int opt = stringToSockOpt(option);
1166 
1167  /*---------------------------------------------------------------
1168  * get option value
1169  *---------------------------------------------------------------*/
1170  switch (opt)
1171  {
1172  default:
1173  ptr = &intVal;
1174  len = sizeof(int);
1175  sscanf(arg, "%d", &intVal);
1176  break;
1177 
1178  case SO_LINGER:
1179  ptr = &lingStruct;
1180  len = sizeof(lingStruct);
1181 
1182  sscanf(arg,"%d %d", &intVal,&intVal2);
1183  lingStruct.l_onoff = (u_short)intVal;
1184  lingStruct.l_linger = (u_short)intVal2;
1185 
1186  break;
1187 
1188  case SO_RCVBUF:
1189  case SO_SNDBUF:
1190  ptr = &lenVal;
1191  len = sizeof(lenVal);
1192 
1193  sscanf(arg, "%d", &lenVal);
1194  break;
1195 
1196  case SO_ERROR:
1197  case SO_TYPE:
1198  return -1;
1199  }
1200 
1201  /*---------------------------------------------------------------
1202  * make call
1203  *---------------------------------------------------------------*/
1204  int rc = setsockopt(sock,SOL_SOCKET,opt,(const char *)ptr,len);
1205 
1206  // set the errno information
1207  cleanup(context);
1208 
1209  /*---------------------------------------------------------------
1210  * set return code
1211  *---------------------------------------------------------------*/
1212  return rc;
1213 }
1214 
1215 /*-/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\-*/
1216 /*-\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/-*/
1217 
1218 /*------------------------------------------------------------------
1219  * shutdown()
1220  *------------------------------------------------------------------*/
1221 RexxRoutine2(int, SockShutDown, int, sock, int, how)
1222 {
1223  /*---------------------------------------------------------------
1224  * call function
1225  *---------------------------------------------------------------*/
1226  int rc = shutdown(sock, how);
1227 
1228  // set the errno information
1229  cleanup(context);
1230 
1231  /*---------------------------------------------------------------
1232  * set return code
1233  *---------------------------------------------------------------*/
1234  return rc;
1235 }
1236 
1237 /*-/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\-*/
1238 /*-\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/-*/
1239 
1240 /*------------------------------------------------------------------
1241  * sock_init()
1242  *------------------------------------------------------------------*/
1243 RexxRoutine0(int, SockInit)
1244 {
1245 #ifdef WIN32
1246  WORD wVersionRequested;
1247  WSADATA wsaData;
1248  wVersionRequested = MAKEWORD( 1, 1 );
1249  int rc = WSAStartup( wVersionRequested, &wsaData );
1250 #else
1251  int rc = 0;
1252 #endif
1253  // set the errno information
1254  cleanup(context);
1255 
1256  /*---------------------------------------------------------------
1257  * set return code
1258  *---------------------------------------------------------------*/
1259  return rc;
1260 }
1261 
1262 /*-/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\-*/
1263 /*-\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/-*/
1264 
1265 /*------------------------------------------------------------------
1266  * socket()
1267  *------------------------------------------------------------------*/
1268 RexxRoutine3(int, SockSocket, CSTRING, domainArg, CSTRING, typeArg, CSTRING, protocolArg)
1269 {
1270  int domain;
1271  int type;
1272  int protocol;
1273  char *pszDomain;
1274  char *pszType;
1275  char *pszProtocol;
1276 
1277  /*---------------------------------------------------------------
1278  * get parms
1279  *---------------------------------------------------------------*/
1280  pszDomain = strdup(domainArg);
1281  pszType = strdup(typeArg);
1282  pszProtocol = strdup(protocolArg);
1283 
1284  stripBlanks(pszDomain);
1285  stripBlanks(pszType);
1286  stripBlanks(pszProtocol);
1287 
1288  if (!caselessCompare(pszDomain,"AF_INET"))
1289  {
1290  domain = AF_INET;
1291  }
1292  else
1293  {
1294  context->InvalidRoutine();
1295  return 0;
1296  }
1297 
1298  if (!caselessCompare(pszType,"SOCK_STREAM")) type = SOCK_STREAM;
1299  else if (!caselessCompare(pszType,"SOCK_DGRAM" )) type = SOCK_DGRAM;
1300  else if (!caselessCompare(pszType,"SOCK_RAW" )) type = SOCK_RAW;
1301  else
1302  {
1303  context->InvalidRoutine();
1304  return 0;
1305  }
1306 
1307  if (!caselessCompare(pszProtocol,"IPPROTO_UDP"))
1308  protocol = IPPROTO_UDP;
1309  else if (!caselessCompare(pszProtocol,"IPPROTO_TCP"))
1310  protocol = IPPROTO_TCP;
1311  else if (!caselessCompare(pszProtocol,"0" ))
1312  protocol = 0;
1313  else
1314  {
1315  context->InvalidRoutine();
1316  return 0;
1317  }
1318 
1319  /*---------------------------------------------------------------
1320  * call function
1321  *---------------------------------------------------------------*/
1322  int rc = socket(domain,type,protocol);
1323  // set the errno information
1324  cleanup(context);
1325 
1326  /*---------------------------------------------------------------
1327  * set return code
1328  *---------------------------------------------------------------*/
1329  return rc;
1330 }
1331 
1332 /*-/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\-*/
1333 /*-\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/-*/
1334 
1335 /*------------------------------------------------------------------
1336  * soclose()
1337  *------------------------------------------------------------------*/
1338 RexxRoutine1(int, SockSoClose, int, sock)
1339 {
1340  /*---------------------------------------------------------------
1341  * call function
1342  *---------------------------------------------------------------*/
1343 #if defined(WIN32)
1344  int rc = closesocket(sock);
1345 #else
1346  int rc = close(sock);
1347 #endif
1348  // set the errno information
1349  cleanup(context);
1350  return rc;
1351 }
1352 
RexxRoutine2
RexxRoutine2(int, SockAccept, int, sock, OPTIONAL_RexxObjectPtr, stemSource)
Definition: rxsockfn.cpp:144
CSTRING
const typedef char * CSTRING
Definition: rexx.h:78
hostEntToStem
void hostEntToStem(RexxCallContext *context, struct hostent *pHostEnt, StemManager &stem)
Definition: rxsock.cpp:364
caselessCompare
int caselessCompare(const char *op1, const char *op2)
Definition: rxsock.cpp:108
StemManager
Definition: rxsock.h:114
type
int type
Definition: cmdparse.cpp:1965
cleanup
void cleanup(RexxCallContext *context)
Definition: rxsock.cpp:584
in_addr
struct in_addr in_addr
Definition: rxsock.h:49
stripBlanks
void stripBlanks(char *string)
Definition: rxsock.cpp:124
intArrayToStem
void intArrayToStem(RexxCallContext *context, RexxObjectPtr stemSource, int count, int *arr)
Definition: rxsock.cpp:232
RexxRoutine0
RexxRoutine0(int, SockSock_Errno)
Definition: rxsockfn.cpp:108
RexxRoutine3
RexxRoutine3(int, SockGetHostByAddr, CSTRING, addrArg, RexxObjectPtr, stemSource, OPTIONAL_int, domain)
Definition: rxsockfn.cpp:265
StemManager::resolveStem
bool resolveStem(RexxObjectPtr source)
Definition: rxsock.h:134
stemToSockAddr
void stemToSockAddr(RexxCallContext *context, StemManager &stem, sockaddr_in *pSockAddr)
Definition: rxsock.cpp:261
rxsock.h
RexxRoutine1
RexxRoutine1(CSTRING, SockPSock_Errno, OPTIONAL_CSTRING, type)
Definition: rxsockfn.cpp:120
sockAddrToStem
void sockAddrToStem(RexxCallContext *context, sockaddr_in *pSockAddr, StemManager &stem)
Definition: rxsock.cpp:343
oorexxapi.h
stringToSockOpt
int stringToSockOpt(const char *pszOptName)
Definition: rxsock.cpp:422
argumentOmitted
#define argumentOmitted(i)
Definition: oorexxapi.h:3694
sockaddr_in
struct sockaddr_in sockaddr_in
Definition: rxsock.h:48
RexxStringObject
struct _RexxStringObject * RexxStringObject
Definition: rexx.h:128
stemToIntArray
void stemToIntArray(RexxCallContext *context, RexxObjectPtr stemSource, int &count, int *&arr)
Definition: rxsock.cpp:173
NULLOBJECT
#define NULLOBJECT
Definition: rexx.h:147
RexxObjectPtr
struct _RexxObjectPtr * RexxObjectPtr
Definition: rexx.h:127
RexxRoutine4
RexxRoutine4(int, SockGetSockOpt, int, sock, CSTRING, level, CSTRING, option, CSTRING, var)
Definition: rxsockfn.cpp:501
RexxRoutine5
RexxRoutine5(int, SockRecvFrom, int, sock, CSTRING, var, int, dataLen, RexxObjectPtr, flagArg, OPTIONAL_RexxObjectPtr, stemSource)
Definition: rxsockfn.cpp:731