/[resiprocate]/main/resip/dum/Profile.hxx
ViewVC logotype

Contents of /main/resip/dum/Profile.hxx

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3360 - (show annotations) (download)
Thu Sep 30 12:41:33 2004 UTC (15 years, 2 months ago) by sgodin
Original Path: main/sip/resiprocate/dum/Profile.hxx
File size: 6855 byte(s)
Cleanup up use of Profile settings for default
Subscription/Regisration time.
Allow times to be overridden in make request API's.
1 #if !defined(RESIP_PROFILE_HXX)
2 #define RESIP_PROFILE_HXX
3
4 #include <iosfwd>
5 #include <set>
6 #include "resiprocate/Headers.hxx"
7 #include "resiprocate/MethodTypes.hxx"
8
9 namespace resip
10 {
11
12 class Data;
13
14 // !jf! will want to provide a default subclass of Profile that provides some
15 // good defaults for the Profile
16 class Profile
17 {
18 public:
19
20 struct DigestCredential
21 {
22 DigestCredential();
23 DigestCredential(const Data& aor, const Data& realm, const Data& username, const Data& password);
24 Data aor;
25 Data realm;
26 Data user;
27 Data password;
28
29 bool operator<(const DigestCredential& rhs) const;
30 };
31
32 Profile();
33
34 void setDefaultFrom(const NameAddr& from);
35 void setDefaultRegistrationTime(int secs);
36 void setDefaultSubscriptionTime(int secs);
37
38 NameAddr& getDefaultFrom();
39 int getDefaultRegistrationTime();
40 int getDefaultSubscriptionTime();
41
42 //overrides the value used to populate the contact
43 //?dcm? -- also change via entries? Also, dum currently uses(as a uas)
44 //the request uri of the dialog constructing request for the local contact
45 //within that dialog. A transport paramter here could also be used to
46 //force tcp vs udp vs tls?
47 void setOverrideHostAndPort(const Uri& hostPort);
48 bool hasOverrideHostAndPort() const;
49 const Uri& getOverideHostAndPort() const;
50
51 void addSupportedScheme(const Data& scheme); // Default is "sip"
52 bool isSchemeSupported(const Data& scheme);
53 void clearSupportedSchemes(void);
54
55 void addSupportedMethod(const MethodTypes& method); // Defaults are: INVITE, ACK, CANCEL, OPTIONS, BYE
56 bool isMethodSupported(MethodTypes method);
57 Tokens getAllowedMethods();
58 void clearSupportedMethods(void);
59
60 void addSupportedOptionTag(const Token& tag); // Default is none
61 Tokens getUnsupportedOptionsTags(const Tokens& requires); // Returns list of unsupported option tags
62 Tokens getSupportedOptionTags();
63 void clearSupportedOptionTags(void);
64
65 void addSupportedMimeType(const Mime& mimeType); // Default is application/sdp
66 bool isMimeTypeSupported(const Mime& mimeType);
67 Mimes getSupportedMimeTypes();
68 void clearSupportedMimeTypes(void);
69
70 void addSupportedEncoding(const Token& encoding); // Default is no encoding
71 bool isContentEncodingSupported(const Token& contentEncoding);
72 Tokens getSupportedEncodings();
73 void clearSupportedEncodings(void);
74
75 void addSupportedLanguage(const Token& lang); // Default is all - if nothing is set, then all are allowed
76 bool isLanguageSupported(const Tokens& lang);
77 Tokens getSupportedLanguages();
78 void clearSupportedLanguages(void);
79
80 //enable/disable sending of Allow/Supported/Accept-Language/Accept-Encoding headers
81 //on initial outbound requests (ie. Initial INVITE, REGISTER, etc.) and Invite 200 responses
82 //Note: Default is to advertise Headers::Allow and Headers::Supported, use clearAdvertisedCapabilities to remove these
83 // Currently implemented header values are: Headers::Allow,
84 // Headers::AcceptEncoding, Headers::AcceptLanguage, Headers::Supported
85 void addAdvertisedCapability(const Headers::Type header);
86 bool isAdvertisedCapability(const Headers::Type header);
87 void clearAdvertisedCapabilities();
88
89 void addGruu(const Data& aor, const NameAddr& contact);
90 bool hasGruu(const Data& aor);
91 bool hasGruu(const Data& aor, const Data& instance);
92 NameAddr& getGruu(const Data& aor);
93 NameAddr& getGruu(const Data& aor, const NameAddr& contact);
94
95 void setOutboundProxy( const Uri& uri );
96 const NameAddr& getOutboundProxy() const;
97 bool hasOutboundProxy() const;
98
99 void disableGruu();
100
101 /// The following functions deal with getting digest credentals
102 //@{
103 void setDigestCredential( const Data& aor, const Data& realm, const Data& user, const Data& password);
104
105 /** This class is used as a callback to get digest crednetials. The
106 * derived class must define one of computeA1 or getPaswword. computeA1 is
107 * tried first and it it returns an empty string, then getPassword is
108 * tried. */
109 class DigestCredentialHandler
110 {
111 public:
112 virtual Data computeA1( const Data& realm, const Data& users );
113 virtual Data getPassword( const Data& realm, const Data& users );
114 };
115
116 void setDigestHandler( DigestCredentialHandler* handler );
117 //@}
118
119 DigestCredentialHandler* getDigestHandler();
120 const DigestCredential& getDigestCredential( const Data& realm );
121 const DigestCredential& getDigestCredential( const SipMessage& challenge );
122
123 //defaults to false, turn on for VONAGE
124 bool& looseToTagMatching();
125 const bool looseToTagMatching() const;
126
127 //enable/disable rport for requests. rport is enabled by default
128 bool& rportEnabled();
129 const bool rportEnabled() const;
130
131 //enable/disable content validation
132 bool& validateContentEnabled();
133 const bool validateContentEnabled() const;
134
135 //enable/disable content language validation
136 bool& validateContentLanguageEnabled();
137 const bool validateContentLanguageEnabled() const;
138
139 //enable/disable Accept header validation
140 bool& validateAcceptEnabled();
141 const bool validateAcceptEnabled() const;
142
143 //if set then UserAgent header is added to outbound messages
144 void setUserAgent( const Data& userAgent );
145 const Data& getUserAgent() const;
146 bool hasUserAgent() const;
147
148 private:
149 NameAddr mDefaultFrom;
150 int mDefaultRegistrationExpires;
151 int mDefaultSubscriptionExpires;
152
153 bool mHasOutboundProxy;
154 NameAddr mOutboundProxy;
155
156 std::set<Data> mSupportedSchemes;
157 std::set<MethodTypes> mSupportedMethodTypes;
158 Tokens mSupportedMethods;
159 Tokens mSupportedOptionTags;
160 Mimes mSupportedMimeTypes;
161 Tokens mSupportedEncodings;
162 Tokens mSupportedLanguages;
163 std::set<Headers::Type> mAdvertisedCapabilities;
164
165 DigestCredentialHandler* mDigestCredentialHandler;
166
167 bool mLooseToTagMatching;
168 bool mRportEnabled;
169 bool mValidateContentEnabled;
170 bool mValidateContentLanguageEnabled;
171 bool mValidateAcceptEnabled;
172 bool mHasUserAgent;
173
174 Data mUserAgent;
175 Uri mOverrideHostPort;
176 bool mHasOverrideHostPort;
177
178 typedef std::set<DigestCredential> DigestCredentials;
179 DigestCredentials mDigestCredentials;
180 };
181
182 std::ostream&
183 operator<<(std::ostream&, const Profile::DigestCredential& cred);
184
185 }
186
187 #endif

webmaster AT resiprocate DOT org
ViewVC Help
Powered by ViewVC 1.1.27