#ifndef PROTOCOL_H
#define PROTOCOL_H

#include "packet.h"


#define MAX_NAMELENGTH  8
#define MAX_NBNAME      40


#define PROTOCOL_ERROR -1

typedef struct
{
  char name[MAX_NAMELENGTH+1];
  int size;
  int type;
  int state;
} Variable;

#define TI_OK         0
#define TI_TIMEOUT    -1
#define TI_BADFORMAT  -2
#define TI_FILE       -3 /* Problem with the file */
#define TI_PROTOCOL   -4
#define TI_MEMORY     -5
#define TI_NOTEXIST   -6
#define TI_PING       -7




int ti_ping(int nb);
int ti_listdir(char *foldname, Variable *vars);
int ti_folderlist(Variable *vars);
int ti_sendfile(char *filename, char *defaultfolder);
int ti_getvar(char *foldername, char *varname, char *filename);
int ti_getfolder(char *foldername, char *filename);
char *ti_code2string(int code);




#endif
