xipmsg-0.8088.orig/0000755001001300006200000000000010212772212014342 5ustar gotomgotom00000000000000xipmsg-0.8088.orig/xipmsg.c0000644001001300006200000010221210211266743016021 0ustar gotomgotom00000000000000/* * xipmsg.c - IP Messenger 1.20 for X11 * Copyright (C) 1995, 1996 by candy */ char rcsid_xipmsg[] = "$Id: xipmsg.c,v 3.7 1997/05/02 05:27:46 candy Exp candy $"; #include #include /* floor() */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include /* select() */ #include /* setitimer() */ /* includes below are order dependent */ #include /* htons() */ #include /* socket() */ #include /* socket() */ #include /* inet_addr() INADDR_ANY */ #include /* inet_addr() */ #include "xipmsg.h" #include "brocas.h" #include "db.h" #ifdef NO_STRTOUL #define strtoul(s,p,b) ((unsigned long)strtol(s,p,b)) #endif #ifdef NO_MEMMOVE #define memmove(d,s,l) bcopy(s,d,l) #endif #ifdef SUNOS41X /* [ */ static int atexit(void (*proc)(void)) { return on_exit((void (*)(int, caddr_t))proc, NULL); }/* atexit */ #endif /* ] */ #ifdef NO_ATEXIT /* [ */ static void (*at_exit_proc)(void); static void inttrap(void) { if (at_exit_proc != NULL) { at_exit_proc(); } exit(1); }/* inttrap */ static int atexit(void (*proc)(void)) { at_exit_proc = proc; signal(SIGINT, inttrap); signal(SIGHUP, inttrap); signal(SIGTERM, inttrap); return 0; }/* atexit */ #endif /* ] */ #define NUMBER_OF_MENU 16 /* Don't forget change fallback_resources[] too.*/ extern char *myname; static XtAppContext app_con; static Widget toplevel; static char last_msg[MESSAGE_MAX]; static Pixmap last_icon; static Cursor csr_clock; static int iconified; static int pause_time = 500; /* milli-seconds */ static int bogus_fix; static void send_dialog(Widget parent, const struct maddr_t *dstaddr, const char *to); /* * リストの個数を返す。 */ static int count_list(const void * const *ls) { const void * const *mv = ls; while (*mv++ != NULL) ; return mv - 1 - ls; }/* count_list */ /* * カンマで区切られた文字列をリストに変換する。 */ static char ** cvs_list(const char *s) { char **ls = NULL; int n = 0; const char *p = s; while (strchr(p, ',') != NULL) { p = strchr(p, ',') + 1; n++; }/* while */ n++; ls = malloc(sizeof(*ls) * (n + 1)); if (ls != NULL) { char *buf = str_dup(s); if (buf != NULL) { char *mv = buf; int i; ls[0] = mv; for (i = 1; i < n; i++) { mv = strchr(mv, ','); *mv++ = '\0'; while (isascii(*mv) && isspace(*mv)) mv++; ls[i] = mv; }/* for */ ls[n] = NULL; } } return ls; }/* cvs_list */ #define FROM_DB_MAX 64 struct from_t { int fr_so; char fr_name[USERNAME_MAX + HOSTNAME_MAX]; struct sockaddr_in fr_addr; struct packet_t fr_pk; char fr_last_msg[MESSAGE_MAX]; /* 最後に送ったメッセージ */ unsigned int fr_x0, fr_y0; /* 最初にダイアログを出す位置 */ unsigned int fr_x, fr_y; /* 次にダイアログを出す位置 */ int fr_count; /* 開いているダイアログの数 */ }; static struct db_t *from_db; static int from_comp(const void *d_, const void *s_) { const struct from_t *d = d_, *s = s_; int cmp = strcmp(d->fr_name, s->fr_name); return cmp; }/* from_comp */ /* * window 幅は最大 466 くらい */ static struct from_t * from_install(const char *from) { static int lastx = 4, lasty = 4; struct from_t *fr = malloc(sizeof(*fr)); int wx = DisplayWidth(XtDisplay(toplevel), 0); int wy = DisplayHeight(XtDisplay(toplevel), 0); if (lastx >= wx - 300) lastx = lastx % (wx - 300); if (lasty >= wy - 160) lasty = lasty % (wy - 160); if (fr != NULL) { memset(fr, '\0', sizeof(*fr)); strncpyz(fr->fr_name, from, sizeof(fr->fr_name)); strcpy(fr->fr_last_msg, last_msg); fr->fr_x0 = lastx; fr->fr_y0 = lasty; fr->fr_x = lastx; fr->fr_y = lasty; fr->fr_count = 0; lastx += 256; db_install(from_db, fr); } return fr; }/* from_install */ static struct from_t * from_lookup(const char *from) { struct from_t key, *fr; strncpyz(key.fr_name, from, sizeof(key.fr_name)); fr = db_lookup(from_db, &key); return fr; }/* from_lookup */ static void next_pos(Dimension *nx, Dimension *ny) { static int lastx = 20, lasty = 20; int wx = DisplayWidth(XtDisplay(toplevel), 0); int wy = DisplayHeight(XtDisplay(toplevel), 0); if (lastx >= wx - 300) lastx = 20; if (lasty >= wy - 200) lasty = 20; *nx = lastx; *ny = lasty; lastx += 10; lasty += 100; }/* next_pos */ /* * 以下の from_*()では fr == NULL でもよい。 */ static struct from_t * from_next_pos(struct from_t *fr, Dimension *nx, Dimension *ny) { int wy = DisplayHeight(XtDisplay(toplevel), 0); if (fr != NULL) { *nx = fr->fr_x; *ny = fr->fr_y; fr->fr_y += 100; if (fr->fr_y >= wy - 200) fr->fr_y = fr->fr_y0; } else { next_pos(nx, ny); } return fr; }/* from_next_pos */ static char * from_last_msg(struct from_t *fr) { char *ret = NULL; if (fr != NULL) ret = fr->fr_last_msg; else ret = last_msg; return ret; }/* from_last_msg */ static struct from_t * from_count_up(struct from_t *fr) { if (fr != NULL) fr->fr_count++; return fr; }/* from_count_up */ static struct from_t * from_count_down(struct from_t *fr) { if (fr != NULL) { if (--fr->fr_count == 0) { fr->fr_x = fr->fr_x0; fr->fr_y = fr->fr_y0; } } return fr; }/* from_count_down */ /* * */ static void iconify_action(Widget w, XEvent *event, String *params, Cardinal *num_params) { Display *d = XtDisplay(toplevel); Window win = XtWindow(toplevel); int scno = XScreenNumberOfScreen(XtScreen(w)); if (iconified) XMapWindow(d, win); else XIconifyWindow(d, win, scno); iconified = !iconified; }/* iconify_action */ /* * 返信ボタン */ static void answer_proc(Widget w, XtPointer closure, XtPointer call_data) { struct maddr_t *replyto = closure; Widget from = XtNameToWidget(XtParent(w), "from"); if (from != NULL) { String to; XtVaGetValues(from, XtNlabel, &to, NULL); #if 1 /* answer時に引用する機能の追加 sakane@NES [ */ { struct from_t *fr = from_lookup(to); if (fr != NULL) { char answer_string[MESSAGE_MAX]; char *p, *ap = answer_string; String from_msg; Widget dialog = XtParent(w); XtVaGetValues(dialog, XtNlabel, &from_msg, NULL); memset(answer_string, '\0', sizeof(answer_string)); *ap = '>'; for (p = (char *)from_msg;*p != '\0' && ap + 1 < &answer_string[COUNTOF(answer_string)];++p) { *++ap = *p; if (*p == '\n') { if (*(p + 1) != '\0') *++ap = '>'; } } ap[1] = '\0'; strncpyz(fr->fr_last_msg, answer_string, sizeof(fr->fr_last_msg)); } } #endif /* ] */ send_dialog(w, replyto, to); } else { fprintf(stderr, "%s: [answer] cannot get `from' widget.\n", myname); } }/* answer_proc */ /* * Done または Cancel ボタン */ static void done_proc(Widget w, XtPointer closure, XtPointer call_data) { if (bogus_fix) XtPopdown(XtParent(XtParent(w))); else XtDestroyWidget(XtParent(XtParent(w))); }/* done_proc */ /* * destroyCallback */ static void destroy_proc(Widget w, XtPointer closure, XtPointer call_data) { XtFree(closure); }/* destroy_proc */ /* * destroyCallback */ static void from_free_proc(Widget w, XtPointer closure, XtPointer call_data) { struct from_t *fr = closure; from_count_down(fr); }/* from_free_proc */ /* * セレクション [ */ #undef SELECT_TOGGLE static char selected_string[MESSAGE_MAX]; /* * ペースト(?)の要求があった。 */ static Boolean convert_selection(Widget w, Atom *selection, Atom *target, Atom *type_return, XtPointer *value_return, unsigned long *length_return, int *format_return) { XTextProperty ct; Display *d = XtDisplay(w); char *v = selected_string; XmbTextListToTextProperty(d, &v, 1, XCompoundTextStyle, &ct); *type_return = ct.encoding; *length_return = ct.nitems; *value_return = ct.value; *format_return = ct.format; return True; }/* convert_selection */ static void lose_selection(Widget w, Atom *selection) { return; }/* lose_selection */ static void own_selection(Widget w, XtPointer closure, XtPointer call_data) { Time time = XtLastTimestampProcessed(XtDisplay(w)); XtOwnSelection(w, XA_PRIMARY, time, convert_selection, lose_selection, NULL); }/* own_selection */ /* ] セレクション */ /* * コピーボタン */ static void select_proc(Widget w, XtPointer closure, XtPointer call_data) { Widget dialog = XtParent(w); String str; char *p; XtVaGetValues(dialog, XtNlabel, &str, NULL); strncpyz(selected_string, str, sizeof(selected_string)); p = strrchr(selected_string, '\n'); if (p != NULL) { *p = '\0'; if (*--p == '\n') *p = '\0'; } own_selection(toplevel, NULL, NULL); }/* select_proc */ /* * */ static char * cryption(char *str, int decode_flag) { unsigned char *p = (unsigned char *)str; while (*p != '\0') { if (*p != '\n' && *p != 0xff - '\n') *p ^= 0xff; p++; }/* while */ return str; }/* cryption */ /* * 開封ボタン */ static void open_proc(Widget w, XtPointer closure, XtPointer call_data) { struct maddr_t *replyto = closure; Widget dialog = XtParent(w); Widget w_pkno = XtNameToWidget(dialog, "pkno"); String str, str_pkno; XtVaGetValues(dialog, XtNlabel, &str, NULL); cryption(str, 1); XtVaSetValues(dialog, XtNlabel, str, NULL); XtSetSensitive(w, False); XtVaGetValues(w_pkno, XtNlabel, &str_pkno, NULL); send_IPMSG_READMSG(replyto, strtoul(str_pkno, NULL, 0)); }/* open_proc */ /* * */ static char * mkmsg(const char *msg, const char *from) { char *ret, lbuf[64]; time_t now = time(NULL); struct tm lc = *localtime(&now); sprintf(lbuf, "\n\n%02d:%02d ", lc.tm_hour, lc.tm_min); ret = XtMalloc(strlen(msg) + strlen(lbuf) + strlen(from) + 1); strcat(strcat(strcpy(ret, msg), lbuf), from); return ret; }/* mkmsg */ /* * メッセージが届きました。 */ static void recv_dialog(const char *msg, const char *from, const unsigned char *icon, struct maddr_t *replyto_, unsigned long opt, unsigned long pkno) { Widget popup, dialog; Pixmap pix; Dimension nx, ny; char title[256], *label = NULL, *str_pkno = NULL; struct from_t *fr = from_lookup(from); struct maddr_t *replyto = (void *)XtMalloc(sizeof(*replyto)); *replyto = *replyto_; if (fr == NULL) fr = from_install(from); popup = XtVaCreatePopupShell("recv_popup", transientShellWidgetClass, toplevel, NULL); label = mkmsg(msg, from); str_pkno = XtMalloc(20); if (opt & IPMSG_SECRETOPT) { cryption(label, 0); sprintf(str_pkno, "%lu", pkno); } pix = XCreateBitmapFromData(XtDisplay(toplevel), XtWindow(toplevel), (char *)icon, 32, 32); dialog = XtVaCreateManagedWidget("recv_from", dialogWidgetClass, popup, XtNlabel, label, XtNicon, pix, NULL); XtAddCallback(dialog, XtNdestroyCallback, destroy_proc, replyto); XtAddCallback(dialog, XtNdestroyCallback, destroy_proc, label); XtAddCallback(dialog, XtNdestroyCallback, destroy_proc, str_pkno); XtAddCallback(dialog, XtNdestroyCallback, from_free_proc, fr); XawDialogAddButton(dialog, "answer", answer_proc, replyto); XawDialogAddButton(dialog, "done", done_proc, NULL); XawDialogAddButton(dialog, "select", select_proc, NULL); if (opt & IPMSG_SECRETOPT) { XawDialogAddButton(dialog, "open", open_proc, replyto); } XtVaCreateManagedWidget("from", labelWidgetClass, dialog, XtNlabel, from, XtNmappedWhenManaged, False, NULL); XtVaCreateManagedWidget("pkno", labelWidgetClass, dialog, XtNlabel, str_pkno, XtNmappedWhenManaged, False, NULL); from_next_pos(fr, &nx, &ny); from_count_up(fr); XtVaSetValues(popup, XtNx, nx, XtNy, ny, NULL); XtPopup(popup, XtGrabNone); sprintf(title, "%s %s.%d", from, inet_ntoa(replyto->m_saddr.sin.sin_addr), (unsigned short)htons(replyto->m_saddr.sin.sin_port)); #ifdef NOTDEF XStoreName(XtDisplay(popup), XtWindow(popup), title); #else { char *v = title; XTextProperty ct; Display *d = XtDisplay(popup); XmbTextListToTextProperty(d, &v, 1, XCompoundTextStyle, &ct); XSetWMName(d, XtWindow(popup), &ct); } #endif XBell(XtDisplay(toplevel), 20); XFlush(XtDisplay(toplevel)); }/* recv_dialog */ /* * */ static void error_dialog(Widget w, const char *msg) { Position nx, ny; Widget err_popup = XtVaCreatePopupShell("err_popup", transientShellWidgetClass, toplevel, NULL); Widget err_dialog = XtVaCreateManagedWidget(msg, dialogWidgetClass, err_popup, NULL); XawDialogAddButton(err_dialog, "ok", done_proc, NULL); XtTranslateCoords(w, 0, 0, &nx, &ny); XtVaSetValues(err_popup, XtNx, nx + 20, XtNy, ny + 20, NULL); XtPopup(err_popup, XtGrabExclusive); XBell(XtDisplay(toplevel), 20); XFlush(XtDisplay(toplevel)); }/* error_dialog */ /* * */ static unsigned char * get_icon_data(XImage *img, unsigned char *buf) { int y; unsigned char *d = buf; for (y = 0; y < 32; y++) { int x, z = 0; for (x = 0; x < 32; x++) { z >>= 1; if (XGetPixel(img, x, y) != 0) z |= 0x80; if ((x & 7) == 7) { *d++ = z; z = 0; } }/* for */ }/* for */ return buf; }/* get_icon_data */ /* * 送信ボタン */ static void send_proc(Widget w, XtPointer closure, XtPointer call_data) { struct maddr_t *replyto = closure; Widget dialog = XtParent(w); String msg, label; Pixmap icon; XImage *img; Widget button = XtNameToWidget(dialog, "*icon_button"); int err = -1; struct from_t *fr; XtVaGetValues(button, XtNbitmap, &icon, NULL); XtVaGetValues(dialog, XtNvalue, &msg, XtNlabel, &label, NULL); img = XGetImage(XtDisplay(w), icon, 0, 0, 32, 32, 1L, XYPixmap); if (msg[0] != '\0' && img != NULL) { if (strlen(msg) < MESSAGE_MAX - 1 - 128) { unsigned char pat[128]; get_icon_data(img, pat); XDestroyImage(img); last_icon = icon; strcpy(last_msg, msg); fr = from_lookup(label); if (fr != NULL) strncpyz(fr->fr_last_msg, msg, sizeof(fr->fr_last_msg)); XDefineCursor(XtDisplay(dialog), XtWindow(dialog), csr_clock); XDefineCursor(XtDisplay(toplevel), XtWindow(toplevel), csr_clock); XFlush(XtDisplay(dialog)); err = bro_send(msg, pat, replyto); XUndefineCursor(XtDisplay(toplevel), XtWindow(toplevel)); XUndefineCursor(XtDisplay(dialog), XtWindow(dialog)); if (err == 0) { if (bogus_fix) XtPopdown(XtParent(dialog)); else XtDestroyWidget(XtParent(dialog)); } else { error_dialog(dialog, "not_sent"); } } else { error_dialog(dialog, "too_long"); } } }/* send_proc */ /* * クリアボタン */ static void clear_proc(Widget w, XtPointer closure, XtPointer call_data) { Widget dialog = XtParent(w); Widget value = XtNameToWidget(dialog, "value"); XawTextBlock tb; tb.firstPos = 0; tb.length = 0; tb.ptr = ""; tb.format = FMT8BIT; XawTextReplace(value, 0, 9999, &tb); XawTextSetInsertionPoint(value, 0); }/* clear_proc */ /* * */ static Widget make_menu(const char *rsc, const char *inst, Widget parent, const char * const *list, int n, void (*callback)()) { Widget menu = XtVaCreatePopupShell(rsc, simpleMenuWidgetClass, parent, NULL); int i; for (i = 0; i < n; i++) { char iname[256]; Widget entry; sprintf(iname, "%s%02d", inst, i); entry = XtVaCreateManagedWidget(iname, smeBSBObjectClass, menu, NULL); XtAddCallback(entry, XtNcallback, callback, (XtPointer)i); }/* for */ return menu; }/* make_menu */ /* * アイコンポップアップメニュー */ static void icon_select(Widget w, XtPointer closure, XtPointer call_data) { Pixmap pix; Widget menu = XtParent(w); Widget button = XtParent(menu); XtVaGetValues(w, XtNleftBitmap, &pix, NULL); XtVaSetValues(button, XtNbitmap, pix, NULL); }/* icon_select */ /* * 送信ダイアログ * parent のウィンドウの付近にだします。 */ static void send_dialog(Widget parent, const struct maddr_t *dstaddr, const char *to) { struct from_t *fr = from_lookup(to); String label = XtMalloc(strlen(to) + 1); struct maddr_t *daddr = (void *)XtMalloc(sizeof(*daddr)); Widget send_popup = XtVaCreatePopupShell("send_popup", transientShellWidgetClass, toplevel, NULL); Widget send_to = XtVaCreateManagedWidget("send_to", dialogWidgetClass, send_popup, XtNlabel, (strcpy(label, to)), XtNvalue, from_last_msg(fr), NULL); Widget icon_button = XtVaCreateManagedWidget("icon_button", menuButtonWidgetClass, send_to, XtNfromVert, NULL, XtNfromHoriz, NULL, NULL); Position nx, ny; *daddr = *dstaddr; XtAddCallback(send_to, XtNdestroyCallback, destroy_proc, label); XtAddCallback(send_to, XtNdestroyCallback, destroy_proc, daddr); make_menu("icon_menu", "icon", icon_button, NULL, NUMBER_OF_MENU, icon_select); if (last_msg[0] == '\0') { Widget entry = XtNameToWidget(icon_button, "*icon00"); XtVaGetValues(entry, XtNleftBitmap, &last_icon, NULL); } XtVaSetValues(icon_button, XtNbitmap, last_icon, NULL); XawDialogAddButton(send_to, "clear", clear_proc, NULL); XawDialogAddButton(send_to, "cancel", done_proc, NULL); XawDialogAddButton(send_to, "send", send_proc, (XtPointer)daddr); XtTranslateCoords(parent, 0, 0, &nx, &ny); XtVaSetValues(send_popup, XtNx, nx, XtNy, ny, NULL); XtPopup(send_popup, XtGrabNone); }/* send_dialog */ /* * 送信ダイアログを出すボタン */ static void compose_proc(Widget w, XtPointer closure, XtPointer call_data) { Widget name_list = closure; XawListReturnStruct *np = XawListShowCurrent(name_list); if (np->list_index != XAW_LIST_NONE) { struct ns_t *ns = ns_get(np->list_index); if (ns != NULL) send_dialog(XtParent(w), &ns->ns_maddr, np->string); } }/* compose_proc */ /* * List Widget の操作 [ */ /* * List を空っぽにする。 */ static int list_clear(Widget list) { static String empty[1] = {NULL}; XawListChange(list, empty, 0, 0, True); return 0; }/* list_clear */ /* * list の親が viewport だったら、 * 1 ページの行数を返す。つもり。 */ static int list_lines_per_page(Widget list) { int n, lines; Widget view = XtParent(list); XtVaGetValues(list, XtNnumberStrings, &n, NULL); lines = n; if (XtClass(view) == viewportWidgetClass) { Widget vbar = XtNameToWidget(view, "vertical"); if (vbar != NULL) { float shown, top; XtVaGetValues(vbar, XtNshown, &shown, XtNtop, &top, NULL); lines = floor(n * shown / 1.0); } } return lines; }/* list_lines_per_page */ /* * List の親が Viewport だったら、 * vertical スクロールバーの位置を調整する。 */ static void list_manage_viewport(Widget list) { XawListReturnStruct *elm = XawListShowCurrent(list); int idx = elm->list_index; Widget view = XtParent(list); if (idx != XAW_LIST_NONE && XtClass(view) == viewportWidgetClass) { Widget vbar = XtNameToWidget(view, "vertical"); if (vbar != NULL) { int n; float shown, top; XtVaGetValues(list, XtNnumberStrings, &n, NULL); XtVaGetValues(vbar, XtNshown, &shown, NULL); top = (double)idx / (n + 1); XawScrollbarSetThumb(vbar, top, shown); XtCallCallbacks(vbar, XtNjumpProc, &top); } } }/* list_manage_viewport */ /* * List のセレクトの位置を delta ずらす。 */ static void list_move_select(Widget list, int delta) { String *ls; XawListReturnStruct *elm = XawListShowCurrent(list); int n, idx = elm->list_index; XtVaGetValues(list, XtNlist, &ls, XtNnumberStrings, &n, NULL); if (elm->list_index == XAW_LIST_NONE) idx = -1; idx += delta; if (idx >= n) idx = n -1; if (idx < 0) idx = 0; if (idx != elm->list_index && idx < n) { XawListHighlight(list, idx); list_manage_viewport(list); } }/* list_move_select */ /* * List の要素のから、文字列 match とマッチした所を選択する。 */ static void list_select_match(Widget list, const char *match) { String *ls; int n, i = 0, found = -1, len = strlen(match); XtVaGetValues(list, XtNlist, &ls, XtNnumberStrings, &n, NULL); while (i < n && found < 0) { if (strncmpi(ls[i], match, len) == 0) found = i; else i++; }/* while */ if (found >= 0) { XawListHighlight(list, found); list_manage_viewport(list); } }/* list_select_match */ /* * List にカーソルキーやページキーの処理をする。 */ static void do_control_key(Widget list, int ksym) { #ifndef XK_Page_Up #define XK_Page_Up XK_Prior #endif #ifndef XK_Page_Down #define XK_Page_Down XK_Next #endif int lpp; switch (ksym) { case XK_Up: list_move_select(list, -1); break; case XK_Down: list_move_select(list, 1); break; case XK_Home: list_move_select(list, -9999); break; case XK_End: list_move_select(list, 9999); break; case XK_Page_Up: lpp = list_lines_per_page(list); list_move_select(list, -lpp); break; case XK_Page_Down: lpp = list_lines_per_page(list); list_move_select(list, lpp); break; }/* switch */ }/* do_control_key */ /* * List にカーソルキーやページキーの処理をさせるアクション。 * アクションのパラメータにキーの名前が入っている。 */ static void list_key_named_action(Widget list, XEvent *event, String *params, Cardinal *num_params) { int err = -1; if (XtClass(list) == listWidgetClass && event->type == KeyPress) { String arg = *params; if (arg != NULL) { struct kw_t { const char *name; int ksym; }; static struct kw_t kw[] = { {"Up", XK_Up}, {"Down", XK_Down}, {"Page_Up", XK_Page_Up}, {"Page_Down", XK_Page_Down}, {"Home", XK_Home}, {"End", XK_End}, {NULL, 0}, }; struct kw_t *p = kw; while (p->name != NULL && strcmp(p->name, arg) != 0) p++; if (p->name != NULL) { do_control_key(list, p->ksym); err = 0; } if (err < 0) fprintf(stderr, "%s: bad parameter for key_named_action.\n", arg); } } }/* list_key_named_action */ /* * リストでキーが押されたアクション * ・カーソルキーでスクロール * ・頭文字で、マッチした所に飛ぶ */ static void list_key_action(Widget list, XEvent *event, String *params, Cardinal *num_params) { static Time last_time; if (XtClass(list) == listWidgetClass && event->type == KeyPress) { XKeyEvent *ev = &event->xkey; int multi_event_time = XtGetMultiClickTime(XtDisplay(list)); /* milli-sec */ char kbuf[32]; KeySym ksym; int len = XLookupString(ev, kbuf, sizeof(kbuf) - 1, &ksym, NULL); multi_event_time *= 2; /* キータイプ速度はクリック速度より遅いので */ kbuf[len] = '\0'; switch (ksym) { case XK_Up: case XK_Down: case XK_Home: case XK_End: case XK_Page_Up: case XK_Page_Down: do_control_key(list, ksym); break; default: if (len != 0) { static char match_str[32]; static int match_len; if (ev->time - last_time >= multi_event_time) { match_len = 0; match_str[0] = '\0'; } if (strlen(match_str) + len < sizeof(match_str) - 1) { strcat(match_str, kbuf); list_select_match(list, match_str); } } break; }/* switch */ last_time = ev->time; } }/* list_key_action */ /* ] List Widget の操作 */ /* * 名前リストにキーイベントが届いたアクション */ static void call_name_list_action(Widget w, XEvent *event, String *params, Cardinal *num_params) { w = XtNameToWidget(toplevel, "*name_list"); if (w != NULL && XtClass(w) == listWidgetClass) { list_key_action(w, event, params, num_params); } }/* call_name_list_action */ /* * 名前リストを更新する。 */ static int refresh_name_list(Widget list) { ns_clear(); list_clear(list); send_IPMSG_BR_ENTRY(); return 0; }/* refresh_name_list */ /* * ゾーンリストをクリックされた処理。 */ static void get_zone_proc(Widget w, XtPointer closure, XtPointer call_data) { Widget name_list = (Widget)closure; refresh_name_list(name_list); }/* get_zone_proc */ /* * 自分の名前を見えなくするボタン。 */ static void disable_proc(Widget w, XtPointer closure, XtPointer call_data) { Boolean state; XtVaGetValues(w, XtNstate, &state, NULL); XDefineCursor(XtDisplay(w), XtWindow(w), csr_clock); XDefineCursor(XtDisplay(toplevel), XtWindow(toplevel), csr_clock); XFlush(XtDisplay(w)); bro_set_disable(state); XUndefineCursor(XtDisplay(toplevel), XtWindow(toplevel)); XUndefineCursor(XtDisplay(w), XtWindow(w)); }/* disable_proc */ /* * 終了 */ static void quit_proc(Widget w, XtPointer closure, XtPointer call_data) { exit(0); }/* quit_proc */ /* * ファイル *source に入力があった時呼び出される。 */ static void input_proc(XtPointer closure, int *source, XtInputId *id) { bro_recv_packet(*source); }/* input_proc */ /* * タイムアウト処理。 */ static void timeout_proc(XtPointer p1, XtIntervalId* id) { XtAppContext app_con = p1; #if 0 static Widget icon_label; static int done, count, status = -1; static Pixmap icons[2]; if (!done) { done = 1; icon_label = XtNameToWidget(toplevel, "*icon_label"); if (icon_label != NULL) { Widget icon_label2; XtVaGetValues(icon_label, XtNbitmap, &icons[0], NULL); icon_label2 = XtNameToWidget(toplevel, "*icon_label2"); if (icon_label2 != NULL) { XtVaGetValues(icon_label2, XtNbitmap, &icons[1], NULL); status = 1; } } } if (status >= 0) { if (++count == 10) { count = 0; XtVaSetValues(icon_label, XtNbitmap, icons[status], NULL); status = (status + 1) % COUNTOF(icons); } } #endif bro_job(); XtAppAddTimeOut(app_con, pause_time, timeout_proc, app_con); }/* timeout_proc */ /* * 何もイベントが無い時呼ばれる。 */ static Boolean work_proc(XtPointer closure) { bro_work(); return True; /* True -> remove proc */ }/* work_proc */ /* * アクション */ /* * 他の Command widget のコールバックを呼び出す、アクション処理ルーチン。 * 1. イベントのあったウィジェットから、親をたどって Dialog widget を探す。 * 2. その Dialog widget を起点に params の名前の widget を探す。 * 3. その widget の set() notify() unset() アクションを呼び出す。 */ static void direct_call_action(Widget w, XEvent *event, String *params, Cardinal *num_params) { Widget dialog = w; while (dialog != NULL && XtClass(dialog) != dialogWidgetClass) dialog = XtParent(dialog); if (dialog == NULL) dialog = toplevel; if (params != NULL) { String name = *params; Widget command = XtNameToWidget(dialog, name); if (command != NULL) { if (XtClass(command) == commandWidgetClass) { XtCallActionProc(command, "set", event, NULL, ZERO); XtCallActionProc(command, "notify", event, NULL, ZERO); XtCallActionProc(command, "unset", event, NULL, ZERO); } else { fprintf(stderr, "%s:direct_call_action: %s: not Command widget.\n", myname, name); } } else { fprintf(stderr, "%s:direct_call_action: %s: unknown widget.\n", myname, name); } } else { fprintf(stderr, "%s:direct_call_action: no arg.\n", myname); } }/* direct_call_action */ /* * disable は Command じゃないので、direct_call_action が使えない。 */ static void disable_action(Widget w, XEvent *event, String *params, Cardinal *num_params) { Widget disable = XtNameToWidget(toplevel, "*disable"); if (disable != NULL) { Boolean state; String action; XtVaGetValues(disable, XtNstate, &state, NULL); action = state ? "unset" : "set"; XtCallActionProc(disable, action, event, params, *num_params); XtCallActionProc(disable, "notify", event, params, *num_params); } else fprintf(stderr, "%s: disable toggle not found.\n", myname); }/* disable_action */ /* * IP Messenger のイベントの処理 */ static void ipmsg_notify(enum bro_event_t evt, void *closure, void *call_data) { switch (evt) { case BRO_EV_START_WORK_PROC: { XtAppContext app_con = closure; XtAppAddWorkProc(app_con, work_proc, app_con); } break; case BRO_EV_LIST_CHANGED: { Widget name_list = closure; char **ls, *name = NULL; int n; XawListReturnStruct *np = XawListShowCurrent(name_list); if (np->list_index != XAW_LIST_NONE) { name = str_dup(np->string); } ls = ns_list(); n = count_list((void *)ls); XawListChange(name_list, ls, n, 0, True); if (name != NULL) { list_select_match(name_list, name); free(name); } } break; case BRO_EV_RECV_MESSAGE: { struct msg_data_t *md = call_data; struct maddr_t *rp = md->md_replyto; recv_dialog(md->md_msg, md->md_from, md->md_icon, rp, md->md_opt, md->md_pkno); } break; case BRO_EV_RECV_ACK: if (debug_flag & 1) fprintf(stderr, "%s に出したメッセージは届いたようです。\n", (char *)call_data); break; case BRO_EV_NO_ACK: error_dialog(toplevel, "not_sent"); if (debug_flag & 1) fprintf(stderr, "%s :メッセージは届かなかったようです。\n", (char *)call_data); break; case BRO_EV_MAX: break; }/* switch */ }/* ipmsg_notify */ /* * */ static void exit_proc(void) { send_IPMSG_BR_EXIT(); }/* exit_proc */ #define DEFSTR(name, class, default) {#name, class, XtRString, sizeof(String), XtOffsetOf(struct appr, name), XtRString, (default)} #define DEFINT(name, class, default) {#name, class, XtRInt, sizeof(int), XtOffsetOf(struct appr, name), XtRImmediate, (XtPointer)(default)} #define DEFBOOL(name, class, default) {#name, class, XtRBoolean, sizeof(Boolean), XtOffsetOf(struct appr, name), XtRImmediate, (XtPointer)(default)} #define TITLE "XIP Messenger V0.8086" /* * */ int main(int argc, char *argv[]) { int ex = 1; static String fallback_resources[] = { #include "xipmsg.ad.h" NULL, }; static XtActionsRec actions[] = { {"direct_call_action", direct_call_action}, {"call_name_list_action", call_name_list_action}, {"iconify_action", iconify_action}, {"disable_action", disable_action}, {"list_key_named_action", list_key_named_action}, }; static XrmOptionDescRec options[] = { /* {option, specifier, argKind, value} */ {"-bogus_fix", ".bogusfix", XrmoptionNoArg, "True"}, {"-broadcast", ".broadcast", XrmoptionSepArg, NULL}, {"-disable", ".disable", XrmoptionNoArg, "True"}, {"-debug", ".debug", XrmoptionSepArg, NULL}, {"-name", ".name", XrmoptionSepArg, NULL}, {"-port", ".port", XrmoptionSepArg, NULL}, }; struct appr { Boolean bogusfix; String broadcast; String debug; Boolean disable; String name; String port; } app_resources; static XtResource resources[] = { /* resource_{name, class, type, size}, */ /* resource_offset, default_type, default_addr */ DEFBOOL(bogusfix, "Bogusfix", False), DEFSTR(broadcast, "Broadcast", "255.255.255.255"), DEFSTR(debug, "Debug", NULL), DEFBOOL(disable, "Disable", False), DEFSTR(name, "Name", NULL), DEFSTR(port, "Port", NULL), }; static char usage_msg[] = "usage: %s " "[-bogus_fix][-disable]" "[-broadcast xx.xx.xx.xx][-debug n]" "[-port n][-name str]" "[Xtoolkit options]" "\n"; myname = argv[0]; XtSetLanguageProc(NULL, NULL, NULL); toplevel = XtVaAppInitialize(&app_con, "XIpmsg", options, XtNumber(options), &argc, argv, fallback_resources, NULL); if (argc > 1) { fprintf(stderr, usage_msg, myname, argv[1]); } else { int port = IPMSG_DEFAULT_PORT, bro_so; char **bros; char *name, entity_name[USERNAME_MAX], hostname[HOSTNAME_MAX]; XtVaGetApplicationResources(toplevel, &app_resources, resources, XtNumber(resources), NULL); XtAppAddActions(app_con, actions, XtNumber(actions)); bogus_fix = app_resources.bogusfix; if (app_resources.debug) debug_flag = strtol(app_resources.debug, NULL, 0); if (app_resources.disable) bro_set_disable(True); if (app_resources.port != NULL) port = strtol(app_resources.port, NULL, 0); if (app_resources.name != NULL) name = app_resources.name; else name = getenv("USER"); if (name == NULL) name = "anonymous"; bros = cvs_list(app_resources.broadcast); strncpyz(entity_name, name, sizeof(entity_name)); gethostname(hostname, sizeof(hostname)); hostname[sizeof(hostname) - 1] = '\0'; if (strchr(hostname, '.') != NULL) *strchr(hostname, '.') = '\0'; bro_so = bro_init(port, entity_name, hostname, (void *)bros); if (bro_so < 0) { fprintf(stderr, "%s: failed to initialize.\n", myname); perror("bro_init"); } else if ((from_db = db_new(FROM_DB_MAX, from_comp)) == NULL) fprintf(stderr, "%s: malloc failed.\n", myname); else { Widget level0, main1, main2, commands, disable; Widget name_view, name_list; ex = 0; csr_clock = XCreateFontCursor(XtDisplay(toplevel), XC_watch); level0 = XtVaCreateManagedWidget("level0", panedWidgetClass, toplevel, NULL); main1 = XtVaCreateManagedWidget("main1", formWidgetClass, level0, NULL); main2 = XtVaCreateManagedWidget("main2", formWidgetClass, level0, NULL); commands = XtVaCreateManagedWidget("commands", panedWidgetClass, main1, NULL); XtVaCreateManagedWidget("icon_label", labelWidgetClass, main1, NULL); XtVaCreateManagedWidget("icon_label2", labelWidgetClass, main1, NULL); name_view = XtVaCreateManagedWidget("name_view", viewportWidgetClass, main2, NULL); name_list = XtVaCreateManagedWidget("name_list", listWidgetClass, name_view, NULL); XawDialogAddButton(commands, "quit", quit_proc, NULL); XawDialogAddButton(commands, "get_zone", get_zone_proc, name_list); XawDialogAddButton(commands, "compose", compose_proc, name_list); disable = XtVaCreateManagedWidget("disable", toggleWidgetClass, commands, XtNstate, app_resources.disable, NULL); XtAddCallback(disable, XtNcallback, disable_proc, NULL); XtRealizeWidget(toplevel); XStoreName(XtDisplay(toplevel), XtWindow(toplevel), TITLE); XSetIconName(XtDisplay(toplevel), XtWindow(toplevel), "xipmsg"); XtAppAddTimeOut(app_con, pause_time, timeout_proc, app_con); XtAppAddInput(app_con, bro_so, (XtPointer)XtInputReadMask, input_proc, NULL); bro_add_callback(BRO_EV_LIST_CHANGED, ipmsg_notify, name_list); bro_add_callback(BRO_EV_RECV_MESSAGE, ipmsg_notify, NULL); bro_add_callback(BRO_EV_RECV_ACK, ipmsg_notify, NULL); bro_add_callback(BRO_EV_NO_ACK, ipmsg_notify, NULL); bro_add_callback(BRO_EV_START_WORK_PROC, ipmsg_notify, app_con); refresh_name_list(name_list); atexit(exit_proc); XtAppMainLoop(app_con); } } return ex; }/* main */ xipmsg-0.8088.orig/brocas.c0000644001001300006200000007240410207572355016000 0ustar gotomgotom00000000000000/* * brocas.c - IP Messenger 1.20 protocol * Copyright (C) 1996, 1997 by Toshihiro Kanda. */ char rcsid_brocas[] = "$Id: brocas.c,v 3.7 1997/05/02 05:47:43 candy Exp candy $"; #include #ifdef USE_VARARGS #include #else #include #endif #include #include #include #include #include #include /* setitimer() */ /* includes below are order dependent */ #include /* htons() */ #include /* socket() */ #include /* socket() */ #include /* inet_addr() INADDR_ANY */ #include /* inet_addr() */ #ifdef SOCKS #include #endif #include "xipmsg.h" #include "kanji.h" #include "brocas.h" #ifdef BOGUS_REALLOC #undef realloc #define realloc(p,s) ((p)?((realloc)(p,s)):malloc(s)) #endif #ifdef NO_SSIZE_T #define ssize_t int #endif #ifdef NO_MEMMOVE #define memmove(d,s,l) bcopy(s,d,l) #endif #include "dyna.h" #if defined BSD4_4 #define SENDTO(s,msg,len,flags,to,tolen) sendto(s,msg,len,flags,to,tolen) #define SETSOCKOPT(s,level,optname,optval,optlen) setsockopt(s,level,optname,optval,optlen) #else #define SENDTO(s,msg,len,flags,to,tolen) sendto(s,msg,len,flags,(struct sockaddr *)to,tolen) #define SETSOCKOPT(s,level,optname,optval,optlen) setsockopt(s,level,optname,(char *)optval,optlen) #endif int debug_flag; static int bro_socket; static int bro_port; static char *bro_user; /* SJIS */ static const char *bro_host; static int bro_disabled; static unsigned long bro_tic; char *myname; #define HH(s) ((int)(((s) % 86400)/3600)) #define MM(s) ((int)(((s) % 3600)/60)) #define SS(s) ((int)((s) % 60)) /* * */ static int #ifdef USE_VARARGS warning(va_alist) va_dcl #else warning(const char *fmt, ...) #endif { struct timeval tv; va_list ap; #ifdef USE_VARARGS const char *fmt; va_start(ap); fmt = va_arg(ap, const char *); #else va_start(ap, fmt); #endif gettimeofday(&tv, NULL); fprintf(stderr, "%02d:%02d:%02d.%06lu ", HH(tv.tv_sec), MM(tv.tv_sec), SS(tv.tv_sec), tv.tv_usec); vfprintf(stderr, fmt, ap); va_end(ap); return 0; }/* warning */ /* * 文字列を len バイト以内にコピーし、'\0' ターミネートする。 */ char * strncpyz(char *dst, const char *src, size_t len) { strncpy(dst, src, len); dst[len - 1] = '\0'; return dst; }/* strncpyz */ /* * */ static int #ifdef USE_VARARGS error(va_alist) va_dcl #else error(const char *fmt, ...) #endif { va_list ap; #ifdef USE_VARARGS const char *fmt; va_start(ap); fmt = va_arg(ap, const char *); #else va_start(ap, fmt); #endif fprintf(stderr, "%s: ", myname); vfprintf(stderr, fmt, ap); fprintf(stderr, ": "); perror(NULL); va_end(ap); return 0; }/* error */ /* * 文字列を malloc() して複製する。 * あとで free(3) してちょ。 */ char * str_dup(const char *s) { char *p = malloc(strlen(s) + 1); if (p != NULL) strcpy(p, s); return p; }/* str_dup */ /* * 文字列の n 個目の ch の位置を返す。 * n == 1 なら strchr() と同じ。n == 0 なら NULL */ char * strnchr(const char *s, int ch, size_t n) { if (n == 0) s = NULL; while (s != NULL && n-- != 0) { s = strchr(s, ch); if (s != NULL && *s != '\0' && n != 0) s++; }/* while */ return (char *)s; }/* strnchr */ /* * 文字列同士を tolower() しながら比較する。 */ int strcmpi(const char *d_, const char *s_) { const unsigned char *d = (const unsigned char *)d_, *s = (const unsigned char *)s_; int cp; while ((cp = tolower(*d) - tolower(*s)) == 0 && *d != '\0') { d++; s++; }/* while */ return cp; }/* strcmpi */ /* * 文字列同士を tolower() しながら、長くとも n バイト比較する。 */ int strncmpi(const char *d_, const char *s_, size_t n) { const unsigned char *d = (const unsigned char *)d_, *s = (const unsigned char *)s_; int cp = 0; while (n-- != 0 && (cp = tolower(*d) - tolower(*s)) == 0 && *d != '\0') { d++; s++; }/* while */ return cp; }/* strcmpi */ /* * 末尾の空白文字の列を無くす。 */ static char * strtrim(char *str) { char *p = strchr(str, '\0'); while (p-- != str && isascii(*p) && isspace(*p)) *p = '\0'; return str; }/* strtrim */ /* * シフトJIS 文字列を EUC にして複製する。 * あとで free(3) してちょ。 */ static char * strstedup(const char *s) { size_t len = strstoelen(s); char *p = malloc(len + 1); if (p != NULL) strstoe(p, s); return p; }/* strstedup */ #if 0 /* [ */ /* * bit 並びを反転させながらの memcpy */ static unsigned char * rev_memcpy(void *d_, const void *s_, size_t n) { static unsigned char byte_rev[256] = { 0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0, 0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0, 0x08, 0x88, 0x48, 0xc8, 0x28, 0xa8, 0x68, 0xe8, 0x18, 0x98, 0x58, 0xd8, 0x38, 0xb8, 0x78, 0xf8, 0x04, 0x84, 0x44, 0xc4, 0x24, 0xa4, 0x64, 0xe4, 0x14, 0x94, 0x54, 0xd4, 0x34, 0xb4, 0x74, 0xf4, 0x0c, 0x8c, 0x4c, 0xcc, 0x2c, 0xac, 0x6c, 0xec, 0x1c, 0x9c, 0x5c, 0xdc, 0x3c, 0xbc, 0x7c, 0xfc, 0x02, 0x82, 0x42, 0xc2, 0x22, 0xa2, 0x62, 0xe2, 0x12, 0x92, 0x52, 0xd2, 0x32, 0xb2, 0x72, 0xf2, 0x0a, 0x8a, 0x4a, 0xca, 0x2a, 0xaa, 0x6a, 0xea, 0x1a, 0x9a, 0x5a, 0xda, 0x3a, 0xba, 0x7a, 0xfa, 0x06, 0x86, 0x46, 0xc6, 0x26, 0xa6, 0x66, 0xe6, 0x16, 0x96, 0x56, 0xd6, 0x36, 0xb6, 0x76, 0xf6, 0x0e, 0x8e, 0x4e, 0xce, 0x2e, 0xae, 0x6e, 0xee, 0x1e, 0x9e, 0x5e, 0xde, 0x3e, 0xbe, 0x7e, 0xfe, 0x01, 0x81, 0x41, 0xc1, 0x21, 0xa1, 0x61, 0xe1, 0x11, 0x91, 0x51, 0xd1, 0x31, 0xb1, 0x71, 0xf1, 0x09, 0x89, 0x49, 0xc9, 0x29, 0xa9, 0x69, 0xe9, 0x19, 0x99, 0x59, 0xd9, 0x39, 0xb9, 0x79, 0xf9, 0x05, 0x85, 0x45, 0xc5, 0x25, 0xa5, 0x65, 0xe5, 0x15, 0x95, 0x55, 0xd5, 0x35, 0xb5, 0x75, 0xf5, 0x0d, 0x8d, 0x4d, 0xcd, 0x2d, 0xad, 0x6d, 0xed, 0x1d, 0x9d, 0x5d, 0xdd, 0x3d, 0xbd, 0x7d, 0xfd, 0x03, 0x83, 0x43, 0xc3, 0x23, 0xa3, 0x63, 0xe3, 0x13, 0x93, 0x53, 0xd3, 0x33, 0xb3, 0x73, 0xf3, 0x0b, 0x8b, 0x4b, 0xcb, 0x2b, 0xab, 0x6b, 0xeb, 0x1b, 0x9b, 0x5b, 0xdb, 0x3b, 0xbb, 0x7b, 0xfb, 0x07, 0x87, 0x47, 0xc7, 0x27, 0xa7, 0x67, 0xe7, 0x17, 0x97, 0x57, 0xd7, 0x37, 0xb7, 0x77, 0xf7, 0x0f, 0x8f, 0x4f, 0xcf, 0x2f, 0xaf, 0x6f, 0xef, 0x1f, 0x9f, 0x5f, 0xdf, 0x3f, 0xbf, 0x7f, 0xff, }; int i; unsigned char *d = d_; const unsigned char *s = s_; for (i = 0; i < n; i++) *d++ = byte_rev[*s++]; return d_; }/* rev_memcpy */ #endif /* ] */ /* * EUC の 2 byte もじをぶった切らないように、 column で改行する。 */ static char * wrap_euc(char *d_, const char *s_, int column) { unsigned char *d = (unsigned char *)d_; const unsigned char *s = (const unsigned char *)s_; size_t c = 0; while (*s != '\0') { if (*s == '\n') { *d++ = *s++; c = 0; } else if (is1euc(*s)) { if ((c + 2) > column) { *d++ = '\n'; c = 0; } *d++ = *s++; c++; if (*s != '\0') { *d++ = *s++; c++; } } else { if ((c + 1) > column) { *d++ = '\n'; c = 0; } *d++ = *s++; c++; } }/* while */ *d = '\0'; return d_; }/* wrap_euc */ /* * wrap_euc() する時の長さ。 */ static size_t wrap_euclen(const char *s_, int column) { size_t ins = 0, c = 0; const unsigned char *s = (const unsigned char *)s_; while (*s != '\0') { if (*s == '\n') { s++; c = 0; } else if (is1euc(*s)) { if ((c + 2) > column) { ins++; c = 0; } s++; c++; if (*s != '\0') { s++; c++; } } else { if ((c + 1) > column) { ins++; c = 0; } s++; c++; } }/* while */ return strlen(s_) + ins; }/* wrap_euclen */ /* * コールバック [ */ struct bro_cb_t { bro_callback_t cb_proc; void *cb_closure; }; struct bro_cb_t bro_cbacks[BRO_EV_MAX]; /* * イベント e が起きた時のコールバックルーチンと、 * クライアントデータ closure を登録する。 */ int bro_add_callback(enum bro_event_t e, bro_callback_t callback, void *closure) { int err = -1; if (e < BRO_EV_MAX) { bro_cbacks[e].cb_proc = callback; bro_cbacks[e].cb_closure = closure; err = 0; } return err; }/* bro_add_callback */ /* * イベント e に対応するコールバックルーチンを呼び出す。 */ static int call_cback(enum bro_event_t e, void *call_data) { int err = -1; if (e < BRO_EV_MAX) { bro_callback_t cback = bro_cbacks[e].cb_proc; if (cback != NULL) { cback(e, bro_cbacks[e].cb_closure, call_data); } } return err; }/* call_cback */ /* ] コールバック */ /* * パケット再送信 [ */ #define XQ_REXMT 2 /* 再送する間隔 [500msec 単位] */ #define XQ_KEEP 40 /* あきらめる時間 [500msec 単位] */ struct xq_t { struct xq_t *xq_next; unsigned long xq_id; /* 識別子 */ int xq_so; union saddr xq_saddr; void *xq_buf; /* malloc()'ed */ size_t xq_size; int xq_keep; /* 0 になったら、あきらめる。 */ int xq_rexmt; /* 0 になったら、再送信する。 */ int xq_rexmt0; int xq_givenup; /* あきらめたフラグ */ }; /* * 構造体を初期化する。 */ static struct xq_t * xq_initone(struct xq_t *xq) { memset(xq, '\0', sizeof(*xq)); xq->xq_rexmt0 = XQ_REXMT; xq->xq_rexmt = XQ_REXMT; xq->xq_keep = XQ_KEEP; return xq; }/* xq_initone */ struct xq_t *xq_base; /* キュー */ /* * キューに入れる。 */ struct xq_t * xq_enq(struct xq_t *xq) { xq->xq_next = xq_base; xq_base = xq; return xq; }/* xq_enq */ /* * キューから外す。 */ static void xq_deq(struct xq_t *dst) { if (dst != NULL) { if (dst == xq_base) { xq_base = dst->xq_next; } else { struct xq_t *xq = xq_base; while (xq != NULL && xq->xq_next != dst) xq = xq->xq_next; if (xq != NULL) xq->xq_next = dst->xq_next; } } }/* xq_deq */ /* * 識別子 id を持つエントリを探す。 */ static struct xq_t * xq_lookup(unsigned long id) { struct xq_t *xq = xq_base; while (xq != NULL && xq->xq_id != id) xq = xq->xq_next; return xq; }/* xq_lookup */ /* * パケット送信する。 */ static int xq_transmit(struct xq_t *xq) { int flags = 0; int err = SENDTO(xq->xq_so, xq->xq_buf, xq->xq_size, flags, &xq->xq_saddr.sa, sizeof(xq->xq_saddr.sin)); if (err < 0) error("sendto"); if (debug_flag & 2) warning("xq_xmit(%p %lu)\n", xq, xq->xq_id); return err; }/* xq_transmit */ static int xq_givenup; /* * 500msec 毎に呼び出される、タイマルーチン。 */ static void xq_timers(void) { struct xq_t *xq = xq_base; while (xq != NULL) { if (!xq->xq_givenup) { if (--(xq->xq_keep) == 0) { /* あきらめる。 */ xq->xq_givenup = 1; if (xq_givenup++ == 0) call_cback(BRO_EV_START_WORK_PROC, NULL); } else if (--(xq->xq_rexmt) == 0) { /* 再送信する。 */ xq_transmit(xq); xq->xq_rexmt0 = xq->xq_rexmt0 * 3 / 2; xq->xq_rexmt = xq->xq_rexmt0; } } xq = xq->xq_next; }/* while */ }/* xq_timers */ /* * */ static void xq_work_proc(void) { if (xq_givenup) { struct xq_t *xq = xq_base; while (xq != NULL) { struct xq_t *next = xq->xq_next; if (xq->xq_givenup) { char lbuf[64], *p; size_t size; memset(lbuf, '\0', sizeof(lbuf)); sprintf(lbuf, "%16s.%d ", inet_ntoa(xq->xq_saddr.sin.sin_addr), ntohs(xq->xq_saddr.sin.sin_port)); p = strchr(lbuf, '\0'); size = sizeof(lbuf) - (p - lbuf); memcpy(p, xq->xq_buf, MIN(xq->xq_size, size - 1)); call_cback(BRO_EV_NO_ACK, lbuf); xq_deq(xq); free(xq->xq_buf); free(xq); } xq = next; }/* while */ xq_givenup = 0; } }/* xq_work_proc */ /* ] パケット再送信 */ static size_t iov_total(const struct iov_t *v) { size_t total = 0; while (v != NULL) { total += v->iov_len; v = v->iov_next; }/* while */ return total; }/* iov_total */ static void * iov_gather(void *buf_, const struct iov_t *v) { char *buf = buf_; while (v != NULL) { memcpy(buf, v->iov_base, v->iov_len); buf += v->iov_len; v = v->iov_next; }/* while */ return buf_; }/* iov_gather */ /* * */ static int p_sendtov(int so, const union saddr *to, unsigned long pno, const struct iov_t *iov) { int err = -1; struct xq_t *xq = malloc(sizeof(*xq)); if (xq != NULL) { size_t total = iov_total(iov); char *buf = malloc(total); if (buf != NULL) { iov_gather(buf, iov); xq_initone(xq); xq->xq_id = pno; xq->xq_so = so; xq->xq_saddr = *to; xq->xq_buf = buf; xq->xq_size = total; err = xq_transmit(xq); if (err >= 0) xq_enq(xq); else { free(xq->xq_buf); free(xq); } } } return err; }/* p_sendtov */ /* * ソケット so からパケットを受信する。 */ static ssize_t p_get(int so, union saddr *from, int msec, void *buf, size_t size) { ssize_t err; struct timeval tv; fd_set readfds; FD_ZERO(&readfds); FD_SET(so, &readfds); tv.tv_sec = msec / 1000; tv.tv_usec = (msec % 1000) * 1000; err = select(so + 1, &readfds, NULL, NULL, &tv); if (err > 0) { int flags = 0, fromlen = sizeof(from->sa); err = recvfrom(so, buf, size, flags, &from->sa, &fromlen); if (err < 0) perror("recvfrom"); } return err; }/* p_get */ static ssize_t sendtov(int so, int flags, const struct sockaddr *to, int tolen, const struct iov_t *iov) { ssize_t err = -1; size_t total = iov_total(iov); char *buf = malloc(total); if (buf != NULL) { iov_gather(buf, iov); err = SENDTO(so, buf, total, flags, to, tolen); if (err < 0) error("sendto"); free(buf); } return err; }/* sendtov */ static unsigned long msg_number; static int send_msgv(int so, const union saddr *to, unsigned long command, int retryflag, const struct iov_t *iov) { char lbuf[2 + 12 + USERNAME_MAX + 1 + HOSTNAME_MAX + 1 + 12]; int err, flags = 0; struct iov_t v; sprintf(lbuf, "1:%ld:%.*s:%.*s:%lu:", msg_number++, USERNAME_MAX, bro_user, HOSTNAME_MAX, bro_host, command); SET_IOV(&v, (void *)iov, lbuf, strlen(lbuf)); if (retryflag) { err = p_sendtov(so, to, msg_number - 1, &v); } else { err = sendtov(so, flags, &to->sa, sizeof(to->sin), &v); } return err; }/* send_msgv */ static int send_msg(int so, const union saddr *to, unsigned long command, const char *msg) { char lbuf[2 + 12 + USERNAME_MAX + 1 + HOSTNAME_MAX + 1 + 12]; int err, flags = 0; struct iov_t v[2]; sprintf(lbuf, "1:%ld:%.*s:%.*s:%lu:", msg_number++, USERNAME_MAX, bro_user, HOSTNAME_MAX, bro_host, command); SET_IOV(&v[0], &v[1], lbuf, strlen(lbuf)); SET_IOV(&v[1], NULL, (void *)msg, strlen(msg) + 1); err = sendtov(so, flags, &to->sa, sizeof(to->sin), v); return err; }/* send_msg */ /* */ int bro_send(const char *msg, const unsigned char *icon, const struct maddr_t *ma) { int err = -1; char *sjis = malloc(strlen(msg) + 1); if (sjis != NULL) { unsigned long cmd = IPMSG_SENDMSG | IPMSG_SENDCHECKOPT; int retry = 1; struct iov_t v[2]; stretos(sjis, msg); SET_IOV(&v[0], &v[1], sjis, strlen(sjis) + 1); SET_IOV(&v[1], NULL, (void *)icon, 128); if (send_msgv(ma->m_so, &ma->m_saddr, cmd, retry, v) > 0) err = 0; free(sjis); } return err; }/* bro_send */ /* * 名前リストの管理 [ */ struct dyns_t STRUCT_DYNA(struct ns_t); struct dyns_t dyns; /* * INET ソケットアドレスの大小比較 */ static int cmp_sin(const struct sockaddr_in *d, const struct sockaddr_in *s) { unsigned long da = d->sin_addr.s_addr, sa = s->sin_addr.s_addr; int cmp = da == sa ? 0 : (da < sa ? -1 : 1); #if 0 /* port 番号は比較対象としない */ if (cmp == 0) { cmp = ntohs(d->sin_port) - ntohs(s->sin_port); } #endif return cmp; }/* cmp_sin */ /* * */ static int ns_cmp(const void *d_, const void *s_) { const struct ns_t *d = d_, *s = s_; const struct maddr_t *dm = &d->ns_maddr, *sm = &s->ns_maddr; int cmp = strcmpi(dm->m_user, sm->m_user); if (cmp == 0) { cmp = cmp_sin(&dm->m_saddr.sin, &sm->m_saddr.sin); } return cmp; }/* ns_cmp */ /* * 名前リストから検索する */ struct ns_t * ns_lookup(const struct maddr_t *ma) { struct ns_t *ret = NULL; struct ns_t *ls = DYNA_BUF(&dyns); if (ls != NULL) { int n = DYNA_USED(&dyns); struct ns_t key; key.ns_maddr = *ma; ret = bsearch(&key, ls, n, sizeof(*ls), ns_cmp); } return ret; }/* ns_lookup */ /* * */ struct ns_t * ns_get(int idx) { struct ns_t *ret = NULL; struct ns_t *ls = DYNA_BUF(&dyns); if (ls != NULL) { int n = DYNA_USED(&dyns); if (idx >= 0 && idx < n) ret = &ls[idx]; } return ret; }/* ns_get */ /* * 新しいエントリを作る。 */ static struct ns_t * ns_new(const struct maddr_t *ma) { struct ns_t *ret = DYNA_NEXT(&dyns); if (ret != NULL) { struct ns_t key; struct ns_t *ls = DYNA_BUF(&dyns); int i = 0, n = DYNA_USED(&dyns) - 1; key.ns_maddr = *ma; while (i < n && ns_cmp(&key, &ls[i]) > 0) { i++; }/* while */ memmove(&ls[i + 1], &ls[i], sizeof(*ls) * (n - i)); ret = &ls[i]; memset(ret, '\0', sizeof(*ret)); } return ret; }/* ns_new */ /* * */ void ns_free(const struct maddr_t *ma) { struct ns_t *ns = ns_lookup(ma); if (ns != NULL) { struct ns_t *ls = DYNA_BUF(&dyns); int i = ns - ls, n = DYNA_USED(&dyns); memmove(&ls[i], &ls[i + 1], sizeof(*ls) * (n - i - 1)); DYNA_UNGROW(&dyns, 1); } }/* ns_free */ /* * */ void ns_clear(void) { DYNA_RESET(&dyns); }/* ns_clear */ /* * */ char ** ns_list(void) { int n = DYNA_USED(&dyns); static char **last; char **ls = malloc(sizeof(*ls) * (n + 1)); if (last != NULL) { char **mv = last; while (*mv != NULL) free(*mv++); free(last); last = NULL; } if (ls != NULL) { int i; struct ns_t *ns = DYNA_BUF(&dyns); for (i = 0; i < n; i++, ns++) { size_t len = strlen(ns->ns_nick) + 1 + strlen(ns->ns_host); ls[i] = malloc(len + 1); if (ls[i] != NULL) { strcat(strcat(strcpy(ls[i], ns->ns_nick), "@"), ns->ns_host); } }/* for */ ls[n] = NULL; } last = ls; return ls; }/* ns_list */ /* ] 名前リストの管理 */ /* * 同一パケットのフィルタリング [ * * 名前リストのエントリ毎に受信パケットリストを持つ。 * 最も最近受信したパケットがリストの先頭にくるようにする。 * 受信後一定時間経ったらリストから削除する。 */ #define RCV_KEEP (60*2) /* 保持する時間 [tic] */ /* * パケット番号 id が受信リストにあるかどうか調べる。 */ static int rcv_id_lookup(struct rcv_t *rcv, unsigned long id) { int idx = 0; struct rcv_q_t *q = rcv->rcv_q; while (idx < rcv->rcv_used && q[idx].q_id != id) idx++; if (idx >= rcv->rcv_used) idx = -1; return idx; }/* rcv_id_lookup */ /* * パケット番号 id と、保持する時間を受信リストに記録する。 */ static int rcv_add(struct rcv_t *rcv, unsigned long id) { int err = -1; struct rcv_q_t *q = rcv->rcv_q; size_t size = rcv->rcv_size; if (rcv->rcv_used >= size) { size = size == 0 ? 64 : size * 2; q = realloc(q, size); if (q != NULL) { rcv->rcv_q = q; rcv->rcv_size = size; } } if (q != NULL) { memmove(q + 1, q, sizeof(*q) * rcv->rcv_used); rcv->rcv_used++; q->q_keep = bro_tic + RCV_KEEP; q->q_id = id; if (debug_flag & 2) warning("add: %lu %lu\n", q->q_id, q->q_keep); err = 0; } return err; }/* rcv_add */ /* * パケット番号 id をリストの先頭に移動する。 */ static int rcv_raise(struct rcv_t *rcv, unsigned long id) { int i = rcv_id_lookup(rcv, id); if (i >= 0) { struct rcv_q_t *q = rcv->rcv_q; struct rcv_q_t x = q[i]; memmove(&q[1], q, i); *q = x; q->q_keep = bro_tic + RCV_KEEP; if (debug_flag & 2) warning("raise: %lu %lu\n", q->q_id, q->q_keep); } return 0; }/* rcv_raise */ /* * 一定時間経ったものは削除する。 */ static int rcv_delete(struct rcv_t *rcv) { struct rcv_q_t *q = rcv->rcv_q; int i = rcv->rcv_used; while (--i >= 0 && q[i].q_keep < bro_tic) if (debug_flag & 2) warning("delete: %lu %lu %lu\n", bro_tic, q[i].q_keep, q[i].q_id); i++; if (i + 1 < rcv->rcv_used) memmove(&q[i], &q[i + 1], sizeof(*q) * (rcv->rcv_used - (i + 1))); rcv->rcv_used = i; return 0; }/* rcv_delete */ /* ] 同一パケットのフィルタリング */ /* * ネットワークの登録 */ struct dynet_t STRUCT_DYNA(union saddr); struct dynet_t dynet; static int network_add(const char *broad) { union saddr *net; net = DYNA_NEXT(&dynet); if (net != NULL) { memset(net, '\0', sizeof(*net)); net->sin.sin_family = AF_INET; net->sin.sin_addr.s_addr = inet_addr(broad); net->sin.sin_port = htons(bro_port); } return 0; }/* network_add */ static int network_bro_send(int so, unsigned long cmd, const char *msg) { union saddr *sin = DYNA_BUF(&dynet); if (sin != NULL) { int i, err; for (i = 0; i < DYNA_USED(&dynet); i++) { err = send_msg(so, sin, cmd, msg); sin++; }/* for */ } return 0; }/* network_bro_send */ /* */ int send_IPMSG_READMSG(struct maddr_t *replyto, unsigned long pkno) { char lbuf[20]; sprintf(lbuf, "%lu", pkno); send_msg(replyto->m_so, &replyto->m_saddr, IPMSG_READMSG, lbuf); return 0; }/* send_IPMSG_READMSG */ /* * 起動時など、BR_ENTRY をブロードキャストする。 */ int send_IPMSG_BR_ENTRY(void) { network_bro_send(bro_socket, IPMSG_BR_ENTRY, ""); return 0; }/* send_IPMSG_BR_ENTRY */ /* * 終了時、BR_EXIT をブロードキャストする。 */ int send_IPMSG_BR_EXIT(void) { network_bro_send(bro_socket, IPMSG_BR_EXIT, ""); return 0; }/* send_IPMSG_BR_EXIT */ /* * BR_ENTRY を受け取ったら、それに ANSENTRY を返す。 */ static int reply_IPMSG_ANSENTRY(int so, const union saddr *from) { int err = 0; if (!bro_disabled) err = send_msg(so, from, IPMSG_ANSENTRY, ""); return err; }/* reply_IPMSG_ANSENTRY */ /* * 受信メッセージにオプション IPMSG_SENDCHECKOPT がついていたら * 確認パケットを返す。 */ static int reply_IPMSG_RECVMSG(int so, const union saddr *from, unsigned long pkno) { char lbuf[32]; int err; sprintf(lbuf, "%lu", pkno); err = send_msg(so, from, IPMSG_RECVMSG, lbuf); return err; }/* reply_IPMSG_RECVMSG */ /* * 受け取ったパケットの送り手は、すべて名前リストに登録する。 */ static struct ns_t * add_ns_entry(const struct maddr_t *ma, const char *host, const char *nick, const char *aux) { struct ns_t *ns = ns_lookup(ma); if (ns == NULL) { ns = ns_new(ma); } if (ns != NULL) { ns->ns_maddr = *ma; strncpyz(ns->ns_host, host, sizeof(ns->ns_host)); if (nick != NULL) strncpyz(ns->ns_nick, nick, sizeof(ns->ns_nick)); if (ns->ns_nick[0] == '\0' && aux != NULL) strncpyz(ns->ns_nick, aux, sizeof(ns->ns_nick)); call_cback(BRO_EV_LIST_CHANGED, NULL); } return ns; }/* add_ns_entry */ static void delete_ns_entry(const struct maddr_t *ma) { ns_free(ma); }/* delete_ns_entry */ /* * パケット処理部はここから [ */ static int recv_IPMSG_NOOPERATION(const struct packet_t *pk) { return 0; }/* recv_IPMSG_NOOPERATION */ /* * 新規ノードが立ち上がった * pk->pk_msg == ニックネーム */ static int recv_IPMSG_BR_ENTRY(const struct packet_t *pk) { char *nick = pk->pk_msg[0] != '\0' ? pk->pk_msg : pk->pk_user; reply_IPMSG_ANSENTRY(pk->pk_maddr.m_so, &pk->pk_maddr.m_saddr); add_ns_entry(&pk->pk_maddr, pk->pk_host, nick, NULL); call_cback(BRO_EV_LIST_CHANGED, NULL); return 0; }/* recv_IPMSG_BR_ENTRY */ /* * ノード終了した。 * pk->pk_msg == ニックネーム */ static int recv_IPMSG_BR_EXIT(const struct packet_t *pk) { delete_ns_entry(&pk->pk_maddr); call_cback(BRO_EV_LIST_CHANGED, NULL); return 0; }/* recv_IPMSG_BR_EXIT */ /* * BR_ENTRY の返事が来た。 * pk->pk_msg == ニックネーム */ static int recv_IPMSG_ANSENTRY(const struct packet_t *pk) { char *nick = pk->pk_msg[0] != '\0' ? pk->pk_msg : pk->pk_user; add_ns_entry(&pk->pk_maddr, pk->pk_host, nick, NULL); call_cback(BRO_EV_LIST_CHANGED, NULL); return 0; }/* recv_IPMSG_ANSENTRY */ static int recv_IPMSG_ABSENCE(const struct packet_t *pk) { return 0; }/* recv_IPMSG_ABSENCE */ static int recv_IPMSG_BR_ISGETLIST(const struct packet_t *pk) { return 0; }/* recv_IPMSG_BR_ISGETLIST */ static int recv_IPMSG_OKGETLIST(const struct packet_t *pk) { return 0; }/* recv_IPMSG_OKGETLIST */ static int recv_IPMSG_GETLIST(const struct packet_t *pk) { return 0; }/* recv_IPMSG_GETLIST */ static int recv_IPMSG_ANSLIST(const struct packet_t *pk) { return 0; }/* recv_IPMSG_ANSLIST */ /* * メッセージが届いた。 */ static int recv_IPMSG_SENDMSG(const struct packet_t *pk) { char *nick = pk->pk_user; struct ns_t *ns = add_ns_entry(&pk->pk_maddr, pk->pk_host, NULL, nick); unsigned long opt = GET_OPT(pk->pk_cmd); int ignore = 0; if (ns != NULL) { nick = ns->ns_nick; rcv_delete(&ns->ns_rcv); if (rcv_id_lookup(&ns->ns_rcv, pk->pk_no) < 0) rcv_add(&ns->ns_rcv, pk->pk_no); else { rcv_raise(&ns->ns_rcv, pk->pk_no); ignore = 1; } } if ((opt & IPMSG_SENDCHECKOPT) && !(opt & (IPMSG_BROADCASTOPT | IPMSG_AUTORETOPT))) reply_IPMSG_RECVMSG(pk->pk_maddr.m_so, &pk->pk_maddr.m_saddr, pk->pk_no); if (!ignore) { #define BRO_COLUMNS 58 size_t wraplen = wrap_euclen(pk->pk_msg, BRO_COLUMNS); char *wrapbuf = malloc(wraplen + 1); if (wrapbuf != NULL) { char idname[USERNAME_MAX + HOSTNAME_MAX]; struct msg_data_t md; wrap_euc(wrapbuf, pk->pk_msg, BRO_COLUMNS); strtrim(wrapbuf); strcat(strcat(strncpyz(idname, nick, USERNAME_MAX), "@"), ns->ns_host); md.md_replyto = (void *)&pk->pk_maddr; md.md_msg = wrapbuf; md.md_icon = pk->pk_icon; md.md_opt = opt; md.md_pkno = pk->pk_no; md.md_from = idname; call_cback(BRO_EV_RECV_MESSAGE, &md); free(wrapbuf); } else error("malloc"); } return 0; }/* recv_IPMSG_SENDMSG */ /* * 送ったメッセージの受信確認パケットが帰って来た。 * msg == 送ったメッセージの番号 */ static int recv_IPMSG_RECVMSG(const struct packet_t *pk) { struct xq_t *xq = xq_lookup(strtol(pk->pk_msg, NULL, 10)); if (xq != NULL) { char lbuf[80]; xq_deq(xq); sprintf(lbuf, "%16s.%d ", inet_ntoa(xq->xq_saddr.sin.sin_addr), ntohs(xq->xq_saddr.sin.sin_port)); call_cback(BRO_EV_RECV_ACK, lbuf); free(xq->xq_buf); free(xq); } return 0; }/* recv_IPMSG_RECVMSG */ static int recv_IPMSG_READMSG(const struct packet_t *pk) { return 0; }/* recv_IPMSG_READMSG */ static int recv_IPMSG_DELMSG(const struct packet_t *pk) { return 0; }/* recv_IPMSG_DELMSG */ static int recv_IPMSG_GETINFO(const struct packet_t *pk) { return 0; }/* recv_IPMSG_GETINFO */ static int recv_IPMSG_SENDINFO(const struct packet_t *pk) { return 0; }/* recv_IPMSG_SENDINFO */ /* * */ static int do_cmd(struct packet_t *pk) { unsigned long cmd = GET_MODE(pk->pk_cmd); switch (cmd) { case IPMSG_NOOPERATION: /* 無操作 */ recv_IPMSG_NOOPERATION(pk); break; case IPMSG_BR_ENTRY: /* サービスにエントリー(起動時にBroadcast) */ recv_IPMSG_BR_ENTRY(pk); break; case IPMSG_BR_EXIT: /* サービスから抜ける(終了時にBroadcast) */ recv_IPMSG_BR_EXIT(pk); break; case IPMSG_ANSENTRY: /* サービスにエントリーを認識 */ recv_IPMSG_ANSENTRY(pk); break; case IPMSG_BR_ABSENCE: /* 不在モード変更 */ recv_IPMSG_ABSENCE(pk); break; case IPMSG_BR_ISGETLIST: /* ホストリスト送出可能メンバの探索 */ recv_IPMSG_BR_ISGETLIST(pk); break; case IPMSG_OKGETLIST: /* ホストリスト送出可能通知 */ recv_IPMSG_OKGETLIST(pk); break; case IPMSG_GETLIST: /* ホストリスト送出要求 */ recv_IPMSG_GETLIST(pk); break; case IPMSG_ANSLIST: /* ホストリスト送出 */ recv_IPMSG_ANSLIST(pk); break; case IPMSG_SENDMSG: /* メッセージの送信 */ recv_IPMSG_SENDMSG(pk); break; case IPMSG_RECVMSG: /* メッセージの受信確認 */ recv_IPMSG_RECVMSG(pk); break; case IPMSG_READMSG: /* 封書の開封通知 */ recv_IPMSG_READMSG(pk); break; case IPMSG_DELMSG: /* 封書破棄通知 */ recv_IPMSG_DELMSG(pk); break; case IPMSG_GETINFO: recv_IPMSG_GETINFO(pk); break; case IPMSG_SENDINFO: recv_IPMSG_SENDINFO(pk); break; }/* switch */ return 0; }/* do_cmd */ static struct packet_t * decode_packet(char *lbuf, size_t size, struct packet_t *pk) { /* Ver(1):Packet番号 : 自User名 : 自Host名 : Command番号 : 追加部*/ struct packet_t *ret = NULL; char *user, *host, *msg; sscanf(lbuf, "%lu:%lu:%*[^:]:%*[^:]:%lu", &pk->pk_ver, &pk->pk_no, &pk->pk_cmd); user = strnchr(lbuf, ':', 2); if (user != NULL) { user++; host = strnchr(lbuf, ':', 3); if (host != NULL) { host++; msg = strnchr(lbuf, ':', 5); if (msg != NULL) { msg++; *strchr(user, ':') = '\0'; *strchr(host, ':') = '\0'; pk->pk_user = user; pk->pk_host = host; pk->pk_msg = msg; ret = pk; } } } return ret; }/* decode_packet */ /* * パケットが届いた時呼び出される。 */ int bro_recv_packet(int so) { struct packet_t pk; char sbuf[MESSAGE_MAX]; union saddr *from = &pk.pk_maddr.m_saddr; ssize_t size = p_get(so, from, 0, sbuf, sizeof(sbuf) - 1); if (size > 0) { char ebuf[sizeof(sbuf) * 2], *p; unsigned char icon[128]; size_t iconsize; sbuf[size] = '\0'; p = strchr(sbuf, '\0') + 1; iconsize = MIN(sizeof(icon), size - (p - sbuf)); memset(icon, '\0', sizeof(icon)); memcpy(icon, p, iconsize); strstoe(ebuf, sbuf); size = strlen(ebuf) + 1; if (debug_flag & 2) { warning("%d: %16s.%d [", so, inet_ntoa(from->sin.sin_addr), ntohs(from->sin.sin_port)); fputs(ebuf, stderr); fputs("]\n", stderr); } if (decode_packet(ebuf, size, &pk) != NULL) { pk.pk_maddr.m_so = so; pk.pk_icon = icon; strncpyz(pk.pk_maddr.m_user, pk.pk_user, sizeof(pk.pk_maddr.m_user)); do_cmd(&pk); } else warning("bad packet.\n"); } return 0; }/* recv_packet */ /* ] パケット処理部おわり */ /* * タイムアウト処理 * 1 秒毎に呼び出される。 */ void bro_job(void) { bro_tic++; xq_timers(); }/* bro_job */ /* * 暇な時呼び出される。 */ void bro_work(void) { xq_work_proc(); }/* bro_job */ /* * */ int bro_set_disable(int disable) { bro_disabled = disable; return 0; }/* bro_set_disable */ /* * */ int bro_init(int port, const char *user, const char *host, const char * const *bros) { int so; #ifdef SOCKS SOCKSinit(myname); #endif so = socket(PF_INET, SOCK_DGRAM, 0); DYNA_IZ(&dynet, 32); bro_user = malloc(strlen(user) + 1); if (bro_user != NULL) { stretos(bro_user, user); bro_port = port; bro_host = host; msg_number = time(NULL); while (*bros != NULL) network_add(*bros++); if (so >= 0) { int optval = 1; int err = SETSOCKOPT(so, SOL_SOCKET, SO_BROADCAST, &optval, sizeof(optval)); if (err >= 0) { int err; union saddr sa; memset(&sa, '\0', sizeof(sa)); sa.sin.sin_family = AF_INET; sa.sin.sin_addr.s_addr = INADDR_ANY; sa.sin.sin_port = htons(port); err = bind(so, &sa.sa, sizeof(sa)); } if (err < 0) { close(so); so = -1; } } } bro_socket = so; return so; }/* bro_init */ xipmsg-0.8088.orig/kanji.c0000644001001300006200000002626706332312602015620 0ustar gotomgotom00000000000000/* * kanji.c - kanji code converter * Copyright (C) 1994, 1996 by candy */ const char rcsid_kanji[] = "$Id: kanji.c,v 3.7 1997/05/02 04:06:57 candy Exp candy $"; #include #include #include "kanji.h" int kanji_in = '@'; int kanji_out = 'J'; static int etoj(int wc); static int etos(int wc); static int jtoe(int wc); static int jtos(int wc); static int stoe(int wc); static int stoj(int wc); static int get_euc(struct MB *mb, int ch, int (*put)(int)); static int get_sjis(struct MB *mb, int ch, int (*put)(int)); static int get_jis(struct MB *mb, int ch, int (*put)(int)); /* * EUC を JIS 0x2121..0x7e7e * 0x00 .. 0xff はそのまま。 */ static int etoj(int wc) { int ret, hib = (wc >> 8) & 0x7f, lob = wc & 0x7f; if (hib != 0) ret = (hib << 8) | lob; else ret = wc; return ret; }/* etoj */ /* * EUC を shift-JIS * 0x00 .. 0xff はそのまま。 */ static int etos(int wc) { int ret, hib = (wc >> 8) & 0x7f, lob = wc & 0x7f; if ((wc & 0xff00) == 0x8e00) { ret = wc & 0xff; } else if (hib != 0) ret = jtos((hib << 8) | lob); else ret = wc; return ret; }/* etos */ /* * JIS 0x2121..0x7e7e を EUC * 0x00 .. 0xff はそのまま。 */ static int jtoe(int wc) { int ret, hib = (wc >> 8) & 0xff, lob = wc & 0xff; if (hib != 0) ret = ((hib | 0x80) << 8) | (lob | 0x80); else ret = wc; return ret; }/* jtoe */ /* * JIS 0x2121..0x7e7e を shift-JIS * 0x00 .. 0xff はそのまま。 */ static int jtos(int wc) { int ret = 0, err = 0; int hib = (wc >> 8) & 0xff, lob = wc & 0xff, hi1 = 0x81, hi2 = 0x21, lo1 = 0x1f; if (hib >= 0x21 && hib < 0x5f) hi1 = 0x81; else { if (hib >= 0x5f && hib < 0x80) hi1 = 0xc1; else err = -1; } if (err == 0) { if ((hib & 1) == 1) { hi2 = 0x21; if (lob >= 0x21 && lob < 0x60) lo1 = 0x1f; else { if (lob >= 0x60 && lob < 0x7f) lo1 = 0x20; else err = -1; } } else { hi2 = 0x22; if (lob >= 0x21 && lob < 0x7f) lo1 = 0x7e; else err = -1; } } if (err == 0) ret = (((hib - hi2) / 2 + hi1) << 8) + lob + lo1; else ret = wc; return ret; }/* jtos */ /* * shift-JIS を EUC * 0x00 .. 0xff はそのまま。 */ static int stoe(int wc) { int ret, hib = (wc >> 8) & 0xff; if (hib != 0) ret = stoj(wc) | 0x8080; else ret = wc; return ret; }/* stoe */ /* * shift-JIS を JIS 0x2121..0x7e7e * 0x00 .. 0xff はそのまま。 */ static int stoj(int wc) { int err = 0, ret = 0; int hib = (wc >> 8) & 0xff, lob = wc & 0xff, hi1 = 0x81, hi2 = 0x21, lo1 = 0x1f; if (hib >= 0x81 && hib < 0xa0) hi1 = 0x81; else { if (hib >= 0xe0 && hib < 0xf0) hi1 = 0xc1; else err = -1; } if (err == 0) { if (lob >= 0x40 && lob < 0x7f) { hi2 = 0x21; lo1 = 0x1f; } else { if (lob >= 0x80 && lob < 0x9f) { hi2 = 0x21; lo1 = 0x20; } else { if (lob >= 0x9f && lob < 0xfd) { hi2 = 0x22; lo1 = 0x7e; } else err = -1; } } } if (err == 0) ret = (((hib - hi1) * 2 + hi2) << 8) + lob - lo1; else ret = wc; return ret; }/* stoj */ /* * ch == 0 で呼び出すと、*mb を初期化する。 * ch == EOF で呼び出すと、プールしてある文字(033 など)を掃き出す。 * 戻り値は、文字コード(single-byte: 1..0xff, multi-byte: 0x8181..0xfefe) * 0 ならば、文字はない(エスケープシーケンス処理中など) */ static int get_euc(struct MB *mb, int ch, int (*put)(int)) { int ret = 0; if (ch == 0) { MB_CLEAR(mb); } else { if (ch == EOF) { if (mb->hi) put(mb->hi); mb->hi = 0; } else if (mb->hi) { ret = (mb->hi << 8) + ch; mb->hi = 0; } else { if (ch >= 0x80) mb->hi = ch; else ret = ch; } } return ret; }/* get_euc */ /* * ch == 0 で呼び出すと、*mb を初期化する。 * ch == EOF で呼び出すと、プールしてある文字(033 など)を掃き出す。 * 戻り値は、文字コード(single-byte: 1..0xff, multi-byte: 0x8181..0xfefe) * 0 ならば、文字はない(エスケープシーケンス処理中など) */ static int get_sjis(struct MB *mb, int ch, int (*put)(int)) { int ret = 0; if (ch == 0) { MB_CLEAR(mb); } else { if (ch == EOF) { if (mb->hi) put(mb->hi); mb->hi = 0; } else if (mb->hi) { ret = (mb->hi << 8) + ch; mb->hi = 0; } else { if (is1sjis(ch)) mb->hi = ch; else ret = ch; } } return ret; }/* get_sjis */ /* * ch == 0 で呼び出すと、*mb を初期化する。 * ch == EOF で呼び出すと、プールしてある文字(033 など)を掃き出す。 * 戻り値は、文字コード(single-byte: 1..0xff, multi-byte: 0x2121..0xfefe) * 0 ならば、文字はない(エスケープシーケンス処理中など) */ static int get_jis(struct MB *mb, int ch, int (*put)(int)) { int ret = 0; if (ch == 0) { MB_CLEAR(mb); } else if (ch == '\n') { return ch; } else { switch (mb->st) { case MB_KI1: if (ch == KI_1) { mb->st = MB_KI2; } else { mb->st = MB_INITIAL; put(033); } break; case MB_KI2: if (ch == kanji_in || ch == '@' || ch == 'B') { mb->st = MB_INKANJI; ch = 0; } else { mb->st = MB_INITIAL; put(033); put(KI_1); } break; case MB_KO1: if (ch == KO_1) { mb->st = MB_KO2; } else { mb->st = MB_INKANJI; put(033); } break; case MB_KO2: if (ch == kanji_out || ch == 'J' || ch == 'H' || ch == 'B') { mb->st = MB_INITIAL; ch = 0; } else { mb->st = MB_INKANJI; put(033); put(KO_1); } break; default: break; }/* switch */ switch (mb->st) { case MB_INITIAL: if (ch == EOF) ret = 0; else if (ch == 033) mb->st = MB_KI1; else ret = ch; break; case MB_INKANJI: if (ch == EOF) { if (mb->hi) { mb->st = MB_INITIAL; put(mb->hi); mb->hi = 0; } } else if (ch == 033) mb->st = MB_KO1; else { if (mb->hi) { ret = (mb->hi << 8) + ch; mb->hi = 0; } else mb->hi = ch; } break; default: break; }/* switch */ } return ret; }/* get_jis */ /* * EUC 文字列を shift-JIS に変換する。 * ch == 0 でまず呼び出し、文字列から1バイトずつ ch に入れて呼び出し、 * 最後は ch == EOF で呼び出す。 * 出力は put() を通じて行われる。 */ int euc_to_sjis(struct MB *mb, int ch, int (*put)(int)) { int wc = get_euc(mb, ch, put); if (wc != 0) { wc = etos(wc); if (wc != 0) { if (wc & 0xff00) { put((wc >> 8) & 0xff); } put(wc & 0xff); } } return wc; }/* euc_to_sjis */ /* * JIS 文字列を shift-JIS に変換する。 * ch == 0 でまず呼び出し、文字列から1バイトずつ ch に入れて呼び出し、 * 最後は ch == EOF で呼び出す。 * 出力は put() を通じて行われる。 */ int jis_to_sjis(struct MB *mb, int ch, int (*put)(int)) { int wc = get_jis(mb, ch, put); if (wc != 0) { wc = jtos(wc); if (wc != 0) { if (wc & 0xff00) { put((wc >> 8) & 0xff); } put(wc & 0xff); } } return wc; }/* jis_to_sjis */ /* */ int sjis_to_euc(struct MB *mb, int ch, int (*put)(int)) { int wc = get_sjis(mb, ch, put); if (wc != 0) { wc = stoe(wc); if (wc != 0) { if (wc & 0xff00) { put((wc >> 8) & 0xff); } put(wc & 0xff); } } return wc; }/* sjis_to_euc */ /* */ int sjis_to_jis(struct MB *mb, int ch, int (*put)(int)) { int wc = get_sjis(mb, ch, put); static int inkanji = 0; if (wc != 0) { wc = stoj(wc); if (wc != 0) { if (wc & 0xff00) { if (!inkanji) { inkanji = 1; put('\033'); put(KI_1); put(kanji_in); } put((wc >> 8) & 0xff); } else { if (inkanji) { inkanji = 0; put('\033'); put(KO_1); put(kanji_out); } } put(wc & 0xff); } } return wc; }/* sjis_to_jis */ #define GETWCH(s) (((unsigned char)(s)[0] << 8) | (unsigned char)(s)[1]) /* * */ char * stretos(char *buf, const char *src) { const unsigned char *s = (const unsigned char *)src; char *d = buf; while (*s != '\0') { int wc; if (is1euc(*s)) { wc = GETWCH(s); wc = etos(wc); if (s[1] != '\0') s++; } else { wc = *s; } if ((wc & ~0xff) != 0) { *d++ = wc >> 8; } *d++ = wc; s++; }/* while */ *d = '\0'; return buf; }/* stretos */ /* * buf == src だとだめ(カナの時)。 */ char * strstoe(char *buf, const char *src) { const unsigned char *s = (const unsigned char *)src; char *d = buf; while (*s != '\0') { int wc; if (is1sjis(*s)) { wc = GETWCH(s); wc = stoe(wc); if (s[1] != '\0') s++; } else if (isskana(*s)) { wc = 0x8e00 | *s; } else { wc = *s; } if ((wc & ~0xff) != 0) { *d++ = wc >> 8; } *d++ = wc; s++; }/* while */ *d = '\0'; return buf; }/* strstoe */ /* * strstoe() した時のバイト数を返す。 */ size_t strstoelen(const char *src) { size_t d = 0; const unsigned char *s = (const unsigned char *)src; while (*s != '\0') { int wc; if (is1sjis(*s)) { wc = GETWCH(s); wc = stoe(wc); if (s[1] != '\0') s++; } else if (isskana(*s)) { wc = 0x8e00 | *s; } else { wc = *s; } if ((wc & ~0xff) != 0) { d++; } d++; s++; }/* while */ return d; }/* strstoelen */ static unsigned short kana_zen[64] = { 0xa1a1, 0xa1a3, 0xa1d6, 0xa1d7, 0xa1a2, 0xa1a6, 0xa5f2, 0xa5a1, 0xa5a3, 0xa5a5, 0xa5a7, 0xa5a9, 0xa5e3, 0xa5e5, 0xa5e7, 0xa5c3, 0xa1bc, 0xa5a2, 0xa5a4, 0xa5a6, 0xa5a8, 0xa5aa, 0xa5ab, 0xa5ad, 0xa5af, 0xa5b1, 0xa5b3, 0xa5b5, 0xa5b7, 0xa5b9, 0xa5bb, 0xa5bd, 0xa5bf, 0xa5c1, 0xa5c4, 0xa5c6, 0xa5c8, 0xa5ca, 0xa5cb, 0xa5cc, 0xa5cd, 0xa5ce, 0xa5cf, 0xa5d2, 0xa5d5, 0xa5d8, 0xa5db, 0xa5de, 0xa5df, 0xa5e0, 0xa5e1, 0xa5e2, 0xa5e4, 0xa5e6, 0xa5e8, 0xa5e9, 0xa5ea, 0xa5eb, 0xa5ec, 0xa5ed, 0xa5ef, 0xa5f3, 0xa1ab, 0xa1ac, }; char * strstoe2(char *buf, const char *src) { const unsigned char *s = (unsigned char *)src; char *d = buf; while (*s != '\0') { int wc; if (is1sjis(*s)) { wc = GETWCH(s); wc = stoe(wc); if (s[1] != '\0') s++; } else if (isskana(*s)) { wc = kana_zen[*s - 0xa0]; } else { wc = *s; } if ((wc & ~0xff) != 0) { *d++ = wc >> 8; } *d++ = wc; s++; }/* while */ *d = '\0'; return buf; }/* strstoe2 */ #ifdef TEST char *myname; char usage_msg[] = "euc/sjis converter V0.8086\n" "usage: %s [-es] [file ...]\n" "\t-e\tsjis->euc\n" "\t-j\tsjis->jis\n" "\t-s\teuc->sjis\n" ; int verbose; int (*filter)(struct MB *mb, int ch, int (*put)(int)) = euc_to_sjis; int fnain(FILE *fp) { struct MB mb; int err = 0, ch; filter(&mb, 0, putchar); while ((ch = fgetc(fp)) != EOF) { filter(&mb, ch, putchar); }/* while */ filter(&mb, EOF, putchar); return err; }/* fnain */ int nain(const char *name) { int err = -1; FILE *fp = fopen(name, "r"); if (fp == NULL) { fprintf(stderr, "%s: %s: cannot open\n", myname, name); } else { err = fnain(fp); fclose(fp); } return err; }/* nain */ #ifdef __BORLANDC__ extern int optind; extern char *optarg; extern int getopt(int, char **, const char *); #endif int main(int argc, char *argv[]) { int ex, ch, show_usage = 0; myname = argv[0]; while ((ch = getopt(argc, argv, "ejsvV")) != EOF) { switch (ch) { default: case 'V': show_usage++; break; case 'v': verbose = 1; break; case 'e': filter = sjis_to_euc; break; case 'j': filter = sjis_to_jis; break; case 's': filter = euc_to_sjis; break; }/* switch */ }/* while */ ex = 1; if (show_usage) { fprintf(stderr, usage_msg, myname); } else { ex = 0; if (argc - optind == 0) { if (fnain(stdin) < 0) ex = 1; } else { int i; for (i = optind; i < argc; i++) { if (nain(argv[i]) < 0) ex = 1; }/* for */ } } return ex; }/* main */ #endif xipmsg-0.8088.orig/db.c0000644001001300006200000000302306334062151015075 0ustar gotomgotom00000000000000/* * db.c - a simple database * Copyright (C) 1996 by candy */ char rcsid_db[] = "$Id: db.c,v 3.6 1996/11/28 09:01:20 candy Exp $"; #include #include #include #include #include "db.h" #ifdef NO_MEMMOVE #define memmove(d,s,l) bcopy(s,d,l) #endif struct db_t * db_new(size_t max, int (*comp)(const void *, const void *)) { struct db_t *db = malloc(sizeof(*db)); if (db != NULL) { db->db_max = max; db->db_used = 0; db->db_comp = comp; db->db_table = malloc(sizeof(*db->db_table) * max); if (db->db_table == NULL) { free(db); db = NULL; } } return db; }/* db_new */ void db_free(struct db_t *db) { free(db->db_table); free(db); }/* db_free */ void * db_install(struct db_t *db, const void *data) { void *ret = NULL; if (db->db_used < db->db_max) { void **tab = db->db_table; int i = 0; while (i < db->db_used && db->db_comp(tab[i], data) < 0) i++; if (i < db->db_used) memmove(&tab[i + 1], &tab[i], sizeof(*tab) * (db->db_used - i)); tab[i] = (void *)data; db->db_used++; ret = (void *)data; } return ret; }/* db_install */ static int (*cur_comp)(const void *, const void *); static int std_comp(const void *d_, const void *s_) { void * const *d = d_, * const *s = s_; return cur_comp(*d, *s); }/* std_comp */ void * db_lookup(struct db_t *db, const void *data) { void *ret; cur_comp = db->db_comp; ret = bsearch(&data, db->db_table, db->db_used, sizeof(*db->db_table), std_comp); if (ret != NULL) ret = *(void **)ret; return ret; }/* db_lookup */ xipmsg-0.8088.orig/brocas.h0000644001001300006200000000702510207536237016001 0ustar gotomgotom00000000000000/* * brocas.h * Copyright (C) 1996 by candy * $Id: brocas.h,v 3.7 1996/12/12 17:15:12 candy Exp candy $ */ #ifndef BROCAS_H__ #define BROCAS_H__ #define COUNTOF(v) (sizeof(v)/sizeof((v)[0])) #define GETUW(p) ((((unsigned char *)(p))[0]<<8)|(((unsigned char *)(p))[1])) #define GETUL(p) ((((unsigned long)((unsigned char *)(p))[0])<<24)|(((unsigned char *)(p))[1]<<16)|(((unsigned char *)(p))[2]<<8)|(((unsigned char *)(p))[3])) #define SETUW(p,x) (void)(((char*)(p))[0]=((x)>>8)&0xff,((char*)(p))[1]=(x)&0xff) #define SETUL(p,x) (void)(((char*)(p))[0]=((x)>>24)&0xff,((char*)(p))[1]=((x)>>16)&0xff,((char*)(p))[2]=((x)>>8)&0xff,((char*)(p))[3]=(x)&0xff) #ifndef MAX #define MAX(a,b) ((a)>(b)?(a):(b)) #endif #ifndef MIN #define MIN(a,b) ((a)<(b)?(a):(b)) #endif extern int debug_flag; #define USERNAME_MAX 64 #define HOSTNAME_MAX 256 #define MESSAGE_MAX 8192 /* * ソケットアドレス */ union saddr { struct sockaddr sa; struct sockaddr_in sin; }; /* * IP Messenger プロトコルアドレス構造体 */ struct maddr_t { int m_so; char m_user[USERNAME_MAX]; union saddr m_saddr; }; /* * 受信パケットをデコードしたもの */ struct packet_t { unsigned long pk_ver; unsigned long pk_no; unsigned long pk_cmd; char *pk_user; char *pk_host; char *pk_msg; char *pk_icon; size_t pk_msgsize; struct maddr_t pk_maddr; }; /* * コールバックのイベント */ enum bro_event_t { BRO_EV_LIST_CHANGED, /* 名前リストが変わった */ BRO_EV_RECV_MESSAGE, /* メッセージが届いた */ BRO_EV_RECV_ACK, /* 送ったメッセージが間違いなく届いた */ BRO_EV_NO_ACK, /* 送ったメッセージが届かなかったかも */ BRO_EV_START_WORK_PROC, /* work procedure を開始する (^^;; */ BRO_EV_MAX /* (イベント種類総数) */ }; struct msg_data_t { struct maddr_t *md_replyto; char *md_msg; char *md_from; unsigned long md_opt; unsigned long md_pkno; unsigned char *md_icon; }; /* * パケットフィルタリング用 */ struct rcv_q_t { unsigned long q_id; /* 受信したパケット番号 */ unsigned long q_keep; /* 保持する時間 */ }; /* * */ struct rcv_t { struct rcv_q_t *rcv_q; size_t rcv_size; /* rcv_q のサイズ */ size_t rcv_used; /* rcv_q の使用中のサイズ */ }; struct ns_t { struct maddr_t ns_maddr; /* プロトコルアドレス */ char ns_host[HOSTNAME_MAX]; /* ホスト名フィールド値 */ char ns_nick[USERNAME_MAX]; /* ニックネーム */ struct rcv_t ns_rcv; }; typedef void (*bro_callback_t)(enum bro_event_t, void *closure, void *call_data); /* * スキャッターバッファ */ struct iov_t { struct iov_t *iov_next; void *iov_base; size_t iov_len; }; #define SET_IOV(v,next,base,len) (void)((v)->iov_next = (next), (v)->iov_base = (base), (v)->iov_len = (len)) /* ----START */ char * str_dup(const char *s); char * strncpyz(char *dst, const char *src, size_t len); char * strnchr(const char *s, int ch, size_t n); int strcmpi(const char *d_, const char *s_); int strncmpi(const char *d_, const char *s_, size_t n); int bro_add_callback(enum bro_event_t e, bro_callback_t callback, void *closure); struct xq_t * xq_enq(struct xq_t *xq); int bro_send(const char *msg, const unsigned char *icon, const struct maddr_t *ma); struct ns_t * ns_lookup(const struct maddr_t *ma); struct ns_t * ns_get(int idx); void ns_free(const struct maddr_t *ma); void ns_clear(void); char ** ns_list(void); int send_IPMSG_READMSG(struct maddr_t *replyto, unsigned long pkno); int send_IPMSG_BR_ENTRY(void); int send_IPMSG_BR_EXIT(void); int bro_recv_packet(int so); void bro_job(void); void bro_work(void); int bro_set_disable(int disable); int bro_init(int port, const char *user, const char *host, const char * const *bros); /* ----END */ #endif xipmsg-0.8088.orig/kanji.h0000644001001300006200000000253506332312602015615 0ustar gotomgotom00000000000000/* * kanji.h * $Id: kanji.h,v 3.6 1996/11/28 09:01:21 candy Exp $ */ #ifndef KANJI_H /* [ */ #define KANJI_H #ifndef is1sjis #define is1sjis(c) (((0x81<=(unsigned char)(c))&&((unsigned char)(c)<=0x9f))||((0xe0<=(unsigned char)(c))&&((unsigned char)(c)<=0xfc))) #endif #ifndef is1euc #define is1euc(c) ((0x81<=(unsigned char)(c))&&((unsigned char)(c)<=0xfe)) #endif struct MB { enum { MB_INITIAL, /* initial state : ank chars */ MB_KI1, /* detected 033 */ MB_KI2, /* detected '$' */ MB_INKANJI, /* detected '@' */ MB_KO1, /* detected 033 */ MB_KO2 /* detected '(' */ } st; int hi; /* 1st byte of a multi byte character */ }; #define MB_CLEAR(mb) ((mb)->st = MB_INITIAL, (mb)->hi = 0) #define KI_1 '$' #define KO_1 '(' #define isskana(c) (((unsigned char)(c))>=0xa0&&((unsigned char)(c))<0xe0) extern int kanji_in; /* default '@' */ extern int kanji_out; /* default 'J' */ extern int euc_to_sjis(struct MB *mb, int ch, int (*put)(int)); extern int jis_to_sjis(struct MB *mb, int ch, int (*put)(int)); extern int sjis_to_euc(struct MB *mb, int ch, int (*put)(int)); extern int sjis_to_jis(struct MB *mb, int ch, int (*put)(int)); extern char * stretos(char *dst, const char *src); extern char * strstoe(char *dst, const char *src); extern size_t strstoelen(const char *src); extern char * strstoe2(char *dst, const char *src); #endif /* ] KANJI_H */ xipmsg-0.8088.orig/db.h0000644001001300006200000000076506332312601015110 0ustar gotomgotom00000000000000/* * db.h - a simple database * Copyright (C) 1996 by candy * $Id: db.h,v 3.6 1996/11/28 09:01:21 candy Exp $ */ #ifndef DB_H__ #define DB_H__ struct db_t { size_t db_size; size_t db_max; void **db_table; int (*db_comp)(const void *, const void *); size_t db_used; }; struct db_t * db_new(size_t max, int (*comp)(const void *, const void *)); void db_free(struct db_t *db); void * db_install(struct db_t *db, const void *data); void * db_lookup(struct db_t *db, const void *data); #endif xipmsg-0.8088.orig/dyna.h0000644001001300006200000001172306332403774015466 0ustar gotomgotom00000000000000/* * dyna.h -- 動的に大きくなるバッファ * Copyright (C) 1991-1993 by candy * Thu Oct 31 10:13:53 JST 1996 * DYNA_IZ() 不要に * Sat May 3 00:27:48 JST 1997 * BOGUS_REALLOC */ /* * $Id: dyna.h,v 3.6 1996/11/28 09:01:21 candy Exp $ */ #ifndef __DYNA_H /* [ */ #define __DYNA_H #ifdef BOGUS_REALLOC #undef realloc #define realloc(p,s) ((p)?((realloc)(p,s)):malloc(s)) #endif /* * NAME * STRUCT_DYNA - 構造体の宣言(の一部!!) * * SYNOPSIS * struct DYNA STRUCT_DYNA(TYPE); * * DESCRIPTION * TYPE 型を要素とする動的に大きくなる配列を扱う構造体 * struct DYNA * を宣言します。 * * EXAPMLE * struct CHAR_BUF STRUCT_DYNA(char); 文字バッファ * struct LIST_BUF STRUCT_DYNA(char *); 文字列のリスト * のように宣言します。 * TYPE の書式には制限があって、定義 * TYPE * identifier; * において、identifier が TYPE へのポインタとなるようなものしか書けません。 * 例えば * STRUCT_DYNA(char **) はいいけれど * STRUCT_DYNA(int (*)()) はだめです。 */ #define STRUCT_DYNA(TYPE) \ { \ unsigned int more, size, used; \ TYPE *buf; \ TYPE *spare; \ } /* * NAME * DYNA_IZ - 構造体の初期化 * * SYNOPSIS * void DYNA_IZ(struct DYNA *dyna, unsigned int nmore); * * DESCRIPTION * 構造体を初期化します。 * dyna には STRUCT_DYNA で宣言した構造体のアドレスを与えます。 * nmore には一度に増加する要素の数を指定します。 * * EXAMPLE * struct LIST_BUF STRUCT_DYNA(char *) list_buf; * の時、 * DYNA_IZ(&list_buf, 64); * のように初期化します。 */ #define DYNA_IZ(dyna, nmore) ((void)( \ (dyna)->more = (nmore), \ (dyna)->used = (dyna)->size = 0, \ (dyna)->buf = (void *)0 \ )) /* * NAME * DYNA_BRK - 配列の拡大 * * SYNOPSIS * TYPE *DYNA_BRK(struct DYNA *dyna, unsigned int nmore); * * DESCRIPTION * 構造体の配列を nmore 個だけ拡大します。 * DYNA_NEXT() が自動的に実行するので普通は関係ありません。 * 成功なら NULL 以外を返し、失敗なら NULL を返します。 * * EXAMPLE * struct LIST_BUF STRUCT_DYNA(char *) list_buf; * DYNA_IZ(&list_buf, 64); * の時、 * if (DYNA_BRK(&list_buf, 16) == NULL) * goto no_memory; * などとします。 */ #define DYNA_BRK(dyna, nmore) ( \ (dyna)->spare = (dyna)->buf, \ (dyna)->size += (nmore), \ (dyna)->buf = realloc((dyna)->buf, (dyna)->size * sizeof((dyna)->buf[0])), \ (((dyna)->buf != (void *)0) ? (dyna)->buf \ : ((dyna)->buf = (dyna)->spare, \ (dyna)->size -= (nmore), \ (void *)0)) \ ) /* * NAME * DYNA_NEXT - バッファの拡大 * * SYNOPSIS * TYPE *DYNA_NEXT(struct DYNA *dyna); * * DESCRIPTION * 配列の新しい要素のアドレスを返します。 * 使用領域が 1 増えます。 * 足りない場合は DYNA_BRK() を呼び出します。 * 失敗なら NULL を返します。 * * EXAMPLE * struct LIST_BUF STRUCT_DYNA(char *)list_buf; * char **next; * DYNA_IZ(&list_buf, 64); * の時、 * if ((next = DYNA_NEXT(&list_buf)) == NULL) * goto no_memory; * *next = malloc(256); * などとします。 */ #define DYNA_NEXT(dyna) ( \ ((dyna)->used >= (dyna)->size && DYNA_BRK(dyna, \ ((dyna)->more ? (dyna)->more : 256)) == (void *)0) \ ? (void *)0 \ : (dyna)->buf + (dyna)->used++ \ ) /* * NAME * DYNA_ALLOC - バッファの拡大 * * SYNOPSIS * TYPE *DYNA_ALLOC(struct DYNA *dyna, unsigned int n); * * DESCRIPTION * 配列の中の新しい n 個の連続した要素のアドレスを返します。 * 使用領域が n 増えます。 * 足りない場合は DYNA_BRK() を呼び出します。 * 失敗なら NULL を返します。 * * EXAMPLE * struct CHAR_BUF STRUCT_DYNA(char) char_buf; * char *next; * DYNA_IZ(&char_buf, 256); * の時、 * if ((next = DYNA_ALLOC(&char_buf, strlen(s) + 1)) == NULL) * goto no_memory; * strcpy(next, s); * などとします。 */ #define DYNA_ALLOC(dyna, nmore) ( \ ((dyna)->used + (nmore) > (dyna)->size && DYNA_BRK(dyna, (dyna)->more + (nmore)) == (void *)0) \ ? ((void *)0)\ : ((dyna)->used += (nmore), (dyna)->buf + (dyna)->used - (nmore))\ ) /* * NAME * DYNA_RESET - バッファを空にする * * SYNOPSIS * void DYNA_RESET(struct DYNA *dyna) * * DESCRIPTION * バッファを空にします(使用領域を 0 にします)。 * dyna には STRUCT_DYNA で宣言した構造体のアドレスを与えます。 */ #define DYNA_RESET(dyna) ((void)((dyna)->used = 0)) /* * NAME * DYNA_UNGROW - バッファの縮小 * * SYNOPSIS * void DYNA_UNGROW(struct DYNA *dyna, unsigned int n); * * DESCRIPTION * バッファの大きさ(使用領域)が 0 でなければ、n 要素分縮小します。 * */ #define DYNA_UNGROW(dyna, n) ((void)((dyna)->used > (n) ? ((dyna)->used -= (n)) : ((dyna)->used = 0))) /* * NAME * DYNA_BUF - バッファのアドレス * * SYNOPSIS * TYPE *DYNA_BUF(struct DYNA *dyna); * * DESCRIPTION * バッファの最初の要素のアドレスを返します。 * DYNA_BRK() や DYNA_NEXT() によって値が変化しますので、 * それらを呼び出した後は以前の値は無効になります。 */ #define DYNA_BUF(dyna) ((dyna)->buf) /* * NAME * DYNA_USED - バッファの大きさ * * SYNOPSIS * unsigned int DYNA_USED(struct DYNA *dyna); * * DESCRIPTION * バッファの大きさを返します。 * DYNA_IZ() 直後は 0 で、 * DYNA_NEXT() する毎に + 1 します。 */ #define DYNA_USED(dyna) ((dyna)->used) #endif /* ] !__DYNA_H */ xipmsg-0.8088.orig/xipmsg.h0000644001001300006200000000322406332277254016041 0ustar gotomgotom00000000000000/* IP Messenger Communication Protocol version 1.0 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 */ #define IPMSG_NOOPERATION 0x00000000UL #define IPMSG_BR_ENTRY 0x00000001UL #define IPMSG_BR_EXIT 0x00000002UL #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_SENDMSG 0x00000020UL #define IPMSG_RECVMSG 0x00000021UL #define IPMSG_READMSG 0x00000030UL #define IPMSG_DELMSG 0x00000031UL #define IPMSG_GETINFO 0x00000040UL #define IPMSG_SENDINFO 0x00000041UL #define IPMSG_GETABSENCEINFO 0x00000050UL #define IPMSG_SENDABSENCEINFO 0x00000051UL /* option for all command */ #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 #define IPMSG_PASSWORDOPT 0x00008000UL #define IPMSG_NOLOGOPT 0x00020000UL #define IPMSG_NEWMUTIOPT 0x00040000UL #define IPMSG_NOADDLISTOPT 0x00080000UL #define HOSTLIST_DELIMIT "\a" #define HOSTLIST_DUMMY "\b" /* end of IP Messenger Communication Protocol version 1.0 define */ xipmsg-0.8088.orig/Imakefile0000644001001300006200000001253710212772207016167 0ustar gotomgotom00000000000000#ifndef XCOMM #define XCOMM # #endif #ifndef RemoveFiles #define RemoveFiles(xx) $(RM) xx #endif XCOMM Imakefile for xipmsg XCOMM $Id: Imakefile,v 3.7 1997/05/02 06:42:42 candy Exp candy $ XCOMM =============================================== XCOMM Enable/Disable OS dependent things. XCOMM =============================================== XCOMM ------------------------------------ XCOMM DEC DigitalUNIX3.2A XCOMM ------------------------------------ XCOMM CC=/usr/bin/cc XCOMM CDEBUGFLAGS=-O XCOMM EXTRA_DEFINES=$(SOCKSDEF) XCOMM LDLIBS=-lm $(SOCKSLIB) XCOMM ------------------------------------ XCOMM EWS4800 (SVR4.2) Release9.1 with X11R5 XCOMM ------------------------------------ XCOMM CC=/usr/abiccs/bin/cc XCOMM CDEBUGFLAGS=-O XCOMM EXTRA_DEFINES=$(SOCKSDEF) XCOMM LDLIBS=-lsocket -lnsl -lm $(SOCKSLIB) XCOMM ------------------------------------ XCOMM FreeBSD 2.X XCOMM ------------------------------------ XCOMM CDEBUGFLAGS=-O EXTRA_DEFINES=$(SOCKSDEF) LDLIBS+=-lm $(SOCKSLIB) XCOMM Here are some bogons... #ifdef FreeBSDArchitecture .if exists(/usr/lib/libxpg4.a) LDLIBS+=-lxpg4 .endif #endif XCOMM *** my debugging option XCOMM CDEBUGFLAGS=-g -static -pipe -Wall XCOMM ------------------------------------ XCOMM Linux 2.0.29,30 XCOMM ------------------------------------ XCOMM CDEBUGFLAGS=-O XCOMM EXTRA_DEFINES=$(SOCKSDEF) XCOMM LDLIBS+=-lm $(SOCKSLIB) XCOMM ------------------------------------ XCOMM NetBSD XCOMM ------------------------------------ XCOMM CDEBUGFLAGS=-O XCOMM EXTRA_DEFINES=$(SOCKSDEF) XCOMM LDLIBS+=-lm $(SOCKSLIB) XCOMM ------------------------------------ XCOMM SunOS 4.1.X with X11R6 XCOMM ------------------------------------ XCOMM CC=gcc XCOMM CDEBUGFLAGS=-g -O XCOMM EXTRA_DEFINES=$(SOCKSDEF) -DUSE_VARARGS -DBOGUS_REALLOC -DNO_SSIZE_T -DNO_MEMMOVE -DNO_STRTOUL -DSUNOS41X XCOMM LDLIBS=-lm $(SOCKSLIB) XCOMM =============================================== XCOMM Edit the following options. XCOMM =============================================== XCOMM ------------------------------------ XCOMM L10N (ja_JP.EUC) support XCOMM Comment out if you don't want to use Japanese resources. XCOMM ------------------------------------ XCOMM #define INSTALL_ja XCOMM LANG=ja_JP.eucJP XCOMM ------------------------------------ XCOMM Select Athena Widget library XCOMM ------------------------------------ XAWLIB = -lXaw # for most starndard systems XCOMM XAWLIB = -lXaw95 XCOMM XAWLIB = -lXaw3d XCOMM ------------------------------------ XCOMM SOCKS5 support (for experiment only!) XCOMM ------------------------------------ XCOMM SOCKSDEF=-DSOCKS -I/usr/local/include XCOMM SOCKSLIB=-L/usr/local/lib -lsocks5 XCOMM =============================================== INSTUIDFLAGS=-m 755 -o bin -g bin DEPLIBS=XawClientDepLibs LOCAL_LIBRARIES=XawClientLibs INCLUDES= SRCS=xipmsg.c brocas.c kanji.c db.c OBJS=$(SRCS:.c=.o) HEADERS=brocas.h kanji.h db.h dyna.h xipmsg.h #undef InstallProgram #define InstallProgram(a,b) ComplexProgramTarget(xipmsg) InstallProgramWithFlags(xipmsg,$(BINDIR),$(INSTUIDFLAGS)) proto: (sed -n '1,/----START/p' brocas.h; \ proto brocas.c ; \ sed -n '/----END/,$$p' brocas.h) > xx mv brocas.h brocas.h.bak cp xx brocas.h RemoveFiles(xx) clean:: RemoveFiles(xx) XCOMM =============================================== XCOMM App-default to C include file (.h) converter AD2C=Ad2c/ad2c.script XCOMM Where to install XBM files XIPM_DIR=$(LIBDIR)/xipmsg XIPM_XBMDIR=$(XIPM_DIR) MakeDirectories(install,$(XIPM_XBMDIR)) InstallNonExec(xbro00.xbm,$(XIPM_XBMDIR)) InstallNonExec(xbro01.xbm,$(XIPM_XBMDIR)) InstallNonExec(xbro02.xbm,$(XIPM_XBMDIR)) InstallNonExec(xbro03.xbm,$(XIPM_XBMDIR)) InstallNonExec(xbro04.xbm,$(XIPM_XBMDIR)) InstallNonExec(xbro05.xbm,$(XIPM_XBMDIR)) InstallNonExec(xbro06.xbm,$(XIPM_XBMDIR)) InstallNonExec(xbro07.xbm,$(XIPM_XBMDIR)) InstallNonExec(xbro08.xbm,$(XIPM_XBMDIR)) InstallNonExec(xbro09.xbm,$(XIPM_XBMDIR)) InstallNonExec(xbro10.xbm,$(XIPM_XBMDIR)) InstallNonExec(xbro11.xbm,$(XIPM_XBMDIR)) InstallNonExec(xbro12.xbm,$(XIPM_XBMDIR)) InstallNonExec(xbro13.xbm,$(XIPM_XBMDIR)) InstallNonExec(xbro14.xbm,$(XIPM_XBMDIR)) InstallNonExec(xbro15.xbm,$(XIPM_XBMDIR)) $(AD2C):: chmod 555 $(AD2C) #ifdef INSTALL_ja LOCALEDIR=$(LIBDIR)/$(LANG)/app-defaults XIpmsg_jp.ad:: XIpmsg_jp.ad.in RemoveFiles(XIpmsg_jp.ad) sed 's!XIPM_XBMDIR!$(XIPM_XBMDIR)!g' XIpmsg_jp.ad.in > XIpmsg_jp.ad MakeDirectories(install,$(LOCALEDIR)) InstallNonExec(XIpmsg_jp.ad,$(LOCALEDIR)/XIpmsg) #endif XIpmsg.ad:: XIpmsg.ad.in RemoveFiles(XIpmsg.ad) sed 's!XIPM_XBMDIR!$(XIPM_XBMDIR)!g' XIpmsg.ad.in > XIpmsg.ad xipmsg.ad.h:: XIpmsg.ad $(AD2C) RemoveFiles(xipmsg.ad.h) $(AD2C) XIpmsg.ad > xipmsg.ad.h clean:: RemoveFiles(XIpmsg.ad xipmsg.ad.h XIpmsg_jp.ad) InstallAppDefaults(XIpmsg) includes:: xipmsg.ad.h XCOMM =============================================== V=8088 DISTFILES= $(SRCS) $(HEADERS) Imakefile README protocol.txt \ xipmsg.man \ XIpmsg.ad.in XIpmsg_jp.ad.in \ xbro00.xbm xbro01.xbm xbro02.xbm xbro03.xbm \ xbro04.xbm xbro05.xbm xbro06.xbm xbro07.xbm \ xbro08.xbm xbro09.xbm xbro10.xbm xbro11.xbm \ xbro12.xbm xbro13.xbm xbro14.xbm xbro15.xbm dist: (cd udpmsg && $(MAKE) 'clean') $(RM) -r xipmsg-$(V) mkdir xipmsg-$(V) ln $(DISTFILES) xipmsg-$(V) tar -cf - Ad2c | (cd xipmsg-$(V); tar xf -) tar -cf - udpmsg | (cd xipmsg-$(V); tar xf -) tar -czf xipmsg-$(V).tar.gz xipmsg-$(V) $(RM) -r xipmsg-$(V) clean:: $(RM) -r xipmsg-$(V).tar.gz xipmsg-$(V) xipmsg-0.8088.orig/README0000644001001300006200000003032210212770124015222 0ustar gotomgotom00000000000000XIP Messenger V0.8088 /* * Copyright (c) 1995, 1996, 1997, 2004 * Toshihiro Kanda. 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. * * THIS SOFTWARE IS PROVIDED BY TOSHIHIRO KANDA 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 TOSHIHIRO KANDA 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. * */ Original IP Messenger for Windows: Copyright (C) 1996 by H.Shirouzu BSD Daemon Copyright 1988 by Marshall Kirk McKusick. All Rights Reserved. AD2C - convert resource files to C decls by George Ferguson, ferguson at cs.rochester.edu -------- ENGLISH ------------------------------------------------------- WHAT IS XIP Messenger? Xipmsg is an UDP based simple communication tool for X. It can communicate directly with IP Messenger for Windows and Macintosh. OS VERSION Xipmsg runs on: DEC DigitalUNIX3.2A EWS4800 Release9.1 FreeBSD 2.X IRIX (?) Linux 2.0.29,30 NetBSD 1.2 SunOS 4.1.X with X11R6 or later (maybe with X11R5). INSTALL (1) Edit Imakefile. - Enabe/Disable OS dependent variables (CC, EXTRA_DEFINES, ..) (2) In the source directory, run # xmkmf -a # make # make install (3) Run xipmsg. E-MAIL SPECIAL SPASEBO TO NAOKI KATSURAGAWA for his great helps and advices. SPASEBO TO (in alphabetical order) (valid till 1998.03.31) -------- JAPANESE ------------------------- $BF|K\8l(B ------------ WHAT IS XIP Messenger? xipmsg $B$O(B X $BMQ$N(B UDP $B%Y!<%9$N4JC1$J%3%_%e%K%1!<%7%g%s%D!<%k$G!"(B Windows $B$d(B Apple Macintosh $BMQ$N(B IP Messenger $B$H%a%C%;!<%8$N$d$j$H(B $B$j$,$G$-$^$9!#(B OS VERSION xipmsg $B$O0J2<$N(B OS $B$H(B X11R6 ($B$b$7$+$9$k$H(B X11R5 $B$G$b2D(B) $B4D6-$G(B $BF0:n$7$^$9!#(B DEC DigitalUNIX3.2A EWS4800 Release9.1 FreeBSD 2.X IRIX (?) Linux 2.0.29,30 NetBSD 1.2 SunOS 4.1.X INSTALL (1) Imakefile $B$rJT=8$7$^$9!#(B - OS $B0MB8$NDj5AIt$r=$@5$7$F2<$5$$!#(B(CC, EXTRA_DEFINES $BEy(B) - $B9%$_$N(B XAWLIB $B$rA*$s$G2<$5$$!#(B (2) $B%=!<%9%G%#%l%/%H%j$G!"o $B$rDI2C$7$F$_$F$/$@$5$$!#(B Q. $BIu=qIU$-$N%a%C%;!<%8$r $B%P%0%l%]!<%H$O!"(B xipmsg $B$N%P!<%8%g%s(B(*.tar.gz $B$N%U%!%$%kL>(B) OS $B$N%P!<%8%g%s(B (uname -a $B$N=PNO(B) X11 $B$N%P!<%8%g%s(B (R5, R6, R6.1, R6.3 $BEy(B) X $B%5!<%P%P!<%8%g%s(B (XFree86-3.2 $BEy(B) $B>\$7$$>I>u(B($B%3%s%Q%$%k$N%m%0!"5/F0;~$N%m%0!"2?$r$I$&$9$k$H$I$&(B $B$J$C$?$+Ey(B) $B$rL@5-$7$F$/$@$5$$!#(B $B%a!<%j%s%0%j%9%H$b$"$j$^$9!#(B http://www.ipmsg.org/ $B$+$i$?$I$C$F2<$5$$!#(B SPECIAL SPASEBO Xipmsg $B$ND>@\$NA0?H$G$"$k(B XBroadcast $B$N@=:n$KB?Bg$J$k8f6(NO$H(B $B8f=u8@$r2<$5$C$?7K@nD>8J;a$K!"$3$N%W%m%0%i%`$rJ{$2$^$9!#(B SPASEBO TO (in alphabetical order) $B9b661I0l(B $B?eDE@5F;(B (valid till 1998.03.31) $BLxBt@5OB(B $B;0Bp0l1J(B $B:d:,5H?.(B $B@gEDCRLi(B $BGr?e7<>O(B ------------------------------------------------------------------------ $BF|K\8l%^%K%e%"%k(B NAME xipmsg - XIP Messenger SYNOPSIS xipmsg [-broadcast broadcast-address[,broadcast-address,...]] [-bogus_fix] [-debug n] [-disable] [-name entity-name] [-port portnumber] [-toolkitoption ...] OPTIONS xipmsg $B$O(B X Toolkit $B$NI8=`%*%W%7%g%s$rl9g!"$3$N%*%W%7%g%s$r;XDj$7$F2<(B $B$5$$!#%P%0$r2sHr$7$^$9!#(B $B$?$@$7$3$N%*%W%7%g%s$r;XDj$9$k$H!"AwA0$rIT2D;k$K$7$^$9!#(B -name entity-name $BL>A0$r;XDj$7$^$9!#;XDj$,L5$$>l9g$O(B $USER $B$NCM$K$J$j$^$9!#(B -port portnumber $B;HMQ$9$k(B UDP $B%]!<%H$r;XDj$7$^$9!#%G%U%)%k%H$O(B 2425$B!#(B USAGE $B%a%C%;!<%8Aw?.(B $B%>!<%sL>$r%/%j%C%/$7!"L>A0$r%/%j%C%/$7$^$9!#(B $B%a%C%;!<%8$rF~NO$7!"(B[send] $B%\%?%s$r2!$7$^$9!#(B $BJV?.(B $BA0$rIT2D;k$K$7$^$9!#(B(Meta-d) $BL>A0%j%9%H(B $B%/%j%C%/$9$k$H!"Aw?.AjC5n$7$^$9!#(B(Meta-x) [cancel] $BAw?.%&%#%s%I%&$r>C5n$7$^$9!#(B(Meta-w) [send] $B%a%C%;!<%8$rAw?.$7$^$9!#(B(Meta-Return, Enter) $BC5n$7$^$9!#(B(Meta-w) [select] $BA0(B LANG - ja_JP.eucJP $B$J$I!#(B BUGS AUTHORS Original IP Messenger for Windows: Copyright (C) 1996, 1997 by H.Shirouzu X version Copyright (C) 1996, 1997, 2004 by Toshihiro Kanda ------------------------------------------------------------------------ $B$*$^$1(B -- udpmsg $B%3%^%s%I%i%$%s$+$i(B IP Messenger $B$K%a%C%;!<%8$rAw?.$9$k%W%m%0%i%`$G$9!#(B $B;~Js$d!"%a!<%kE~Ce$NDLCN$K;H$C$?$j$7$F$^$9!#(B $B%$%s%9%H!<%k(B: cd udpmsg && make NAME udpmsg -- $B%3%^%s%I%i%$%sHG(B IP Messenger $B%a%C%;!<%8Aw?.(B SYNOPSIS udpmsg {-f file | -m message} [-p port] [-u user] address address... DESCRIPTION udpmsg $B$O%3%^%s%I%i%$%s$+$i(B address $B$G;XDj$5$l$?%"%I%l%9$N(B IP Messenger $B$K%a%C%;!<%8$rAw?.$7$^$9!#(B $B%a%C%;!<%8$OI8=`F~NO$+$iFI$_$^$9!#(B OPTIONS -f file $B%a%C%;!<%8$rI8=`F~NO$+$i$G$O$J$/!"(Bfile $B$+$iFI$_$^$9!#(B -m message message $B$r%a%C%;!<%8$H$7$FAw?.$7$^$9!#(B -p port $B%]!<%HHV9f$r;XDj$7$^$9!#(B -u user $BAw?.85$N%f!<%6L>$r;XDj$7$^$9!#(B EXAMPLES 3 $BJ,7W(B $ sleep 180; udpmsg -m 'time has come.' localhost biff $B$,$o$j(B $ sed -n '/^From: /{s///;p;q;}' ~/Mail/inbox/1 | nkf -m -e | udpmsg -u biff localhost ------------------------------------------------------------------------ TODO: - $B%0%k!<%W$N%5%]!<%H(B - $B3F%P%C%U%!(B 14 -> 256 bytes$B!#(B - $BIu=qIU$-$N%a%C%;!<%8$GFCDj$NJ8;z$,2=$1$k$N$r(B fix$B!#(B - send $B$r%/%j%C%/8e!"%f!<%6%j%9%H$KA}8:$,$"$k$H08@h$r4V0c$($k$N$r(B fix$B!#(B - vsprintf(3) $B$r;H$o$J$$$h$&$K$7$?!#(B - $B%i%$%;%s%9$+$i9-9p>r9`:o=|!#(B - udpmsg $B$D$1$?!#(B xipmsg V0.8087 (1997.05.08) - SunOS 4.1.X $B%5%]!<%H(B bug fix xipmsg V0.8086 ($B@5<0%j%j!<%9$T$g(B) - SunOS 4.1.X $B%^!<%8!#(B - Digital UNIX $BDI2C!#(B - $BF1$8L>A0$G0c$&%]!<%H$N;~!"8E$$%(%s%H%j$r>C$9!#(B - -bogus_fix $B%*%W%7%g%s$G!"%U%j!<%:2sHr$9$k$h$&$K!#(B - $BI8=`$GF|K\8l%j%=!<%9%$%s%9%H!<%k$9$k!#(B - README $B@0Hw(B xipmsg V0.8086-alpha7 - [update] $B$G%j%9%H%/%j%"$5$l$J$$%P%0(B fix - $B%"%$%3%s%"%K%a$d$a$?!#(B - $B%"%$%3%s2=$7$?;~!"$A$C$3$/$J$k$N$rD>$9!#(B - $BL>A0%j%9%H$N2#%9%/%m!<%k%P!e$G$b$@$$$8$g$V!A(B - $B%;%l%/%H$r%3%s%Q%&%s%I2=$7!"(B $BB>$N%/%i%$%"%s%H$K$A$c$s$HF|K\8l%Z!<%9%H$G$-$k!#(B xipmsg V0.8086-alpha4 - $B:d:,5H?.;a(B $B$*$h$S(B $B@gEDCRLi;a(B $B$N(B EWM4800 $BMQ$N%Q%C%A$r%^!<%8$9$k!#(B ($B0zMQ5!G=$b4^$`(B) - SOCKS5 $BBP1~$K$9$k!#(B - IP Messenger $BI8=`%"%$%3%sE:IU(B xipmsg V0.8086-alpha3 - debug $BI=<(L5$/$7$?!#(B - $B%Q%1%C%HFO$+$J$+$C$?;~%(%i!<%&%#%s%I%&=P$9!#(B - $BL>A0%j%9%HJQ99$"$C$?;~!"%+%l%s%H$rJ]B8$9$k!#(B - $BIu=q%A%'%C%/IU$-%a%C%;!<%8$N $B$^$G!#(B xipmsg-0.8088.orig/protocol.txt0000644001001300006200000001215406331315542016755 0ustar gotomgotom00000000000000 IP Messenger MvgRdl(htg4j 96/02/21 Modify 97/02/10 H.Shirouzu shirouzu@ntt-it.co.jp Tv UDP PortgpAbZ[WMT[rX TCP/IPgAOSBゥlbg[N iwlbg[NjAIoFッB bZ[WMAIPSosB AMAyB UDP|[g(default:2425)gpA@B 1.R}h 1) R}h( command & 0xff ) IPMSG_NOOPERATION IPMSG_BR_ENTRY T[rXGg[iNBroadcastj IPMSG_BR_EXIT T[rXiIBroadcastj IPMSG_ANSENTRY T[rXGg[Fッ IPMSG_BR_ABSENCE s[hX IPMSG_BR_ISGETLIST zXgXgo\oT IPMSG_OKGETLIST zXgXgo\m IPMSG_GETLIST zXgXgov IPMSG_ANSLIST zXgXgo IPMSG_SENDMSG bZ[WM IPMSG_RECVMSG bZ[WMmF IPMSG_READMSG Jm IPMSG_DELMSG jm IPMSG_GETINFO IPMSGo[W IPMSG_SETINFO IPMSGo[W 2) IvVtO( command & 0xffffff00 ) IPMSG_SENDCHECKOPT M`FbN IPMSG_SECRETOPT IPMSG_BROADCASTOPT u[hLXgij IPMSG_MULTICASTOPT }`LXgiIj IPMSG_NOPOPUPOPT m|bvAbvMiMMj IPMSG_AUTORETOPT ゥis|h~pj IPMSG_RETRYOPT tO IPMSG_PASSWORDOPT O IPMSG_DIALUPOPT _CAAbv IPMSG_NOLOGOPT Oc IPMSG_NEWMUTIOPT j[o[W}`LXg IPMSG_ABSENCEOPT s[h IPMSG_SERVEROPT T[o[ IPMSG_NOADDLISTOPT BR_ENTRYo 2.R}htH[}bgi\j 1) R}hitH[}bgo[W1j Ver(1)FPacket : ゥUser : ゥHost : Command : 2) R}htH[}bgbZ[WM "1:0:shirouzu:jupiter:32:Hello" 3.R}hTv NAIPMSG_BR_ENTRYR}hu[hLXgA IP MessengerAVKQmB u[hLXgAoA ゥMXgVKQoBA IPMSG_ANSENTRYR}hVKQoAMB VKQoAIPMSG_ANSENTRYMA SoB AIPpPbgクASIP Messenger MXgB IPMSG_BR_ENTRY, IPMSG_ANSENTRY, IPMSG_BR_ABSENCER}hA s[hAIPMSG_ABSENCEOPTBA R}hjbNl[BIPMSG_BR_ABSENCEA s[hu[hLXgB iO[vgjLR}hQ'\0'I[A O[vB bZ[WMAIPMSG_SENDMSGgpAMAmF tOAIPMSG_RECVMSGB u[hLXgbZ[WMAIPMSG_BOADCASTOPT IPMSG_SENDMSGgpBu[hLXgゥ `FbNpPbgA{IpPbg B `FbNpPbgAJA IPMSG_READMSGoB AIPMSG_ANSENTRYmFpPbg ApPbgoBgCEu AタB AIPMSG_RECVMSG, IPMSG_READMSGAmFEpPbgA pPbggB 4. 1) s obZ[WsAUNIX`ョ('0x0a')B KvAsB 2) f~^ f~^':'gWA[UAzXgA ':'OAgBAゥzXg':' A(';')ugpB KvvARAGXP[ vV[PXlvB 3) R[h R[hASJISgpzAAUNIX lAlvB 5. A E-Mail shirouzu@ntt-it.co.jp B L R}hR[hAipmsg.hQ() xipmsg-0.8088.orig/xipmsg.man0000644001001300006200000000244606332317342016363 0ustar gotomgotom00000000000000.TH XIPMSG 1 "Release 6" "X Version 11" .SH NAME xipmsg - XIP Messenger .SH SYNOPSIS .B xipmsg [\-broadcast \fIbroadcast-address\fP[,\fIbroadcast-address\fP,...]] [\-bogus_fix] [\-debug \fIn\fP] [\-disable] [\-name \fIentity-name\fP] [\-port \fIportnumber\fP] [\-\fItoolkitoption\fP ...] .SH DESCRIPTION \fIXipmsg\fP is an UDP based simple communication tool for X11. It can communicate with IP Messenger for Windows/Macintosh. See README file for more information. .SS OPTIONS .I Xipmsg accepts all of the standard X Toolkit command line options, as well as the followings: .TP .BI "\-broadcast " "broadcast-address[,broadcast-address,...]]" specifies boradcast addresses separated by a comma. It defaults to 255.255.255.255. .I Xipmsg send broadcast packets at the start and the end. .TP .B \-bogus_fix Specify if .I xipmsg freezes when send a message. .TP .BI "\-debug " n specifies debug level. .TP .B \-disable makes your name invisible. .TP .BI "\-name " entity-name specifies your name. It defaults to $USER. .TP .BI "\-port " Iportnumber specifies the UDP port number. It defaults to 2425. .SH FILES xbro*.xbm - icon bitmap files. .SH "SEE ALSO" X(1). .SH BUGS .SH AUTHORS .TP Original IP Messenger for Windows: Copyright (C) 1996, 1997 by H.Shirouzu .TP X version: Copyright (C) 1996, 1997 by Toshihiro Kanda xipmsg-0.8088.orig/XIpmsg.ad.in0000644001001300006200000001042510207542003016463 0ustar gotomgotom00000000000000! $Id: XIpmsg.ad.in,v 3.8 1997/04/08 05:59:16 candy Exp candy $ ! ! xipmsg.c - IP Messenger 1.20 for X11 ! Copyright (C) 1995, 1996 by candy ! ! XIpmsg.ad - app-default file for IP Messenger ! Copyright (C) 1996 by M.Suizu ! *international: True *inputMethod: kinput2 *Label.borderWidth: 0 *background: PeachPuff *showGrip: False *icon_label.bitmap: XIPM_XBMDIR/xbro00.xbm *icon_label2.bitmap: XIPM_XBMDIR/xbro08.xbm *icon_label2.mappedWhenManaged: False ! ! きかないなあ?? ! *Dialog.*.scrollVertical: always ! *commands.orientation: Horizontal *icon_label.fromHoriz: commands *get_zone.label: update *compose.label: send *disable.label: # *disable.skipAdjust: True *name_view.allowVert: True !*name_view.allowHoriz: True *name_list.defaultColumns: 1 *name_list.forceColumns: True ! ! (list.font.height + 2) * N + 4 *name_list.height: 109 ! ! list.font.width * N + 10 *name_list.width: 118 *send_to.value.height: 50 *send_to.value.width: 406 ! ! これもだめだなあ ! *send_to.value.scrollHorizontal: WhenNeeded ! *icon_button.bitmap: XIPM_XBMDIR/xbro00.xbm *icon_button.label: \000 *icon_button.menuName: icon_menu *icon_menu*SmeBSB.fontSet: -*-*-*-*-*-*-16-*-*-*-*-*-*-* *icon_menu*SmeBSB.vertSpace: 100 *icon_menu*SmeBSB.leftMargin: 40 *icon_menu*SmeBSB.label: \000 *icon_menu*icon00.leftBitmap: XIPM_XBMDIR/xbro00.xbm *icon_menu*icon01.leftBitmap: XIPM_XBMDIR/xbro01.xbm *icon_menu*icon02.leftBitmap: XIPM_XBMDIR/xbro02.xbm *icon_menu*icon03.leftBitmap: XIPM_XBMDIR/xbro03.xbm *icon_menu*icon04.leftBitmap: XIPM_XBMDIR/xbro04.xbm *icon_menu*icon05.leftBitmap: XIPM_XBMDIR/xbro05.xbm *icon_menu*icon06.leftBitmap: XIPM_XBMDIR/xbro06.xbm *icon_menu*icon07.leftBitmap: XIPM_XBMDIR/xbro07.xbm *icon_menu*icon08.leftBitmap: XIPM_XBMDIR/xbro08.xbm *icon_menu*icon09.leftBitmap: XIPM_XBMDIR/xbro09.xbm *icon_menu*icon10.leftBitmap: XIPM_XBMDIR/xbro10.xbm *icon_menu*icon11.leftBitmap: XIPM_XBMDIR/xbro11.xbm *icon_menu*icon12.leftBitmap: XIPM_XBMDIR/xbro12.xbm *icon_menu*icon13.leftBitmap: XIPM_XBMDIR/xbro13.xbm *icon_menu*icon14.leftBitmap: XIPM_XBMDIR/xbro14.xbm *icon_menu*icon15.leftBitmap: XIPM_XBMDIR/xbro15.xbm *err_popup*not_sent.label: Massage was not delivered *err_popup*too_long.label: Massage is too long.\n\ (Message + name + zone) must lesser than 256 bytes *fontSet:\n\ -misc-fixed-medium-r-normal--13-*-*-*-*--iso8859-1,\n\ -misc-fixed-medium-r-normal--14-*-*-*-*-*-jisx0201.1976-*,\n\ -misc-fixed-medium-r-normal--14-*-*-*-*-*-jisx0208.1983-*,\n\ -misc-fixed-medium-r-normal--14-*-*-*-*-*-jisx0213.2000-* *Command.fontSet: -*-fixed-bold-*-*-*-13-*-*-*-*-*-*-*,\n\ -misc-fixed-medium-r-normal--14-*-*-*-*-*-jisx0201.1976-*,\n\ -misc-fixed-medium-r-normal--14-*-*-*-*-*-jisx0208.1983-*,\n\ -misc-fixed-medium-r-normal--14-*-*-*-*-*-jisx0213.2000-* *Toggle.fontSet: -*-fixed-bold-*-*-*-13-*-*-*-*-*-*-*,\n\ -misc-fixed-medium-r-normal--14-*-*-*-*-*-jisx0201.1976-*,\n\ -misc-fixed-medium-r-normal--14-*-*-*-*-*-jisx0208.1983-*,\n\ -misc-fixed-medium-r-normal--14-*-*-*-*-*-jisx0213.2000-* *translations: #override\n Ctrlz: iconify_action() *level0*translations: #override\n\ Ctrlz: iconify_action() \n\ Metaq: direct_call_action(*quit) \n\ Metar: direct_call_action(*get_zone) \n\ Metap: direct_call_action(*plus) \n\ Metam: direct_call_action(*minus) \n\ Metad: disable_action() \n\ Ctrlp: list_key_named_action(Up) \n\ Ctrln: list_key_named_action(Down) \n\ Metav: list_key_named_action(Page_Up) \n\ Ctrlv: list_key_named_action(Page_Down) \n\ Return: direct_call_action(*compose) \n\ KP_Enter: direct_call_action(*compose) \n\ : call_name_list_action() *send_to*translations: #override\n\ Ctrlz: iconify_action() \n\ KP_Enter: direct_call_action(send) \n\ MetaReturn: direct_call_action(send) \n\ Metaw: direct_call_action(cancel) \n\ Metax: direct_call_action(clear) *recv_from*translations: #override\n\ Ctrlz: iconify_action() \n\ KP_Enter: direct_call_action(answer) \n\ Return: direct_call_action(answer) \n\ Metaw: direct_call_action(done) \n\ Metac: direct_call_action(select) *err_popup*translations: #override\n\ Ctrlz: iconify_action() \n\ Metaw: direct_call_action(ok) \n\ Return: direct_call_action(ok) \n\ Escape: direct_call_action(ok) xipmsg-0.8088.orig/XIpmsg_jp.ad.in0000644001001300006200000001016010207536200017152 0ustar gotomgotom00000000000000! $Id: XIpmsg_jp.ad.in,v 3.8 1997/04/08 06:00:25 candy Exp candy $ ! ! xipmsg.c - IP Messenger 1.20 for X11 ! Copyright (C) 1995, 1996 by candy ! ! XIpmsg.ad - app-default file for IP Messenger ! Copyright (C) 1996 by M.Suizu ! *international: True *inputMethod: kinput2 *Label.borderWidth: 0 *background: PeachPuff *showGrip: False *icon_label.bitmap: XIPM_XBMDIR/xbro00.xbm *icon_label2.bitmap: XIPM_XBMDIR/xbro08.xbm *icon_label2.mappedWhenManaged: False ! ! きかないなあ?? ! *Dialog.*.scrollVertical: always ! *commands.orientation: Horizontal *icon_label.fromHoriz: commands *quit.label: 終了 *get_zone.label: 更新 *compose.label: 送信 *disable.label: 留守 *disable.skipAdjust: True *name_view.allowVert: True !*name_view.allowHoriz: True *name_list.defaultColumns: 1 *name_list.forceColumns: True ! ! (list.font.height + 2) * N + 4 *name_list.height: 109 ! ! list.font.width * N + 10 *name_list.width: 118 *send_to.value.height: 50 *send_to.value.width: 406 *clear.label: 消去 *cancel.label: 中止 *send.label: 送信 *answer.label: 返信 *done.label: 閉じる *select.label: セレクト *open.label: 開封 ! ! これもだめだなあ ! *send_to.value.scrollHorizontal: WhenNeeded ! *icon_button.bitmap: XIPM_XBMDIR/xbro00.xbm *icon_button.label: \000 *icon_button.menuName: icon_menu !*icon_menu*SmeBSB.fontSet: -*-fixed-bold-*-*-*-16-*-*-*-*-*-*-* *icon_menu*SmeBSB.vertSpace: 100 *icon_menu*SmeBSB.leftMargin: 40 *icon_menu*SmeBSB.label: \000 *icon_menu*icon00.leftBitmap: XIPM_XBMDIR/xbro00.xbm *icon_menu*icon01.leftBitmap: XIPM_XBMDIR/xbro01.xbm *icon_menu*icon02.leftBitmap: XIPM_XBMDIR/xbro02.xbm *icon_menu*icon03.leftBitmap: XIPM_XBMDIR/xbro03.xbm *icon_menu*icon04.leftBitmap: XIPM_XBMDIR/xbro04.xbm *icon_menu*icon05.leftBitmap: XIPM_XBMDIR/xbro05.xbm *icon_menu*icon06.leftBitmap: XIPM_XBMDIR/xbro06.xbm *icon_menu*icon07.leftBitmap: XIPM_XBMDIR/xbro07.xbm *icon_menu*icon08.leftBitmap: XIPM_XBMDIR/xbro08.xbm *icon_menu*icon09.leftBitmap: XIPM_XBMDIR/xbro09.xbm *icon_menu*icon10.leftBitmap: XIPM_XBMDIR/xbro10.xbm *icon_menu*icon11.leftBitmap: XIPM_XBMDIR/xbro11.xbm *icon_menu*icon12.leftBitmap: XIPM_XBMDIR/xbro12.xbm *icon_menu*icon13.leftBitmap: XIPM_XBMDIR/xbro13.xbm *icon_menu*icon14.leftBitmap: XIPM_XBMDIR/xbro14.xbm *icon_menu*icon15.leftBitmap: XIPM_XBMDIR/xbro15.xbm *err_popup*not_sent.label: メッセージは送信できませんでした。 *err_popup*too_long.label: メッセージが長過ぎです。\n\ (メッセージ + 名前 + ゾーン) の合計を 256 バイト以内にしてください。 *ok.label: あっそ *fontSet:\ -misc-fixed-medium-r-normal--14-*-*-*-*--iso8859-1,\ -misc-fixed-medium-r-normal--14-*-*-*-*-*-jisx0201.1976-*,\ -misc-fixed-medium-r-normal--14-*-*-*-*-*-jisx0208.1983-*,\ -misc-fixed-medium-r-normal--14-*-*-*-*-*-jisx0213.2000-* !*Command.fontSet: -*-fixed-bold-*-*-*-13-*-*-*-*-*-*-* !*Toggle.fontSet: -*-fixed-bold-*-*-*-13-*-*-*-*-*-*-* *translations: #override\n Ctrlz: iconify_action() *level0*translations: #override\n\ Ctrlz: iconify_action() \n\ Metaq: direct_call_action(*quit) \n\ Metar: direct_call_action(*get_zone) \n\ Metap: direct_call_action(*plus) \n\ Metam: direct_call_action(*minus) \n\ Metad: disable_action() \n\ Ctrlp: list_key_named_action(Up) \n\ Ctrln: list_key_named_action(Down) \n\ Metav: list_key_named_action(Page_Up) \n\ Ctrlv: list_key_named_action(Page_Down) \n\ Return: direct_call_action(*compose) \n\ KP_Enter: direct_call_action(*compose) \n\ : call_name_list_action() *send_to*translations: #override\n\ Ctrlz: iconify_action() \n\ KP_Enter: direct_call_action(send) \n\ MetaReturn: direct_call_action(send) \n\ Metaw: direct_call_action(cancel) \n\ Metax: direct_call_action(clear) *recv_from*translations: #override\n\ Ctrlz: iconify_action() \n\ KP_Enter: direct_call_action(answer) \n\ Return: direct_call_action(answer) \n\ Metaw: direct_call_action(done) \n\ Metac: direct_call_action(select) *err_popup*translations: #override\n\ Ctrlz: iconify_action() \n\ Metaw: direct_call_action(ok) \n\ Return: direct_call_action(ok) \n\ Escape: direct_call_action(ok) xipmsg-0.8088.orig/xbro00.xbm0000644001001300006200000000133706240627013016174 0ustar gotomgotom00000000000000#define ipmsg_width 32 #define ipmsg_height 32 static char ipmsg_bits[] = { 0xff,0xff,0xff,0xff,0x01,0x54,0x55,0xa5,0x01,0x94,0x54,0xaa,0x01,0xa8,0x4a, 0xd5,0x01,0x50,0x55,0xa1,0x01,0xa8,0x50,0xc8,0x01,0x90,0xa0,0xa0,0x01,0x50, 0x24,0xc8,0x01,0xa8,0x20,0xa2,0x01,0x54,0x88,0xa0,0x01,0x54,0x22,0xaa,0x07, 0xa5,0x08,0xd0,0x79,0x55,0xa1,0xaa,0x47,0x95,0x0a,0xd4,0xa9,0xaa,0x20,0x92, 0x2b,0x09,0x08,0xd5,0x55,0x05,0xa0,0xaa,0xab,0x40,0x0a,0xca,0xa5,0x10,0x20, 0xd5,0x2b,0x44,0x0d,0xa9,0x55,0x80,0x52,0xca,0x13,0xa8,0x0a,0xaa,0x2f,0x62, 0x8f,0xf8,0x3b,0xc8,0x25,0xa8,0x2b,0x71,0x8f,0xfa,0x3d,0xb0,0x75,0xac,0x57, 0x6d,0xdf,0xff,0xfb,0xff,0x6a,0xff,0x57,0xff,0xb7,0xfd,0xfb,0xfe,0xff,0xff, 0xd7,0xed,0xff,0xff,0xff,0xff,0xff,0xff}; xipmsg-0.8088.orig/xbro01.xbm0000644001001300006200000000157206240630726016203 0ustar gotomgotom00000000000000#define xbro01_width 32 #define xbro01_height 32 static unsigned char xbro01_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0xc0, 0x01, 0x38, 0x00, 0x60, 0x01, 0x50, 0x00, 0xb0, 0x00, 0xa8, 0x00, 0x58, 0xf0, 0x5f, 0x01, 0x68, 0xac, 0xaa, 0x01, 0xd4, 0x56, 0x40, 0x01, 0xac, 0x0b, 0xb3, 0x02, 0x54, 0x85, 0x4c, 0x01, 0xa8, 0x4a, 0x48, 0x01, 0x50, 0x45, 0x88, 0x01, 0xb0, 0x4a, 0x90, 0x01, 0x60, 0x45, 0xbc, 0x02, 0xc0, 0x4a, 0x7c, 0x02, 0x80, 0x45, 0x9c, 0x04, 0x80, 0x8a, 0x08, 0x05, 0x80, 0x15, 0x8f, 0x04, 0x80, 0x0a, 0x70, 0x04, 0x00, 0x85, 0x00, 0x02, 0x00, 0x0a, 0xbf, 0x01, 0x00, 0x14, 0x40, 0x00, 0x00, 0xf8, 0x3f, 0x00}; xipmsg-0.8088.orig/xbro02.xbm0000644001001300006200000000157206240630726016204 0ustar gotomgotom00000000000000#define xbro02_width 32 #define xbro02_height 32 static unsigned char xbro02_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x08, 0x00, 0x10, 0x42, 0x08, 0x02, 0x20, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x10, 0x00, 0x00, 0x0c, 0x08, 0xc0, 0x01, 0x38, 0x00, 0x60, 0x01, 0x50, 0x00, 0xb0, 0x00, 0xa8, 0x00, 0x58, 0xf0, 0x5f, 0x01, 0x68, 0xac, 0xaa, 0x01, 0xd4, 0x56, 0x40, 0x01, 0xac, 0x0b, 0xb3, 0x02, 0x54, 0x85, 0x4c, 0x01, 0xa8, 0x4a, 0x48, 0x01, 0x50, 0x45, 0x88, 0x01, 0xb0, 0x4a, 0xb0, 0x01, 0x60, 0x45, 0x9c, 0x02, 0xc0, 0x4a, 0x72, 0x02, 0x80, 0x45, 0x98, 0x04, 0x80, 0x8a, 0x08, 0x05, 0x80, 0x15, 0x8f, 0x04, 0x80, 0x0a, 0x70, 0x04, 0x00, 0x85, 0x00, 0x02, 0x00, 0x0a, 0xbf, 0x01, 0x00, 0x14, 0x40, 0x00, 0x00, 0xf8, 0x3f, 0x00}; xipmsg-0.8088.orig/xbro03.xbm0000644001001300006200000000157206236316066016210 0ustar gotomgotom00000000000000#define xbro03_width 32 #define xbro03_height 32 static unsigned char xbro03_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0xc0, 0x00, 0x90, 0x00, 0x20, 0x01, 0x80, 0x00, 0x20, 0x00, 0x40, 0x0c, 0x46, 0x00, 0x00, 0x12, 0x09, 0x00, 0x00, 0x10, 0x01, 0x00, 0x0c, 0x08, 0xc2, 0x01, 0x38, 0x00, 0x60, 0x01, 0x50, 0x00, 0xb0, 0x00, 0xa8, 0x00, 0x58, 0xf0, 0x5f, 0x01, 0x68, 0xac, 0xaa, 0x01, 0xd4, 0x56, 0x40, 0x01, 0xac, 0x0b, 0xb3, 0x02, 0x54, 0x85, 0x4c, 0x01, 0xa8, 0x4a, 0x48, 0x01, 0x50, 0x45, 0xb8, 0x01, 0xb0, 0x4a, 0xae, 0x01, 0x60, 0x45, 0xb2, 0x02, 0xc0, 0x4a, 0x72, 0x02, 0x80, 0x45, 0x94, 0x04, 0x80, 0x8a, 0x08, 0x05, 0x80, 0x15, 0x8f, 0x04, 0x80, 0x8a, 0x70, 0x05, 0x00, 0x45, 0x00, 0x02, 0x00, 0x4a, 0x7c, 0x01, 0x00, 0x94, 0x82, 0x00, 0x00, 0xf8, 0x7f, 0x00}; xipmsg-0.8088.orig/xbro04.xbm0000644001001300006200000000157206236316066016211 0ustar gotomgotom00000000000000#define xbro04_width 32 #define xbro04_height 32 static unsigned char xbro04_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x01, 0x70, 0x00, 0x20, 0x02, 0x88, 0x00, 0x20, 0x02, 0x88, 0x00, 0x00, 0x01, 0x40, 0x00, 0x80, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0xc0, 0x01, 0x38, 0x00, 0x60, 0x01, 0x50, 0x00, 0xb0, 0x00, 0xa8, 0x00, 0x58, 0xf0, 0x5f, 0x01, 0x68, 0xac, 0xaa, 0x01, 0xd4, 0x56, 0x40, 0x01, 0xac, 0x0b, 0xb3, 0x02, 0x54, 0x85, 0x4c, 0x01, 0xa8, 0x4a, 0x48, 0x01, 0x50, 0x45, 0x88, 0x01, 0xb0, 0x4a, 0x90, 0x01, 0x60, 0x45, 0xbc, 0x02, 0xc0, 0x4a, 0x7c, 0x02, 0x80, 0x45, 0x9c, 0x04, 0x80, 0x8a, 0x08, 0x05, 0x80, 0x15, 0x8f, 0x04, 0x80, 0x0a, 0x70, 0x04, 0x00, 0x85, 0x00, 0x02, 0x00, 0x0a, 0xbf, 0x01, 0x00, 0x14, 0x40, 0x00, 0x00, 0xf8, 0x3f, 0x00}; xipmsg-0.8088.orig/xbro05.xbm0000644001001300006200000000157206236316066016212 0ustar gotomgotom00000000000000#define xbro05_width 32 #define xbro05_height 32 static unsigned char xbro05_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0xc0, 0x01, 0x38, 0x00, 0x60, 0x01, 0x50, 0x00, 0xb0, 0x00, 0xa8, 0x00, 0x58, 0xf0, 0x5f, 0x01, 0x68, 0xac, 0xaa, 0x01, 0xd4, 0x56, 0x40, 0x01, 0xac, 0x0b, 0xb3, 0x02, 0x54, 0x85, 0x4c, 0x01, 0xa8, 0x4a, 0x48, 0x01, 0x50, 0x45, 0x88, 0x01, 0xb0, 0x4a, 0x90, 0x01, 0x60, 0x45, 0xbc, 0x02, 0xc0, 0x4a, 0x7c, 0x02, 0x80, 0x45, 0x9c, 0x04, 0x80, 0x8a, 0x08, 0x05, 0x80, 0x15, 0x8f, 0x04, 0x80, 0x0a, 0x70, 0x04, 0x00, 0x85, 0x00, 0x02, 0x00, 0x0a, 0xbf, 0x01, 0x00, 0x14, 0x40, 0x00, 0x00, 0xf8, 0x3f, 0x00}; xipmsg-0.8088.orig/xbro06.xbm0000644001001300006200000000157206236316066016213 0ustar gotomgotom00000000000000#define xbro06_width 32 #define xbro06_height 32 static unsigned char xbro06_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0xc0, 0x01, 0x38, 0x00, 0x60, 0x01, 0x50, 0x00, 0xb0, 0x00, 0xa8, 0x00, 0x58, 0xf0, 0x5f, 0x01, 0x68, 0xac, 0xaa, 0x01, 0xd4, 0x56, 0x40, 0x01, 0xac, 0x0b, 0xb3, 0x02, 0x54, 0x85, 0x4c, 0x01, 0xa8, 0x4a, 0x48, 0x01, 0x50, 0x45, 0x88, 0x01, 0xb0, 0x4a, 0x90, 0x01, 0x60, 0x45, 0xbc, 0x02, 0xc0, 0x4a, 0x7c, 0x02, 0x80, 0x85, 0x9c, 0x04, 0x80, 0x0a, 0x09, 0x05, 0x80, 0x95, 0x8e, 0x04, 0x80, 0x0a, 0x70, 0x04, 0x00, 0x45, 0x00, 0x02, 0x00, 0x0a, 0xb8, 0x01, 0x00, 0x54, 0x40, 0x00, 0x00, 0xf8, 0x3f, 0x00}; xipmsg-0.8088.orig/xbro07.xbm0000644001001300006200000000157206236316066016214 0ustar gotomgotom00000000000000#define xbro08_width 32 #define xbro08_height 32 static unsigned char xbro08_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x82, 0x00, 0x00, 0x00, 0x81, 0x00, 0x00, 0x80, 0x88, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x0c, 0x00, 0xc0, 0x01, 0x38, 0x00, 0x60, 0x01, 0x50, 0x00, 0xb0, 0x00, 0xa8, 0x00, 0x58, 0xf0, 0x5f, 0x01, 0x68, 0xac, 0xaa, 0x01, 0xd4, 0x56, 0x40, 0x01, 0xac, 0x8b, 0xb1, 0x02, 0x54, 0x45, 0x52, 0x01, 0xa8, 0x4a, 0x4c, 0x01, 0x50, 0x45, 0x88, 0x01, 0xb0, 0x4a, 0x90, 0x01, 0x60, 0x45, 0xbc, 0x02, 0xc0, 0x4a, 0x7c, 0x02, 0x80, 0x45, 0x9c, 0x04, 0x80, 0x8a, 0x08, 0x05, 0x80, 0x15, 0x8f, 0x04, 0x80, 0x0a, 0x70, 0x04, 0x00, 0x15, 0x00, 0x02, 0x00, 0x2a, 0xb8, 0x01, 0x00, 0x54, 0x44, 0x00, 0x00, 0xf8, 0x3f, 0x00}; xipmsg-0.8088.orig/xbro08.xbm0000644001001300006200000000157206236316066016215 0ustar gotomgotom00000000000000#define xbro08_width 32 #define xbro08_height 32 static unsigned char xbro08_bits[] = { 0x00, 0x00, 0x03, 0x00, 0x70, 0x00, 0x0e, 0x00, 0x58, 0x00, 0x14, 0x00, 0x2c, 0x00, 0x2a, 0x00, 0x16, 0xfc, 0x57, 0x00, 0x1a, 0xab, 0x6a, 0x00, 0xb5, 0x15, 0x50, 0x00, 0xeb, 0xc2, 0xac, 0x00, 0x55, 0x21, 0x53, 0x00, 0xaa, 0x12, 0x52, 0x00, 0x54, 0x11, 0x62, 0x00, 0xac, 0x12, 0x64, 0x00, 0x58, 0x11, 0xaf, 0x00, 0xb0, 0x12, 0x9f, 0x00, 0x60, 0x11, 0x27, 0x01, 0xa0, 0x22, 0x42, 0x01, 0x60, 0xc5, 0x23, 0x01, 0xa0, 0x02, 0x1c, 0x09, 0x40, 0x21, 0x80, 0x64, 0x80, 0xc2, 0x6f, 0x32, 0x00, 0x05, 0x10, 0x9a, 0x00, 0xaa, 0xca, 0x4c, 0x00, 0x56, 0x65, 0x37, 0x00, 0xab, 0xba, 0x02, 0x00, 0x55, 0x55, 0x03, 0x00, 0xab, 0xaf, 0x02, 0x00, 0xf5, 0x5d, 0x01, 0x80, 0xaa, 0xfa, 0x00, 0x80, 0x55, 0x15, 0x00, 0x80, 0xab, 0x1a, 0x00, 0x80, 0x5f, 0x15, 0x00, 0x80, 0xfa, 0x1b, 0x00}; xipmsg-0.8088.orig/xbro09.xbm0000644001001300006200000000157206236316066016216 0ustar gotomgotom00000000000000#define xbro09_width 32 #define xbro09_height 32 static unsigned char xbro09_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x07, 0x88, 0x00, 0x80, 0x08, 0x08, 0x01, 0x40, 0x08, 0x38, 0x02, 0x20, 0x0e, 0x48, 0x04, 0x10, 0x09, 0x88, 0x08, 0x88, 0x08, 0x08, 0x09, 0x48, 0x08, 0x08, 0xf1, 0x47, 0x08, 0x08, 0x81, 0x40, 0x08, 0x08, 0xc0, 0x01, 0x08, 0x08, 0x80, 0x00, 0x08, 0x04, 0x00, 0x00, 0x10, 0x04, 0x1f, 0x7c, 0x10, 0x9c, 0x20, 0x82, 0x1c, 0x5f, 0x40, 0x01, 0x7d, 0x44, 0x70, 0x07, 0x11, 0x5f, 0x78, 0x0f, 0x7d, 0x5c, 0x78, 0x0f, 0x1d, 0x47, 0x70, 0x07, 0x71, 0xbc, 0x20, 0x82, 0x1e, 0x7c, 0x9f, 0x7c, 0x1f, 0x08, 0x00, 0x00, 0x08, 0x08, 0x00, 0x00, 0x08, 0x30, 0xe0, 0x03, 0x06, 0xc0, 0x00, 0x80, 0x01, 0x00, 0xff, 0x7f, 0x00}; xipmsg-0.8088.orig/xbro10.xbm0000644001001300006200000000157206236316066016206 0ustar gotomgotom00000000000000#define xbro10_width 32 #define xbro10_height 32 static unsigned char xbro10_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x7f, 0x00, 0x00, 0x78, 0x80, 0x01, 0x00, 0x07, 0x00, 0x06, 0xc0, 0x30, 0x00, 0x08, 0x20, 0x06, 0x00, 0x10, 0xd0, 0x00, 0x00, 0x20, 0x08, 0x00, 0x00, 0x40, 0x04, 0x00, 0x00, 0x40, 0x82, 0xff, 0xff, 0x87, 0x79, 0x88, 0x44, 0xb8, 0x07, 0x04, 0x83, 0xc0, 0x01, 0xc4, 0x8f, 0x80, 0x03, 0xc4, 0x8f, 0xc0, 0x3d, 0x04, 0x83, 0xb0, 0xc2, 0x8b, 0x44, 0x4e, 0x0c, 0xfc, 0xff, 0x21, 0x30, 0x00, 0x00, 0x18, 0xe0, 0x03, 0x00, 0x0e, 0x10, 0xfc, 0xff, 0x11, 0x30, 0x10, 0x10, 0x18, 0x20, 0x11, 0x10, 0x09, 0xc0, 0x0e, 0xe0, 0x06, 0x00, 0x00, 0x00, 0x00}; xipmsg-0.8088.orig/xbro11.xbm0000644001001300006200000000157206236316065016206 0ustar gotomgotom00000000000000#define xbro11_width 32 #define xbro11_height 32 static unsigned char xbro11_bits[] = { 0x80, 0x1f, 0xf8, 0x01, 0x40, 0x20, 0x04, 0x02, 0x40, 0x20, 0x04, 0x02, 0x20, 0x40, 0x02, 0x04, 0x20, 0x40, 0x02, 0x04, 0x20, 0x40, 0x02, 0x04, 0x20, 0x40, 0x02, 0x04, 0x20, 0x40, 0x02, 0x04, 0x20, 0x40, 0x02, 0x04, 0x20, 0x40, 0x02, 0x04, 0x20, 0x40, 0x02, 0x04, 0x20, 0x40, 0x02, 0x04, 0x20, 0x40, 0x02, 0x04, 0x20, 0xc0, 0x03, 0x04, 0x20, 0x00, 0x00, 0x04, 0x20, 0x00, 0x00, 0x04, 0x10, 0x00, 0x00, 0x08, 0x08, 0x00, 0x00, 0x10, 0x08, 0x00, 0x00, 0x10, 0x04, 0x00, 0x00, 0x20, 0x04, 0x00, 0x00, 0x20, 0x04, 0x00, 0x00, 0x20, 0x04, 0x60, 0x06, 0x20, 0x04, 0x60, 0x06, 0x20, 0x04, 0x60, 0x06, 0x20, 0x04, 0x60, 0x06, 0x20, 0x04, 0x00, 0x00, 0x20, 0x08, 0x00, 0x00, 0x10, 0x08, 0x00, 0x00, 0x10, 0x10, 0x00, 0x00, 0x08, 0x60, 0x00, 0x00, 0x06, 0x80, 0xff, 0xff, 0x01}; xipmsg-0.8088.orig/xbro12.xbm0000644001001300006200000000133406236316065016203 0ustar gotomgotom00000000000000#define kuma_width 32 #define kuma_height 32 static char kuma_bits[] = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x20,0x01,0x00,0x00,0x40,0x04,0xe0, 0x03,0x90,0xf2,0x50,0x85,0x27,0xa9,0xe9,0xcb,0x4a,0x74,0x37,0x76,0x17,0x8a, 0x1e,0xbc,0x28,0x06,0x15,0x54,0x30,0x07,0x1b,0x6c,0x70,0x05,0x35,0x56,0x50, 0x8b,0xea,0xab,0x68,0x75,0x55,0x55,0x57,0xab,0xfa,0xaf,0x6a,0x55,0x0d,0x58, 0x55,0xab,0x02,0xa0,0x6a,0x55,0x01,0x40,0x55,0xab,0x00,0x80,0x6a,0xd5,0x00, 0x80,0x55,0xab,0x00,0x80,0x6a,0xd6,0x00,0x80,0x35,0xaa,0x01,0xc0,0x2a,0x54, 0x03,0x60,0x15,0xa8,0x0e,0xb8,0x0a,0x70,0xf5,0x57,0x07,0xc0,0xaa,0xaa,0x01, 0x00,0x57,0x75,0x00,0x00,0xf8,0x0f,0x00}; xipmsg-0.8088.orig/xbro13.xbm0000644001001300006200000000133106236316065016201 0ustar gotomgotom00000000000000#define lan_width 32 #define lan_height 32 static char lan_bits[] = { 0xe0,0x00,0x00,0x1f,0x50,0x07,0xc0,0x35,0xb0,0xfa,0xbf,0x2a,0x58,0x55,0x55, 0x35,0xa8,0xaa,0xaa,0x2a,0x58,0x55,0x55,0x55,0xa8,0xaa,0xaa,0x6a,0x58,0x55, 0x55,0x55,0xa8,0xaa,0xaa,0x6a,0x58,0x01,0x55,0x50,0xa8,0x00,0x08,0x60,0x58, 0x18,0x00,0x46,0x28,0x18,0x00,0x46,0x50,0x00,0x00,0x40,0x30,0x30,0x00,0x46, 0x30,0x78,0x00,0x4f,0x30,0x78,0x00,0x4f,0x20,0x30,0x00,0x46,0x20,0x00,0x00, 0x40,0x58,0x00,0x00,0x40,0x6c,0x00,0x00,0x40,0xd6,0x00,0x60,0x40,0xab,0x00, 0xf0,0x40,0x55,0x01,0x60,0x20,0xaa,0x02,0x00,0x20,0x55,0x05,0x00,0x30,0xaa, 0x1a,0x00,0x38,0x55,0x61,0xf8,0x6f,0xaa,0x80,0x27,0x55,0x55,0x00,0x04,0x6b, 0xaa,0x00,0x88,0xd0,0x55,0x00,0x70,0xa8}; xipmsg-0.8088.orig/xbro14.xbm0000644001001300006200000000133706236316065016210 0ustar gotomgotom00000000000000#define teddy_width 32 #define teddy_height 32 static char teddy_bits[] = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xf8,0xe1,0x01, 0x00,0x04,0x1e,0x7e,0x1e,0x02,0x00,0x80,0x61,0xf2,0x00,0x00,0x40,0x7a,0x00, 0x00,0x9c,0x7a,0x00,0x00,0xb8,0x3a,0x00,0x00,0xb0,0x32,0x00,0x00,0xb0,0x14, 0x00,0x00,0xa0,0x04,0x00,0x00,0x80,0x08,0x00,0x00,0x40,0x10,0x18,0x00,0x40, 0x10,0xd8,0x33,0x30,0x10,0x20,0x34,0x08,0x10,0x10,0x08,0x08,0x10,0x88,0x11, 0x08,0x20,0x88,0x11,0x04,0x20,0x08,0x10,0x04,0x40,0xc8,0x13,0x02,0xc0,0x13, 0x88,0x01,0x20,0xff,0xff,0x03,0x18,0xfe,0xff,0x0c,0x04,0xf8,0x7f,0x30,0x02, 0xf0,0x1f,0x40,0x01,0xf8,0x3c,0x80,0x00,0x78,0x7c,0x00,0x00,0x7c,0xf8,0x00, 0x00,0x3c,0xf0,0x00,0x00,0x00,0x00,0x00}; xipmsg-0.8088.orig/xbro15.xbm0000644001001300006200000000157206244263440016207 0ustar gotomgotom00000000000000#define daemon_width 32 #define daemon_height 32 static unsigned char daemon_bits[] = { 0x00, 0xc0, 0x00, 0x00, 0x00, 0x70, 0x00, 0x0e, 0x00, 0x28, 0x00, 0x1a, 0x00, 0x54, 0x00, 0x34, 0x00, 0xea, 0x3f, 0x68, 0x00, 0x56, 0xd5, 0x58, 0x00, 0x0a, 0xa8, 0xad, 0x00, 0x35, 0x43, 0xd7, 0x00, 0xca, 0x84, 0xaa, 0x00, 0x4a, 0x48, 0x55, 0x00, 0x46, 0x88, 0x2a, 0x00, 0x26, 0x48, 0x35, 0x00, 0xf5, 0x88, 0x1a, 0x00, 0xf9, 0x48, 0x0d, 0x80, 0xe4, 0x88, 0x06, 0x80, 0x42, 0x44, 0x05, 0x80, 0xc4, 0xa3, 0x06, 0x90, 0x38, 0x40, 0x05, 0x26, 0x01, 0x84, 0x02, 0x4c, 0xf6, 0x43, 0x01, 0x59, 0x08, 0xa0, 0x00, 0x32, 0x53, 0x55, 0x00, 0xec, 0xa6, 0x6a, 0x00, 0x40, 0x5d, 0xd5, 0x00, 0xc0, 0xaa, 0xaa, 0x00, 0x40, 0xf5, 0xd5, 0x00, 0x80, 0xba, 0xaf, 0x00, 0x00, 0x5f, 0x55, 0x01, 0x00, 0xa8, 0xaa, 0x01, 0x00, 0x58, 0xd5, 0x01, 0x00, 0xa8, 0xfa, 0x01, 0x00, 0xd8, 0x5f, 0x01}; xipmsg-0.8088.orig/Ad2c/0000755001001300006200000000000006247051125015121 5ustar gotomgotom00000000000000xipmsg-0.8088.orig/Ad2c/Imakefile0000644001001300006200000000100706247051125016730 0ustar gotomgotom00000000000000# # Imakefile for ad2c - Convert X resources to C decls # # George Ferguson, ferguson@cs.rochester.edu, 19 Mar 1991. # # Where do you want this (if the default isn't okay)? #BINDIR = bin #MANDIR = man/man1 # Default suffix is "1", change if you change MANDIR I guess ##undef ManSuffix ##define ManSuffix l # Why is this not the default? INSTPGMFLAGS = -m 0755 AllTarget(ad2c) depend: @echo 'no need to depend for ad2c' ad2c: @echo 'ad2c is up to date' InstallScript(ad2c,$(BINDIR)) InstallManPage(ad2c,$(MANDIR)) xipmsg-0.8088.orig/Ad2c/README0000644001001300006200000000431206247051125016001 0ustar gotomgotom00000000000000 README for AD2C - convert resource files to C decls George Ferguson, ferguson@cs.rochester.edu 12 Nov 1990 Updated 19 Apr 1993 DESCRIPTION: Ad2c is a program which converts X resource files into C declarations appropriate for inclusion as fallback resources. The program is a sed script which is effectively a finite state machine, escaping quotes and backslashes (and newlines where necessary), and adding quotes and commas as needed for array initialization. DISCLAIMER: This software is provided as is with no warranty expressed or implied. I hope you find it useful, but I won't be held responsable for any damage that may occur from reading, compiling, installing or using it. You are free to use any part of this code for other purposes. It would be nice if you could keep my name on some part of whatever the final product is. INSTALLATION: 1. Edit the Imakefile to change the installation directories if desired. 2. Execute "xmkmf" to make the Makefile. 3. Execute "make install" to install ad2c, and/or "make install.man" to install the man page. Making ad2c itself is unnecessary. HISTORY: 12 Nov 1990 - Written and released to alt.sources. 19 Mar 1991 From: ferguson@cs.rochester.edu - Made it "self-contained" (ie. eliminated ad2c.sed) - Added Imakefile From: jerbil@ultra.com (Joseph Beckenbach) - Wrote man page. 22 Jul 1991 From: ferguson@cs.rochester.edu - Added USAGE section to man page and converted it to use italic rather than bold font. Version 1.4: 6 Jan 1992 From: tim@cs.wisc.edu (Tim Theisen) - Fixed example in man page. From: mycroft@gnu.ai.mit.edu (Charles Hannum) - Changes to work with Gnu and IBM sed, instead of relying or quirky SunOS "-n" behaviour. Version 1.5: 7 Jan 1992 From: matthew@sunpix.East.Sun.COM (Matthew Stier) - Escape quotes after escaping backslashes. Version 1.6: 8 Jul 1992 From: davidw@vista.atmos.uiuc.edu (David Wojtowicz) - Semicolon after close-paren in example in manpage. Version 1.7: 19 Apr 1993 From: ferguson@cs.rochester.edu - Remove comments inside sed command, and just put them in the text. xipmsg-0.8088.orig/Ad2c/ad2c.man0000644001001300006200000000445306247051125016435 0ustar gotomgotom00000000000000.TH ad2c 1 "19 Apr 1993" .SH NAME ad2c \- convert resource files to C declarations .SH SYNOPSIS .I ad2c [ files ] .SH DESCRIPTION .LP .I Ad2c converts X resource files into C declarations, appropriate for inclusion as fallback resources. The program is a .IR sed (1) script which is effectively a finite state machine, escaping quotes and backslashes (and newlines where necessary), and adding quotes and commas as needed for array initialization. .LP It reads from the given files (or stdin if none are given) and writes the C declarations to stdout. .SH USAGE The following example shows a typical use of .I ad2c to ensure that an application always has the latest version of its resources compiled into the executable. Suppose the application defaults file is named "Foobar.ad", for application .IR foobar . Then the following lines in a Makefile or Imakefile will indicate how and when to run .IR ad2c : .nf .na Foobar.ad.h: Foobar.ad ad2c Foobar.ad >Foobar.ad.h .ad .fi The resulting C strings should be included (say in "foobar.c"): .nf .na static char fallback_resources[] = { #include "Foobar.ad.h" NULL }; .ad .fi This array of strings can then be given as a parameter to .IR XtAppInitialize (3X) or otherwise used to initialize the application's resources. Running .I makedepend or adding the line .nf .na foobar.c: Foobar.ad.h .ad .fi to the Makefile or Imakefile will ensure that "foobar.c" is recompiled when necessary (ie., whenever "Foobar.ad" changes). .SH "RETURN VALUE" .LP .I Ad2c returns as for .IR sed . .SH "SEE ALSO" sed(1) .SH DISCLAIMER .LP This software is provided as is with no warranty expressed or implied. I hope you find it useful, but I won't be held responsable for any damage that may occur from reading, compiling, installing or using it. .LP You are free to use any part of this code for other purposes. It would be nice if you could keep my name on some part of whatever the final product is. .SH AUTHOR .LP George Ferguson, ferguson@cs.rochester.edu. .LP Man page by Joseph Beckenbach, jerbil@ultra.com. Usage section added by George Ferguson. Example corrected by Tim Theisen, tim@cs.wisc.edu. Example further corrected by David Wojtowicz, davidw@vista.atmos.uiuc.edu. .LP Modified to work with Gnu and IBM sed by Charles Hannum, mycroft@gnu.ai.mit.edu. xipmsg-0.8088.orig/Ad2c/ad2c.script0000555001001300006200000000315106247051125017161 0ustar gotomgotom00000000000000#!/bin/sh # # ad2c : Convert app-defaults file to C strings decls. # # George Ferguson, ferguson@cs.rcohester.edu, 12 Nov 1990. # 19 Mar 1991: gf # Made it self-contained. # 6 Jan 1992: mycroft@gnu.ai.mit.edu (Charles Hannum) # Removed use of "-n" and ":read" label since Gnu and # IBM sed print pattern space on "n" command. Still works # with Sun sed, of course. # 7 Jan 1992: matthew@sunpix.East.Sun.COM (Matthew Stier) # Escape quotes after escaping backslashes. # 8 Jul 1992: Version 1.6 # Manpage fixes. # 19 Apr 1993: Version 1.7 # Remove comments that were inside the sed command since # some versions of sed don't like them. The comments are # now given here in the header. # # Comments on the script by line: # /^!/d Remove comments # /^$/d Remove blanks # s/\\/\\\\/g Escape backslashes... # s/\\$//g ...except the line continuation ones # s/"/\\"/g Escape quotes # s/^/"/ Add leading quote # : test Establish label for later branch # /\\$/b slash Branch to label "slash" if line ends in backslash # s/$/",/ Otherwise add closing quote and comma... # p ...output the line... # d ...and clear the pattern space so it's not printed again # : slash Branch comes here if line ends in backslash # n Read next line, append to pattern space # [...] The "d" and "s" commands that follow just delete # comments and blank lines and escape control sequences # b test Branch up to see if the line ends in backslash or not # sed ' /^!/d /^$/d s/\\/\\\\/g s/\\$//g s/"/\\"/g s/^/"/ : test /\\$/b slash s/$/",/ p d : slash n /^!/d /^$/d s/"/\\"/g s/\\\\/\\/g s/\\n/\\\\n/g s/\\t/\\\\t/g s/\\f/\\\\f/g s/\\b/\\\\b/g b test' "$@" xipmsg-0.8088.orig/udpmsg/0000755001001300006200000000000010212771011015635 5ustar gotomgotom00000000000000xipmsg-0.8088.orig/udpmsg/brocas.h0000777001001300006200000000000010214322655021121 2../brocas.hustar gotomgotom00000000000000xipmsg-0.8088.orig/udpmsg/dyna.h0000777001001300006200000000000010214322655020265 2../dyna.hustar gotomgotom00000000000000xipmsg-0.8088.orig/udpmsg/kanji.c0000777001001300006200000000000010214322655020555 2../kanji.custar gotomgotom00000000000000xipmsg-0.8088.orig/udpmsg/Makefile0000644001001300006200000000052210212755622017306 0ustar gotomgotom00000000000000# .if 0 && exists(/usr/local/lib/libsocks5.a) SOCKSDEF=-DSOCKS -I/usr/local/include SOCKSLIB=-L/usr/local/lib -lsocks5 .endif CFLAGS=-g -O -Wall -pipe -static $(SOCKSDEF) SRCS=udpmsg.c kanji.c OBJS=$(SRCS:S/.c/.o/) LDLIBS=$(SOCKSLIB) all: udpmsg udpmsg: $(OBJS) $(CC) $(CFLAGS) -o $@ $(OBJS) $(LDLIBS) clean: -rm -f errs udpmsg *.o xipmsg-0.8088.orig/udpmsg/kanji.h0000777001001300006200000000000010214322655020567 2../kanji.hustar gotomgotom00000000000000xipmsg-0.8088.orig/udpmsg/xipmsg.h0000777001001300006200000000000010214322655021215 2../xipmsg.hustar gotomgotom00000000000000xipmsg-0.8088.orig/udpmsg/udpmsg.c0000644001001300006200000001624107057372440017324 0ustar gotomgotom00000000000000/* * brocas.c - IP Messenger 1.20 protocol * Copyright (C) 1996 by candy */ char rcsid_brocas[] = "$Id: brocas.c,v 3.1 1996/11/21 13:28:23 candy Exp candy $"; #include #include #include #include #include #include #include #include /* setitimer() */ /* includes below are order dependent */ #include /* htons() */ #include /* socket() */ #include /* socket() */ #include /* inet_addr() INADDR_ANY */ #include /* inet_addr() */ #include /* gethostbyname() */ #ifdef SOCKS #include #endif #include "xipmsg.h" #include "kanji.h" #include "brocas.h" #include "dyna.h" #if defined BSD4_4 #define SENDTO(s,msg,len,flags,to,tolen) sendto(s,msg,len,flags,to,tolen) #define SETSOCKOPT(s,level,optname,optval,optlen) setsockopt(s,level,optname,optval,optlen) #else #define SENDTO(s,msg,len,flags,to,tolen) sendto(s,msg,len,flags,(struct sockaddr *)to,tolen) #define SETSOCKOPT(s,level,optname,optval,optlen) setsockopt(s,level,optname,(char *)optval,optlen) #endif static int debug_flag; static int bro_socket; static int bro_port; static char *bro_user; static const char *bro_host; static int verbose; static char *myname; #define lan_width 32 #define lan_height 32 static unsigned char lan_bits[] = { 0xe0,0x00,0x00,0x1f,0x50,0x07,0xc0,0x35,0xb0,0xfa,0xbf,0x2a,0x58,0x55,0x55, 0x35,0xa8,0xaa,0xaa,0x2a,0x58,0x55,0x55,0x55,0xa8,0xaa,0xaa,0x6a,0x58,0x55, 0x55,0x55,0xa8,0xaa,0xaa,0x6a,0x58,0x01,0x55,0x50,0xa8,0x00,0x08,0x60,0x58, 0x18,0x00,0x46,0x28,0x18,0x00,0x46,0x50,0x00,0x00,0x40,0x30,0x30,0x00,0x46, 0x30,0x78,0x00,0x4f,0x30,0x78,0x00,0x4f,0x20,0x30,0x00,0x46,0x20,0x00,0x00, 0x40,0x58,0x00,0x00,0x40,0x6c,0x00,0x00,0x40,0xd6,0x00,0x60,0x40,0xab,0x00, 0xf0,0x40,0x55,0x01,0x60,0x20,0xaa,0x02,0x00,0x20,0x55,0x05,0x00,0x30,0xaa, 0x1a,0x00,0x38,0x55,0x61,0xf8,0x6f,0xaa,0x80,0x27,0x55,0x55,0x00,0x04,0x6b, 0xaa,0x00,0x88,0xd0,0x55,0x00,0x70,0xa8 }; static unsigned char *icon = lan_bits; static unsigned long atoaddr(const char *host) { unsigned long ret = INADDR_NONE; struct hostent *he = gethostbyname(host); if (he == NULL) { fprintf(stderr, "%s: %s: unknown host.\n", myname, host); } if (he != NULL) { if (he->h_addrtype == AF_INET && he->h_length <= sizeof(ret)) { memcpy(&ret, he->h_addr_list[0], he->h_length); } } return ret; }/* atoaddr */ static size_t iov_total(const struct iov_t *v) { size_t total = 0; while (v != NULL) { total += v->iov_len; v = v->iov_next; }/* while */ return total; }/* iov_total */ static void * iov_gather(void *buf_, const struct iov_t *v) { char *buf = buf_; while (v != NULL) { memcpy(buf, v->iov_base, v->iov_len); buf += v->iov_len; v = v->iov_next; }/* while */ return buf_; }/* iov_gather */ static ssize_t sendtov(int so, int flags, const struct sockaddr *to, int tolen, const struct iov_t *iov) { ssize_t err = -1; size_t total = iov_total(iov); char *buf = malloc(total); if (buf != NULL) { iov_gather(buf, iov); err = SENDTO(so, buf, total, flags, to, tolen); if (err < 0) perror("sendto"); free(buf); } return err; }/* sendtov */ static unsigned long msg_number; static int send_msgv(int so, const union saddr *to, unsigned long command, int retryflag, const struct iov_t *iov) { char lbuf[2 + 12 + USERNAME_MAX + 1 + HOSTNAME_MAX + 1 + 12]; int err = -1, flags = 0; struct iov_t v; sprintf(lbuf, "1:%ld:%.*s:%.*s:%lu:", msg_number++, USERNAME_MAX, bro_user, HOSTNAME_MAX, bro_host, command); SET_IOV(&v, (void *)iov, lbuf, strlen(lbuf)); if (retryflag) { err = sendtov(so, flags, &to->sa, sizeof(to->sin), &v); } return err; }/* send_msgv */ /* * ネットワークの登録 */ struct dynet_t STRUCT_DYNA(union saddr); struct dynet_t dynet; static int network_add(const char *broad) { unsigned long addr = atoaddr(broad); if (addr != INADDR_NONE) { union saddr *net; net = DYNA_NEXT(&dynet); if (net != NULL) { memset(net, '\0', sizeof(*net)); net->sin.sin_family = AF_INET; net->sin.sin_addr.s_addr = atoaddr(broad); net->sin.sin_port = htons(bro_port); } } return 0; }/* network_add */ static int network_bro_send(int so, const char *msg) { union saddr *sin = DYNA_BUF(&dynet); if (sin != NULL) { char *sjis = malloc(strlen(msg) + 1); if (sjis != NULL) { unsigned long cmd = IPMSG_SENDMSG | IPMSG_SENDCHECKOPT; int retry = 1; int i, err; struct iov_t v[2]; stretos(sjis, msg); SET_IOV(&v[0], &v[1], sjis, strlen(sjis) + 1); SET_IOV(&v[1], NULL, (void *)icon, 128); for (i = 0; i < DYNA_USED(&dynet); i++) { err = send_msgv(so, sin, cmd, retry, v); sin++; }/* for */ free(sjis); } } return 0; }/* network_bro_send */ /* * */ int bro_init(int port, const char *user, const char *host, const char * const *bros) { int so = socket(PF_INET, SOCK_DGRAM, 0); DYNA_IZ(&dynet, 32); bro_port = port; bro_user = malloc(strlen(user) * 2 + 1); if (bro_user != NULL) stretos(bro_user, user); else bro_user = (char *)user; bro_host = host; msg_number = time(NULL); while (*bros != NULL) network_add(*bros++); if (so >= 0) { int optval = 1; int err = SETSOCKOPT(so, SOL_SOCKET, SO_BROADCAST, &optval, sizeof(optval)); if (err < 0) { close(so); so = -1; } } bro_socket = so; return so; }/* bro_init */ static int fnain(int so, FILE *fp) { char buf[5120]; size_t size = fread(buf, 1, sizeof(buf) - 1, fp); buf[size] = '\0'; return network_bro_send(so, buf); }/* fnain */ static int nain(int so, const char *name) { FILE *fp = fopen(name, "r"); int err = -1; if (fp != NULL) { err = fnain(so, fp); fclose(fp); } return err; }/* nain */ static char * get_env(const char *e) { char *ret = NULL, *p = getenv(e); if (p != NULL) { ret = malloc(strlen(p) + 1); if (ret != NULL) strcpy(ret, p); } return p; }/* get_env */ static char usage_msg[] = "usage: %s [-v][-d n] {[-f file] | [-m message]} [-p port] [-u user] address address...\n" ; int main(int argc, char *argv[]) { int ex, show_usage = 0, ch; int port = 2425; char *user = get_env("USER"), *filename = NULL, *message = NULL; myname = argv[0]; while ((ch = getopt(argc, argv, "d:f:m:p:u:vV")) != EOF) { switch (ch) { default: case 'V': show_usage++; break; case 'd': debug_flag = strtol(optarg, NULL, 0); break; case 'f': filename = optarg; break; case 'm': message = optarg; break; case 'p': port = strtol(optarg, NULL, 0); break; case 'u': user = optarg; break; case 'v': verbose++; break; }/* switch */ }/* while */ if (argc - optind < 1) show_usage++; ex = 1; if (show_usage) { fprintf(stderr, usage_msg, myname); } else { const char * const *v = (const char * const *)&argv[optind]; char hostname[64]; int so; if (user == NULL) user = "anonymous"; gethostname(hostname, sizeof(hostname)); if (strchr(hostname, '.') != NULL) *strchr(hostname, '.') = '\0'; so = bro_init(port, user, hostname, v); if (so >= 0) { int err = 0; if (message != NULL) err = network_bro_send(so, message); else if (filename != NULL) err = nain(so, filename); else err = fnain(so, stdin); ex = err != 0; } } return ex; }/* main */