Changeset c269bc7 for server/lib/ippvalue.py
- Timestamp:
- Mar 7, 2011, 7:47:42 PM (14 years ago)
- Branches:
- no-cups
- Children:
- fa0d0ef
- Parents:
- 5cfb358
- git-author:
- Jessica B. Hamrick <jhamrick@…> (03/07/11 19:47:42)
- git-committer:
- Jessica B. Hamrick <jhamrick@…> (03/07/11 19:47:42)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
server/lib/ippvalue.py
r5cfb358 rc269bc7 65 65 self.value_tag = None # one byte, the type of value 66 66 self.value = None # non-binary value of self.value 67 self.value_size = None # size of self.value 67 self.tag_size = 1 # length of the tag in bytes 68 self.value_size = None # size of self.value in bytes 68 69 self.binary_value = None # binary value of self.value 69 70 … … 72 73 self.value_tag = value_tag 73 74 self.binary_value = value 74 self.unpack() 75 self.pack() 75 self.value_size, self.value = self.unpack() 76 76 else: 77 77 self.value_tag = value_tag 78 78 self.value = value 79 self.pack() 80 self.unpack() 79 self.value_size, self.binary_value = self.pack() 80 81 self.verify() 81 82 82 83 def unpack(self): … … 196 197 "unpacked value is not the same as self.value!" 197 198 198 self.value_size = value_size199 self.value = value200 201 199 return value_size, value 202 200 … … 313 311 binary_value = self.value 314 312 315 if self.value_size is not None:316 assert value_size == self.value_size, \317 "packed value size is not the same as " + \318 "self.value_size!"319 if self.binary_value is not None:320 assert binary_value == self.binary_value, \321 "packed binary value is not the same as " + \322 "self.binary_value!"323 324 self.value_size = value_size325 self.binary_value = binary_value326 327 313 return value_size, binary_value 328 314 … … 346 332 "value type is unknown!" 347 333 348 self.pack() 349 self.unpack() 334 value_size1, binary_value = self.pack() 335 value_size2, value = self.unpack() 336 337 assert value_size1 == value_size2, \ 338 "packed value size is not the same as " + \ 339 "unpacked value size!" 340 assert value_size == self.value_size, \ 341 "packed value size is not the same as " + \ 342 "self.value_size!" 343 assert binary_value == self.binary_value, \ 344 "packed binary value is not the same as " + \ 345 "self.binary_value!" 350 346 351 347 def getValue(self): … … 371 367 return self.value_tag 372 368 373 def get Size(self):369 def getValueSize(self): 374 370 """ 375 371 Get the size of the value in bytes. … … 378 374 return self.value_size 379 375 376 def getTagSize(self): 377 """ 378 Get the size of the value tag in bytes. 379 """ 380 381 return self.tag_size 382 380 383 def setValue(self, value): 381 384 """ 382 385 Set the non-binary value. 383 386 """ 384 387 385 388 self.value = value 386 389 … … 389 392 Set the binary value. 390 393 """ 394 391 395 self.binary_value = binary_value 392 396 … … 399 403 self.value_tag = value_tag 400 404 401 def set Size(self, size):405 def setValueSize(self, size): 402 406 """ 403 407 Set the size of the value in bytes. … … 405 409 406 410 self.value_size = size 411 412 def getTotalSize(self): 413 """ 414 Get the total size of the IPP value. 415 """ 416 417 return self.value_size + self.tag_size 407 418 408 419 def __str__(self):
Note: See TracChangeset
for help on using the changeset viewer.