home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / tkisrc04.zip / tcl / os2 / tclOS2NoSock.c < prev    next >
C/C++ Source or Header  |  1998-08-07  |  5KB  |  209 lines

  1. /* 
  2.  * tclOS2NoSock.c --
  3.  *
  4.  *    This file contains stubs in absence of sockets.
  5.  *
  6.  * Copyright (c) 1995-1996 Sun Microsystems, Inc.
  7.  * Copyright (c) 1996-1997 Illya Vaes
  8.  *
  9.  * See the file "license.terms" for information on usage and redistribution
  10.  * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
  11.  *
  12.  */
  13.  
  14. #include "tclInt.h"
  15. #include "tclPort.h"
  16.  
  17.  
  18.  
  19. /*
  20.  *----------------------------------------------------------------------
  21.  *
  22.  * Tcl_OpenTcpClient --
  23.  *
  24.  *    Opens a TCP client socket and creates a channel around it.
  25.  *
  26.  * Results:
  27.  *    The channel or NULL if failed.  An error message is returned
  28.  *    in the interpreter on failure.
  29.  *
  30.  * Side effects:
  31.  *    Opens a client socket and creates a new channel.
  32.  *
  33.  *----------------------------------------------------------------------
  34.  */
  35.  
  36. Tcl_Channel
  37. Tcl_OpenTcpClient(interp, port, host, myaddr, myport, async)
  38.     Tcl_Interp *interp;            /* For error reporting; can be NULL. */
  39.     int port;                /* Port number to open. */
  40.     char *host;                /* Host on which to open port. */
  41.     char *myaddr;            /* Client-side address */
  42.     int myport;                /* Client-side port */
  43.     int async;                /* If nonzero, should connect
  44.                                          * client socket asynchronously. */
  45. {
  46.     return NULL;
  47. }
  48.  
  49. /*
  50.  *----------------------------------------------------------------------
  51.  *
  52.  * Tcl_OpenTcpServer --
  53.  *
  54.  *    Opens a TCP server socket and creates a channel around it.
  55.  *
  56.  * Results:
  57.  *    The channel or NULL if failed.  An error message is returned
  58.  *    in the interpreter on failure.
  59.  *
  60.  * Side effects:
  61.  *    Opens a server socket and creates a new channel.
  62.  *
  63.  *----------------------------------------------------------------------
  64.  */
  65.  
  66. Tcl_Channel
  67. Tcl_OpenTcpServer(interp, port, host, acceptProc, acceptProcData)
  68.     Tcl_Interp *interp;            /* For error reporting - may be
  69.                                          * NULL. */
  70.     int port;                /* Port number to open. */
  71.     char *host;                /* Name of local host. */
  72.     Tcl_TcpAcceptProc *acceptProc;    /* Callback for accepting connections
  73.                                          * from new clients. */
  74.     ClientData acceptProcData;        /* Data for the callback. */
  75. {
  76.     return NULL;
  77. }
  78.  
  79. /*
  80.  *----------------------------------------------------------------------
  81.  *
  82.  * TclOS2NotifySocket --
  83.  *
  84.  *    Set up event notifiers for any sockets that are being watched.
  85.  *    Also, clean up any sockets that are no longer being watched.
  86.  *
  87.  * Results:
  88.  *    None.
  89.  *
  90.  * Side effects:
  91.  *    Adds and removes asynch select handlers.
  92.  *
  93.  *----------------------------------------------------------------------
  94.  */
  95.  
  96. void
  97. TclOS2NotifySocket()
  98. {
  99.     return;
  100. }
  101.  
  102. /*
  103.  *----------------------------------------------------------------------
  104.  *
  105.  * TclHasSockets --
  106.  *
  107.  *    This function determines whether sockets are available on the
  108.  *    current system and returns an error in interp if they are not.
  109.  *    Note that interp may be NULL.
  110.  *
  111.  * Results:
  112.  *    Returns TCL_OK if the system supports sockets, or TCL_ERROR with
  113.  *    an error in interp.
  114.  *
  115.  * Side effects:
  116.  *    None.
  117.  *
  118.  *----------------------------------------------------------------------
  119.  */
  120.  
  121. int
  122. TclHasSockets(interp)
  123.     Tcl_Interp *interp;
  124. {
  125.     return TCL_ERROR;
  126. }
  127.  
  128. /*
  129.  *----------------------------------------------------------------------
  130.  *
  131.  * TclOS2SocketReady --
  132.  *
  133.  *    This function is invoked by Tcl_FileReady to check whether
  134.  *    the specified conditions are present on a socket.
  135.  *
  136.  * Results:
  137.  *    The return value is 0 if none of the conditions specified by
  138.  *    mask were true for socket the last time the system checked.
  139.  *    If any of the conditions were true, then the return value is a
  140.  *    mask of those that were true.
  141.  *
  142.  * Side effects:
  143.  *    None.
  144.  *
  145.  *----------------------------------------------------------------------
  146.  */
  147.  
  148. int
  149. TclOS2SocketReady(file, mask)
  150.     Tcl_File file;    /* File handle for a stream. */
  151.     int mask;            /* OR'ed combination of TCL_READABLE,
  152.                  * TCL_WRITABLE, and TCL_EXCEPTION:
  153.                  * indicates conditions caller cares about. */
  154. {
  155.     return 0;
  156. }
  157.  
  158. /*
  159.  *----------------------------------------------------------------------
  160.  *
  161.  * Tcl_GetHostName --
  162.  *
  163.  *    Returns the name of the local host.
  164.  *
  165.  * Results:
  166.  *    Returns a string containing the host name, or NULL on error.
  167.  *    The returned string must be freed by the caller.
  168.  *
  169.  * Side effects:
  170.  *    None.
  171.  *
  172.  *----------------------------------------------------------------------
  173.  */
  174.  
  175. char *
  176. Tcl_GetHostName()
  177. {
  178.     return (char *) NULL;
  179. }
  180.  
  181. /*
  182.  *----------------------------------------------------------------------
  183.  *
  184.  * TclOS2WatchSocket --
  185.  *
  186.  *    This function imlements the socket specific portion of the
  187.  *    Tcl_WatchFile function in the notifier.
  188.  *
  189.  * Results:
  190.  *    None.
  191.  *
  192.  * Side effects:
  193.  *    The watched socket will be placed into non-blocking mode, and
  194.  *    an entry on the asynch handler list will be created if necessary. 
  195.  *
  196.  *----------------------------------------------------------------------
  197.  */
  198.  
  199. void
  200. TclOS2WatchSocket(file, mask)
  201.     Tcl_File file;        /* Socket to watch. */
  202.     int mask;            /* OR'ed combination of TCL_READABLE,
  203.                  * TCL_WRITABLE, and TCL_EXCEPTION:
  204.                  * indicates conditions to wait for
  205.                  * in select. */
  206. {
  207.     return;
  208. }
  209.