@startuml

enum ClientSendError {
  NO_CONNECT_REQUESTED,
  SERVER_NOT_AVAILABLE,
  INVALID_REQUEST,
}

class ClientPortData {
  chunkSenderData: ChunkSenderData
  chunkReceiverData: ChunkReceiverData
  connectRequested: atomic<bool>
  connectionState: atomic<ConnectionState>
}

class ClientPortUser {
  connect(): void
  disconnect(): void
  getConnectionState(): ConnectionState
  allocateRequest(userPayloadSize: uint32_t, userPayloadAlignment: uint32_t): expected<RequestHeader*, AllocationError>
  sendRequest(requestHeader: RequestHeader*): expected<ClientSendError>
  releaseRequest(requestHeader: const RequestHeader*): void
  getResponse(): expected<const ResponseHeader*, ChunkReceiveResult>
  releaseResponse(responseHeader: const ResponseHeader*): void
  releaseQueuedResponses(): void
  hasNewResponses(): bool
  hasLostResponsesSinceLastCall(): bool
  setConditionVariable(conditionVariableData: ConditionVariableData&, notificationIndex: uint64_t): void
  unsetConditionVariable(): void
  isConditionVariableSet(): bool
}

class ClientPortRouDi {
  getResponseQueueFullPolicy(): QueueFullPolicy
  getServerTooSlowPolicy(): ConsumerTooSlowPolicy
  tryGetCaProMessage(): optional<CaProMessage>
  dispatchCaProMessageAndGetPossibleResponse(caProMessage: const CaProMessage&): optional<CaProMessage>
  releaseAllChunks(): void
}

ClientPortUser o-- ClientPortData
ClientPortData --o ClientPortRouDi

@enduml
