Newer
Older
tuved / tuved.h
@reddawg reddawg on 3 Oct 2007 1 KB Changed some files around
/*
  (c) 2007 Christopher Olsen

  $Id$
*/
#include <sys/types.h>

#define MYPORT   9999         // the port users will be connecting to
#define BACKLOG  10           // how many pending connections queue will hold
#define LOG_FILE "./podzd.log"

typedef struct podz {
  short  ident;
  short  pfailed;
  short  status;
  int    uid;
  time_t pong;
  char   username[32];
  } podz_t;

typedef struct myConnections {
  struct myConnections *prev;
  struct myConnections *next;
  int    fd;
  int    recLen;
  char   data[1024];
  podz_t userInfo;
  } myConnections_t;

/*
  Global variables very not safe
 */
extern int listenerFD;
extern int highSock;
extern myConnections_t *connections;
extern FILE *logFile;

/* Socket Functions */
ssize_t sReadSocket(int socketFD,void *buffer,size_t length);
myConnections_t *sFindConnection(int fd); 
int sStartListener();
int sAddConnection(int);
int sGetConnections(fd_set *);
int sProcessConnections(fd_set *);
int sSendPing(time_t);
int sCleanConnections();

/* Podz Fucntions */
int podzGetData(myConnections_t *);
int podzProcessData(myConnections_t *);
int podzSendAll(char *,int);

/* Log Functions */
int writeLog(char const * __restrict, ...);