1 /* esecannaserver --- pseudo canna server that wraps another IME. 2 * Copyright (C) 1999-2000 Yasuhiro Take 3 * 4 * This program is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU General Public License as published by 6 * the Free Software Foundation; either version 2 of the License, or 7 * (at your option) any later version. 8 * 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * 14 * You should have received a copy of the GNU General Public License 15 * along with this program; if not, write to the Free Software 16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 */ 18 19 #ifndef __def_h__ 20 #define __def_h__ 21 22 #ifndef __const_def__ 23 #include "constdef.h" 24 #endif 25 26 #include <sys/types.h> 27 28 #ifndef __uchar_t__ 29 #define __uchar_t__ 30 typedef unsigned char uchar; 31 #endif 32 33 34 typedef struct { 35 int sockfd; 36 37 int ime; 38 39 char user[10]; /* �桼����̾ */ 40 char *host; /* �ۥ���̾ */ 41 char *homedir; /* �ۡ���ǥ��쥯�ȥ�Υѥ� */ 42 43 /* IME �˸�ͭ�Υǡ����� malloc �����ݻ� */ 44 union { 45 struct _vje25_t *vje25; 46 struct _vje30_t *vje30; 47 struct _atok_t *atok; 48 struct _wnn_t *wnn; 49 } data; 50 51 int data_received:1; /* �����åȤ���ǡ�������������� */ 52 int need_terminate:1; /* main.c �ǽ�λ������ɬ�פ��ꡩ */ 53 54 } client_t; 55 56 #define IME_NON 0 57 #define IME_START 1 58 #define IME_VJE25 1 59 #define IME_VJE30 2 60 #define IME_ATOK 3 61 #define IME_WNN 4 62 #define IME_END 4 63 64 typedef struct { 65 unsigned char type; 66 unsigned char extra; 67 unsigned short datalen; 68 union { 69 unsigned short e16; 70 unsigned char e8; 71 } err; 72 } cannaheader_t; 73 74 #ifndef WORDS_BIGENDIAN 75 #define LSBMSB16(_s) ((((_s) >> 8) & 0xff) | (((_s) & 0xff) << 8)) 76 #define LSBMSB32(_s) ((((_s) >> 24) & 0xff) | (((_s) & 0xff) << 24) | \ 77 (((_s) >> 8) & 0xff00) | (((_s) & 0xff00) << 8)) 78 #else 79 #define LSBMSB16(_s) (_s) 80 #define LSBMSB32(_s) (_s) 81 #endif 82 83 #endif 84