/*	@(#)Copyright (C) H.Shirouzu 1996-2000   ipmsg.h	Ver1.40 */
/*
 * Copyright (c) 1996-2000
 *	Hiroaki Shirouzu.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 * 3. All advertising materials mentioning features or use of this software
 *    must display the following acknowledgement:
 *	This product includes software developed by Hiroaki Shirouzu.
 * 4. Neither the name of the author nor the names of any co-contributors
 *    may be used to endorse or promote products derived from this software
 *    without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY HIROAKI SHIROUZU AND CONTRIBUTORS ``AS IS''
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED. IN NO EVENT SHALL HIROAKI SHIROUZU OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 *
 */

#ifndef __IPMSGPRTCL_H__
#define __IPMSGPRTCL_H__

/*  IP Messenger Communication Protocol version 1.1 define  */
/*  macro  */
#define GET_MODE(command)	(command & 0x000000ffUL)
#define GET_OPT(command)	(command & 0xffffff00UL)

/*  header  */
#define IPMSG_VERSION			(0x0001)
#define IPMSG_DEFAULT_PORT		(0x0979)

/*  command  */
/* コマンド種類 (command番号(32bit)のうち、下位8bit) */
#define IPMSG_NOOPERATION	(0x00000000UL)	/* 無操作 */

#define IPMSG_BR_ENTRY		(0x00000001UL)	/* サービスにエントリ（起動時にBroadcast）*/
#define IPMSG_BR_EXIT		(0x00000002UL)	/* サービスから抜ける（終了時にBroadcast）*/
#define IPMSG_ANSENTRY		(0x00000003UL)	/* エントリを認識したことを通知 */
#define IPMSG_BR_ABSENCE	(0x00000004UL)	/* 不在モード変更 */

#define IPMSG_BR_ISGETLIST	(0x00000010UL)	/* ホストリスト送出可能メンバの探索 */
#define IPMSG_OKGETLIST		(0x00000011UL)	/* ホストリスト送出可能通知 */
#define IPMSG_GETLIST		(0x00000012UL)	/* ホストリスト送出要求 */
#define IPMSG_ANSLIST		(0x00000013UL)	/* ホストリスト送出 */
#define IPMSG_BR_ISGETLIST2	(0x00000018UL)

#define IPMSG_SENDMSG		(0x00000020UL)	/* メッセージの送信 */
#define IPMSG_RECVMSG		(0x00000021UL)	/* メッセージの受信確認 */
#define IPMSG_READMSG		(0x00000030UL)	/* 封書の開封通知 */
#define IPMSG_DELMSG		(0x00000031UL)	/* 封書破棄通知 */
#define IPMSG_ANSREADMSG	(0x00000032UL)	/* 封書の開封確認（8 版から追加）*/

#define IPMSG_GETINFO		(0x00000040UL)	/* IPMSGバージョン情報取得 */
#define IPMSG_SENDINFO		(0x00000041UL)	/* IPMSGバージョン情報応答 */

#define IPMSG_GETABSENCEINFO	(0x00000050UL)	/* 不在通知文取得 */
#define IPMSG_SENDABSENCEINFO	(0x00000051UL)	/* 不在通知文応答 */

/*  option for all command  */
/* オプションフラグ種類 (command番号(32bit)のうち、上位24bit) */
#define IPMSG_ABSENCEOPT	(0x00000100UL)	/* 不在モード（メンバ認識系コマンドで使用） */
#define IPMSG_SERVEROPT		(0x00000200UL)	/* サーバー（予約）*/
#define IPMSG_DIALUPOPT		(0x00010000UL)	/* メンバ認識系のコマンドを個別に送り返す */

/*  OPTION for send command  */
#define IPMSG_SENDCHECKOPT	(0x00000100UL)	/* 送信チェック */
#define IPMSG_SECRETOPT		(0x00000200UL)	/* 封書 */
#define IPMSG_BROADCASTOPT	(0x00000400UL)	/* ブロードキャスト（同報）*/
#define IPMSG_MULTICASTOPT	(0x00000800UL)	/* マルチキャスト（複数選択）*/
#define IPMSG_NOPOPUPOPT	(0x00001000UL)	/* （使用しなくなりました）*/
#define IPMSG_AUTORETOPT	(0x00002000UL)	/* 自動応答（ピンポン防止用）*/
#define IPMSG_RETRYOPT		(0x00004000UL)	/* 再送フラグ（HOSTLIST取得時に使用）*/
#define IPMSG_PASSWORDOPT	(0x00008000UL)	/* 錠前 */
#define IPMSG_NOLOGOPT		(0x00020000UL)	/* ログに残さない（ことを推奨）*/
#define IPMSG_NEWMUTIOPT	(0x00040000UL)	/* ニューバージョンマルチキャスト（予約）*/
#define IPMSG_NOADDLISTOPT	(0x00080000UL)	/* BR_ENTRYしていない一時メンバ通知 */
#define IPMSG_READCHECKOPT	(0x00100000UL)	/* 封書確認（8 版から追加）*/
#define IPMSG_SECRETEXOPT	(IPMSG_READCHECKOPT|IPMSG_SECRETOPT)

#define HOSTLIST_DELIMIT	"\a"
#define HOSTLIST_DUMMY		"\b"

/*  end of IP Messenger Communication Protocol version 1.1 define  */

#endif /* __IPMSGPRTCL_H__ */
