summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--include/opkele/types.h1
1 files changed, 0 insertions, 1 deletions
diff --git a/include/opkele/types.h b/include/opkele/types.h
index 64f165c..bf50e2b 100644
--- a/include/opkele/types.h
+++ b/include/opkele/types.h
@@ -59,129 +59,128 @@ namespace opkele {
59 /** 59 /**
60 * plainly encode to base64 representation 60 * plainly encode to base64 representation
61 * @param rv reference to the return value 61 * @param rv reference to the return value
62 */ 62 */
63 void to_base64(string& rv) const; 63 void to_base64(string& rv) const;
64 /** 64 /**
65 * decode cleartext secret from base64 65 * decode cleartext secret from base64
66 * @param b64 base64-encoded representation of the secret value 66 * @param b64 base64-encoded representation of the secret value
67 */ 67 */
68 void from_base64(const string& b64); 68 void from_base64(const string& b64);
69 }; 69 };
70 70
71 /** 71 /**
72 * Interface to the association. 72 * Interface to the association.
73 */ 73 */
74 class association_t { 74 class association_t {
75 public: 75 public:
76 76
77 virtual ~association_t() { } 77 virtual ~association_t() { }
78 78
79 /** 79 /**
80 * retrieve the server with which association was established. 80 * retrieve the server with which association was established.
81 * @return server name 81 * @return server name
82 */ 82 */
83 virtual string server() const = 0; 83 virtual string server() const = 0;
84 /** 84 /**
85 * retrieve the association handle. 85 * retrieve the association handle.
86 * @return handle 86 * @return handle
87 */ 87 */
88 virtual string handle() const = 0; 88 virtual string handle() const = 0;
89 /** 89 /**
90 * retrieve the association type. 90 * retrieve the association type.
91 * @return association type 91 * @return association type
92 */ 92 */
93 virtual string assoc_type() const = 0; 93 virtual string assoc_type() const = 0;
94 /** 94 /**
95 * retrieve the association secret. 95 * retrieve the association secret.
96 * @return association secret 96 * @return association secret
97 */ 97 */
98 virtual secret_t secret() const = 0; 98 virtual secret_t secret() const = 0;
99 /** 99 /**
100 * retrieve the number of seconds the association expires in. 100 * retrieve the number of seconds the association expires in.
101 * @return seconds till expiration 101 * @return seconds till expiration
102 */ 102 */
103 virtual int expires_in() const = 0; 103 virtual int expires_in() const = 0;
104 /** 104 /**
105 * check whether the association is stateless. 105 * check whether the association is stateless.
106 * @return true if stateless 106 * @return true if stateless
107 */ 107 */
108 virtual bool stateless() const = 0; 108 virtual bool stateless() const = 0;
109 /** 109 /**
110 * check whether the association is expired. 110 * check whether the association is expired.
111 * @return true if expired 111 * @return true if expired
112 */ 112 */
113 virtual bool is_expired() const = 0; 113 virtual bool is_expired() const = 0;
114 }; 114 };
115 115
116 /** 116 /**
117 * the shared_ptr<> for association_t object type 117 * the shared_ptr<> for association_t object type
118 */ 118 */
119 typedef tr1mem::shared_ptr<association_t> assoc_t; 119 typedef tr1mem::shared_ptr<association_t> assoc_t;
120 120
121 class basic_message { 121 class basic_message {
122 public: 122 public:
123 typedef list<string> fields_t;
124 typedef util::forward_iterator_proxy< 123 typedef util::forward_iterator_proxy<
125 string,const string&,const string* 124 string,const string&,const string*
126 > fields_iterator; 125 > fields_iterator;
127 126
128 basic_message() { } 127 basic_message() { }
129 virtual ~basic_message() { } 128 virtual ~basic_message() { }
130 basic_message(const basic_message& x); 129 basic_message(const basic_message& x);
131 void copy_to(basic_message& x) const; 130 void copy_to(basic_message& x) const;
132 void append_to(basic_message& x) const; 131 void append_to(basic_message& x) const;
133 132
134 virtual bool has_field(const string& n) const = 0; 133 virtual bool has_field(const string& n) const = 0;
135 virtual const string& get_field(const string& n) const = 0; 134 virtual const string& get_field(const string& n) const = 0;
136 135
137 virtual fields_iterator fields_begin() const = 0; 136 virtual fields_iterator fields_begin() const = 0;
138 virtual fields_iterator fields_end() const = 0; 137 virtual fields_iterator fields_end() const = 0;
139 138
140 virtual string append_query(const string& url,const char *pfx=0) const; 139 virtual string append_query(const string& url,const char *pfx=0) const;
141 virtual string query_string(const char *pfx=0) const; 140 virtual string query_string(const char *pfx=0) const;
142 141
143 virtual void reset_fields(); 142 virtual void reset_fields();
144 virtual void set_field(const string& n,const string& v); 143 virtual void set_field(const string& n,const string& v);
145 virtual void reset_field(const string& n); 144 virtual void reset_field(const string& n);
146 145
147 }; 146 };
148 147
149 class basic_openid_message : public basic_message { 148 class basic_openid_message : public basic_message {
150 public: 149 public:
151 typedef list<string> fields_t; 150 typedef list<string> fields_t;
152 typedef util::forward_iterator_proxy< 151 typedef util::forward_iterator_proxy<
153 string,const string&,const string* 152 string,const string&,const string*
154 > fields_iterator; 153 > fields_iterator;
155 154
156 basic_openid_message() { } 155 basic_openid_message() { }
157 basic_openid_message(const basic_openid_message& x); 156 basic_openid_message(const basic_openid_message& x);
158 157
159 virtual bool has_ns(const string& uri) const; 158 virtual bool has_ns(const string& uri) const;
160 virtual string get_ns(const string& uri) const; 159 virtual string get_ns(const string& uri) const;
161 160
162 virtual string append_query(const string& url,const char *pfx="openid.") const { 161 virtual string append_query(const string& url,const char *pfx="openid.") const {
163 return basic_message::append_query(url,pfx); } 162 return basic_message::append_query(url,pfx); }
164 virtual string query_string(const char *pfx="openid.") const { 163 virtual string query_string(const char *pfx="openid.") const {
165 return basic_message::query_string(pfx); } 164 return basic_message::query_string(pfx); }
166 165
167 virtual void from_keyvalues(const string& kv); 166 virtual void from_keyvalues(const string& kv);
168 virtual void to_keyvalues(ostream& o) const; 167 virtual void to_keyvalues(ostream& o) const;
169 168
170 virtual void to_htmlhiddens(ostream& o,const char* pfx=0) const; 169 virtual void to_htmlhiddens(ostream& o,const char* pfx=0) const;
171 170
172 void add_to_signed(const string& fields); 171 void add_to_signed(const string& fields);
173 string find_ns(const string& uri,const char *pfx) const; 172 string find_ns(const string& uri,const char *pfx) const;
174 string allocate_ns(const string& uri,const char *pfx); 173 string allocate_ns(const string& uri,const char *pfx);
175 }; 174 };
176 175
177 class openid_message_t : public basic_openid_message, public map<string,string> { 176 class openid_message_t : public basic_openid_message, public map<string,string> {
178 public: 177 public:
179 openid_message_t() { } 178 openid_message_t() { }
180 openid_message_t(const basic_openid_message& x) 179 openid_message_t(const basic_openid_message& x)
181 : basic_openid_message(x) { } 180 : basic_openid_message(x) { }
182 181
183 bool has_field(const string& n) const; 182 bool has_field(const string& n) const;
184 const string& get_field(const string& n) const; 183 const string& get_field(const string& n) const;
185 virtual fields_iterator fields_begin() const; 184 virtual fields_iterator fields_begin() const;
186 virtual fields_iterator fields_end() const; 185 virtual fields_iterator fields_end() const;
187 186