/* ----- Definitions and macros ----- */

#define D_NONE 0
#define D_FATAL 1
#define D_ERROR 2
#define D_VERBOSE 3

#define DEBUGLEVEL D_FATAL

#define DEBUG(lvl, args...) if (lvl >= DEBUGLEVEL) { fprintf(stderr, ##args); }

/* ----- Structures and types ----- */


/* 
 * conntype_t : application layer protocol to use...
 */
typedef enum {
	CONNTYPE_FTP,
} conntype_t;

/*
 * FTP-protocol specifik connection-data.
 */
typedef struct {
	const char *username;
	const char *password;
	int datafd;
} conntypeftpdata_t;

/*
 * conntypedata_t : union of protocol-specific data structs.
 */
typedef union {
	conntypeftpdata_t data;
} conntypedata_t;
	
/*
 * struct conn_info : generic structure with information about the connection.
 */
struct conn_info {
	const char *hostname;
	const char *service;
	conntype_t ct;
	conntypedata_t *ctdata;
	int fd;
}

/* ----- function definition --- */

int parseargs(int argc, char *argv[], struct conn_info *c);
int alloc_ctdata(conntype_t ct, conntypedata_t *ctdata);

