Browse CVS Repository
Contents of /xoonips/AL/event.cc
Parent Directory
| Revision Log
| Revision Graph
Revision 1.4 -
( show annotations)
( download)
( as text)
Tue Apr 11 10:31:27 2006 UTC
(17 years, 10 months ago)
by tani
Branch: MAIN
CVS Tags: tag20061130, merge_to_20060605, tag20070307, tag20070307current, AL_PORTING, HEAD
Branch point for: XOONIPS_STABLE_3, XOONIPS_STABLE_32
Changes since 1.3: +3 -3 lines
File MIME type: text/x-c++src
merge to main trunk (from REL20060213 to merge_to_20060411)
REL20060213からmerge_to_20060411までのSTABLE_2の差分をCURRENTにマージ.
| 1 |
/* |
| 2 |
* -------------------------------------------------------------------------- |
| 3 |
* XooNiPs Xoops modules for Neuroinformatics Platforms |
| 4 |
* Copyright (C) 2005 RIKEN, Japan. All rights reserved. |
| 5 |
* http://sourceforge.jp/projects/xoonips/ |
| 6 |
* -------------------------------------------------------------------------- |
| 7 |
* This program is free software; you can redistribute it and/or |
| 8 |
* modify it under the terms of the GNU General Public License |
| 9 |
* as published by the Free Software Foundation; either version 2 |
| 10 |
* of the License, or (at your option) any later version. |
| 11 |
* |
| 12 |
* This program is distributed in the hope that it will be useful, |
| 13 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 |
* GNU General Public License for more details. |
| 16 |
* |
| 17 |
* You should have received a copy of the GNU General Public License |
| 18 |
* along with this program; if not, write to the Free Software |
| 19 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 20 |
* -------------------------------------------------------------------------- |
| 21 |
* |
| 22 |
* |
| 23 |
* 鐃緒申鐃緒申鐃緒申鐃緒申鐃緒申鐃緒申鐃緒申鐃緒申鐃緒申鐃緒申鐃緒申鐃緒申鐃緒申鐃緒申鐃緒申 |
| 24 |
* |
| 25 |
* $Revision: 1.3.4.1 $ |
| 26 |
*/ |
| 27 |
|
| 28 |
#include <time.h> |
| 29 |
#include <string.h> |
| 30 |
|
| 31 |
#include "common.h" |
| 32 |
#include "event.h" |
| 33 |
|
| 34 |
const int event::validFields[][10] = |
| 35 |
{ |
| 36 |
// timestamp, exec_uid, remote_host, index_id, file_id, uid, gid, search_keyword, additional_info |
| 37 |
{ 0,0,0,0,0,0,0,0,0,0}, //(dummy) |
| 38 |
{ 1,1,1,0,0,0,0,0,0,1}, //LOGIN_FAILURE |
| 39 |
{ 1,1,1,0,0,0,0,0,0,0}, //LOGIN_SUCCESS |
| 40 |
{ 1,1,1,0,0,0,0,0,0,0}, //LOGOUT |
| 41 |
{ 1,1,1,0,1,0,0,0,0,0}, //INSERT_ITEM |
| 42 |
{ 1,1,1,0,1,0,0,0,0,0}, //UPDATE_ITEM |
| 43 |
{ 1,1,1,0,1,0,0,0,0,0}, //DELETE_ITEM |
| 44 |
{ 1,1,1,0,1,0,0,0,0,0}, //VIEW_ITEM |
| 45 |
{ 1,1,1,0,1,1,0,0,0,0}, //DOWNLOAD_FILE |
| 46 |
{ 1,1,1,1,1,0,0,0,0,0}, //REQUEST_CERTIFY_ITEM |
| 47 |
{ 1,1,1,1,0,0,0,0,0,0}, //INSERT_INDEX |
| 48 |
{ 1,1,1,1,0,0,0,0,0,0}, //UPDATE_INDEX |
| 49 |
{ 1,1,1,1,0,0,0,0,0,0}, //DELETE_INDEX |
| 50 |
{ 1,1,1,1,1,0,0,0,0,0}, //CERTIFY_ITEM |
| 51 |
{ 1,1,1,1,1,0,0,0,0,0}, //REJECT_ITEM |
| 52 |
{ 1,0,1,0,0,0,1,0,0,0}, //REQUEST_INSERT_ACCOUNT |
| 53 |
{ 1,1,1,0,0,0,1,0,0,0}, //CERTIFY_ACCOUNT |
| 54 |
{ 1,1,1,0,0,0,0,1,0,0}, //INSERT_GROUP |
| 55 |
{ 1,1,1,0,0,0,0,1,0,0}, //UPDATE_GROUP |
| 56 |
{ 1,1,1,0,0,0,0,1,0,0}, //DELETE_GROUP |
| 57 |
{ 1,1,1,0,0,0,1,1,0,0}, //INSERT_GROUP_MEMBER |
| 58 |
{ 1,1,1,0,0,0,1,1,0,0}, //DELETE_GROUP_MEMBER |
| 59 |
{ 1,1,1,0,0,0,0,0,0,0}, //VIEW_TOP_PAGE |
| 60 |
{ 1,1,1,0,0,0,0,0,1,0}, //QUICK_SEARCH |
| 61 |
{ 1,1,1,0,0,0,0,0,1,0} //ADVANCED_SEARCH |
| 62 |
}; |
| 63 |
|
| 64 |
event::event() |
| 65 |
{ |
| 66 |
eventID = 0; |
| 67 |
eventTypeID = ETID_INVALID_ETID; |
| 68 |
timestamp = 0; |
| 69 |
execUID = 0; |
| 70 |
indexID = 0; |
| 71 |
itemID = 0; |
| 72 |
fileID = 0; |
| 73 |
uid = 0; |
| 74 |
gid = 0; |
| 75 |
remoteHost = 0; setValue( &this -> remoteHost , "" ); |
| 76 |
searchKeyword = 0; setValue( &this -> searchKeyword , "" ); |
| 77 |
additionalInfo= 0; setValue( &this -> additionalInfo, "" ); |
| 78 |
} |
| 79 |
|
| 80 |
event::~event(){ |
| 81 |
if ( remoteHost != 0 ) delete[] remoteHost ; |
| 82 |
if ( searchKeyword != 0 ) delete[] searchKeyword ; |
| 83 |
if ( additionalInfo!= 0 ) delete[] additionalInfo; |
| 84 |
|
| 85 |
} |
| 86 |
|
| 87 |
eventid_t event::getEventID () const { return eventID ; } |
| 88 |
eventtypeid_t event::getEventTypeID () const { return eventTypeID ; } |
| 89 |
time_t event::getTimestamp () const { return timestamp ; } |
| 90 |
userid_t event::getExecUID () const { return execUID ; } |
| 91 |
indexid_t event::getIndexID () const { return indexID ; } |
| 92 |
itemid_t event::getItemID () const { return itemID ; } |
| 93 |
fileid_t event::getFileID () const { return fileID ; } |
| 94 |
userid_t event::getUID () const { return uid ; } |
| 95 |
groupid_t event::getGID () const { return gid ; } |
| 96 |
const char* event::getRemoteHost () const { return remoteHost ; } |
| 97 |
const char* event::getSearchKeyword () const { return searchKeyword ; } |
| 98 |
const char* event::getAdditionalInfo() const { return additionalInfo; } |
| 99 |
|
| 100 |
void event::setEventID ( eventid_t x ) { eventID = x; } |
| 101 |
void event::setEventTypeID ( eventtypeid_t x ) { if ( ETID_INVALID_ETID < x && x <= ETID_MAX ) eventTypeID = x;} |
| 102 |
void event::setTimestamp ( time_t x ) { timestamp = x; } |
| 103 |
void event::setExecUID ( userid_t x ) { execUID = x; } |
| 104 |
void event::setIndexID ( indexid_t x ) { indexID = x; } |
| 105 |
void event::setItemID ( itemid_t x ) { itemID = x; } |
| 106 |
void event::setFileID ( fileid_t x ) { fileID = x; } |
| 107 |
void event::setUID ( userid_t x ) { uid = x; } |
| 108 |
void event::setGID ( groupid_t x ) { gid = x; } |
| 109 |
void event::setRemoteHost ( const char* x ) { setValue( &this -> remoteHost , x ); } |
| 110 |
void event::setSearchKeyword ( const char* x ) { setValue( &this -> searchKeyword , x ); } |
| 111 |
void event::setAdditionalInfo( const char* x ) { setValue( &this -> additionalInfo, x ); } |
| 112 |
|
| 113 |
bool event::isValidTimestamp () const { return (bool)validFields[eventTypeID][0]; } |
| 114 |
bool event::isValidExecUID () const { return (bool)validFields[eventTypeID][1]; } |
| 115 |
bool event::isValidIndexID () const { return (bool)validFields[eventTypeID][3]; } |
| 116 |
bool event::isValidItemID () const { return (bool)validFields[eventTypeID][4]; } |
| 117 |
bool event::isValidFileID () const { return (bool)validFields[eventTypeID][5]; } |
| 118 |
bool event::isValidUID () const { return (bool)validFields[eventTypeID][6]; } |
| 119 |
bool event::isValidGID () const { return (bool)validFields[eventTypeID][7]; } |
| 120 |
bool event::isValidRemoteHost () const { return (bool)validFields[eventTypeID][2]; } |
| 121 |
bool event::isValidSearchKeyword () const { return (bool)validFields[eventTypeID][8]; } |
| 122 |
bool event::isValidAdditionalInfo() const { return (bool)validFields[eventTypeID][9]; } |
| 123 |
|
| |