PingAccess Agent SDK for C
paa-util.h
Go to the documentation of this file.
1 /*****************************************************
2  * Copyright (C) 2015 Ping Identity Corporation
3  * All rights reserved.
4  *
5  * The contents of this file are the property of Ping Identity Corporation.
6  * You may not copy or use this file, in either source code or executable
7  * form, except in compliance with terms set by Ping Identity Corporation.
8  * For further information please contact:
9  *
10  * Ping Identity Corporation
11  * 1001 17th St Suite 100
12  * Denver, CO 80202
13  * 303.468.2900
14  * http://www.pingidentity.com
15  *
16  ****************************************************/
17 
26 #ifndef _PAA_SDK_PAA_UTIL_H_
27 #define _PAA_SDK_PAA_UTIL_H_ 1
28 
29 #include "apr.h"
30 #include "apr_pools.h"
31 #include "apr_tables.h"
32 
37 #ifdef _MSC_VER
38 #ifdef PAA_UTIL_SDK_BUILD
39 #define PAA_UTIL_GLOBAL __declspec(dllexport)
40 #else
41 #define PAA_UTIL_GLOBAL __declspec(dllimport)
42 #endif
43 #else
44 #define PAA_UTIL_GLOBAL
45 #endif
46 
48 #define APR_PAA_ERROR_START (APR_OS_START_USERERR + 4000)
49 
51 #define APR_PAA_MODULE_START (APR_PAA_ERROR_START + 0)
52 
54 #define APR_PAA_CACHE_START (APR_PAA_ERROR_START + 50)
55 
57 #define APR_PAA_HTTP_START (APR_PAA_ERROR_START + 100)
58 
59 #ifdef __cplusplus
60 extern "C" {
61 #endif
62 
74 apr_status_t paa_util_parse_header_value(const char *header_value,
75  apr_pool_t *pool,
76  apr_array_header_t **output);
77 
91 apr_status_t paa_util_parse_header_space_values(const char *header_value,
92  apr_pool_t *pool,
93  apr_array_header_t **output);
94 
115 apr_status_t paa_util_parse_header_map(const char *header_value,
116  apr_pool_t *pool,
117  apr_table_t **output);
118 
131 apr_status_t paa_util_parse_header(const char *header,
132  size_t len,
133  apr_pool_t *pool,
134  char **name,
135  char **value);
136 
147 char *paa_util_trim_whitespace(char *input);
148 
155 void paa_util_secure_erase(void *buffer, size_t buflen);
156 
157 
170 const char *paa_util_apr_table_getm(apr_pool_t *p,
171  const apr_table_t *t,
172  const char *key,
173  char delim);
179 int paa_util_getpid();
180 
181 /* Global PAA Constants */
182 
183 #ifndef DOXYGEN_SKIP
184 
185 /* common HTTP methods */
186 
187 PAA_UTIL_GLOBAL extern const char * const HTTP_GET_METHOD;
188 PAA_UTIL_GLOBAL extern const char * const HTTP_HEAD_METHOD;
189 PAA_UTIL_GLOBAL extern const char * const HTTP_PUT_METHOD;
190 PAA_UTIL_GLOBAL extern const char * const HTTP_POST_METHOD;
191 PAA_UTIL_GLOBAL extern const char * const HTTP_DELETE_METHOD;
192 PAA_UTIL_GLOBAL extern const char * const HTTP_OPTIONS_METHOD;
193 PAA_UTIL_GLOBAL extern const char * const HTTP_TRACE_METHOD;
194 PAA_UTIL_GLOBAL extern const char * const HTTP_CONNECT_METHOD;
195 
196 /* common HTTP header names */
197 
198 PAA_UTIL_GLOBAL extern const char * const HTTP_CONTENT_LENGTH;
199 PAA_UTIL_GLOBAL extern const char * const HTTP_CONTENT_TYPE;
200 PAA_UTIL_GLOBAL extern const char * const HTTP_CONTENT_ENCODING;
201 PAA_UTIL_GLOBAL extern const char * const HTTP_CONTENT_LANGUAGE;
202 PAA_UTIL_GLOBAL extern const char * const HTTP_CONTENT_LOCATION;
203 PAA_UTIL_GLOBAL extern const char * const HTTP_CONTENT_MD5;
204 PAA_UTIL_GLOBAL extern const char * const HTTP_CONTENT_RANGE;
205 PAA_UTIL_GLOBAL extern const char * const HTTP_TRANSFER_ENCODING;
206 PAA_UTIL_GLOBAL extern const char * const HTTP_HOST;
207 PAA_UTIL_GLOBAL extern const char * const HTTP_EXPECT;
208 PAA_UTIL_GLOBAL extern const char * const HTTP_ACCEPT;
209 PAA_UTIL_GLOBAL extern const char * const HTTP_ACCEPT_CHARSET;
210 PAA_UTIL_GLOBAL extern const char * const HTTP_ACCEPT_ENCODING;
211 PAA_UTIL_GLOBAL extern const char * const HTTP_ACCEPT_LANGUAGE;
212 PAA_UTIL_GLOBAL extern const char * const HTTP_ACCEPT_RANGES;
213 PAA_UTIL_GLOBAL extern const char * const HTTP_CACHE_CONTROL;
214 PAA_UTIL_GLOBAL extern const char * const HTTP_CONNECTION;
215 PAA_UTIL_GLOBAL extern const char * const HTTP_DATE;
216 PAA_UTIL_GLOBAL extern const char * const HTTP_KEEP_ALIVE;
217 PAA_UTIL_GLOBAL extern const char * const HTTP_PRAGMA;
218 PAA_UTIL_GLOBAL extern const char * const HTTP_TRAILER;
219 PAA_UTIL_GLOBAL extern const char * const HTTP_UPGRADE;
220 PAA_UTIL_GLOBAL extern const char * const HTTP_VIA;
221 PAA_UTIL_GLOBAL extern const char * const HTTP_WARNING;
222 PAA_UTIL_GLOBAL extern const char * const HTTP_ALLOW;
223 PAA_UTIL_GLOBAL extern const char * const HTTP_EXPIRES;
224 PAA_UTIL_GLOBAL extern const char * const HTTP_LAST_MODIFIED;
225 PAA_UTIL_GLOBAL extern const char * const HTTP_AUTHORIZATION;
226 PAA_UTIL_GLOBAL extern const char * const HTTP_COOKIE;
227 PAA_UTIL_GLOBAL extern const char * const HTTP_FROM;
228 PAA_UTIL_GLOBAL extern const char * const HTTP_IF_MATCH;
229 PAA_UTIL_GLOBAL extern const char * const HTTP_IF_MODIFIED_SINCE;
230 PAA_UTIL_GLOBAL extern const char * const HTTP_IF_NONE_MATCH;
231 PAA_UTIL_GLOBAL extern const char * const HTTP_IF_RANGE;
232 PAA_UTIL_GLOBAL extern const char * const HTTP_IF_UNMODIFIED_SINCE;
233 PAA_UTIL_GLOBAL extern const char * const HTTP_MAX_FORWARDS;
234 PAA_UTIL_GLOBAL extern const char * const HTTP_PROXY_AUTHENTICATE;
235 PAA_UTIL_GLOBAL extern const char * const HTTP_PROXY_AUTHORIZATION;
236 PAA_UTIL_GLOBAL extern const char * const HTTP_REFERER;
237 PAA_UTIL_GLOBAL extern const char * const HTTP_RANGE;
238 PAA_UTIL_GLOBAL extern const char * const HTTP_TE;
239 PAA_UTIL_GLOBAL extern const char * const HTTP_TRANSLATE;
240 PAA_UTIL_GLOBAL extern const char * const HTTP_USER_AGENT;
241 PAA_UTIL_GLOBAL extern const char * const HTTP_AGE;
242 PAA_UTIL_GLOBAL extern const char * const HTTP_ETAG;
243 PAA_UTIL_GLOBAL extern const char * const HTTP_LOCATION;
244 PAA_UTIL_GLOBAL extern const char * const HTTP_RETRY_AFTER;
245 PAA_UTIL_GLOBAL extern const char * const HTTP_SERVER;
246 PAA_UTIL_GLOBAL extern const char * const HTTP_SET_COOKIE;
247 PAA_UTIL_GLOBAL extern const char * const HTTP_VARY;
248 PAA_UTIL_GLOBAL extern const char * const HTTP_WWW_AUTHENTICATE;
249 
250 #endif /* DOXYGEN_SKIP */
251 
252 #ifdef __cplusplus
253 } /* C */
254 #endif
255 
256 #endif /* _PAA_SDK_PAA_UTIL_H_ */
apr_status_t paa_util_parse_header(const char *header, size_t len, apr_pool_t *pool, char **name, char **value)
void paa_util_secure_erase(void *buffer, size_t buflen)
apr_status_t paa_util_parse_header_map(const char *header_value, apr_pool_t *pool, apr_table_t **output)
apr_status_t paa_util_parse_header_space_values(const char *header_value, apr_pool_t *pool, apr_array_header_t **output)
char * paa_util_trim_whitespace(char *input)
#define PAA_UTIL_GLOBAL
Definition: paa-util.h:44
apr_status_t paa_util_parse_header_value(const char *header_value, apr_pool_t *pool, apr_array_header_t **output)
int paa_util_getpid()
const char * paa_util_apr_table_getm(apr_pool_t *p, const apr_table_t *t, const char *key, char delim)