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

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 3607 by sgodin, Tue Nov 23 21:17:30 2004 UTC revision 3613 by jason, Wed Nov 24 01:03:05 2004 UTC
# Line 11  Line 11 
11    
12  class Data;  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  class Profile
17  {  {
18     public:             public:        
       Profile(Profile *baseProfile = 0);  // Default to no base profile  
19                
20        virtual void setDefaultRegistrationTime(int secs);        struct DigestCredential
21        virtual int getDefaultRegistrationTime() const;        {
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        virtual void setDefaultSubscriptionTime(int secs);        void setDefaultFrom(const NameAddr& from);
35        virtual int getDefaultSubscriptionTime() const;        NameAddr& getDefaultFrom();
36    
37          void setDefaultRegistrationTime(int secs);
38          int getDefaultRegistrationTime() const;
39    
40          void setDefaultSubscriptionTime(int secs);
41          int getDefaultSubscriptionTime() const;
42    
43        // Only used if timer option tag is set.        // Only used if timer option tag is set.
44        // Note:  Add timer to options tag and set DefaultSessionTime to 0 to show          // Note:  Add timer to options tag and set DefaultSessionTime to 0 to show  
45        // support, but not request a session timer.        // support, but not request a session timer.
46        virtual void setDefaultSessionTime(int secs);        void setDefaultSessionTime(int secs);
47        virtual int getDefaultSessionTime() const;        int getDefaultSessionTime() const;
48    
49        /// Call is stale if UAC gets no final response within the stale call timeout (default 3 minutes)        /// Call is stale if UAC gets no final response within the stale call timeout (default 3 minutes)
50        virtual void setDefaultStaleCallTime(int secs);        void setDefaultStaleCallTime(int secs);
51        virtual int getDefaultStaleCallTime() const;        int getDefaultStaleCallTime() const;
52    
53        //overrides the value used to populate the contact        //overrides the value used to populate the contact
54        //?dcm? -- also change via entries? Also, dum currently uses(as a uas)        //?dcm? -- also change via entries? Also, dum currently uses(as a uas)
55        //the request uri of the dialog constructing request for the local contact        //the request uri of the dialog constructing request for the local contact
56        //within that dialog. A transport paramter here could also be used to        //within that dialog. A transport paramter here could also be used to
57        //force tcp vs udp vs tls?        //force tcp vs udp vs tls?
58        virtual void setOverrideHostAndPort(const Uri& hostPort);        void setOverrideHostAndPort(const Uri& hostPort);
59        virtual bool hasOverrideHostAndPort() const;        bool hasOverrideHostAndPort() const;
60        virtual const Uri& getOverideHostAndPort() const;              const Uri& getOverideHostAndPort() const;      
61    
62          void addSupportedScheme(const Data& scheme);          // Default is "sip"
63          bool isSchemeSupported(const Data& scheme) const;
64          void clearSupportedSchemes(void);
65    
66          void addSupportedMethod(const MethodTypes& method);   // Defaults are: INVITE, ACK, CANCEL, OPTIONS, BYE
67          bool isMethodSupported(MethodTypes method) const;
68          Tokens getAllowedMethods() const;
69          void clearSupportedMethods(void);
70    
71          void addSupportedOptionTag(const Token& tag);        // Default is none
72          Tokens getUnsupportedOptionsTags(const Tokens& requires); // Returns list of unsupported option tags
73          Tokens getSupportedOptionTags() const;
74          void clearSupportedOptionTags(void);
75    
76          void addSupportedMimeType(const Mime& mimeType);      // Default is application/sdp
77          bool isMimeTypeSupported(const Mime& mimeType) const;
78          Mimes getSupportedMimeTypes() const;
79          void clearSupportedMimeTypes(void);
80    
81          void addSupportedEncoding(const Token& encoding);     // Default is no encoding
82          bool isContentEncodingSupported(const Token& contentEncoding) const;
83          Tokens getSupportedEncodings() const;
84          void clearSupportedEncodings(void);
85    
86          void addSupportedLanguage(const Token& lang);         // Default is all - if nothing is set, then all are allowed
87          bool isLanguageSupported(const Tokens& lang) const;
88          Tokens getSupportedLanguages() const;
89    
90          void clearSupportedLanguages(void);
91                
92            //enable/disable sending of Allow/Supported/Accept-Language/Accept-Encoding headers            //enable/disable sending of Allow/Supported/Accept-Language/Accept-Encoding headers
93            //on initial outbound requests (ie. Initial INVITE, REGISTER, etc.) and Invite 200 responses            //on initial outbound requests (ie. Initial INVITE, REGISTER, etc.) and Invite 200 responses
94            //Note:  Default is to advertise Headers::Allow and Headers::Supported, use clearAdvertisedCapabilities to remove these            //Note:  Default is to advertise Headers::Allow and Headers::Supported, use clearAdvertisedCapabilities to remove these
95            //       Currently implemented header values are: Headers::Allow,            //       Currently implemented header values are: Headers::Allow,
96            //       Headers::AcceptEncoding, Headers::AcceptLanguage, Headers::Supported            //       Headers::AcceptEncoding, Headers::AcceptLanguage, Headers::Supported
97            virtual void addAdvertisedCapability(const Headers::Type header);            void addAdvertisedCapability(const Headers::Type header);
98        virtual bool isAdvertisedCapability(const Headers::Type header) const;        bool isAdvertisedCapability(const Headers::Type header) const;
99            virtual void clearAdvertisedCapabilities();            void clearAdvertisedCapabilities();
100          
101        virtual void setOutboundProxy( const Uri& uri );        void addGruu(const Data& aor, const NameAddr& contact);
102        virtual const NameAddr& getOutboundProxy() const;        bool hasGruu(const Data& aor) const;
103        virtual bool hasOutboundProxy() const;        bool hasGruu(const Data& aor, const Data& instance) const;
104          NameAddr& getGruu(const Data& aor);
105          NameAddr& getGruu(const Data& aor, const NameAddr& contact);
106          void disableGruu();
107          
108          void setOutboundProxy( const Uri& uri );
109          const NameAddr& getOutboundProxy() const;
110          bool hasOutboundProxy() const;
111          
112          void setUAName(const Data& name);
113          const Data& getUAName() const;
114    
115          /// The following functions deal with getting digest credentals
116          //@{
117          void setDigestCredential( const Data& aor, const Data& realm, const Data& user, const Data& password);
118          
119          /** This class is used as a callback to get digest crednetials. The
120           * derived class must define one of computeA1 or getPaswword. computeA1 is
121           * tried first and it it returns an empty string, then getPassword is
122           * tried. */
123          class DigestCredentialHandler
124          {
125             public:
126                virtual Data computeA1( const Data& realm, const Data& users );
127                virtual Data getPassword( const Data& realm, const Data& users );
128          };
129          
130          void setDigestHandler( DigestCredentialHandler* handler );
131          //@}
132          
133          DigestCredentialHandler* getDigestHandler();
134          const DigestCredential& getDigestCredential( const Data& realm );
135          const DigestCredential& getDigestCredential( const SipMessage& challenge );      
136                
137        //defaults to false, turn on for VONAGE        //defaults to false, turn on for VONAGE
138        virtual void setLooseToTagMatching(bool enabled);        bool& looseToTagMatching();      
139        virtual bool getLooseToTagMatching() const;              const bool looseToTagMatching() const;      
140    
141        //enable/disable rport for requests. rport is enabled by default        //enable/disable rport for requests. rport is enabled by default
142        virtual void setRportEnabled(bool enabled);        bool& rportEnabled();      
143        virtual bool getRportEnabled() const;              const bool rportEnabled() const;
144    
145          //enable/disable content validation
146          bool& validateContentEnabled();
147          const bool validateContentEnabled() const;
148    
149          //enable/disable content language validation
150          bool& validateContentLanguageEnabled();
151          const bool validateContentLanguageEnabled() const;
152    
153          //enable/disable Accept header validation
154          bool& validateAcceptEnabled();
155          const bool validateAcceptEnabled() const;
156    
157            //if set then UserAgent header is added to outbound messages            //if set then UserAgent header is added to outbound messages
158        virtual void setUserAgent( const Data& userAgent );        void setUserAgent( const Data& userAgent );
159        virtual const Data& getUserAgent() const;        const Data& getUserAgent() const;
160        virtual bool hasUserAgent() const;        bool hasUserAgent() const;
161    
162     private:     private:
163        // !slg! - should we provide a mechanism to clear the mHasxxxxx members to re-enable fall through after setting?        NameAddr mDefaultFrom;
           bool mHasDefaultRegistrationExpires;  
164        int mDefaultRegistrationExpires;        int mDefaultRegistrationExpires;
   
       bool mHasDefaultSubscriptionExpires;  
165        int mDefaultSubscriptionExpires;        int mDefaultSubscriptionExpires;
   
       bool mHasDefaultSessionExpires;  
166        int mDefaultSessionExpires;        int mDefaultSessionExpires;
   
       bool mHasDefaultStaleCallTime;  
167        int mDefaultStaleCallTime;        int mDefaultStaleCallTime;
168    
169        bool mHasOutboundProxy;        bool mHasOutboundProxy;
170        NameAddr mOutboundProxy;        NameAddr mOutboundProxy;
171    
172            bool mHasAdvertisedCapabilities;        Data mUAName;
173          
174          std::set<Data> mSupportedSchemes;
175          std::set<MethodTypes> mSupportedMethodTypes;
176          Tokens mSupportedMethods;
177          Tokens mSupportedOptionTags;
178          Mimes mSupportedMimeTypes;
179          Tokens mSupportedEncodings;
180          Tokens mSupportedLanguages;
181            std::set<Headers::Type> mAdvertisedCapabilities;            std::set<Headers::Type> mAdvertisedCapabilities;
182    
183            bool mHasLooseToTagMatching;        DigestCredentialHandler* mDigestCredentialHandler;
       bool mLooseToTagMatching;  
184    
185            bool mHasRportEnabled;        bool mLooseToTagMatching;
186        bool mRportEnabled;        bool mRportEnabled;
187          bool mValidateContentEnabled;
188          bool mValidateContentLanguageEnabled;
189          bool mValidateAcceptEnabled;
190        bool mHasUserAgent;                    bool mHasUserAgent;            
       Data mUserAgent;  
191    
192        bool mHasOverrideHostPort;        Data mUserAgent;
193        Uri  mOverrideHostPort;        Uri  mOverrideHostPort;
194          bool mHasOverrideHostPort;
195    
196            Profile *mBaseProfile;  // All non-set settings will fall through to this Profile (if set)        typedef std::set<DigestCredential> DigestCredentials;
197          DigestCredentials mDigestCredentials;
198  };  };
199        
200    std::ostream&
201    operator<<(std::ostream&, const Profile::DigestCredential& cred);
202    
203  }  }
204    
205  #endif  #endif

Legend:
Removed from v.3607  
changed lines
  Added in v.3613

webmaster AT resiprocate DOT org
ViewVC Help
Powered by ViewVC 1.1.27