touched up code a little
This commit is contained in:
@ -30,8 +30,6 @@ enum qse_htrd_errnum_t
|
||||
{
|
||||
QSE_HTRD_ENOERR,
|
||||
QSE_HTRD_ENOMEM,
|
||||
|
||||
QSE_HTRD_EDISCON,
|
||||
QSE_HTRD_EBADRE,
|
||||
QSE_HTRD_EBADHDR,
|
||||
QSE_HTRD_ERECBS
|
||||
@ -50,13 +48,9 @@ typedef struct qse_htrd_recbs_t qse_htrd_recbs_t;
|
||||
|
||||
struct qse_htrd_recbs_t
|
||||
{
|
||||
/* octet reader and writer */
|
||||
qse_ssize_t (*reader) (qse_htrd_t* htrd, qse_htoc_t* buf, qse_size_t len);
|
||||
|
||||
int (*request) (qse_htrd_t* htrd, qse_htre_t* req);
|
||||
int (*response) (qse_htrd_t* htrd, qse_htre_t* res);
|
||||
int (*expect_continue) (qse_htrd_t* htrd, qse_htre_t* req);
|
||||
|
||||
int (*response) (qse_htrd_t* htrd, qse_htre_t* res);
|
||||
int (*qparamstr) (qse_htrd_t* htrd, const qse_mcstr_t* key, const qse_mcstr_t* val);
|
||||
};
|
||||
|
||||
@ -110,8 +104,6 @@ struct qse_htrd_t
|
||||
} retype;
|
||||
|
||||
qse_htre_t re;
|
||||
|
||||
qse_htoc_t rbuf[4096];
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -23,8 +23,10 @@
|
||||
|
||||
#include <qse/types.h>
|
||||
#include <qse/macros.h>
|
||||
#include <qse/net/htre.h>
|
||||
|
||||
typedef struct qse_httpd_t qse_httpd_t;
|
||||
typedef struct qse_httpd_t qse_httpd_t;
|
||||
typedef struct qse_httpd_client_t qse_httpd_client_t;
|
||||
|
||||
enum qse_httpd_errnum_t
|
||||
{
|
||||
@ -34,15 +36,18 @@ enum qse_httpd_errnum_t
|
||||
QSE_HTTPD_EINTERN,
|
||||
QSE_HTTPD_EIOMUX,
|
||||
QSE_HTTPD_ESOCKET,
|
||||
QSE_HTTPD_EDISCON, /* client disconnnected */
|
||||
QSE_HTTPD_EBADREQ, /* bad request */
|
||||
QSE_HTTPD_ECOMCBS
|
||||
};
|
||||
typedef enum qse_httpd_errnum_t qse_httpd_errnum_t;
|
||||
|
||||
typedef struct qse_httpd_comcbs_t qse_httpd_comcbs_t;
|
||||
struct qse_httpd_comcbs_t
|
||||
|
||||
typedef struct qse_httpd_cbs_t qse_httpd_cbs_t;
|
||||
struct qse_httpd_cbs_t
|
||||
{
|
||||
int (*open_listeners) (qse_httpd_t* httpd);
|
||||
int (*close_listeners) (qse_httpd_t* httpd);
|
||||
int (*handle_request) (qse_httpd_t* httpd, qse_httpd_client_t* client, qse_htre_t* req);
|
||||
int (*handle_expect_continue) (qse_httpd_t* httpd, qse_httpd_client_t* client, qse_htre_t* req);
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
@ -66,9 +71,13 @@ void qse_httpd_close (
|
||||
qse_httpd_t* httpd
|
||||
);
|
||||
|
||||
void qse_httpd_setcomcbs (
|
||||
qse_httpd_t* httpd,
|
||||
qse_httpd_comcbs_t* comcbs
|
||||
const qse_httpd_cbs_t* qse_httpd_getcbs (
|
||||
qse_httpd_t* httpd
|
||||
);
|
||||
|
||||
void qse_httpd_setcbs (
|
||||
qse_httpd_t* httpd,
|
||||
qse_httpd_cbs_t* cbs
|
||||
);
|
||||
|
||||
int qse_httpd_loop (
|
||||
|
Reference in New Issue
Block a user