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

static int ipmsg_send_absence_msg ( const udp_con_t *  con,
const int  flags 
) [static]

IPMSGのIPMSG_SENDABSENCEINFOパケットを送出する

Parameters:
[in] con UDPコネクション情報
[in] flags パケット送信フラグ
Return values:
0 正常終了
-EINVAL 引数異常
-ENOMEM メモリ不足

Definition at line 1625 of file protocol.c.

References IPMSG_PROTOCOL_MSG_NO_EXTENSION, IPMSG_PROTOCOL_PKTNUM_AUTO, and ipmsg_send_sendmsg_packets().

Referenced by ipmsg_proc_get_absence_info(), and ipmsg_proc_send_msg().

                                                              {
      char        *absence_message = NULL;
      const char          *ipaddr = NULL;
      int             local_flags = 0;
      int                      rc = 0;

      if (con == NULL) {
        rc = -EINVAL;
        goto no_need_free_out;
      }

      /*
       * フラグを設定する
       */
      local_flags  = flags;
      local_flags |= (IPMSG_NO_REPLY_OPTS|IPMSG_AUTORETOPT);

      /*
       * ピアのIPアドレスを取得する
       */
      ipaddr = udp_get_peeraddr(con);
      if (ipaddr == NULL) {
            rc = -ENOENT;
            goto no_need_free_out;
      }
            
      /*
       * 不在通知電文を獲得する
       */
      rc = hostinfo_get_current_absence_message(&absence_message);
      if (rc != 0) {
            g_assert(absence_message == NULL);
            goto no_need_free_out;
      }

      rc = ipmsg_send_sendmsg_packets(con, ipaddr, local_flags, 
          IPMSG_PROTOCOL_PKTNUM_AUTO, 
          absence_message, IPMSG_PROTOCOL_MSG_NO_EXTENSION);
      if (rc != 0) {
            goto free_absence_message;
      }

      dbg_out("Absence message:%s\n", absence_message);

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

free_absence_message:
      if (absence_message != NULL)
            g_free(absence_message);

no_need_free_out:
      return rc;
}


Generated by  Doxygen 1.6.0   Back to index