/**
 * MobileWonderGate Network Communication Library
 *      copyright 2000-2001, by Naga(nagaw@attglobal.net)
 *
 * $Id$
 *
 * $Log$
 */

#ifndef	_MWGATE_H_
#define	_MWGATE_H_

#include "mwgsock.h"

#ifdef	__cplusplus
extern	"C"
{
#endif


/*-------------------------------------------------------------------*/
/*
 * バッファサイズの定義
 */
#define	MWG_RECV_BUFF	0x007F
#define	MWG_SEND_BUFF	0x007F

#define	MAX_RECV_BUFF	(8+MWG_RECV_BUFF)

/*
 * 基本的な戻り値の定義
 */
#define	MWG_SUCCESS		1
#define	MWG_FAILURE		0
#define	MWG_ERROR		(0x8000)

/*
 * mwgate_openの戻り値のマクロ(バージョン番号)
 */
#define	MWGVER_MAJOR(c)	( (c)       & 0x00FF)
#define	MWGVER_MINOR(c)	(((c) >> 8) & 0x00FF)

/*
 * megate_statusの戻り値の定義
 */
#define	MWGSTAT_ON		0x02
#define	MWGSTAT_PPP		0x03

/*
 * mwgate_check_pdcの戻り値のマクロ
 */
#define	PDC_WAVLEVEL(c)	(((c) >> 8) & 0x00FF)
#define	PDC_RETVALUE(c)	( (c)       & 0x00FF)
#define	PDC_OK			0x00
#define	PDC_ERR_BUSY	0x01
#define	PDC_ERR_OOB		0x02
#define	PDC_ERR_NOPDC	0x03

/*
 * mwgate_dialup/hangupの戻り値のマクロ
 */
#define	DIAL_CONNECT	0x00


/*-------------------------------------------------------------------*/
/*
 * 内部処理用バッファ
 */
extern	unsigned char	_mwg_achWorkBuff[];


/*-------------------------------------------------------------------*/
/*
 * MobileWonderGateのコマンド処理関数
 */
int	mwgate_command(char nType, char nCmd, char far *pParam, int nLen,
	char far *pBuff, int nSize);


/*-------------------------------------------------------------------*/
/*
 * MobileWonderGateの基本コマンド関数
 */
int	mwgate_open(int speed);
int	mwgate_close(void);

int	mwgate_status(void);
int	mwgate_check_pdc(void);

int	mwgate_set_ppp(char far *user, char far *pass);
int	mwgate_set_dns(struct in_addr far *dns1, struct in_addr far *dns2);

int	mwgate_dialup(char far *tel);
int	mwgate_hangup(void);


#ifdef	__cplusplus
}
#endif

#endif	/* _MWGATE_H_ */
