public void handleEvent(ServerPDUEvent event) { PDU pdu = event.getPDU(); if (pdu.isRequest()) { System.out.println("async request received, enqueuing " + pdu.debugString()); synchronized (requestEvents) { requestEvents.enqueue(event); requestEvents.notify(); } } else if (pdu.isResponse()) { System.out.println("async response received " + pdu.debugString()); } else { System.out.println( "pdu of unknown class (not request nor " + "response) received, discarding " + pdu.debugString()); } }
/** * Assigns newly generated sequence number if the sequence number * hasn't been assigned yet. Doesn't have any effect if the sequence * number was already assigned. * * @see #assignSequenceNumber(boolean) * @see #setSequenceNumber(int) * @see #setHeader(ByteBuffer) */ public void assignSequenceNumber() { assignSequenceNumber(false); }
/** * Sets the command status, i.e. error status of the PDU. */ public void setCommandStatus(int cmdStatus) { checkHeader(); header.setCommandStatus(cmdStatus); }
/** * Initialises PDU with given command id. Derived classes should * provide correct command id for their type, e.g. SubmitSM should * provide <code>Data.SUBMIT_SM</code>, which is equal to 4 (as defined * in SMPP 3.4 spec.) * * @param commandId the numerical id of the PDU as specified in SMPP * specification */ public PDU(int commandId) { super(); checkHeader(); setCommandId(commandId); }
System.out.println("Received PDU " + pdu.debugString()); if (pdu.isRequest()) { Response response = ((Request) pdu).getResponse();
int seqNr = expdu == null ? 0 : expdu.getSequenceNumber(); if(automaticNack) { sendGenericNack(Data.ESME_RINVMSGLEN, seqNr); int seqNr = expdu == null ? 0 : expdu.getSequenceNumber(); if(automaticNack) { sendGenericNack(e.getErrorCode(), seqNr); debug.write(DRXTX, "Receiver.receiveAsync(): PDU received, processing " + pdu.debugString()); if (asynchronous) { process(pdu);
public String toString() { String s = super.toString(); if (pdu != null) { s += "\nPDU debug string: " + pdu.debugString(); } return s; }
pdu = receivePDUFromConnection(connection, unprocessed); if (pdu != null) { if ((expectedPDU == null) || !pdu.equals(expectedPDU)) { debug.write(DRXTX, "This is not the pdu we expect, processing" + pdu.debugString()); enqueue(pdu); pdu = null;
if (pdu.getCommandId() == Data.OUTBIND) { debug.write("Got outbind PDU, sending event info. " + pdu.debugString()); sendOutbindEvent(new OutbindEvent(this, connection, (Outbind) pdu)); } else { debug.write("PDU isn't outbind, throwing away. " + pdu.debugString());
ByteBuffer unprocBuffer = unprocessed.getUnprocessed(); try { pdu = PDU.createPDU(unprocBuffer); unprocessed.check(); debug.write(DRXTX, "received complete pdu" + pdu.debugString()); debug.write(DRXTX, "there is " + unprocBuffer.length() + " bytes left in unprocessed buffer");
/** * Assigns unique sequence number to PDU, if necessary, and sends its * data over connection. * * @param pdu the PDU to send * * @exception IOException exception during communication * @exception ValueNotSetException optional param not set but requested */ public void send(PDU pdu) throws ValueNotSetException, IOException { debug.enter(DCOM, this, "send"); pdu.assignSequenceNumber(); try { debug.write(DCOM, "going to send pdu's data over connection"); connection.send(pdu.getData()); debug.write(DCOM, "successfully sent pdu's data over connection"); } finally { debug.exit(DCOM, this); } }
/** * Sets the PDU extra information as a copy of existing Dictionary. * The Dictionary is shallow copied, i.e. new container is created for the PDU * and elements are put into the new container without copying. * @see #setApplicationSpecificInfo(Object,Object) * @see #cloneApplicationSpecificInfo(Dictionary) */ public void setApplicationSpecificInfo(Dictionary<Object, Object> applicationSpecificInfo) { this.applicationSpecificInfo = cloneApplicationSpecificInfo(applicationSpecificInfo); }
/** Returns debug string of all optional parameters. */ protected String debugStringOptional() { String dbgs = ""; dbgs += debugStringOptional("opt", optionalParameters); dbgs += debugStringOptional("extraopt", extraOptionalParameters); return dbgs; }
protected PDU tryReceivePDU(Connection connection, PDU expectedPDU) throws UnknownCommandIdException, TimeoutException, PDUException, IOException { PDU pdu = null; pdu = receivePDUFromConnection(connection, unprocessed); if (pdu != null) { if (!pdu.equals(expectedPDU)) { pdu = null; } } return pdu; }
debug.write(DSESS, "wrong length " + e); debug.write(DSESS, " => sending gnack."); safeGenericNack(Data.ESME_RINVMSGLEN, e.getPDU().getSequenceNumber()); } else { debug.write(DSESS, "InvalidPDUException - rethrowing " + e); debug.write(DSESS, "Got response(?) pdu " + pdu.debugString()); response = checkResponse(pdu, expResponse); } else {
/** * Passes the <code>pdu</code> to the <code>pduListener</code>. * * @param pdu the PDU to pass to the processor as an * <code>ServerPDUEvent</code> * @see Queue * @see ServerPDUEventListener */ private void process(PDU pdu) { debug.write(DRXTX, "receiver passing pdu to ServerPDUEventListener"); if (pduListener != null) { ServerPDUEvent pduReceived = new ServerPDUEvent(this, connection, pdu); pduListener.handleEvent(pduReceived); debug.write(DRXTX, "ServerPDUEventListener received pdu"); } else { debug.write( DRXTX, "async receiver doesn't have ServerPDUEventListener, " + "discarding " + pdu.debugString()); } }
/** * Returns all the extra information related to this PDU. If there is no * information found for this PDU, returns <code>null</code>. * @see #setApplicationSpecificInfo(Object,Object) */ public Dictionary<Object, Object> getApplicationSpecificInfo() { return cloneApplicationSpecificInfo(applicationSpecificInfo); }
/** * "Handles" the event generated for received PDUs -- just logs * the event and throws it away. */ public void handleEvent(ServerPDUEvent event) { PDU pdu = event.getPDU(); if (pdu != null) { if (pdu.isRequest()) { debug.write(DUTL, "receiver listener: handling request " + pdu.debugString()); } else if (pdu.isResponse()) { debug.write(DUTL, "receiver listener: handling response " + pdu.debugString()); } else { debug.write(DUTL, "receiver listener: handling strange pdu " + pdu.debugString()); } } } }
debug.write(DRXTX, "Got pdu " + pdu.debugString());