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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3242 - (show annotations) (download)
Tue Aug 10 21:45:22 2004 UTC (15 years, 4 months ago) by jason
Original Path: main/sip/resiprocate/dum/Profile.hxx
File size: 4312 byte(s)
change interface/impl to allow replacing existing digest credentials
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
37 void addSupportedScheme(const Data& scheme);
38 void addSupportedMethod(const MethodTypes& method);
39 void addSupportedOptionTags(const Token& tag);
40 void addSupportedMimeType(const Mime& mimeType);
41 void addSupportedEncoding(const Token& encoding);
42 void addSupportedLanguage(const Token& lang);
43
44 NameAddr& getDefaultFrom();
45 int getDefaultRegistrationTime();
46 int getDefaultSubscriptionTime();
47
48 bool isSchemeSupported(const Data& scheme);
49 bool isMethodSupported(MethodTypes method);
50 bool isMimeTypeSupported(const Mime& mimeType);
51 bool isContentEncodingSupported(const Token& contentEncoding);
52 bool isLanguageSupported(const Tokens& lang);
53
54 // return the list of unsupported tokens from set of requires tokens
55 Tokens isSupported(const Tokens& requires);
56 Tokens getSupportedOptionTags();
57 Tokens getAllowedMethods();
58 Mimes getSupportedMimeTypes();
59 Tokens getSupportedEncodings();
60 Tokens getSupportedLanguages();
61
62 void addGruu(const Data& aor, const NameAddr& contact);
63 bool hasGruu(const Data& aor);
64 bool hasGruu(const Data& aor, const Data& instance);
65 NameAddr& getGruu(const Data& aor);
66 NameAddr& getGruu(const Data& aor, const NameAddr& contact);
67
68 void setOutboundProxy( const Uri& uri );
69 const NameAddr& getOutboundProxy() const;
70 bool hasOutboundProxy() const;
71
72 void disableGruu();
73
74 /// The following functions deal with getting digest credentals
75 //@{
76 void setDigestCredential( const Data& aor, const Data& realm, const Data& user, const Data& password);
77
78 /** This class is used as a callback to get digest crednetials. The
79 * derived class must define one of computeA1 or getPaswword. computeA1 is
80 * tried first and it it returns an empty string, then getPassword is
81 * tried. */
82 class DigestCredentialHandler
83 {
84 public:
85 virtual Data computeA1( const Data& realm, const Data& users );
86 virtual Data getPassword( const Data& realm, const Data& users );
87 };
88
89 void setDigestHandler( DigestCredentialHandler* handler );
90 //@}
91
92 DigestCredentialHandler* getDigestHandler();
93 const DigestCredential& getDigestCredential( const Data& realm );
94 const DigestCredential& getDigestCredential( const SipMessage& challenge );
95
96 //defaults to false, turn on for VONAGE
97 bool& looseToTagMatching();
98 const bool looseToTagMatching() const;
99
100 //enable/disable rport for requests. rport is enabled by feault
101 bool& rportEnabled();
102 const bool rportEnabled() const;
103
104 private:
105 NameAddr mDefaultFrom;
106 int mDefaultRegistrationExpires;
107
108 bool mHasOutboundProxy;
109 NameAddr mOutboundProxy;
110
111 std::set<Data> mSupportedSchemes;
112 std::set<MethodTypes> mSupportedMethodTypes;
113 Tokens mSupportedMethods;
114 Tokens mSupportedOptionTags;
115 Mimes mSupportedMimeTypes;
116 Tokens mSupportedEncodings;
117 Tokens mSupportedLanguages;
118
119 DigestCredentialHandler* mDigestCredentialHandler;
120
121 bool mLooseToTagMatching;
122 bool mRportEnabled;
123
124
125 typedef std::set<DigestCredential> DigestCredentials;
126 DigestCredentials mDigestCredentials;
127 };
128
129 std::ostream&
130 operator<<(std::ostream&, const Profile::DigestCredential& cred);
131
132 }
133
134 #endif

webmaster AT resiprocate DOT org
ViewVC Help
Powered by ViewVC 1.1.27