diff options
Diffstat (limited to 'src/mint/taler-mint-httpd_parsing.h')
-rw-r--r-- | src/mint/taler-mint-httpd_parsing.h | 104 |
1 files changed, 52 insertions, 52 deletions
diff --git a/src/mint/taler-mint-httpd_parsing.h b/src/mint/taler-mint-httpd_parsing.h index 7a322d4d7..99376cac4 100644 --- a/src/mint/taler-mint-httpd_parsing.h +++ b/src/mint/taler-mint-httpd_parsing.h @@ -20,8 +20,8 @@ * @author Benedikt Mueller * @author Christian Grothoff */ -#ifndef TALER_MICROHTTPD_LIB_H_ -#define TALER_MICROHTTPD_LIB_H_ +#ifndef TALER_MINT_HTTPD_PARSING_H +#define TALER_MINT_HTTPD_PARSING_H #include <microhttpd.h> #include <jansson.h> @@ -34,7 +34,7 @@ * (incrementally) process JSON data uploaded to the HTTP * server. It will store the required state in the * "connection_cls", which must be cleaned up using - * #TALER_MINT_parse_post_cleanup_callback(). + * #TMH_PARSE_post_cleanup_callback(). * * @param connection the MHD connection * @param con_cs the closure (points to a `struct Buffer *`) @@ -53,11 +53,11 @@ * close HTTP session with MHD_NO) */ int -TALER_MINT_parse_post_json (struct MHD_Connection *connection, - void **con_cls, - const char *upload_data, - size_t *upload_data_size, - json_t **json); +TMH_PARSE_post_json (struct MHD_Connection *connection, + void **con_cls, + const char *upload_data, + size_t *upload_data_size, + json_t **json); /** @@ -65,42 +65,42 @@ TALER_MINT_parse_post_json (struct MHD_Connection *connection, * to clean up our state. * * @param con_cls value as it was left by - * #TALER_MINT_parse_post_json(), to be cleaned up + * #TMH_PARSE_post_json(), to be cleaned up */ void -TALER_MINT_parse_post_cleanup_callback (void *con_cls); +TMH_PARSE_post_cleanup_callback (void *con_cls); /** * Constants for JSON navigation description. */ -enum TALER_MINT_JsonNavigationCommand +enum TMH_PARSE_JsonNavigationCommand { /** * Access a field. * Param: const char * */ - JNAV_FIELD, + TMH_PARSE_JNC_FIELD, /** * Access an array index. * Param: int */ - JNAV_INDEX, + TMH_PARSE_JNC_INDEX, /** * Return base32crockford encoded data of * constant size. * Params: (void *, size_t) */ - JNAV_RET_DATA, + TMH_PARSE_JNC_RET_DATA, /** * Return base32crockford encoded data of * variable size. * Params: (void **, size_t *) */ - JNAV_RET_DATA_VAR, + TMH_PARSE_JNC_RET_DATA_VAR, /** * Return a json object, which must be @@ -108,25 +108,25 @@ enum TALER_MINT_JsonNavigationCommand * or -1 for any type). * Params: (int, json_t **) */ - JNAV_RET_TYPED_JSON, + TMH_PARSE_JNC_RET_TYPED_JSON, /** * Return a `struct GNUNET_CRYPTO_rsa_PublicKey` which was * encoded as variable-size base32crockford encoded data. */ - JNAV_RET_RSA_PUBLIC_KEY, + TMH_PARSE_JNC_RET_RSA_PUBLIC_KEY, /** * Return a `struct GNUNET_CRYPTO_rsa_Signature` which was * encoded as variable-size base32crockford encoded data. */ - JNAV_RET_RSA_SIGNATURE, + TMH_PARSE_JNC_RET_RSA_SIGNATURE, /** * Return a `struct TALER_Amount` which was * encoded within its own json object. */ - JNAV_RET_AMOUNT + TMH_PARSE_JNC_RET_AMOUNT }; @@ -138,22 +138,22 @@ enum TALER_MINT_JsonNavigationCommand * * @param connection the connection to send an error response to * @param root the JSON node to start the navigation at. - * @param ... navigation specification (see `enum TALER_MINT_JsonNavigationCommand`) + * @param ... navigation specification (see `enum TMH_PARSE_JsonNavigationCommand`) * @return * #GNUNET_YES if navigation was successful * #GNUNET_NO if json is malformed, error response was generated * #GNUNET_SYSERR on internal error */ int -GNUNET_MINT_parse_navigate_json (struct MHD_Connection *connection, - const json_t *root, - ...); +TMH_PARSE_navigate_json (struct MHD_Connection *connection, + const json_t *root, + ...); /** * Specification for how to parse a JSON field. */ -struct GNUNET_MINT_ParseFieldSpec +struct TMH_PARSE_FieldSpecification { /** * Name of the field. NULL only to terminate array. @@ -183,15 +183,15 @@ struct GNUNET_MINT_ParseFieldSpec /** * Navigation command to use to extract the value. Note that - * #JNAV_RET_DATA or #JNAV_RET_DATA_VAR must be used for @e + * #TMH_PARSE_JNC_RET_DATA or #TMH_PARSE_JNC_RET_DATA_VAR must be used for @e * destination_size_in and @e destination_size_out to have a - * meaning. #JNAV_FIELD and #JNAV_INDEX must not be used here! + * meaning. #TMH_PARSE_JNC_FIELD and #TMH_PARSE_JNC_INDEX must not be used here! */ - enum TALER_MINT_JsonNavigationCommand command; + enum TMH_PARSE_JsonNavigationCommand command; /** * JSON type to use, only meaningful in connection with a @e command - * value of #JNAV_RET_TYPED_JSON. Typical values are + * value of #TMH_PARSE_JNC_RET_TYPED_JSON. Typical values are * #JSON_ARRAY and #JSON_OBJECT. */ int type; @@ -209,14 +209,14 @@ struct GNUNET_MINT_ParseFieldSpec * @return * #GNUNET_YES if navigation was successful (caller is responsible * for freeing allocated variable-size data using - * #TALER_MINT_release_parsed_data() when done) + * #TMH_PARSE_release_data() when done) * #GNUNET_NO if json is malformed, error response was generated * #GNUNET_SYSERR on internal error */ int -TALER_MINT_parse_json_data (struct MHD_Connection *connection, +TMH_PARSE_json_data (struct MHD_Connection *connection, const json_t *root, - struct GNUNET_MINT_ParseFieldSpec *spec); + struct TMH_PARSE_FieldSpecification *spec); /** @@ -226,7 +226,7 @@ TALER_MINT_parse_json_data (struct MHD_Connection *connection, * @param spec specification to free */ void -TALER_MINT_release_parsed_data (struct GNUNET_MINT_ParseFieldSpec *spec); +TMH_PARSE_release_data (struct TMH_PARSE_FieldSpecification *spec); /** @@ -235,14 +235,14 @@ TALER_MINT_release_parsed_data (struct GNUNET_MINT_ParseFieldSpec *spec); * @param field name of the field * @param value where to store the value */ -#define TALER_MINT_PARSE_FIXED(field,value) { field, value, sizeof (*value), 0, JNAV_RET_DATA, 0 } +#define TMH_PARSE_MEMBER_FIXED(field,value) { field, value, sizeof (*value), 0, TMH_PARSE_JNC_RET_DATA, 0 } /** * Generate line in parser specification for variable-size value. * * @param field name of the field */ -#define TALER_MINT_PARSE_VARIABLE(field) { field, NULL, 0, 0, JNAV_RET_DATA_VAR, 0 } +#define TMH_PARSE_MEMBER_VARIABLE(field) { field, NULL, 0, 0, TMH_PARSE_JNC_RET_DATA_VAR, 0 } /** * Generate line in parser specification for JSON array value. @@ -250,7 +250,7 @@ TALER_MINT_release_parsed_data (struct GNUNET_MINT_ParseFieldSpec *spec); * @param field name of the field * @param ptraddr address of pointer to initialize (a `void **`) */ -#define TALER_MINT_PARSE_ARRAY(field,ptraddr) { field, ptraddr, 0, 0, JNAV_RET_TYPED_JSON, JSON_ARRAY } +#define TMH_PARSE_MEMBER_ARRAY(field,ptraddr) { field, ptraddr, 0, 0, TMH_PARSE_JNC_RET_TYPED_JSON, JSON_ARRAY } /** * Generate line in parser specification for JSON object value. @@ -258,7 +258,7 @@ TALER_MINT_release_parsed_data (struct GNUNET_MINT_ParseFieldSpec *spec); * @param field name of the field * @param ptraddr address of pointer to initialize (a `void **`) */ -#define TALER_MINT_PARSE_OBJECT(field,ptraddr) { field, ptraddr, 0, 0, JNAV_RET_TYPED_JSON, JSON_OBJECT } +#define TMH_PARSE_MEMBER_OBJECT(field,ptraddr) { field, ptraddr, 0, 0, TMH_PARSE_JNC_RET_TYPED_JSON, JSON_OBJECT } /** * Generate line in parser specification for RSA public key. @@ -266,7 +266,7 @@ TALER_MINT_release_parsed_data (struct GNUNET_MINT_ParseFieldSpec *spec); * @param field name of the field * @param ptraddr address of `struct GNUNET_CRYPTO_rsa_PublicKey *` initialize */ -#define TALER_MINT_PARSE_RSA_PUBLIC_KEY(field,ptrpk) { field, ptrpk, 0, 0, JNAV_RET_RSA_PUBLIC_KEY, 0 } +#define TMH_PARSE_MEMBER_RSA_PUBLIC_KEY(field,ptrpk) { field, ptrpk, 0, 0, TMH_PARSE_JNC_RET_RSA_PUBLIC_KEY, 0 } /** * Generate line in parser specification for RSA public key. @@ -274,7 +274,7 @@ TALER_MINT_release_parsed_data (struct GNUNET_MINT_ParseFieldSpec *spec); * @param field name of the field * @param ptrsig address of `struct GNUNET_CRYPTO_rsa_Signature *` initialize */ -#define TALER_MINT_PARSE_RSA_SIGNATURE(field,ptrsig) { field, ptrsig, 0, 0, JNAV_RET_RSA_SIGNATURE, 0 } +#define TMH_PARSE_MEMBER_RSA_SIGNATURE(field,ptrsig) { field, ptrsig, 0, 0, TMH_PARSE_JNC_RET_RSA_SIGNATURE, 0 } /** * Generate line in parser specification for an amount. @@ -282,12 +282,12 @@ TALER_MINT_release_parsed_data (struct GNUNET_MINT_ParseFieldSpec *spec); * @param field name of the field * @param amount a `struct TALER_Amount *` to initialize */ -#define TALER_MINT_PARSE_AMOUNT(field,amount) { field, amount, sizeof(*amount), 0, JNAV_RET_AMOUNT, 0 } +#define TMH_PARSE_MEMBER_AMOUNT(field,amount) { field, amount, sizeof(*amount), 0, TMH_PARSE_JNC_RET_AMOUNT, 0 } /** * Generate line in parser specification indicating the end of the spec. */ -#define TALER_MINT_PARSE_END { NULL, NULL, 0, 0, JNAV_FIELD, 0 } +#define TMH_PARSE_MEMBER_END { NULL, NULL, 0, 0, TMH_PARSE_JNC_FIELD, 0 } /** @@ -302,9 +302,9 @@ TALER_MINT_release_parsed_data (struct GNUNET_MINT_ParseFieldSpec *spec); * #GNUNET_SYSERR on internal error, error response was not generated */ int -TALER_MINT_parse_amount_json (struct MHD_Connection *connection, - json_t *f, - struct TALER_Amount *amount); +TMH_PARSE_amount_json (struct MHD_Connection *connection, + json_t *f, + struct TALER_Amount *amount); /** @@ -323,10 +323,10 @@ TALER_MINT_parse_amount_json (struct MHD_Connection *connection, * #GNUNET_SYSERR on internal error (error response could not be sent) */ int -TALER_MINT_mhd_request_arg_data (struct MHD_Connection *connection, - const char *param_name, - void *out_data, - size_t out_size); +TMH_PARSE_mhd_request_arg_data (struct MHD_Connection *connection, + const char *param_name, + void *out_data, + size_t out_size); /** @@ -345,12 +345,12 @@ TALER_MINT_mhd_request_arg_data (struct MHD_Connection *connection, * #GNUNET_SYSERR on internal error (error response could not be sent) */ int -TALER_MINT_mhd_request_var_arg_data (struct MHD_Connection *connection, - const char *param_name, - void **out_data, - size_t *out_size); +TMH_PARSE_mhd_request_var_arg_data (struct MHD_Connection *connection, + const char *param_name, + void **out_data, + size_t *out_size); -#endif /* TALER_MICROHTTPD_LIB_H_ */ +#endif /* TALER_MINT_HTTPD_PARSING_H */ |