@@ -89,6 +89,7 @@ def wrapper(*args, **kwds):
8989
9090 return decorator
9191
92+
9293def get_cid ():
9394 if fcntl is None :
9495 return None
@@ -102,6 +103,7 @@ def get_cid():
102103 else :
103104 return struct .unpack ("I" , r )[0 ]
104105
106+
105107def _have_socket_can ():
106108 """Check whether CAN sockets are supported on this host."""
107109 try :
@@ -112,6 +114,7 @@ def _have_socket_can():
112114 s .close ()
113115 return True
114116
117+
115118def _have_socket_can_isotp ():
116119 """Check whether CAN ISOTP sockets are supported on this host."""
117120 try :
@@ -122,6 +125,7 @@ def _have_socket_can_isotp():
122125 s .close ()
123126 return True
124127
128+
125129def _have_socket_can_j1939 ():
126130 """Check whether CAN J1939 sockets are supported on this host."""
127131 try :
@@ -132,6 +136,7 @@ def _have_socket_can_j1939():
132136 s .close ()
133137 return True
134138
139+
135140def _have_socket_rds ():
136141 """Check whether RDS sockets are supported on this host."""
137142 try :
@@ -142,6 +147,7 @@ def _have_socket_rds():
142147 s .close ()
143148 return True
144149
150+
145151def _have_socket_alg ():
146152 """Check whether AF_ALG sockets are supported on this host."""
147153 try :
@@ -152,6 +158,7 @@ def _have_socket_alg():
152158 s .close ()
153159 return True
154160
161+
155162def _have_socket_qipcrtr ():
156163 """Check whether AF_QIPCRTR sockets are supported on this host."""
157164 try :
@@ -162,6 +169,7 @@ def _have_socket_qipcrtr():
162169 s .close ()
163170 return True
164171
172+
165173def _have_socket_vsock ():
166174 """Check whether AF_VSOCK sockets are supported on this host."""
167175 cid = get_cid ()
@@ -202,6 +210,7 @@ def _have_socket_hyperv():
202210 s .close ()
203211 return True
204212
213+
205214def _find_service (expected_protocols ,
206215 services_file = '/etc/services' ):
207216 if not os .path .exists (services_file ):
@@ -223,6 +232,7 @@ def _find_service(expected_protocols,
223232 return service_name
224233 return None
225234
235+
226236@contextlib .contextmanager
227237def socket_setdefaulttimeout (timeout ):
228238 old_timeout = socket .getdefaulttimeout ()
0 commit comments