WinSockNetEvents.h

Go to the documentation of this file.
00001 
00002 /*  $Id: WinSockNetEvents.h 1196 2006-04-05 21:50:20Z karstenw $    */
00003 
00004 /******************************************************************************
00005 
00006     UserLand Frontier(tm) -- High performance Web content management,
00007     object database, system-level and Internet scripting environment,
00008     including source code editing and debugging.
00009 
00010     Copyright (C) 1992-2004 UserLand Software, Inc.
00011 
00012     This program is free software; you can redistribute it and/or modify
00013     it under the terms of the GNU General Public License as published by
00014     the Free Software Foundation; either version 2 of the License, or
00015     (at your option) any later version.
00016 
00017     This program is distributed in the hope that it will be useful,
00018     but WITHOUT ANY WARRANTY; without even the implied warranty of
00019     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00020     GNU General Public License for more details.
00021 
00022     You should have received a copy of the GNU General Public License
00023     along with this program; if not, write to the Free Software
00024     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00025 
00026 ******************************************************************************/
00027 
00028 /*************************************************************************
00029 
00030 This file contains the Frontier NetEvents interface for the Windows
00031 version.  It uses the WinSock 1.1 specification.  Extensions should be 
00032 added for the 2.0 specification at a later date.  The primary advantage
00033 of the 2.x specification is that more then just the TCP/IP protocol is
00034 supported.  In fact many protocols are supported including the Apple
00035 Share protocol.
00036 
00037 
00038 Created 7/20/97 Robert Bierman
00039 
00040   General Note:  All addresses are in HOST format.  We convert to network
00041   format internally.
00042 
00043 **************************************************************************/
00044 
00045 /* Represent version 1.1 of the WinSock interface */
00046 
00047 #define WINSOCK_VERSION_MAJOR 1
00048 #define WINSOCK_VERSION_MINOR 1
00049 
00050 
00051 extern /*const*/ long maxconnections; /*7.0b37 PBS: referenced by system.environment set-up in langstartup.c*/
00052                                         /*7.1b2 RAB: removed const */
00053 
00054 /* Initialize the NetEvents system */
00055 //boolean fwsNetEventLaunch (void);
00056 
00057 /* Indicate if we are between a fwsNetEventLaunch and a fwsNetEventQuit */
00058 //boolean fwsNetEventIsRunning (void);
00059 
00060 /* shut down the NetEvents system */
00061 extern boolean fwsNetEventQuit (void);
00062 
00063 /* shut down the NetEvents system */
00064 /* This is for Frontier Internal use ONLY */
00065 extern boolean fwsNetEventShutDown (void);
00066 
00067 /* shutdown listeners whose daemon script lives in hdatabase */
00068 extern void fwsNetEventShutdownDependentListeners (long hdatabase);
00069 
00070 /* Convert an address (4 byte) into a dotted IP address */
00071 extern boolean fwsNetEventAddressDecode (unsigned long addr, bigstring IPaddr);
00072 
00073 /* Convert a dotted IP address into an address (4 byte) */
00074 extern boolean fwsNetEventAddressEncode (bigstring IPaddr, unsigned long  * addr);
00075 
00076 /* Convert an address (4 byte) into a domain name */
00077 extern boolean fwsNetEventAddressToName (unsigned long addr, bigstring domainName);
00078 
00079 /* Convert a domain name into an address (4 byte) */
00080 extern boolean fwsNetEventNameToAddress (bigstring domainName, unsigned long * addr);
00081 
00082 /* Get the hosts address */
00083 extern boolean fwsNetEventMyAddress (unsigned long * addr);
00084 
00085 
00086 /* Abort a stream and delete associated data */
00087 extern boolean fwsNetEventAbortStream (unsigned long stream);
00088 
00089 /* Close a stream and delete associated data */
00090 extern boolean fwsNetEventCloseStream (unsigned long stream);
00091 
00092 /* Open a stream and create associated data */
00093 extern boolean fwsNetEventOpenAddrStream (unsigned long addr, unsigned long port, unsigned long * stream);
00094 
00095 /* Open a stream and create associated data */
00096 extern boolean fwsNetEventOpenNameStream (bigstring name, unsigned long port, unsigned long * stream);
00097 
00098 /* Read from a stream */
00099 extern boolean fwsNetEventReadStream (unsigned long stream, unsigned long * bytesToRead, char * buffer);
00100 
00101 /* Write to a Stream */
00102 extern boolean fwsNetEventWriteStream (unsigned long stream, unsigned long bytesToWrite, char * buffer);
00103 
00104 /* Set up a listner on a port */
00105 // 2006-04-04 - kw --- removed parameter names
00106 // extern boolean fwsNetEventListenStream (unsigned long port, long depth, bigstring callback, unsigned long refcon, unsigned long * stream, unsigned long ipaddr, long hdatabase);
00107 extern boolean fwsNetEventListenStream (unsigned long, long, bigstring, unsigned long, unsigned long *, unsigned long, long);
00108 
00109 /* get the status of a stream */
00110 extern boolean fwsNetEventStatusStream (unsigned long stream, bigstring status, unsigned long * bytesPending);
00111 
00112 #ifdef WIN95VERSION
00113 /* Process an accept pending message on a socket */
00114 extern boolean fwsNetEventAcceptSocket (WPARAM wParam, LPARAM lParam);
00115 #endif
00116 
00117 #ifdef MACVERSION
00118 extern boolean fwsNetEventCheckAndAcceptSocket (void);
00119 #endif
00120 
00121 /* Close a listen and delete associated data */
00122 extern boolean fwsNetEventCloseListen (unsigned long stream);
00123 
00124 /* Get the peers address and port info */
00125 extern boolean fwsNetEventGetPeerAddress (unsigned long stream, unsigned long * peeraddress, unsigned long * peerport);
00126 
00127 /* Read from stream until pattern is found or timeout */
00128 extern boolean fwsNetEventReadStreamUntil (unsigned long stream, Handle hbuffer, Handle hpattern, unsigned long timeoutsecs);
00129 
00130 /* Read ctbytes bytes from stream or timeout */
00131 extern boolean fwsNetEventReadStreamBytes (unsigned long stream, Handle hbuffer, long ctbytes, unsigned long timeoutsecs);
00132 
00133 /* Read from stream until connection is closed or timeout */
00134 extern boolean fwsNetEventReadStreamUntilClosed (unsigned long stream, Handle hbuffer, unsigned long timeoutsecs);
00135 
00136 /* Write to stream using a blocking socket, retry until done */
00137 extern boolean fwsNetEventWriteHandleToStream (unsigned long stream, Handle hbuffer, unsigned long chunksize, unsigned long timeoutsecs);
00138 
00139 /* Write a file to stream using a blocking socket, retry until done */
00140 //#if 0
00141 extern boolean fwsNetEventWriteFileToStream (unsigned long stream, Handle hprefix, Handle hsuffix, ptrfilespec fs);
00142 //#endif
00143 
00144 /* Special read function for inetdsupervisor */
00145 extern boolean fwsNetEventInetdRead (unsigned long stream, Handle hbuffer, unsigned long timeoutsecs);
00146 
00147 extern boolean fwsNetEventGetStats (unsigned long stream, bigstring bs);
00148 
00149 extern long fwsNetEventGetConnectionCount (void); /*7.0b37 PBS*/

Generated on Wed May 31 18:20:04 2006 for frontierkernel 10.1.10a by  doxygen 1.4.6