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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3360 - (hide 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 fluffy 2502 #if !defined(RESIP_PROFILE_HXX)
2     #define RESIP_PROFILE_HXX
3 fluffy 2490
4 jason 2941 #include <iosfwd>
5 jason 2727 #include <set>
6 davidb 2595 #include "resiprocate/Headers.hxx"
7 jason 2727 #include "resiprocate/MethodTypes.hxx"
8 davidb 2595
9 fluffy 2502 namespace resip
10     {
11 fluffy 2490
12 jason 2514 class Data;
13    
14 jason 2727 // !jf! will want to provide a default subclass of Profile that provides some
15     // good defaults for the Profile
16 fluffy 2486 class Profile
17     {
18 fluffy 2876 public:
19    
20 derek 2910 struct DigestCredential
21     {
22     DigestCredential();
23 jason 3150 DigestCredential(const Data& aor, const Data& realm, const Data& username, const Data& password);
24     Data aor;
25 derek 2910 Data realm;
26     Data user;
27     Data password;
28    
29     bool operator<(const DigestCredential& rhs) const;
30     };
31    
32 jason 2727 Profile();
33    
34 jason 3150 void setDefaultFrom(const NameAddr& from);
35 jason 2727 void setDefaultRegistrationTime(int secs);
36 sgodin 3360 void setDefaultSubscriptionTime(int secs);
37    
38     NameAddr& getDefaultFrom();
39     int getDefaultRegistrationTime();
40     int getDefaultSubscriptionTime();
41    
42 derek 3308 //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 jason 2727
51 sgodin 3354 void addSupportedScheme(const Data& scheme); // Default is "sip"
52     bool isSchemeSupported(const Data& scheme);
53     void clearSupportedSchemes(void);
54 jason 2727
55 sgodin 3354 void addSupportedMethod(const MethodTypes& method); // Defaults are: INVITE, ACK, CANCEL, OPTIONS, BYE
56 jason 2514 bool isMethodSupported(MethodTypes method);
57 sgodin 3354 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 jason 2514 bool isMimeTypeSupported(const Mime& mimeType);
67 sgodin 3354 Mimes getSupportedMimeTypes();
68     void clearSupportedMimeTypes(void);
69    
70     void addSupportedEncoding(const Token& encoding); // Default is no encoding
71 jason 2526 bool isContentEncodingSupported(const Token& contentEncoding);
72 sgodin 3354 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 jason 2526 bool isLanguageSupported(const Tokens& lang);
77 sgodin 3354 Tokens getSupportedLanguages();
78     void clearSupportedLanguages(void);
79 jason 2514
80 sgodin 3354 //enable/disable sending of Allow/Supported/Accept-Language/Accept-Encoding headers
81 sgodin 3323 //on initial outbound requests (ie. Initial INVITE, REGISTER, etc.) and Invite 200 responses
82 sgodin 3354 //Note: Default is to advertise Headers::Allow and Headers::Supported, use clearAdvertisedCapabilities to remove these
83     // Currently implemented header values are: Headers::Allow,
84 sgodin 3323 // Headers::AcceptEncoding, Headers::AcceptLanguage, Headers::Supported
85 sgodin 3319 void addAdvertisedCapability(const Headers::Type header);
86     bool isAdvertisedCapability(const Headers::Type header);
87     void clearAdvertisedCapabilities();
88    
89 jason 2621 void addGruu(const Data& aor, const NameAddr& contact);
90 jason 2611 bool hasGruu(const Data& aor);
91 jason 2621 bool hasGruu(const Data& aor, const Data& instance);
92 jason 2611 NameAddr& getGruu(const Data& aor);
93     NameAddr& getGruu(const Data& aor, const NameAddr& contact);
94    
95 jason 2871 void setOutboundProxy( const Uri& uri );
96     const NameAddr& getOutboundProxy() const;
97     bool hasOutboundProxy() const;
98    
99 jason 2558 void disableGruu();
100 fluffy 2501
101     /// The following functions deal with getting digest credentals
102     //@{
103 jason 3242 void setDigestCredential( const Data& aor, const Data& realm, const Data& user, const Data& password);
104 fluffy 2490
105 fluffy 2501 /** 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 fluffy 2490 class DigestCredentialHandler
110     {
111     public:
112 fluffy 2501 virtual Data computeA1( const Data& realm, const Data& users );
113     virtual Data getPassword( const Data& realm, const Data& users );
114 fluffy 2490 };
115    
116     void setDigestHandler( DigestCredentialHandler* handler );
117 fluffy 2501 //@}
118 jason 2611
119 fluffy 2870 DigestCredentialHandler* getDigestHandler();
120 fluffy 2876 const DigestCredential& getDigestCredential( const Data& realm );
121 derek 2983 const DigestCredential& getDigestCredential( const SipMessage& challenge );
122    
123 derek 3155 //defaults to false, turn on for VONAGE
124     bool& looseToTagMatching();
125     const bool looseToTagMatching() const;
126    
127 sgodin 3319 //enable/disable rport for requests. rport is enabled by default
128 derek 3233 bool& rportEnabled();
129 sgodin 3354 const bool rportEnabled() const;
130 derek 3233
131 sgodin 3354 //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 sgodin 3319 //if set then UserAgent header is added to outbound messages
144 derek 3289 void setUserAgent( const Data& userAgent );
145     const Data& getUserAgent() const;
146     bool hasUserAgent() const;
147    
148 fluffy 2490 private:
149 jason 3150 NameAddr mDefaultFrom;
150 jason 2727 int mDefaultRegistrationExpires;
151 sgodin 3360 int mDefaultSubscriptionExpires;
152 jason 2871
153     bool mHasOutboundProxy;
154     NameAddr mOutboundProxy;
155 jason 2727
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 sgodin 3319 std::set<Headers::Type> mAdvertisedCapabilities;
164 fluffy 2870
165     DigestCredentialHandler* mDigestCredentialHandler;
166 derek 3155
167     bool mLooseToTagMatching;
168 derek 3233 bool mRportEnabled;
169 sgodin 3354 bool mValidateContentEnabled;
170     bool mValidateContentLanguageEnabled;
171     bool mValidateAcceptEnabled;
172 derek 3289 bool mHasUserAgent;
173 fluffy 2870
174 derek 3308 Data mUserAgent;
175     Uri mOverrideHostPort;
176     bool mHasOverrideHostPort;
177 derek 3233
178 fluffy 2870 typedef std::set<DigestCredential> DigestCredentials;
179     DigestCredentials mDigestCredentials;
180 fluffy 2486 };
181 derek 3308
182 jason 3164 std::ostream&
183     operator<<(std::ostream&, const Profile::DigestCredential& cred);
184 fluffy 2502
185     }
186    
187     #endif

webmaster AT resiprocate DOT org
ViewVC Help
Powered by ViewVC 1.1.27