summaryrefslogtreecommitdiffabout
authorMichael Krelin <hacker@klever.net>2007-01-12 15:23:09 (UTC)
committer Michael Krelin <hacker@klever.net>2007-01-12 15:23:09 (UTC)
commitae41407817c5e360e57e06eba656a38b32093977 (patch) (unidiff)
treece24f86960a745f6e65eaca44a555ad2da7fcfd3
parent9caa31b962c42cf64ce03893ba616b135de12bbd (diff)
downloadlibopkele-ae41407817c5e360e57e06eba656a38b32093977.zip
libopkele-ae41407817c5e360e57e06eba656a38b32093977.tar.gz
libopkele-ae41407817c5e360e57e06eba656a38b32093977.tar.bz2
doxygen improvements
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--Doxyfile.in4
-rw-r--r--include/opkele/association.h21
-rw-r--r--include/opkele/consumer.h3
-rw-r--r--include/opkele/data.h6
-rw-r--r--include/opkele/exception.h3
-rw-r--r--include/opkele/extension.h3
-rw-r--r--include/opkele/extension_chain.h12
-rw-r--r--include/opkele/server.h3
-rw-r--r--include/opkele/sreg.h3
-rw-r--r--include/opkele/types.h3
-rw-r--r--include/opkele/util.h3
-rw-r--r--include/opkele/xconsumer.h3
-rw-r--r--include/opkele/xserver.h3
13 files changed, 11 insertions, 59 deletions
diff --git a/Doxyfile.in b/Doxyfile.in
index adb2aa3..ce2fb20 100644
--- a/Doxyfile.in
+++ b/Doxyfile.in
@@ -1,247 +1,247 @@
1# Doxyfile 1.3.9.1 1# Doxyfile 1.3.9.1
2 2
3#--------------------------------------------------------------------------- 3#---------------------------------------------------------------------------
4# Project related configuration options 4# Project related configuration options
5#--------------------------------------------------------------------------- 5#---------------------------------------------------------------------------
6PROJECT_NAME = @PACKAGE@ 6PROJECT_NAME = @PACKAGE@
7PROJECT_NUMBER = @VERSION@ 7PROJECT_NUMBER = @VERSION@
8OUTPUT_DIRECTORY = @builddir@/doxydox 8OUTPUT_DIRECTORY = @builddir@/doxydox
9CREATE_SUBDIRS = NO 9CREATE_SUBDIRS = NO
10OUTPUT_LANGUAGE = English 10OUTPUT_LANGUAGE = English
11USE_WINDOWS_ENCODING = NO 11USE_WINDOWS_ENCODING = NO
12BRIEF_MEMBER_DESC = YES 12BRIEF_MEMBER_DESC = YES
13REPEAT_BRIEF = YES 13REPEAT_BRIEF = YES
14ABBREVIATE_BRIEF = 14ABBREVIATE_BRIEF =
15ALWAYS_DETAILED_SEC = NO 15ALWAYS_DETAILED_SEC = NO
16INLINE_INHERITED_MEMB = NO 16INLINE_INHERITED_MEMB = NO
17FULL_PATH_NAMES = YES 17FULL_PATH_NAMES = YES
18STRIP_FROM_PATH = include 18STRIP_FROM_PATH = include
19STRIP_FROM_INC_PATH = include 19STRIP_FROM_INC_PATH = include
20SHORT_NAMES = NO 20SHORT_NAMES = NO
21JAVADOC_AUTOBRIEF = NO 21JAVADOC_AUTOBRIEF = NO
22MULTILINE_CPP_IS_BRIEF = NO 22MULTILINE_CPP_IS_BRIEF = NO
23DETAILS_AT_TOP = NO 23DETAILS_AT_TOP = NO
24INHERIT_DOCS = YES 24INHERIT_DOCS = YES
25DISTRIBUTE_GROUP_DOC = NO 25DISTRIBUTE_GROUP_DOC = NO
26TAB_SIZE = 8 26TAB_SIZE = 8
27ALIASES = 27ALIASES =
28OPTIMIZE_OUTPUT_FOR_C = NO 28OPTIMIZE_OUTPUT_FOR_C = NO
29OPTIMIZE_OUTPUT_JAVA = NO 29OPTIMIZE_OUTPUT_JAVA = NO
30SUBGROUPING = YES 30SUBGROUPING = YES
31 31
32#--------------------------------------------------------------------------- 32#---------------------------------------------------------------------------
33# Build related configuration options 33# Build related configuration options
34#--------------------------------------------------------------------------- 34#---------------------------------------------------------------------------
35 35
36EXTRACT_ALL = NO 36EXTRACT_ALL = NO
37EXTRACT_PRIVATE = NO 37EXTRACT_PRIVATE = NO
38EXTRACT_STATIC = NO 38EXTRACT_STATIC = NO
39EXTRACT_LOCAL_CLASSES = YES 39EXTRACT_LOCAL_CLASSES = YES
40EXTRACT_LOCAL_METHODS = NO 40EXTRACT_LOCAL_METHODS = NO
41HIDE_UNDOC_MEMBERS = NO 41HIDE_UNDOC_MEMBERS = YES
42HIDE_UNDOC_CLASSES = NO 42HIDE_UNDOC_CLASSES = YES
43HIDE_FRIEND_COMPOUNDS = NO 43HIDE_FRIEND_COMPOUNDS = NO
44HIDE_IN_BODY_DOCS = NO 44HIDE_IN_BODY_DOCS = NO
45INTERNAL_DOCS = NO 45INTERNAL_DOCS = NO
46CASE_SENSE_NAMES = YES 46CASE_SENSE_NAMES = YES
47HIDE_SCOPE_NAMES = NO 47HIDE_SCOPE_NAMES = NO
48SHOW_INCLUDE_FILES = NO 48SHOW_INCLUDE_FILES = NO
49INLINE_INFO = YES 49INLINE_INFO = YES
50SORT_MEMBER_DOCS = YES 50SORT_MEMBER_DOCS = YES
51SORT_BRIEF_DOCS = NO 51SORT_BRIEF_DOCS = NO
52SORT_BY_SCOPE_NAME = YES 52SORT_BY_SCOPE_NAME = YES
53GENERATE_TODOLIST = YES 53GENERATE_TODOLIST = YES
54GENERATE_TESTLIST = YES 54GENERATE_TESTLIST = YES
55GENERATE_BUGLIST = YES 55GENERATE_BUGLIST = YES
56GENERATE_DEPRECATEDLIST= YES 56GENERATE_DEPRECATEDLIST= YES
57ENABLED_SECTIONS = 57ENABLED_SECTIONS =
58MAX_INITIALIZER_LINES = 30 58MAX_INITIALIZER_LINES = 30
59SHOW_USED_FILES = NO 59SHOW_USED_FILES = NO
60SHOW_DIRECTORIES = YES 60SHOW_DIRECTORIES = YES
61 61
62#--------------------------------------------------------------------------- 62#---------------------------------------------------------------------------
63# configuration options related to warning and progress messages 63# configuration options related to warning and progress messages
64#--------------------------------------------------------------------------- 64#---------------------------------------------------------------------------
65 65
66QUIET = NO 66QUIET = NO
67WARNINGS = YES 67WARNINGS = YES
68WARN_IF_UNDOCUMENTED = YES 68WARN_IF_UNDOCUMENTED = YES
69WARN_IF_DOC_ERROR = YES 69WARN_IF_DOC_ERROR = YES
70WARN_FORMAT = "$file:$line: $text" 70WARN_FORMAT = "$file:$line: $text"
71WARN_LOGFILE = 71WARN_LOGFILE =
72 72
73#--------------------------------------------------------------------------- 73#---------------------------------------------------------------------------
74# configuration options related to the input files 74# configuration options related to the input files
75#--------------------------------------------------------------------------- 75#---------------------------------------------------------------------------
76 76
77INPUT = \ 77INPUT = \
78 @srcdir@/include/opkele/ @srcdir@/lib/ 78 @srcdir@/include/opkele/ @srcdir@/lib/
79FILE_PATTERNS = *.h *.cc 79FILE_PATTERNS = *.h *.cc
80RECURSIVE = NO 80RECURSIVE = NO
81EXCLUDE = 81EXCLUDE =
82EXCLUDE_SYMLINKS = NO 82EXCLUDE_SYMLINKS = NO
83EXCLUDE_PATTERNS = 83EXCLUDE_PATTERNS =
84EXAMPLE_PATH = 84EXAMPLE_PATH =
85EXAMPLE_PATTERNS = 85EXAMPLE_PATTERNS =
86EXAMPLE_RECURSIVE = NO 86EXAMPLE_RECURSIVE = NO
87IMAGE_PATH = 87IMAGE_PATH =
88INPUT_FILTER = 88INPUT_FILTER =
89FILTER_PATTERNS = 89FILTER_PATTERNS =
90FILTER_SOURCE_FILES = NO 90FILTER_SOURCE_FILES = NO
91 91
92#--------------------------------------------------------------------------- 92#---------------------------------------------------------------------------
93# configuration options related to source browsing 93# configuration options related to source browsing
94#--------------------------------------------------------------------------- 94#---------------------------------------------------------------------------
95 95
96SOURCE_BROWSER = YES 96SOURCE_BROWSER = YES
97INLINE_SOURCES = NO 97INLINE_SOURCES = NO
98STRIP_CODE_COMMENTS = YES 98STRIP_CODE_COMMENTS = YES
99REFERENCED_BY_RELATION = YES 99REFERENCED_BY_RELATION = YES
100REFERENCES_RELATION = YES 100REFERENCES_RELATION = YES
101VERBATIM_HEADERS = YES 101VERBATIM_HEADERS = YES
102 102
103#--------------------------------------------------------------------------- 103#---------------------------------------------------------------------------
104# configuration options related to the alphabetical class index 104# configuration options related to the alphabetical class index
105#--------------------------------------------------------------------------- 105#---------------------------------------------------------------------------
106 106
107ALPHABETICAL_INDEX = YES 107ALPHABETICAL_INDEX = YES
108COLS_IN_ALPHA_INDEX = 2 108COLS_IN_ALPHA_INDEX = 2
109IGNORE_PREFIX = 109IGNORE_PREFIX =
110 110
111#--------------------------------------------------------------------------- 111#---------------------------------------------------------------------------
112# configuration options related to the HTML output 112# configuration options related to the HTML output
113#--------------------------------------------------------------------------- 113#---------------------------------------------------------------------------
114 114
115GENERATE_HTML = YES 115GENERATE_HTML = YES
116HTML_OUTPUT = html 116HTML_OUTPUT = html
117HTML_FILE_EXTENSION = .html 117HTML_FILE_EXTENSION = .html
118HTML_HEADER = 118HTML_HEADER =
119HTML_FOOTER = 119HTML_FOOTER =
120HTML_STYLESHEET = 120HTML_STYLESHEET =
121HTML_ALIGN_MEMBERS = YES 121HTML_ALIGN_MEMBERS = YES
122GENERATE_HTMLHELP = NO 122GENERATE_HTMLHELP = NO
123CHM_FILE = 123CHM_FILE =
124HHC_LOCATION = 124HHC_LOCATION =
125GENERATE_CHI = NO 125GENERATE_CHI = NO
126BINARY_TOC = NO 126BINARY_TOC = NO
127TOC_EXPAND = NO 127TOC_EXPAND = NO
128DISABLE_INDEX = NO 128DISABLE_INDEX = NO
129ENUM_VALUES_PER_LINE = 4 129ENUM_VALUES_PER_LINE = 4
130GENERATE_TREEVIEW = NO 130GENERATE_TREEVIEW = NO
131TREEVIEW_WIDTH = 250 131TREEVIEW_WIDTH = 250
132 132
133#--------------------------------------------------------------------------- 133#---------------------------------------------------------------------------
134# configuration options related to the LaTeX output 134# configuration options related to the LaTeX output
135#--------------------------------------------------------------------------- 135#---------------------------------------------------------------------------
136 136
137GENERATE_LATEX = NO 137GENERATE_LATEX = NO
138LATEX_OUTPUT = latex 138LATEX_OUTPUT = latex
139LATEX_CMD_NAME = latex 139LATEX_CMD_NAME = latex
140MAKEINDEX_CMD_NAME = makeindex 140MAKEINDEX_CMD_NAME = makeindex
141COMPACT_LATEX = NO 141COMPACT_LATEX = NO
142PAPER_TYPE = a4wide 142PAPER_TYPE = a4wide
143EXTRA_PACKAGES = 143EXTRA_PACKAGES =
144LATEX_HEADER = 144LATEX_HEADER =
145PDF_HYPERLINKS = NO 145PDF_HYPERLINKS = NO
146USE_PDFLATEX = NO 146USE_PDFLATEX = NO
147LATEX_BATCHMODE = NO 147LATEX_BATCHMODE = NO
148LATEX_HIDE_INDICES = NO 148LATEX_HIDE_INDICES = NO
149 149
150#--------------------------------------------------------------------------- 150#---------------------------------------------------------------------------
151# configuration options related to the RTF output 151# configuration options related to the RTF output
152#--------------------------------------------------------------------------- 152#---------------------------------------------------------------------------
153 153
154GENERATE_RTF = NO 154GENERATE_RTF = NO
155RTF_OUTPUT = rtf 155RTF_OUTPUT = rtf
156COMPACT_RTF = NO 156COMPACT_RTF = NO
157RTF_HYPERLINKS = NO 157RTF_HYPERLINKS = NO
158RTF_STYLESHEET_FILE = 158RTF_STYLESHEET_FILE =
159RTF_EXTENSIONS_FILE = 159RTF_EXTENSIONS_FILE =
160 160
161#--------------------------------------------------------------------------- 161#---------------------------------------------------------------------------
162# configuration options related to the man page output 162# configuration options related to the man page output
163#--------------------------------------------------------------------------- 163#---------------------------------------------------------------------------
164 164
165GENERATE_MAN = NO 165GENERATE_MAN = NO
166MAN_OUTPUT = man 166MAN_OUTPUT = man
167MAN_EXTENSION = .3 167MAN_EXTENSION = .3
168MAN_LINKS = YES 168MAN_LINKS = YES
169 169
170#--------------------------------------------------------------------------- 170#---------------------------------------------------------------------------
171# configuration options related to the XML output 171# configuration options related to the XML output
172#--------------------------------------------------------------------------- 172#---------------------------------------------------------------------------
173 173
174GENERATE_XML = YES 174GENERATE_XML = YES
175XML_OUTPUT = xml 175XML_OUTPUT = xml
176XML_SCHEMA = 176XML_SCHEMA =
177XML_DTD = 177XML_DTD =
178XML_PROGRAMLISTING = YES 178XML_PROGRAMLISTING = YES
179 179
180#--------------------------------------------------------------------------- 180#---------------------------------------------------------------------------
181# configuration options for the AutoGen Definitions output 181# configuration options for the AutoGen Definitions output
182#--------------------------------------------------------------------------- 182#---------------------------------------------------------------------------
183 183
184GENERATE_AUTOGEN_DEF = NO 184GENERATE_AUTOGEN_DEF = NO
185 185
186#--------------------------------------------------------------------------- 186#---------------------------------------------------------------------------
187# configuration options related to the Perl module output 187# configuration options related to the Perl module output
188#--------------------------------------------------------------------------- 188#---------------------------------------------------------------------------
189 189
190GENERATE_PERLMOD = NO 190GENERATE_PERLMOD = NO
191PERLMOD_LATEX = NO 191PERLMOD_LATEX = NO
192PERLMOD_PRETTY = YES 192PERLMOD_PRETTY = YES
193PERLMOD_MAKEVAR_PREFIX = 193PERLMOD_MAKEVAR_PREFIX =
194 194
195#--------------------------------------------------------------------------- 195#---------------------------------------------------------------------------
196# Configuration options related to the preprocessor 196# Configuration options related to the preprocessor
197#--------------------------------------------------------------------------- 197#---------------------------------------------------------------------------
198 198
199ENABLE_PREPROCESSING = YES 199ENABLE_PREPROCESSING = YES
200MACRO_EXPANSION = NO 200MACRO_EXPANSION = NO
201EXPAND_ONLY_PREDEF = NO 201EXPAND_ONLY_PREDEF = NO
202SEARCH_INCLUDES = YES 202SEARCH_INCLUDES = YES
203INCLUDE_PATH = 203INCLUDE_PATH =
204INCLUDE_FILE_PATTERNS = 204INCLUDE_FILE_PATTERNS =
205PREDEFINED = 205PREDEFINED =
206EXPAND_AS_DEFINED = 206EXPAND_AS_DEFINED =
207SKIP_FUNCTION_MACROS = YES 207SKIP_FUNCTION_MACROS = YES
208 208
209#--------------------------------------------------------------------------- 209#---------------------------------------------------------------------------
210# Configuration::additions related to external references 210# Configuration::additions related to external references
211#--------------------------------------------------------------------------- 211#---------------------------------------------------------------------------
212 212
213TAGFILES = 213TAGFILES =
214GENERATE_TAGFILE = 214GENERATE_TAGFILE =
215ALLEXTERNALS = NO 215ALLEXTERNALS = NO
216EXTERNAL_GROUPS = YES 216EXTERNAL_GROUPS = YES
217PERL_PATH = /usr/bin/perl 217PERL_PATH = /usr/bin/perl
218 218
219#--------------------------------------------------------------------------- 219#---------------------------------------------------------------------------
220# Configuration options related to the dot tool 220# Configuration options related to the dot tool
221#--------------------------------------------------------------------------- 221#---------------------------------------------------------------------------
222 222
223CLASS_DIAGRAMS = YES 223CLASS_DIAGRAMS = YES
224HIDE_UNDOC_RELATIONS = YES 224HIDE_UNDOC_RELATIONS = YES
225HAVE_DOT = @HAVE_DOT@ 225HAVE_DOT = @HAVE_DOT@
226CLASS_GRAPH = YES 226CLASS_GRAPH = YES
227COLLABORATION_GRAPH = YES 227COLLABORATION_GRAPH = YES
228UML_LOOK = NO 228UML_LOOK = NO
229TEMPLATE_RELATIONS = YES 229TEMPLATE_RELATIONS = YES
230INCLUDE_GRAPH = YES 230INCLUDE_GRAPH = YES
231INCLUDED_BY_GRAPH = YES 231INCLUDED_BY_GRAPH = YES
232CALL_GRAPH = NO 232CALL_GRAPH = NO
233GRAPHICAL_HIERARCHY = YES 233GRAPHICAL_HIERARCHY = YES
234DOT_IMAGE_FORMAT = png 234DOT_IMAGE_FORMAT = png
235DOT_PATH = @DOT@ 235DOT_PATH = @DOT@
236DOTFILE_DIRS = 236DOTFILE_DIRS =
237MAX_DOT_GRAPH_WIDTH = 1024 237MAX_DOT_GRAPH_WIDTH = 1024
238MAX_DOT_GRAPH_HEIGHT = 1024 238MAX_DOT_GRAPH_HEIGHT = 1024
239MAX_DOT_GRAPH_DEPTH = 0 239MAX_DOT_GRAPH_DEPTH = 0
240GENERATE_LEGEND = YES 240GENERATE_LEGEND = YES
241DOT_CLEANUP = YES 241DOT_CLEANUP = YES
242 242
243#--------------------------------------------------------------------------- 243#---------------------------------------------------------------------------
244# Configuration::additions related to the search engine 244# Configuration::additions related to the search engine
245#--------------------------------------------------------------------------- 245#---------------------------------------------------------------------------
246 246
247SEARCHENGINE = NO 247SEARCHENGINE = NO
diff --git a/include/opkele/association.h b/include/opkele/association.h
index ef0df42..a8f3915 100644
--- a/include/opkele/association.h
+++ b/include/opkele/association.h
@@ -1,89 +1,68 @@
1#ifndef __OPKELE_ASSOCIATION_H 1#ifndef __OPKELE_ASSOCIATION_H
2#define __OPKELE_ASSOCIATION_H 2#define __OPKELE_ASSOCIATION_H
3 3
4#include <time.h> 4#include <time.h>
5#include <opkele/types.h> 5#include <opkele/types.h>
6 6
7/** 7/**
8 * @file 8 * @file
9 * @brief reference implementation of association_t 9 * @brief reference implementation of association_t
10 */ 10 */
11 11
12/**
13 * @brief the main opkele namespace
14 */
15namespace opkele { 12namespace opkele {
16 13
17 /** 14 /**
18 * reference implementation of association_t class. 15 * reference implementation of association_t class.
19 */ 16 */
20 class association : public association_t { 17 class association : public association_t {
21 public: 18 public:
22 /** 19 /**
23 * OpenID server name 20 * OpenID server name
24 */ 21 */
25 string _server; 22 string _server;
26 /** 23 /**
27 * association handle 24 * association handle
28 */ 25 */
29 string _handle; 26 string _handle;
30 /** 27 /**
31 * association type 28 * association type
32 */ 29 */
33 string _assoc_type; 30 string _assoc_type;
34 /** 31 /**
35 * the secret 32 * the secret
36 */ 33 */
37 secret_t _secret; 34 secret_t _secret;
38 /** 35 /**
39 * expiration time 36 * expiration time
40 */ 37 */
41 time_t _expires; 38 time_t _expires;
42 /** 39 /**
43 * statelessness of the assoc_handle 40 * statelessness of the assoc_handle
44 */ 41 */
45 bool _stateless; 42 bool _stateless;
46 43
47 /** 44 /**
48 * @param __server the server name 45 * @param __server the server name
49 * @param __handle association handle 46 * @param __handle association handle
50 * @param __assoc_type association type 47 * @param __assoc_type association type
51 * @param __secret the secret 48 * @param __secret the secret
52 * @param __expires expiration time 49 * @param __expires expiration time
53 * @param __stateless statelessness of the assoc_handle 50 * @param __stateless statelessness of the assoc_handle
54 */ 51 */
55 association(const string& __server, const string& __handle, 52 association(const string& __server, const string& __handle,
56 const string& __assoc_type, const secret_t& __secret, 53 const string& __assoc_type, const secret_t& __secret,
57 time_t __expires, bool __stateless) 54 time_t __expires, bool __stateless)
58 : _server(__server), _handle(__handle), _assoc_type(__assoc_type), 55 : _server(__server), _handle(__handle), _assoc_type(__assoc_type),
59 _secret(__secret), _expires(__expires), _stateless(__stateless) { } 56 _secret(__secret), _expires(__expires), _stateless(__stateless) { }
60 57
61 /**
62 * @overload association_t::server()
63 */
64 virtual string server() const { return _server; } 58 virtual string server() const { return _server; }
65 /**
66 * @overload association_t::handle()
67 */
68 virtual string handle() const { return _handle; } 59 virtual string handle() const { return _handle; }
69 /**
70 * @overload association_t::assoc_type()
71 */
72 virtual string assoc_type() const { return _assoc_type; } 60 virtual string assoc_type() const { return _assoc_type; }
73 /**
74 * @overload association_t::secret()
75 */
76 virtual secret_t secret() const { return _secret; } 61 virtual secret_t secret() const { return _secret; }
77 /**
78 * @overload association_t::expires_in()
79 */
80 virtual int expires_in() const { return _expires-time(0); } 62 virtual int expires_in() const { return _expires-time(0); }
81 /**
82 * @overload association_t::stateless()
83 */
84 virtual bool stateless() const { return _stateless; } 63 virtual bool stateless() const { return _stateless; }
85 }; 64 };
86 65
87} 66}
88 67
89#endif /* __OPKELE_ASSOCIATION_H */ 68#endif /* __OPKELE_ASSOCIATION_H */
diff --git a/include/opkele/consumer.h b/include/opkele/consumer.h
index f32509e..fdb6119 100644
--- a/include/opkele/consumer.h
+++ b/include/opkele/consumer.h
@@ -1,145 +1,142 @@
1#ifndef __OPKELE_CONSUMER_H 1#ifndef __OPKELE_CONSUMER_H
2#define __OPKELE_CONSUMER_H 2#define __OPKELE_CONSUMER_H
3 3
4#include <opkele/types.h> 4#include <opkele/types.h>
5#include <opkele/extension.h> 5#include <opkele/extension.h>
6 6
7/** 7/**
8 * @file 8 * @file
9 * @brief OpenID consumer-side functionality 9 * @brief OpenID consumer-side functionality
10 */ 10 */
11 11
12/**
13 * @brief the main opkele namespace
14 */
15namespace opkele { 12namespace opkele {
16 13
17 /** 14 /**
18 * implementation of basic consumer functionality 15 * implementation of basic consumer functionality
19 */ 16 */
20 class consumer_t { 17 class consumer_t {
21 public: 18 public:
22 19
23 /** 20 /**
24 * store association. The function should be overridden in the real 21 * store association. The function should be overridden in the real
25 * implementation to provide persistent associations store. 22 * implementation to provide persistent associations store.
26 * @param server the OpenID server 23 * @param server the OpenID server
27 * @param handle association handle 24 * @param handle association handle
28 * @param secret the secret associated with the server and handle 25 * @param secret the secret associated with the server and handle
29 * @param expires_in the number of seconds until the handle is expired 26 * @param expires_in the number of seconds until the handle is expired
30 * @return the auto_ptr<> for the newly allocated association_t object 27 * @return the auto_ptr<> for the newly allocated association_t object
31 */ 28 */
32 virtual assoc_t store_assoc(const string& server,const string& handle,const secret_t& secret,int expires_in) = 0; 29 virtual assoc_t store_assoc(const string& server,const string& handle,const secret_t& secret,int expires_in) = 0;
33 /** 30 /**
34 * retrieve stored association. The function should be overridden 31 * retrieve stored association. The function should be overridden
35 * in the real implementation to provide persistent assocations 32 * in the real implementation to provide persistent assocations
36 * store. 33 * store.
37 * @param server the OpenID server 34 * @param server the OpenID server
38 * @param handle association handle 35 * @param handle association handle
39 * @return the autho_ptr<> for the newly allocated association_t object 36 * @return the autho_ptr<> for the newly allocated association_t object
40 * @throw failed_lookup in case of error 37 * @throw failed_lookup in case of error
41 */ 38 */
42 virtual assoc_t retrieve_assoc(const string& server,const string& handle) = 0; 39 virtual assoc_t retrieve_assoc(const string& server,const string& handle) = 0;
43 /** 40 /**
44 * invalidate stored association. The function should be overridden 41 * invalidate stored association. The function should be overridden
45 * in the real implementation of the consumer. 42 * in the real implementation of the consumer.
46 * @param server the OpenID server 43 * @param server the OpenID server
47 * @param handle association handle 44 * @param handle association handle
48 */ 45 */
49 virtual void invalidate_assoc(const string& server,const string& handle) = 0; 46 virtual void invalidate_assoc(const string& server,const string& handle) = 0;
50 /** 47 /**
51 * retrieve any unexpired association for the server. If the 48 * retrieve any unexpired association for the server. If the
52 * function is not overridden in the real implementation, the new 49 * function is not overridden in the real implementation, the new
53 * association will be established for each request. 50 * association will be established for each request.
54 * @param server the OpenID server 51 * @param server the OpenID server
55 * @return the auto_ptr<> for the newly allocated association_t object 52 * @return the auto_ptr<> for the newly allocated association_t object
56 * @throw failed_lookup in case of absence of the handle 53 * @throw failed_lookup in case of absence of the handle
57 */ 54 */
58 virtual assoc_t find_assoc(const string& server); 55 virtual assoc_t find_assoc(const string& server);
59 56
60 /** 57 /**
61 * retrieve the metainformation contained in link tags from the 58 * retrieve the metainformation contained in link tags from the
62 * page pointed by url. the function may implement caching of the 59 * page pointed by url. the function may implement caching of the
63 * information. 60 * information.
64 * @param url url to harvest for link tags 61 * @param url url to harvest for link tags
65 * @param server reference to the string object where to put 62 * @param server reference to the string object where to put
66 * openid.server value 63 * openid.server value
67 * @param delegate reference to the string object where to put the 64 * @param delegate reference to the string object where to put the
68 * openid.delegate value (if any) 65 * openid.delegate value (if any)
69 */ 66 */
70 virtual void retrieve_links(const string& url,string& server,string& delegate); 67 virtual void retrieve_links(const string& url,string& server,string& delegate);
71 68
72 /** 69 /**
73 * perform the associate request to OpenID server. 70 * perform the associate request to OpenID server.
74 * @param server the OpenID server 71 * @param server the OpenID server
75 * @return the auto_ptr<> for the newly allocated association_t 72 * @return the auto_ptr<> for the newly allocated association_t
76 * object, representing established association 73 * object, representing established association
77 * @throw exception in case of error 74 * @throw exception in case of error
78 */ 75 */
79 assoc_t associate(const string& server); 76 assoc_t associate(const string& server);
80 /** 77 /**
81 * prepare the parameters for the checkid_immediate 78 * prepare the parameters for the checkid_immediate
82 * request. 79 * request.
83 * @param identity the identity to verify 80 * @param identity the identity to verify
84 * @param return_to the return_to url to pass with the request 81 * @param return_to the return_to url to pass with the request
85 * @param trust_root the trust root to advertise with the request 82 * @param trust_root the trust root to advertise with the request
86 * @param ext pointer to an extension(s) hooks object 83 * @param ext pointer to an extension(s) hooks object
87 * @return the location string 84 * @return the location string
88 * @throw exception in case of error 85 * @throw exception in case of error
89 */ 86 */
90 virtual string checkid_immediate(const string& identity,const string& return_to,const string& trust_root="",extension_t *ext=0); 87 virtual string checkid_immediate(const string& identity,const string& return_to,const string& trust_root="",extension_t *ext=0);
91 /** 88 /**
92 * prepare the parameters for the checkid_setup 89 * prepare the parameters for the checkid_setup
93 * request. 90 * request.
94 * @param identity the identity to verify 91 * @param identity the identity to verify
95 * @param return_to the return_to url to pass with the request 92 * @param return_to the return_to url to pass with the request
96 * @param trust_root the trust root to advertise with the request 93 * @param trust_root the trust root to advertise with the request
97 * @param ext pointer to an extension(s) hooks object 94 * @param ext pointer to an extension(s) hooks object
98 * @return the location string 95 * @return the location string
99 * @throw exception in case of error 96 * @throw exception in case of error
100 */ 97 */
101 virtual string checkid_setup(const string& identity,const string& return_to,const string& trust_root="",extension_t *ext=0); 98 virtual string checkid_setup(const string& identity,const string& return_to,const string& trust_root="",extension_t *ext=0);
102 /** 99 /**
103 * the actual implementation behind checkid_immediate() and 100 * the actual implementation behind checkid_immediate() and
104 * checkid_setup() functions. 101 * checkid_setup() functions.
105 * @param mode checkid_* mode - either mode_checkid_immediate or mode_checkid_setup 102 * @param mode checkid_* mode - either mode_checkid_immediate or mode_checkid_setup
106 * @param identity the identity to verify 103 * @param identity the identity to verify
107 * @param return_to the return_to url to pass with the request 104 * @param return_to the return_to url to pass with the request
108 * @param trust_root the trust root to advertise with the request 105 * @param trust_root the trust root to advertise with the request
109 * @param ext pointer to an extension(s) hooks object 106 * @param ext pointer to an extension(s) hooks object
110 * @return the location string 107 * @return the location string
111 * @throw exception in case of error 108 * @throw exception in case of error
112 */ 109 */
113 virtual string checkid_(mode_t mode,const string& identity,const string& return_to,const string& trust_root="",extension_t *ext=0); 110 virtual string checkid_(mode_t mode,const string& identity,const string& return_to,const string& trust_root="",extension_t *ext=0);
114 /** 111 /**
115 * verify the id_res response 112 * verify the id_res response
116 * @param pin the response parameters 113 * @param pin the response parameters
117 * @param identity the identity being checked (if not specified, 114 * @param identity the identity being checked (if not specified,
118 * @param ext pointer to an extension(s) hooks object 115 * @param ext pointer to an extension(s) hooks object
119 * extracted from the openid.identity parameter 116 * extracted from the openid.identity parameter
120 * @throw id_res_mismatch in case of signature mismatch 117 * @throw id_res_mismatch in case of signature mismatch
121 * @throw id_res_setup in case of openid.user_setup_url failure 118 * @throw id_res_setup in case of openid.user_setup_url failure
122 * (supposedly checkid_immediate only) 119 * (supposedly checkid_immediate only)
123 * @throw id_res_failed in case of failure 120 * @throw id_res_failed in case of failure
124 * @throw exception in case of other failures 121 * @throw exception in case of other failures
125 */ 122 */
126 virtual void id_res(const params_t& pin,const string& identity="",extension_t *ext=0); 123 virtual void id_res(const params_t& pin,const string& identity="",extension_t *ext=0);
127 /** 124 /**
128 * perform a check_authentication request. 125 * perform a check_authentication request.
129 * @param server the OpenID server 126 * @param server the OpenID server
130 * @param p request parameters 127 * @param p request parameters
131 */ 128 */
132 void check_authentication(const string& server,const params_t& p); 129 void check_authentication(const string& server,const params_t& p);
133 130
134 /** 131 /**
135 * make URL canonical, by adding http:// and trailing slash, if needed. 132 * make URL canonical, by adding http:// and trailing slash, if needed.
136 * @param url 133 * @param url
137 * @return canonicalized url 134 * @return canonicalized url
138 */ 135 */
139 static string canonicalize(const string& url); 136 static string canonicalize(const string& url);
140 137
141 }; 138 };
142 139
143} 140}
144 141
145#endif /* __OPKELE_CONSUMER_H */ 142#endif /* __OPKELE_CONSUMER_H */
diff --git a/include/opkele/data.h b/include/opkele/data.h
index 7fc635b..d0b0516 100644
--- a/include/opkele/data.h
+++ b/include/opkele/data.h
@@ -1,12 +1,18 @@
1#ifndef __OPKELE_DATA_H 1#ifndef __OPKELE_DATA_H
2#define __OPKELE_DATA_H 2#define __OPKELE_DATA_H
3 3
4/**
5 * @brief the main opkele namespace
6 */
4namespace opkele { 7namespace opkele {
5 8
9 /**
10 * @brief internal data opkele namespace
11 */
6 namespace data { 12 namespace data {
7 extern const char *_default_p; 13 extern const char *_default_p;
8 extern const char *_default_g; 14 extern const char *_default_g;
9 } 15 }
10} 16}
11 17
12#endif /* __OPKELE_DATA_H */ 18#endif /* __OPKELE_DATA_H */
diff --git a/include/opkele/exception.h b/include/opkele/exception.h
index 9fc9bd3..0150e6b 100644
--- a/include/opkele/exception.h
+++ b/include/opkele/exception.h
@@ -1,220 +1,217 @@
1#ifndef __OPKELE_EXCEPTION_H 1#ifndef __OPKELE_EXCEPTION_H
2#define __OPKELE_EXCEPTION_H 2#define __OPKELE_EXCEPTION_H
3 3
4/** 4/**
5 * @file 5 * @file
6 * @brief opkele exceptions 6 * @brief opkele exceptions
7 */ 7 */
8 8
9#include <curl/curl.h> 9#include <curl/curl.h>
10 10
11#include <opkele/opkele-config.h> 11#include <opkele/opkele-config.h>
12#ifdef OPKELE_HAVE_KONFORKA 12#ifdef OPKELE_HAVE_KONFORKA
13# include <konforka/exception.h> 13# include <konforka/exception.h>
14/** 14/**
15 * the exception parameters declaration 15 * the exception parameters declaration
16 */ 16 */
17# define OPKELE_E_PARS const string& fi,const string&fu,int l,const string& w 17# define OPKELE_E_PARS const string& fi,const string&fu,int l,const string& w
18/** 18/**
19 * the exception parameters list to pass to constructor 19 * the exception parameters list to pass to constructor
20 */ 20 */
21# define OPKELE_E_CONS_ fi,fu,l, 21# define OPKELE_E_CONS_ fi,fu,l,
22/** 22/**
23 * the exception codepoint specification 23 * the exception codepoint specification
24 */ 24 */
25# define OPKELE_CP_ CODEPOINT, 25# define OPKELE_CP_ CODEPOINT,
26/** 26/**
27 * the simple rethrow of konforka-based exception 27 * the simple rethrow of konforka-based exception
28 */ 28 */
29# define OPKELE_RETHROW catch(konforka::exception& e) { e.see(CODEPOINT); throw } 29# define OPKELE_RETHROW catch(konforka::exception& e) { e.see(CODEPOINT); throw }
30#else /* OPKELE_HAVE_KONFORKA */ 30#else /* OPKELE_HAVE_KONFORKA */
31# include <exception> 31# include <exception>
32# include <string> 32# include <string>
33/** 33/**
34 * the exception parameter declaration 34 * the exception parameter declaration
35 */ 35 */
36# define OPKELE_E_PARS const string& w 36# define OPKELE_E_PARS const string& w
37/** 37/**
38 * the dummy prefix for exception parameters list to prepend in the absence of 38 * the dummy prefix for exception parameters list to prepend in the absence of
39 * konforka library 39 * konforka library
40 */ 40 */
41# define OPKELE_E_CONS_ 41# define OPKELE_E_CONS_
42/** 42/**
43 * the dummy placeholder for konforka exception codepoint specification 43 * the dummy placeholder for konforka exception codepoint specification
44 */ 44 */
45# define OPKELE_CP_ 45# define OPKELE_CP_
46/** 46/**
47 * the dummy define for the konforka-based rethrow of exception 47 * the dummy define for the konforka-based rethrow of exception
48 */ 48 */
49# define OPKELE_RETHROW 49# define OPKELE_RETHROW
50#endif /* OPKELE_HAVE_KONFORKA */ 50#endif /* OPKELE_HAVE_KONFORKA */
51/** 51/**
52 * the exception parameters list to pass to constructor 52 * the exception parameters list to pass to constructor
53 */ 53 */
54# define OPKELE_E_CONS OPKELE_E_CONS_ w 54# define OPKELE_E_CONS OPKELE_E_CONS_ w
55 55
56/*
57 * @brief the main opkele namespace
58 */
59namespace opkele { 56namespace opkele {
60 using std::string; 57 using std::string;
61 58
62 /** 59 /**
63 * the base opkele exception class 60 * the base opkele exception class
64 */ 61 */
65 class exception : public 62 class exception : public
66# ifdef OPKELE_HAVE_KONFORKA 63# ifdef OPKELE_HAVE_KONFORKA
67 konforka::exception 64 konforka::exception
68# else 65# else
69 std::exception 66 std::exception
70# endif 67# endif
71 { 68 {
72 public: 69 public:
73# ifdef OPKELE_HAVE_KONFORKA 70# ifdef OPKELE_HAVE_KONFORKA
74 explicit 71 explicit
75 exception(const string& fi,const string& fu,int l,const string& w) 72 exception(const string& fi,const string& fu,int l,const string& w)
76 : konforka::exception(fi,fu,l,w) { } 73 : konforka::exception(fi,fu,l,w) { }
77# else /* OPKELE_HAVE_KONFORKA */ 74# else /* OPKELE_HAVE_KONFORKA */
78 string _what; 75 string _what;
79 explicit 76 explicit
80 exception(const string& w) 77 exception(const string& w)
81 : _what(w) { } 78 : _what(w) { }
82 virtual ~exception() throw(); 79 virtual ~exception() throw();
83 virtual const char * what() const throw(); 80 virtual const char * what() const throw();
84# endif /* OPKELE_HAVE_KONFORKA */ 81# endif /* OPKELE_HAVE_KONFORKA */
85 }; 82 };
86 83
87 /** 84 /**
88 * thrown in case of failed conversion 85 * thrown in case of failed conversion
89 */ 86 */
90 class failed_conversion : public exception { 87 class failed_conversion : public exception {
91 public: 88 public:
92 failed_conversion(OPKELE_E_PARS) 89 failed_conversion(OPKELE_E_PARS)
93 : exception(OPKELE_E_CONS) { } 90 : exception(OPKELE_E_CONS) { }
94 }; 91 };
95 /** 92 /**
96 * thrown in case of failed lookup (either parameter or persistent store) 93 * thrown in case of failed lookup (either parameter or persistent store)
97 */ 94 */
98 class failed_lookup : public exception { 95 class failed_lookup : public exception {
99 public: 96 public:
100 failed_lookup(OPKELE_E_PARS) 97 failed_lookup(OPKELE_E_PARS)
101 : exception(OPKELE_E_CONS) { } 98 : exception(OPKELE_E_CONS) { }
102 }; 99 };
103 /** 100 /**
104 * thrown in case of bad input (either local or network) 101 * thrown in case of bad input (either local or network)
105 */ 102 */
106 class bad_input : public exception { 103 class bad_input : public exception {
107 public: 104 public:
108 bad_input(OPKELE_E_PARS) 105 bad_input(OPKELE_E_PARS)
109 : exception(OPKELE_E_CONS) { } 106 : exception(OPKELE_E_CONS) { }
110 }; 107 };
111 108
112 /** 109 /**
113 * thrown on failed assertion 110 * thrown on failed assertion
114 */ 111 */
115 class failed_assertion : public exception { 112 class failed_assertion : public exception {
116 public: 113 public:
117 failed_assertion(OPKELE_E_PARS) 114 failed_assertion(OPKELE_E_PARS)
118 : exception(OPKELE_E_CONS) { } 115 : exception(OPKELE_E_CONS) { }
119 }; 116 };
120 117
121 /** 118 /**
122 * thrown if the handle being retrieved is invalid 119 * thrown if the handle being retrieved is invalid
123 */ 120 */
124 class invalid_handle : public exception { 121 class invalid_handle : public exception {
125 public: 122 public:
126 invalid_handle(OPKELE_E_PARS) 123 invalid_handle(OPKELE_E_PARS)
127 : exception(OPKELE_E_CONS) { } 124 : exception(OPKELE_E_CONS) { }
128 }; 125 };
129 /** 126 /**
130 * thrown if the handle passed to check_authentication request is not 127 * thrown if the handle passed to check_authentication request is not
131 * stateless 128 * stateless
132 */ 129 */
133 class stateful_handle : public exception { 130 class stateful_handle : public exception {
134 public: 131 public:
135 stateful_handle(OPKELE_E_PARS) 132 stateful_handle(OPKELE_E_PARS)
136 : exception(OPKELE_E_CONS) { } 133 : exception(OPKELE_E_CONS) { }
137 }; 134 };
138 135
139 /** 136 /**
140 * thrown if check_authentication request fails 137 * thrown if check_authentication request fails
141 */ 138 */
142 class failed_check_authentication : public exception { 139 class failed_check_authentication : public exception {
143 public: 140 public:
144 failed_check_authentication(OPKELE_E_PARS) 141 failed_check_authentication(OPKELE_E_PARS)
145 : exception(OPKELE_E_CONS) { } 142 : exception(OPKELE_E_CONS) { }
146 }; 143 };
147 144
148 /** 145 /**
149 * thrown if the id_res request result is negative 146 * thrown if the id_res request result is negative
150 */ 147 */
151 class id_res_failed : public exception { 148 class id_res_failed : public exception {
152 public: 149 public:
153 id_res_failed(OPKELE_E_PARS) 150 id_res_failed(OPKELE_E_PARS)
154 : exception(OPKELE_E_CONS) { } 151 : exception(OPKELE_E_CONS) { }
155 }; 152 };
156 /** 153 /**
157 * thrown if the user_setup_url is provided with negative response 154 * thrown if the user_setup_url is provided with negative response
158 */ 155 */
159 class id_res_setup : public id_res_failed { 156 class id_res_setup : public id_res_failed {
160 public: 157 public:
161 string setup_url; 158 string setup_url;
162 id_res_setup(OPKELE_E_PARS,const string& su) 159 id_res_setup(OPKELE_E_PARS,const string& su)
163 : id_res_failed(OPKELE_E_CONS), setup_url(su) { } 160 : id_res_failed(OPKELE_E_CONS), setup_url(su) { }
164 ~id_res_setup() throw() { } 161 ~id_res_setup() throw() { }
165 }; 162 };
166 /** 163 /**
167 * thrown in case of signature mismatch 164 * thrown in case of signature mismatch
168 */ 165 */
169 class id_res_mismatch : public id_res_failed { 166 class id_res_mismatch : public id_res_failed {
170 public: 167 public:
171 id_res_mismatch(OPKELE_E_PARS) 168 id_res_mismatch(OPKELE_E_PARS)
172 : id_res_failed(OPKELE_E_CONS) { } 169 : id_res_failed(OPKELE_E_CONS) { }
173 }; 170 };
174 171
175 /** 172 /**
176 * openssl malfunction occured 173 * openssl malfunction occured
177 */ 174 */
178 class exception_openssl : public exception { 175 class exception_openssl : public exception {
179 public: 176 public:
180 unsigned long _error; 177 unsigned long _error;
181 string _ssl_string; 178 string _ssl_string;
182 exception_openssl(OPKELE_E_PARS); 179 exception_openssl(OPKELE_E_PARS);
183 ~exception_openssl() throw() { } 180 ~exception_openssl() throw() { }
184 }; 181 };
185 182
186 /** 183 /**
187 * network operation related error occured 184 * network operation related error occured
188 */ 185 */
189 class exception_network : public exception { 186 class exception_network : public exception {
190 public: 187 public:
191 exception_network(OPKELE_E_PARS) 188 exception_network(OPKELE_E_PARS)
192 : exception(OPKELE_E_CONS) { } 189 : exception(OPKELE_E_CONS) { }
193 }; 190 };
194 191
195 /** 192 /**
196 * network operation related error occured, specifically, related to 193 * network operation related error occured, specifically, related to
197 * libcurl 194 * libcurl
198 */ 195 */
199 class exception_curl : public exception_network { 196 class exception_curl : public exception_network {
200 public: 197 public:
201 CURLcode _error; 198 CURLcode _error;
202 string _curl_string; 199 string _curl_string;
203 exception_curl(OPKELE_E_PARS); 200 exception_curl(OPKELE_E_PARS);
204 exception_curl(OPKELE_E_PARS,CURLcode e); 201 exception_curl(OPKELE_E_PARS,CURLcode e);
205 ~exception_curl() throw() { } 202 ~exception_curl() throw() { }
206 }; 203 };
207 204
208 /** 205 /**
209 * not implemented (think pure virtual) member function executed, signfies 206 * not implemented (think pure virtual) member function executed, signfies
210 * programmer error 207 * programmer error
211 */ 208 */
212 class not_implemented : public exception { 209 class not_implemented : public exception {
213 public: 210 public:
214 not_implemented(OPKELE_E_PARS) 211 not_implemented(OPKELE_E_PARS)
215 : exception(OPKELE_E_CONS) { } 212 : exception(OPKELE_E_CONS) { }
216 }; 213 };
217 214
218} 215}
219 216
220#endif /* __OPKELE_EXCEPTION_H */ 217#endif /* __OPKELE_EXCEPTION_H */
diff --git a/include/opkele/extension.h b/include/opkele/extension.h
index f547555..ea0c74c 100644
--- a/include/opkele/extension.h
+++ b/include/opkele/extension.h
@@ -1,66 +1,63 @@
1#ifndef __OPKELE_EXTENSION_H 1#ifndef __OPKELE_EXTENSION_H
2#define __OPKELE_EXTENSION_H 2#define __OPKELE_EXTENSION_H
3 3
4/** 4/**
5 * @file 5 * @file
6 * @brief extensions framework basics 6 * @brief extensions framework basics
7 */ 7 */
8 8
9#include <opkele/types.h> 9#include <opkele/types.h>
10 10
11/**
12 * @brief the main opkele namespace
13 */
14namespace opkele { 11namespace opkele {
15 12
16 /** 13 /**
17 * OpenID extension hooks base class 14 * OpenID extension hooks base class
18 */ 15 */
19 class extension_t { 16 class extension_t {
20 public: 17 public:
21 /** 18 /**
22 * hook called by consumer before submitting data to OpenID server. 19 * hook called by consumer before submitting data to OpenID server.
23 * It is supposed to manipulate parameters list. 20 * It is supposed to manipulate parameters list.
24 * @param p parameters about to be submitted to server 21 * @param p parameters about to be submitted to server
25 * @param identity identity being verified. It may differ from the 22 * @param identity identity being verified. It may differ from the
26 * one available in parameters list in case of delegation 23 * one available in parameters list in case of delegation
27 * @see consumer_t::checkid_ 24 * @see consumer_t::checkid_
28 * @see consumer_t::checkid_immediate 25 * @see consumer_t::checkid_immediate
29 * @see consumer_t::checkid_setup 26 * @see consumer_t::checkid_setup
30 */ 27 */
31 virtual void checkid_hook(params_t& p,const string& identity); 28 virtual void checkid_hook(params_t& p,const string& identity);
32 /** 29 /**
33 * hook called by consumer after identity information received from 30 * hook called by consumer after identity information received from
34 * OpenID server is verified. 31 * OpenID server is verified.
35 * @param p parameters received from server 32 * @param p parameters received from server
36 * @param sp signed parameters received from server with 'openid.' 33 * @param sp signed parameters received from server with 'openid.'
37 * leader stripped 34 * leader stripped
38 * @param identity identity confirmed. May differ from the one 35 * @param identity identity confirmed. May differ from the one
39 * available in parameters list in case of delegation. May also be 36 * available in parameters list in case of delegation. May also be
40 * empty which means - extract one from parameters 37 * empty which means - extract one from parameters
41 * @see consumer_t::id_res 38 * @see consumer_t::id_res
42 */ 39 */
43 virtual void id_res_hook(const params_t& p,const params_t& sp,const string& identity); 40 virtual void id_res_hook(const params_t& p,const params_t& sp,const string& identity);
44 41
45 /** 42 /**
46 * hook called by server before returning information to consumer. 43 * hook called by server before returning information to consumer.
47 * The hook may manipulate output parameters. It is important to 44 * The hook may manipulate output parameters. It is important to
48 * note that modified pout["signed"] is used for signing response. 45 * note that modified pout["signed"] is used for signing response.
49 * @param pin request parameters list with "openid." prefix 46 * @param pin request parameters list with "openid." prefix
50 * @param pout response parameters list without "openid." prefix 47 * @param pout response parameters list without "openid." prefix
51 * @see server_t::checkid_ 48 * @see server_t::checkid_
52 * @see server_t::checkid_immediate 49 * @see server_t::checkid_immediate
53 * @see server_t::checkid_setup 50 * @see server_t::checkid_setup
54 */ 51 */
55 virtual void checkid_hook(const params_t& pin,params_t& pout); 52 virtual void checkid_hook(const params_t& pin,params_t& pout);
56 53
57 /** 54 /**
58 * Casts the object to pointer to itself. For convenient passing 55 * Casts the object to pointer to itself. For convenient passing
59 * of pointer. 56 * of pointer.
60 */ 57 */
61 operator extension_t*(void) { return this; } 58 operator extension_t*(void) { return this; }
62 }; 59 };
63 60
64} 61}
65 62
66#endif /* __OPKELE_EXTENSION_H */ 63#endif /* __OPKELE_EXTENSION_H */
diff --git a/include/opkele/extension_chain.h b/include/opkele/extension_chain.h
index 955f4d5..f0eea94 100644
--- a/include/opkele/extension_chain.h
+++ b/include/opkele/extension_chain.h
@@ -1,50 +1,38 @@
1#ifndef __OPKELE_EXTENSION_CHAIN_H 1#ifndef __OPKELE_EXTENSION_CHAIN_H
2#define __OPKELE_EXTENSION_CHAIN_H 2#define __OPKELE_EXTENSION_CHAIN_H
3 3
4/** 4/**
5 * @file 5 * @file
6 * @brief extension chain extension 6 * @brief extension chain extension
7 */ 7 */
8 8
9#include <list> 9#include <list>
10#include <opkele/extension.h> 10#include <opkele/extension.h>
11 11
12/**
13 * @brief the main opkele namespace
14 */
15namespace opkele { 12namespace opkele {
16 using std::list; 13 using std::list;
17 14
18 /** 15 /**
19 * OpenID extensions chain used to combine extensions, it is actually an 16 * OpenID extensions chain used to combine extensions, it is actually an
20 * stl list of pointers to extensions. 17 * stl list of pointers to extensions.
21 */ 18 */
22 class extension_chain_t : public extension_t, public list<extension_t*> { 19 class extension_chain_t : public extension_t, public list<extension_t*> {
23 public: 20 public:
24 21
25 /** 22 /**
26 * Default constructor creates an empty chain 23 * Default constructor creates an empty chain
27 */ 24 */
28 extension_chain_t() { } 25 extension_chain_t() { }
29 /** 26 /**
30 * Create extension chain with a single extension in it 27 * Create extension chain with a single extension in it
31 */ 28 */
32 extension_chain_t(extension_t *e) { push_back(e); } 29 extension_chain_t(extension_t *e) { push_back(e); }
33 30
34 /**
35 * Implementation of consumer's checkid hook
36 */
37 virtual void checkid_hook(params_t& p,const string& identity); 31 virtual void checkid_hook(params_t& p,const string& identity);
38 /**
39 * Implementation of consumer's id_res hook
40 */
41 virtual void id_res_hook(const params_t& p,const params_t& sp,const string& identity); 32 virtual void id_res_hook(const params_t& p,const params_t& sp,const string& identity);
42 /**
43 * Implementation of server's checkid_hook
44 */
45 virtual void checkid_hook(const params_t& pin,params_t& pout); 33 virtual void checkid_hook(const params_t& pin,params_t& pout);
46 }; 34 };
47 35
48} 36}
49 37
50#endif /* __OPKELE_EXTENSION_CHAIN_H */ 38#endif /* __OPKELE_EXTENSION_CHAIN_H */
diff --git a/include/opkele/server.h b/include/opkele/server.h
index 598eb47..e7e5bb3 100644
--- a/include/opkele/server.h
+++ b/include/opkele/server.h
@@ -1,99 +1,96 @@
1#ifndef __OPKELE_SERVER_H 1#ifndef __OPKELE_SERVER_H
2#define __OPKELE_SERVER_H 2#define __OPKELE_SERVER_H
3 3
4/** 4/**
5 * @file 5 * @file
6 * @brief OpenID server-side functionality 6 * @brief OpenID server-side functionality
7 */ 7 */
8 8
9#include <opkele/types.h> 9#include <opkele/types.h>
10#include <opkele/extension.h> 10#include <opkele/extension.h>
11 11
12/**
13 * @brief the main opkele namespace
14 */
15namespace opkele { 12namespace opkele {
16 13
17 /** 14 /**
18 * implementation of basic server functionality 15 * implementation of basic server functionality
19 */ 16 */
20 class server_t { 17 class server_t {
21 public: 18 public:
22 19
23 /** 20 /**
24 * allocate the new association. The function should be overridden 21 * allocate the new association. The function should be overridden
25 * in the real implementation to provide persistent assocations 22 * in the real implementation to provide persistent assocations
26 * store. 23 * store.
27 * @param mode the mode of request being processed to base the 24 * @param mode the mode of request being processed to base the
28 * statelessness of the association upon 25 * statelessness of the association upon
29 * @return the auto_ptr<> for the newly allocated association_t object 26 * @return the auto_ptr<> for the newly allocated association_t object
30 */ 27 */
31 virtual assoc_t alloc_assoc(mode_t mode) = 0; 28 virtual assoc_t alloc_assoc(mode_t mode) = 0;
32 /** 29 /**
33 * retrieve the association. The function should be overridden in 30 * retrieve the association. The function should be overridden in
34 * the reqal implementation to provide persistent assocations 31 * the reqal implementation to provide persistent assocations
35 * store. 32 * store.
36 * @param h association handle 33 * @param h association handle
37 * @return the auto_ptr<> for the newly allocated association_t object 34 * @return the auto_ptr<> for the newly allocated association_t object
38 * @throw failed_lookup in case of failure 35 * @throw failed_lookup in case of failure
39 */ 36 */
40 virtual assoc_t retrieve_assoc(const string& h) = 0; 37 virtual assoc_t retrieve_assoc(const string& h) = 0;
41 38
42 /** 39 /**
43 * validate the identity. 40 * validate the identity.
44 * @param assoc association object 41 * @param assoc association object
45 * @param pin incoming request parameters 42 * @param pin incoming request parameters
46 * @param identity being verified 43 * @param identity being verified
47 * @param trust_root presented in the request 44 * @param trust_root presented in the request
48 * @throw exception if identity can not be confirmed 45 * @throw exception if identity can not be confirmed
49 */ 46 */
50 virtual void validate(const association_t& assoc,const params_t& pin,const string& identity,const string& trust_root) = 0; 47 virtual void validate(const association_t& assoc,const params_t& pin,const string& identity,const string& trust_root) = 0;
51 48
52 49
53 /** 50 /**
54 * process the associate request. 51 * process the associate request.
55 * @param pin the incoming request parameters 52 * @param pin the incoming request parameters
56 * @param pout the store for the response parameters 53 * @param pout the store for the response parameters
57 */ 54 */
58 void associate(const params_t& pin,params_t& pout); 55 void associate(const params_t& pin,params_t& pout);
59 /** 56 /**
60 * process the checkid_immediate request. 57 * process the checkid_immediate request.
61 * @param pin the incoming request parameters 58 * @param pin the incoming request parameters
62 * @param return_to reference to the object to store return_to url to 59 * @param return_to reference to the object to store return_to url to
63 * @param pout the response parameters 60 * @param pout the response parameters
64 * @param ext pointer to the extension hooks object 61 * @param ext pointer to the extension hooks object
65 * @throw exception in case of errors or negative reply 62 * @throw exception in case of errors or negative reply
66 */ 63 */
67 virtual void checkid_immediate(const params_t& pin,string& return_to,params_t& pout,extension_t *ext=0); 64 virtual void checkid_immediate(const params_t& pin,string& return_to,params_t& pout,extension_t *ext=0);
68 /** 65 /**
69 * process the checkid_setup request. 66 * process the checkid_setup request.
70 * @param pin the incoming request parameters 67 * @param pin the incoming request parameters
71 * @param return_to reference to the object to store return_to url to 68 * @param return_to reference to the object to store return_to url to
72 * @param pout the response parameters 69 * @param pout the response parameters
73 * @param ext pointer to the extension hooks object 70 * @param ext pointer to the extension hooks object
74 * @throw exception in case of errors or negative reply 71 * @throw exception in case of errors or negative reply
75 */ 72 */
76 virtual void checkid_setup(const params_t& pin,string& return_to,params_t& pout,extension_t *ext=0); 73 virtual void checkid_setup(const params_t& pin,string& return_to,params_t& pout,extension_t *ext=0);
77 /** 74 /**
78 * the actual functionality behind checkid_immediate() and 75 * the actual functionality behind checkid_immediate() and
79 * checkid_setup() 76 * checkid_setup()
80 * @param mode the request being processed (either 77 * @param mode the request being processed (either
81 * mode_checkid_immediate or mode_checkid_setup) 78 * mode_checkid_immediate or mode_checkid_setup)
82 * @param pin the incoming request parameters 79 * @param pin the incoming request parameters
83 * @param return_to reference to the object to store return_to url to 80 * @param return_to reference to the object to store return_to url to
84 * @param pout the response parameters 81 * @param pout the response parameters
85 * @param ext pointer to the extension hooks object 82 * @param ext pointer to the extension hooks object
86 * @throw exception in case of errors or negative reply 83 * @throw exception in case of errors or negative reply
87 */ 84 */
88 virtual void checkid_(mode_t mode,const params_t& pin,string& return_to,params_t& pout,extension_t *ext=0); 85 virtual void checkid_(mode_t mode,const params_t& pin,string& return_to,params_t& pout,extension_t *ext=0);
89 /** 86 /**
90 * process the check_authentication request. 87 * process the check_authentication request.
91 * @param pin incoming request parameters 88 * @param pin incoming request parameters
92 * @param pout response parameters 89 * @param pout response parameters
93 */ 90 */
94 void check_authentication(const params_t& pin,params_t& pout); 91 void check_authentication(const params_t& pin,params_t& pout);
95 }; 92 };
96 93
97} 94}
98 95
99#endif /* __OPKELE_SERVER_H */ 96#endif /* __OPKELE_SERVER_H */
diff --git a/include/opkele/sreg.h b/include/opkele/sreg.h
index 6713ef7..df37a86 100644
--- a/include/opkele/sreg.h
+++ b/include/opkele/sreg.h
@@ -1,206 +1,203 @@
1#ifndef __OPKELE_SREG_H 1#ifndef __OPKELE_SREG_H
2#define __OPKELE_SREG_H 2#define __OPKELE_SREG_H
3 3
4/** 4/**
5 * @file 5 * @file
6 * @brief Simple registration extension 6 * @brief Simple registration extension
7 */ 7 */
8 8
9#include <opkele/extension.h> 9#include <opkele/extension.h>
10 10
11/**
12 * @brief the main opkele namespace
13 */
14namespace opkele { 11namespace opkele {
15 using std::map; 12 using std::map;
16 13
17 /** 14 /**
18 * OpenID simple registration extension implementation 15 * OpenID simple registration extension implementation
19 * http://openid.net/specs/openid-simple-registration-extension-1_0.html 16 * http://openid.net/specs/openid-simple-registration-extension-1_0.html
20 */ 17 */
21 class sreg_t : public extension_t { 18 class sreg_t : public extension_t {
22 public: 19 public:
23 /** 20 /**
24 * sreg fields enumeration 21 * sreg fields enumeration
25 */ 22 */
26 enum fieldbit_t { 23 enum fieldbit_t {
27 /** 24 /**
28 * Any UTF-8 string that the End User wants to use as a nickname. 25 * Any UTF-8 string that the End User wants to use as a nickname.
29 */ 26 */
30 field_nickname = 1, 27 field_nickname = 1,
31 /** 28 /**
32 * The email address of the End User as specified in section 3.4.1 of [RFC2822] 29 * The email address of the End User as specified in section 3.4.1 of [RFC2822]
33 */ 30 */
34 field_email = 2, 31 field_email = 2,
35 /** 32 /**
36 * UTF-8 string free text representation of the End User's full name. 33 * UTF-8 string free text representation of the End User's full name.
37 */ 34 */
38 field_fullname = 4, 35 field_fullname = 4,
39 /** 36 /**
40 * The End User's date of birth as YYYY-MM-DD. Any values whose 37 * The End User's date of birth as YYYY-MM-DD. Any values whose
41 * representation uses fewer than the specified number of 38 * representation uses fewer than the specified number of
42 * digits should be zero-padded. The length of this value MUST 39 * digits should be zero-padded. The length of this value MUST
43 * always be 10. If the End User user does not want to reveal 40 * always be 10. If the End User user does not want to reveal
44 * any particular component of this value, it MUST be set to 41 * any particular component of this value, it MUST be set to
45 * zero. 42 * zero.
46 * 43 *
47 * For instance, if a End User wants to specify that his date 44 * For instance, if a End User wants to specify that his date
48 * of birth is in 1980, but not the month or day, the value 45 * of birth is in 1980, but not the month or day, the value
49 * returned SHALL be "1980-00-00". 46 * returned SHALL be "1980-00-00".
50 */ 47 */
51 field_dob = 8, 48 field_dob = 8,
52 /** 49 /**
53 * Alias to field_dob 50 * Alias to field_dob
54 */ 51 */
55 field_birthdate = field_dob, 52 field_birthdate = field_dob,
56 /** 53 /**
57 * The End User's gender, "M" for male, "F" for female. 54 * The End User's gender, "M" for male, "F" for female.
58 */ 55 */
59 field_gender = 16, 56 field_gender = 16,
60 /** 57 /**
61 * Alias to field_gender 58 * Alias to field_gender
62 */ 59 */
63 field_sex = field_gender, 60 field_sex = field_gender,
64 /** 61 /**
65 * UTF-8 string free text that SHOULD conform to the End User's 62 * UTF-8 string free text that SHOULD conform to the End User's
66 * country's postal system. 63 * country's postal system.
67 */ 64 */
68 field_postcode = 32, 65 field_postcode = 32,
69 /** 66 /**
70 * The End User's country of residence as specified by ISO3166 67 * The End User's country of residence as specified by ISO3166
71 */ 68 */
72 field_country = 64, 69 field_country = 64,
73 /** 70 /**
74 * End User's preferred language as specified by ISO639 71 * End User's preferred language as specified by ISO639
75 */ 72 */
76 field_language = 128, 73 field_language = 128,
77 /** 74 /**
78 * ASCII string from TimeZone database 75 * ASCII string from TimeZone database
79 * 76 *
80 * For example, "Europe/Paris" or "America/Los_Angeles". 77 * For example, "Europe/Paris" or "America/Los_Angeles".
81 */ 78 */
82 field_timezone = 256, 79 field_timezone = 256,
83 /** 80 /**
84 * All fields bits combined 81 * All fields bits combined
85 */ 82 */
86 fields_ALL = 511, 83 fields_ALL = 511,
87 /** 84 /**
88 * No fields 85 * No fields
89 */ 86 */
90 fields_NONE = 0 87 fields_NONE = 0
91 }; 88 };
92 /** 89 /**
93 * Bitmask for fields which, if absent from the response, will 90 * Bitmask for fields which, if absent from the response, will
94 * prevent the Consumer from completing the registration without 91 * prevent the Consumer from completing the registration without
95 * End User interation. 92 * End User interation.
96 */ 93 */
97 long fields_required; 94 long fields_required;
98 /** 95 /**
99 * Bitmask for fields that will be used by the Consumer, but whose 96 * Bitmask for fields that will be used by the Consumer, but whose
100 * absence will not prevent the registration from completing. 97 * absence will not prevent the registration from completing.
101 */ 98 */
102 long fields_optional; 99 long fields_optional;
103 /** 100 /**
104 * A URL which the Consumer provides to give the End User a place 101 * A URL which the Consumer provides to give the End User a place
105 * to read about the how the profile data will be used. The 102 * to read about the how the profile data will be used. The
106 * Identity Provider SHOULD display this URL to the End User if it 103 * Identity Provider SHOULD display this URL to the End User if it
107 * is given. 104 * is given.
108 */ 105 */
109 string policy_url; 106 string policy_url;
110 107
111 /** 108 /**
112 * Bitmask for fields present in response 109 * Bitmask for fields present in response
113 */ 110 */
114 long has_fields; 111 long has_fields;
115 /** 112 /**
116 * Container type for response fields values 113 * Container type for response fields values
117 */ 114 */
118 typedef map<fieldbit_t,string> response_t; 115 typedef map<fieldbit_t,string> response_t;
119 /** 116 /**
120 * Response contents 117 * Response contents
121 */ 118 */
122 response_t response; 119 response_t response;
123 120
124 /** 121 /**
125 * Fields bitmask to send in response 122 * Fields bitmask to send in response
126 */ 123 */
127 long fields_response; 124 long fields_response;
128 125
129 /** 126 /**
130 * Consumer constructor. 127 * Consumer constructor.
131 * @param fr required fields 128 * @param fr required fields
132 * @see fields_required 129 * @see fields_required
133 * @param fo optional fields 130 * @param fo optional fields
134 * @see fields_optional 131 * @see fields_optional
135 * @param pu policy url 132 * @param pu policy url
136 * @see policy_url 133 * @see policy_url
137 */ 134 */
138 sreg_t(long fr=fields_NONE,long fo=fields_NONE,const string& pu="") 135 sreg_t(long fr=fields_NONE,long fo=fields_NONE,const string& pu="")
139 : fields_required(fr), fields_optional(fo), policy_url(pu), has_fields(0) { } 136 : fields_required(fr), fields_optional(fo), policy_url(pu), has_fields(0) { }
140 137
141 /** 138 /**
142 * Implementation of consumer's checkid hook 139 * Implementation of consumer's checkid hook
143 */ 140 */
144 virtual void checkid_hook(params_t& p,const string& identity); 141 virtual void checkid_hook(params_t& p,const string& identity);
145 /** 142 /**
146 * Implementation of consumer's id_res hook 143 * Implementation of consumer's id_res hook
147 */ 144 */
148 virtual void id_res_hook(const params_t& p,const params_t& sp,const string& identity); 145 virtual void id_res_hook(const params_t& p,const params_t& sp,const string& identity);
149 /** 146 /**
150 * Implementation of server's checkid_hook 147 * Implementation of server's checkid_hook
151 */ 148 */
152 virtual void checkid_hook(const params_t& pin,params_t& pout); 149 virtual void checkid_hook(const params_t& pin,params_t& pout);
153 150
154 /** 151 /**
155 * Check and see if we have value for some particular field. 152 * Check and see if we have value for some particular field.
156 * @param fb field in question 153 * @param fb field in question
157 * @see fieldbit_t 154 * @see fieldbit_t
158 * @return true if the value is available 155 * @return true if the value is available
159 */ 156 */
160 bool has_field(fieldbit_t fb) const { return has_fields&fb; } 157 bool has_field(fieldbit_t fb) const { return has_fields&fb; }
161 158
162 /** 159 /**
163 * Retrieve the value for a field. 160 * Retrieve the value for a field.
164 * @param fb field in question 161 * @param fb field in question
165 * @see fieldbit_t 162 * @see fieldbit_t
166 * @return field value 163 * @return field value
167 * @throw failed_lookup if no data avaialble 164 * @throw failed_lookup if no data avaialble
168 */ 165 */
169 const string& get_field(fieldbit_t fb) const; 166 const string& get_field(fieldbit_t fb) const;
170 167
171 /** 168 /**
172 * Set the value for a field. 169 * Set the value for a field.
173 * @param fb field in question 170 * @param fb field in question
174 * @see fieldbit_t 171 * @see fieldbit_t
175 * @param fv field value 172 * @param fv field value
176 */ 173 */
177 void set_field(fieldbit_t fb,const string& fv); 174 void set_field(fieldbit_t fb,const string& fv);
178 175
179 /** 176 /**
180 * Remove the value for a field. 177 * Remove the value for a field.
181 * @param fb field in question 178 * @param fb field in question
182 * @see fieldbit_t 179 * @see fieldbit_t
183 */ 180 */
184 void reset_field(fieldbit_t fb); 181 void reset_field(fieldbit_t fb);
185 182
186 /** 183 /**
187 * Reset field data 184 * Reset field data
188 */ 185 */
189 void clear(); 186 void clear();
190 187
191 /** 188 /**
192 * Function called after parsing sreg request to set up response 189 * Function called after parsing sreg request to set up response
193 * fields. The default implementation tries to send as much fields 190 * fields. The default implementation tries to send as much fields
194 * as we have. The function is supposed to set the data and 191 * as we have. The function is supposed to set the data and
195 * fields_response. 192 * fields_response.
196 * @see fields_response 193 * @see fields_response
197 * @param pin input request parameters with "openid." prefix 194 * @param pin input request parameters with "openid." prefix
198 * @param pout output request parameters without "openid." prefix. 195 * @param pout output request parameters without "openid." prefix.
199 * @see checkid_hook(const params_t&,params_t&) 196 * @see checkid_hook(const params_t&,params_t&)
200 */ 197 */
201 virtual void setup_response(const params_t& pin,params_t& pout); 198 virtual void setup_response(const params_t& pin,params_t& pout);
202 199
203 }; 200 };
204} 201}
205 202
206#endif /* __OPKELE_SREG_H */ 203#endif /* __OPKELE_SREG_H */
diff --git a/include/opkele/types.h b/include/opkele/types.h
index ba06776..757c0af 100644
--- a/include/opkele/types.h
+++ b/include/opkele/types.h
@@ -1,168 +1,165 @@
1#ifndef __OPKELE_TYPES_H 1#ifndef __OPKELE_TYPES_H
2#define __OPKELE_TYPES_H 2#define __OPKELE_TYPES_H
3 3
4/** 4/**
5 * @file 5 * @file
6 * @brief various types declarations 6 * @brief various types declarations
7 */ 7 */
8 8
9#include <ostream> 9#include <ostream>
10#include <vector> 10#include <vector>
11#include <string> 11#include <string>
12#include <map> 12#include <map>
13#include <memory> 13#include <memory>
14 14
15/**
16 * @brief the main opkele namespace
17 */
18namespace opkele { 15namespace opkele {
19 using std::vector; 16 using std::vector;
20 using std::string; 17 using std::string;
21 using std::map; 18 using std::map;
22 using std::ostream; 19 using std::ostream;
23 using std::auto_ptr; 20 using std::auto_ptr;
24 21
25 /** 22 /**
26 * the OpenID operation mode 23 * the OpenID operation mode
27 */ 24 */
28 typedef enum _mode_t { 25 typedef enum _mode_t {
29 mode_associate, 26 mode_associate,
30 mode_checkid_immediate, 27 mode_checkid_immediate,
31 mode_checkid_setup, 28 mode_checkid_setup,
32 mode_check_association 29 mode_check_association
33 } mode_t; 30 } mode_t;
34 31
35 /** 32 /**
36 * the association secret container 33 * the association secret container
37 */ 34 */
38 class secret_t : public vector<unsigned char> { 35 class secret_t : public vector<unsigned char> {
39 public: 36 public:
40 37
41 /** 38 /**
42 * xor the secret and hmac together and encode, using base64 39 * xor the secret and hmac together and encode, using base64
43 * @param key_sha1 pointer to the sha1 digest 40 * @param key_sha1 pointer to the sha1 digest
44 * @param rv reference to the return value 41 * @param rv reference to the return value
45 */ 42 */
46 void enxor_to_base64(const unsigned char *key_sha1,string& rv) const; 43 void enxor_to_base64(const unsigned char *key_sha1,string& rv) const;
47 /** 44 /**
48 * decode base64-encoded secret and xor it with the sha1 digest 45 * decode base64-encoded secret and xor it with the sha1 digest
49 * @param key_sha1 pointer to the message digest 46 * @param key_sha1 pointer to the message digest
50 * @param b64 base64-encoded secret value 47 * @param b64 base64-encoded secret value
51 */ 48 */
52 void enxor_from_base64(const unsigned char *key_sha1,const string& b64); 49 void enxor_from_base64(const unsigned char *key_sha1,const string& b64);
53 /** 50 /**
54 * plainly encode to base64 representation 51 * plainly encode to base64 representation
55 * @param rv reference to the return value 52 * @param rv reference to the return value
56 */ 53 */
57 void to_base64(string& rv) const; 54 void to_base64(string& rv) const;
58 /** 55 /**
59 * decode cleartext secret from base64 56 * decode cleartext secret from base64
60 * @param b64 base64-encoded representation of the secret value 57 * @param b64 base64-encoded representation of the secret value
61 */ 58 */
62 void from_base64(const string& b64); 59 void from_base64(const string& b64);
63 }; 60 };
64 61
65 /** 62 /**
66 * Interface to the association. 63 * Interface to the association.
67 */ 64 */
68 class association_t { 65 class association_t {
69 public: 66 public:
70 67
71 /** 68 /**
72 * retrieve the server with which association was established. 69 * retrieve the server with which association was established.
73 * @return server name 70 * @return server name
74 */ 71 */
75 virtual string server() const = 0; 72 virtual string server() const = 0;
76 /** 73 /**
77 * retrieve the association handle. 74 * retrieve the association handle.
78 * @return handle 75 * @return handle
79 */ 76 */
80 virtual string handle() const = 0; 77 virtual string handle() const = 0;
81 /** 78 /**
82 * retrieve the association type. 79 * retrieve the association type.
83 * @return association type 80 * @return association type
84 */ 81 */
85 virtual string assoc_type() const = 0; 82 virtual string assoc_type() const = 0;
86 /** 83 /**
87 * retrieve the association secret. 84 * retrieve the association secret.
88 * @return association secret 85 * @return association secret
89 */ 86 */
90 virtual secret_t secret() const = 0; 87 virtual secret_t secret() const = 0;
91 /** 88 /**
92 * retrieve the number of seconds the association expires in. 89 * retrieve the number of seconds the association expires in.
93 * @return seconds till expiration 90 * @return seconds till expiration
94 */ 91 */
95 virtual int expires_in() const = 0; 92 virtual int expires_in() const = 0;
96 /** 93 /**
97 * check whether the association is stateless. 94 * check whether the association is stateless.
98 * @return true if stateless 95 * @return true if stateless
99 */ 96 */
100 virtual bool stateless() const = 0; 97 virtual bool stateless() const = 0;
101 }; 98 };
102 99
103 /** 100 /**
104 * the auto_ptr<> for association_t object type 101 * the auto_ptr<> for association_t object type
105 */ 102 */
106 typedef auto_ptr<association_t> assoc_t; 103 typedef auto_ptr<association_t> assoc_t;
107 104
108 /** 105 /**
109 * request/response parameters map 106 * request/response parameters map
110 */ 107 */
111 class params_t : public map<string,string> { 108 class params_t : public map<string,string> {
112 public: 109 public:
113 110
114 /** 111 /**
115 * check whether the parameter is present. 112 * check whether the parameter is present.
116 * @param n the parameter name 113 * @param n the parameter name
117 * @return true if yes 114 * @return true if yes
118 */ 115 */
119 bool has_param(const string& n) const; 116 bool has_param(const string& n) const;
120 /** 117 /**
121 * retrieve the parameter (const version) 118 * retrieve the parameter (const version)
122 * @param n the parameter name 119 * @param n the parameter name
123 * @return the parameter value 120 * @return the parameter value
124 * @throw failed_lookup if there is no such parameter 121 * @throw failed_lookup if there is no such parameter
125 */ 122 */
126 const string& get_param(const string& n) const; 123 const string& get_param(const string& n) const;
127 /** 124 /**
128 * retrieve the parameter. 125 * retrieve the parameter.
129 * @param n the parameter name 126 * @param n the parameter name
130 * @return the parameter value 127 * @return the parameter value
131 * @throw failed_lookup if there is no such parameter 128 * @throw failed_lookup if there is no such parameter
132 */ 129 */
133 string& get_param(const string& n); 130 string& get_param(const string& n);
134 131
135 /** 132 /**
136 * parse the OpenID key/value data. 133 * parse the OpenID key/value data.
137 * @param kv the OpenID key/value data 134 * @param kv the OpenID key/value data
138 */ 135 */
139 void parse_keyvalues(const string& kv); 136 void parse_keyvalues(const string& kv);
140 /** 137 /**
141 * sign the fields. 138 * sign the fields.
142 * @param secret the secret used for signing 139 * @param secret the secret used for signing
143 * @param sig reference to the string, containing base64-encoded 140 * @param sig reference to the string, containing base64-encoded
144 * result 141 * result
145 * @param slist the comma-separated list of fields to sign 142 * @param slist the comma-separated list of fields to sign
146 * @param prefix the string to prepend to parameter names 143 * @param prefix the string to prepend to parameter names
147 */ 144 */
148 void sign(secret_t secret,string& sig,const string& slist,const char *prefix=0) const; 145 void sign(secret_t secret,string& sig,const string& slist,const char *prefix=0) const;
149 146
150 /** 147 /**
151 * append parameters to the URL as a GET-request parameters. 148 * append parameters to the URL as a GET-request parameters.
152 * @param url the base URL 149 * @param url the base URL
153 * @param prefix the string to prepend to parameter names 150 * @param prefix the string to prepend to parameter names
154 * @return the ready-to-use location 151 * @return the ready-to-use location
155 */ 152 */
156 string append_query(const string& url,const char *prefix = "openid.") const; 153 string append_query(const string& url,const char *prefix = "openid.") const;
157 }; 154 };
158 155
159 /** 156 /**
160 * dump the key/value pairs for the parameters to the stream. 157 * dump the key/value pairs for the parameters to the stream.
161 * @param o output stream 158 * @param o output stream
162 * @param p the parameters 159 * @param p the parameters
163 */ 160 */
164 ostream& operator << (ostream& o,const params_t& p); 161 ostream& operator << (ostream& o,const params_t& p);
165 162
166} 163}
167 164
168#endif /* __OPKELE_TYPES_H */ 165#endif /* __OPKELE_TYPES_H */
diff --git a/include/opkele/util.h b/include/opkele/util.h
index 2a7a859..edc1859 100644
--- a/include/opkele/util.h
+++ b/include/opkele/util.h
@@ -1,130 +1,133 @@
1#ifndef __OPKELE_UTIL_H 1#ifndef __OPKELE_UTIL_H
2#define __OPKELE_UTIL_H 2#define __OPKELE_UTIL_H
3 3
4#include <time.h> 4#include <time.h>
5#include <string> 5#include <string>
6#include <vector> 6#include <vector>
7#include <openssl/bn.h> 7#include <openssl/bn.h>
8#include <openssl/dh.h> 8#include <openssl/dh.h>
9 9
10namespace opkele { 10namespace opkele {
11 using std::string; 11 using std::string;
12 using std::vector; 12 using std::vector;
13 13
14 /**
15 * @brief opkele utils namespace
16 */
14 namespace util { 17 namespace util {
15 18
16 /** 19 /**
17 * Convenience class encapsulating SSL BIGNUM object for the purpose of 20 * Convenience class encapsulating SSL BIGNUM object for the purpose of
18 * automatical freeing. 21 * automatical freeing.
19 */ 22 */
20 class bignum_t { 23 class bignum_t {
21 public: 24 public:
22 BIGNUM *_bn; 25 BIGNUM *_bn;
23 26
24 bignum_t() : _bn(0) { } 27 bignum_t() : _bn(0) { }
25 bignum_t(BIGNUM *bn) : _bn(bn) { } 28 bignum_t(BIGNUM *bn) : _bn(bn) { }
26 ~bignum_t() throw() { if(_bn) BN_free(_bn); } 29 ~bignum_t() throw() { if(_bn) BN_free(_bn); }
27 30
28 bignum_t& operator=(BIGNUM *bn) { if(_bn) BN_free(_bn); _bn = bn; return *this; } 31 bignum_t& operator=(BIGNUM *bn) { if(_bn) BN_free(_bn); _bn = bn; return *this; }
29 32
30 operator const BIGNUM*(void) const { return _bn; } 33 operator const BIGNUM*(void) const { return _bn; }
31 operator BIGNUM*(void) { return _bn; } 34 operator BIGNUM*(void) { return _bn; }
32 }; 35 };
33 /** 36 /**
34 * Convenience clas encapsulating SSL DH object for the purpose of 37 * Convenience clas encapsulating SSL DH object for the purpose of
35 * automatic freeing. 38 * automatic freeing.
36 */ 39 */
37 class dh_t { 40 class dh_t {
38 public: 41 public:
39 DH *_dh; 42 DH *_dh;
40 43
41 dh_t() : _dh(0) { } 44 dh_t() : _dh(0) { }
42 dh_t(DH *dh) : _dh(dh) { } 45 dh_t(DH *dh) : _dh(dh) { }
43 ~dh_t() throw() { if(_dh) DH_free(_dh); } 46 ~dh_t() throw() { if(_dh) DH_free(_dh); }
44 47
45 dh_t& operator=(DH *dh) { if(_dh) DH_free(_dh); _dh = dh; return *this; } 48 dh_t& operator=(DH *dh) { if(_dh) DH_free(_dh); _dh = dh; return *this; }
46 49
47 operator const DH*(void) const { return _dh; } 50 operator const DH*(void) const { return _dh; }
48 operator DH*(void) { return _dh; } 51 operator DH*(void) { return _dh; }
49 52
50 DH* operator->() { return _dh; } 53 DH* operator->() { return _dh; }
51 const DH* operator->() const { return _dh; } 54 const DH* operator->() const { return _dh; }
52 }; 55 };
53 56
54 /** 57 /**
55 * Convert base64-encoded SSL BIGNUM to internal representation. 58 * Convert base64-encoded SSL BIGNUM to internal representation.
56 * @param b64 base64-encoded number 59 * @param b64 base64-encoded number
57 * @return SSL BIGNUM 60 * @return SSL BIGNUM
58 * @throw failed_conversion in case of error 61 * @throw failed_conversion in case of error
59 */ 62 */
60 BIGNUM *base64_to_bignum(const string& b64); 63 BIGNUM *base64_to_bignum(const string& b64);
61 /** 64 /**
62 * Convert decimal representation to SSL BIGNUM. 65 * Convert decimal representation to SSL BIGNUM.
63 * @param dec decimal representation 66 * @param dec decimal representation
64 * @return resulting BIGNUM 67 * @return resulting BIGNUM
65 * @throw failed_conversion in case of error 68 * @throw failed_conversion in case of error
66 */ 69 */
67 BIGNUM *dec_to_bignum(const string& dec); 70 BIGNUM *dec_to_bignum(const string& dec);
68 /** 71 /**
69 * Convert SSL BIGNUM data to base64 encoded string. 72 * Convert SSL BIGNUM data to base64 encoded string.
70 * @param bn BIGNUM 73 * @param bn BIGNUM
71 * @return base64encoded string 74 * @return base64encoded string
72 */ 75 */
73 string bignum_to_base64(const BIGNUM *bn); 76 string bignum_to_base64(const BIGNUM *bn);
74 77
75 /** 78 /**
76 * Convert internal time representation to w3c format 79 * Convert internal time representation to w3c format
77 * @param t internal representation 80 * @param t internal representation
78 * @return w3c time 81 * @return w3c time
79 * @throw failed_conversion in case of error 82 * @throw failed_conversion in case of error
80 */ 83 */
81 string time_to_w3c(time_t t); 84 string time_to_w3c(time_t t);
82 /** 85 /**
83 * Convert W3C time representation to internal time_t 86 * Convert W3C time representation to internal time_t
84 * @param w w3c representation 87 * @param w w3c representation
85 * @return converted time 88 * @return converted time
86 * @throw failed_conversion in case of error 89 * @throw failed_conversion in case of error
87 */ 90 */
88 time_t w3c_to_time(const string& w); 91 time_t w3c_to_time(const string& w);
89 92
90 /** 93 /**
91 * Encode string to the representation suitable for using in URL. 94 * Encode string to the representation suitable for using in URL.
92 * @param str string to encode 95 * @param str string to encode
93 * @return encoded string 96 * @return encoded string
94 * @throw failed_conversion in case of failure 97 * @throw failed_conversion in case of failure
95 */ 98 */
96 string url_encode(const string& str); 99 string url_encode(const string& str);
97 100
98 /** 101 /**
99 * Convert number to string 102 * Convert number to string
100 * @param l number 103 * @param l number
101 * @return string representation 104 * @return string representation
102 * @throw failed_conversion in case of failure 105 * @throw failed_conversion in case of failure
103 */ 106 */
104 string long_to_string(long l); 107 string long_to_string(long l);
105 /** 108 /**
106 * Convert string to number 109 * Convert string to number
107 * @param s string, containing the number 110 * @param s string, containing the number
108 * @return the number 111 * @return the number
109 * @throw failed_conversion in case of failure 112 * @throw failed_conversion in case of failure
110 */ 113 */
111 long string_to_long(const string& s); 114 long string_to_long(const string& s);
112 115
113 /** 116 /**
114 * Encode binary data using base64. 117 * Encode binary data using base64.
115 * @param data pointer to binary data 118 * @param data pointer to binary data
116 * @param length length of data 119 * @param length length of data
117 * @return encoded data 120 * @return encoded data
118 */ 121 */
119 string encode_base64(const void *data,size_t length); 122 string encode_base64(const void *data,size_t length);
120 /** 123 /**
121 * Decode binary data from base64 representation. 124 * Decode binary data from base64 representation.
122 * @param data base64-encoded data 125 * @param data base64-encoded data
123 * @param rv container for decoded binary 126 * @param rv container for decoded binary
124 */ 127 */
125 void decode_base64(const string& data,vector<unsigned char>& rv); 128 void decode_base64(const string& data,vector<unsigned char>& rv);
126 } 129 }
127 130
128} 131}
129 132
130#endif /* __OPKELE_UTIL_H */ 133#endif /* __OPKELE_UTIL_H */
diff --git a/include/opkele/xconsumer.h b/include/opkele/xconsumer.h
index 14a8aaa..42796c0 100644
--- a/include/opkele/xconsumer.h
+++ b/include/opkele/xconsumer.h
@@ -1,41 +1,38 @@
1#ifndef __OPKELE_XCONSUMER_H 1#ifndef __OPKELE_XCONSUMER_H
2#define __OPKELE_XCONSUMER_H 2#define __OPKELE_XCONSUMER_H
3 3
4/** 4/**
5 * @file 5 * @file
6 * @brief OpenID consumer with built-in extension chain 6 * @brief OpenID consumer with built-in extension chain
7 */ 7 */
8 8
9#include <opkele/extension_chain.h> 9#include <opkele/extension_chain.h>
10#include <opkele/consumer.h> 10#include <opkele/consumer.h>
11 11
12/**
13 * @brief the main opkele namespace
14 */
15namespace opkele { 12namespace opkele {
16 13
17 /** 14 /**
18 * Extended OpenID consumer implementation with built in 15 * Extended OpenID consumer implementation with built in
19 * extensions chain. 16 * extensions chain.
20 */ 17 */
21 class xconsumer_t : public consumer_t, public extension_chain_t { 18 class xconsumer_t : public consumer_t, public extension_chain_t {
22 public: 19 public:
23 20
24 string checkid_immediate(const string& identity,const string& return_to,const string& trust_root="",extension_t *ext=0) { 21 string checkid_immediate(const string& identity,const string& return_to,const string& trust_root="",extension_t *ext=0) {
25 return consumer_t::checkid_immediate(identity,return_to,trust_root,this); 22 return consumer_t::checkid_immediate(identity,return_to,trust_root,this);
26 } 23 }
27 string chekid_setup(const string& identity,const string& return_to,const string& trust_root="",extension_t *ext=0) { 24 string chekid_setup(const string& identity,const string& return_to,const string& trust_root="",extension_t *ext=0) {
28 return consumer_t::checkid_setup(identity,return_to,trust_root,this); 25 return consumer_t::checkid_setup(identity,return_to,trust_root,this);
29 } 26 }
30 string checkid_(mode_t mode,const string& identity,const string& return_to,const string& trust_root="",extension_t *ext=0) { 27 string checkid_(mode_t mode,const string& identity,const string& return_to,const string& trust_root="",extension_t *ext=0) {
31 return consumer_t::checkid_(mode,identity,return_to,trust_root,this); 28 return consumer_t::checkid_(mode,identity,return_to,trust_root,this);
32 } 29 }
33 void id_res(const params_t& pin,const string& identity="",extension_t *ext=0) { 30 void id_res(const params_t& pin,const string& identity="",extension_t *ext=0) {
34 consumer_t::id_res(pin,identity,this); 31 consumer_t::id_res(pin,identity,this);
35 } 32 }
36 33
37 }; 34 };
38 35
39} 36}
40 37
41#endif /* __OPKELE_XCONSUMER_H */ 38#endif /* __OPKELE_XCONSUMER_H */
diff --git a/include/opkele/xserver.h b/include/opkele/xserver.h
index e29bfe6..c645d56 100644
--- a/include/opkele/xserver.h
+++ b/include/opkele/xserver.h
@@ -1,37 +1,34 @@
1#ifndef __OPKELE_XSERVER_H 1#ifndef __OPKELE_XSERVER_H
2#define __OPKELE_XSERVER_H 2#define __OPKELE_XSERVER_H
3 3
4/** 4/**
5 * @file 5 * @file
6 * @brief OpenID server with built-in extension chain 6 * @brief OpenID server with built-in extension chain
7 */ 7 */
8 8
9#include <opkele/extension_chain.h> 9#include <opkele/extension_chain.h>
10#include <opkele/server.h> 10#include <opkele/server.h>
11 11
12/**
13 * @brief the main opkele namespace
14 */
15namespace opkele { 12namespace opkele {
16 13
17 /** 14 /**
18 * Extended OpenID server implementationwith built in 15 * Extended OpenID server implementationwith built in
19 * extensions chain. 16 * extensions chain.
20 */ 17 */
21 class xserver_t : public server_t, public extension_chain_t { 18 class xserver_t : public server_t, public extension_chain_t {
22 public: 19 public:
23 20
24 void checkid_immediate(const params_t& pin,string& return_to,params_t& pout,extension_t *ext=0) { 21 void checkid_immediate(const params_t& pin,string& return_to,params_t& pout,extension_t *ext=0) {
25 server_t::checkid_immediate(pin,return_to,pout,this); 22 server_t::checkid_immediate(pin,return_to,pout,this);
26 } 23 }
27 void checkid_setup(const params_t& pin,string& return_to,params_t& pout,extension_t *ext=0) { 24 void checkid_setup(const params_t& pin,string& return_to,params_t& pout,extension_t *ext=0) {
28 server_t::checkid_setup(pin,return_to,pout,this); 25 server_t::checkid_setup(pin,return_to,pout,this);
29 } 26 }
30 void checkid_(mode_t mode,const params_t& pin,string& return_to,params_t& pout,extension_t *ext=0) { 27 void checkid_(mode_t mode,const params_t& pin,string& return_to,params_t& pout,extension_t *ext=0) {
31 server_t::checkid_(mode,pin,return_to,pout,this); 28 server_t::checkid_(mode,pin,return_to,pout,this);
32 } 29 }
33 }; 30 };
34 31
35} 32}
36 33
37#endif /* __OPKELE_XSERVER_H */ 34#endif /* __OPKELE_XSERVER_H */