-rw-r--r-- | acinclude.m4 | 17 | ||||
-rw-r--r-- | configure.ac | 32 | ||||
-rw-r--r-- | include/Makefile.am | 3 | ||||
-rw-r--r-- | include/opkele/consumer.h | 6 | ||||
-rw-r--r-- | include/opkele/server.h | 4 | ||||
-rw-r--r-- | include/opkele/types.h | 7 |
6 files changed, 59 insertions, 10 deletions
diff --git a/acinclude.m4 b/acinclude.m4 index 80defc7..fbb4cdc 100644 --- a/acinclude.m4 +++ b/acinclude.m4 | |||
@@ -158,9 +158,26 @@ AC_DEFUN([AC_WITH_PCREPP],[ | |||
158 | AC_DEFINE_UNQUOTED([PCREPP_VERSION],["${PCREPP_VERSION}"],[pcre++ version]) | 158 | AC_DEFINE_UNQUOTED([PCREPP_VERSION],["${PCREPP_VERSION}"],[pcre++ version]) |
159 | $1 | 159 | $1 |
160 | fi | 160 | fi |
161 | fi | 161 | fi |
162 | fi | 162 | fi |
163 | fi | 163 | fi |
164 | ]) | 164 | ]) |
165 | 165 | ||
166 | dnl AC_CHECK_SHAREDPTR(NS,HEADER[,ACTION-IF-FOUND[,ACTION-IF-NOT-FOUND]]) | ||
167 | AC_DEFUN([AC_CHECK_SHAREDPTR],[ | ||
168 | AC_LANG_PUSH([C++]) | ||
169 | AC_MSG_CHECKING([for $1::shared_ptr<> in $2]) | ||
170 | AC_COMPILE_IFELSE([ | ||
171 | #include <$2> | ||
172 | int main(int c,char**v) { $1::shared_ptr<int> spi(new int(0)); return *spi; } | ||
173 | ],[ | ||
174 | AC_MSG_RESULT([found]) | ||
175 | $3 | ||
176 | ],[ | ||
177 | AC_MSG_RESULT([not found]) | ||
178 | $4 | ||
179 | ]) | ||
180 | AC_LANG_POP([C++]) | ||
181 | ]) | ||
182 | |||
166 | m4_include([acinclude.d/libcurl.m4]) | 183 | m4_include([acinclude.d/libcurl.m4]) |
diff --git a/configure.ac b/configure.ac index 1bd1873..c4e9a74 100644 --- a/configure.ac +++ b/configure.ac | |||
@@ -21,16 +21,47 @@ if headrev=$(cd $srcdir && git rev-parse --verify HEAD 2>/dev/null) ; then | |||
21 | ( cd $srcdir && git diff-index $headrev | read dirt ) && PACKAGE_SRC_VERSION="${PACKAGE_SRC_VERSION}-dirty" | 21 | ( cd $srcdir && git diff-index $headrev | read dirt ) && PACKAGE_SRC_VERSION="${PACKAGE_SRC_VERSION}-dirty" |
22 | else | 22 | else |
23 | PACKAGE_SRC_VERSION="$PACKAGE_VERSION" | 23 | PACKAGE_SRC_VERSION="$PACKAGE_VERSION" |
24 | fi | 24 | fi |
25 | AC_MSG_RESULT([$PACKAGE_SRC_VERSION]) | 25 | AC_MSG_RESULT([$PACKAGE_SRC_VERSION]) |
26 | AC_SUBST([PACKAGE_SRC_VERSION]) | 26 | AC_SUBST([PACKAGE_SRC_VERSION]) |
27 | AC_DEFINE_UNQUOTED([PACKAGE_SRC_VERSION],["$PACKAGE_SRC_VERSION"],[more or less precise source tree version]) | 27 | AC_DEFINE_UNQUOTED([PACKAGE_SRC_VERSION],["$PACKAGE_SRC_VERSION"],[more or less precise source tree version]) |
28 | 28 | ||
29 | tr1_mem_std="false" | ||
30 | tr1_mem_boost="false" | ||
31 | AC_CHECK_SHAREDPTR(std::tr1,tr1/memory,[ tr1_mem_std=true ]) | ||
32 | AC_CHECK_SHAREDPTR(boost,boost/shared_ptr.hpp,[ tr1_mem_boost=true ]) | ||
33 | tr1_mem="" | ||
34 | AC_ARG_WITH([tr1-memory], | ||
35 | AC_HELP_STRING([--with-tr1-memory=<boost|std>],[select tr1/memory (shared_ptr<>) implementation to use]), | ||
36 | [ tr1_mem="$withval" ] | ||
37 | ) | ||
38 | AC_MSG_CHECKING([for tr1/memory implementation to use]) | ||
39 | test -z "$tr1_mem" && $tr1_mem_std && tr1_mem=std | ||
40 | test -z "$tr1_mem" && $tr1_mem_boost && tr1_mem=boost | ||
41 | test -z "$tr1_mem" && AC_MSG_RESULT([none found]) || AC_MSG_RESULT([$tr1_mem]) | ||
42 | case "$tr1_mem" in | ||
43 | std) | ||
44 | $tr1_mem_std || AC_MSG_ERROR([std implementation requested, but not found]) | ||
45 | OPKELE_TR1_MEM_NS=std::tr1 | ||
46 | OPKELE_TR1_MEM_HEADER=tr1/memory | ||
47 | ;; | ||
48 | boost) | ||
49 | $tr1_mem_boost || AC_MSG_ERROR([boost implementation requested, but not found]) | ||
50 | OPKELE_TR1_MEM_NS=boost | ||
51 | OPKELE_TR1_MEM_HEADER=boost/shared_ptr.hpp | ||
52 | ;; | ||
53 | *) | ||
54 | AC_MSG_ERROR([no shared_ptr<> implementation found]) | ||
55 | ;; | ||
56 | esac | ||
57 | AC_SUBST([OPKELE_TR1_MEM_NS]) | ||
58 | AC_SUBST([OPKELE_TR1_MEM_HEADER]) | ||
59 | |||
29 | PKG_CHECK_MODULES([OPENSSL],[openssl],,[ | 60 | PKG_CHECK_MODULES([OPENSSL],[openssl],,[ |
30 | AC_MSG_ERROR([no openssl library found. get one from http://www.openssl.org/]) | 61 | AC_MSG_ERROR([no openssl library found. get one from http://www.openssl.org/]) |
31 | ]) | 62 | ]) |
32 | 63 | ||
33 | WANT_KONFORKA="yes" | 64 | WANT_KONFORKA="yes" |
34 | AC_ARG_ENABLE([konforka], | 65 | AC_ARG_ENABLE([konforka], |
35 | AC_HELP_STRING([--disable-konforka],[do not use konforka library (default: use if found)]), | 66 | AC_HELP_STRING([--disable-konforka],[do not use konforka library (default: use if found)]), |
36 | [ | 67 | [ |
@@ -139,12 +170,13 @@ AC_ARG_ENABLE([xri-proxy], | |||
139 | AC_MSG_RESULT([$xri_proxy_url]) | 170 | AC_MSG_RESULT([$xri_proxy_url]) |
140 | AC_DEFINE_UNQUOTED([XRI_PROXY_URL],["$xri_proxy_url"],[XRI proxy resolver URL]) | 171 | AC_DEFINE_UNQUOTED([XRI_PROXY_URL],["$xri_proxy_url"],[XRI proxy resolver URL]) |
141 | 172 | ||
142 | AC_CONFIG_FILES([ | 173 | AC_CONFIG_FILES([ |
143 | Makefile | 174 | Makefile |
144 | libopkele.pc | 175 | libopkele.pc |
145 | Doxyfile | 176 | Doxyfile |
146 | include/Makefile | 177 | include/Makefile |
178 | include/opkele/tr1-mem.h | ||
147 | lib/Makefile | 179 | lib/Makefile |
148 | test/Makefile | 180 | test/Makefile |
149 | ]) | 181 | ]) |
150 | AC_OUTPUT | 182 | AC_OUTPUT |
diff --git a/include/Makefile.am b/include/Makefile.am index 078c6dc..26cb614 100644 --- a/include/Makefile.am +++ b/include/Makefile.am | |||
@@ -7,13 +7,14 @@ nobase_include_HEADERS = \ | |||
7 | opkele/server.h \ | 7 | opkele/server.h \ |
8 | opkele/consumer.h \ | 8 | opkele/consumer.h \ |
9 | opkele/extension.h \ | 9 | opkele/extension.h \ |
10 | opkele/sreg.h \ | 10 | opkele/sreg.h \ |
11 | opkele/extension_chain.h \ | 11 | opkele/extension_chain.h \ |
12 | opkele/xconsumer.h \ | 12 | opkele/xconsumer.h \ |
13 | opkele/xserver.h \ | 13 | opkele/xserver.h \ |
14 | opkele/discovery.h \ | 14 | opkele/discovery.h \ |
15 | opkele/uris.h | 15 | opkele/uris.h \ |
16 | opkele/tr1-mem.h | ||
16 | EXTRA_DIST = \ | 17 | EXTRA_DIST = \ |
17 | opkele/data.h \ | 18 | opkele/data.h \ |
18 | opkele/curl.h opkele/expat.h \ | 19 | opkele/curl.h opkele/expat.h \ |
19 | opkele/util.h | 20 | opkele/util.h |
diff --git a/include/opkele/consumer.h b/include/opkele/consumer.h index c463787..3c1d318 100644 --- a/include/opkele/consumer.h +++ b/include/opkele/consumer.h | |||
@@ -26,17 +26,17 @@ namespace opkele { | |||
26 | 26 | ||
27 | /** | 27 | /** |
28 | * store association. The function should be overridden in the real | 28 | * store association. The function should be overridden in the real |
29 | * implementation to provide persistent associations store. | 29 | * implementation to provide persistent associations store. |
30 | * @param server the OpenID server | 30 | * @param server the OpenID server |
31 | * @param handle association handle | 31 | * @param handle association handle |
32 | * @param secret the secret associated with the server and handle | 32 | * @param secret the secret associated with the server and handle |
33 | * @param expires_in the number of seconds until the handle is expired | 33 | * @param expires_in the number of seconds until the handle is expired |
34 | * @return the auto_ptr<> for the newly allocated association_t object | 34 | * @return the assoc_t for the newly allocated association_t object |
35 | */ | 35 | */ |
36 | virtual assoc_t store_assoc(const string& server,const string& handle,const secret_t& secret,int expires_in) = 0; | 36 | virtual assoc_t store_assoc(const string& server,const string& handle,const secret_t& secret,int expires_in) = 0; |
37 | /** | 37 | /** |
38 | * retrieve stored association. The function should be overridden | 38 | * retrieve stored association. The function should be overridden |
39 | * in the real implementation to provide persistent assocations | 39 | * in the real implementation to provide persistent assocations |
40 | * store. | 40 | * store. |
41 | * | 41 | * |
42 | * @note | 42 | * @note |
@@ -68,17 +68,17 @@ namespace opkele { | |||
68 | * association. | 68 | * association. |
69 | * | 69 | * |
70 | * @note | 70 | * @note |
71 | * It may be a good idea to pre-expire associations shortly before | 71 | * It may be a good idea to pre-expire associations shortly before |
72 | * their time is really up to avoid association expiry in the | 72 | * their time is really up to avoid association expiry in the |
73 | * middle of negotiations. | 73 | * middle of negotiations. |
74 | * | 74 | * |
75 | * @param server the OpenID server | 75 | * @param server the OpenID server |
76 | * @return the auto_ptr<> for the newly allocated association_t object | 76 | * @return the assoc_t for the newly allocated association_t object |
77 | * @throw failed_lookup in case of absence of the handle | 77 | * @throw failed_lookup in case of absence of the handle |
78 | */ | 78 | */ |
79 | virtual assoc_t find_assoc(const string& server); | 79 | virtual assoc_t find_assoc(const string& server); |
80 | 80 | ||
81 | /** | 81 | /** |
82 | * retrieve the metainformation contained in link tags from the | 82 | * retrieve the metainformation contained in link tags from the |
83 | * page pointed by url. the function may implement caching of the | 83 | * page pointed by url. the function may implement caching of the |
84 | * information. | 84 | * information. |
@@ -88,17 +88,17 @@ namespace opkele { | |||
88 | * @param delegate reference to the string object where to put the | 88 | * @param delegate reference to the string object where to put the |
89 | * openid.delegate value (if any) | 89 | * openid.delegate value (if any) |
90 | */ | 90 | */ |
91 | virtual void retrieve_links(const string& url,string& server,string& delegate); | 91 | virtual void retrieve_links(const string& url,string& server,string& delegate); |
92 | 92 | ||
93 | /** | 93 | /** |
94 | * perform the associate request to OpenID server. | 94 | * perform the associate request to OpenID server. |
95 | * @param server the OpenID server | 95 | * @param server the OpenID server |
96 | * @return the auto_ptr<> for the newly allocated association_t | 96 | * @return the assoc_t for the newly allocated association_t |
97 | * object, representing established association | 97 | * object, representing established association |
98 | * @throw exception in case of error | 98 | * @throw exception in case of error |
99 | */ | 99 | */ |
100 | assoc_t associate(const string& server); | 100 | assoc_t associate(const string& server); |
101 | /** | 101 | /** |
102 | * prepare the parameters for the checkid_immediate | 102 | * prepare the parameters for the checkid_immediate |
103 | * request. | 103 | * request. |
104 | * @param identity the identity to verify | 104 | * @param identity the identity to verify |
diff --git a/include/opkele/server.h b/include/opkele/server.h index dd7fc41..3c25646 100644 --- a/include/opkele/server.h +++ b/include/opkele/server.h | |||
@@ -20,25 +20,25 @@ namespace opkele { | |||
20 | virtual ~server_t() { } | 20 | virtual ~server_t() { } |
21 | 21 | ||
22 | /** | 22 | /** |
23 | * allocate the new association. The function should be overridden | 23 | * allocate the new association. The function should be overridden |
24 | * in the real implementation to provide persistent assocations | 24 | * in the real implementation to provide persistent assocations |
25 | * store. | 25 | * store. |
26 | * @param mode the mode of request being processed to base the | 26 | * @param mode the mode of request being processed to base the |
27 | * statelessness of the association upon | 27 | * statelessness of the association upon |
28 | * @return the auto_ptr<> for the newly allocated association_t object | 28 | * @return the assoc_t for the newly allocated association_t object |
29 | */ | 29 | */ |
30 | virtual assoc_t alloc_assoc(mode_t mode) = 0; | 30 | virtual assoc_t alloc_assoc(mode_t mode) = 0; |
31 | /** | 31 | /** |
32 | * retrieve the association. The function should be overridden in | 32 | * retrieve the association. The function should be overridden in |
33 | * the reqal implementation to provide persistent assocations | 33 | * the reqal implementation to provide persistent assocations |
34 | * store. | 34 | * store. |
35 | * @param h association handle | 35 | * @param h association handle |
36 | * @return the auto_ptr<> for the newly allocated association_t object | 36 | * @return the assoc_t for the newly allocated association_t object |
37 | * @throw failed_lookup in case of failure | 37 | * @throw failed_lookup in case of failure |
38 | */ | 38 | */ |
39 | virtual assoc_t retrieve_assoc(const string& h) = 0; | 39 | virtual assoc_t retrieve_assoc(const string& h) = 0; |
40 | 40 | ||
41 | /** | 41 | /** |
42 | * validate the identity. | 42 | * validate the identity. |
43 | * @param assoc association object | 43 | * @param assoc association object |
44 | * @param pin incoming request parameters | 44 | * @param pin incoming request parameters |
diff --git a/include/opkele/types.h b/include/opkele/types.h index ca07df5..d959021 100644 --- a/include/opkele/types.h +++ b/include/opkele/types.h | |||
@@ -5,25 +5,24 @@ | |||
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> | ||
14 | #include <set> | 13 | #include <set> |
14 | #include <opkele/tr1-mem.h> | ||
15 | 15 | ||
16 | namespace opkele { | 16 | namespace opkele { |
17 | using std::vector; | 17 | using std::vector; |
18 | using std::string; | 18 | using std::string; |
19 | using std::map; | 19 | using std::map; |
20 | using std::ostream; | 20 | using std::ostream; |
21 | using std::auto_ptr; | ||
22 | using std::multimap; | 21 | using std::multimap; |
23 | using std::set; | 22 | using std::set; |
24 | 23 | ||
25 | /** | 24 | /** |
26 | * the OpenID operation mode | 25 | * the OpenID operation mode |
27 | */ | 26 | */ |
28 | typedef enum _mode_t { | 27 | typedef enum _mode_t { |
29 | mode_associate, | 28 | mode_associate, |
@@ -103,19 +102,19 @@ namespace opkele { | |||
103 | /** | 102 | /** |
104 | * check whether the association is expired. | 103 | * check whether the association is expired. |
105 | * @return true if expired | 104 | * @return true if expired |
106 | */ | 105 | */ |
107 | virtual bool is_expired() const = 0; | 106 | virtual bool is_expired() const = 0; |
108 | }; | 107 | }; |
109 | 108 | ||
110 | /** | 109 | /** |
111 | * the auto_ptr<> for association_t object type | 110 | * the shared_ptr<> for association_t object type |
112 | */ | 111 | */ |
113 | typedef auto_ptr<association_t> assoc_t; | 112 | typedef tr1mem::shared_ptr<association_t> assoc_t; |
114 | 113 | ||
115 | /** | 114 | /** |
116 | * request/response parameters map | 115 | * request/response parameters map |
117 | */ | 116 | */ |
118 | class params_t : public map<string,string> { | 117 | class params_t : public map<string,string> { |
119 | public: | 118 | public: |
120 | 119 | ||
121 | /** | 120 | /** |