static void allocateWriteBuffer(CotpConnection* self) { if (self->writeBuffer == NULL ) self->writeBuffer = ByteBuffer_create(NULL, CotpConnection_getTpduSize(self) + TPKT_RFC1006_HEADER_SIZE); }
void MmsServerConnection_sendWriteResponse(MmsServerConnection* self, uint32_t invokeId, MmsDataAccessError indication) { ByteBuffer* response = ByteBuffer_create(NULL, self->maxPduSize); mmsServer_createMmsWriteResponse(self, invokeId, response, 1, &indication); IsoConnection_sendMessage(self->isoConnection, response, false); ByteBuffer_destroy(response); }
void CotpConnection_init(CotpConnection* self, Socket socket, ByteBuffer* payloadBuffer) { self->state = 0; self->socket = socket; self->srcRef = -1; self->dstRef = -1; self->protocolClass = -1; self->options.tpdu_size = 0; self->options.tsap_id_src = -1; self->options.tsap_id_dst = -1; self->payload = payloadBuffer; /* default TPDU size is maximum size */ CotpConnection_setTpduSize(self, COTP_MAX_TPDU_SIZE); self->writeBuffer = NULL; self->readBuffer = ByteBuffer_create(NULL, COTP_MAX_TPDU_SIZE + TPKT_RFC1006_HEADER_SIZE); self->packetSize = 0; }