- MMS client: add handling of initiate error PDU

pull/277/head
Michael Zillgith 5 years ago
parent 74de3a0d07
commit 1bd6efaf05

@ -44,7 +44,7 @@ typedef enum
ISO_IND_TICK
} IsoIndication;
typedef void*
typedef bool
(*IsoIndicationCallback)(IsoIndication indication, void* param, ByteBuffer* payload);
/**

@ -499,7 +499,9 @@ IsoClientConnection_handleConnection(IsoClientConnection self)
setState(self, STATE_CONNECTED);
nextState = INT_STATE_WAIT_FOR_DATA_MSG;
self->callback(ISO_IND_ASSOCIATION_SUCCESS, self->callbackParameter, self->receivePayloadBuffer);
if (self->callback(ISO_IND_ASSOCIATION_SUCCESS, self->callbackParameter, self->receivePayloadBuffer) == false) {
nextState = INT_STATE_CLOSE_ON_ERROR;
}
CotpConnection_resetPayload(self->cotpConnection);
}

@ -981,7 +981,7 @@ handleAsyncResponse(MmsConnection self, ByteBuffer* response, uint32_t bufPos, M
removeFromOutstandingCalls(self, outstandingCall->invokeId);
}
static void
static bool
mmsIsoCallback(IsoIndication indication, void* parameter, ByteBuffer* payload)
{
MmsConnection self = (MmsConnection) parameter;
@ -1022,7 +1022,7 @@ mmsIsoCallback(IsoIndication indication, void* parameter, ByteBuffer* payload)
}
}
return;
return true;
}
if (indication == ISO_IND_CLOSED) {
@ -1035,7 +1035,7 @@ mmsIsoCallback(IsoIndication indication, void* parameter, ByteBuffer* payload)
if (self->connectionLostHandler != NULL)
self->connectionLostHandler(self, self->connectionLostHandlerParameter);
return;
return true;
}
if (indication == ISO_IND_ASSOCIATION_FAILED) {
@ -1043,12 +1043,12 @@ mmsIsoCallback(IsoIndication indication, void* parameter, ByteBuffer* payload)
printf("MMS_CLIENT: mmsIsoCallback: association failed!\n");
setConnectionState(self, MMS_CONNECTION_STATE_CLOSING);
return;
return false;
}
if (payload != NULL) {
if (ByteBuffer_getSize(payload) < 1) {
return;
return false;
}
}
@ -1075,7 +1075,8 @@ mmsIsoCallback(IsoIndication indication, void* parameter, ByteBuffer* payload)
}
else {
setConnectionState(self, MMS_CONNECTION_STATE_CLOSING);
IsoClientConnection_close(self->isoClient);
goto exit_with_error;
}
}
else {
@ -1083,8 +1084,19 @@ mmsIsoCallback(IsoIndication indication, void* parameter, ByteBuffer* payload)
if (DEBUG_MMS_CLIENT)
printf("MMS_CLIENT: Failed to parse initiate response!\n");
return false;
}
}
else if (tag == 0xaa) { /* initiate error PDU */
if (DEBUG_MMS_CLIENT)
printf("MMS_CLIENT: received initiate error PDU\n");
setConnectionState(self, MMS_CONNECTION_STATE_CLOSING);
return false;
}
else if (tag == 0xa3) { /* unconfirmed PDU */
handleUnconfirmedMmsPdu(self, payload);
}
@ -1096,7 +1108,7 @@ mmsIsoCallback(IsoIndication indication, void* parameter, ByteBuffer* payload)
}
else if (tag == 0x8c) { /* conclude response PDU */
if (DEBUG_MMS_CLIENT)
printf("MMS_CLIENT: received conclude.reponse+\n");
printf("MMS_CLIENT: received conclude.response+\n");
if (self->concludeHandler) {
self->concludeHandler(self->concludeHandlerParameter, MMS_ERROR_NONE, true);
@ -1151,14 +1163,14 @@ mmsIsoCallback(IsoIndication indication, void* parameter, ByteBuffer* payload)
if (DEBUG_MMS_CLIENT)
printf("MMS_CLIENT: server sent unexpected confirmed error PDU!\n");
return;
return false;
}
}
else {
if (DEBUG_MMS_CLIENT)
printf("MMS_CLIENT: server sent confirmed error PDU without invoke ID!\n");
return;
return false;
}
}
@ -1195,11 +1207,11 @@ mmsIsoCallback(IsoIndication indication, void* parameter, ByteBuffer* payload)
}
}
else {
return;
return false;
}
}
else {
return;
return false;
}
}
@ -1247,7 +1259,7 @@ mmsIsoCallback(IsoIndication indication, void* parameter, ByteBuffer* payload)
if (DEBUG_MMS_CLIENT)
printf("MMS_CLIENT: unexpected message from server!\n");
return;
return false;
}
}
else
@ -1385,14 +1397,14 @@ mmsIsoCallback(IsoIndication indication, void* parameter, ByteBuffer* payload)
if (DEBUG_MMS_CLIENT)
printf("MMS_CLIENT: LEAVE mmsIsoCallback - OK\n");
return;
return true;
exit_with_error:
if (DEBUG_MMS_CLIENT)
printf("MMS_CLIENT: received malformed message from server!\n");
return;
return false;
}
#if (CONFIG_MMS_THREADLESS_STACK == 0)

Loading…
Cancel
Save