# regprocessor.h

Go to the documentation of this file.

    00001 #ifndef REGPROCESSOR_H
    00002 #define REGPROCESSOR_H
    00003
    00004 #ifndef _PTLIB_H
    00005 #include <ptlib.h>
    00006 #endif
    00007
    00008 #include <opal/buildopts.h>
    00009
    00010 #include <ptclib/random.h>
    00011 #include <opal/connection.h>
    00012
    00013 #include <iax2/frame.h>
    00014 #include <iax2/processor.h>
    00015 #include <iax2/iedata.h>
    00016 #include <iax2/remote.h>
    00017 #include <iax2/safestrings.h>
    00018 #include <iax2/sound.h>
    00019
    00020 class IAX2EndPoint;
    00021 class IAX2Connection;
    00022
    00023 class IAX2RegProcessor : public IAX2Processor
    00024 {
    00025   PCLASSINFO(IAX2RegProcessor, IAX2Processor);
    00026
    00027  public:
    00029   IAX2RegProcessor( IAX2EndPoint & ep,
    00030                     const PString & host,
    00031                     const PString & username,
    00032                     const PString & password,
    00033                     PINDEX inRegistrationRefreshTime
    00034                     );
    00035
    00037   virtual ~IAX2RegProcessor();
    00038
    00042   void Unregister();
    00043
    00044   PString GetHost() const { return host; };
    00045   PString GetUserName() const { return userName; };
    00046   PString GetPassword() const { return password; };
    00047
    00048  protected:
    00049   PString host;
    00050   PString userName;
    00051   PString password;
    00052
    00053   INT registrationRefreshTime;
    00054
    00056   enum RegistrationState {
    00057     registrationStart    =  1,
    00058     registrationHappening,
    00059     registrationUnregisterStart,
    00060     registrationUnregistering,
    00061     registrationUnregistered,
    00063     registrationWait
    00064   };
    00065
    00067   RegistrationState registrationState;
    00068
    00071   PMutex stateMutex;
    00072
    00073 #ifdef DOC_PLUS_PLUS
    00074
    00075   void OnDoRegistration(PTimer &, INT);
    00076 #else
    00077   PDECLARE_NOTIFIER(PTimer, IAX2RegProcessor, OnDoRegistration);
    00078 #endif
    00079
    00081   PTimer registrationTimer;
    00082
    00084   void ProcessIaxCmdRegAuth(IAX2FullFrameProtocol * src);
    00085
    00087   void ProcessIaxCmdRegAck(IAX2FullFrameProtocol * src);
    00088
    00090   void ProcessIaxCmdRegRej(IAX2FullFrameProtocol * src);
    00091
    00094   void ProcessIaxCmdUnRegAuth(IAX2FullFrameProtocol * src);
    00095
    00097   void ProcessIaxCmdUnRegAck(IAX2FullFrameProtocol * src);
    00098
    00100   void ProcessIaxCmdUnRegRej(IAX2FullFrameProtocol * src);
    00101
    00104   void OnNoResponseTimeout();
    00105
    00108   void PrintOn(ostream & strm) const;
    00109
    00111   virtual void ProcessLists();
    00112
    00115   virtual void ProcessFullFrame(IAX2FullFrame & fullFrame);
    00116
    00118   virtual void ProcessNetworkFrame(IAX2MiniFrame * src);
    00119
    00122   virtual PBoolean ProcessNetworkFrame(IAX2FullFrameProtocol * src);
    00123
    00129    void ResetCall();
    00130
    00137   virtual PBoolean IncomingMessageOutOfOrder(IAX2FullFrame *)
    00138        { return PFalse; };
    00139
    00140
    00143   PRandom regRandom;
    00144 };
    00145
    00146 #endif // REGPROCESSOR_H