# regprocessor.h

Go to the documentation of this file.

    00001 /*
    00002  *
    00003  *
    00004  * Inter Asterisk Exchange 2
    00005  *
    00006  * A class to describe the node we are talking to.
    00007  *
    00008  * Open Phone Abstraction Library (OPAL)
    00009  *
    00010  * Copyright (c) 2005 Indranet Technologies Ltd.
    00011  *
    00012  * The contents of this file are subject to the Mozilla Public License
    00013  * Version 1.0 (the "License"); you may not use this file except in
    00014  * compliance with the License. You may obtain a copy of the License at
    00015  * http://www.mozilla.org/MPL/
    00016  *
    00017  * Software distributed under the License is distributed on an "AS IS"
    00018  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
    00019  * the License for the specific language governing rights and limitations
    00020  * under the License.
    00021  *
    00022  * The Original Code is Open Phone Abstraction Library.
    00023  *
    00024  * The Initial Developer of the Original Code is Indranet Technologies Ltd.
    00025  *
    00026  * The author of this code is Derek J Smithies
    00027  *
    00028  * $Revision: 27997 $
    00029  * $Author: rjongbloed $
    00030  * $Date: 2012-07-10 22:23:17 -0500 (Tue, 10 Jul 2012) $
    00031  */
    00032
    00033 #ifndef OPAL_IAX2_REGPROCESSOR_H
    00034 #define OPAL_IAX2_REGPROCESSOR_H
    00035
    00036 #ifndef _PTLIB_H
    00037 #include <ptlib.h>
    00038 #endif
    00039
    00040 #include <opal/buildopts.h>
    00041
    00042 #if OPAL_IAX2
    00043
    00044 #include <ptclib/random.h>
    00045 #include <opal/connection.h>
    00046
    00047 #include <iax2/frame.h>
    00048 #include <iax2/processor.h>
    00049 #include <iax2/iedata.h>
    00050 #include <iax2/remote.h>
    00051 #include <iax2/safestrings.h>
    00052 #include <iax2/sound.h>
    00053
    00054 class IAX2EndPoint;
    00055 class IAX2Connection;
    00056
    00057 class IAX2RegProcessor : public IAX2Processor
    00058 {
    00059   PCLASSINFO(IAX2RegProcessor, IAX2Processor);
    00060
    00061  public:
    00063   IAX2RegProcessor( IAX2EndPoint & ep,
    00064                     const PString & host,
    00065                     const PString & username,
    00066                     const PString & password,
    00067                     PINDEX inRegistrationRefreshTime
    00068                     );
    00069
    00071   virtual ~IAX2RegProcessor();
    00072
    00076   void Unregister();
    00077
    00078   PString GetHost() const { return host; };
    00079   PString GetUserName() const { return userName; };
    00080   PString GetPassword() const { return password; };
    00081
    00082  protected:
    00083   PString host;
    00084   PString userName;
    00085   PString password;
    00086
    00087   unsigned registrationRefreshTime;
    00088
    00090   enum RegistrationState {
    00091     registrationStart    =  1,
    00092     registrationHappening,
    00093     registrationUnregisterStart,
    00094     registrationUnregistering,
    00095     registrationUnregistered,
    00097     registrationWait
    00098   };
    00099
    00101   RegistrationState registrationState;
    00102
    00105   PMutex stateMutex;
    00106
    00107 #ifdef DOC_PLUS_PLUS
    00108
    00109   void OnDoRegistration(PTimer &, INT);
    00110 #else
    00111   PDECLARE_NOTIFIER(PTimer, IAX2RegProcessor, OnDoRegistration);
    00112 #endif
    00113
    00115   PTimer registrationTimer;
    00116
    00118   void ProcessIaxCmdRegAuth(IAX2FullFrameProtocol * src);
    00119
    00121   void ProcessIaxCmdRegAck(IAX2FullFrameProtocol * src);
    00122
    00124   void ProcessIaxCmdRegRej(IAX2FullFrameProtocol * src);
    00125
    00128   void ProcessIaxCmdUnRegAuth(IAX2FullFrameProtocol * src);
    00129
    00131   void ProcessIaxCmdUnRegAck(IAX2FullFrameProtocol * src);
    00132
    00134   void ProcessIaxCmdUnRegRej(IAX2FullFrameProtocol * src);
    00135
    00138   void OnNoResponseTimeout();
    00139
    00142   void PrintOn(ostream & strm) const;
    00143
    00145   virtual void ProcessLists();
    00146
    00149   virtual void ProcessFullFrame(IAX2FullFrame & fullFrame);
    00150
    00152   virtual void ProcessNetworkFrame(IAX2MiniFrame * src);
    00153
    00156   virtual PBoolean ProcessNetworkFrame(IAX2FullFrameProtocol * src);
    00157
    00163    void ResetCall();
    00164
    00171   virtual PBoolean IncomingMessageOutOfOrder(IAX2FullFrame *)
    00172        { return false; };
    00173
    00174
    00177   PRandom regRandom;
    00178 };
    00179
    00180
    00181 #endif // OPAL_IAX2
    00182
    00183 #endif // OPAL_IAX2_REGPROCESSOR_H