public CMPPDeliver unwrapReport(SGIPPacket packet) { try { SGIPReport sgip_report = new SGIPReport(packet); sgip_report.unwrap(); SGIPReportResponse response = new SGIPReportResponse(sgip_report.sequence_id); response.gateway_name = sgip_report.gateway_name; response.sequence_id = sgip_report.sequence_id; response.node_id = sgip_report.node_id; response.time_stamp = sgip_report.time_stamp; response.result = 0; response.session_id = sgip_report.session_id; response.wrap(); for (; !m_gateway.send(response); Engine.nap()) ; if (!sgip_report.isValid()) return null; CMPPDeliver deliver = new CMPPDeliver(packet.sequence_id); deliver.gateway_name = sgip_report.gateway_name; deliver.session_id = sgip_report.session_id; deliver.guid = sgip_report.guid; long msg_id = (long) sgip_report.node_id & 0xfffffffffL; msg_id <<= 32; msg_id |= (long) sgip_report.time_stamp & 0xffffffffL; deliver.msg_id = msg_id; deliver.registered_delivery = 1; deliver.service_id = "REPORT"; msg_id = (long) sgip_report.packet_time_stamp & 0xfffffffffL; msg_id <<= 32; msg_id |= (long) sgip_report.packet_sequence_id & 0xffffffffL; deliver.status_report.msg_id = msg_id; deliver.status_report.submit_time = Utility.get_time_stamp(sgip_report.time_stamp); if (sgip_report.state == 0) deliver.status_report.status = "DELIVRD"; else if (sgip_report.state == 1) deliver.status_report.status = "WAITING"; else if (sgip_report.state == 2) deliver.status_report.status = "FAILED"; else deliver.status_report.status = "UNKNOWN"; deliver.destination_id = sgip_report.user_number; deliver.status_report.smsc_sequence = sgip_report.error_code; return deliver; } catch (Exception e) { Log.log(e); } Log.log( "SGIPExchanger(" + m_nID + "," + m_gateway.m_strName + ").unwrapReport : 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; }
public void run() { try { Log.log( "SGIPExchanger(" + m_nID + "," + m_gateway.m_strName + ").run : thread startup !", 4L); m_nStatus = 1; for (; isRunning(); Engine.nap()) { if (m_gateway.isStopped()) { Log.log( "SGIPExchanger(" + m_nID + "," + m_gateway.m_strName + ").run : gateway is stopped !", 0x2000000000000004L); break; } if (sgip_output == null) handleOutput(); toGateway(); if (m_database.isStopped()) { Log.log( "SGIPExchanger(" + m_nID + "," + m_gateway.m_strName + ").run : database is stopped !", 0x2000000000000004L); break; } if (cmpp_input == null) handleInput(); toDatabase(); } } catch (Exception e) { Log.log(e); Log.log( "SGIPExchanger(" + m_nID + "," + m_gateway.m_strName + ").run : unexpected exit !", 0x2000000000000004L); } m_nStatus = 3; Log.log("SGIPExchanger(" + m_nID + "," + m_gateway.m_strName + ").run : thread stopped !", 4L); }