| 1 |
/* |
| 2 |
* |
| 3 |
* -------------------------------------------------------------------------- |
| 4 |
* XooNiPs Xoops modules for Neuroinformatics Platforms |
| 5 |
* Copyright (C) 2005 RIKEN, Japan. All rights reserved. |
| 6 |
* http://sourceforge.jp/projects/xoonips/ |
| 7 |
* -------------------------------------------------------------------------- |
| 8 |
* This program is free software; you can redistribute it and/or |
| 9 |
* modify it under the terms of the GNU General Public License |
| 10 |
* as published by the Free Software Foundation; either version 2 |
| 11 |
* of the License, or (at your option) any later version. |
| 12 |
* |
| 13 |
* This program is distributed in the hope that it will be useful, |
| 14 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 |
* GNU General Public License for more details. |
| 17 |
* |
| 18 |
* You should have received a copy of the GNU General Public License |
| 19 |
* along with this program; if not, write to the Free Software |
| 20 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 21 |
* -------------------------------------------------------------------------- |
| 22 |
* |
| 23 |
* 鐃緒申鐃緒申鐃緒申鐃緒申鐃緒申鐃緒申鐃緒申鐃緒申鐃緒申鐃緒申鐃緒申鐃緒申鐃緒申鐃緒申 |
| 24 |
* |
| 25 |
* $Revision: 1.6 $ |
| 26 |
* $Log: session.cc,v $ |
| 27 |
* Revision 1.6 2005/01/06 07:24:07 youi |
| 28 |
* getUserID鐃緒申getUID鐃緒申鐃緒申setUserID鐃緒申setUID鐃緒申鐃緒申鐃緒申鐃緒申鐃緒申. |
| 29 |
* |
| 30 |
* Revision 1.5 2004/11/30 05:46:32 aga |
| 31 |
* 鐃緒申session鐃緒申鐃緒申remoteHost鐃緒申鐃緒申鐃緒申. |
| 32 |
* |
| 33 |
* Revision 1.4 2004/11/27 02:24:45 aga |
| 34 |
* 鐃緒申sessionid鐃緒申鐃緒申鐃緒申鐃緒申鐃緒申鐃緒申鐃緒申鐃緒申鐃緒申鐃緒申鐃緒申鐃緒申. |
| 35 |
* |
| 36 |
* Revision 1.3 2004/11/26 06:24:53 aga |
| 37 |
* 鐃緒申session鐃緒申鐃緒申鐃緒申鐃緒申鐃緒申userid_t鐃緒申鐃緒申鐃緒申. |
| 38 |
* |
| 39 |
* Revision 1.2 2004/11/25 09:00:24 youi |
| 40 |
* get鐃緒申鐃緒申鐃緒申鐃緒申const鐃緒申鐃緒申. |
| 41 |
* |
| 42 |
* Revision 1.1 2004/11/24 06:54:04 youi |
| 43 |
* initial version |
| 44 |
* |
| 45 |
* |
| 46 |
*/ |
| 47 |
|
| 48 |
#include <stdlib.h> |
| 49 |
|
| 50 |
#include "session.h" |
| 51 |
|
| 52 |
session::session() |
| 53 |
{ |
| 54 |
sessionID = 0; |
| 55 |
date = 0; |
| 56 |
userID = 0; |
| 57 |
} |
| 58 |
|
| 59 |
session::session( time_t date ) |
| 60 |
{ |
| 61 |
this -> date = date; |
| 62 |
|
| 63 |
sessionid( date ); |
| 64 |
} |
| 65 |
|
| 66 |
session::~session(){} |
| 67 |
|
| 68 |
unsigned long session::getSessionID() const { return sessionID; } |
| 69 |
time_t session::getDate() const { return date; } |
| 70 |
userid_t session::getUID() const { return userID; } |
| 71 |
|
| 72 |
void session::setDate( time_t date ) |
| 73 |
{ |
| 74 |
this -> date = date; |
| 75 |
} |
| 76 |
|
| 77 |
void session::sessionid( time_t date ) |
| 78 |
{ |
| 79 |
srand( time( NULL ) ); |
| 80 |
sessionID = date ^ rand( ); |
| 81 |
} |
| 82 |
|
| 83 |
void session::setSessionID( sessionid_t id ) |
| 84 |
{ |
| 85 |
this -> sessionID = id; |
| 86 |
} |
| 87 |
|
| 88 |
void session::setUID( userid_t uid ) |
| 89 |
{ |
| 90 |
this -> userID = uid; |
| 91 |
} |
| 92 |
|