taskrambler  0.1.9
Web server and task management solution.
application.c File Reference
#include <stdarg.h>
#include "class.h"
#include "hash.h"
#include "uuid.h"
#include "application/application.h"
#include "storage/storage.h"
#include "utils/memory.h"
#include "config.h"
+ Include dependency graph for application.c:

Go to the source code of this file.

Macros

#define _GNU_SOURCE
 

Functions

static int applicationCtor (void *_this, va_list *params)
 
static void applicationDtor (void *_this)
 
 INIT_IFACE (Class, applicationCtor, applicationDtor, NULL)
 
 CREATE_CLASS (Application, NULL, IFACE(Class))
 

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

Macro Definition Documentation

#define _GNU_SOURCE

Definition at line 23 of file application.c.

Function Documentation

static int applicationCtor ( void *  _this,
va_list *  params 
)
static
Todo:
for both of these...each user should be identified by a number...that way I could use that number in the passwords db and no direct association between email and password could be made when someone get the hands on the password database.

Definition at line 38 of file application.c.

References memCalloc(), SESSION_LIVETIME, and uuidParse().

39 {
40  Application this = _this;
41  size_t i;
42 
43  this->val = va_arg(*params, struct randval *);
44 
45  /**
46  * \todo for both of these...each user should be identified
47  * by a number...that way I could use that number in the
48  * passwords db and no direct association between email and
49  * password could be made when someone get the hands on the
50  * password database.
51  */
52  this->users = va_arg(*params, Storage);
53  this->passwords = va_arg(*params, Storage);
54  //this->roles = va_arg(*params, Storage);
55 
56  this->user_namespace = uuidParse(va_arg(*params, char *));
57 
58  this->auth = va_arg(*params, void *);
59 
60  this->active_sessions = memCalloc(SESSION_LIVETIME, sizeof(Hash));
61  for (i=0; i<SESSION_LIVETIME; i++) {
62  this->active_sessions[i] = new(Hash);
63  }
64 
65  this->version = VERSION;
66  this->loc = LOC;
67 
68  return 0;
69 }
Uuid uuidParse(const UuidString)
Definition: uuid/parse.c:30
void * memCalloc(size_t, size_t)
Definition: memory.c:818
#define SESSION_LIVETIME
Definition: session.h:33

+ Here is the call graph for this function:

static void applicationDtor ( void *  _this)
static

Definition at line 73 of file application.c.

References MEM_FREE, and SESSION_LIVETIME.

74 {
75  Application this = _this;
76  size_t i;
77 
78  delete(this->user_namespace);
79 
80  for (i=0; i<SESSION_LIVETIME; i++) {
81  delete(this->active_sessions[i]);
82  }
83 
84  MEM_FREE(this->active_sessions);
85  MEM_FREE(this->auth);
86 }
#define MEM_FREE(seg)
Definition: memory.h:28
#define SESSION_LIVETIME
Definition: session.h:33
CREATE_CLASS ( Application  ,
NULL  ,
IFACE(Class)   
)
INIT_IFACE ( Class  ,
applicationCtor  ,
applicationDtor  ,
NULL   
)