[3ec149c] | 1 | // ******************************************************************************************************** |
---|
| 2 | // Servicio: ogAdmServer |
---|
| 3 | // Autor: José Manuel Alonso (E.T.S.I.I.) Universidad de Sevilla |
---|
| 4 | // Fecha Creación: Marzo-2010 |
---|
| 5 | // Fecha Última modificación: Marzo-2010 |
---|
| 6 | // Nombre del fichero: ogAdmServer.h |
---|
| 7 | // Descripción: Este fichero implementa el servicio de administración general del sistema |
---|
| 8 | // ******************************************************************************************************** |
---|
| 9 | #include <stdio.h> |
---|
| 10 | #include <stdlib.h> |
---|
| 11 | #include <string.h> |
---|
| 12 | #include <ctype.h> |
---|
| 13 | #include <errno.h> |
---|
| 14 | #include <unistd.h> |
---|
| 15 | #include <time.h> |
---|
| 16 | #include <sys/types.h> |
---|
| 17 | #include <sys/socket.h> |
---|
| 18 | #include <netinet/in.h> |
---|
| 19 | #include <arpa/inet.h> |
---|
[c0a46e2] | 20 | #include <stdbool.h> |
---|
[3ec149c] | 21 | #include </usr/include/mysql/mysql.h> |
---|
| 22 | #include "ogAdmLib.h" |
---|
| 23 | // ________________________________________________________________________________________________________ |
---|
| 24 | // Variables globales |
---|
| 25 | // ________________________________________________________________________________________________________ |
---|
| 26 | char servidoradm[LONPRM]; // Dirección IP del servidor de administración |
---|
| 27 | char puerto[LONPRM]; // Puerto de comunicación |
---|
| 28 | |
---|
[2e0c063] | 29 | struct og_client; |
---|
| 30 | |
---|
[3ec149c] | 31 | typedef struct{ // Estructura usada para guardar información de los clientes |
---|
| 32 | char ip[LONIP]; // IP del cliente |
---|
| 33 | char estado[4]; // Tipo de Sistema Operativo en que se encuentra el cliente |
---|
[2e0c063] | 34 | struct og_client *cli; |
---|
[3ec149c] | 35 | }SOCKETCL; |
---|
| 36 | SOCKETCL tbsockets[MAXIMOS_CLIENTES]; |
---|
| 37 | |
---|
[46d07a2] | 38 | struct og_dbi; |
---|
| 39 | |
---|
[c0a46e2] | 40 | bool registraCliente(char *); |
---|
| 41 | bool procesoInclusionClienteWinLnx(int socket, TRAMA*,int*,char*); |
---|
[8c04716] | 42 | bool procesoInclusionCliente(struct og_client *, TRAMA*); |
---|
[c0a46e2] | 43 | bool clienteExistente(char *,int *); |
---|
| 44 | bool clienteDisponible(char *,int *); |
---|
[e052fdc] | 45 | bool actualizaConfiguracion(struct og_dbi *,char* ,int); |
---|
[46d07a2] | 46 | bool recorreProcedimientos(struct og_dbi *,char* ,FILE*,char*); |
---|
[c0a46e2] | 47 | bool buscaComandos(char *,TRAMA *,int *); |
---|
| 48 | bool respuestaConsola(int socket, TRAMA *,int); |
---|
| 49 | bool enviaComando(TRAMA *ptrTrama,const char*); |
---|
[62c0560] | 50 | bool Levanta(char**, char**, int, char*); |
---|
[aaa2c57] | 51 | bool WakeUp(int,char*,char*,char*); |
---|
[3ec149c] | 52 | void PasaHexBin(char *,char *); |
---|
[7a8fae6] | 53 | bool actualizaCreacionImagen(struct og_dbi *,char*,char*,char*,char*,char*,char*); |
---|
[e052fdc] | 54 | bool actualizaRestauracionImagen(struct og_dbi *,char*,char*,char*,char*,char*); |
---|
[54bd82d] | 55 | bool actualizaHardware(struct og_dbi *dbi, char* ,char*,char*,char*); |
---|
| 56 | bool cuestionPerfilHardware(struct og_dbi *dbi,char*,char*,int,char*,char*,int *,int); |
---|
[e052fdc] | 57 | bool actualizaSoftware(struct og_dbi *, char* , char* , char*,char*,char*); |
---|
| 58 | bool cuestionPerfilSoftware(struct og_dbi *, char*, char*,int,int,char*,char*,char*,int *,int); |
---|
[3ec149c] | 59 | |
---|
[e052fdc] | 60 | int checkDato(struct og_dbi *,char*,const char*,const char*,const char*); |
---|