Back to index

im-sdk  12.3.91
im-message.c
Go to the documentation of this file.
00001 #include <stdio.h>
00002 #include <stdlib.h>
00003 #include <sys/types.h>
00004 
00005 #include <iiimp-data.h>
00006 #include <iiimp-opcode.h>
00007 
00008 #include "iiimp-dataP.h"
00009 #include "iiimp-message.h"
00010 #include "print-misc.h"
00011 
00012 
00013 static IIIMP_message_delete_func message_delete_func[] = {
00014        iiimp_invalid_message_delete,      /* 0 */
00015 
00016        iiimp_connect_delete,              /* IM_CONNECT */
00017        iiimp_connect_reply_delete, /* IM_CONNECT_REPLY */
00018        iiimp_simple_delete,        /* IM_DISCONNECT */
00019        iiimp_simple_delete,        /* IM_DISCONNECT_REPLY */
00020        iiimp_register_trigger_keys_delete,
00021        /* IM_REGISTER_TRIGGER_KEYS */
00022        iiimp_trigger_notify_delete,       /* IM_TRIGGER_NOTIFY */
00023        iiimp_simple_delete,        /* IM_TRIGGER_NOTIFY_REPLY */
00024        iiimp_setimvalues_delete,   /* IM_SETIMVALUES */
00025        iiimp_simple_delete,        /* IM_SETIMVALUES_REPLY */
00026        iiimp_getimvalues_delete,   /* IM_GETIMVALUES */
00027        iiimp_getimvalues_reply_delete,    /* IM_GETIMVALUES_REPLY */
00028 
00029        iiimp_forward_event_delete, /* IM_FORWARD_EVENT */
00030        iiimp_simple_delete,        /* IM_FORWARD_EVENT_REPLY */
00031        iiimp_commit_string_delete, /* IM_COMMIT_STRING */
00032        iiimp_forward_event_with_operations_delete,
00033        /* IM_FORWARD_EVENT_WITH_OPERATIONS */
00034        iiimp_forward_event_with_operations_reply_delete,
00035        /* IM_FORWARD_EVENT_WITH_OPERATIONS_REPLY */
00036        iiimp_register_hotkeys_delete,
00037        /* IM_REGISTER_HOTKEYS */
00038        iiimp_hotkey_notify_delete, /* IM_HOTKEY_NOTIFY */
00039        iiimp_simple_delete,        /* IM_HOTKEY_NOTIFY_REPLY */
00040 
00041        iiimp_createic_delete,             /* IM_CREATEIC */
00042        iiimp_simple_delete,        /* IM_CREATEIC_REPLY */
00043        iiimp_simple_delete,        /* IM_DESTROYIC */
00044        iiimp_simple_delete,        /* IM_DESTROYIC_REPLY */
00045        iiimp_seticvalues_delete,   /* IM_SETICVALUES */
00046        iiimp_simple_delete,        /* IM_SETICVALUES_REPLY */
00047        iiimp_geticvalues_delete,   /* IM_GETICVALUES */
00048        iiimp_geticvalues_reply_delete,    /* IM_GETICVALUES_REPLY */
00049        iiimp_simple_delete,        /* IM_SETICFOCUS */
00050        iiimp_simple_delete,        /* IM_SETICFOCUS_REPLY */
00051        iiimp_simple_delete,        /* IM_UNSETICFOCUS */
00052        iiimp_simple_delete,        /* IM_UNSETICFOCUS_REPLY */
00053        iiimp_simple_delete,        /* IM_RESETIC */
00054        iiimp_simple_delete,        /* IM_RESETIC_REPLY */
00055 
00056        iiimp_hotkey_state_notify_delete,  /* IM_HOTKEY_STATE_NOTIFY */
00057        iiimp_simple_delete, /* IM_HOTKEY_STATE_NOTIFY_REPLY */
00058        iiimp_select_hotkey_profile_delete,       /* IM_SELECT_HOTKEY_PROFILE */
00059        iiimp_invalid_message_delete,      /* 37 */
00060        iiimp_invalid_message_delete,      /* 38 */
00061        iiimp_invalid_message_delete,      /* 39 */
00062 
00063        iiimp_simple_delete,        /* IM_PREEDIT_START */
00064        iiimp_preedit_start_reply_delete,
00065        /* IM_PREEDIT_START_REPLY */
00066        iiimp_preedit_draw_delete,  /* IM_PREEDIT_DRAW */
00067        iiimp_simple_delete,        /* IM_PREEDIT_DRAW_REPLY */
00068        iiimp_invalid_message_delete,      /* 44 */
00069        iiimp_invalid_message_delete,      /* 45 */
00070        iiimp_simple_delete,        /* IM_PREEDIT_DONE */
00071        iiimp_simple_delete,        /* IM_PREEDIT_DONE_REPLY */
00072 
00073        iiimp_invalid_message_delete,      /* 48 */
00074        iiimp_invalid_message_delete,      /* 49 */
00075 
00076        iiimp_simple_delete,        /* IM_STATUS_START */
00077        iiimp_simple_delete,        /* IM_STATUS_START_REPLY */
00078        iiimp_status_draw_delete,   /* IM_STATUS_DRAW */
00079        iiimp_simple_delete,        /* IM_STATUS_DRAW_REPLY */
00080        iiimp_simple_delete,        /* IM_STATUS_DONE */
00081        iiimp_simple_delete,        /* IM_STATUS_DONE_REPLY */
00082 
00083         iiimp_invalid_message_delete,   /* 56 */
00084         iiimp_invalid_message_delete,   /* 57 */
00085         iiimp_invalid_message_delete,   /* 58 */
00086         iiimp_invalid_message_delete,   /* 59 */
00087        iiimp_invalid_message_delete,      /* 60 */
00088        iiimp_invalid_message_delete,      /* 61 */
00089        iiimp_invalid_message_delete,      /* 62 */
00090        iiimp_invalid_message_delete,      /* 63 */
00091        iiimp_invalid_message_delete,      /* 64 */
00092        iiimp_invalid_message_delete,      /* 65 */
00093        iiimp_invalid_message_delete,      /* 66 */
00094        iiimp_invalid_message_delete,      /* 67 */
00095        iiimp_invalid_message_delete,      /* 68 */
00096        iiimp_invalid_message_delete,      /* 69 */
00097 
00098        iiimp_lookup_choice_start_delete,
00099        /* IM_LOOKUP_CHOICE_START */
00100        iiimp_simple_delete,        /* IM_LOOKUP_CHOICE_START_REPLY */
00101        iiimp_lookup_choice_draw_delete,/* IM_LOOKUP_CHOICE_DRAW */
00102        iiimp_simple_delete,        /* IM_LOOKUP_CHOICE_DRAW_REPLY */
00103        iiimp_simple_delete,        /* IM_LOOKUP_CHOICE_DONE */
00104        iiimp_simple_delete,        /* IM_LOOKUP_CHOICE_DONE_REPLY */
00105        iiimp_lookup_choice_process_delete,
00106        /* IM_LOOKUP_CHOICE_PROCESS */
00107        iiimp_simple_delete,        /* IM_LOOKUP_CHOICE_PROCESS_REPLY */
00108 
00109         iiimp_invalid_message_delete,   /* 78 */
00110         iiimp_invalid_message_delete,   /* 79 */
00111         iiimp_invalid_message_delete,   /* 80 */
00112         iiimp_invalid_message_delete,   /* 81 */
00113         iiimp_invalid_message_delete,   /* 82 */
00114         iiimp_invalid_message_delete,   /* 83 */
00115         iiimp_invalid_message_delete,   /* 84 */
00116         iiimp_invalid_message_delete,   /* 85 */
00117         iiimp_invalid_message_delete,   /* 86 */
00118         iiimp_invalid_message_delete,   /* 87 */
00119         iiimp_invalid_message_delete,   /* 88 */
00120         iiimp_invalid_message_delete,   /* 89 */
00121 
00122        iiimp_aux_simple_delete,    /* IM_AUX_START */
00123        iiimp_aux_simple_delete,    /* IM_AUX_START_REPLY */
00124        iiimp_aux_value_delete,            /* IM_AUX_DRAW */
00125        iiimp_aux_simple_delete,    /* IM_AUX_DRAW_REPLY */
00126        iiimp_aux_simple_delete,    /* IM_AUX_DONE */
00127        iiimp_aux_simple_delete,    /* IM_AUX_DONE_REPLY */
00128        iiimp_aux_value_delete,            /* IM_AUX_SETVALUES */
00129        iiimp_aux_simple_delete,    /* IM_AUX_SETVALUES_REPLY */
00130        iiimp_aux_value_delete,            /* IM_AUX_GETVALUES */
00131        iiimp_aux_value_delete,            /* IM_AUX_GETVALUES_REPLY */
00132 
00133        iiimp_protocol_version_delete,     /* IM_PROTOCOL_VERSION */
00134 
00135        iiimp_file_operation_delete,       /* IM_FILE_OPERATION */
00136        iiimp_file_operation_reply_delete,
00137        /* IM_FILE_OPERATION_REPLY */
00138 
00139        iiimp_invalid_message_delete,   /* 103 */
00140        iiimp_invalid_message_delete,   /* 104 */
00141        iiimp_invalid_message_delete,   /* 105 */
00142        iiimp_invalid_message_delete,   /* 106 */
00143        iiimp_invalid_message_delete,   /* 107 */
00144        iiimp_invalid_message_delete,   /* 108 */
00145        iiimp_invalid_message_delete,   /* 109 */
00146        iiimp_invalid_message_delete,   /* 110 */
00147        iiimp_invalid_message_delete,   /* 111 */
00148        iiimp_invalid_message_delete,   /* 112 */
00149        iiimp_invalid_message_delete,   /* 113 */
00150        iiimp_invalid_message_delete,   /* 114 */
00151        iiimp_invalid_message_delete,   /* 115 */
00152        iiimp_invalid_message_delete,   /* 116 */
00153        iiimp_invalid_message_delete,   /* 117 */
00154        iiimp_invalid_message_delete,   /* 118 */
00155        iiimp_invalid_message_delete,   /* 119 */
00156        iiimp_invalid_message_delete,   /* 120 */
00157        iiimp_invalid_message_delete,   /* 121 */
00158        iiimp_invalid_message_delete,   /* 122 */
00159        iiimp_invalid_message_delete,   /* 123 */
00160        iiimp_invalid_message_delete,   /* 124 */
00161        iiimp_invalid_message_delete,   /* 125 */
00162        iiimp_invalid_message_delete,   /* 126 */
00163        iiimp_invalid_message_delete    /* 127 */
00164 
00165 };
00166 
00167 
00168 void
00169 iiimp_message_delete(IIIMP_data_s * data_s, IIIMP_message * m)
00170 {
00171     (message_delete_func[m->opcode & 0x7f])(data_s, m);
00172     return;
00173 }
00174 
00175 
00176 uchar_t *
00177 iiimp_message_pack(
00178     IIIMP_data_s *   data_s,
00179     IIIMP_message *  m,
00180     size_t *         nbyte)
00181 {
00182     uchar_t * p;
00183    
00184     switch (m->opcode) {
00185       case IM_DISCONNECT:
00186       case IM_DISCONNECT_REPLY:
00187       case IM_TRIGGER_NOTIFY_REPLY:
00188       case IM_HOTKEY_NOTIFY_REPLY:
00189       case IM_SETIMVALUES_REPLY:
00190       case IM_FORWARD_EVENT_REPLY:
00191       case IM_CREATEIC_REPLY:
00192       case IM_DESTROYIC:
00193       case IM_DESTROYIC_REPLY:
00194       case IM_SETICVALUES_REPLY:
00195       case IM_SETICFOCUS:
00196       case IM_SETICFOCUS_REPLY:
00197       case IM_UNSETICFOCUS:
00198       case IM_UNSETICFOCUS_REPLY:
00199       case IM_RESETIC:
00200       case IM_RESETIC_REPLY:
00201       case IM_PREEDIT_START:
00202       case IM_PREEDIT_DRAW_REPLY:
00203       case IM_PREEDIT_DONE:
00204       case IM_PREEDIT_DONE_REPLY:
00205       case IM_STATUS_START:
00206       case IM_STATUS_START_REPLY:
00207       case IM_STATUS_DRAW_REPLY:
00208       case IM_STATUS_DONE:
00209       case IM_STATUS_DONE_REPLY:
00210       case IM_LOOKUP_CHOICE_START_REPLY:
00211       case IM_LOOKUP_CHOICE_DRAW_REPLY:
00212       case IM_LOOKUP_CHOICE_DONE:
00213       case IM_LOOKUP_CHOICE_DONE_REPLY:
00214       case IM_LOOKUP_CHOICE_PROCESS_REPLY:
00215        p = iiimp_simple_pack(data_s, m->opcode, m->im_id, m->ic_id, nbyte);
00216        break;
00217 
00218       case IM_CONNECT:
00219        p = iiimp_connect_pack(data_s, m->v.connect.user_name,
00220                            m->v.connect.auth, nbyte);
00221        break;
00222 
00223       case IM_CONNECT_REPLY:
00224        p = iiimp_connect_reply_pack(data_s, m->im_id,
00225                                 m->v.connect_reply.language, nbyte);
00226        break;
00227 
00228       case IM_REGISTER_TRIGGER_KEYS:
00229        p = iiimp_register_trigger_keys_pack(
00230           data_s, m->im_id,
00231           m->v.register_trigger_keys.trigger_on,
00232           m->v.register_trigger_keys.trigger_off, nbyte);
00233        break;
00234 
00235       case IM_TRIGGER_NOTIFY:
00236        p = iiimp_trigger_notify_pack(data_s, m->im_id, m->ic_id,
00237                                  m->v.trigger_notify.flag, nbyte);
00238        break;
00239 
00240       case IM_REGISTER_HOTKEYS:
00241        p = iiimp_register_hotkeys_pack(
00242           data_s, m->im_id, m->v.register_hotkeys.scope_and_profile_id,
00243           m->v.register_hotkeys.hotkeys, nbyte);
00244        break;
00245 
00246       case IM_HOTKEY_NOTIFY:
00247        p = iiimp_hotkey_notify_pack(data_s, m->im_id, m->ic_id,
00248                                 m->v.hotkey_notify.hotkey_id, 
00249                                 m->v.hotkey_notify.index,nbyte);
00250        break;
00251 
00252       case IM_HOTKEY_STATE_NOTIFY:
00253        p = iiimp_hotkey_state_notify_pack(data_s, m->im_id, m->ic_id,
00254                                      m->v.hotkey_state_notify.hotkey_id,
00255                                      m->v.hotkey_state_notify.current_state_flag,nbyte);
00256        break;
00257 
00258       case IM_SELECT_HOTKEY_PROFILE:
00259        p = iiimp_select_hotkey_profile_pack(data_s, m->im_id,
00260                                        m->v.select_hotkey_profile.scope_and_profile_id, nbyte);
00261        break;
00262 
00263       case IM_SETIMVALUES:
00264        p = iiimp_setimvalues_pack(data_s, m->im_id,
00265                               m->v.setimvalues.attr_list, nbyte);
00266        break;
00267 
00268       case IM_GETIMVALUES:
00269        p = iiimp_getimvalues_pack(data_s, m->im_id,
00270                               m->v.getimvalues.attr_list, nbyte);
00271        break;
00272 
00273       case IM_GETIMVALUES_REPLY:
00274        p = iiimp_getimvalues_reply_pack(data_s, m->im_id,
00275                                    m->v.getimvalues_reply.attr_list,
00276                                    nbyte);
00277        break;
00278 
00279       case IM_FORWARD_EVENT:
00280        p = iiimp_forward_event_pack(data_s, m->im_id, m->ic_id,
00281                                 m->v.forward_event.contents,
00282                                 nbyte);
00283        break;
00284 
00285       case IM_COMMIT_STRING:
00286        p = iiimp_commit_string_pack(data_s, m->im_id, m->ic_id,
00287                                 m->v.commit_string.contents,
00288                                 nbyte);
00289        break;
00290 
00291       case IM_FORWARD_EVENT_WITH_OPERATIONS:
00292        p = iiimp_forward_event_with_operations_pack(
00293           data_s, m->im_id, m->ic_id,
00294           m->v.forward_event_with_operations.contents,
00295           m->v.forward_event_with_operations.operation, nbyte);
00296        break;
00297 
00298       case IM_FORWARD_EVENT_WITH_OPERATIONS_REPLY:
00299        p = iiimp_forward_event_with_operations_reply_pack(
00300           data_s, m->im_id, m->ic_id,
00301           m->v.forward_event_with_operations_reply.operation,
00302           nbyte);
00303        break;
00304 
00305       case IM_CREATEIC:
00306        p = iiimp_createic_pack(data_s, m->im_id,
00307                             m->v.createic.attr_list, nbyte);
00308        break;
00309 
00310       case IM_SETICVALUES:
00311        p = iiimp_seticvalues_pack(data_s, m->im_id, m->ic_id,
00312                               m->v.seticvalues.attr_list, nbyte);
00313        break;
00314 
00315       case IM_GETICVALUES:
00316        p = iiimp_geticvalues_pack(data_s, m->im_id, m->ic_id,
00317                               m->v.geticvalues.attr_list, nbyte);
00318        break;
00319 
00320       case IM_GETICVALUES_REPLY:
00321        p = iiimp_geticvalues_reply_pack(data_s, m->im_id, m->ic_id,
00322                                    m->v.geticvalues_reply.attr_list,
00323                                    nbyte);
00324        break;
00325 
00326       case IM_PREEDIT_START_REPLY:
00327        p = iiimp_preedit_start_reply_pack(
00328           data_s, m->im_id, m->ic_id,
00329           m->v.preedit_start_reply.maximum_length, nbyte);
00330        break;
00331 
00332       case IM_PREEDIT_DRAW:
00333        p = iiimp_preedit_draw_pack(data_s, m->im_id, m->ic_id,
00334                                m->v.preedit_draw.caret,
00335                                m->v.preedit_draw.change_first,
00336                                m->v.preedit_draw.change_length,
00337                                m->v.preedit_draw.preedit,
00338                                nbyte);
00339        break;
00340 
00341       case IM_STATUS_DRAW:
00342        p = iiimp_status_draw_pack(data_s, m->im_id, m->ic_id,
00343                               m->v.status_draw.status, nbyte);
00344        break;
00345 
00346       case IM_LOOKUP_CHOICE_START:
00347        p = iiimp_lookup_choice_start_pack(
00348           data_s, m->im_id, m->ic_id,
00349           m->v.lookup_choice_start.master,
00350           m->v.lookup_choice_start.choice_per_window,
00351           m->v.lookup_choice_start.rows,
00352           m->v.lookup_choice_start.columns,
00353           m->v.lookup_choice_start.direction,
00354           m->v.lookup_choice_start.label_owner,
00355           nbyte);
00356        break;
00357 
00358       case IM_LOOKUP_CHOICE_DRAW:
00359        p = iiimp_lookup_choice_draw_pack(data_s, m->im_id, m->ic_id,
00360                                     m->v.lookup_choice_draw.first,
00361                                     m->v.lookup_choice_draw.last,
00362                                     m->v.lookup_choice_draw.current,
00363                                     m->v.lookup_choice_draw.choice,
00364                                     m->v.lookup_choice_draw.index_label,
00365                                     m->v.lookup_choice_draw.title, nbyte);
00366        break;
00367 
00368       case IM_LOOKUP_CHOICE_PROCESS:
00369        p = iiimp_lookup_choice_process_pack(data_s, m->im_id, m->ic_id,
00370                                        m->v.lookup_choice_process.type,
00371                                        m->v.lookup_choice_process.value,
00372                                        nbyte);
00373        break;
00374 
00375       case IM_AUX_START:
00376       case IM_AUX_START_REPLY:
00377       case IM_AUX_DRAW_REPLY:
00378       case IM_AUX_DONE_REPLY:
00379       case IM_AUX_DONE:
00380       case IM_AUX_SETVALUES_REPLY:
00381        p = iiimp_aux_simple_pack(data_s, m->opcode, m->im_id, m->ic_id,
00382                              m->v.aux_simple.class_index,
00383                              m->v.aux_simple.input_method_name,
00384                              nbyte);
00385        break;
00386 
00387       case IM_AUX_DRAW:
00388       case IM_AUX_SETVALUES:
00389       case IM_AUX_GETVALUES:
00390       case IM_AUX_GETVALUES_REPLY:
00391        p = iiimp_aux_value_pack(data_s, m->opcode, m->im_id, m->ic_id,
00392                             m->v.aux_value.class_index,
00393                             m->v.aux_value.input_method_name,
00394                             m->v.aux_value.integer_value,
00395                             m->v.aux_value.string_value,
00396                             nbyte);
00397        break;
00398 
00399       case IM_PROTOCOL_VERSION:
00400        p = iiimp_protocol_version_pack(data_s, m->im_id,
00401                                    m->v.protocol_version.number,
00402                                    nbyte);
00403        break;
00404 
00405       case IM_FILE_OPERATION:
00406        p = iiimp_file_operation_pack(data_s, m->im_id,
00407                                  m->v.file_operation.type,
00408                                  m->v.file_operation.value,
00409                                  nbyte);
00410        break;
00411 
00412       case IM_FILE_OPERATION_REPLY:
00413        p = iiimp_file_operation_reply_pack(data_s, m->im_id,
00414                                       m->v.file_operation_reply.type,
00415                                       m->v.file_operation_reply.value,
00416                                       nbyte);
00417        break;
00418 
00419       default:
00420        p = NULL;
00421        data_s->status = IIIMP_DATA_INVALID;
00422     }
00423 
00424     return p;
00425 }
00426 
00427 
00428 static IIIMP_message_unpack_func message_unpack_func[] = {
00429        iiimp_invalid_message_unpack,      /* 0 */
00430 
00431        iiimp_connect_unpack,              /* IM_CONNECT */
00432        iiimp_connect_reply_unpack, /* IM_CONNECT_REPLY */
00433        iiimp_simple_im_unpack,            /* IM_DISCONNECT */
00434        iiimp_simple_im_unpack,            /* IM_DISCONNECT_REPLY */
00435        iiimp_register_trigger_keys_unpack,
00436        /* IM_REGISTER_TRIGGER_KEYS */
00437        iiimp_trigger_notify_unpack,       /* IM_TRIGGER_NOTIFY */
00438        iiimp_simple_unpack,        /* IM_TRIGGER_NOTIFY_REPLY */
00439        iiimp_setimvalues_unpack,   /* IM_SETIMVALUES */
00440        iiimp_simple_im_unpack,            /* IM_SETIMVALUES_REPLY */
00441        iiimp_getimvalues_unpack,   /* IM_GETIMVALUES */
00442        iiimp_getimvalues_reply_unpack,    /* IM_GETIMVALUES_REPLY */
00443 
00444        iiimp_forward_event_unpack, /* IM_FORWARD_EVENT */
00445        iiimp_simple_unpack,        /* IM_FORWARD_EVENT_REPLY */
00446        iiimp_commit_string_unpack, /* IM_COMMIT_STRING */
00447        iiimp_forward_event_with_operations_unpack,
00448        /* IM_FORWARD_EVENT_WITH_OPERATIONS */
00449        iiimp_forward_event_with_operations_reply_unpack,
00450        /* IM_FORWARD_EVENT_WITH_OPERATIONS_REPLY */
00451 
00452        iiimp_register_hotkeys_unpack,
00453        /* IM_REGISTER_HOTKEYS */
00454        iiimp_hotkey_notify_unpack, /* IM_HOTKEY_NOTIFY */
00455        iiimp_simple_unpack,        /* IM_HOTKEY_NOTIFY_REPLY */
00456 
00457        iiimp_createic_unpack,             /* IM_CREATEIC */
00458        iiimp_simple_unpack,        /* IM_CREATEIC_REPLY */
00459        iiimp_simple_unpack,        /* IM_DESTROYIC */
00460        iiimp_simple_unpack,        /* IM_DESTROYIC_REPLY */
00461        iiimp_seticvalues_unpack,   /* IM_SETICVALUES */
00462        iiimp_simple_unpack,        /* IM_SETICVALUES_REPLY */
00463        iiimp_geticvalues_unpack,   /* IM_GETICVALUES */
00464        iiimp_geticvalues_reply_unpack,    /* IM_GETICVALUES_REPLY */
00465        iiimp_simple_unpack,        /* IM_SETICFOCUS */
00466        iiimp_simple_unpack,        /* IM_SETICFOCUS_REPLY */
00467        iiimp_simple_unpack,        /* IM_UNSETICFOCUS */
00468        iiimp_simple_unpack,        /* IM_UNSETICFOCUS_REPLY */
00469        iiimp_simple_unpack,        /* IM_RESETIC */
00470        iiimp_simple_unpack,        /* IM_RESETIC_REPLY */
00471 
00472        iiimp_hotkey_state_notify_unpack,  /* IM_HOTKEY_STATE_NOTIFY */
00473        iiimp_simple_unpack, /* IM_HOTKEY_STATE_NOTIFY_REPLY */
00474        iiimp_select_hotkey_profile_unpack,       /* IM_SELECT_HOTKEY_PROFILE */
00475        iiimp_invalid_message_unpack,      /* 37 */
00476        iiimp_invalid_message_unpack,      /* 38 */
00477        iiimp_invalid_message_unpack,      /* 39 */
00478 
00479        iiimp_simple_unpack,        /* IM_PREEDIT_START */
00480        iiimp_preedit_start_reply_unpack,
00481        /* IM_PREEDIT_START_REPLY */
00482        iiimp_preedit_draw_unpack,  /* IM_PREEDIT_DRAW */
00483        iiimp_simple_unpack,        /* IM_PREEDIT_DRAW_REPLY */
00484        iiimp_invalid_message_unpack,      /* 44 */
00485        iiimp_invalid_message_unpack,      /* 45 */
00486        iiimp_simple_unpack,        /* IM_PREEDIT_DONE */
00487        iiimp_simple_unpack,        /* IM_PREEDIT_DONE_REPLY */
00488 
00489        iiimp_invalid_message_unpack,      /* 48 */
00490        iiimp_invalid_message_unpack,      /* 49 */
00491 
00492        iiimp_simple_unpack,        /* IM_STATUS_START */
00493        iiimp_simple_unpack,        /* IM_STATUS_START_REPLY */
00494        iiimp_status_draw_unpack,   /* IM_STATUS_DRAW */
00495        iiimp_simple_unpack,        /* IM_STATUS_DRAW_REPLY */
00496        iiimp_simple_unpack,        /* IM_STATUS_DONE */
00497        iiimp_simple_unpack,        /* IM_STATUS_DONE_REPLY */
00498 
00499        iiimp_invalid_message_unpack,      /* 56 */
00500        iiimp_invalid_message_unpack,      /* 57 */
00501        iiimp_invalid_message_unpack,      /* 58 */
00502        iiimp_invalid_message_unpack,      /* 59 */
00503 
00504        iiimp_invalid_message_unpack,      /* 60 */
00505        iiimp_invalid_message_unpack,      /* 61 */
00506        iiimp_invalid_message_unpack,      /* 62 */
00507        iiimp_invalid_message_unpack,      /* 63 */
00508        iiimp_invalid_message_unpack,      /* 64 */
00509        iiimp_invalid_message_unpack,      /* 65 */
00510        iiimp_invalid_message_unpack,      /* 66 */
00511        iiimp_invalid_message_unpack,      /* 67 */
00512        iiimp_invalid_message_unpack,      /* 68 */
00513        iiimp_invalid_message_unpack,      /* 69 */
00514 
00515        iiimp_lookup_choice_start_unpack,
00516        /* IM_LOOKUP_CHOICE_START */
00517        iiimp_simple_unpack,        /* IM_LOOKUP_CHOICE_START_REPLY */
00518        iiimp_lookup_choice_draw_unpack,/* IM_LOOKUP_CHOICE_DRAW */
00519        iiimp_simple_unpack,        /* IM_LOOKUP_CHOICE_DRAW_REPLY */
00520        iiimp_simple_unpack,        /* IM_LOOKUP_CHOICE_DONE */
00521        iiimp_simple_unpack,        /* IM_LOOKUP_CHOICE_DONE_REPLY */
00522        iiimp_lookup_choice_process_unpack,
00523        /* IM_LOOKUP_CHOICE_PROCESS */
00524        iiimp_simple_unpack,        /* IM_LOOKUP_CHOICE_PROCESS_REPLY */
00525 
00526        iiimp_invalid_message_unpack,      /* 78 */
00527        iiimp_invalid_message_unpack,      /* 79 */
00528        iiimp_invalid_message_unpack,      /* 80 */
00529        iiimp_invalid_message_unpack,      /* 81 */
00530        iiimp_invalid_message_unpack,      /* 82 */
00531        iiimp_invalid_message_unpack,      /* 83 */
00532        iiimp_invalid_message_unpack,      /* 84 */
00533        iiimp_invalid_message_unpack,      /* 85 */
00534        iiimp_invalid_message_unpack,      /* 86 */
00535        iiimp_invalid_message_unpack,      /* 87 */
00536        iiimp_invalid_message_unpack,      /* 88 */
00537        iiimp_invalid_message_unpack,      /* 89 */
00538 
00539        iiimp_aux_simple_unpack,    /* IM_AUX_START */
00540        iiimp_aux_simple_unpack,    /* IM_AUX_START_REPLY */
00541        iiimp_aux_value_unpack,            /* IM_AUX_DRAW */
00542        iiimp_aux_simple_unpack,    /* IM_AUX_DRAW_REPLY */
00543        iiimp_aux_simple_unpack,    /* IM_AUX_DONE */
00544        iiimp_aux_simple_unpack,    /* IM_AUX_DONE_REPLY */
00545        iiimp_aux_value_unpack,            /* IM_AUX_SETVALUES */
00546        iiimp_aux_simple_unpack,    /* IM_AUX_SETVALUES_REPLY */
00547        iiimp_aux_value_unpack,            /* IM_AUX_GETVALUES */
00548        iiimp_aux_value_unpack,            /* IM_AUX_GETVALUES_REPLY */
00549 
00550        iiimp_protocol_version_unpack,     /* IM_PROTOCOL_VERSION */
00551 
00552        iiimp_file_operation_unpack,       /* IM_FILE_OPERATION */
00553        iiimp_file_operation_reply_unpack,
00554        /* IM_FILE_OPERATION_REPLY */
00555 
00556        iiimp_invalid_message_unpack,   /* 103 */
00557        iiimp_invalid_message_unpack,   /* 104 */
00558        iiimp_invalid_message_unpack,   /* 105 */
00559        iiimp_invalid_message_unpack,   /* 106 */
00560        iiimp_invalid_message_unpack,   /* 107 */
00561        iiimp_invalid_message_unpack,   /* 108 */
00562        iiimp_invalid_message_unpack,   /* 109 */
00563        iiimp_invalid_message_unpack,   /* 110 */
00564        iiimp_invalid_message_unpack,   /* 111 */
00565        iiimp_invalid_message_unpack,   /* 112 */
00566        iiimp_invalid_message_unpack,   /* 113 */
00567        iiimp_invalid_message_unpack,   /* 114 */
00568        iiimp_invalid_message_unpack,   /* 115 */
00569        iiimp_invalid_message_unpack,   /* 116 */
00570        iiimp_invalid_message_unpack,   /* 117 */
00571        iiimp_invalid_message_unpack,   /* 118 */
00572        iiimp_invalid_message_unpack,   /* 119 */
00573        iiimp_invalid_message_unpack,   /* 120 */
00574        iiimp_invalid_message_unpack,   /* 121 */
00575        iiimp_invalid_message_unpack,   /* 122 */
00576        iiimp_invalid_message_unpack,   /* 123 */
00577        iiimp_invalid_message_unpack,   /* 124 */
00578        iiimp_invalid_message_unpack,   /* 125 */
00579        iiimp_invalid_message_unpack,   /* 126 */
00580        iiimp_invalid_message_unpack    /* 127 */
00581 };
00582 
00583 
00584 IIIMP_message *
00585 iiimp_message_unpack(
00586     IIIMP_data_s *   data_s,
00587     IIIMP_card7             opcode,
00588     size_t *         nbyte,
00589     const uchar_t ** ptr)
00590 {
00591     return (message_unpack_func[opcode & 0x7f])(data_s, opcode, nbyte, ptr);
00592 }
00593 
00594 
00595 void
00596 iiimp_message_header_print(
00597     IIIMP_data_s *   data_s,
00598     int              opcode,
00599     int              im_id,
00600     int              ic_id)
00601 {
00602     if (im_id < 0) {
00603        (void)fprintf(data_s->print_fp, ":*:*:");
00604     } else if (ic_id < 0) {
00605        (void)fprintf(data_s->print_fp, ":%d:*:", im_id);
00606     } else {
00607        (void)fprintf(data_s->print_fp, ":%d:%d:", im_id, ic_id);
00608     }
00609     (void)fprintf(data_s->print_fp, " %s\n", opcode_string_get(opcode));
00610 }
00611 
00612 
00613 typedef void
00614 (* IIIMP_message_print_func)(
00615     IIIMP_data_s *   data_s,
00616     IIIMP_message *  m);
00617 
00618 static IIIMP_message_print_func message_print_func[] = {
00619        iiimp_invalid_message_print,       /* 0 */
00620 
00621        iiimp_connect_print,        /* IM_CONNECT */
00622        iiimp_connect_reply_print,  /* IM_CONNECT_REPLY */
00623        iiimp_simple_im_print,             /* IM_DISCONNECT */
00624        iiimp_simple_im_print,             /* IM_DISCONNECT_REPLY */
00625        iiimp_register_trigger_keys_print,
00626        /* IM_REGISTER_TRIGGER_KEYS */
00627        iiimp_trigger_notify_print, /* IM_TRIGGER_NOTIFY */
00628        iiimp_simple_print,         /* IM_TRIGGER_NOTIFY_REPLY */
00629        iiimp_setimvalues_print,    /* IM_SETIMVALUES */
00630        iiimp_simple_im_print,             /* IM_SETIMVALUES_REPLY */
00631        iiimp_getimvalues_print,    /* IM_GETIMVALUES */
00632        iiimp_getimvalues_reply_print,     /* IM_GETIMVALUES_REPLY */
00633 
00634        iiimp_forward_event_print,  /* IM_FORWARD_EVENT */
00635        iiimp_simple_print,         /* IM_FORWARD_EVENT_REPLY */
00636        iiimp_commit_string_print,  /* IM_COMMIT_STRING */
00637        iiimp_forward_event_with_operations_print,
00638        /* IM_FORWARD_EVENT_WITH_OPERATIONS */
00639        iiimp_forward_event_with_operations_reply_print,
00640        /* IM_FORWARD_EVENT_WITH_OPERATIONS_REPLY */
00641 
00642        iiimp_register_hotkeys_print,
00643        /* IM_REGISTER_HOTKEYS */
00644        iiimp_hotkey_notify_print,  /* IM_HOTKEY_NOTIFY */
00645        iiimp_simple_print,         /* IM_HOTKEY_NOTIFY_REPLY */
00646 
00647        iiimp_createic_print,              /* IM_CREATEIC */
00648        iiimp_simple_print,         /* IM_CREATEIC_REPLY */
00649        iiimp_simple_print,         /* IM_DESTROYIC */
00650        iiimp_simple_print,         /* IM_DESTROYIC_REPLY */
00651        iiimp_seticvalues_print,    /* IM_SETICVALUES */
00652        iiimp_simple_print,         /* IM_SETICVALUES_REPLY */
00653        iiimp_geticvalues_print,    /* IM_GETICVALUES */
00654        iiimp_geticvalues_reply_print,     /* IM_GETICVALUES_REPLY */
00655        iiimp_simple_print,         /* IM_SETICFOCUS */
00656        iiimp_simple_print,         /* IM_SETICFOCUS_REPLY */
00657        iiimp_simple_print,         /* IM_UNSETICFOCUS */
00658        iiimp_simple_print,         /* IM_UNSETICFOCUS_REPLY */
00659        iiimp_simple_print,         /* IM_RESETIC */
00660        iiimp_simple_print,         /* IM_RESETIC_REPLY */
00661 
00662        iiimp_hotkey_state_notify_print,   /* IM_HOTKEY_STATE_NOTIFY */
00663        iiimp_simple_print,  /* IM_HOTKEY_STATE_NOTIFY_REPLY */
00664        iiimp_select_hotkey_profile_print, /* IM_SELECT_HOTKEY_PROFILE */
00665        iiimp_invalid_message_print,       /* 37 */
00666        iiimp_invalid_message_print,       /* 38 */
00667        iiimp_invalid_message_print,       /* 39 */
00668 
00669        iiimp_simple_print,         /* IM_PREEDIT_START */
00670        iiimp_preedit_start_reply_print,/* IM_PREEDIT_START_REPLY */
00671        iiimp_preedit_draw_print,   /* IM_PREEDIT_DRAW */
00672        iiimp_simple_print,         /* IM_PREEDIT_DRAW_REPLY */
00673        iiimp_invalid_message_print,       /* 44 */
00674        iiimp_invalid_message_print,       /* 45 */
00675        iiimp_simple_print,         /* IM_PREEDIT_DONE */
00676        iiimp_simple_print,         /* IM_PREEDIT_DONE_REPLY */
00677 
00678        iiimp_invalid_message_print,       /* 48 */
00679        iiimp_invalid_message_print,       /* 49 */
00680 
00681        iiimp_simple_print,         /* IM_STATUS_START */
00682        iiimp_simple_print,         /* IM_STATUS_START_REPLY */
00683        iiimp_status_draw_print,    /* IM_STATUS_DRAW */
00684        iiimp_simple_print,         /* IM_STATUS_DRAW_REPLY */
00685        iiimp_simple_print,         /* IM_STATUS_DONE */
00686        iiimp_simple_print,         /* IM_STATUS_DONE_REPLY */
00687 
00688        iiimp_invalid_message_print,       /* 56 */
00689        iiimp_invalid_message_print,       /* 57 */
00690        iiimp_invalid_message_print,       /* 58 */
00691        iiimp_invalid_message_print,       /* 59 */
00692 
00693        iiimp_invalid_message_print,       /* 60 */
00694        iiimp_invalid_message_print,       /* 61 */
00695        iiimp_invalid_message_print,       /* 62 */
00696        iiimp_invalid_message_print,       /* 63 */
00697        iiimp_invalid_message_print,       /* 64 */
00698        iiimp_invalid_message_print,       /* 65 */
00699        iiimp_invalid_message_print,       /* 66 */
00700        iiimp_invalid_message_print,       /* 67 */
00701        iiimp_invalid_message_print,       /* 68 */
00702        iiimp_invalid_message_print,       /* 69 */
00703 
00704        iiimp_lookup_choice_start_print,/* IM_LOOKUP_CHOICE_START */
00705        iiimp_simple_print,         /* IM_LOOKUP_CHOICE_START_REPLY */
00706        iiimp_lookup_choice_draw_print,    /* IM_LOOKUP_CHOICE_DRAW */
00707        iiimp_simple_print,         /* IM_LOOKUP_CHOICE_DRAW_REPLY */
00708        iiimp_simple_print,         /* IM_LOOKUP_CHOICE_DONE */
00709        iiimp_simple_print,         /* IM_LOOKUP_CHOICE_DONE_REPLY */
00710        iiimp_lookup_choice_process_print,
00711        /* IM_LOOKUP_CHOICE_PROCESS */
00712        iiimp_simple_print,         /* IM_LOOKUP_CHOICE_PROCESS_REPLY */
00713 
00714        iiimp_invalid_message_print,       /* 78 */
00715        iiimp_invalid_message_print,       /* 79 */
00716        iiimp_invalid_message_print,       /* 80 */
00717        iiimp_invalid_message_print,       /* 81 */
00718        iiimp_invalid_message_print,       /* 82 */
00719        iiimp_invalid_message_print,       /* 83 */
00720        iiimp_invalid_message_print,       /* 84 */
00721        iiimp_invalid_message_print,       /* 85 */
00722        iiimp_invalid_message_print,       /* 86 */
00723        iiimp_invalid_message_print,       /* 87 */
00724        iiimp_invalid_message_print,       /* 88 */
00725        iiimp_invalid_message_print,       /* 89 */
00726 
00727        iiimp_aux_simple_print,            /* IM_AUX_START */
00728        iiimp_aux_simple_print,            /* IM_AUX_START_REPLY */
00729        iiimp_aux_value_print,             /* IM_AUX_DRAW */
00730        iiimp_aux_simple_print,            /* IM_AUX_DRAW_REPLY */
00731        iiimp_aux_simple_print,            /* IM_AUX_DONE */
00732        iiimp_aux_simple_print,            /* IM_AUX_DONE_REPLY */
00733        iiimp_aux_value_print,             /* IM_AUX_SETVALUES */
00734        iiimp_aux_simple_print,            /* IM_AUX_SETVALUES_REPLY */
00735        iiimp_aux_value_print,             /* IM_AUX_GETVALUES */
00736        iiimp_aux_value_print,             /* IM_AUX_GETVALUES_REPLY */
00737 
00738        iiimp_protocol_version_print,      /* IM_PROTOCOL_VERSION */
00739 
00740        iiimp_file_operation_print, /* IM_FILE_OPERATION */
00741        iiimp_file_operation_reply_print,
00742        /* IM_FILE_OPERATION_REPLY */
00743 
00744        iiimp_invalid_message_print,   /* 103 */
00745        iiimp_invalid_message_print,   /* 104 */
00746        iiimp_invalid_message_print,   /* 105 */
00747        iiimp_invalid_message_print,   /* 106 */
00748        iiimp_invalid_message_print,   /* 107 */
00749        iiimp_invalid_message_print,   /* 108 */
00750        iiimp_invalid_message_print,   /* 109 */
00751        iiimp_invalid_message_print,   /* 110 */
00752        iiimp_invalid_message_print,   /* 111 */
00753        iiimp_invalid_message_print,   /* 112 */
00754        iiimp_invalid_message_print,   /* 113 */
00755        iiimp_invalid_message_print,   /* 114 */
00756        iiimp_invalid_message_print,   /* 115 */
00757        iiimp_invalid_message_print,   /* 116 */
00758        iiimp_invalid_message_print,   /* 117 */
00759        iiimp_invalid_message_print,   /* 118 */
00760        iiimp_invalid_message_print,   /* 119 */
00761        iiimp_invalid_message_print,   /* 120 */
00762        iiimp_invalid_message_print,   /* 121 */
00763        iiimp_invalid_message_print,   /* 122 */
00764        iiimp_invalid_message_print,   /* 123 */
00765        iiimp_invalid_message_print,   /* 124 */
00766        iiimp_invalid_message_print,   /* 125 */
00767        iiimp_invalid_message_print,   /* 126 */
00768        iiimp_invalid_message_print    /* 127 */
00769 };
00770 
00771 
00772 void
00773 iiimp_message_print(
00774     IIIMP_data_s *   data_s,
00775     IIIMP_message *  m)
00776 {
00777     if (NULL == m) return;
00778     (message_print_func[0x7f & m->opcode])(data_s, m);
00779     // (message_print_func[m->opcode & 0x7f])(data_s, m);
00780 }
00781 
00782 
00783 /* Local Variables: */
00784 /* c-file-style: "iiim-project" */
00785 /* End: */