2
0
mirror of https://github.com/openkmip/pykmip synced 2025-12-16 00:04:26 +00:00

Fully enable KMIP 2.0 support for the server

This changes adds all of the final core updates necessary to allow
KMIP 2.0 message encoding/decoding support for the PyKMIP server.
Request and responses now dynamically adjust the KMIP version they
encode/decode under based on the KMIP version included in their
header segments. Extra server logging has also been added to show
the KMIP version specified by the client request.

Message tests have been updated to reflect these changes.
This commit is contained in:
Peter Hamilton
2019-06-17 17:17:24 -04:00
committed by Peter Hamilton
parent 1c879e2f49
commit 8fb05bd848
5 changed files with 33 additions and 5 deletions

View File

@@ -62,6 +62,10 @@ class RequestHeader(Struct):
self.protocol_version = contents.ProtocolVersion()
self.protocol_version.read(tstream, kmip_version=kmip_version)
kmip_version = contents.protocol_version_to_kmip_version(
self.protocol_version
)
# Read the maximum response size if it is present
if self.is_tag_next(Tags.MAXIMUM_RESPONSE_SIZE, tstream):
self.maximum_response_size = contents.MaximumResponseSize()
@@ -185,6 +189,10 @@ class ResponseHeader(Struct):
self.protocol_version = contents.ProtocolVersion()
self.protocol_version.read(tstream, kmip_version=kmip_version)
kmip_version = contents.protocol_version_to_kmip_version(
self.protocol_version
)
self.time_stamp = contents.TimeStamp()
self.time_stamp.read(tstream, kmip_version=kmip_version)
@@ -467,6 +475,10 @@ class RequestMessage(Struct):
self.request_header = RequestHeader()
self.request_header.read(istream, kmip_version=kmip_version)
kmip_version = contents.protocol_version_to_kmip_version(
self.request_header.protocol_version
)
self.batch_items = []
for _ in range(self.request_header.batch_count.value):
batch_item = RequestBatchItem()
@@ -507,6 +519,10 @@ class ResponseMessage(Struct):
self.response_header = ResponseHeader()
self.response_header.read(istream, kmip_version=kmip_version)
kmip_version = contents.protocol_version_to_kmip_version(
self.response_header.protocol_version
)
self.batch_items = []
for _ in range(self.response_header.batch_count.value):
batch_item = ResponseBatchItem()