Exemplo n.º 1
0
	def __init__(self, sequence, id, modify_time, categories, name, desc, used, owner, components, feedback, properties):
		Processed.__init__(self, sequence)

		# Length is:
		#
		self.length = 4 + 8 + \
				4 + len(categories)*4 + \
				4 + len(name) + \
				4 + len(desc) + \
				4 + 4 + \
				4 + len(components)*8 + \
				4 + len(feedback) + \
				4

		for x, s in properties:
			self.length += 4 + 4 + len(s)

		self.id = id
		self.modify_time = modify_time
		self.categories = categories
		self.name = name
		self.desc = desc
		self.used = used
		self.owner = owner
		self.components = components
		self.feedback = feedback
		self.properties = properties
Exemplo n.º 2
0
	def __init__(self, sequence, key, start, amount):
		Processed.__init__(self, sequence)

		self.length = 4 + 4 + 4
	
		self.key = key
		self.start = start
		self.amount = amount
Exemplo n.º 3
0
	def __init__(self, sequence, key, left, ids):
		Processed.__init__(self, sequence)

		self.length = 4 + 4 + 4 + (4+8) * len(ids)
	
		self.key = key
		self.left = left
		self.ids = ids
	def __init__(self, sequence, time):
		Processed.__init__(self, sequence)

		# Length is:
		#  * 4 bytes UInt32
		#
		self.length = 4
		self.time = time
Exemplo n.º 5
0
	def __init__(self, sequence, ids):
		Processed.__init__(self, sequence)

		# Length is:
		#  * 4 bytes (uint32 - id)
		#
		self.length = 4 + 4 * len(ids)

		self.ids = ids
Exemplo n.º 6
0
	def __init__(self, sequence):
		Processed.__init__(self, sequence)

		# Length is:
		#  * 4 bytes (uint32 - error code
		#  * 4 bytes (uint32 - string length)
		#  * the string
		#  * null terminator
		#
		self.length = 0
Exemplo n.º 7
0
	def __init__(self, sequence, id, slots):
		Processed.__init__(self, sequence)

		# Length is:
		#  * 4 bytes (uint32 - id)
		#
		self.length = 4 + 4 + 4 * len(slots)
	
		self.id = id
		self.slots = slots
Exemplo n.º 8
0
	def __init__(self, sequence, s=""):
		Processed.__init__(self, sequence)

		# Length is:
		#  * 4 bytes (uint32 - string length)
		#  * the string
		#  * null terminator
		#
		self.length = 4 + len(s)
		self.s = s
	def __init__(self, sequence, posx, posy, posz, size):
		if sequence != 0:
			raise ValueError("Object_Get is a normal packet so needs a zero sequence number (%i)" % sequence)
		Processed.__init__(self, sequence)

		# Length is:
		#  * 24 bytes (position)
		#  * 8 bytes (radius)
		self.length = 32

		self.pos = [posx, posy, posz]
		self.size = size
Exemplo n.º 10
0
	def __init__(self, sequence, id, name, race_name):
		Processed.__init__(self, sequence)

		# Length is:
		#
		self.length = 4 + \
			4 + len(name) + \
			4 + len(race_name)
			
		self.id = id
		self.name = name
		self.race_name = race_name
Exemplo n.º 11
0
	def __init__(self, sequence, s=""):
		if 1 > sequence:
			raise ValueError("OK is a reply packet so needs a valid sequence number (%i)" % sequence)
		Processed.__init__(self, sequence)

		# Length is:
		#  * 4 bytes (32 bit integer)
		#  * the string
		#  * null terminator
		#
		self.length = 4 + len(s) 
		self.s = s
Exemplo n.º 12
0
	def __init__(self, sequence, id, modify_time, name, description):
		Processed.__init__(self, sequence)

		# Length is:
		#
		self.length = 4 + 8 + \
				4 + len(name) + \
				4 + len(description)

		self.id = id
		self.modify_time = modify_time
		self.name = name
		self.description = description
Exemplo n.º 13
0
	def __init__(self, sequence, number):
		if 1 > sequence:
			raise ValueError("Sequence is a reply packet so needs a valid sequence number (%i)" % sequence)
		Processed.__init__(self, sequence)

		# Length is:
		#  * 4 bytes (uint32 - error code
		#  * 4 bytes (uint32 - string length)
		#  * the string
		#  * null terminator
		#
		self.length = 4

		self.number = number
Exemplo n.º 14
0
    def __init__(self, sequence, time, reason, turn_num, turn_name):
        Processed.__init__(self, sequence)

        # Length is:
        #  * 4 bytes UInt32
        #  * 4 bytes UInt32
        #  * 4 bytes UInt32
        #  * length of string
        #
        self.length = 4 + 4 + 4 + 4 + len(turn_name)
        self.time = time
        self.reason = reason
        self.turn_num = turn_num
        self.turn_name = turn_name
Exemplo n.º 15
0
	def __init__(self, sequence, name, key, \
			tp, server, sertype, rule, rulever, \
			locations, optional, media):
		Processed.__init__(self, sequence)

		# Length is:
		#
		self.length = \
				4 + len(name) + \
				4 + len(key) + \
				4 + len(server) + \
				4 + len(sertype) + \
				4 + len(rule) + \
				4 + len(rulever) 

		self.length += 4
		for version in tp:
			self.length += 4 + len(version)

		self.length += 4
		for location in locations:
			self.length += \
				4 + len(location[0]) + \
				4 + len(location[1]) + \
				4 + len(location[2]) + \
				4

		self.length += 4
		if isinstance(optional, list):
			for option in optional:
				self.length += 4 + 4 + len(option[1]) + 4
		else:
			for option in optional.values():
				if isinstance(option, (str, unicode)):
					self.length += 4 + 4 + len(option) + 4
				else:
					self.length += 4 + 4 + 0 + 4
		self.length += 4 + len(media)

		self.name    = name
		self.key     = key
		self.tp      = tp
		self.server  = server
		self.sertype = sertype
		self.rule    = rule
		self.rulever = rulever
		self.locations = locations
		self._optional = optional
		self.media   = media
Exemplo n.º 16
0
	def __init__(self, sequence, errno, s=""):
		if errno != 0 and sequence < 1:
			raise ValueError("Fail is a reply packet so needs a valid sequence number (%i)" % sequence)
		Processed.__init__(self, sequence)

		# Length is:
		#  * 4 bytes (uint32 - error code
		#  * 4 bytes (uint32 - string length)
		#  * the string
		#  * null terminator
		#
		self.length = 4 + 4 + len(s)

		self.errno = errno
		self.s = s
Exemplo n.º 17
0
    def __init__(self, sequence, username, password):
        Processed.__init__(self, sequence)

        # Length is:
        #  * 4 bytes (uint32 - string length)
        #  * the string
        #  * null terminator
        #  * 4 bytes (uint32 - string length)
        #  * the string
        #  * null terminator
        #
        self.length = 4 + len(username) + 4 + len(password)

        self.username = username
        self.password = password
Exemplo n.º 18
0
	def __init__(self, sequence, username, password, email, comment):
		Processed.__init__(self, sequence)

		# Length is:
		#  * 4 bytes (uint32 - string length)
		#  * the string
		#
		self.length = \
			 4 + len(username) + \
			 4 + len(password) + \
			 4 + len(email) + \
			 4 + len(comment)
		self.username = username
		self.password = password
		self.email    = email
		self.comment  = comment
Exemplo n.º 19
0
	def __str__(self):
		output = Processed.__str__(self)
		output += pack(self.struct, self.key, self.start, self.amount, self.since)

		assert len(output) == Header.size+self.length, "Output length (%s) did not match out length! (%s)" % (len(output, self.length))

		return output
Exemplo n.º 20
0
	def __str__(self):
		output1 = pack(self.struct, self.id, self.modify_time, self.categories, self.name, self.desc, self.used, self.owner, self.components, self.feedback, self.properties)
		
		self.length = len(output1)
		output2 = Processed.__str__(self)

		return output2+output1
Exemplo n.º 21
0
	def __str__(self):
		output = Processed.__str__(self)
		output += pack(self.struct, 
			self.name, \
			self.key,
			self.tp, \
			self.server, self.sertype, \
			self.rule, self.rulever, \
			self.locations, \
			self._optional)
		return output
Exemplo n.º 22
0
	def __init__(self, sequence, id, modify_time, categories, name, description, requirements, properties):
		Processed.__init__(self, sequence)

		# Length is:
		#
		self.length = 4 + 4 + 8 + \
				4 + len(categories)*4 + \
				4 + len(name) + \
				4 + len(description) + \
				4 + len(requirements) 

		for x, value in properties:
			self.length += 4 + 4 + len(value)

		self.id = id
		self.modify_time = modify_time
		self.categories = categories
		self.name = name
		self.description = description
		self.requirements = requirements
		self.properties = properties
Exemplo n.º 23
0
	def __init__(self, sequence, id, slot, types, subject, body, turn, references):
		Processed.__init__(self, sequence)

		if not isinstance(references, GenericRS.References):
			references = GenericRS.References(references)

		# Length is:
		#
		self.length = 4 + 4 + \
				4 + len(types)*4 + \
				4 + len(subject) + \
				4 + len(body) + \
				4 + \
				4 + len(references)*(4*4)

		self.id = id
		self.slot = slot
		self.types = types
		self.subject = subject
		self.body = body
		self.turn = turn
		self.references = references
Exemplo n.º 24
0
    def __init__(
        self,
        sequence,
        id,
        name_singular,
        name_plural,
        unit_singular,
        unit_plural,
        description,
        weight,
        size,
        modify_time,
    ):
        Processed.__init__(self, sequence)

        # Length is:
        #
        self.length = (
            4
            + 4
            + len(name_singular)
            + 4
            + len(name_plural)
            + 4
            + len(unit_singular)
            + 4
            + len(unit_plural)
            + 4
            + len(description)
            + 4
            + 4
            + 8
        )

        self.id = id
        self.name_singular, self.name_plural = name_singular, name_plural
        self.unit_singular, self.unit_plural = unit_singular, unit_plural
        self.description, self.weight, self.size, self.modify_time = description, weight, size, modify_time
Exemplo n.º 25
0
	def __init__(self, sequence, id, modify_time, categories, rank, name, display_name, description, calculate, requirements):
		Processed.__init__(self, sequence)

		# Length is:
		#
		self.length = 4 + 8 + \
				4 + len(categories)*4 + \
				4 + \
				4 + len(name) + \
				4 + len(display_name) + \
				4 + len(description) + \
				4 + len(calculate) + \
				4 + len(requirements)

		self.id = id
		self.modify_time = modify_time
		self.categories = categories
		self.rank = rank
		self.name = name
		self.display_name = display_name
		self.description = description
		self.calculate = calculate
		self.requirements = requirements
Exemplo n.º 26
0
    def __str__(self):
        output = Processed.__str__(self)
        output += pack(
            self.struct,
            self.id,
            self.name_singular,
            self.name_plural,
            self.unit_singular,
            self.unit_plural,
            self.description,
            self.weight,
            self.size,
            self.modify_time,
        )

        return output
Exemplo n.º 27
0
	def __str__(self):
		output = Processed.__str__(self)
		output += pack(self.struct, self.username, self.password, self.email, self.comment)

		return output
Exemplo n.º 28
0
 def __init__(self, sequence, id):
     Processed.__init__(self, sequence)
     self.id = id
	def __init__(self, sequence):
		Processed.__init__(self, sequence)

		self.length = 0
Exemplo n.º 30
0
	def __str__(self):
		output = Processed.__str__(self)
		output += pack(self.struct, self.s)

		return output