Página principal | Lista de componentes | Directories | Lista de archivos | Miembros de las clases | Archivos de los miembros | Páginas relacionadas

servidor.h

Ir a la documentación de este archivo.
00001 /* 
00002  * LabSession - login application and administration tools 
00003  * Copyright (C) 2005 - 2006 - Hugo Ruscitti (see AUTHORS file)
00004  * 
00005  * This program is free software; you can redistribute it and/or modify
00006  * it under the terms of the GNU General Public License as published by
00007  * the Free Software Foundation; either version 2 of the License, or
00008  * (at your option) any later version.
00009  * 
00010  * This program is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  * GNU General Public License for more details.
00014  * 
00015  * You should have received a copy of the GNU General Public License
00016  * along with this program; if not, write to the Free Software
00017  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
00018  */
00019 
00025 #ifndef _SERVIDOR_H
00026 #define _SERVIDOR_H
00027 
00028 #include <gnet.h>
00029 #include "lista.h"
00030 
00034 enum tipo_cliente {CLIENTE, ADMINISTRADOR, OTRO};
00035 
00036 
00040 typedef struct servidor
00041 {
00042         Nodo * clientes;        
00043         int puerto;             
00044         int sesion_tiempo;      
00045         int sesion_cantidad;    
00046         GTcpSocket * socket;    
00047         GTcpSocket * administrador; 
00048         char administrador_passwd [512];
00049 } Servidor;
00050 
00051 
00052 /* utilizadas al inicio del programa */
00053 int servidor_iniciar (Servidor * data, int argc, char * argv []);
00054 int servidor_cargar_opciones_arg (Servidor * data, int argc, char * argv []);
00055 void servidor_imprimir_ayuda (char * programa);
00056 void servidor_puerto_por_defecto (Servidor * datos, int puerto);
00057 int servidor_cargar_opciones_disco (Servidor * datos);
00058 void servidor_terminar (Servidor * data);
00059 
00060 /* comunicacion con el programa administrador */
00061 gboolean servidor_atender_pedido_administrador (GIOChannel* io, \
00062                 GIOCondition cond, gpointer _data);
00063 void servidor_enviar_listado_clientes (Servidor * datos);
00064 void servidor_atender_login (Servidor * data, GIOChannel * io);
00065 void servidor_atender_actualizar (Servidor * data, GIOChannel * io);
00066 
00067 /* mensajes con el administrador */
00068 void servidor_atender_adm_getdatos (Servidor * data, GIOChannel * io);
00069 void servidor_atender_adm_mensaje (Servidor * data, GIOChannel * io);
00070 void servidor_atender_adm_logout (Servidor * data, GIOChannel * io);
00071 void servidor_atender_adm_reiniciar (Servidor * data, GIOChannel * io);
00072 void servidor_atender_adm_apagar (Servidor * data, GIOChannel * io);
00073 void servidor_atender_adm_actualiza_sesion (Servidor * data, GIOChannel * io);
00074 void servidor_atender_adm_super_sesion (Servidor * data, GIOChannel * io);
00075 
00076 /* comunicación con clientes nuevos */
00077 void servidor_evaluar_nuevo_cliente (GTcpSocket * server, 
00078                 GTcpSocket * client, gpointer data);
00079 void servidor_agregar_usuario (Servidor * datos, GIOChannel * io, \
00080                 GTcpSocket * socket, char * msg);
00081 void servidor_identificar_cliente (Servidor* data, GIOChannel* io, \
00082                 GTcpSocket * cliente);
00083 
00084 /* mensajes con sus clientes */
00085 void servidor_atender_login (Servidor * data, GIOChannel * io);
00086 void servidor_asignar_sesion (Servidor * datos, char * nombre, char * equipo,
00087                 int super_sesion);
00088 
00089 /* comunicación con el administrador */
00090 void servidor_enviar_listado_clientes (Servidor * datos);
00091 void servidor_informar_desconectado (Servidor * data, char * nombre);
00092 void servidor_informar_usuario (Servidor * data, char * nombre);
00093 
00094 /* gestión de errores y desconexión */
00095 void servidor_desconectar_administrador (Servidor * datos);
00096 int servidor_validar_ingreso (Servidor * datos, char * nombre, char * passwd);
00097 
00098 /* otras */
00099 void servidor_manejador (int num);
00100 void servidor_agregar_usuario (Servidor * datos, GIOChannel * io, \
00101                 GTcpSocket * socket, char * msg);
00102 gboolean servidor_atender_pedido_usuario (GIOChannel* io, GIOCondition cond, 
00103                 gpointer data);
00104 void servidor_desconectar_usuario (Servidor * data, GIOChannel * io);
00105 void servidor_enviar_mensaje (Servidor * data, char * nombre, \
00106                 enum socket_mensaje tipo, char * extra);
00107 int servidor_valida_passwd (Servidor * data, char * passwd);
00108 void servidor_evento (char * format, ...);
00109 #endif




Generado con Doxygen, versión 1.4.2