Asterisk - The Open Source Telephony Project GIT-master-1f1c5bb
Macros | Functions | Variables
res_ari_model.c File Reference

Implementation Swagger validators. More...

#include "asterisk.h"
#include "ari/ari_model_validators.h"
#include "asterisk/logger.h"
#include "asterisk/module.h"
#include "asterisk/utils.h"
#include <regex.h>
Include dependency graph for res_ari_model.c:

Go to the source code of this file.

Macros

#define ISO8601_PATTERN   "^" REGEX_YMD "(T" REGEX_HMS REGEX_TZ ")?$"
 
#define REGEX_HMS   "[0-2][0-9]:[0-5][0-9](:[0-6][0-9](.[0-9]+)?)?"
 
#define REGEX_TZ   "(Z|[-+][0-2][0-9](:?[0-5][0-9])?)"
 
#define REGEX_YMD   "[0-9]{4}-[01][0-9]-[0-3][0-9]"
 

Functions

static void __reg_module (void)
 
static void __unreg_module (void)
 
int ast_ari_validate_boolean (struct ast_json *json)
 Validator for native Swagger boolean. More...
 
int ast_ari_validate_byte (struct ast_json *json)
 Validator for native Swagger byte. More...
 
int ast_ari_validate_date (struct ast_json *json)
 Validator for native Swagger date. More...
 
int ast_ari_validate_double (struct ast_json *json)
 Validator for native Swagger double. More...
 
int ast_ari_validate_float (struct ast_json *json)
 Validator for native Swagger float. More...
 
int ast_ari_validate_int (struct ast_json *json)
 Validator for native Swagger int. More...
 
int ast_ari_validate_list (struct ast_json *json, int(*fn)(struct ast_json *))
 Validator for a Swagger List[]/JSON array. More...
 
int ast_ari_validate_long (struct ast_json *json)
 Validator for native Swagger long. More...
 
int ast_ari_validate_object (struct ast_json *json)
 Validator for native Swagger object. More...
 
int ast_ari_validate_string (struct ast_json *json)
 Validator for native Swagger string. More...
 
int ast_ari_validate_void (struct ast_json *json)
 Validator for native Swagger void. More...
 
struct ast_moduleAST_MODULE_SELF_SYM (void)
 
static int check_range (intmax_t minval, intmax_t maxval, struct ast_json *json)
 
static int check_type (struct ast_json *json, enum ast_json_type expected)
 
static int load_module (void)
 
static int unload_module (void)
 

Variables

static struct ast_module_info __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_LOAD_ORDER | AST_MODFLAG_GLOBAL_SYMBOLS , .description = "ARI Model validators" , .key = "This paragraph is copyright (c) 2006 by Digium, Inc. \In order for your module to load, it must return this \key via a function called \"key\". Any code which \includes this paragraph must be licensed under the GNU \General Public License version 2 or later (at your \option). In addition to Digium's general reservations \of rights, Digium expressly reserves the right to \allow other parties to license this paragraph under \different terms. Any use of Digium, Inc. trademarks or \logos (including \"Asterisk\" or \"Digium\") without \express written permission of Digium, Inc. is prohibited.\n" , .buildopt_sum = AST_BUILDOPT_SUM, .support_level = AST_MODULE_SUPPORT_CORE, .load = load_module, .unload = unload_module, .load_pri = AST_MODPRI_APP_DEPEND, }
 
static const struct ast_module_infoast_module_info = &__mod_info
 
static regex_t date_regex
 

Detailed Description

Implementation Swagger validators.

Author
David M. Lee, II dlee@.nosp@m.digi.nosp@m.um.co.nosp@m.m

Definition in file res_ari_model.c.

Macro Definition Documentation

◆ ISO8601_PATTERN

#define ISO8601_PATTERN   "^" REGEX_YMD "(T" REGEX_HMS REGEX_TZ ")?$"

Definition at line 53 of file res_ari_model.c.

◆ REGEX_HMS

#define REGEX_HMS   "[0-2][0-9]:[0-5][0-9](:[0-6][0-9](.[0-9]+)?)?"

Definition at line 47 of file res_ari_model.c.

◆ REGEX_TZ

#define REGEX_TZ   "(Z|[-+][0-2][0-9](:?[0-5][0-9])?)"

Definition at line 50 of file res_ari_model.c.

◆ REGEX_YMD

#define REGEX_YMD   "[0-9]{4}-[01][0-9]-[0-3][0-9]"

Definition at line 43 of file res_ari_model.c.

Function Documentation

◆ __reg_module()

static void __reg_module ( void  )
static

Definition at line 209 of file res_ari_model.c.

◆ __unreg_module()

static void __unreg_module ( void  )
static

Definition at line 209 of file res_ari_model.c.

◆ ast_ari_validate_boolean()

int ast_ari_validate_boolean ( struct ast_json json)

Validator for native Swagger boolean.

Parameters
jsonJSON object to validate.
Return values
True(non-zero) if valid.
False(zero) if invalid.

Definition at line 107 of file res_ari_model.c.

108{
109 enum ast_json_type actual = ast_json_typeof(json);
110 switch (actual) {
111 case AST_JSON_TRUE:
112 case AST_JSON_FALSE:
113 return 1;
114 default:
115 ast_log(LOG_ERROR, "Expected type boolean, was %s\n",
116 ast_json_typename(actual));
117 return 0;
118 }
119}
#define ast_log
Definition: astobj2.c:42
#define LOG_ERROR
enum ast_json_type ast_json_typeof(const struct ast_json *value)
Get the type of value.
Definition: json.c:78
const char * ast_json_typename(enum ast_json_type type)
Get the string name for the given type.
Definition: json.c:95
ast_json_type
Valid types of a JSON element.
Definition: json.h:163
@ AST_JSON_FALSE
Definition: json.h:170
@ AST_JSON_TRUE
Definition: json.h:169

References AST_JSON_FALSE, AST_JSON_TRUE, ast_json_typename(), ast_json_typeof(), ast_log, and LOG_ERROR.

Referenced by ast_ari_validate_bridge_attended_transfer(), ast_ari_validate_bridge_blind_transfer(), ast_ari_validate_channel_hangup_request(), and AST_TEST_DEFINE().

◆ ast_ari_validate_byte()

int ast_ari_validate_byte ( struct ast_json json)

Validator for native Swagger byte.

Parameters
jsonJSON object to validate.
Return values
True(non-zero) if valid.
False(zero) if invalid.

Definition at line 101 of file res_ari_model.c.

102{
103 /* Java bytes are signed, which accounts for great fun for all */
104 return check_range(-128, 255, json);
105}
static int check_range(intmax_t minval, intmax_t maxval, struct ast_json *json)
Definition: res_ari_model.c:74

References check_range().

Referenced by AST_TEST_DEFINE().

◆ ast_ari_validate_date()

int ast_ari_validate_date ( struct ast_json json)

Validator for native Swagger date.

Parameters
jsonJSON object to validate.
Return values
True(non-zero) if valid.
False(zero) if invalid.

Definition at line 148 of file res_ari_model.c.

149{
150 /* Dates are ISO-8601 strings */
151 const char *str;
152 if (!check_type(json, AST_JSON_STRING)) {
153 return 0;
154 }
155 str = ast_json_string_get(json);
156 ast_assert(str != NULL);
157 if (regexec(&date_regex, str, 0, NULL, 0) != 0) {
158 ast_log(LOG_ERROR, "Date field is malformed: '%s'\n", str);
159 return 0;
160 }
161 return 1;
162}
const char * str
Definition: app_jack.c:147
@ AST_JSON_STRING
Definition: json.h:166
const char * ast_json_string_get(const struct ast_json *string)
Get the value of a JSON string.
Definition: json.c:283
static regex_t date_regex
Definition: res_ari_model.c:40
static int check_type(struct ast_json *json, enum ast_json_type expected)
Definition: res_ari_model.c:55
#define NULL
Definition: resample.c:96
#define ast_assert(a)
Definition: utils.h:739

References ast_assert, AST_JSON_STRING, ast_json_string_get(), ast_log, check_type(), date_regex, LOG_ERROR, NULL, and str.

Referenced by ast_ari_validate_application_move_failed(), ast_ari_validate_application_replaced(), ast_ari_validate_bridge(), ast_ari_validate_bridge_attended_transfer(), ast_ari_validate_bridge_blind_transfer(), ast_ari_validate_bridge_created(), ast_ari_validate_bridge_destroyed(), ast_ari_validate_bridge_merged(), ast_ari_validate_bridge_video_source_changed(), ast_ari_validate_channel(), ast_ari_validate_channel_caller_id(), ast_ari_validate_channel_connected_line(), ast_ari_validate_channel_created(), ast_ari_validate_channel_destroyed(), ast_ari_validate_channel_dialplan(), ast_ari_validate_channel_dtmf_received(), ast_ari_validate_channel_entered_bridge(), ast_ari_validate_channel_hangup_request(), ast_ari_validate_channel_hold(), ast_ari_validate_channel_left_bridge(), ast_ari_validate_channel_state_change(), ast_ari_validate_channel_talking_finished(), ast_ari_validate_channel_talking_started(), ast_ari_validate_channel_unhold(), ast_ari_validate_channel_userevent(), ast_ari_validate_channel_varset(), ast_ari_validate_contact_status_change(), ast_ari_validate_device_state_changed(), ast_ari_validate_dial(), ast_ari_validate_endpoint_state_change(), ast_ari_validate_event(), ast_ari_validate_peer_status_change(), ast_ari_validate_playback_continuing(), ast_ari_validate_playback_finished(), ast_ari_validate_playback_started(), ast_ari_validate_recording_failed(), ast_ari_validate_recording_finished(), ast_ari_validate_recording_started(), ast_ari_validate_stasis_end(), ast_ari_validate_stasis_start(), ast_ari_validate_status_info(), ast_ari_validate_text_message_received(), and AST_TEST_DEFINE().

◆ ast_ari_validate_double()

int ast_ari_validate_double ( struct ast_json json)

Validator for native Swagger double.

Parameters
jsonJSON object to validate.
Return values
True(non-zero) if valid.
False(zero) if invalid.

Definition at line 138 of file res_ari_model.c.

139{
140 return check_type(json, AST_JSON_REAL);
141}
@ AST_JSON_REAL
Definition: json.h:168

References AST_JSON_REAL, and check_type().

Referenced by ast_ari_validate_config_info(), and ast_ari_validate_rtpstat().

◆ ast_ari_validate_float()

int ast_ari_validate_float ( struct ast_json json)

Validator for native Swagger float.

Parameters
jsonJSON object to validate.
Return values
True(non-zero) if valid.
False(zero) if invalid.

Definition at line 133 of file res_ari_model.c.

134{
135 return check_type(json, AST_JSON_REAL);
136}

References AST_JSON_REAL, and check_type().

◆ ast_ari_validate_int()

int ast_ari_validate_int ( struct ast_json json)

Validator for native Swagger int.

Parameters
jsonJSON object to validate.
Return values
True(non-zero) if valid.
False(zero) if invalid.

Definition at line 121 of file res_ari_model.c.

122{
123 /* Swagger int's are 32-bit */
124 return check_range(-2147483648LL, 2147483647LL, json);
125}

References check_range().

Referenced by ast_ari_validate_channel_caller_id(), ast_ari_validate_channel_destroyed(), ast_ari_validate_channel_dtmf_received(), ast_ari_validate_channel_hangup_request(), ast_ari_validate_channel_talking_finished(), ast_ari_validate_config_info(), ast_ari_validate_live_recording(), ast_ari_validate_mailbox(), ast_ari_validate_module(), ast_ari_validate_rtpstat(), and AST_TEST_DEFINE().

◆ ast_ari_validate_list()

int ast_ari_validate_list ( struct ast_json json,
int(*)(struct ast_json *)  fn 
)

Validator for a Swagger List[]/JSON array.

Parameters
jsonJSON object to validate.
fnValidator to call on every element in the array.
Return values
True(non-zero) if valid.
False(zero) if invalid.

Definition at line 164 of file res_ari_model.c.

165{
166 int res = 1;
167 size_t i;
168
169 if (!check_type(json, AST_JSON_ARRAY)) {
170 return 0;
171 }
172
173 for (i = 0; i < ast_json_array_size(json); ++i) {
174 int member_res;
175 member_res = fn(ast_json_array_get(json, i));
176 if (!member_res) {
178 "Array member %zu failed validation\n", i);
179 res = 0;
180 }
181 }
182
183 return res;
184}
struct ast_json * ast_json_array_get(const struct ast_json *array, size_t index)
Get an element from an array.
Definition: json.c:370
@ AST_JSON_ARRAY
Definition: json.h:165
size_t ast_json_array_size(const struct ast_json *array)
Get the size of a JSON array.
Definition: json.c:366

References AST_JSON_ARRAY, ast_json_array_get(), ast_json_array_size(), ast_log, check_type(), and LOG_ERROR.

Referenced by ast_ari_applications_list_cb(), ast_ari_asterisk_get_object_cb(), ast_ari_asterisk_list_log_channels_cb(), ast_ari_asterisk_list_modules_cb(), ast_ari_asterisk_update_object_cb(), ast_ari_bridges_list_cb(), ast_ari_channels_list_cb(), ast_ari_device_states_list_cb(), ast_ari_endpoints_list_by_tech_cb(), ast_ari_endpoints_list_cb(), ast_ari_mailboxes_list_cb(), ast_ari_recordings_list_stored_cb(), ast_ari_sounds_list_cb(), ast_ari_validate_application(), ast_ari_validate_application_move_failed(), ast_ari_validate_bridge(), ast_ari_validate_endpoint(), ast_ari_validate_missing_params(), ast_ari_validate_sound(), ast_ari_validate_stasis_start(), and AST_TEST_DEFINE().

◆ ast_ari_validate_long()

int ast_ari_validate_long ( struct ast_json json)

Validator for native Swagger long.

Parameters
jsonJSON object to validate.
Return values
True(non-zero) if valid.
False(zero) if invalid.

Definition at line 127 of file res_ari_model.c.

128{
129 /* All integral values are valid longs. No need for range check. */
130 return check_type(json, AST_JSON_INTEGER);
131}
@ AST_JSON_INTEGER
Definition: json.h:167

References AST_JSON_INTEGER, and check_type().

Referenced by ast_ari_validate_dialplan_cep(), and AST_TEST_DEFINE().

◆ ast_ari_validate_object()

int ast_ari_validate_object ( struct ast_json json)

Validator for native Swagger object.

Parameters
jsonJSON object to validate.
Return values
True(non-zero) if valid.
False(zero) if invalid.

Definition at line 96 of file res_ari_model.c.

97{
98 return check_type(json, AST_JSON_OBJECT);
99}
@ AST_JSON_OBJECT
Definition: json.h:164

References AST_JSON_OBJECT, and check_type().

Referenced by ast_ari_validate_application(), ast_ari_validate_channel(), ast_ari_validate_channel_userevent(), and ast_ari_validate_text_message().

◆ ast_ari_validate_string()

int ast_ari_validate_string ( struct ast_json json)

Validator for native Swagger string.

Parameters
jsonJSON object to validate.
Return values
True(non-zero) if valid.
False(zero) if invalid.

Definition at line 143 of file res_ari_model.c.

144{
145 return check_type(json, AST_JSON_STRING);
146}

References AST_JSON_STRING, and check_type().

Referenced by ast_ari_validate_application(), ast_ari_validate_application_move_failed(), ast_ari_validate_application_replaced(), ast_ari_validate_asterisk_ping(), ast_ari_validate_bridge(), ast_ari_validate_bridge_attended_transfer(), ast_ari_validate_bridge_blind_transfer(), ast_ari_validate_bridge_created(), ast_ari_validate_bridge_destroyed(), ast_ari_validate_bridge_merged(), ast_ari_validate_bridge_video_source_changed(), ast_ari_validate_build_info(), ast_ari_validate_caller_id(), ast_ari_validate_channel(), ast_ari_validate_channel_caller_id(), ast_ari_validate_channel_connected_line(), ast_ari_validate_channel_created(), ast_ari_validate_channel_destroyed(), ast_ari_validate_channel_dialplan(), ast_ari_validate_channel_dtmf_received(), ast_ari_validate_channel_entered_bridge(), ast_ari_validate_channel_hangup_request(), ast_ari_validate_channel_hold(), ast_ari_validate_channel_left_bridge(), ast_ari_validate_channel_state_change(), ast_ari_validate_channel_talking_finished(), ast_ari_validate_channel_talking_started(), ast_ari_validate_channel_unhold(), ast_ari_validate_channel_userevent(), ast_ari_validate_channel_varset(), ast_ari_validate_config_info(), ast_ari_validate_config_tuple(), ast_ari_validate_contact_info(), ast_ari_validate_contact_status_change(), ast_ari_validate_device_state(), ast_ari_validate_device_state_changed(), ast_ari_validate_dial(), ast_ari_validate_dialplan_cep(), ast_ari_validate_endpoint(), ast_ari_validate_endpoint_state_change(), ast_ari_validate_event(), ast_ari_validate_format_lang_pair(), ast_ari_validate_live_recording(), ast_ari_validate_log_channel(), ast_ari_validate_mailbox(), ast_ari_validate_message(), ast_ari_validate_missing_params(), ast_ari_validate_module(), ast_ari_validate_peer(), ast_ari_validate_peer_status_change(), ast_ari_validate_playback(), ast_ari_validate_playback_continuing(), ast_ari_validate_playback_finished(), ast_ari_validate_playback_started(), ast_ari_validate_recording_failed(), ast_ari_validate_recording_finished(), ast_ari_validate_recording_started(), ast_ari_validate_rtpstat(), ast_ari_validate_set_id(), ast_ari_validate_sound(), ast_ari_validate_stasis_end(), ast_ari_validate_stasis_start(), ast_ari_validate_stored_recording(), ast_ari_validate_system_info(), ast_ari_validate_text_message(), ast_ari_validate_text_message_received(), ast_ari_validate_variable(), and AST_TEST_DEFINE().

◆ ast_ari_validate_void()

int ast_ari_validate_void ( struct ast_json json)

Validator for native Swagger void.

Parameters
jsonJSON object to validate.
Return values
True(non-zero) if valid.
False(zero) if invalid.

Definition at line 91 of file res_ari_model.c.

92{
93 return check_type(json, AST_JSON_NULL);
94}
@ AST_JSON_NULL
Definition: json.h:171

References AST_JSON_NULL, and check_type().

Referenced by ast_ari_asterisk_add_log_cb(), ast_ari_asterisk_delete_log_cb(), ast_ari_asterisk_delete_object_cb(), ast_ari_asterisk_load_module_cb(), ast_ari_asterisk_reload_module_cb(), ast_ari_asterisk_rotate_log_cb(), ast_ari_asterisk_set_global_var_cb(), ast_ari_asterisk_unload_module_cb(), ast_ari_bridges_add_channel_cb(), ast_ari_bridges_clear_video_source_cb(), ast_ari_bridges_destroy_cb(), ast_ari_bridges_remove_channel_cb(), ast_ari_bridges_set_video_source_cb(), ast_ari_bridges_start_moh_cb(), ast_ari_bridges_stop_moh_cb(), ast_ari_channels_answer_cb(), ast_ari_channels_continue_in_dialplan_cb(), ast_ari_channels_dial_cb(), ast_ari_channels_hangup_cb(), ast_ari_channels_hold_cb(), ast_ari_channels_move_cb(), ast_ari_channels_mute_cb(), ast_ari_channels_redirect_cb(), ast_ari_channels_ring_cb(), ast_ari_channels_ring_stop_cb(), ast_ari_channels_send_dtmf_cb(), ast_ari_channels_set_channel_var_cb(), ast_ari_channels_start_moh_cb(), ast_ari_channels_start_silence_cb(), ast_ari_channels_stop_moh_cb(), ast_ari_channels_stop_silence_cb(), ast_ari_channels_unhold_cb(), ast_ari_channels_unmute_cb(), ast_ari_device_states_delete_cb(), ast_ari_device_states_update_cb(), ast_ari_endpoints_refer_cb(), ast_ari_endpoints_refer_to_endpoint_cb(), ast_ari_endpoints_send_message_cb(), ast_ari_endpoints_send_message_to_endpoint_cb(), ast_ari_events_user_event_cb(), ast_ari_mailboxes_delete_cb(), ast_ari_mailboxes_update_cb(), ast_ari_playbacks_control_cb(), ast_ari_playbacks_stop_cb(), ast_ari_recordings_cancel_cb(), ast_ari_recordings_delete_stored_cb(), ast_ari_recordings_mute_cb(), ast_ari_recordings_pause_cb(), ast_ari_recordings_stop_cb(), ast_ari_recordings_unmute_cb(), and ast_ari_recordings_unpause_cb().

◆ AST_MODULE_SELF_SYM()

struct ast_module * AST_MODULE_SELF_SYM ( void  )

Definition at line 209 of file res_ari_model.c.

◆ check_range()

static int check_range ( intmax_t  minval,
intmax_t  maxval,
struct ast_json json 
)
static

Definition at line 74 of file res_ari_model.c.

75{
76 intmax_t v;
77
78 if (!check_type(json, AST_JSON_INTEGER)) {
79 return 0;
80 }
81
82 v = ast_json_integer_get(json);
83
84 if (v < minval || maxval < v) {
85 ast_log(LOG_ERROR, "Value out of range. Expected %jd <= %jd <= %jd\n", minval, v, maxval);
86 return 0;
87 }
88 return 1;
89}
intmax_t ast_json_integer_get(const struct ast_json *integer)
Get the value from a JSON integer.
Definition: json.c:332

References AST_JSON_INTEGER, ast_json_integer_get(), ast_log, check_type(), and LOG_ERROR.

Referenced by ast_ari_validate_byte(), and ast_ari_validate_int().

◆ check_type()

static int check_type ( struct ast_json json,
enum ast_json_type  expected 
)
static

Definition at line 55 of file res_ari_model.c.

56{
57 enum ast_json_type actual;
58
59 if (!json) {
60 ast_log(LOG_ERROR, "Expected type %s, was NULL\n",
61 ast_json_typename(expected));
62 return 0;
63 }
64
65 actual = ast_json_typeof(json);
66 if (expected != actual) {
67 ast_log(LOG_ERROR, "Expected type %s, was %s\n",
68 ast_json_typename(expected), ast_json_typename(actual));
69 return 0;
70 }
71 return 1;
72}

References ast_json_typename(), ast_json_typeof(), ast_log, and LOG_ERROR.

Referenced by ast_ari_validate_date(), ast_ari_validate_double(), ast_ari_validate_float(), ast_ari_validate_list(), ast_ari_validate_long(), ast_ari_validate_object(), ast_ari_validate_string(), ast_ari_validate_void(), and check_range().

◆ load_module()

static int load_module ( void  )
static

Definition at line 186 of file res_ari_model.c.

187{
188 int res;
189 res = regcomp(&date_regex, ISO8601_PATTERN,
190 REG_EXTENDED | REG_ICASE | REG_NOSUB);
191
192 if (res != 0) {
194 }
196}
@ AST_MODULE_LOAD_SUCCESS
Definition: module.h:70
@ AST_MODULE_LOAD_DECLINE
Module has failed to load, may be in an inconsistent state.
Definition: module.h:78
#define ISO8601_PATTERN
Definition: res_ari_model.c:53

References AST_MODULE_LOAD_DECLINE, AST_MODULE_LOAD_SUCCESS, date_regex, and ISO8601_PATTERN.

◆ unload_module()

static int unload_module ( void  )
static

Definition at line 198 of file res_ari_model.c.

199{
200 regfree(&date_regex);
201 return 0;
202}

References date_regex.

Variable Documentation

◆ __mod_info

struct ast_module_info __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_LOAD_ORDER | AST_MODFLAG_GLOBAL_SYMBOLS , .description = "ARI Model validators" , .key = "This paragraph is copyright (c) 2006 by Digium, Inc. \In order for your module to load, it must return this \key via a function called \"key\". Any code which \includes this paragraph must be licensed under the GNU \General Public License version 2 or later (at your \option). In addition to Digium's general reservations \of rights, Digium expressly reserves the right to \allow other parties to license this paragraph under \different terms. Any use of Digium, Inc. trademarks or \logos (including \"Asterisk\" or \"Digium\") without \express written permission of Digium, Inc. is prohibited.\n" , .buildopt_sum = AST_BUILDOPT_SUM, .support_level = AST_MODULE_SUPPORT_CORE, .load = load_module, .unload = unload_module, .load_pri = AST_MODPRI_APP_DEPEND, }
static

Definition at line 209 of file res_ari_model.c.

◆ ast_module_info

const struct ast_module_info* ast_module_info = &__mod_info
static

Definition at line 209 of file res_ari_model.c.

◆ date_regex

regex_t date_regex
static

Definition at line 40 of file res_ari_model.c.

Referenced by ast_ari_validate_date(), load_module(), and unload_module().