| 118 | |
| 119 | |
| 120 | class CUnsignedAlert(Serializable): |
| 121 | def __init__(self): |
| 122 | self.nVersion = 1 |
| 123 | self.nRelayUntil = 0 |
| 124 | self.nExpiration = 0 |
| 125 | self.nID = 0 |
| 126 | self.nCancel = 0 |
| 127 | self.setCancel = [] |
| 128 | self.nMinVer = 0 |
| 129 | self.nMaxVer = 0 |
| 130 | self.setSubVer = [] |
| 131 | self.nPriority = 0 |
| 132 | self.strComment = b"" |
| 133 | self.strStatusBar = b"" |
| 134 | self.strReserved = b"" |
| 135 | |
| 136 | @classmethod |
| 137 | def stream_deserialize(cls, f): |
| 138 | c = cls() |
| 139 | c.nVersion = struct.unpack(b"<i", ser_read(f,4))[0] |
| 140 | c.nRelayUntil = struct.unpack(b"<q", ser_read(f,8))[0] |
| 141 | c.nExpiration = struct.unpack(b"<q", ser_read(f,8))[0] |
| 142 | c.nID = struct.unpack(b"<i", ser_read(f,4))[0] |
| 143 | c.nCancel = struct.unpack(b"<i", ser_read(f,4))[0] |
| 144 | c.setCancel = intVectorSerializer.deserialize(f) |
| 145 | c.nMinVer = struct.unpack(b"<i", ser_read(f,4))[0] |
| 146 | c.nMaxVer = struct.unpack(b"<i", ser_read(f,4))[0] |
| 147 | c.setSubVer = intVectorSerializer.deserialize(f) |
| 148 | c.nPriority = struct.unpack(b"<i", ser_read(f,4))[0] |
| 149 | c.strComment = VarStringSerializer.deserialize(f) |
| 150 | c.strStatusBar = VarStringSerializer.deserialize(f) |
| 151 | c.strReserved = VarStringSerializer.deserialize(f) |
| 152 | return c |
| 153 | |
| 154 | def stream_serialize(self, f): |
| 155 | f.write(struct.pack(b"<i", self.nVersion)) |
| 156 | f.write(struct.pack(b"<q", self.nRelayUntil)) |
| 157 | f.write(struct.pack(b"<q", self.nExpiration)) |
| 158 | f.write(struct.pack(b"<i", self.nID)) |
| 159 | f.write(struct.pack(b"<i", self.nCancel)) |
| 160 | f.write(intVectorSerializer.serialize(self.setCancel)) |
| 161 | f.write(struct.pack(b"<i", self.nMinVer)) |
| 162 | f.write(struct.pack(b"<i", self.nMaxVer)) |
| 163 | f.write(intVectorSerializer.serialize(self.setSubVer)) |
| 164 | f.write(struct.pack(b"<i", self.nPriority)) |
| 165 | f.write(VarStringSerializer.serialize(self.strComment)) |
| 166 | f.write(VarStringSerializer.serialize(self.strStatusBar)) |
| 167 | f.write(VarStringSerializer.serialize(self.strReserved)) |
| 168 | |
| 169 | def __repr__(self): |
| 170 | return "CUnsignedAlert(nVersion %d, nRelayUntil %d, nExpiration %d, nID %d, nCancel %d, nMinVer %d, nMaxVer %d, nPriority %d, strComment %s, strStatusBar %s, strReserved %s)" % (self.nVersion, self.nRelayUntil, self.nExpiration, self.nID, self.nCancel, self.nMinVer, self.nMaxVer, self.nPriority, self.strComment, self.strStatusBar, self.strReserved) |
| 171 | |
| 172 | |
| 173 | class CAlert(Serializable): |
no outgoing calls