Ejemplo n.º 1
0
  def handle_read(self):
    retval = msgpkt.recv(self)
    if retval == 0:
      return
    if retval == -1:
      self.handle_close()
      return
    data = self.msgpkt_buf
    self.msgpkt_hdr = ''
    self.msgpkt_buf = ''
    self.msgpkt_len = 0

    if data != '':
      log.l.LogIt('RTS004', 'D', '%s i: %s', (self.ip, data))

      tok = string.split(data)
      if tok[0] == 'ok':
        pass

      elif tok[0] == 'atm':
        if len(tok) == 8:
          #           wsid    dom     port    sub     prim    sec     fb
          ga_hdlr.setatm(tok[1], tok[2], tok[3], tok[4], tok[5], tok[6], tok[7])
        else:
          ga_hdlr.badatm(tok[1])
Ejemplo n.º 2
0
 def handle_read(self):
   global responses
   retval = msgpkt.recv(self)
   if retval == 0:
     return
   if retval == -1:
     self.handle_close()
     return
   data = self.msgpkt_buf
   self.msgpkt_hdr = ''
   self.msgpkt_buf = ''
   self.msgpkt_len = 0
   log.l.LogIt('SCMD11', 'D', 'i: %s', (data))
   print data
   responses.append(self.name)
Ejemplo n.º 3
0
 def handle_read(self):
   retval = msgpkt.recv(self)
   if retval == 0:
     return
   if retval == -1:
     self.handle_close()
     return
   self.data = self.msgpkt_buf
   self.msgpkt_hdr = ''
   self.msgpkt_buf = ''
   self.msgpkt_len = 0
   
   if self.data != '':
     log.l.LogIt('RSD004', 'D', 'i (%s): %s', (self.peer_ip, self.data))
     self.process()
Ejemplo n.º 4
0
 def handle_read(self):
     global aprs, responses
     retval = msgpkt.recv(self)
     if retval == 0:
         return
     if retval == -1:
         self.handle_close()
         return
     data = self.msgpkt_buf
     self.msgpkt_hdr = ""
     self.msgpkt_buf = ""
     self.msgpkt_len = 0
     log.l.LogIt("CTRL13", "D", "i: %s", (data))
     ip = aprs[self.name]["ip"]
     print self.name, "(%s)" % ip, data
     responses.append(self.name)
Ejemplo n.º 5
0
 def handle_read(self):
     global responses
     # --------------
     retval = msgpkt.recv(self)
     if retval == 0:
         return
     if retval == -1:
         self.handle_close()
         return
     data = self.msgpkt_buf
     self.msgpkt_hdr = ""
     self.msgpkt_buf = ""
     self.msgpkt_len = 0
     # --------------
     log.l.LogIt("CMD011", "D", "i: %s", (data))
     print data
     responses.append(self.name)
Ejemplo n.º 6
0
  def handle_read(self):
    retval = msgpkt.recv(self)
    if retval == 0:
      return
    if retval == -1:
      self.handle_close()
      return
    cmd = self.msgpkt_hdr
    msg = self.msgpkt_buf
    self.msgpkt_hdr = ''
    self.msgpkt_buf = ''
    self.msgpkt_len = 0

    if cmd != '':
      #-----------------------
      if cmd == 'DAT':  # incoming status
        self.apr = insert(msg)
        

      #-----------------------
      elif cmd == 'GET':  # request for status
        log.l.LogIt('AS0010', 'I', '%s: %s: %s', (self.peer[0], cmd, msg))
        aprs = apr.keys()
        aprs.sort()
        for i in aprs:
          addrs = apr[i].keys()
          addrs.sort()
          for a in addrs:
            pkt = '%s ' % i
            if len(a) <= 3:  # X.25
              if msg == 'tcp': continue
              else:
                pkt += '%s %s ' % (a[0], a[1:])
            else:            # IP
              if msg == 'sna': continue
              else:
                pkt += '%s ' % (a)
            pkt += '%s %s %s %s %s %s' % (apr[i][a]['status'],
                   apr[i][a]['sub'], apr[i][a]['dom'], apr[i][a]['wsid'],
                   apr[i][a]['ga'], apr[i][a]['bnm'])
            pkt = msgpkt.mkmsg('DAT', pkt)
            self.senddata.append(pkt)
        if len(self.senddata) == 0:
          self.handle_close()