NTP.h

Go to the documentation of this file.
00001 //
00002 // Copyright 2004 Sony Corporation 
00003 //
00004 // Permission to use, copy, modify, and redistribute this software for
00005 // non-commercial use is hereby granted.
00006 //
00007 // This software is provided "as is" without warranty of any kind,
00008 // either expressed or implied, including but not limited to the
00009 // implied warranties of fitness for a particular purpose.
00010 //
00011 
00012 #ifndef NTP_h_DEFINED
00013 #define NTP_h_DEFINED
00014 
00015 #include <OPENR/OObject.h>
00016 #include <OPENR/OSubject.h>
00017 #include <OPENR/OObserver.h>
00018 #include "UDPConnection.h"
00019 #include "NTPConfig.h"
00020 #include "def.h"
00021 
00022 struct NTPMessage {
00023     longword data[12];
00024 };
00025 
00026 class NTP : public OObject {
00027 public:
00028     NTP();
00029     virtual ~NTP() {}
00030 
00031     OSubject*   subject[numOfSubject];
00032     OObserver*  observer[numOfObserver];     
00033 
00034     virtual OStatus DoInit   (const OSystemEvent& event);
00035     virtual OStatus DoStart  (const OSystemEvent& event);
00036     virtual OStatus DoStop   (const OSystemEvent& event);
00037     virtual OStatus DoDestroy(const OSystemEvent& event);
00038 
00039     void GetHostByNameCont(ANTENVMSG msg);
00040     void SendCont         (ANTENVMSG msg);
00041     void ReceiveCont      (ANTENVMSG msg);
00042 
00043 private:
00044     static const longword SECONDS_OF_100YEARS = 3155673600U;
00045 
00046     void GetHostByName(char* hostname);
00047     OStatus InitUDPBuffer();
00048     OStatus CreateUDPEndpoint();
00049     OStatus CloseUDPEndpoint();
00050     OStatus SendNTPPacket();
00051     OStatus Send   ();
00052     OStatus Receive();
00053 
00054     antStackRef    ipstackRef;
00055     antModuleRef   dnsEndpoint;
00056     UDPConnection  connection;
00057     char           ntpserver[128];
00058 };
00059 
00060 #endif // NTP_h_DEFINED

Generated on Sun Dec 2 23:04:30 2007 for openSDK by  doxygen 1.3.9.1