-rw-r--r-- | include/opkele/types.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/include/opkele/types.h b/include/opkele/types.h index 757c0af..8f4bf73 100644 --- a/include/opkele/types.h +++ b/include/opkele/types.h | |||
@@ -50,96 +50,101 @@ namespace opkele { | |||
50 | /** | 50 | /** |
51 | * plainly encode to base64 representation | 51 | * plainly encode to base64 representation |
52 | * @param rv reference to the return value | 52 | * @param rv reference to the return value |
53 | */ | 53 | */ |
54 | void to_base64(string& rv) const; | 54 | void to_base64(string& rv) const; |
55 | /** | 55 | /** |
56 | * decode cleartext secret from base64 | 56 | * decode cleartext secret from base64 |
57 | * @param b64 base64-encoded representation of the secret value | 57 | * @param b64 base64-encoded representation of the secret value |
58 | */ | 58 | */ |
59 | void from_base64(const string& b64); | 59 | void from_base64(const string& b64); |
60 | }; | 60 | }; |
61 | 61 | ||
62 | /** | 62 | /** |
63 | * Interface to the association. | 63 | * Interface to the association. |
64 | */ | 64 | */ |
65 | class association_t { | 65 | class association_t { |
66 | public: | 66 | public: |
67 | 67 | ||
68 | /** | 68 | /** |
69 | * retrieve the server with which association was established. | 69 | * retrieve the server with which association was established. |
70 | * @return server name | 70 | * @return server name |
71 | */ | 71 | */ |
72 | virtual string server() const = 0; | 72 | virtual string server() const = 0; |
73 | /** | 73 | /** |
74 | * retrieve the association handle. | 74 | * retrieve the association handle. |
75 | * @return handle | 75 | * @return handle |
76 | */ | 76 | */ |
77 | virtual string handle() const = 0; | 77 | virtual string handle() const = 0; |
78 | /** | 78 | /** |
79 | * retrieve the association type. | 79 | * retrieve the association type. |
80 | * @return association type | 80 | * @return association type |
81 | */ | 81 | */ |
82 | virtual string assoc_type() const = 0; | 82 | virtual string assoc_type() const = 0; |
83 | /** | 83 | /** |
84 | * retrieve the association secret. | 84 | * retrieve the association secret. |
85 | * @return association secret | 85 | * @return association secret |
86 | */ | 86 | */ |
87 | virtual secret_t secret() const = 0; | 87 | virtual secret_t secret() const = 0; |
88 | /** | 88 | /** |
89 | * retrieve the number of seconds the association expires in. | 89 | * retrieve the number of seconds the association expires in. |
90 | * @return seconds till expiration | 90 | * @return seconds till expiration |
91 | */ | 91 | */ |
92 | virtual int expires_in() const = 0; | 92 | virtual int expires_in() const = 0; |
93 | /** | 93 | /** |
94 | * check whether the association is stateless. | 94 | * check whether the association is stateless. |
95 | * @return true if stateless | 95 | * @return true if stateless |
96 | */ | 96 | */ |
97 | virtual bool stateless() const = 0; | 97 | virtual bool stateless() const = 0; |
98 | /** | ||
99 | * check whether the association is expired. | ||
100 | * @return true if expired | ||
101 | */ | ||
102 | virtual bool is_expired() const = 0; | ||
98 | }; | 103 | }; |
99 | 104 | ||
100 | /** | 105 | /** |
101 | * the auto_ptr<> for association_t object type | 106 | * the auto_ptr<> for association_t object type |
102 | */ | 107 | */ |
103 | typedef auto_ptr<association_t> assoc_t; | 108 | typedef auto_ptr<association_t> assoc_t; |
104 | 109 | ||
105 | /** | 110 | /** |
106 | * request/response parameters map | 111 | * request/response parameters map |
107 | */ | 112 | */ |
108 | class params_t : public map<string,string> { | 113 | class params_t : public map<string,string> { |
109 | public: | 114 | public: |
110 | 115 | ||
111 | /** | 116 | /** |
112 | * check whether the parameter is present. | 117 | * check whether the parameter is present. |
113 | * @param n the parameter name | 118 | * @param n the parameter name |
114 | * @return true if yes | 119 | * @return true if yes |
115 | */ | 120 | */ |
116 | bool has_param(const string& n) const; | 121 | bool has_param(const string& n) const; |
117 | /** | 122 | /** |
118 | * retrieve the parameter (const version) | 123 | * retrieve the parameter (const version) |
119 | * @param n the parameter name | 124 | * @param n the parameter name |
120 | * @return the parameter value | 125 | * @return the parameter value |
121 | * @throw failed_lookup if there is no such parameter | 126 | * @throw failed_lookup if there is no such parameter |
122 | */ | 127 | */ |
123 | const string& get_param(const string& n) const; | 128 | const string& get_param(const string& n) const; |
124 | /** | 129 | /** |
125 | * retrieve the parameter. | 130 | * retrieve the parameter. |
126 | * @param n the parameter name | 131 | * @param n the parameter name |
127 | * @return the parameter value | 132 | * @return the parameter value |
128 | * @throw failed_lookup if there is no such parameter | 133 | * @throw failed_lookup if there is no such parameter |
129 | */ | 134 | */ |
130 | string& get_param(const string& n); | 135 | string& get_param(const string& n); |
131 | 136 | ||
132 | /** | 137 | /** |
133 | * parse the OpenID key/value data. | 138 | * parse the OpenID key/value data. |
134 | * @param kv the OpenID key/value data | 139 | * @param kv the OpenID key/value data |
135 | */ | 140 | */ |
136 | void parse_keyvalues(const string& kv); | 141 | void parse_keyvalues(const string& kv); |
137 | /** | 142 | /** |
138 | * sign the fields. | 143 | * sign the fields. |
139 | * @param secret the secret used for signing | 144 | * @param secret the secret used for signing |
140 | * @param sig reference to the string, containing base64-encoded | 145 | * @param sig reference to the string, containing base64-encoded |
141 | * result | 146 | * result |
142 | * @param slist the comma-separated list of fields to sign | 147 | * @param slist the comma-separated list of fields to sign |
143 | * @param prefix the string to prepend to parameter names | 148 | * @param prefix the string to prepend to parameter names |
144 | */ | 149 | */ |
145 | void sign(secret_t secret,string& sig,const string& slist,const char *prefix=0) const; | 150 | void sign(secret_t secret,string& sig,const string& slist,const char *prefix=0) const; |