2012-06-14 08:28:16 +00:00
|
|
|
/*
|
|
|
|
* $Id$
|
|
|
|
*
|
2013-12-31 10:24:12 +00:00
|
|
|
Copyright 2006-2014 Chung, Hyung-Hwan.
|
2012-06-14 08:28:16 +00:00
|
|
|
This file is part of QSE.
|
|
|
|
|
|
|
|
QSE is free software: you can redistribute it and/or modify
|
2012-06-20 15:12:18 +00:00
|
|
|
it under the terms of the GNU Lesser General Public License as
|
|
|
|
published by the Free Software Foundation, either version 3 of
|
2012-06-14 08:28:16 +00:00
|
|
|
the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
QSE is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU Lesser General Public License for more details.
|
|
|
|
|
2012-06-20 15:12:18 +00:00
|
|
|
You should have received a copy of the GNU Lesser General Public
|
2012-06-14 08:28:16 +00:00
|
|
|
License along with QSE. If not, see <htrd://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _QSE_LIB_NET_UPXD_H_
|
|
|
|
#define _QSE_LIB_NET_UPXD_H_
|
|
|
|
|
2013-02-18 13:45:50 +00:00
|
|
|
#include <qse/http/upxd.h>
|
2012-06-20 15:12:18 +00:00
|
|
|
#include "../cmn/mem.h"
|
|
|
|
|
|
|
|
typedef struct qse_upxd_server_session_t qse_upxd_server_session_t;
|
|
|
|
|
|
|
|
struct qse_upxd_server_t
|
|
|
|
{
|
|
|
|
qse_upxd_server_t* next;
|
2012-07-02 14:21:40 +00:00
|
|
|
qse_upxd_server_t* prev;
|
2012-06-20 15:12:18 +00:00
|
|
|
|
2012-07-02 14:21:40 +00:00
|
|
|
#define QSE_UPXD_SERVER_ENABLED (1 << 0)
|
2012-06-20 15:12:18 +00:00
|
|
|
int flags;
|
|
|
|
|
|
|
|
/* the socket can be bound to this interface.
|
|
|
|
* sock->dev points to this buffer when necessary. */
|
|
|
|
qse_char_t dev[QSE_UPXD_SESSION_DEV_LEN + 1];
|
|
|
|
|
|
|
|
/* list of sessions beloning to this server */
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
qse_upxd_server_session_t* list;
|
|
|
|
qse_size_t count;
|
|
|
|
} session;
|
|
|
|
|
|
|
|
qse_upxd_sock_t local;
|
|
|
|
|
|
|
|
/* user-defined context data that can be set
|
|
|
|
* with qse_upxd_setserverctx() */
|
|
|
|
void* ctx;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct qse_upxd_server_session_t
|
|
|
|
{
|
|
|
|
/* internal fields */
|
|
|
|
qse_upxd_server_session_t* next;
|
|
|
|
qse_upxd_server_session_t* prev;
|
|
|
|
|
|
|
|
/* timestamps for housekeeping */
|
|
|
|
qse_ntime_t created;
|
|
|
|
qse_ntime_t modified;
|
|
|
|
|
|
|
|
/* socket used to talk with a peer */
|
|
|
|
qse_upxd_sock_t peer;
|
|
|
|
|
|
|
|
/* exposed to a caller via callbacks */
|
|
|
|
qse_upxd_session_t inner;
|
|
|
|
};
|
2012-06-14 08:28:16 +00:00
|
|
|
|
|
|
|
struct qse_upxd_t
|
|
|
|
{
|
2012-11-01 15:03:02 +00:00
|
|
|
qse_mmgr_t* mmgr;
|
2012-06-20 15:12:18 +00:00
|
|
|
qse_upxd_errnum_t errnum;
|
|
|
|
|
2012-06-14 08:28:16 +00:00
|
|
|
int stopreq;
|
2012-06-20 15:12:18 +00:00
|
|
|
qse_upxd_cbs_t* cbs;
|
2012-06-14 08:28:16 +00:00
|
|
|
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
qse_upxd_server_t* list;
|
2012-06-20 15:12:18 +00:00
|
|
|
qse_size_t nactive;
|
2012-06-14 08:28:16 +00:00
|
|
|
} server;
|
2012-06-20 15:12:18 +00:00
|
|
|
|
|
|
|
void* mux;
|
|
|
|
qse_uint8_t rbuf[65535];
|
2012-06-14 08:28:16 +00:00
|
|
|
};
|
|
|
|
|
2012-06-20 15:12:18 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
int qse_upxd_init (qse_upxd_t* upxd, qse_mmgr_t* mmgr);
|
|
|
|
void qse_upxd_fini (qse_upxd_t* upxd);
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2012-06-14 08:28:16 +00:00
|
|
|
#endif
|