if 'nw_udp_listen' in obj.conf:
ip, sep, port = obj.conf['nw_udp_listen'].rpartition(':')
if not ip:
ip = '0.0.0.0'
dest = 'udp:' + ip + ':' + port
if dest not in self.special_listeners:
if self.add_listener('udp', ip, port):
self.special_listeners[dest][obj_type + 's'][oid] = {obj_type: obj, 'acl': acl}
else:
self.logger.warning("Could not add listener {} for {}".format(dest, oid))
else:
self.special_listeners[dest][obj_type + 's'][oid] = {obj_type: obj, 'acl': acl}
if generic:
self.generic_listeners[dest] = {'items': {}, 'logics': {}, 'acl': acl}
else:
self.special_listeners[dest] = {'items': {}, 'logics': {}, 'acl': acl}
if dest in self.generic_listeners:
inp = data.split(self.input_seperator, 2) # max 3 elements
elif dest in self.special_listeners:
proto, t1, t2 = dest.partition(':')
if proto == 'udp':
gacl = self.udp_acl
for entry in self.special_listeners[dest]['items']:
lacl = self.special_listeners[dest]['items'][entry]['acl']
item = self.special_listeners[dest]['items'][entry]['item']
if lacl:
if source not in lacl:
self.logger.error("Item {0} acl doesn't permit triggering from {1}.".format(item.id(), source))
return False
elif gacl:
if source not in gacl:
self.logger.error("Generic network acl doesn't permit triggering from {0}.".format(source))
return False
item(data, 'network', source)