File: TcpTransportPython.i

package info (click to toggle)
robotraconteur 1.2.7-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 101,380 kB
  • sloc: cpp: 1,149,268; cs: 87,653; java: 58,127; python: 26,897; ansic: 356; sh: 152; makefile: 90; xml: 51
file content (180 lines) | stat: -rw-r--r-- 5,141 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180

%rename(_IsTransportConnectionSecure) IsTransportConnectionSecure;
%rename(_IsSecurePeerIdentityVerified) IsSecurePeerIdentityVerified;
%rename(_GetSecurePeerIdentity) GetSecurePeerIdentity;

%include "TcpTransport.i"

%extend RobotRaconteur::TcpTransport
{
%pythoncode
%{
	DefaultReceiveTimeout = property(lambda self: self._GetDefaultReceiveTimeout()/1000.0, lambda self, timeout: self._SetDefaultReceiveTimeout(timeout*1000),
		doc = """
		Set the default receive timeout in seconds

		If no messages are received within the timeout, the connection
		is assumed to be lost.

		Default: 15 seconds

		:rtype: float
		""")
	DefaultConnectTimeout = property(lambda self: self._GetDefaultConnectTimeout()/1000.0, lambda self, timeout: self._SetDefaultConnectTimeout(timeout*1000),
		doc = """
		Set the default connect timeout in seconds

		If the connection is not completed within the timeout, the connection
		attempt will be aborted.

		Default: 5 seconds

		:rtype: float
		"""
	)
	DefaultHeartbeatPeriod = property(lambda self: self._GetDefaultHeartbeatPeriod()/1000.0, lambda self, timeout: self._SetDefaultHeartbeatPeriod(timeout*1000),
		doc = """
		Set the default heartbeat period in seconds

		The heartbeat is used to keep the connection alive
		if no communication is occuring between nodes.

		Default: 5 seconds

		:rtype: float
		"""
	)
	MaxMessageSize = property(lambda self: self._GetMaxMessageSize(), lambda self, size: self._SetMaxMessageSize(size),
		doc = """
		Set the maximum serialized message size

		Default: 10 MB

		:rtype: int
		""")
	MaxConnectionCount = property(lambda self: self._GetMaxConnectionCount(), lambda self, count: self._SetMaxConnectionCount(count),
		doc = """
		Set the maximum number of concurrent connections

		Default: 0 for unlimited

		:rtype: int
		""")
	RequireTls = property(lambda self: self._GetRequireTls(), lambda self, val: self._SetRequireTls(val),
		doc = """
		Set if all connections require TLS

		If true, all connections require TLS

		:rtype: bool
		""")
	IsTlsNodeCertificateLoaded = property(lambda self: self._IsTlsNodeCertificateLoaded(),
		doc = """
	Check if TLS certificate is loaded

	:rtype: bool
	""")
	AcceptWebSockets = property(lambda self: self._GetAcceptWebSockets(), lambda self, val: self._SetAcceptWebSockets(val),
		doc = """
		Set if the transport will accept incoming HTTP websocket connections

		Default: true

		:rtype: bool
		""")
	DisableMessage4 = property(lambda self: self._GetDisableMessage4(), lambda self, val: self._SetDisableMessage4(val),
		doc = """
		Set disable Message Format Version 4

		Message Format Version 2 will be used

		Default: Message V4 is enabled

		:rtype: bool
		""")
	DisableStringTable = property(lambda self: self._GetDisableStringTable(), lambda self, val: self._SetDisableStringTable(val),
		doc = """
		Set disable string table

		Default: false

		RobotRaconteurNodeSetup and its subclasses
		will disable the string table by default

		:rtype: bool
		""")

	DisableAsyncMessageIO = property(lambda self: self._GetDisableAsyncMessageIO(), lambda self, val: self._SetDisableAsyncMessageIO(val),
		doc = """
		Set if async message io is disabled

		Async message io has better memory handling, at the
		expense of slightly higher latency.

		Default: Async io enabled

		:rtype: bool
		""")

	NodeAnnouncePeriod = property(lambda self: self._GetNodeAnnouncePeriod()/1000.0, lambda self, timeout: self._SetNodeAnnouncePeriod(timeout*1000),
		doc = """
		Set the period between node announce in seconds

		Default 55 seconds

		:rtype: float
		"""

	)

	def IsTransportConnectionSecure(self,obj):
		"""
		Check if specified client or endpoint is using TLS for its transport

		Throws ConnectionException if the client or endpoint is invalid or the connection
		is not using TcpTransport

		:param obj: The client or endpoint to check
		:return: True The connection is using TLS, otherwise False
		:rtype: bool
		"""
		if (hasattr(obj,'rrinnerstub')):
			obj=obj.rrinnerstub
		return self._IsTransportConnectionSecure(obj)

	def IsSecurePeerIdentityVerified(self,obj):
		"""
		Check if specified peer is using TLS and has been
		verified using a certificate

		Checks if the peer server node has a valid certificate, or if the peer client
		has been verified using mutual authentication.

		Throws ConnectionException if the endpoint is invalid or the connection
		is not using TcpTransport

		:param obj: The client or endpoint to check
		:return: True The connection is using TLS, otherwise False
		:rtype: bool
		"""
		if (hasattr(obj,'rrinnerstub')):
			obj=obj.rrinnerstub
		return self._IsSecurePeerIdentityVerified(obj)

	def GetSecurePeerIdentity(self,obj):
		"""
		Get the identity of the peer if secured using TLS

		Get the identity of a peer verified using TLS certificates. Returns a NodeID in string
		format. Will throw AuthenticationException if the peer has not been verified.

		:param obj: The client or endpoint to check
		:return: The verified peer NodeID as a string
		:rtype: str
		"""
		if (hasattr(obj,'rrinnerstub')):
			obj=obj.rrinnerstub
		return self._GetSecurePeerIdentity(obj)
%}

}