/*
 * mod_reqin_log.h - Apache HTTPD module for logging HTTP requests as JSON to Unix socket
 *
 * Copyright (c) 2026. All rights reserved.
 */

#ifndef MOD_REQIN_LOG_H
#define MOD_REQIN_LOG_H

#include "httpd.h"
#include "http_config.h"
#include "apr_tables.h"

/* Module name */
#define MOD_REQIN_LOG_NAME "mod_reqin_log"

/* Default configuration values */
#define DEFAULT_MAX_HEADERS 25
#define DEFAULT_MAX_HEADER_VALUE_LEN 256
#define DEFAULT_RECONNECT_INTERVAL 10
#define DEFAULT_ERROR_REPORT_INTERVAL 10

/* Module configuration structure */
typedef struct {
    int enabled;
    const char *socket_path;
    apr_array_header_t *headers;
    int max_headers;
    int max_header_value_len;
    int reconnect_interval;
    int error_report_interval;
} reqin_log_config_t;

/* External module declaration */
extern module AP_MODULE_DECLARE_DATA reqin_log_module;

/* ====== Fingerprinting HTTP/2 passif ====== */

/* Clés des notes de connexion stockant le fingerprint HTTP/2 parsé */
#define H2_NOTE_FINGERPRINT  "reqin_h2_fp"   /* Fingerprint Akamai complet */
#define H2_NOTE_SETTINGS     "reqin_h2_set"  /* Entrées SETTINGS brutes    */
#define H2_NOTE_WUPDATE      "reqin_h2_wu"   /* Incrément WINDOW_UPDATE    */
#define H2_NOTE_PSEUDO_ORDER "reqin_h2_ps"   /* Ordre pseudo-headers        */
#define H2_NOTE_HAS_PRIORITY "reqin_h2_pri"  /* Flag PRIORITY présent       */
#define H2_NOTE_PARSED       "reqin_h2_done" /* Marqueur "déjà parsé"       */

/* Clés des notes pour chaque paramètre SETTINGS individuel (RFC 9113 §6.5.2) */
#define H2_NOTE_SET_HEADER_TABLE_SIZE      "reqin_h2_s1"  /* ID 1 */
#define H2_NOTE_SET_ENABLE_PUSH            "reqin_h2_s2"  /* ID 2 */
#define H2_NOTE_SET_MAX_CONCURRENT_STREAMS "reqin_h2_s3"  /* ID 3 */
#define H2_NOTE_SET_INITIAL_WINDOW_SIZE    "reqin_h2_s4"  /* ID 4 */
#define H2_NOTE_SET_MAX_FRAME_SIZE         "reqin_h2_s5"  /* ID 5 */
#define H2_NOTE_SET_MAX_HEADER_LIST_SIZE   "reqin_h2_s6"  /* ID 6 */
#define H2_NOTE_SET_ENABLE_CONNECT         "reqin_h2_s8"  /* ID 8 */

#endif /* MOD_REQIN_LOG_H */
