2012-06-14 08:28:16 +00:00
|
|
|
/*
|
|
|
|
* $Id$
|
|
|
|
*
|
2019-06-06 05:28:23 +00:00
|
|
|
Copyright (c) 2006-2019 Chung, Hyung-Hwan. All rights reserved.
|
2014-11-19 14:42:24 +00:00
|
|
|
|
|
|
|
Redistribution and use in source and binary forms, with or without
|
|
|
|
modification, are permitted provided that the following conditions
|
|
|
|
are met:
|
|
|
|
1. Redistributions of source code must retain the above copyright
|
|
|
|
notice, this list of conditions and the following disclaimer.
|
|
|
|
2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
notice, this list of conditions and the following disclaimer in the
|
|
|
|
documentation and/or other materials provided with the distribution.
|
|
|
|
|
|
|
|
THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR
|
|
|
|
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
|
|
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
|
|
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
|
|
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
|
|
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
|
|
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
2012-06-14 08:28:16 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#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>
|
2016-04-29 03:55:42 +00:00
|
|
|
#include "../cmn/mem-prv.h"
|
2012-06-20 15:12:18 +00:00
|
|
|
|
|
|
|
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
|
|
|
};
|
|
|
|
|
2014-11-14 02:44:20 +00:00
|
|
|
#if defined(__cplusplus)
|
2012-06-20 15:12:18 +00:00
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
int qse_upxd_init (qse_upxd_t* upxd, qse_mmgr_t* mmgr);
|
|
|
|
void qse_upxd_fini (qse_upxd_t* upxd);
|
|
|
|
|
2014-11-14 02:44:20 +00:00
|
|
|
#if defined(__cplusplus)
|
2012-06-20 15:12:18 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2012-06-14 08:28:16 +00:00
|
|
|
#endif
|