2 from rosauth.srv
import Authentication
6 from twisted.internet.protocol
import DatagramProtocol,Factory
12 (host, port) = source_addr
13 endpoint = host.__str__() + port.__str__()
14 if endpoint
in self.
socks:
17 writefunc =
lambda msg: self.transport.write(msg, (host,port))
25 client_count_pub =
None 30 fragment_timeout = 600
32 delay_between_messages = 0
33 max_message_size =
None 34 unregister_timeout = 10.0
56 except Exception
as exc:
57 rospy.logerr(
"Unable to accept incoming connection. Reason: %s", str(exc))
60 rospy.loginfo(
"Awaiting proper authentication...")
67 msg = json.loads(message)
68 if msg[
'op'] ==
'auth':
70 auth_srv = rospy.ServiceProxy(
'authenticate', Authentication)
71 resp = auth_srv(msg[
'mac'], msg[
'client'], msg[
'dest'],
72 msg[
'rand'], rospy.Time(msg[
't']), msg[
'level'],
73 rospy.Time(msg[
'end']))
76 rospy.loginfo(
"Client %d has authenticated.", self.protocol.client_id)
79 rospy.logwarn(
"Client %d did not authenticate. Closing connection.",
80 self.protocol.client_id)
84 self.protocol.incoming(message)
87 self.protocol.incoming(message)
92 self.protocol.finish()
97 binary = type(message)==bson.BSON
int delay_between_messages
def check_origin(self, origin)
def datagramReceived(self, message)
def __init__(self, write)
def datagramReceived(self, message, source_addr)
def send_message(self, message)