taskrambler  0.1.9
Web server and task management solution.
session.c File Reference
#include <time.h>
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <sys/types.h>
#include <uuid/uuid.h>
#include "session.h"
#include "hash.h"
#include "class.h"
#include "utils/hash.h"
#include "utils/memory.h"
+ Include dependency graph for session.c:

Go to the source code of this file.

Functions

static int sessionCtor (void *_this, va_list *params)
 
static void sessionDtor (void *_this)
 
static unsigned long sessionGetHash (void *_this)
 
static void sessionHandleDouble (void *_this, void *_doub)
 
 INIT_IFACE (Class, sessionCtor, sessionDtor, NULL)
 
 INIT_IFACE (Hashable, sessionGetHash, sessionHandleDouble)
 
 CREATE_CLASS (Session, NULL, IFACE(Class), IFACE(Hashable))
 

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.c.

Function Documentation

CREATE_CLASS ( Session  ,
NULL  ,
IFACE(Class)  ,
IFACE(Hashable)   
)
INIT_IFACE ( Class  ,
sessionCtor  ,
sessionDtor  ,
NULL   
)
INIT_IFACE ( Hashable  ,
sessionGetHash  ,
sessionHandleDouble   
)
static int sessionCtor ( void *  _this,
va_list *  params 
)
static

Definition at line 41 of file session.c.

References sdbm(), and SESSION_LIVETIME.

42 {
43  Session this = _this;
44  uuid_t uuid;
45 
46  this->livetime = time(NULL) + SESSION_LIVETIME;
47  uuid_generate(uuid);
48  uuid_unparse(uuid, this->id);
49 
50  this->hash = sdbm((unsigned char *)this->id, 36);
51 
52  return 0;
53 }
unsigned long sdbm(const unsigned char *, size_t)
Definition: utils/hash.c:45
#define SESSION_LIVETIME
Definition: session.h:33

+ Here is the call graph for this function:

static void sessionDtor ( void *  _this)
static

Definition at line 57 of file session.c.

58 {
59  Session this = _this;
60 
61  delete(this->user);
62 }
static unsigned long sessionGetHash ( void *  _this)
static

Definition at line 66 of file session.c.

67 {
68  Session this = _this;
69 
70  return this->hash;
71 }
static void sessionHandleDouble ( void *  _this,
void *  _doub 
)
static

Definition at line 75 of file session.c.

76 {
77 }