1 /* 2 * 3 * conf.h - function prototypes for the config handling routines 4 * 5 * Originally written for the dproxy package by Matthew Pratt. 6 * 7 * Copyright 2000 Jeroen Vreeken (pe1rxq@chello.nl) 8 * 9 * This software is licensed under the terms of the GNU General 10 * Public License (GPL). Please see the file COPYING for details. 11 * 12 * 13 */ 14 15 #ifndef _INCLUDE_CONF_H 16 #define _INCLUDE_CONF_H 17 18 /* 19 * More parameters may be added later. 20 */ 21 struct config { 22 /* Overall system configuration parameters */ 23 /* daemon is directly cast into the cnt context rather than conf */ 24 int setup_mode; 25 char *pid_file; 26 char *log_file; 27 int log_level; 28 char *log_type; 29 int quiet; 30 int native_language; 31 const char *camera_name; 32 int camera_id; 33 const char *camera_dir; 34 const char *target_dir; 35 36 /* Capture device configuration parameters */ 37 const char *video_device; 38 char *vid_control_params; 39 int v4l2_palette; 40 int input; 41 int norm; 42 unsigned long frequency; 43 int auto_brightness; 44 const char *tuner_device; 45 int roundrobin_frames; 46 int roundrobin_skip; 47 int roundrobin_switchfilter; 48 49 const char *netcam_url; 50 const char *netcam_highres; 51 const char *netcam_userpass; 52 const char *netcam_keepalive; 53 const char *netcam_proxy; 54 int netcam_tolerant_check; 55 int netcam_use_tcp; 56 char *netcam_decoder; 57 58 const char *mmalcam_name; 59 const char *mmalcam_control_params; 60 61 /* Image processing configuration parameters */ 62 int width; 63 int height; 64 int framerate; 65 int minimum_frame_time; 66 int rotate; 67 const char *flip_axis; 68 const char *locate_motion_mode; 69 const char *locate_motion_style; 70 const char *text_left; 71 const char *text_right; 72 int text_changes; 73 int text_scale; 74 const char *text_event; 75 76 /* Motion detection configuration parameters */ 77 int emulate_motion; 78 int threshold; 79 int threshold_maximum; 80 int threshold_tune; 81 int noise_level; 82 int noise_tune; 83 const char *despeckle_filter; 84 const char *area_detect; 85 const char *mask_file; 86 const char *mask_privacy; 87 int smart_mask_speed; 88 int lightswitch_percent; 89 int lightswitch_frames; 90 int minimum_motion_frames; 91 int event_gap; 92 int pre_capture; 93 int post_capture; 94 95 /* Script execution configuration parameters */ 96 char *on_event_start; 97 char *on_event_end; 98 char *on_picture_save; 99 char *on_area_detected; 100 char *on_motion_detected; 101 char *on_movie_start; 102 char *on_movie_end; 103 char *on_camera_lost; 104 char *on_camera_found; 105 106 /* Picture output configuration parameters */ 107 const char *picture_output; 108 int picture_output_motion; 109 const char *picture_type; 110 int picture_quality; 111 const char *picture_exif; 112 const char *picture_filename; 113 114 /* Snapshot configuration parameters */ 115 int snapshot_interval; 116 const char *snapshot_filename; 117 118 /* Movie output configuration parameters */ 119 int movie_output; 120 int movie_output_motion; 121 int movie_max_time; 122 int movie_bps; 123 int movie_quality; 124 const char *movie_codec; 125 int movie_duplicate_frames; 126 int movie_passthrough; 127 const char *movie_filename; 128 int movie_extpipe_use; 129 const char *movie_extpipe; 130 131 /* Timelapse movie configuration parameters */ 132 int timelapse_interval; 133 const char *timelapse_mode; 134 int timelapse_fps; 135 const char *timelapse_codec; 136 const char *timelapse_filename; 137 138 /* Loopback device configuration parameters */ 139 const char *video_pipe; 140 const char *video_pipe_motion; 141 142 /* Webcontrol configuration parameters */ 143 int webcontrol_port; 144 int webcontrol_ipv6; 145 int webcontrol_localhost; 146 int webcontrol_parms; 147 int webcontrol_interface; 148 int webcontrol_auth_method; 149 const char *webcontrol_authentication; 150 int webcontrol_tls; 151 const char *webcontrol_cert; 152 const char *webcontrol_key; 153 const char *webcontrol_cors_header; 154 155 /* Live stream configuration parameters */ 156 int stream_port; 157 int stream_localhost; 158 int stream_auth_method; 159 const char *stream_authentication; 160 int stream_tls; 161 const char *stream_cors_header; 162 int stream_preview_scale; 163 int stream_preview_newline; 164 int stream_preview_method; 165 int stream_quality; 166 int stream_grey; 167 int stream_motion; 168 int stream_maxrate; 169 int stream_limit; 170 171 /* Database and SQL configuration parameters */ 172 const char *database_type; 173 const char *database_dbname; 174 const char *database_host; 175 int database_port; 176 const char *database_user; 177 const char *database_password; 178 int database_busy_timeout; 179 180 int sql_log_picture; 181 int sql_log_snapshot; 182 int sql_log_movie; 183 int sql_log_timelapse; 184 const char *sql_query_start; 185 const char *sql_query_stop; 186 const char *sql_query; 187 188 /* Command line parameters */ 189 int argc; 190 char **argv; 191 }; 192 193 /** 194 * typedef for a param copy function. 195 */ 196 typedef struct context ** (* conf_copy_func)(struct context **, const char *, int); 197 typedef const char *(* conf_print_func)(struct context **, char **, int, unsigned int); 198 199 /** 200 * description for parameters in the config file 201 */ 202 typedef struct { 203 const char *param_name; /* name for this parameter */ 204 const char *param_help; /* short explanation for parameter */ 205 unsigned int main_thread; /* belong only to main thread when value>0 */ 206 int conf_value; /* pointer to a field in struct context */ 207 conf_copy_func copy; /* a function to set the value in 'config' */ 208 conf_print_func print; /* a function to output the value to a file */ 209 int webui_level; /* Enum to display in webui: 0,1,2,3,99(always to never)*/ 210 } config_param; 211 212 extern config_param config_params[]; 213 214 /** 215 * description for deprecated parameters in the config file 216 */ 217 typedef struct { 218 const char *name; /* Name of the deprecated option */ 219 const char *last_version; /* Last version this option was used in */ 220 const char *info; /* Short text on why it was deprecated (removed, replaced with, etc) */ 221 int conf_value; /* Pointer to the replacement field in struct context */ 222 const char *newname; /* Name of the new parameter */ 223 conf_copy_func copy; /* Function to set the replacement value */ 224 } dep_config_param; 225 226 extern dep_config_param dep_config_params[]; 227 228 struct context **conf_load(struct context **); 229 struct context **copy_string(struct context **, const char *, int); 230 struct context **copy_uri(struct context **, const char *, int); 231 struct context **conf_cmdparse(struct context **, const char *, const char *); 232 struct context **read_camera_dir(struct context **, const char *, int); 233 void conf_output_parms(struct context **cnt); 234 const char *config_type(config_param *); 235 void conf_print(struct context **); 236 char *mystrdup(const char *); 237 char *mystrcpy(char *, const char *); 238 239 #endif /* _INCLUDE_CONF_H */ 240