Logo Search packages:      
Sourcecode: g2ipmsg version File versions  Download package

int ipmsg_dispatch_message ( const udp_con_t *  con,
const msg_data_t *  msg 
)

受信したパケットを処理する

Parameters:
[in] con UDPコネクション情報
[in] msg 受信したメッセージ情報
Return values:
0 正常終了
-EINVAL 引数異常
-ENOENT 指定されたコマンドが見つからなかった.

Definition at line 2544 of file protocol.c.

References ipmsg_proc_ans_entry(), ipmsg_proc_anslist(), ipmsg_proc_anspubkey(), ipmsg_proc_br_absence(), ipmsg_proc_br_entry(), ipmsg_proc_br_exit(), ipmsg_proc_br_isgetlist2(), ipmsg_proc_get_absence_info(), ipmsg_proc_get_info(), ipmsg_proc_get_public_key(), ipmsg_proc_getlist(), ipmsg_proc_okgetlist(), ipmsg_proc_read_msg(), ipmsg_proc_recv_msg(), ipmsg_proc_release_files_msg(), ipmsg_proc_send_absence_info(), ipmsg_proc_send_info(), and ipmsg_proc_send_msg().

                                                                   {
      int rc = 0;

      if ( (con == NULL) || (msg == NULL) ) {
            rc = -EINVAL;
            goto error_out;
      }

      switch(msg->command) {
      case IPMSG_NOOPERATION:
            break;
      case IPMSG_BR_ENTRY:
            dbg_out("Dispatch br_entry\n");
            ipmsg_proc_br_entry(con, msg);
            break;
      case IPMSG_BR_EXIT:
            dbg_out("Dispatch br_exit\n");
            ipmsg_proc_br_exit(con, msg);
            break;
      case IPMSG_ANSENTRY:
            dbg_out("Dispatch ans_entry\n");
            ipmsg_proc_ans_entry(con, msg);
            break;
      case IPMSG_BR_ABSENCE:
            dbg_out("Dispatch br_absense\n");
            ipmsg_proc_br_absence(con, msg);
            break;
      case IPMSG_BR_ISGETLIST:
            dbg_out("Dispatch isget_list2\n");
            if (hostinfo_refer_ipmsg_is_allow_hlist())
                  ipmsg_proc_br_isgetlist2(con, msg);
            break;
      case IPMSG_OKGETLIST:
            dbg_out("Dispatch okget_list\n");
            if (hostinfo_refer_ipmsg_is_get_hlist())    
                  ipmsg_proc_okgetlist(con, msg);
            break;
      case IPMSG_GETLIST:
            dbg_out("Dispatch get_list\n");
            if (hostinfo_refer_ipmsg_is_allow_hlist())
                  ipmsg_proc_getlist(con, msg);
            else
                  dbg_out("Discard getlist request\n");
            break;
      case IPMSG_ANSLIST:
            dbg_out("Dispatch ans_list\n");
            ipmsg_proc_anslist(con, msg);
            break;
      case IPMSG_BR_ISGETLIST2:
            dbg_out("Dispatch br_isget_list2\n");
            if (hostinfo_refer_ipmsg_is_allow_hlist())
                  ipmsg_proc_br_isgetlist2(con, msg);
            break;
      case IPMSG_SENDMSG:
            dbg_out("Dispatch send_message\n");
            ipmsg_proc_send_msg(con, msg);
            break;
      case IPMSG_RECVMSG:
            dbg_out("Dispatch recv_message\n");
            ipmsg_proc_recv_msg(con, msg);
            break;
      case IPMSG_READMSG:
            dbg_out("Dispatch read_message\n");
            ipmsg_proc_read_msg(con, msg);
            break;
      case IPMSG_DELMSG:
            dbg_out("Dispatch delete_message\n");
            break;
      case IPMSG_ANSREADMSG:
            dbg_out("Dispatch ans_read_message\n");
            break;
      case IPMSG_GETINFO:
            dbg_out("Dispatch get_info\n");
            ipmsg_proc_get_info(con, msg);
            break;
      case IPMSG_SENDINFO:
            dbg_out("Dispatch send_info\n");
            ipmsg_proc_send_info(con, msg);
            break;
      case IPMSG_GETABSENCEINFO:
            dbg_out("Dispatch get_absence_info\n");
            ipmsg_proc_get_absence_info(con, msg);
            break;
      case IPMSG_SENDABSENCEINFO:
            dbg_out("Dispatch send_absence_info\n");
            ipmsg_proc_send_absence_info(con, msg);
            break;
      case IPMSG_RELEASEFILES:
            dbg_out("Dispatch release files\n");
            ipmsg_proc_release_files_msg(con, msg);
            break;
      case IPMSG_GETPUBKEY:
            dbg_out("Dispatch get public key\n");
            ipmsg_proc_get_public_key(con, msg);
            break;
      case IPMSG_ANSPUBKEY:
            dbg_out("Dispatch ans public key\n");
            ipmsg_proc_anspubkey(con, msg);
            break;
      default:
            dbg_out("Can not dispatch unknown:%x\n", msg->command);
            /* Unknown command */
            rc = -ENOENT;
            break;
      }

error_out:
      return rc;
}


Generated by  Doxygen 1.6.0   Back to index