rtxSocket.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2003-2010 Objective Systems, Inc.
00003  *
00004  * This software is furnished under a license and may be used and copied
00005  * only in accordance with the terms of such license and with the
00006  * inclusion of the above copyright notice. This software or any other
00007  * copies thereof may not be provided or otherwise made available to any
00008  * other person. No title to and ownership of the software is hereby
00009  * transferred.
00010  *
00011  * The information in this software is subject to change without notice
00012  * and should not be construed as a commitment by Objective Systems, Inc.
00013  *
00014  * PROPRIETARY NOTICE
00015  *
00016  * This software is an unpublished work subject to a confidentiality agreement
00017  * and is protected by copyright and trade secret law.  Unauthorized copying,
00018  * redistribution or other use of this work is prohibited.
00019  *
00020  * The above notice of copyright on this source code product does not indicate
00021  * any actual or intended publication of such source code.
00022  *
00023  *****************************************************************************/
00027 #ifndef _RTXSOCKET_H_
00028 #define _RTXSOCKET_H_
00029 
00030 #include "rtxsrc/osSysTypes.h"
00031 #include "rtxsrc/rtxExternDefs.h"
00032 
00033 #ifdef __cplusplus
00034 extern "C" {
00035 #endif
00036 
00037 #if defined (_WIN64) && !defined(__SYMBIAN32__)
00038 typedef unsigned __int64 OSRTSOCKET; 
00039 #elif defined (_WIN32) && !defined(__SYMBIAN32__)
00040 typedef unsigned int OSRTSOCKET; 
00041 #else
00042 typedef int OSRTSOCKET;          
00043 #endif
00044 
00045 #define OSRTSOCKET_INVALID ((OSRTSOCKET)-1)
00046 
00057 typedef unsigned long OSIPADDR;
00058 
00059 #define OSIPADDR_ANY   ((OSIPADDR)0)
00060 #define OSIPADDR_LOCAL ((OSIPADDR)0x7f000001UL) /* 127.0.0.1 */
00061 
00062 struct in_addr;
00063 
00083 EXTERNRT int rtxSocketAccept (OSRTSOCKET socket, OSRTSOCKET *pNewSocket,
00084                                OSIPADDR* destAddr, int* destPort);
00085 
00096 EXTERNRT int rtxSocketAddrToStr (OSIPADDR ipAddr, char* pbuf, size_t bufsize);
00097 
00111 EXTERNRT int rtxSocketBind (OSRTSOCKET socket, OSIPADDR addr, int port);
00112 
00121 EXTERNRT int rtxSocketClose (OSRTSOCKET socket);
00122 
00138 EXTERNRT int rtxSocketConnect (OSRTSOCKET socket, const char* host, int port);
00139 
00148 EXTERNRT int rtxSocketCreate (OSRTSOCKET* psocket);
00149 
00150 /*
00151  * This function creates a UDP socket.
00152  *
00153  * @param psocket    The Pointer to the socket handle variable to receive
00154  *                   the handle of the new socket.
00155  *
00156  * @return           0 upon success, < 0 upon failure. */
00157 EXTERNRT int rtxSocketCreateUDP (OSRTSOCKET *psocket);
00158 
00168 EXTERNRT int rtxSocketGetHost (const char* host, struct in_addr *inaddr);
00169 
00177 EXTERNRT int rtxSocketsInit ();
00178 
00194 EXTERNRT int rtxSocketListen (OSRTSOCKET socket, int maxConnection);
00195 
00211 EXTERNRT int rtxSocketParseURL
00212 (char* url, char** protocol, char** address, int* port);
00213 
00226 EXTERNRT int rtxSocketRecv (OSRTSOCKET socket, OSOCTET* pbuf, int bufsize);
00227 
00240 EXTERNRT int rtxSocketSend (OSRTSOCKET socket, const OSOCTET* pdata, int size);
00241 
00254 EXTERNRT int rtxSocketStrToAddr (const char* pIPAddrStr, OSIPADDR* pIPAddr);
00255 
00259 #ifdef __cplusplus
00260 }
00261 #endif
00262 
00263 #endif /* _RTXSOCKET_H_ */
00264