OPAL Version 3.10.4

- Main Page
- Related Pages
- Namespaces
- Data Structures
- Files

- File List
- Globals

regprocessor.h
Go to the documentation of this file.
1 /*
2 *
3 *
4 * Inter Asterisk Exchange 2
5 *
6 * A class to describe the node we are talking to.
7 *
8 * Open Phone Abstraction Library (OPAL)
9 *
10 * Copyright (c) 2005 Indranet Technologies Ltd.
11 *
12 * The contents of this file are subject to the Mozilla Public License
13 * Version 1.0 (the "License"); you may not use this file except in
14 * compliance with the License. You may obtain a copy of the License at
15 * http://www.mozilla.org/MPL/
16 *
17 * Software distributed under the License is distributed on an "AS IS"
18 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
19 * the License for the specific language governing rights and limitations
20 * under the License.
21 *
22 * The Original Code is Open Phone Abstraction Library.
23 *
24 * The Initial Developer of the Original Code is Indranet Technologies Ltd.
25 *
26 * The author of this code is Derek J Smithies
27 *
28 * $Revision: 24178 $
29 * $Author: rjongbloed $
30 * $Date: 2010-04-05 19:10:56 -0500 (Mon, 05 Apr 2010) $
31 */
32
33 #ifndef OPAL_IAX2_REGPROCESSOR_H
34 #define OPAL_IAX2_REGPROCESSOR_H
35
36 #ifndef _PTLIB_H
37 #include <ptlib.h>
38 #endif
39
40 #include <opal/buildopts.h>
41
42 #if OPAL_IAX2
43
44 #include <ptclib/random.h>
45 #include <opal/connection.h>
46
47 #include <iax2/frame.h>
48 #include <iax2/processor.h>
49 #include <iax2/iedata.h>
50 #include <iax2/remote.h>
51 #include <iax2/safestrings.h>
52 #include <iax2/sound.h>
53
54 class IAX2EndPoint;
55 class IAX2Connection;
56
57 class IAX2RegProcessor : public IAX2Processor
58 {
59 PCLASSINFO(IAX2RegProcessor, IAX2Processor);
60
61 public:
63 IAX2RegProcessor( IAX2EndPoint & ep,
64 const PString & host,
65 const PString & username,
66 const PString & password,
67 PINDEX inRegistrationRefreshTime
68 );
69
71 virtual ~IAX2RegProcessor();
72
76 void Unregister();
77
78 PString GetHost() const { return host; };
79 PString GetUserName() const { return userName; };
80 PString GetPassword() const { return password; };
81
82 protected:
83 PString host;
84 PString userName;
85 PString password;
86
87 INT registrationRefreshTime;
88
90 enum RegistrationState {
91 registrationStart = 1,
92 registrationHappening,
93 registrationUnregisterStart,
94 registrationUnregistering,
95 registrationUnregistered,
97 registrationWait
98 };
99
101 RegistrationState registrationState;
102
105 PMutex stateMutex;
106
107 #ifdef DOC_PLUS_PLUS
108
109 void OnDoRegistration(PTimer &, INT);
110 #else
111 PDECLARE_NOTIFIER(PTimer, IAX2RegProcessor, OnDoRegistration);
112 #endif
113
115 PTimer registrationTimer;
116
118 void ProcessIaxCmdRegAuth(IAX2FullFrameProtocol * src);
119
121 void ProcessIaxCmdRegAck(IAX2FullFrameProtocol * src);
122
124 void ProcessIaxCmdRegRej(IAX2FullFrameProtocol * src);
125
128 void ProcessIaxCmdUnRegAuth(IAX2FullFrameProtocol * src);
129
131 void ProcessIaxCmdUnRegAck(IAX2FullFrameProtocol * src);
132
134 void ProcessIaxCmdUnRegRej(IAX2FullFrameProtocol * src);
135
138 void OnNoResponseTimeout();
139
142 void PrintOn(ostream & strm) const;
143
145 virtual void ProcessLists();
146
149 virtual void ProcessFullFrame(IAX2FullFrame & fullFrame);
150
152 virtual void ProcessNetworkFrame(IAX2MiniFrame * src);
153
156 virtual PBoolean ProcessNetworkFrame(IAX2FullFrameProtocol * src);
157
163 void ResetCall();
164
171 virtual PBoolean IncomingMessageOutOfOrder(IAX2FullFrame *)
172 { return false; };
173
174
177 PRandom regRandom;
178 };
179
180
181 #endif // OPAL_IAX2
182
183 #endif // OPAL_IAX2_REGPROCESSOR_H