libcom_tcp.h

Go to the documentation of this file.
00001 /******************************************************************************
00002 %   File    : libcom_tcp.h
00003 %*/
00004 /*
00005  * Copyright (C) 2006  SRI International
00006  *
00007  * This library is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU Lesser General Public
00009  * License as published by the Free Software Foundation; either
00010  * version 2.1 of the License, or (at your option) any later version.
00011  *
00012  * This library is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015  * Lesser General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU Lesser General Public
00018  * License along with this library; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
00020  *
00021  * SRI International: 333 Ravenswood Ave, Menlo Park, CA 94025
00022  */
00023 
00024 
00025 /* Make sure only loaded once... */
00026 #ifndef _LIBCOMTCP_H_INCLUDED
00027 #define _LIBCOMTCP_H_INCLUDED
00028 
00029 #ifdef __cplusplus
00030 extern "C" {
00031 #endif
00032 
00033 #ifdef IS_DLL
00034 #define EXTERN __declspec(dllexport)
00035 #else
00036 #define EXTERN extern
00037 #endif
00038 
00039 #ifndef MAX
00040 #define MAX(a,b) ((a) > (b) ? (a) : (b))
00041 #endif
00042 
00043   /* Requires libicl.h */
00044 #include "libicl.h"
00045 
00046 #ifndef _WINDOWS
00047   typedef int SOCKET;
00048 #else
00049 #include <winsock.h>
00050 #endif
00051 
00052   EXTERN SOCKET com_Connect(char *ConnectionId, ICLTerm *Address);
00053   EXTERN SOCKET comConnectFormat(char* ConnectionId, ICLTerm* Params,
00054                                ICLTerm* Address, int format);
00055   EXTERN int  com_Disconnect(char *ConnectionId);
00056   EXTERN int  com_ListenAt(char *ConnectionId, ICLTerm *Params, ICLTerm *Address);
00057   EXTERN int  com_SendData(char *ConnectionId, char *Data, int size);
00058   EXTERN int  com_SendTerm(char *ConnectionId, ICLTerm* term);
00059   EXTERN int  com_Select(char *ConnectionId, double TimeOut);
00060   EXTERN int  com_AddInfo(char *ConnectionId, ICLTerm *NewInfo);
00061   EXTERN int  com_UpdateInfo(char *ConnectionId, ICLTerm *NewInfo);
00062   EXTERN int  com_RemoveInfo(char *ConnectionId, ICLTerm *NewInfo);
00063   EXTERN int  com_GetInfo(char *ConnectionId, ICLTerm *GInfo,
00064                             ICLTerm **Result);
00065   EXTERN int      com_GetConnectionFromInfo(ICLTerm *Info, char** connectionName);
00066 
00067   EXTERN SOCKET com_Connected(char* ConnectionId);
00068   EXTERN int      com_GetAllValidConnections(ICLTerm** result);
00069 
00070   EXTERN int  com_GetConnectionId(char **ConnectionId, ICLTerm *GInfo);
00071   EXTERN char *com_GetDefaultConnectionId();
00072   EXTERN int com_SelectEvent(char* ConnectionId, double timeout, ICLTerm **event);
00073 
00074   EXTERN void cnx_CanonicalAddress(ICLTerm *address, SOCKET socket, ICLTerm **result);
00075 
00076   EXTERN int COM_BEST_FORMAT;
00077   EXTERN int COM_STRING_FORMAT;
00078   EXTERN int COM_BINARY_FORMAT;
00079 
00080   EXTERN int com_GetEventFromConnection(char *ConnectionId, double timeout, ICLTerm **event);
00081   EXTERN int com_SelectEventFromAllIds(double timeout, ICLTerm **event);
00082 
00083 #ifdef __cplusplus
00084 }
00085 #endif
00086 
00087 #endif

Generated on Wed May 23 17:20:11 2007 using doxygen 1.5.2