public CMPPDeliver unwrapUserReport(SGIPPacket packet) {
   try {
     SGIPUserReport sgip_user_report = new SGIPUserReport(packet);
     sgip_user_report.unwrap();
     if (!sgip_user_report.isValid()) return null;
     CMPPDeliver deliver = new CMPPDeliver(packet.sequence_id);
     deliver.gateway_name = sgip_user_report.gateway_name;
     deliver.session_id = sgip_user_report.session_id;
     deliver.guid = sgip_user_report.guid;
     long msg_id = (long) sgip_user_report.node_id & 0xfffffffffL;
     msg_id <<= 32;
     msg_id |= (long) sgip_user_report.time_stamp & 0xffffffffL;
     deliver.msg_id = msg_id;
     deliver.registered_delivery = 1;
     deliver.service_id = "USERRPT";
     deliver.destination_id = sgip_user_report.sp_number;
     deliver.src_terminal_id = sgip_user_report.user_number;
     deliver.status_report.done_time = Utility.get_time_stamp(sgip_user_report.time_stamp);
     if (sgip_user_report.user_condition == 0) deliver.status_report.status = "ABOLISH";
     else if (sgip_user_report.user_condition == 1) deliver.status_report.status = "ARREAR";
     else if (sgip_user_report.user_condition == 2) deliver.status_report.status = "NORMAL";
     else deliver.status_report.status = "UNKNOWN";
     return deliver;
   } catch (Exception e) {
     Log.log(e);
   }
   Log.log(
       "SGIPExchanger("
           + m_nID
           + ","
           + m_gateway.m_strName
           + ").unwrapUserReport : unexpected exit !",
       0x2000000000000004L);
   return null;
 }
 public CMPPDeliver unwrapDeliver(SGIPPacket packet) {
   try {
     SGIPDeliver sgip_deliver = new SGIPDeliver(packet);
     sgip_deliver.unwrap();
     SGIPDeliverResponse response = new SGIPDeliverResponse(sgip_deliver.sequence_id);
     response.gateway_name = sgip_deliver.gateway_name;
     response.sequence_id = sgip_deliver.sequence_id;
     response.node_id = sgip_deliver.node_id;
     response.time_stamp = sgip_deliver.time_stamp;
     response.result = (byte) sgip_deliver.checkValid();
     response.session_id = sgip_deliver.session_id;
     response.wrap();
     for (; !m_gateway.send(response); Engine.nap()) ;
     if (sgip_deliver.message_coding == 8) reencode_message_content(sgip_deliver);
     CMPPDeliver deliver = new CMPPDeliver(packet.sequence_id);
     deliver.gateway_name = sgip_deliver.gateway_name;
     deliver.session_id = sgip_deliver.session_id;
     deliver.guid = sgip_deliver.guid;
     long msg_id = (long) sgip_deliver.node_id & 0xfffffffffL;
     msg_id <<= 32;
     msg_id |= (long) sgip_deliver.time_stamp & 0xffffffffL;
     deliver.msg_id = msg_id;
     deliver.registered_delivery = 0;
     deliver.destination_id = sgip_deliver.sp_number;
     deliver.src_terminal_id = sgip_deliver.user_number;
     deliver.tp_pid = sgip_deliver.tp_pid;
     deliver.tp_udhi = sgip_deliver.tp_udhi;
     deliver.msg_fmt = sgip_deliver.message_coding;
     deliver.msg_length = sgip_deliver.message_length;
     deliver.msg_content = sgip_deliver.message_content;
     return deliver;
   } catch (Exception e) {
     Log.log(e);
   }
   Log.log(
       "SGIPExchanger("
           + m_nID
           + ","
           + m_gateway.m_strName
           + ").unwrapDeliver : unexpected exit !",
       0x2000000000000004L);
   return null;
 }