~nytpu/tlsada

b17888fb591ae1b137747cbe1293afad44e763da — nytpu 1 year, 11 months ago e4fb997
TLS.Contexts.*: Use dot method calls instead of parenthetical calls for cleanliness
3 files changed, 24 insertions(+), 24 deletions(-)

M src/tls-contexts-client.ads
M src/tls-contexts-server.ads
M src/tls-contexts.ads
M src/tls-contexts-client.ads => src/tls-contexts-client.ads +7 -7
@@ 19,8 19,8 @@ package TLS.Contexts.Client is
	procedure Connect
		(Ctx : in out Client_Context; Host : String; Port : Port_Number)
		with
			Pre => Is_Initialized(Ctx) and Is_Configued(Ctx) and not Is_Connected(Ctx),
			Post => Is_Connected(Ctx);
			Pre => Ctx.Is_Initialized and Ctx.Is_Configued and not Ctx.Is_Connected,
			Post => Ctx.Is_Connected;

	-- Connect to a given hostname and port using a given context, in the same
	-- manner as the other Connect; however this will also specify an


@@ 32,8 32,8 @@ package TLS.Contexts.Client is
		Port : Port_Number;
		Server_Name : String
	) with
		Pre => Is_Initialized(Ctx) and Is_Configued(Ctx) and not Is_Connected(Ctx),
		Post => Is_Connected(Ctx);
		Pre => Ctx.Is_Initialized and Ctx.Is_Configued and not Ctx.Is_Connected,
		Post => Ctx.Is_Connected;

	-- Upgrade an existing socket connection to use TLS.  The server name is
	-- used for TLS' server name indication.  If this procedure is used to


@@ 45,13 45,13 @@ package TLS.Contexts.Client is
		Server_Name : String
	) with
		Pre =>
			Is_Initialized(Ctx) and Is_Configued(Ctx) and not Is_Connected(Ctx),
		Post => Is_Connected(Ctx);
			Ctx.Is_Initialized and Ctx.Is_Configued and not Ctx.Is_Connected,
		Post => Ctx.Is_Connected;

	-- Indicate whether a TLS session has been resumed during the handshake
	-- with the connected server
	function Session_Resumed (Ctx : Client_Context) return Boolean
		with Pre => Is_Connected(Ctx);
		with Pre => Ctx.Is_Connected;


private

M src/tls-contexts-server.ads => src/tls-contexts-server.ads +5 -5
@@ 21,16 21,16 @@ package TLS.Contexts.Server is
		Connected_Context : out Server_Context)
		with
			Pre =>
				Is_Initialized(Server_Ctx) and Is_Configued(Server_Ctx) and
				not Is_Connected(Server_Ctx),
				Server_Ctx.Is_Initialized and Server_Ctx.Is_Configued and
				not Server_Ctx.Is_Connected,
			Post =>
				not Is_Connected(Server_Ctx) and
				Is_Initialized(Connected_Context) and Is_Configued(Connected_Context) and Is_Connected(Connected_Context);
				not Server_Ctx.Is_Connected and
				Connected_Context.Is_Initialized and Connected_Context.Is_Configued and Connected_Context.Is_Connected;

	-- Returns a string corresponding to the servername that the client
	-- requested by sending a TLS Server Name Indication extension
	function SNI_Servername (Ctx : Server_Context) return String
		with Pre => Is_Connected(Ctx);
		with Pre => Ctx.Is_Connected;


private

M src/tls-contexts.ads => src/tls-contexts.ads +12 -12
@@ 112,11 112,11 @@ package TLS.Contexts is

	-- Return whether a Context is configured or not.
	function Is_Configued (Ctx : Context) return Boolean
		with Pre => Is_Initialized(Ctx);
		with Pre => Ctx.Is_Initialized;

	-- Return whether a Context has a currently active connection.
	function Is_Connected (Ctx : Context) return Boolean
		with Pre => Is_Initialized(Ctx);
		with Pre => Ctx.Is_Initialized;

	-- Configure a Context with the given Config.  A Context may be
	-- reconfigured multiple times, and the previous configuration will be


@@ 125,19 125,19 @@ package TLS.Contexts is
	-- to update the Context's configuration.
	procedure Configure (Ctx : in out Context; Conf : Config)
		with
			Pre => Is_Initialized(Ctx),
			Post => Is_Configued(Ctx);
			Pre => Ctx.Is_Initialized,
			Post => Ctx.Is_Configued;

	-- Read incoming data from a Context's connection
	overriding procedure Read
		(Ctx : in out Context;
		Item : out Stream_Element_Array; Last : out Stream_Element_Offset)
		with Pre => Is_Connected(Ctx);
		with Pre => Ctx.Is_Connected;

	-- Write data to a Context's connection
	overriding procedure Write
		(Ctx : in out Context; Item : Stream_Element_Array)
		with Pre => Is_Connected(Ctx);
		with Pre => Ctx.Is_Connected;

	-- Close an open TLS connection, or have no effect if there is no active
	-- connection.  If a connection was estabilished using an existing socket


@@ 145,29 145,29 @@ package TLS.Contexts is
	-- Note that even if the peer has closed their end of the connection, you
	-- MUST close your end as well.
	procedure Close (Ctx : in out Context)
		with Post => not Is_Connected(Ctx);
		with Post => not Ctx.Is_Connected;

	-- Return a record containing information about the current TLS connection.
	function Get_Connection_Info (Ctx : Context) return Connection_Info
		with Pre => Is_Connected(Ctx);
		with Pre => Ctx.Is_Connected;

	-- Indicate whether the server has provided a certificate.
	function Peer_Certificate_Provided (Ctx : Context) return Boolean
		with Pre => Is_Connected(Ctx);
		with Pre => Ctx.Is_Connected;

	-- Return a record containing information about the server's TLS
	-- certificate
	function Get_Certificate_Info (Ctx : Context) return Certificate_Info
		with Pre => Is_Connected(Ctx) and Peer_Certificate_Provided(Ctx);
		with Pre => Ctx.Is_Connected and Ctx.Peer_Certificate_Provided;

	-- Check if the server's certificate's SAN or CN match the given Name.
	function Peer_Certificate_Contains_Name
		(Ctx : Context; Name : String)
		return Boolean
		with Pre => Is_Connected(Ctx) and Peer_Certificate_Provided(Ctx);
		with Pre => Ctx.Is_Connected and Ctx.Peer_Certificate_Provided;

	function Get_OCSP_Info (Ctx : Context) return OCSP_Info
		with Pre => Is_Connected(Ctx);
		with Pre => Ctx.Is_Connected;


private