#ifndef __lan_d__
# define __lan_d__

typedef struct {
    unsigned short local_port;
    unsigned short remote_port;
    long remote_iaddr;
    char remote_eaddr[6];
} CHANNEL;

extern unsigned short monport;
extern CHANNEL dbug_ch;
extern CHANNEL curr_ch;	    /* Channel for current message */

#define ETHERNET 1
#define MONPORT (dbug_ch.local_port)
#define HOSTPORT (dbug_ch.remote_port)
#define MAGIC_PORT (unsigned short) 0xffff
#define CONNECTED (MONPORT != MAGIC_PORT)
#define IS_ACK(message) (message)[3] == '*'
/* SWAP macros are needed since the byte-sex used on the network is
   Big-Endian.
*/
#define SWAP_S(x)  ((((x)<<8) & 0xff00) | (((x)>>8) & 0xff))
#define SWAP_L(x)  (((x)<<24) | (((x)<<8) & 0xff0000) | \
                            (((x)>>8) & 0xff00) | (((x)>>24) & 0xff))

extern void read_line_from_lan__(/* message */);
extern void write_line_to_lan__(/* message */);
extern resend_lost_message__(/* lost, frame */);
#endif
