taskrambler  v0.1.8
Web server and task management solution.
session_get.c File Reference
#include <sys/types.h>
#include "class.h"
#include "session.h"
#include "hash.h"
#include "application/application.h"
#include "utils/memory.h"
+ Include dependency graph for session_get.c:

Go to the source code of this file.

Macros

#define _GNU_SOURCE
 

Functions

Session applicationSessionGet (Application this, const char *sid)
 

Detailed Description

Author
Georg Hopp

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 3 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, see http://www.gnu.org/licenses/.

Definition in file session_get.c.

Macro Definition Documentation

#define _GNU_SOURCE

Definition at line 23 of file session_get.c.

Function Documentation

Session applicationSessionGet ( Application  this,
const char *  sid 
)

now get the session if not expired

update livetime of session if found

Definition at line 36 of file session_get.c.

References hashAdd(), hashDelete(), and SESSION_LIVETIME.

Referenced by applicationAdapterHttpUpdate().

37 {
38  Session sess = NULL;
39  int index;
40 
41  if (NULL != sid) {
42  /**
43  * now get the session if not expired
44  */
45  for (index=0; index<SESSION_LIVETIME; index++) {
46  sess = (Session)hashDelete(
47  (this->active_sessions)[index], sid, 36);
48  if (NULL != sess) {
49  break;
50  }
51  }
52 
53  /**
54  * update livetime of session if found
55  */
56  if (NULL != sess) {
57  sess->livetime = this->session_time_ofs + SESSION_LIVETIME;
58  hashAdd((this->active_sessions)[0], sess);
59  }
60  }
61 
62  return sess;
63 }
void * hashDelete(Hash, const char *, size_t)
Definition: hash/delete.c:48
#define SESSION_LIVETIME
Definition: session.h:33
void * hashAdd(Hash, void *)
Definition: add.c:48

+ Here is the call graph for this function:

+ Here is the caller graph for this function: