import syslog
-from hippotit import *
+from hippotat import *
clients = { }
# syslog.syslog(syslog.LOG_DEBUG,
# 'discarded packet %s -> %s (%s)' % (saddr, daddr, why))
-#---------- ipif (slip subprocess) ----------
-
-class IpifProcessProtocol(twisted.internet.protocol.ProcessProtocol):
- def __init__(self):
- self._buffer = b''
- def connectionMade(self): pass
- def outReceived(self, data):
- #print('RECV ', repr(data))
- self._buffer += data
- packets = slip.decode(self._buffer)
- self._buffer = packets.pop()
- for packet in packets:
- if not len(packet): continue
- (saddr, daddr) = packet_addrs(packet)
- route(packet, saddr, daddr)
- def processEnded(self, status):
- status.raiseException()
-
-def start_ipif():
- global ipif
- ipif = IpifProcessProtocol()
- reactor.spawnProcess(ipif,
- '/bin/sh',['sh','-xc', ipif_command],
- childFDs={0:'w', 1:'r', 2:2})
-
-def queue_inbound(packet):
- ipif.transport.write(slip.delimiter)
- ipif.transport.write(slip.encode(packet))
- ipif.transport.write(slip.delimiter)
-
#---------- client ----------
class Client():
c.new_request(request)
def render_GET(self, request):
- return b'<html><body>hippotit</body></html>'
+ return b'<html><body>hippotat</body></html>'
def start_http():
resource = IphttpResource()
cfg.read(opts.configfile)
process_cfg()
- start_ipif()
+ start_ipif(ipif_command, route)
start_http()
startup()