"Fossies" - the Fresh Open Source Software Archive

Member "shellinabox-2.20/shellinabox/session.h" (9 Nov 2016, 3373 Bytes) of package /linux/privat/shellinabox-2.20.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "session.h" see the Fossies "Dox" file reference documentation and the latest Fossies "Diffs" side-by-side code changes report: 2.19_vs_2.20.

    1 // session.h -- Session management for HTTP/HTTPS connections
    2 // Copyright (C) 2008-2009 Markus Gutschke <markus@shellinabox.com>
    3 //
    4 // This program is free software; you can redistribute it and/or modify
    5 // it under the terms of the GNU General Public License version 2 as
    6 // published by the Free Software Foundation.
    7 //
    8 // This program is distributed in the hope that it will be useful,
    9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
   10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   11 // GNU General Public License for more details.
   12 //
   13 // You should have received a copy of the GNU General Public License along
   14 // with this program; if not, write to the Free Software Foundation, Inc.,
   15 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
   16 //
   17 // In addition to these license terms, the author grants the following
   18 // additional rights:
   19 //
   20 // If you modify this program, or any covered work, by linking or
   21 // combining it with the OpenSSL project's OpenSSL library (or a
   22 // modified version of that library), containing parts covered by the
   23 // terms of the OpenSSL or SSLeay licenses, the author
   24 // grants you additional permission to convey the resulting work.
   25 // Corresponding Source for a non-source form of such a combination
   26 // shall include the source code for the parts of OpenSSL used as well
   27 // as that of the covered work.
   28 //
   29 // You may at your option choose to remove this additional permission from
   30 // the work, or from any part of it.
   31 //
   32 // It is possible to build this program in a way that it loads OpenSSL
   33 // libraries at run-time. If doing so, the following notices are required
   34 // by the OpenSSL and SSLeay licenses:
   35 //
   36 // This product includes software developed by the OpenSSL Project
   37 // for use in the OpenSSL Toolkit. (http://www.openssl.org/)
   38 //
   39 // This product includes cryptographic software written by Eric Young
   40 // (eay@cryptsoft.com)
   41 //
   42 //
   43 // The most up-to-date version of this program is always available from
   44 // http://shellinabox.com
   45 
   46 #ifndef SESSION_H__
   47 #define SESSION_H__
   48 
   49 #include "libhttp/http.h"
   50 
   51 #define AJAX_TIMEOUT 45
   52 
   53 struct Session {
   54   const char       *sessionKey;
   55   Server           *server;
   56   ServerConnection *connection;
   57   const char       *peerName;
   58   HttpConnection   *http;
   59   int              done;
   60   int              pty;
   61   int              ptyFirstRead;
   62   int              width;
   63   int              height;
   64   char             *buffered;
   65   int              useLogin;
   66   int              len;
   67   pid_t            pid;
   68   int              cleanup;
   69 };
   70 
   71 void addToGraveyard(struct Session *session);
   72 void checkGraveyard(void);
   73 void initSession(struct Session *session, const char *sessionKey,
   74                  Server *server, const char *peerName);
   75 struct Session *newSession(const char *sessionKey, Server *server,
   76                            const char *peerName);
   77 void destroySession(struct Session *session);
   78 void deleteSession(struct Session *session);
   79 void abandonSession(struct Session *session);
   80 char *newSessionKey(void);
   81 void finishSession(struct Session *session);
   82 void finishAllSessions(void);
   83 struct Session *findSession(const char *sessionKey, const char *cgiSessionKey,
   84                             int *sessionIsNew, HttpConnection *http);
   85 void iterateOverSessions(int (*fnc)(void *, const char *, char **), void *arg);
   86 int  numSessions(void);
   87 
   88 #endif /* SESSION_H__ */