00001
00010 #ifndef STRUCTURES_H_
00011 #define STRUCTURES_H_
00012
00013 #include "defines.h"
00014 #include <stdlib.h>
00015 #include <string.h>
00016 #include <time.h>
00017 #include <sys/types.h>
00018 #include <unistd.h>
00019 #include <stdio.h>
00020 #include <pthread.h>
00021 #include "hashtables.h"
00022 #include "debug.h"
00023
00024 typedef struct
00025 {
00026 char *login;
00027 char *password;
00028 }t_conta;
00029
00030 typedef struct
00031 {
00032 char *ip;
00033 HASHTABLE_T *logins;
00034 LISTA_GENERICA_T *pastas;
00035 }t_maquina;
00036
00037 typedef struct
00038 {
00039 char sessionid[MAX_SESSINON_ID];
00040 char *login;
00041 time_t working_time;
00042 }t_session;
00043
00044 typedef struct
00045 {
00046 HASHTABLE_T *sessions;
00047 int session_len;
00048 pthread_mutex_t *mutex;
00049 pthread_cond_t *cond;
00050 }t_args_monitor;
00051
00052 typedef struct
00053 {
00054 HASHTABLE_T *hash_sessions, *hash_contas, *hash_maquinas;
00055 int session_len;
00056 pthread_mutex_t *mutex;
00057 }t_args_processor;
00058
00059
00060
00061
00062 void free_conta(t_conta *conta);
00063
00064
00065
00066
00067 t_conta *create_conta(char *login, char *password);
00068
00069
00070
00071
00072 void free_maquina(t_maquina *maq);
00073
00074
00075
00076
00077 t_maquina *create_maquina(char *ip, HASHTABLE_T *logins, LISTA_GENERICA_T *pastas);
00078
00079
00080
00081
00082 void free_session(t_session *session);
00083
00084
00085
00086
00087 t_session *create_session(char *login);
00088
00089
00090
00091
00092 void free_args_processor(t_args_processor *args);
00093
00094
00095
00096
00097 t_args_processor *create_args_processor(HASHTABLE_T *sessions, HASHTABLE_T *contas, HASHTABLE_T *maquinas, int tempo, pthread_mutex_t *mutex);
00098
00099
00100
00101
00102 void free_args_monitor(t_args_monitor *args);
00103
00104
00105
00106
00107 t_args_monitor *create_args_monitor(HASHTABLE_T *sessions, int tempo, pthread_mutex_t *mutex, pthread_cond_t *cond);
00108
00109 #endif