MOOS 0.2375
|
00001 /* 00002 * MOOSUDPLink.h 00003 * MOOS 00004 * 00005 * Created by pnewman on 16/05/2009. 00006 * Copyright 2009 Oxford University. All rights reserved. 00007 * 00008 */ 00009 00010 #ifndef MOOSUDPLINKH 00011 #define MOOSUDPLINKH 00012 00013 #include <MOOSLIB/XPCUdpSocket.h> 00014 #include <MOOSGenLib/MOOSThread.h> 00015 #include <MOOSLIB/MOOSMsg.h> 00016 #include <MOOSLIB/MOOSCommPkt.h> 00017 00018 00019 00020 class CMOOSUDPLink 00021 { 00022 public: 00023 CMOOSUDPLink(); 00024 bool Post(CMOOSMsg & M,const std::string & sRemoteHost,long int nRemotePort); 00025 bool Fetch(MOOSMSG_LIST & MailIn); 00026 bool Run(int nLocalPort=-1); 00027 bool ListenLoop(); 00028 00029 protected: 00030 bool ReadPktFromArray(unsigned char *Buff,int nBytes, CMOOSCommPkt& PktRx); 00031 00032 CMOOSThread m_ListenThread; 00033 CMOOSLock m_InLock; 00034 MOOSMSG_LIST m_InBox; 00035 00036 XPCUdpSocket * m_pUDPSocket; 00037 00038 00039 long m_nLocalPort; 00040 }; 00041 #endif 00042 00043