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

static int ipmsg_proc_ans_entry ( const udp_con_t *  con,
const msg_data_t *  msg 
) [static]

IPMSGのIPMSG_ANSENTRYパケットを処理する

Parameters:
[in] con UDPコネクション情報
[in] msg 受信メッセージ情報
Return values:
0 正常終了
-EINVAL 引数異常
-ENOMEM メモリ不足

Definition at line 1399 of file protocol.c.

References ipmsg_protocol_user_opration(), IPMSG_PROTOCOL_USR_ADD, and ipmsg_send_getpubkey().

Referenced by ipmsg_dispatch_message().

                                                                 {
      int                   rc = 0;
      const char       *ipaddr = NULL;
      ipmsg_command_t  command = 0;
      ipmsg_cap_t     peer_cap = 0;

      dbg_out("here\n");

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

      dbg_out("\nNew user: \n\tUser:%s Host: %s\n\t"
          "NickName: %s GroupName:%s\n",
          refer_user_name_from_msg(msg),
          refer_host_name_from_msg(msg),
          refer_nick_name_from_msg(msg),
          refer_group_name_from_msg(msg));

      /* ユーザーリストを更新する */
      rc = ipmsg_protocol_user_opration(con, msg, IPMSG_PROTOCOL_USR_ADD);
      if (rc != 0) {
            goto error_out;
      }

      /*
       * ピアのIPアドレスを取得する
       */
      ipaddr = udp_get_peeraddr(con);
      if (ipaddr == NULL) {
            rc = -ENOENT;
            goto error_out;
      }

      /* コマンドオプションを取得  */
      rc = get_command_from_msg(msg, &command, &peer_cap);
      g_assert(rc == 0);

        /*
       * 暗号化可能なピアの場合, 鍵獲得を試みる  
       */
      if (peer_cap & IPMSG_ENCRYPTOPT) {
        ipmsg_send_getpubkey(con, ipaddr); 
      }

      rc = 0; /* 正常終了 */

error_out:
      return rc;
}


Generated by  Doxygen 1.6.0   Back to index