http_config.h

#ifndef APACHE_HTTP_CONFIG_H
#define APACHE_HTTP_CONFIG_H

#ifdef __cplusplus
extern "C" {
#endif

/*
 * The central data structures around here...
 */

/* Command dispatch structures... */

/* Note that for all of these except RAW_ARGS, the config routine is
 * passed a freshly allocated string which can be modified or stored
 * or whatever... it's only necessary to do pstrdup() stuff with
 * RAW_ARGS.
 */
enum cmd_how {
    RAW_ARGS,   /* cmd_func parses command line itself */
    TAKE1,   /* one argument only */
    TAKE2,   /* two arguments only */
    ITERATE,   /* one argument, occuring multiple times
     * (e.g., IndexIgnore)
     */
    ITERATE2,   /* two arguments, 2nd occurs multiple times
     * (e.g., AddIcon)
     */
    FLAG,   /* One of 'On' or 'Off' */
    NO_ARGS,   /* No args at all, e.g. </Directory> */
    TAKE12,   /* one or two arguments */
    TAKE3,   /* three arguments only */
    TAKE23,   /* two or three arguments */
    TAKE123,   /* one, two or three arguments */
    TAKE13   /* one or three arguments */
};

typedef struct command_struct {
    const char *name;  /* Name of this command */
    const char *(*func) (); /* Function invoked */
    void *cmd_data;  /* Extra data, for functions which
     * implement multiple commands...
     */
    int req_override;  /* What overrides need to be allowed to
     * enable this command.
     */
    enum cmd_how args_how; /* What the command expects as arguments */

    const char *errmsg;  /* 'usage' message, in case of syntax errors */
} command_rec;

/* The allowed locations for a configuration directive are the union of
 * those indicated by each set bit in the req_override mask.

 *
 * (req_override & RSRC_CONF)   => *.conf outside <Directory> or <Location>
 * (req_override & ACCESS_CONF) => *.conf inside <Directory> or <Location>
 * (req_override & OR_AUTHCFG)  => *.conf inside <Directory> or <Location>
 *                                 and .htaccess when AllowOverride AuthConfig
 * (req_override & OR_LIMIT)    => *.conf inside <Directory> or <Location>
 *                                 and .htaccess when AllowOverride Limit
 * (req_override & OR_OPTIONS)  => *.conf anywhere
 *                                 and .htaccess when AllowOverride Options
 * (req_override & OR_FILEINFO) => *.conf anywhere
 *                                 and .htaccess when AllowOverride FileInfo
 * (req_override & OR_INDEXES)  => *.conf anywhere
 *                                 and .htaccess when AllowOverride Indexes
 */
#define OR_NONE 0
#define OR_LIMIT 1
#define OR_OPTIONS 2
#define OR_FILEINFO 4
#define OR_AUTHCFG 8
#define OR_INDEXES 16
#define OR_UNSET 32
#define ACCESS_CONF 64
#define RSRC_CONF 128
#define OR_ALL (OR_LIMIT|OR_OPTIONS|OR_FILEINFO|OR_AUTHCFG|OR_INDEXES)

/* This can be returned by a function if they don't wish to handle
 * a command. Make it something not likely someone will actually use
 * as an error code.
 */

#define DECLINE_CMD "/a/b"

/*
 * This structure is passed to a command which is being invoked,
 * to carry a large variety of miscellaneous data which is all of
 * use to *somebody*...
 */

typedef struct {
    void *info;   /* Argument to command from cmd_table */
    int override;  /* Which allow-override bits are set */
    int limited;  /* Which methods are <Limit>ed */

    configfile_t *config_file; /* Config file structure from pcfg_openfile() */

    ap_pool *pool;   /* Pool to allocate new storage in */
    struct pool *temp_pool;  /* Pool for scratch memory; persists during
     * configuration, but wiped before the first
     * request is served...
     */
    server_rec *server;  /* Server_rec being configured for */
    char *path;   /* If configuring for a directory,
     * pathname of that directory.
     * NOPE!  That's what it meant previous to the
     * existance of <Files>, <Location> and regex
     * matching.  Now the only usefulness that can
     * be derived from this field is whether a command
     * is being called in a server context (path == NULL)
     * or being called in a dir context (path != NULL).
     */
    const command_rec *cmd; /* configuration command */
    const char *end_token; /* end token required to end a nested section */
} cmd_parms;

/* This structure records the existence of handlers in a module... */

typedef struct {
    const char *content_type; /* MUST be all lower case */
    int (*handler) (request_rec *);
} handler_rec;

/*
 * Module structures.  Just about everything is dispatched through
 * these, directly or indirectly (through the command and handler
 * tables).
 */

typedef struct module_struct {
    int version;  /* API version, *not* module version;
     * check that module is compatible with this
     * version of the server.
     */
    int minor_version;          /* API minor version. Provides API feature
                                 * milestones. Not checked during module init
     */
    int module_index;  /* Index to this modules structures in
     * config vectors.
     */

    const char *name;

    void *dynamic_load_handle;

    struct module_struct *next;

    /* init() occurs after config parsing, but before any children are
     * forked.
     * Modules should not rely on the order in which create_server_config
     * and create_dir_config are called.
     */
#ifdef ULTRIX_BRAIN_DEATH
    void (*init) ();
    void *(*create_dir_config) ();
    void *(*merge_dir_config) ();
    void *(*create_server_config) ();
    void *(*merge_server_config) ();
#else
    void (*init) (server_rec *, pool *);
    void *(*create_dir_config) (pool *p, char *dir);
    void *(*merge_dir_config) (pool *p, void *base_conf, void *new_conf);
    void *(*create_server_config) (pool *p, server_rec *s);
    void *(*merge_server_config) (pool *p, void *base_conf, void *new_conf);
#endif

    const command_rec *cmds;
    const handler_rec *handlers;

    /* Hooks for getting into the middle of server ops...

     * translate_handler --- translate URI to filename
     * access_checker --- check access by host address, etc.   All of these
     *                    run; if all decline, that's still OK.
     * check_user_id --- get and validate user id from the HTTP request
     * auth_checker --- see if the user (from check_user_id) is OK *here*.
     *                  If all of *these* decline, the request is rejected
     *                  (as a SERVER_ERROR, since the module which was
     *                  supposed to handle this was configured wrong).
     * type_checker --- Determine MIME type of the requested entity;
     *                  sets content_type, _encoding and _language fields.
     * logger --- log a transaction.
     * post_read_request --- run right after read_request or internal_redirect,
     *                  and not run during any subrequests.
     */

    int (*translate_handler) (request_rec *);
    int (*ap_check_user_id) (request_rec *);
    int (*auth_checker) (request_rec *);
    int (*access_checker) (request_rec *);
    int (*type_checker) (request_rec *);
    int (*fixer_upper) (request_rec *);
    int (*logger) (request_rec *);
    int (*header_parser) (request_rec *);

    /* Regardless of the model the server uses for managing "units of
     * execution", i.e. multi-process, multi-threaded, hybrids of those,
     * there is the concept of a "heavy weight process".  That is, a
     * process with its own memory space, file spaces, etc.  This method,
     * child_init, is called once for each heavy-weight process before
     * any requests are served.  Note that no provision is made yet for
     * initialization per light-weight process (i.e. thread).  The
     * parameters passed here are the same as those passed to the global
     * init method above.
     */
#ifdef ULTRIX_BRAIN_DEATH
    void (*child_init) ();
    void (*child_exit) ();
#else
    void (*child_init) (server_rec *, pool *);
    void (*child_exit) (server_rec *, pool *);
#endif
    int (*post_read_request) (request_rec *);
} module;

/* Initializer for the first few module slots, which are only
 * really set up once we start running.  Note that the first two slots
 * provide a version check; this should allow us to deal with changes to
 * the API. The major number should reflect changes to the API handler table
 * itself or removal of functionality. The minor number should reflect
 * additions of functionality to the existing API. (the server can detect
 * an old-format module, and either handle it back-compatibly, or at least
 * signal an error). See src/include/ap_mmn.h for MMN version history.
 */

#define STANDARD_MODULE_STUFF MODULE_MAGIC_NUMBER_MAJOR, /
    MODULE_MAGIC_NUMBER_MINOR, /
    -1, /
    __FILE__, /
    NULL, /
    NULL

/* Generic accessors for other modules to get at their own module-specific
 * data
 */

API_EXPORT(void *) ap_get_module_config(void *conf_vector, module *m);
API_EXPORT(void) ap_set_module_config(void *conf_vector, module *m, void *val);

#define ap_get_module_config(v,m) /
    (((void **)(v))[(m)->module_index])
#define ap_set_module_config(v,m,val) /
    ((((void **)(v))[(m)->module_index]) = (val))

/* Generic command handling function... */

API_EXPORT_NONSTD(const char *) ap_set_string_slot(cmd_parms *, char *, char *);
API_EXPORT_NONSTD(const char *) ap_set_string_slot_lower(cmd_parms *, char *, char *);
API_EXPORT_NONSTD(const char *) ap_set_flag_slot(cmd_parms *, char *, int);
API_EXPORT_NONSTD(const char *) ap_set_file_slot(cmd_parms *, char *, char *);

/* For modules which need to read config files, open logs, etc. ...
 * this returns the fname argument if it begins with '/'; otherwise
 * it relativizes it wrt server_root.
 */

API_EXPORT(char *) ap_server_root_relative(pool *p, char *fname);

/* Finally, the hook for dynamically loading modules in... */

API_EXPORT(void) ap_add_module(module *m);
API_EXPORT(void) ap_remove_module(module *m);
API_EXPORT(void) ap_add_loaded_module(module *mod);
API_EXPORT(void) ap_remove_loaded_module(module *mod);
API_EXPORT(int) ap_add_named_module(const char *name);
API_EXPORT(void) ap_clear_module_list(void);
API_EXPORT(const char *) ap_find_module_name(module *m);
API_EXPORT(module *) ap_find_linked_module(const char *name);

/* for implementing subconfigs and customized config files */
API_EXPORT(const char *) ap_srm_command_loop(cmd_parms *parms, void *config);

#ifdef CORE_PRIVATE

extern API_VAR_EXPORT module *top_module;

extern module *ap_prelinked_modules[];
extern module *ap_preloaded_modules[];
extern API_VAR_EXPORT module **ap_loaded_modules;

/* For http_main.c... */

server_rec *ap_read_config(pool *conf_pool, pool *temp_pool, char *config_name);
void ap_init_modules(pool *p, server_rec *s);
void ap_child_init_modules(pool *p, server_rec *s);
void ap_child_exit_modules(pool *p, server_rec *s);
void ap_setup_prelinked_modules(void);
void ap_show_directives(void);
void ap_show_modules(void);

/* For http_request.c... */

void *ap_create_request_config(pool *p);
CORE_EXPORT(void *) ap_create_per_dir_config(pool *p);
void *ap_merge_per_dir_configs(pool *p, void *base, void *new);

/* For http_core.c... (<Directory> command and virtual hosts) */

int ap_parse_htaccess(void **result, request_rec *r, int override,
  const char *path, const char *access_name);

CORE_EXPORT(const char *) ap_init_virtual_host(pool *p, const char *hostname,
    server_rec *main_server, server_rec **);
void ap_process_resource_config(server_rec *s, char *fname, pool *p, pool *ptemp);

/* check_cmd_context() definitions: */
API_EXPORT(const char *) ap_check_cmd_context(cmd_parms *cmd, unsigned forbidden);

/* check_cmd_context():                  Forbidden in: */
#define  NOT_IN_VIRTUALHOST     0x01 /* <Virtualhost> */
#define  NOT_IN_LIMIT           0x02 /* <Limit> */
#define  NOT_IN_DIRECTORY       0x04 /* <Directory> */
#define  NOT_IN_LOCATION        0x08 /* <Location> */
#define  NOT_IN_FILES           0x10 /* <Files> */
#define  NOT_IN_DIR_LOC_FILE    (NOT_IN_DIRECTORY|NOT_IN_LOCATION|NOT_IN_FILES) /* <Directory>/<Location>/<Files>*/
#define  GLOBAL_ONLY            (NOT_IN_VIRTUALHOST|NOT_IN_LIMIT|NOT_IN_DIR_LOC_FILE)


/* Module-method dispatchers, also for http_request.c */

int ap_translate_name(request_rec *);
int ap_check_access(request_rec *); /* check access on non-auth basis */
int ap_check_user_id(request_rec *); /* obtain valid username from client auth */
int ap_check_auth(request_rec *); /* check (validated) user is authorized here */
int ap_find_types(request_rec *); /* identify MIME type */
int ap_run_fixups(request_rec *); /* poke around for other metainfo, etc.... */
int ap_invoke_handler(request_rec *);
int ap_log_transaction(request_rec *r);
int ap_header_parse(request_rec *);
int ap_run_post_read_request(request_rec *);

/* for mod_perl */

CORE_EXPORT(const command_rec *) ap_find_command(const char *name, const command_rec *cmds);
CORE_EXPORT(const command_rec *) ap_find_command_in_modules(const char *cmd_name, module **mod);
CORE_EXPORT(const char *) ap_handle_command(cmd_parms *parms, void *config, const char *l);

#endif

#ifdef __cplusplus
}
#endif

该文件是apache的核心结构定义文件。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
#include <dummy.h> #include "esp_camera.h" #include <WiFi.h> #define CAMERA_MODEL_AI_THINKER #include "camera_pins.h" const char* ssid = "666"; const char* password = "qqljc123"; void startCameraServer(); void setup() { Serial.begin(115200); Serial.setDebugOutput(true); Serial.println(); camera_config_t config; config.ledc_channel = LEDC_CHANNEL_0; config.ledc_timer = LEDC_TIMER_0; config.pin_d0 = Y2_GPIO_NUM; config.pin_d1 = Y3_GPIO_NUM; config.pin_d2 = Y4_GPIO_NUM; config.pin_d3 = Y5_GPIO_NUM; config.pin_d4 = Y6_GPIO_NUM; config.pin_d5 = Y7_GPIO_NUM; config.pin_d6 = Y8_GPIO_NUM; config.pin_d7 = Y9_GPIO_NUM; config.pin_xclk = XCLK_GPIO_NUM; config.pin_pclk = PCLK_GPIO_NUM; config.pin_vsync = VSYNC_GPIO_NUM; config.pin_href = HREF_GPIO_NUM; config.pin_sscb_sda = SIOD_GPIO_NUM; config.pin_sscb_scl = SIOC_GPIO_NUM; config.pin_pwdn = PWDN_GPIO_NUM; config.pin_reset = RESET_GPIO_NUM; config.xclk_freq_hz = 20000000; config.pixel_format = PIXFORMAT_JPEG; if(psramFound()){ config.frame_size = FRAMESIZE_UXGA; config.jpeg_quality = 10; config.fb_count = 2; } else { config.frame_size = FRAMESIZE_SVGA; config.jpeg_quality = 12; config.fb_count = 1; } #if defined(CAMERA_MODEL_ESP_EYE) pinMode(13, INPUT_PULLUP); pinMode(14, INPUT_PULLUP); #endif esp_err_t err = esp_camera_init(&config); if (err != ESP_OK) { Serial.printf("Camera init failed with error 0x%x", err); return; } sensor_t * s = esp_camera_sensor_get(); if (s->id.PID == OV3660_PID) { s->set_vflip(s, 1); s->set_brightness(s, 1); s->set_saturation(s, -2); } s->set_framesize(s, FRAMESIZE_QVGA); #if defined(CAMERA_MODEL_M5STACK_WIDE) || defined(CAMERA_MODEL_M5STACK_ESP32CAM) s->set_vflip(s, 1); s->set_hmirror(s, 1); #endif WiFi.begin(ssid, password); while (WiFi.status() != WL_CONNECTED) { delay(500); Serial.print("."); } Serial.println(""); Serial.println("WiFi connected"); startCameraServer(); Serial.print("Camera Ready! Use 'http://"); Serial.print(WiFi.localIP()); Serial.println("' to connect"); } void loop() { delay(10000); } 每句代码具体意思解释
07-16
这段代码是一个ESP32摄像头的示例代码,用于连接WiFi并启动摄像头服务器。下面是每句代码的具体解释: 1. `#include <dummy.h>`:引入了一个名为`dummy.h`的头文件,可能是一个虚拟的头文件,没有实际作用。 2. `"esp_camera.h"`:引入了ESP32摄像头库的头文件。 3. `<WiFi.h>`:引入了ESP32的WiFi库的头文件。 4. `#define CAMERA_MODEL_AI_THINKER`:定义了摄像头型号为AI-Thinker。 5. `"camera_pins.h"`:引入了摄像头引脚配置文件的头文件。 6. `const char* ssid = "666";`:定义了WiFi的SSID,即网络名称。 7. `const char* password = "qqljc123";`:定义了WiFi的密码。 8. `void startCameraServer();`:声明了一个名为`startCameraServer`的函数,用于启动摄像头服务器。 9. `void setup()`:定义了初始化函数,在程序开始时执行一次。 10. `Serial.begin(115200);`:初始化串口通信,波特率设置为115200。 11. `Serial.setDebugOutput(true);`:开启串口调试输出。 12. `camera_config_t config;`:定义了一个名为`config`的结构体变量,用于配置摄像头参数。 13. `config.ledc_channel = LEDC_CHANNEL_0;`:设置LED控制器通道为0。 14. `config.ledc_timer = LEDC_TIMER_0;`:设置LED控制器定时器为0。 15. `config.pin_d0 = Y2_GPIO_NUM;`:设置D0引脚为Y2_GPIO_NUM宏定义所表示的引脚号。 16. `config.pin_d1 = Y3_GPIO_NUM;`:设置D1引脚为Y3_GPIO_NUM宏定义所表示的引脚号。 17. `...`:依次设置了各个引脚的对应关系,以及其他摄像头参数。 18. `if(psramFound()){...} else {...}`:判断是否检测到PSRAM,根据结果设置不同的摄像头分辨率、JPEG质量和帧缓冲区数量。 19. `#if defined(CAMERA_MODEL_ESP_EYE)`:如果定义了宏`CAMERA_MODEL_ESP_EYE`,则执行下面的代码块。 20. `pinMode(13, INPUT_PULLUP);`:将引脚13设置为上拉输入模式。 21. `pinMode(14, INPUT_PULLUP);`:将引脚14设置为上拉输入模式。 22. `#endif`:结束条件编译块。 23. `esp_err_t err = esp_camera_init(&config);`:初始化摄像头,并将错误代码保存在变量`err`中。 24. `if (err != ESP_OK) {...}`:如果初始化失败,则输出错误信息。 25. `sensor_t * s = esp_camera_sensor_get();`:获取摄像头传感器的指针。 26. `if (s->id.PID == OV3660_PID) {...}`:如果摄像头传感器的PID为OV3660_PID,执行下面的代码块。 27. `s->set_vflip(s, 1);`:设置传感器垂直翻转。 28. `s->set_brightness(s, 1);`:设置传感器亮度。 29. `s->set_saturation(s, -2);`:设置传感器饱和度。 30. `s->set_framesize(s, FRAMESIZE_QVGA);`:设置传感器帧大小为QVGA。 31. `#if defined(CAMERA_MODEL_M5STACK_WIDE) || defined(CAMERA_MODEL_M5STACK_ESP32CAM)`:如果定义了宏`CAMERA_MODEL_M5STACK_WIDE`或者`CAMERA_MODEL_M5STACK_ESP32CAM`,执行下面的代码块。 32. `s->set_vflip(s, 1);`:设置传感器垂直翻转。 33. `s->set_hmirror(s, 1);`:设置传感器水平镜像。 34. `#endif`:结束条件编译块。 35. `WiFi.begin(ssid, password);`:使用指定的SSID和密码连接WiFi网络。 36. `while (WiFi.status() != WL_CONNECTED) {...}`:等待WiFi连接成功。 37. `startCameraServer();`:调用函数启动摄像头服务器。 38. `Serial.print("Camera Ready! Use 'http://");`:输出提示信息。 39. `Serial.print(WiFi.localIP());`:输出本地IP地址。 40. `Serial.println("' to connect");`:输出连接提示信息。 41. `void loop()`:定义了循环函数,在程序运行时循环执行。 42. `delay(10000);`:延迟10秒。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值