#include <cgi/cgi_config.h>
Data Structures | |
| struct | s_form_field |
| Form field structure. More... | |
Defines | |
| #define | POST_VAR(ctx, var_name) |
| Register new POST variable. | |
| #define | GET_VAR(ctx, var_name) |
| Register new GET variable. | |
| #define | ff_data data.data |
| Shortcut for data.data in form field structure. | |
| #define | ff_array data.array |
| Shortcut for data.array in form field structure. | |
| #define | array_size length |
| Array length, same as length (form field structure). | |
Typedefs | |
| typedef struct s_form_field | t_form_field |
| Form field type. | |
Functions | |
| struct s_form_field * | form_register_post_var (struct s_cgi_context *, char *, struct s_form_field **) |
| Register form POST variable. | |
| struct s_form_field * | form_register_get_var (struct s_cgi_context *, char *name, struct s_form_field **ptr) |
| Register form GET variable. | |
| struct s_form_field * | form_field (struct s_cgi_context *, char *name) |
| Return form field. | |
| struct s_form_field * | form_get_field (struct s_cgi_context *, char *name) |
| Return GET field. | |
| struct s_form_field * | form_post_field (struct s_cgi_context *, char *name) |
| Return POST field. | |
| void | form_field_free (struct s_form_field *field) |
| Free form field. | |
| #define array_size length |
Array length, same as length (form field structure).
Just an alias for length in form field structure. Example: field->array_size.
| #define ff_array data.array |
Shortcut for data.array in form field structure.
Example: field->ff_array[0]->ff_data.
| #define ff_data data.data |
Shortcut for data.data in form field structure.
Example: field->ff_data.
| #define GET_VAR | ( | ctx, | |||
| var_name | ) |
Value:
struct s_form_field *var_name = \ form_register_get_var(ctx, #var_name, &var_name)
Registers new GET named variable. After registration it is avaiable whenever exists. If form field does not exist, its value will be NULL.
Example: GET_VAR(ctx, action);
| ctx | pointer to existing CGI context (t_cgi_context *). | |
| var_name | variable and form field name. |
| #define POST_VAR | ( | ctx, | |||
| var_name | ) |
Value:
struct s_form_field *var_name = \ form_register_post_var(ctx, #var_name, &var_name)
Registers new POST named variable. After registration it is avaiable whenever exists. If form field does not exist, its value will be NULL.
Example: POST_VAR(ctx, password);
| ctx | pointer to existing CGI context (t_cgi_context *). | |
| var_name | variable and form field name. |
| typedef struct s_form_field t_form_field |
Form field type.
Working alias for s_form_field structure.
| struct s_form_field* form_field | ( | t_cgi_context * | ctx, | |
| char * | name | |||
| ) | [read] |
Return form field.
Returns form field. You can use this function to get form fields with dynamic name.
| ctx | pointer to existing CGI context (t_cgi_context *). | |
| name | field name. |
cgi_context_free(t_cgi_context *)
form_register_post_var(t_cgi_context *, char *, struct s_form_field **)
form_register_get_var(t_cgi_context *, char *, struct s_form_field **)
form_post_field(t_cgi_context *, char *)
| void form_field_free | ( | struct s_form_field * | field | ) |
Free form field.
Frees form field and releases occupied memory.
| field | form field. |
| struct s_form_field* form_get_field | ( | t_cgi_context * | ctx, | |
| char * | name | |||
| ) | [read] |
Return GET field.
Returns GET field. You can use this function to get GET fields with dynamic name.
| ctx | pointer to existing CGI context (t_cgi_context *). | |
| name | GET field name. |
| struct s_form_field* form_post_field | ( | t_cgi_context * | ctx, | |
| char * | name | |||
| ) | [read] |
Return POST field.
Returns POST field. You can use this function to get POST fields with dynamic name.
| ctx | pointer to existing CGI context (t_cgi_context *). | |
| name | POST field name. |
| struct s_form_field* form_register_get_var | ( | t_cgi_context * | ctx, | |
| char * | name, | |||
| struct s_form_field ** | ptr | |||
| ) | [read] |
Register form GET variable.
Registers form GET variable. Will receive value of the specified form field. The advantage of this approach is that you don't need free these variables - they are freed automatically when CGI context is freed. You can use GET_VAR macro to define GET field.
| ctx | pointer to existing CGI context (t_cgi_context *). | |
| name | GET field name. | |
| ptr | pointer to the t_form_field variable to receive field value. |
| struct s_form_field* form_register_post_var | ( | t_cgi_context * | ctx, | |
| char * | name, | |||
| struct s_form_field ** | ptr | |||
| ) | [read] |
Register form POST variable.
Registers form POST variable. Will receive value of the specified form field. The advantage of this approach is that you don't need free these variables - they are freed automatically when CGI context is freed. You can use POST_VAR macro to define POST field.
| ctx | pointer to existing CGI context (t_cgi_context *). | |
| name | POST field name. | |
| ptr | pointer to the t_form_field variable to receive field value. |
1.5.5