wmii

git clone git://oldgit.suckless.org/wmii/
Log | Files | Refs | README | LICENSE

types.py (1215B)


      1 from pyxp.messages import Message
      2 from pyxp.fields import *
      3 
      4 __all__ = 'Qid', 'Stat'
      5           
      6 class Qid(Message):
      7     QTFILE    = 0x00
      8     QTLINK    = 0x01
      9     QTSYMLINK = 0x02
     10     QTTMP     = 0x04
     11     QTAUTH    = 0x08
     12     QTMOUNT   = 0x10
     13     QTEXCL    = 0x20
     14     QTAPPEND  = 0x40
     15     QTDIR     = 0x80
     16 
     17     type    = Int(1)
     18     version = Int(4)
     19     path    = Int(8)
     20 
     21 class Stat(Message):
     22     DMDIR       = 0x80000000
     23     DMAPPEND    = 0x40000000
     24     DMEXCL      = 0x20000000
     25     DMMOUNT     = 0x10000000
     26     DMAUTH      = 0x08000000
     27     DMTMP       = 0x04000000
     28     DMSYMLINK   = 0x02000000
     29     DMDEVICE    = 0x00800000
     30     DMNAMEDPIPE = 0x00200000
     31     DMSOCKET    = 0x00100000
     32     DMSETUID    = 0x00080000
     33     DMSETGID    = 0x00040000
     34 
     35     @classmethod
     36     def unmarshall_list(cls, data, offset=0):
     37         while offset < len(data):
     38             n, stat = cls.unmarshall(data, offset)
     39             offset += n
     40             yield stat
     41 
     42     size   = Size(2)
     43     type   = Int(2)
     44     dev    = Int(4)
     45     qid    = Qid.field()
     46     mode   = Int(4)
     47     atime  = Date()
     48     mtime  = Date()
     49     length = Int(8)
     50     name   = String()
     51     uid    = String()
     52     gid    = String()
     53     muid   = String()
     54 
     55 # vim:se sts=4 sw=4 et: