diff options
author | ilsimo <ilsimo> | 2008-09-11 20:23:15 +0000 |
---|---|---|
committer | ilsimo <ilsimo> | 2008-09-11 20:23:15 +0000 |
commit | 7c7929861246310d48789748cc150c9a4a492e09 (patch) | |
tree | 6b71e5c47fdc95451df2c7d23437ca4adfd227f6 /sesman/libscp | |
parent | 1e33ad14c3c2e82b9ba74a5f8d1210b5ae643054 (diff) | |
download | xrdp-proprietary-7c7929861246310d48789748cc150c9a4a492e09.tar.gz xrdp-proprietary-7c7929861246310d48789748cc150c9a4a492e09.zip |
added first management code
added a rough management tool
fixes in session.c
Diffstat (limited to 'sesman/libscp')
-rw-r--r-- | sesman/libscp/Makefile | 2 | ||||
-rw-r--r-- | sesman/libscp/Makefile.am | 2 | ||||
-rw-r--r-- | sesman/libscp/libscp.h | 6 | ||||
-rw-r--r-- | sesman/libscp/libscp_commands.h | 36 | ||||
-rw-r--r-- | sesman/libscp/libscp_commands_mng.h | 39 | ||||
-rw-r--r-- | sesman/libscp/libscp_session.c | 21 | ||||
-rw-r--r-- | sesman/libscp/libscp_types.h | 7 | ||||
-rw-r--r-- | sesman/libscp/libscp_types_mng.h | 48 | ||||
-rw-r--r-- | sesman/libscp/libscp_v1s.c | 21 | ||||
-rw-r--r-- | sesman/libscp/libscp_v1s_mng.c | 340 | ||||
-rw-r--r-- | sesman/libscp/libscp_v1s_mng.h | 79 |
11 files changed, 590 insertions, 11 deletions
diff --git a/sesman/libscp/Makefile b/sesman/libscp/Makefile index 03779f92..62702afc 100644 --- a/sesman/libscp/Makefile +++ b/sesman/libscp/Makefile @@ -4,7 +4,7 @@ LIBSCPOBJ = libscp_vX.o libscp_v0.o \ libscp_init.o libscp_lock.o libscp_tcp.o \ libscp_session.o libscp_connection.o \ os_calls.o \ -# libscp_v1s_mng.o libscp_v1c_mng.o + libscp_v1s_mng.o libscp_v1c_mng.o CFGDIR = /etc/xrdp PIDDIR = /var/run diff --git a/sesman/libscp/Makefile.am b/sesman/libscp/Makefile.am index 5450f41a..f0b87a7b 100644 --- a/sesman/libscp/Makefile.am +++ b/sesman/libscp/Makefile.am @@ -13,6 +13,8 @@ libscp_la_SOURCES = \ libscp_v0.c \ libscp_v1c.c \ libscp_v1s.c \ + libscp_v1c_mng.c \ + libscp_v1s_mng.c \ libscp_vX.c libscp_la_LIBADD = \ diff --git a/sesman/libscp/libscp.h b/sesman/libscp/libscp.h index b8f9dea9..c0dbf944 100644 --- a/sesman/libscp/libscp.h +++ b/sesman/libscp/libscp.h @@ -22,7 +22,7 @@ * @file libscp.h * @brief libscp main header * @author Simone Fedele - * + * */ #ifndef LIBSCP_H @@ -33,6 +33,7 @@ #endif #include "libscp_types.h" +#include "libscp_commands.h" #include "libscp_connection.h" #include "libscp_session.h" @@ -44,6 +45,7 @@ #include "libscp_v0.h" #include "libscp_v1s.h" #include "libscp_v1c.h" -#include "file_loc.h" +#include "libscp_v1s_mng.h" +#include "libscp_v1c_mng.h" #endif diff --git a/sesman/libscp/libscp_commands.h b/sesman/libscp/libscp_commands.h new file mode 100644 index 00000000..96488f76 --- /dev/null +++ b/sesman/libscp/libscp_commands.h @@ -0,0 +1,36 @@ +/* + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + + xrdp: A Remote Desktop Protocol server. + Copyright (C) Jay Sorg 2005-2008 +*/ + +/** + * + * @file libscp_commands.h + * @brief libscp data types definitions + * @author Simone Fedele + * + */ + +#ifndef LIBSCP_COMMANDS_H +#define LIBSCP_COMMANDS_H + +#include "libscp_commands_mng.h" + +#define SCP_CMD_LOGIN 0x0001 +#define SCP_CMD_CONN_ERROR 0xFFFF + +#endif diff --git a/sesman/libscp/libscp_commands_mng.h b/sesman/libscp/libscp_commands_mng.h new file mode 100644 index 00000000..e9f2a2a6 --- /dev/null +++ b/sesman/libscp/libscp_commands_mng.h @@ -0,0 +1,39 @@ +/* + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + + xrdp: A Remote Desktop Protocol server. + Copyright (C) Jay Sorg 2005-2008 +*/ + +/** + * + * @file libscp_commands_mng.h + * @brief libscp data types definitions + * @author Simone Fedele + * + */ + +#ifndef LIBSCP_COMMANDS_MNG_H +#define LIBSCP_COMMANDS_MNG_H + +#define SCP_CMD_MNG_LOGIN 0x0001 +#define SCP_CMD_MNG_LOGIN_ALLOW 0x0002 +#define SCP_CMD_MNG_LOGIN_DENY 0x0003 +#define SCP_CMD_MNG_CMD_ERROR 0x0004 +#define SCP_CMD_MNG_LIST_REQ 0x0005 +#define SCP_CMD_MNG_LIST 0x0006 +#define SCP_CMD_MNG_ACTION 0x0007 + +#endif diff --git a/sesman/libscp/libscp_session.c b/sesman/libscp/libscp_session.c index 6f86e208..13d0b13a 100644 --- a/sesman/libscp/libscp_session.c +++ b/sesman/libscp/libscp_session.c @@ -50,6 +50,7 @@ scp_session_create() s->password = 0; s->hostname = 0; s->errstr = 0; + s->mng = 0; s->locale[0]='\0'; return s; @@ -69,6 +70,12 @@ scp_session_set_type(struct SCP_SESSION* s, tui8 type) break; case SCP_SESSION_TYPE_MANAGE: s->type = SCP_SESSION_TYPE_MANAGE; + s->mng = g_malloc(sizeof(struct SCP_MNG_DATA),1); + if (NULL == s->mng) + { + log_message(s_log, LOG_LEVEL_ERROR, "[session:%d] set_type: internal error", __LINE__); + return 1; + } break; default: log_message(s_log, LOG_LEVEL_WARNING, "[session:%d] set_type: unknown type", __LINE__); @@ -311,25 +318,31 @@ scp_session_destroy(struct SCP_SESSION* s) if (s->username) { g_free(s->username); - s->username=0; + s->username = 0; } if (s->password) { g_free(s->password); - s->password=0; + s->password = 0; } if (s->hostname) { g_free(s->hostname); - s->hostname=0; + s->hostname = 0; } if (s->errstr) { g_free(s->errstr); - s->errstr=0; + s->errstr = 0; + } + + if (s->mng) + { + g_free(s->mng); + s->mng = 0; } g_free(s); diff --git a/sesman/libscp/libscp_types.h b/sesman/libscp/libscp_types.h index b8b5d6bd..e4cbd0ff 100644 --- a/sesman/libscp/libscp_types.h +++ b/sesman/libscp/libscp_types.h @@ -56,7 +56,7 @@ #define SCP_SERVER_MAX_LIST_SIZE 100 -#define free_session(s) {g_free((s)->username); g_free((s)->password); g_free((s)->hostname); g_free(s);} +#include "libscp_types_mng.h" struct SCP_CONNECTION { @@ -80,8 +80,9 @@ struct SCP_SESSION tui8 addr_type; tui32 ipv4addr; tui8 ipv6addr[16]; - tui16 display; + SCP_DISPLAY display; char* errstr; + struct SCP_MNG_DATA* mng; }; struct SCP_DISCONNECTED_SESSION @@ -135,6 +136,8 @@ enum SCP_SERVER_STATES_E SCP_SERVER_STATE_SELECTION_CANCEL, /*SCP_SERVER_STATE_FORCE_NEW,*/ SCP_SERVER_STATE_START_MANAGE, + SCP_SERVER_STATE_MNG_LISTREQ, + SCP_SERVER_STATE_MNG_ACTION, SCP_SERVER_STATE_END }; diff --git a/sesman/libscp/libscp_types_mng.h b/sesman/libscp/libscp_types_mng.h new file mode 100644 index 00000000..04bda283 --- /dev/null +++ b/sesman/libscp/libscp_types_mng.h @@ -0,0 +1,48 @@ +/* + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + + xrdp: A Remote Desktop Protocol server. + Copyright (C) Jay Sorg 2005-2008 +*/ + +/** + * + * @file libscp_types_mng.h + * @brief libscp data types definitions + * @author Simone Fedele + * + */ + +#ifndef LIBSCP_TYPES_MNG_H +#define LIBSCP_TYPES_MNG_H + +#include "os_calls.h" +#include "parse.h" +#include "arch.h" +#include "log.h" + +enum SCP_MNG_COMMAND +{ + SCP_MNG_CMD_KILL, + SCP_MNG_CMD_DISCONNECT +}; + +struct SCP_MNG_DATA +{ + enum SCP_MNG_COMMAND cmd; + SCP_SID sid; +}; + +#endif diff --git a/sesman/libscp/libscp_v1s.c b/sesman/libscp/libscp_v1s.c index 74ce187d..93c42fa8 100644 --- a/sesman/libscp/libscp_v1s.c +++ b/sesman/libscp/libscp_v1s.c @@ -87,7 +87,8 @@ enum SCP_SERVER_STATES_E scp_v1s_accept(struct SCP_CONNECTION* c, struct SCP_SES if (cmdset == SCP_COMMAND_SET_MANAGE) { log_message(s_log, LOG_LEVEL_DEBUG, "[v1s:%d] requested management connection", __LINE__); - return SCP_SERVER_STATE_START_MANAGE; + /* should return SCP_SERVER_STATE_START_MANAGE */ + return scp_v1s_mng_accept(c, s); } /* if we started with resource sharing... */ @@ -372,7 +373,23 @@ scp_v1s_connect_new_session(struct SCP_CONNECTION* c, SCP_DISPLAY d) enum SCP_SERVER_STATES_E scp_v1s_connection_error(struct SCP_CONNECTION* c, char* error) { - return SCP_SERVER_STATE_INTERNAL_ERR; + tui16 len; + + len = g_strlen(error); + init_stream(c->out_s,c->out_s->size); + + out_uint32_be(c->out_s, 1); + /* packet size: 4 + 4 + 2 + 2 + len */ + /* version + size + cmdset + cmd */ + out_uint32_be(c->out_s, (12 + len)); + out_uint16_be(c->out_s, SCP_COMMAND_SET_DEFAULT); + out_uint16_be(c->out_s, SCP_CMD_CONN_ERROR); + + if (0 != scp_tcp_force_send(c->in_sck, c->out_s->data, (12 + len))) + { + return SCP_SERVER_STATE_NETWORK_ERR; + } + return SCP_SERVER_STATE_END; } diff --git a/sesman/libscp/libscp_v1s_mng.c b/sesman/libscp/libscp_v1s_mng.c new file mode 100644 index 00000000..4acb6570 --- /dev/null +++ b/sesman/libscp/libscp_v1s_mng.c @@ -0,0 +1,340 @@ +/* + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + + xrdp: A Remote Desktop Protocol server. + Copyright (C) Jay Sorg 2005-2008 +*/ + +/** + * + * @file libscp_v1s_mng.c + * @brief libscp version 1 server api code - session management + * @author Simone Fedele + * + */ + +#ifndef LIBSCP_V1S_MNG_C +#define LIBSCP_V1S_MNG_C + +#include "libscp_v1s_mng.h" + +extern struct log_config* s_log; + +static enum SCP_SERVER_STATES_E +_scp_v1s_mng_check_response(struct SCP_CONNECTION* c, struct SCP_SESSION* s); + +/* server API */ +enum SCP_SERVER_STATES_E scp_v1s_mng_accept(struct SCP_CONNECTION* c, struct SCP_SESSION** s) +{ + struct SCP_SESSION* session; + tui32 ipaddr; + tui16 cmd; + tui8 sz; + char buf[257]; + + /* reading command */ + in_uint16_be(c->in_s, cmd); + if (cmd != 1) /* manager login */ + { + return SCP_SERVER_STATE_SEQUENCE_ERR; + } + + session = scp_session_create(); + if (0 == session) + { + return SCP_SERVER_STATE_INTERNAL_ERR; + } + + scp_session_set_version(session, 1); + scp_session_set_type(session, SCP_SESSION_TYPE_MANAGE); + + /* reading username */ + in_uint8(c->in_s, sz); + buf[sz]='\0'; + in_uint8a(c->in_s, buf, sz); + if (0 != scp_session_set_username(session, buf)) + { + scp_session_destroy(session); + return SCP_SERVER_STATE_INTERNAL_ERR; + } + + /* reading password */ + in_uint8(c->in_s, sz); + buf[sz]='\0'; + in_uint8a(c->in_s, buf, sz); + if (0 != scp_session_set_password(session, buf)) + { + scp_session_destroy(session); + return SCP_SERVER_STATE_INTERNAL_ERR; + } + + /* reading remote address */ + in_uint8(c->in_s, sz); + if (sz == SCP_ADDRESS_TYPE_IPV4) + { + in_uint32_be(c->in_s, ipaddr); + scp_session_set_addr(session, SCP_ADDRESS_TYPE_IPV4_BIN, &ipaddr); + } + else if (sz == SCP_ADDRESS_TYPE_IPV6) + { + in_uint8a(c->in_s, buf, 16); + scp_session_set_addr(session, SCP_ADDRESS_TYPE_IPV6_BIN, buf); + } + + /* reading hostname */ + in_uint8(c->in_s, sz); + buf[sz]='\0'; + in_uint8a(c->in_s, buf, sz); + if (0 != scp_session_set_hostname(session, buf)) + { + scp_session_destroy(session); + return SCP_SERVER_STATE_INTERNAL_ERR; + } + + /* returning the struct */ + (*s)=session; + + return SCP_SERVER_STATE_START_MANAGE; +} + +/* 002 */ +enum SCP_SERVER_STATES_E +scp_v1s_mng_allow_connection(struct SCP_CONNECTION* c, struct SCP_SESSION* s) +{ + init_stream(c->out_s,c->out_s->size); + + out_uint32_be(c->out_s, 1); + /* packet size: 4 + 4 + 2 + 2 */ + /* version + size + cmdset + cmd */ + out_uint32_be(c->out_s, 12); + out_uint16_be(c->out_s, SCP_COMMAND_SET_MANAGE); + out_uint16_be(c->out_s, SCP_CMD_MNG_LOGIN_ALLOW); + + if (0 != scp_tcp_force_send(c->in_sck, c->out_s->data, 12)) + { + return SCP_SERVER_STATE_NETWORK_ERR; + } + + return _scp_v1s_mng_check_response(c, s); +} + +/* 003 */ +enum SCP_SERVER_STATES_E +scp_v1s_mng_deny_connection(struct SCP_CONNECTION* c, char* reason) +{ + int rlen; + + init_stream(c->out_s,c->out_s->size); + + /* forcing message not to exceed 64k */ + rlen = g_strlen(reason); + if (rlen > 65535) + { + rlen = 65535; + } + + out_uint32_be(c->out_s, 1); + /* packet size: 4 + 4 + 2 + 2 + 2 + strlen(reason)*/ + /* version + size + cmdset + cmd + msglen + msg */ + out_uint32_be(c->out_s, rlen+14); + out_uint16_be(c->out_s, SCP_COMMAND_SET_MANAGE); + out_uint16_be(c->out_s, SCP_CMD_MNG_LOGIN_DENY); + out_uint16_be(c->out_s, rlen) + out_uint8p(c->out_s, reason, rlen); + + if (0!=scp_tcp_force_send(c->in_sck, c->out_s->data, rlen+14)) + { + return SCP_SERVER_STATE_NETWORK_ERR; + } + + return SCP_SERVER_STATE_END; +} + +/* 006 */ +enum SCP_SERVER_STATES_E +scp_v1s_mng_list_sessions(struct SCP_CONNECTION* c, struct SCP_SESSION* s, + int sescnt, struct SCP_DISCONNECTED_SESSION* ds) +{ + tui32 version = 1; + tui32 size = 12; + tui16 cmd = SCP_CMD_MNG_LIST; + int pktcnt; + int idx; + int sidx; + int pidx; + struct SCP_DISCONNECTED_SESSION* cds; + + /* calculating the number of packets to send */ + pktcnt=sescnt/SCP_SERVER_MAX_LIST_SIZE; + if ((sescnt%SCP_SERVER_MAX_LIST_SIZE)!=0) + { + pktcnt++; + } + + for (idx=0; idx<pktcnt; idx++) + { + /* ok, we send session session list */ + init_stream(c->out_s, c->out_s->size); + + /* size: ver+size+cmdset+cmd+sescnt+continue+count */ + size=4+4+2+2+4+1+1; + + /* header */ + s_push_layer(c->out_s, channel_hdr, 8); + out_uint16_be(c->out_s, SCP_COMMAND_SET_MANAGE); + out_uint16_be(c->out_s, cmd); + + /* session count */ + out_uint32_be(c->out_s, sescnt); + + /* setting the continue flag */ + if ((idx+1)*SCP_SERVER_MAX_LIST_SIZE >= sescnt) + { + out_uint8(c->out_s, 0); + /* setting session count for this packet */ + pidx=sescnt-(idx*SCP_SERVER_MAX_LIST_SIZE); + out_uint8(c->out_s, pidx); + } + else + { + out_uint8(c->out_s, 1); + /* setting session count for this packet */ + pidx=SCP_SERVER_MAX_LIST_SIZE; + out_uint8(c->out_s, pidx); + } + + /* adding session descriptors */ + for (sidx=0; sidx<pidx; sidx++) + { + /* shortcut to the current session to send */ + cds=ds+((idx)*SCP_SERVER_MAX_LIST_SIZE)+sidx; + + /* session data */ + out_uint32_be(c->out_s, cds->SID); /* session id */ + out_uint8(c->out_s, cds->type); + out_uint16_be(c->out_s, cds->height); + out_uint16_be(c->out_s, cds->width); + out_uint8(c->out_s, cds->bpp); + out_uint8(c->out_s, cds->idle_days); + out_uint8(c->out_s, cds->idle_hours); + out_uint8(c->out_s, cds->idle_minutes); + size += 13; + + out_uint16_be(c->out_s, cds->conn_year); + out_uint8(c->out_s, cds->conn_month); + out_uint8(c->out_s, cds->conn_day); + out_uint8(c->out_s, cds->conn_hour); + out_uint8(c->out_s, cds->conn_minute); + out_uint8(c->out_s, cds->addr_type); + size += 7; + + if (cds->addr_type == SCP_ADDRESS_TYPE_IPV4) + { + in_uint32_be(c->out_s, cds->ipv4addr); + size += 4; + } + else if (cds->addr_type == SCP_ADDRESS_TYPE_IPV6) + { + in_uint8a(c->out_s, cds->ipv6addr, 16); + size += 16; + } + } + + s_pop_layer(c->out_s, channel_hdr); + out_uint32_be(c->out_s, version); + out_uint32_be(c->out_s, size); + + if (0!=scp_tcp_force_send(c->in_sck, c->out_s->data, size)) + { + log_message(s_log, LOG_LEVEL_WARNING, "[v1s_mng:%d] connection aborted: network error", __LINE__); + return SCP_SERVER_STATE_NETWORK_ERR; + } + } + + return _scp_v1s_mng_check_response(c, s); +} + +static enum SCP_SERVER_STATES_E +_scp_v1s_mng_check_response(struct SCP_CONNECTION* c, struct SCP_SESSION* s) +{ + tui32 version; + tui32 size; + tui16 cmd; +// tui8 dim; +// char buf[257]; + + init_stream(c->in_s, c->in_s->size); + if (0 != scp_tcp_force_recv(c->in_sck, c->in_s->data, 8)) + { + log_message(s_log, LOG_LEVEL_WARNING, "[v1s_mng:%d] connection aborted: network error", __LINE__); + return SCP_SERVER_STATE_NETWORK_ERR; + } + + in_uint32_be(c->in_s, version); + if (version != 1) + { + log_message(s_log, LOG_LEVEL_WARNING, "[v1s_mng:%d] connection aborted: version error", __LINE__); + return SCP_SERVER_STATE_VERSION_ERR; + } + + in_uint32_be(c->in_s, size); + + init_stream(c->in_s, c->in_s->size); + /* read the rest of the packet */ + if (0 != scp_tcp_force_recv(c->in_sck, c->in_s->data, size - 8)) + { + log_message(s_log, LOG_LEVEL_WARNING, "[v1s_mng:%d] connection aborted: network error", __LINE__); + return SCP_SERVER_STATE_NETWORK_ERR; + } + + in_uint16_be(c->in_s, cmd); + if (cmd != SCP_COMMAND_SET_MANAGE) + { + log_message(s_log, LOG_LEVEL_WARNING, "[v1s_mng:%d] connection aborted: sequence error", __LINE__); + return SCP_SERVER_STATE_SEQUENCE_ERR; + } + + in_uint16_be(c->in_s, cmd) + if (cmd == SCP_CMD_MNG_LIST_REQ) /* request session list */ + { + log_message(s_log, LOG_LEVEL_INFO, "[v1s_mng:%d] request session list", __LINE__); + return SCP_SERVER_STATE_MNG_LISTREQ; + } + else if (cmd == SCP_CMD_MNG_ACTION) /* execute an action */ + { + /*in_uint8(c->in_s, dim); + buf[dim]='\0'; + in_uint8a(c->in_s, buf, dim); + scp_session_set_errstr(s, buf);*/ + + log_message(s_log, LOG_LEVEL_INFO, "[v1s_mng:%d] action request", __LINE__); + return SCP_SERVER_STATE_MNG_ACTION; + } + /* else if (cmd == 20) / * password change * / + { + in_uint16_be(c->in_s, s->display); + + return SCP_SERVER_STATE_OK; + } + else if (cmd == 40) / * session list * / + { + return SCP_SERVER_STATE_SESSION_LIST; + }*/ + + log_message(s_log, LOG_LEVEL_WARNING, "[v1s_mng:%d] connection aborted: sequence error", __LINE__); + return SCP_SERVER_STATE_SEQUENCE_ERR; +} + +#endif diff --git a/sesman/libscp/libscp_v1s_mng.h b/sesman/libscp/libscp_v1s_mng.h new file mode 100644 index 00000000..59145771 --- /dev/null +++ b/sesman/libscp/libscp_v1s_mng.h @@ -0,0 +1,79 @@ +/* + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + + xrdp: A Remote Desktop Protocol server. + Copyright (C) Jay Sorg 2005-2008 +*/ + +/** + * + * @file libscp_v1s_mng.h + * @brief libscp version 1 server api declarations - session management + * @author Simone Fedele + * + */ + +#ifndef LIBSCP_V1S_MNG_H +#define LIBSCP_V1S_MNG_H + +#include "libscp.h" + +/* server API */ +/** + * + * @brief processes the stream using scp version 1 + * @param c connection descriptor + * @param s pointer to session descriptor pointer + * + * this function places in *s the address of a newely allocated SCP_SESSION structure + * that should be free()d + */ +enum SCP_SERVER_STATES_E +scp_v1s_mng_accept(struct SCP_CONNECTION* c, struct SCP_SESSION** s); + +/** + * + * @brief allows connection to sesman + * @param c connection descriptor + * + */ +/* 002 */ +enum SCP_SERVER_STATES_E +scp_v1s_mng_allow_connection(struct SCP_CONNECTION* c, struct SCP_SESSION* s); + +/** + * + * @brief denies connection to sesman + * @param c connection descriptor + * @param reason pointer to a string containinge the reason for denying connection + * + */ +/* 003 */ +enum SCP_SERVER_STATES_E +scp_v1s_mng_deny_connection(struct SCP_CONNECTION* c, char* reason); + +/** + * + * @brief sends session list + * @param c connection descriptor + * + */ +/* 006 */ +enum SCP_SERVER_STATES_E +scp_v1s_mng_list_sessions(struct SCP_CONNECTION* c, struct SCP_SESSION* s, + int sescnt, struct SCP_DISCONNECTED_SESSION* ds); +// SCP_SID* sid); + +#endif |