/* Copyright (C) 2002 Mitsuru KANDA */
#ifndef __DTCP_H__
#define __DTCP_H__ 1

#include <net/if.h>

#define DTCP_MSG_PING        1
#define DTCP_MSG_TUNNEL      2
#define DTCP_MSG_QUIT        3

#define DTCP_HOST           1 /* "host" */
#define DTCP_NETWORK        2 /* "network" */
#define DTCP_TUNNEL_ONLY    3 /* "tunnelonly" */

#define DTCP_OK  0
#define DTCP_ERR 1

#define DTCP_PORT 20200

struct tunnel_config {
	int type;
	char dev[IFNAMSIZ];
	struct in_addr *in_c;
	struct in_addr *in_s;
	struct in6_addr *in6_c; 
	struct in6_addr *in6_s;
	struct in6_addr *in6_net;
	int plen;
	char netdev[IFNAMSIZ]; 
};

int send_ping(int sockfd);
int send_quit(int sockfd);

int do_write(int fd, const char *msg, size_t len);
int do_rcvchk(char *msg);

int detect_tuntype(char *tuntype);

#endif /* __DTCP_H__ */
