ソースを参照

Add comments for mg_get_valid_options and format spaces in the header

bel 11 年 前
コミット
8a514b8ed1
1 ファイル変更19 行追加3 行削除
  1. 19 3
      include/civetweb.h

+ 19 - 3
include/civetweb.h

@@ -1,4 +1,5 @@
-/* Copyright (c) 2004-2013 Sergey Lyubka
+/* Copyright (c) 2013-2014 the Civetweb developers
+ * Copyright (c) 2004-2013 Sergey Lyubka
  *
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
  * of this software and associated documentation files (the "Software"), to deal
@@ -154,6 +155,7 @@ struct mg_callbacks {
     int  (*http_error)(struct mg_connection *, int status);
     int  (*http_error)(struct mg_connection *, int status);
 };
 };
 
 
+
 /* Start web server.
 /* Start web server.
 
 
    Parameters:
    Parameters:
@@ -191,6 +193,7 @@ CIVETWEB_API struct mg_context *mg_start(const struct mg_callbacks *callbacks,
    threads are stopped. Context pointer becomes invalid. */
    threads are stopped. Context pointer becomes invalid. */
 CIVETWEB_API void mg_stop(struct mg_context *);
 CIVETWEB_API void mg_stop(struct mg_context *);
 
 
+
 /* mg_request_handler
 /* mg_request_handler
 
 
    Called when a new request comes in.  This callback is URI based
    Called when a new request comes in.  This callback is URI based
@@ -204,6 +207,7 @@ CIVETWEB_API void mg_stop(struct mg_context *);
       1: the handler processed the request. */
       1: the handler processed the request. */
 typedef int (* mg_request_handler)(struct mg_connection *conn, void *cbdata);
 typedef int (* mg_request_handler)(struct mg_connection *conn, void *cbdata);
 
 
+
 /* mg_set_request_handler
 /* mg_set_request_handler
 
 
    Sets or removes a URI mapping for a request handler.
    Sets or removes a URI mapping for a request handler.
@@ -258,8 +262,11 @@ enum {
     CONFIG_TYPE_EXT_PATTERN = 0x6
     CONFIG_TYPE_EXT_PATTERN = 0x6
 };
 };
 
 
-CIVETWEB_API const struct mg_option *mg_get_valid_options(void);
 
 
+/* Return array of struct mg_option, representing all valid configuration
+   options of civetweb.c.
+   The array is terminated by a NULL name option. */
+CIVETWEB_API const struct mg_option *mg_get_valid_options(void);
 
 
 
 
 /* Get the list of ports that civetweb is listening on.
 /* Get the list of ports that civetweb is listening on.
@@ -271,6 +278,7 @@ CIVETWEB_API const struct mg_option *mg_get_valid_options(void);
    configuration at run time. */
    configuration at run time. */
 CIVETWEB_API size_t mg_get_ports(const struct mg_context *ctx, size_t size, int* ports, int* ssl);
 CIVETWEB_API size_t mg_get_ports(const struct mg_context *ctx, size_t size, int* ports, int* ssl);
 
 
+
 /* Add, edit or delete the entry in the passwords file.
 /* Add, edit or delete the entry in the passwords file.
 
 
    This function allows an application to manipulate .htpasswd files on the
    This function allows an application to manipulate .htpasswd files on the
@@ -316,6 +324,7 @@ CIVETWEB_API int mg_write(struct mg_connection *, const void *buf, size_t len);
 CIVETWEB_API int mg_websocket_write(struct mg_connection* conn, int opcode,
 CIVETWEB_API int mg_websocket_write(struct mg_connection* conn, int opcode,
                                     const char *data, size_t data_len);
                                     const char *data, size_t data_len);
 
 
+
 /* Blocks until unique access is obtained to this connection. Intended for use
 /* Blocks until unique access is obtained to this connection. Intended for use
    with websockets only.
    with websockets only.
    Invoke this before mg_write or mg_printf when communicating with a
    Invoke this before mg_write or mg_printf when communicating with a
@@ -324,6 +333,7 @@ CIVETWEB_API int mg_websocket_write(struct mg_connection* conn, int opcode,
 CIVETWEB_API void mg_lock(struct mg_connection* conn);
 CIVETWEB_API void mg_lock(struct mg_connection* conn);
 CIVETWEB_API void mg_unlock(struct mg_connection* conn);
 CIVETWEB_API void mg_unlock(struct mg_connection* conn);
 
 
+
 /* Opcodes, from http://tools.ietf.org/html/rfc6455 */
 /* Opcodes, from http://tools.ietf.org/html/rfc6455 */
 enum {
 enum {
     WEBSOCKET_OPCODE_CONTINUATION = 0x0,
     WEBSOCKET_OPCODE_CONTINUATION = 0x0,
@@ -355,7 +365,6 @@ enum {
 #endif
 #endif
 
 
 /* Send data to the client using printf() semantics.
 /* Send data to the client using printf() semantics.
-
    Works exactly like mg_write(), but allows to do message formatting. */
    Works exactly like mg_write(), but allows to do message formatting. */
 CIVETWEB_API int mg_printf(struct mg_connection *,
 CIVETWEB_API int mg_printf(struct mg_connection *,
                            PRINTF_FORMAT_STRING(const char *fmt), ...) PRINTF_ARGS(2, 3);
                            PRINTF_FORMAT_STRING(const char *fmt), ...) PRINTF_ARGS(2, 3);
@@ -403,6 +412,7 @@ CIVETWEB_API const char *mg_get_header(const struct mg_connection *, const char
 CIVETWEB_API int mg_get_var(const char *data, size_t data_len,
 CIVETWEB_API int mg_get_var(const char *data, size_t data_len,
                             const char *var_name, char *dst, size_t dst_len);
                             const char *var_name, char *dst, size_t dst_len);
 
 
+
 /* Get a value of particular form variable.
 /* Get a value of particular form variable.
 
 
    Parameters:
    Parameters:
@@ -429,6 +439,7 @@ CIVETWEB_API int mg_get_var(const char *data, size_t data_len,
 CIVETWEB_API int mg_get_var2(const char *data, size_t data_len,
 CIVETWEB_API int mg_get_var2(const char *data, size_t data_len,
                              const char *var_name, char *dst, size_t dst_len, size_t occurrence);
                              const char *var_name, char *dst, size_t dst_len, size_t occurrence);
 
 
+
 /* Fetch value of certain cookie variable into the destination buffer.
 /* Fetch value of certain cookie variable into the destination buffer.
 
 
    Destination buffer is guaranteed to be '\0' - terminated. In case of
    Destination buffer is guaranteed to be '\0' - terminated. In case of
@@ -491,6 +502,7 @@ CIVETWEB_API const char *mg_get_builtin_mime_type(const char *file_name);
 /* Return Civetweb version. */
 /* Return Civetweb version. */
 CIVETWEB_API const char *mg_version(void);
 CIVETWEB_API const char *mg_version(void);
 
 
+
 /* URL-decode input buffer into destination buffer.
 /* URL-decode input buffer into destination buffer.
    0-terminate the destination buffer.
    0-terminate the destination buffer.
    form-url-encoded data differs from URI encoding in a way that it
    form-url-encoded data differs from URI encoding in a way that it
@@ -500,11 +512,13 @@ CIVETWEB_API const char *mg_version(void);
 CIVETWEB_API int mg_url_decode(const char *src, int src_len, char *dst,
 CIVETWEB_API int mg_url_decode(const char *src, int src_len, char *dst,
                                int dst_len, int is_form_url_encoded);
                                int dst_len, int is_form_url_encoded);
 
 
+
 /* URL-encode input buffer into destination buffer.
 /* URL-encode input buffer into destination buffer.
    returns the length of the resulting buffer or -1
    returns the length of the resulting buffer or -1
    is the buffer is too small. */
    is the buffer is too small. */
 CIVETWEB_API int mg_url_encode(const char *src, char *dst, size_t dst_len);
 CIVETWEB_API int mg_url_encode(const char *src, char *dst, size_t dst_len);
 
 
+
 /* MD5 hash given strings.
 /* MD5 hash given strings.
    Buffer 'buf' must be 33 bytes long. Varargs is a NULL terminated list of
    Buffer 'buf' must be 33 bytes long. Varargs is a NULL terminated list of
    ASCIIz strings. When function returns, buf will contain human-readable
    ASCIIz strings. When function returns, buf will contain human-readable
@@ -524,9 +538,11 @@ CIVETWEB_API char *mg_md5(char buf[33], ...);
 CIVETWEB_API void mg_cry(struct mg_connection *conn,
 CIVETWEB_API void mg_cry(struct mg_connection *conn,
                          PRINTF_FORMAT_STRING(const char *fmt), ...) PRINTF_ARGS(2, 3);
                          PRINTF_FORMAT_STRING(const char *fmt), ...) PRINTF_ARGS(2, 3);
 
 
+
 /* utility method to compare two buffers, case incensitive. */
 /* utility method to compare two buffers, case incensitive. */
 CIVETWEB_API int mg_strncasecmp(const char *s1, const char *s2, size_t len);
 CIVETWEB_API int mg_strncasecmp(const char *s1, const char *s2, size_t len);
 
 
+
 #ifdef __cplusplus
 #ifdef __cplusplus
 }
 }
 #endif /* __cplusplus */
 #endif /* __cplusplus */