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 |
std::ostream& operator<<(std::ostream&) const; |
31 |
}; |
32 |
|
33 |
Profile(); |
34 |
|
35 |
void setDefaultFrom(const NameAddr& from); |
36 |
void setDefaultRegistrationTime(int secs); |
37 |
|
38 |
void addSupportedScheme(const Data& scheme); |
39 |
void addSupportedMethod(const MethodTypes& method); |
40 |
void addSupportedOptionTags(const Token& tag); |
41 |
void addSupportedMimeType(const Mime& mimeType); |
42 |
void addSupportedEncoding(const Token& encoding); |
43 |
void addSupportedLanguage(const Token& lang); |
44 |
|
45 |
NameAddr& getDefaultFrom(); |
46 |
int getDefaultRegistrationTime(); |
47 |
int getDefaultSubscriptionTime(); |
48 |
|
49 |
bool isSchemeSupported(const Data& scheme); |
50 |
bool isMethodSupported(MethodTypes method); |
51 |
bool isMimeTypeSupported(const Mime& mimeType); |
52 |
bool isContentEncodingSupported(const Token& contentEncoding); |
53 |
bool isLanguageSupported(const Tokens& lang); |
54 |
|
55 |
// return the list of unsupported tokens from set of requires tokens |
56 |
Tokens isSupported(const Tokens& requires); |
57 |
Tokens getSupportedOptionTags(); |
58 |
Tokens getAllowedMethods(); |
59 |
Mimes getSupportedMimeTypes(); |
60 |
Tokens getSupportedEncodings(); |
61 |
Tokens getSupportedLanguages(); |
62 |
|
63 |
void addGruu(const Data& aor, const NameAddr& contact); |
64 |
bool hasGruu(const Data& aor); |
65 |
bool hasGruu(const Data& aor, const Data& instance); |
66 |
NameAddr& getGruu(const Data& aor); |
67 |
NameAddr& getGruu(const Data& aor, const NameAddr& contact); |
68 |
|
69 |
const NameAddr& getDefaultAor() const; |
70 |
|
71 |
void setOutboundProxy( const Uri& uri ); |
72 |
const NameAddr& getOutboundProxy() const; |
73 |
bool hasOutboundProxy() const; |
74 |
|
75 |
void disableGruu(); |
76 |
|
77 |
/// The following functions deal with getting digest credentals |
78 |
//@{ |
79 |
|
80 |
void addDigestCredential( const Data& aor, const Data& realm, const Data& user, const Data& password); |
81 |
|
82 |
/** This class is used as a callback to get digest crednetials. The |
83 |
* derived class must define one of computeA1 or getPaswword. computeA1 is |
84 |
* tried first and it it returns an empty string, then getPassword is |
85 |
* tried. */ |
86 |
class DigestCredentialHandler |
87 |
{ |
88 |
public: |
89 |
virtual Data computeA1( const Data& realm, const Data& users ); |
90 |
virtual Data getPassword( const Data& realm, const Data& users ); |
91 |
}; |
92 |
|
93 |
void setDigestHandler( DigestCredentialHandler* handler ); |
94 |
//@} |
95 |
|
96 |
DigestCredentialHandler* getDigestHandler(); |
97 |
const DigestCredential& getDigestCredential( const Data& realm ); |
98 |
const DigestCredential& getDigestCredential( const SipMessage& challenge ); |
99 |
|
100 |
private: |
101 |
NameAddr mDefaultFrom; |
102 |
int mDefaultRegistrationExpires; |
103 |
|
104 |
bool mHasOutboundProxy; |
105 |
NameAddr mOutboundProxy; |
106 |
|
107 |
std::set<Data> mSupportedSchemes; |
108 |
std::set<MethodTypes> mSupportedMethodTypes; |
109 |
Tokens mSupportedMethods; |
110 |
Tokens mSupportedOptionTags; |
111 |
Mimes mSupportedMimeTypes; |
112 |
Tokens mSupportedEncodings; |
113 |
Tokens mSupportedLanguages; |
114 |
|
115 |
DigestCredentialHandler* mDigestCredentialHandler; |
116 |
|
117 |
typedef std::set<DigestCredential> DigestCredentials; |
118 |
DigestCredentials mDigestCredentials; |
119 |
}; |
120 |
|
121 |
|
122 |
|
123 |
} |
124 |
|
125 |
#endif |