00001 /** 00002 * @file Platform/Aperios1.3.2/IPEndpoint.h 00003 * 00004 * @author <A href=mailto:robocup@m-wachter.de>Michael Wachter</A> 00005 */ 00006 00007 #ifndef _IPEndpoint_H_ 00008 #define _IPEndpoint_H_ 00009 00010 #include <ant.h> 00011 #include <EndpointTypes.h> 00012 #include <IPAddress.h> 00013 #include "ProcessFramework.h" 00014 00015 00016 /** 00017 * @class IPEndpoint 00018 * This class is used to encapsule ANT library entpoints. Its used as a base-class for 00019 * TCPEndpoint and UDPEndpoint. 00020 */ 00021 00022 class IPEndpoint 00023 { 00024 00025 public: 00026 /** Constructor 00027 * @param sbs The size of the send-buffer. The send-buffer is shared memory between the process 00028 * and Aperios. You can only send data with this size at once. 00029 * @param rbs The size of the receive-buffer. Its also shared memory and you can only receive this 00030 * much data in one call of receiveCont 00031 */ 00032 IPEndpoint(int sbs = 16384, int rbs = 16384); 00033 ~IPEndpoint(); 00034 00035 /** called by the processFramework if someone connects to a listen port */ 00036 virtual void listenCont(antEnvMsg* msg) {}; 00037 00038 /** called by the processFramework if data was send. */ 00039 virtual void sendCont(antEnvMsg* msg) {}; 00040 00041 /** called by the processFramework if new data arrives */ 00042 virtual void receiveCont(antEnvMsg* msg) {}; 00043 00044 /** called by the processFreamwork after a close */ 00045 virtual void closeCont(antEnvMsg* msg) {}; 00046 00047 /** called by the processFramework after connecting */ 00048 virtual void connectCont(antEnvMsg* msg){}; 00049 00050 00051 protected: 00052 antModuleRef endpoint; /**< ANT Library Endpoint */ 00053 antSharedBuffer sendBuffer; /**< ANT buffer for sending */ 00054 byte* sharedSendBuffer; /**< Pointer to the data */ 00055 int sharedSendBufferSize; /**< size of the sendBuffer */ 00056 int sharedReceiveBufferSize; /**< size of the receiveBuffer */ 00057 00058 antSharedBuffer receiveBuffer; /**< ANT buffer for receiving */ 00059 byte* sharedReceiveBuffer; /**< pointer to the data received */ 00060 00061 //*{ 00062 /** 00063 * Pointers to the entry-point selectors in the process-framework 00064 * Need to be pointers because an IPEndpoint can be created before 00065 * the entry-points are created 00066 */ 00067 00068 int* listenContSelector; 00069 int* sendContSelector; 00070 int* receiveContSelector; 00071 int* closeContSelector; 00072 int* connectContSelector; 00073 //*} 00074 00075 antStackRef ipStackRef; /**< handle to comminicate to the ip-stack (ANT library */ 00076 OID* myOID_; /**< Object id of this process */ 00077 00078 }; 00079 00080 Out& operator<<(Out& stream, const IPAddress& ipAddress); 00081 00082 #endif // _IPEndpoint_H_ 00083 00084 /* 00085 * Change log : 00086 * 00087 * $Log: IPEndpoint.h,v $ 00088 * Revision 1.2 2004/09/12 20:10:47 wachter 00089 * Documentation-fixes 00090 * 00091 * Revision 1.1.1.1 2004/05/22 17:23:25 cvsadm 00092 * created new repository GT2004_WM 00093 * 00094 * Revision 1.7 2004/01/26 13:44:07 wachter 00095 * shared-memory-buffers now have variable sizes 00096 * 00097 * Revision 1.6 2004/01/09 13:57:23 wachter 00098 * Addes streaming-operator for Open-R IPAddress 00099 * 00100 * Revision 1.5 2004/01/03 16:18:24 wachter 00101 * debug-communication mostly working now 00102 * 00103 * Revision 1.4 2003/12/21 19:27:02 wachter 00104 * Added classes for Sender/Receiver over TCP and UDP. 00105 * ( PLEASE DO NOT USE THIS NOW ! ) 00106 * 00107 * Revision 1.3 2003/12/03 14:21:52 wachter 00108 * Splitted IPEndpoint.* 00109 * 00110 * Revision 1.2 2003/12/02 20:52:41 wachter 00111 * Added IP-networking to aperios process-framework. 00112 * 00113 * Revision 1.1 2003/11/29 23:01:06 wachter 00114 * idea of an ip-implementation in the process-framework 00115 * 00116 */