From be4a74c7a82631eeeb53bb90df8bcacb02ca0ffe Mon Sep 17 00:00:00 2001 From: AngelCarpintero Date: Wed, 21 May 2008 12:53:43 +0000 Subject: [PATCH] Makeking changes according to http://www.lavrsen.dk/twiki/bin/view/Motion/IntuitiveOptionNamesDiscussion ( locate_motion, sql_log_movie , webcontrol_*, despeckle_filter. Add a wrapped #ifdef / #endif for FFMPEG in motion.c --- alg.c | 6 +- conf.c | 44 +++++----- conf.h | 14 +-- configure | 18 ++-- motion-dist.conf.in | 16 ++-- motion.1 | 26 +++--- motion.c | 36 ++++---- motion.h | 4 +- webhttpd.c | 208 ++++++++++++++++++++++---------------------- 9 files changed, 185 insertions(+), 187 deletions(-) diff --git a/alg.c b/alg.c index 8976db1d..14d99150 100644 --- a/alg.c +++ b/alg.c @@ -618,11 +618,11 @@ int alg_despeckle(struct context *cnt, int olddiffs) unsigned char *out = cnt->imgs.out; int width = cnt->imgs.width; int height = cnt->imgs.height; - int done = 0, i, len = strlen(cnt->conf.despeckle); + int done = 0, i, len = strlen(cnt->conf.despeckle_filter); unsigned char *common_buffer = cnt->imgs.common_buffer; for (i = 0; i < len; i++) { - switch (cnt->conf.despeckle[i]) { + switch (cnt->conf.despeckle_filter[i]) { case 'E': if ((diffs = erode9(out, width, height, common_buffer, 0)) == 0) i = len; done = 1; @@ -648,7 +648,7 @@ int alg_despeckle(struct context *cnt, int olddiffs) } } - /* If conf.despeckle contains any valid action EeDdl */ + /* If conf.despeckle_filter contains any valid action EeDdl */ if (done){ if (done != 2) cnt->imgs.labelsize_max = 0; // Disable Labeling return diffs; diff --git a/conf.c b/conf.c index 8369a032..aa905eac 100644 --- a/conf.c +++ b/conf.c @@ -58,7 +58,7 @@ struct config conf_template = { gap: DEF_GAP, maxmpegtime: DEF_MAXMPEGTIME, snapshot_interval: 0, - locate: "off", + locate_motion: "off", input: IN_DEFAULT, norm: 0, frame_limit: DEF_MAXFRAMERATE, @@ -89,10 +89,10 @@ struct config conf_template = { stream_maxrate: 1, stream_localhost: 1, stream_limit: 0, - control_port: 0, - control_localhost: 1, - control_html_output: 1, - control_authentication:NULL, + webcontrol_port: 0, + webcontrol_localhost: 1, + webcontrol_html_output: 1, + webcontrol_authentication: NULL, frequency: 0, tuner_number: 0, timelapse: 0, @@ -114,7 +114,7 @@ struct config conf_template = { smart_mask_speed: 0, sql_log_image: 1, sql_log_snapshot: 1, - sql_log_mpeg: 0, + sql_log_movie: 0, sql_log_timelapse: 0, sql_query: DEF_SQL_QUERY, mysql_db: NULL, @@ -142,7 +142,7 @@ struct config conf_template = { text_right: DEF_TIMESTAMP, text_event: DEF_EVENTSTAMP, text_double: 0, - despeckle: NULL, + despeckle_filter: NULL, area_detect: NULL, minimum_motion_frames: 1, pid_file: NULL, @@ -470,13 +470,13 @@ config_param config_params[] = { print_bool }, { - "despeckle", + "despeckle_filter", "# Despeckle motion image using (e)rode or (d)ilate or (l)abel (Default: not defined)\n" "# Recommended value is EedDl. Any combination (and number of) of E, e, d, and D is valid.\n" "# (l)abeling must only be used once and the 'l' must be the last letter.\n" "# Comment out to disable", 0, - CONF_OFFSET(despeckle), + CONF_OFFSET(despeckle_filter), copy_string, print_string }, @@ -719,7 +719,7 @@ config_param config_params[] = { print_int }, { - "locate", + "locate_motion", "\n############################################################\n" "# Text Display\n" "# %Y = year, %m = month, %d = date,\n" @@ -736,7 +736,7 @@ config_param config_params[] = { "# Valid values: on, off and preview (default: off)\n" "# Set to 'preview' will only draw a box in preview_shot pictures.", 0, - CONF_OFFSET(locate), + CONF_OFFSET(locate_motion), copy_string, print_string }, @@ -923,38 +923,38 @@ config_param config_params[] = { print_int }, { - "control_port", + "webcontrol_port", "\n############################################################\n" "# HTTP Based Control\n" "############################################################\n\n" "# TCP/IP port for the http server to listen on (default: 0 = disabled)", 1, - CONF_OFFSET(control_port), + CONF_OFFSET(webcontrol_port), copy_int, print_int }, { - "control_localhost", + "webcontrol_localhost", "# Restrict control connections to localhost only (default: on)", 1, - CONF_OFFSET(control_localhost), + CONF_OFFSET(webcontrol_localhost), copy_bool, print_bool }, { - "control_html_output", + "webcontrol_html_output", "# Output for http server, select off to choose raw text plain (default: on)", 1, - CONF_OFFSET(control_html_output), + CONF_OFFSET(webcontrol_html_output), copy_bool, print_bool }, { - "control_authentication", + "webcontrol_authentication", "# Authentication for the http based control. Syntax username:password\n" "# Default: not defined (Disabled)", 1, - CONF_OFFSET(control_authentication), + CONF_OFFSET(webcontrol_authentication), copy_string, print_string }, @@ -1195,10 +1195,10 @@ config_param config_params[] = { print_bool }, { - "sql_log_mpeg", - "# Log to the database when creating motion triggered mpeg file (default: off)", + "sql_log_movie", + "# Log to the database when creating motion triggered movie file (default: off)", 0, - CONF_OFFSET(sql_log_mpeg), + CONF_OFFSET(sql_log_movie), copy_bool, print_bool }, diff --git a/conf.h b/conf.h index 75b809ec..8dd98a85 100644 --- a/conf.h +++ b/conf.h @@ -32,7 +32,7 @@ struct config { int gap; int maxmpegtime; int snapshot_interval; - const char *locate; + const char *locate_motion; int input; int norm; int frame_limit; @@ -64,10 +64,10 @@ struct config { int stream_maxrate; int stream_localhost; int stream_limit; - int control_port; - int control_localhost; - int control_html_output; - const char *control_authentication; + int webcontrol_port; + int webcontrol_localhost; + int webcontrol_html_output; + const char *webcontrol_authentication; unsigned long frequency; int tuner_number; int timelapse; @@ -89,7 +89,7 @@ struct config { int smart_mask_speed; int sql_log_image; int sql_log_snapshot; - int sql_log_mpeg; + int sql_log_movie; int sql_log_timelapse; const char *sql_query; const char *mysql_db; @@ -117,7 +117,7 @@ struct config { const char *text_right; const char *text_event; int text_double; - const char *despeckle; + const char *despeckle_filter; const char *area_detect; int minimum_motion_frames; char *pid_file; diff --git a/configure b/configure index e250f9c7..e58f46a6 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.61 for motion trunk-r345. +# Generated by GNU Autoconf 2.61 for motion trunk-r347. # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, # 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. @@ -572,8 +572,8 @@ SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='motion' PACKAGE_TARNAME='motion' -PACKAGE_VERSION='trunk-r345' -PACKAGE_STRING='motion trunk-r345' +PACKAGE_VERSION='trunk-r347' +PACKAGE_STRING='motion trunk-r347' PACKAGE_BUGREPORT='' ac_unique_file="motion.c" @@ -1178,7 +1178,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures motion trunk-r345 to adapt to many kinds of systems. +\`configure' configures motion trunk-r347 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1239,7 +1239,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of motion trunk-r345:";; + short | recursive ) echo "Configuration of motion trunk-r347:";; esac cat <<\_ACEOF @@ -1375,7 +1375,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -motion configure trunk-r345 +motion configure trunk-r347 generated by GNU Autoconf 2.61 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -1389,7 +1389,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by motion $as_me trunk-r345, which was +It was created by motion $as_me trunk-r347, which was generated by GNU Autoconf 2.61. Invocation command line was $ $0 $@ @@ -7540,7 +7540,7 @@ exec 6>&1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by motion $as_me trunk-r345, which was +This file was extended by motion $as_me trunk-r347, which was generated by GNU Autoconf 2.61. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -7589,7 +7589,7 @@ Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ -motion config.status trunk-r345 +motion config.status trunk-r347 configured by $0, generated by GNU Autoconf 2.61, with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" diff --git a/motion-dist.conf.in b/motion-dist.conf.in index f778d83c..36ec1037 100644 --- a/motion-dist.conf.in +++ b/motion-dist.conf.in @@ -162,7 +162,7 @@ noise_tune on # Recommended value is EedDl. Any combination (and number of) of E, e, d, and D is valid. # (l)abeling must only be used once and the 'l' must be the last letter. # Comment out to disable -despeckle EedDl +despeckle_filter EedDl # Detect motion in predefined areas (1 - 9). Areas are numbered like that: 1 2 3 # A script (on_area_detected) is started immediately when motion is 4 5 6 @@ -308,7 +308,7 @@ snapshot_interval 0 # Locate and draw a box around the moving object. # Valid values: on, off and preview (default: off) # Set to 'preview' will only draw a box in preview_shot pictures. -locate off +locate_motion off # Draws the timestamp using same options as C function strftime(3) # Default: %Y-%m-%d\n%T = date in ISO format and time in 24 hour clock @@ -420,17 +420,17 @@ stream_limit 0 ############################################################ # TCP/IP port for the http server to listen on (default: 0 = disabled) -control_port 8080 +webcontrol_port 8080 # Restrict control connections to localhost only (default: on) -control_localhost on +webcontrol_localhost on # Output for http server, select off to choose raw text plain (default: on) -control_html_output on +webcontrol_html_output on # Authentication for the http based control. Syntax username:password # Default: not defined (Disabled) -; control_authentication username:password +; webcontrol_authentication username:password ############################################################ @@ -549,8 +549,8 @@ sql_log_image on # Log to the database when creating a snapshot image file (default: on) sql_log_snapshot on -# Log to the database when creating motion triggered mpeg file (default: off) -sql_log_mpeg off +# Log to the database when creating motion triggered movie file (default: off) +sql_log_movie off # Log to the database when creating timelapse mpeg file (default: off) sql_log_timelapse off diff --git a/motion.1 b/motion.1 index 1c8330f2..62089379 100644 --- a/motion.1 +++ b/motion.1 @@ -55,32 +55,32 @@ Values: 0 - 255 / Default: 0 (disabled) .br The contrast level for the video device. .TP -.B control_authentication string +.B webcontrol_authentication string Values: Max 4096 characters / Default: Not defined .br To protect HTTP Control by username and password, use this option for HTTP 1.1 Basic authentication. The string is specified as username:password. Do not specify this option for no authentication. This option must be placed in motion.conf and not in a thread config file. .TP -.B control_html_output boolean +.B webcontrol_html_output boolean Values: on, off / Default: on .br -Enable HTML in the answer sent back to a browser connecting to the control_port. This option must be placed in motion.conf and not in a thread config file. +Enable HTML in the answer sent back to a browser connecting to the webcontrol_port. This option must be placed in motion.conf and not in a thread config file. .TP -.B control_localhost boolean +.B webcontrol_localhost boolean Values: on, off / Default: on .br -Limits the http (html) control to the localhost. This option must be placed in motion.conf and not in a thread config file. +Limits the webcontrol to the localhost. This option must be placed in motion.conf and not in a thread config file. .TP -.B control_port integer +.B webcontrol_port integer Values: 0 - 65535 / Default: 0 (disabled) .br -Sets the port number for the http (html using browser) based remote control. This option must be placed in motion.conf and not in a thread config file. +Sets the port number for the http (html using browser) based remote webcontrol. This option must be placed in motion.conf and not in a thread config file. .TP .B daemon boolean Values: on, off / Default: off .br Start in daemon (background) mode and release terminal. This option must be placed in motion.conf and not in a thread config file. .TP -.B despeckle string +.B despeckle_filter string Values: EedDl / Default: Not defined .br Despeckle motion image using combinations of (E/e)rode or (D/d)ilate. And ending with optional (l)abeling. @@ -165,7 +165,7 @@ Values: 0 - 100 / Default: 0 (disabled) .br Ignore sudden massive light intensity changes given as a percentage of the picture area that changed intensity. .TP -.B locate boolean +.B locate_motion boolean Values: on, off, preview / Default: off .br Locate and draw a box around the moving object. Value 'preview' makes Motion only draw a box on a saved preview jpeg image and not on the saved mpeg movie. @@ -410,7 +410,7 @@ Values: on, off / Default: on .br Log to the database when creating motion triggered image file. .TP -.B sql_log_mpeg boolean +.B sql_log_movie boolean Values: on, off / Default: off .br Log to the database when creating motion triggered mpeg file. @@ -670,7 +670,7 @@ So always call the thread config files in the end of the motion.conf file. If yo .br If motion is built without specific features such as ffmpeg, mysql etc it will ignore the options that belongs to these features. You do not have to remove them or comment them out. .br -If you run the http control command http://host:port/0/config/writeyes, motion will overwrite motion.conf and all the thread.conf files by autogenerated config files neatly formatted and only with the features included that Motion was built with. If you later re-build Motion with more features or upgrade to a new version, you can use your old config files, run the motion.conf.write command, and you will have new config files with the new options included all set to their default values. This makes upgrading very easy to do. +If you run the webcontrol command http://host:port/0/config/writeyes, motion will overwrite motion.conf and all the thread.conf files by autogenerated config files neatly formatted and only with the features included that Motion was built with. If you later re-build Motion with more features or upgrade to a new version, you can use your old config files, run the motion.conf.write command, and you will have new config files with the new options included all set to their default values. This makes upgrading very easy to do. .TP .B Conversion Specifiers for Advanced Filename and Text Features The table below shows all the supported Conversion Specifiers you can use in the options text_left, text_right, snapshot_filename, jpeg_filename, ffmpeg_filename, timelapse_filename, on_area_detected, on_camera_lost, on_event_start, on_event_end, on_picture_save, on_movie_start, on_movie_end, and on_motion_detected. @@ -715,7 +715,7 @@ Equivalent to %Y-%m-%d (the ISO 8601 date format). The hour as a decimal number using a 24-hour clock (range 00 to 23). .TP .B %i -Width of the rectangle containing the motion pixels (the rectangle that is shown on the image when locate is on). +Width of the rectangle containing the motion pixels (the rectangle that is shown on the image when locate_motion is on). .TP .B %I The hour as a decimal number using a 12-hour clock (range 01 to 12). @@ -724,7 +724,7 @@ The hour as a decimal number using a 12-hour clock (range 01 to 12). The day of the year as a decimal number (range 001 to 366). .TP .B %J -Height of the rectangle containing the motion pixels (the rectangle that is shown on the image when locate is on). +Height of the rectangle containing the motion pixels (the rectangle that is shown on the image when locate_motion is on). .TP .B %k The hour (24-hour clock) as a decimal number (range 0 to 23); single digits are preceded by a blank. (See also %H.) diff --git a/motion.c b/motion.c index b39c9928..58ab4934 100644 --- a/motion.c +++ b/motion.c @@ -199,7 +199,7 @@ static void image_save_as_preview(struct context *cnt, struct image_data *img) cnt->imgs.preview_image.diffs = 1; /* If we have locate on it is already done */ - if (cnt->locate == LOCATE_PREVIEW) { + if (cnt->locate_motion == LOCATE_PREVIEW) { alg_draw_location(&img->location, &cnt->imgs, cnt->imgs.width, cnt->imgs.preview_image.image, LOCATE_NORMAL); } } @@ -381,7 +381,7 @@ static void motion_detected(struct context *cnt, int dev, struct image_data *img struct coord *location = &img->location; /* Draw location */ - if (cnt->locate == LOCATE_ON) + if (cnt->locate_motion == LOCATE_ON) alg_draw_location(location, imgs, imgs->width, img->image, LOCATE_BOTH); /* Calculate how centric motion is if configured preview center*/ @@ -506,6 +506,7 @@ static void process_image_ring(struct context *cnt, unsigned int max_images) cnt->imgs.image_ring[cnt->imgs.image_ring_out].image, NULL, NULL, &cnt->imgs.image_ring[cnt->imgs.image_ring_out].timestamp_tm); +#ifdef HAVE_FFMPEG /* Check if we must add any "filler" frames into movie to keep up fps */ if (cnt->imgs.image_ring[cnt->imgs.image_ring_out].shot == 0) { /* movie_last_shoot is -1 when file is created, @@ -540,6 +541,7 @@ static void process_image_ring(struct context *cnt, unsigned int max_images) * only when we not are within first sec */ if (cnt->movie_last_shot >= 0) cnt->movie_last_shot = cnt->imgs.image_ring[cnt->imgs.image_ring_out].shot; +#endif } /* Mark the image as saved */ @@ -767,7 +769,7 @@ static int motion_init(struct context *cnt) cnt->sql_mask = cnt->conf.sql_log_image * (FTYPE_IMAGE + FTYPE_IMAGE_MOTION) + cnt->conf.sql_log_snapshot * FTYPE_IMAGE_SNAPSHOT + - cnt->conf.sql_log_mpeg * (FTYPE_MPEG + FTYPE_MPEG_MOTION) + + cnt->conf.sql_log_movie * (FTYPE_MPEG + FTYPE_MPEG_MOTION) + cnt->conf.sql_log_timelapse * FTYPE_MPEG_TIMELAPSE; #endif /* defined(HAVE_MYSQL) || defined(HAVE_PGSQL) */ @@ -1318,7 +1320,7 @@ static void *motion_loop(void *arg) } /* Despeckle feature - * First we run (as given by the despeckle option iterations + * First we run (as given by the despeckle_filter option iterations * of erode and dilate algorithms. * Finally we run the labelling feature. * All this is done in the alg_despeckle code. @@ -1326,7 +1328,7 @@ static void *motion_loop(void *arg) cnt->current_image->total_labels = 0; cnt->imgs.largest_label = 0; olddiffs = 0; - if (cnt->conf.despeckle && cnt->current_image->diffs > 0) { + if (cnt->conf.despeckle_filter && cnt->current_image->diffs > 0) { olddiffs = cnt->current_image->diffs; cnt->current_image->diffs = alg_despeckle(cnt, olddiffs); }else if (cnt->imgs.labelsize_max) @@ -1639,11 +1641,11 @@ static void *motion_loop(void *arg) char msg[1024] = "\0"; char part[100]; - if (cnt->conf.despeckle) { + if (cnt->conf.despeckle_filter) { snprintf(part, 99, "Raw changes: %5d - changes after '%s': %5d", - olddiffs, cnt->conf.despeckle, cnt->current_image->diffs); + olddiffs, cnt->conf.despeckle_filter, cnt->current_image->diffs); strcat(msg, part); - if (strchr(cnt->conf.despeckle, 'l')){ + if (strchr(cnt->conf.despeckle_filter, 'l')){ sprintf(part, " - labels: %3d", cnt->current_image->total_labels); strcat(msg, part); } @@ -1690,8 +1692,6 @@ static void *motion_loop(void *arg) #ifdef HAVE_FFMPEG - - if (cnt->conf.timelapse) { /* Check to see if we should start a new timelapse file. We start one when @@ -1802,12 +1802,12 @@ static void *motion_loop(void *arg) else cnt->new_img = NEWIMG_OFF; - if (strcasecmp(cnt->conf.locate, "on") == 0) - cnt->locate = LOCATE_ON; - else if (strcasecmp(cnt->conf.locate, "preview") == 0) - cnt->locate = LOCATE_PREVIEW; + if (strcasecmp(cnt->conf.locate_motion, "on") == 0) + cnt->locate_motion = LOCATE_ON; + else if (strcasecmp(cnt->conf.locate_motion, "preview") == 0) + cnt->locate_motion = LOCATE_PREVIEW; else - cnt->locate = LOCATE_OFF; + cnt->locate_motion = LOCATE_OFF; /* Sanity check for smart_mask_speed, silly value disables smart mask */ if (cnt->conf.smart_mask_speed < 0 || cnt->conf.smart_mask_speed > 10) @@ -1832,7 +1832,7 @@ static void *motion_loop(void *arg) */ cnt->sql_mask = cnt->conf.sql_log_image * (FTYPE_IMAGE + FTYPE_IMAGE_MOTION) + cnt->conf.sql_log_snapshot * FTYPE_IMAGE_SNAPSHOT + - cnt->conf.sql_log_mpeg * (FTYPE_MPEG + FTYPE_MPEG_MOTION) + + cnt->conf.sql_log_movie * (FTYPE_MPEG + FTYPE_MPEG_MOTION) + cnt->conf.sql_log_timelapse * FTYPE_MPEG_TIMELAPSE; #endif /* defined(HAVE_MYSQL) || defined(HAVE_PGSQL) */ @@ -2185,7 +2185,7 @@ static void start_motion_thread(struct context *cnt, pthread_attr_t *thread_attr if (cnt->conf.stream_port != 0) { /* Compare against the control port. */ - if (cnt_list[0]->conf.control_port == cnt->conf.stream_port) { + if (cnt_list[0]->conf.webcontrol_port == cnt->conf.stream_port) { motion_log(LOG_ERR, 0, "Stream port number %d for thread %d conflicts with the control port", cnt->conf.stream_port, cnt->threadnr); @@ -2324,7 +2324,7 @@ int main (int argc, char **argv) /* Create a thread for the control interface if requested. Create it * detached and with 'motion_web_control' as the thread function. */ - if (cnt_list[0]->conf.control_port) + if (cnt_list[0]->conf.webcontrol_port) pthread_create(&thread_id, &thread_attr, &motion_web_control, cnt_list); if (cnt_list[0]->conf.setup_mode) diff --git a/motion.h b/motion.h index d4a57efa..6187a1e3 100644 --- a/motion.h +++ b/motion.h @@ -18,7 +18,6 @@ #endif #include -#include #include #define __USE_GNU #include @@ -26,7 +25,6 @@ #include #include #include -#include #include #include #include @@ -314,7 +312,7 @@ struct context { struct image_data *current_image; /* Pointer to a structure where the image, diffs etc is stored */ unsigned short int new_img; - int locate; + int locate_motion; struct rotdata rotate_data; /* rotation data is thread-specific */ int noise; diff --git a/webhttpd.c b/webhttpd.c index a563f1f3..bb77adc6 100644 --- a/webhttpd.c +++ b/webhttpd.c @@ -358,7 +358,7 @@ static unsigned short int config(char *pointer, char *res, unsigned short int le const char *value = NULL; char *retval = NULL; /*call list*/ - if (cnt[0]->conf.control_html_output) { + if (cnt[0]->conf.webcontrol_html_output) { send_template_ini_client(client_socket, ini_template); sprintf(res, "<– back

\nThread %hu\n
    ", thread, thread); send_template(client_socket, res); @@ -447,7 +447,7 @@ static unsigned short int config(char *pointer, char *res, unsigned short int le } } else { /*error*/ - if (cnt[0]->conf.control_html_output) + if (cnt[0]->conf.webcontrol_html_output) response_client(client_socket, not_found_response_valid_command, NULL); else response_client(client_socket, not_found_response_valid_command_raw, NULL); @@ -486,7 +486,7 @@ static unsigned short int config(char *pointer, char *res, unsigned short int le /* FIXME need to assure that is a valid value */ url_decode(Value, strlen(Value)); conf_cmdparse(cnt + thread, config_params[i].param_name, Value); - if (cnt[0]->conf.control_html_output) { + if (cnt[0]->conf.webcontrol_html_output) { sprintf(res, "<– back" "

    \nThread %hu\n" @@ -505,7 +505,7 @@ static unsigned short int config(char *pointer, char *res, unsigned short int le } } else { /*error*/ - if (cnt[0]->conf.control_html_output) + if (cnt[0]->conf.webcontrol_html_output) response_client(client_socket, not_valid_syntax, NULL); else response_client(client_socket, not_valid_syntax_raw, NULL); @@ -536,7 +536,7 @@ static unsigned short int config(char *pointer, char *res, unsigned short int le type = strdup("unknown"); } - if (cnt[0]->conf.control_html_output) { + if (cnt[0]->conf.webcontrol_html_output) { sprintf(res, "<– back

    \n" "Thread %hu\n
    • %s" @@ -556,14 +556,14 @@ static unsigned short int config(char *pointer, char *res, unsigned short int le } } else { /*error*/ - if (cnt[0]->conf.control_html_output) + if (cnt[0]->conf.webcontrol_html_output) response_client(client_socket, not_found_response_valid_command, NULL); else response_client(client_socket, not_found_response_valid_command_raw, NULL); } } else { /* Show param_name dialogue only for html output */ - if ( (cnt[0]->conf.control_html_output) && (command[0] != '\0') && + if ( (cnt[0]->conf.webcontrol_html_output) && (command[0] != '\0') && (((length_uri = length_uri - strlen(command)) == 0 )) ) { i=0; while (config_params[i].param_name != NULL) { @@ -639,20 +639,20 @@ static unsigned short int config(char *pointer, char *res, unsigned short int le send_template_end_client(client_socket); free(text_help); } else { - if (cnt[0]->conf.control_html_output) + if (cnt[0]->conf.webcontrol_html_output) response_client(client_socket, not_found_response_valid_command, NULL); else response_client(client_socket, not_found_response_valid_command_raw, NULL); } } else { - if (cnt[0]->conf.control_html_output) + if (cnt[0]->conf.webcontrol_html_output) response_client(client_socket, not_found_response_valid_command, NULL); else response_client(client_socket, not_found_response_valid_command_raw, NULL); } } } else if (length_uri == 0) { - if (cnt[0]->conf.control_html_output) { + if (cnt[0]->conf.webcontrol_html_output) { send_template_ini_client(client_socket, set_template); sprintf(res, "<– back

      \nThread %hu\n" "
      \n\n" @@ -1833,13 +1833,13 @@ static unsigned short int track(char *pointer, char *res, unsigned short int len send_template_raw(client_socket, res); } } else { - if (cnt[0]->conf.control_html_output) + if (cnt[0]->conf.webcontrol_html_output) response_client(client_socket, not_found_response_valid_command, NULL); else response_client(client_socket, not_found_response_valid_command_raw, NULL); } } else { - if (cnt[0]->conf.control_html_output) + if (cnt[0]->conf.webcontrol_html_output) response_client(client_socket, not_found_response_valid_command, NULL); else response_client(client_socket, not_found_response_valid_command_raw, NULL); @@ -1871,7 +1871,7 @@ static unsigned short int handle_get(int client_socket, const char *url, void *u /* ROOT_URI -> GET / */ if (! (strcmp (url, "/")) ) { unsigned short int y; - if (cnt[0]->conf.control_html_output) { + if (cnt[0]->conf.webcontrol_html_output) { send_template_ini_client(client_socket, ini_template); sprintf(res, "Motion "VERSION" Running [%hu] Threads
      \n" "All
      \n", i); @@ -1927,7 +1927,7 @@ static unsigned short int handle_get(int client_socket, const char *url, void *u pointer = pointer + 6; length_uri = length_uri - 6; if (length_uri == 0) { - if (cnt[0]->conf.control_html_output) { + if (cnt[0]->conf.webcontrol_html_output) { send_template_ini_client(client_socket, ini_template); sprintf(res, "<– back

      \n" "Thread %hd
      \n" @@ -1949,7 +1949,7 @@ static unsigned short int handle_get(int client_socket, const char *url, void *u length_uri--; config(pointer, res, length_uri, thread, client_socket, cnt); } else { - if (cnt[0]->conf.control_html_output) + if (cnt[0]->conf.webcontrol_html_output) response_client(client_socket, not_found_response_valid_command, NULL); else response_client(client_socket, not_found_response_valid_command_raw, NULL); @@ -1961,7 +1961,7 @@ static unsigned short int handle_get(int client_socket, const char *url, void *u length_uri = length_uri - 6; /* call action() */ if (length_uri == 0) { - if (cnt[0]->conf.control_html_output) { + if (cnt[0]->conf.webcontrol_html_output) { send_template_ini_client(client_socket, ini_template); sprintf(res, "<– back

      \n" "Thread %hd
      \n" @@ -1986,7 +1986,7 @@ static unsigned short int handle_get(int client_socket, const char *url, void *u return ret; } else { - if (cnt[0]->conf.control_html_output) + if (cnt[0]->conf.webcontrol_html_output) response_client(client_socket, not_found_response_valid_command,NULL); else response_client(client_socket, not_found_response_valid_command_raw,NULL); @@ -1997,7 +1997,7 @@ static unsigned short int handle_get(int client_socket, const char *url, void *u pointer = pointer + 9; length_uri = length_uri - 9; if (length_uri == 0) { - if (cnt[0]->conf.control_html_output) { + if (cnt[0]->conf.webcontrol_html_output) { send_template_ini_client(client_socket, ini_template); sprintf(res, "<– back

      \n" "Thread %hd
      \n" @@ -2019,7 +2019,7 @@ static unsigned short int handle_get(int client_socket, const char *url, void *u /* call detection() */ detection(pointer, res, length_uri, thread, client_socket, cnt); } else { - if (cnt[0]->conf.control_html_output) + if (cnt[0]->conf.webcontrol_html_output) response_client(client_socket, not_found_response_valid_command, NULL); else response_client(client_socket, not_found_response_valid_command_raw, NULL); @@ -2030,7 +2030,7 @@ static unsigned short int handle_get(int client_socket, const char *url, void *u pointer = pointer + 5; length_uri = length_uri - 5; if (length_uri == 0) { - if (cnt[0]->conf.control_html_output) { + if (cnt[0]->conf.webcontrol_html_output) { send_template_ini_client(client_socket, ini_template); sprintf(res, "<– back

      \n" "Thread %hd
      \n" @@ -2054,7 +2054,7 @@ static unsigned short int handle_get(int client_socket, const char *url, void *u track(pointer, res, length_uri, thread, client_socket, cnt); } else { /* error track not enable */ - if (cnt[0]->conf.control_html_output) { + if (cnt[0]->conf.webcontrol_html_output) { sprintf(res, "<– back\n", thread); response_client(client_socket, not_track, res); } @@ -2062,7 +2062,7 @@ static unsigned short int handle_get(int client_socket, const char *url, void *u response_client(client_socket, not_track_raw, NULL); } } else { - if (cnt[0]->conf.control_html_output) { + if (cnt[0]->conf.webcontrol_html_output) { sprintf(res, "<– back\n", thread); response_client(client_socket, not_found_response_valid_command, res); } @@ -2070,7 +2070,7 @@ static unsigned short int handle_get(int client_socket, const char *url, void *u response_client(client_socket, not_found_response_valid_command_raw, NULL); } } else { - if (cnt[0]->conf.control_html_output) { + if (cnt[0]->conf.webcontrol_html_output) { sprintf(res, "<– back\n", thread); response_client(client_socket, not_found_response_valid_command, res); } @@ -2079,7 +2079,7 @@ static unsigned short int handle_get(int client_socket, const char *url, void *u } } else { /* /thread_number/ requested */ - if (cnt[0]->conf.control_html_output) { + if (cnt[0]->conf.webcontrol_html_output) { send_template_ini_client(client_socket, ini_template); sprintf(res, "<– back

      \nThread %hd
      \n" "config
      \n" @@ -2096,7 +2096,7 @@ static unsigned short int handle_get(int client_socket, const char *url, void *u } } } else { - if (cnt[0]->conf.control_html_output) { + if (cnt[0]->conf.webcontrol_html_output) { sprintf(res, "<– back\n"); response_client(client_socket, not_found_response_valid, res); } @@ -2106,7 +2106,7 @@ static unsigned short int handle_get(int client_socket, const char *url, void *u } free(res); } else { - if (cnt[0]->conf.control_html_output) + if (cnt[0]->conf.webcontrol_html_output) response_client(client_socket, not_found_response_template,NULL); else response_client(client_socket, not_found_response_template_raw,NULL); @@ -2185,7 +2185,7 @@ static unsigned short int read_client(int client_socket, void *userdata, char *a /* Check Protocol */ if (strcmp(protocol, "HTTP/1.0") && strcmp (protocol, "HTTP/1.1")) { /* We don't understand this protocol. Report a bad response. */ - if (cnt[0]->conf.control_html_output) + if (cnt[0]->conf.webcontrol_html_output) warningkill = write(client_socket, bad_request_response, sizeof (bad_request_response)); else warningkill = write(client_socket, bad_request_response_raw, sizeof (bad_request_response_raw)); @@ -2198,7 +2198,7 @@ static unsigned short int read_client(int client_socket, void *userdata, char *a /* This server only implements the GET method. If client uses other method, report the failure. */ char response[1024]; - if (cnt[0]->conf.control_html_output) + if (cnt[0]->conf.webcontrol_html_output) snprintf(response, sizeof (response), bad_method_response_template, method); else snprintf(response, sizeof (response), bad_method_response_template_raw, method); @@ -2222,11 +2222,11 @@ static unsigned short int read_client(int client_socket, void *userdata, char *a return 1; } - // Don't allow to change control_authentication from http control + // Don't allow to change webcontrol_authentication from http control // If it has to be allowed reenable check_authentication() /*if ( !check_authentication(auth, authentication, - strlen(cnt[0]->conf.control_authentication), - cnt[0]->conf.control_authentication)) { + strlen(cnt[0]->conf.webcontrol_authentication), + cnt[0]->conf.webcontrol_authentication)) { */ if (strcmp(auth, authentication)) { @@ -2322,9 +2322,9 @@ void httpd_run(struct context **cnt) hints.ai_family = AF_UNSPEC; hints.ai_socktype = SOCK_STREAM; - snprintf(portnumber, sizeof(portnumber), "%u", cnt[0]->conf.control_port); + snprintf(portnumber, sizeof(portnumber), "%u", cnt[0]->conf.webcontrol_port); - val = getaddrinfo(cnt[0]->conf.control_localhost ? "localhost" : NULL, portnumber, &hints, &res); + val = getaddrinfo(cnt[0]->conf.webcontrol_localhost ? "localhost" : NULL, portnumber, &hints, &res); /* check != 0 to allow FreeBSD compatibility */ if (val != 0) { @@ -2380,15 +2380,15 @@ void httpd_run(struct context **cnt) motion_log(LOG_DEBUG, 0, "motion-httpd/"VERSION" running, accepting connections"); motion_log(LOG_DEBUG, 0, "motion-httpd: waiting for data on %s port TCP %s", hbuf, sbuf); - if (cnt[0]->conf.control_authentication != NULL ) { + if (cnt[0]->conf.webcontrol_authentication != NULL ) { char *userpass = NULL; - size_t auth_size = strlen(cnt[0]->conf.control_authentication); + size_t auth_size = strlen(cnt[0]->conf.webcontrol_authentication); authentication = (char *) mymalloc(BASE64_LENGTH(auth_size) + 1); userpass = mymalloc(auth_size + 4); /* base64_encode can read 3 bytes after the end of the string, initialize it */ memset(userpass, 0, auth_size + 4); - strcpy(userpass, cnt[0]->conf.control_authentication); + strcpy(userpass, cnt[0]->conf.webcontrol_authentication); base64_encode(userpass, authentication, auth_size); free(userpass); }