Changeset 5c5fe6d
- Timestamp:
- Dec 17, 2011, 5:52:59 PM (13 years ago)
- Branches:
- no-cups
- Children:
- 287d6ec
- Parents:
- 5d24a81
- git-author:
- Jessica B. Hamrick <jhamrick@…> (12/17/11 17:52:59)
- git-committer:
- Jessica B. Hamrick <jhamrick@…> (12/17/11 17:52:59)
- Location:
- server/lib/gutenbach
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
server/lib/gutenbach/ipp/attribute.py
rdf51061 r5c5fe6d 8 8 9 9 class Attribute(object): 10 """ 11 In addition to what the RFC reports, an attribute has an 12 'attribute tag', which specifies what type of attribute it is. 13 It is 1 bytes long, and comes before the list of values. 10 """In addition to what the RFC reports, an attribute has an 11 'attribute tag', which specifies what type of attribute it is. It 12 is 1 bytes long, and comes before the list of values. 14 13 15 14 From RFC 2565: … … 38 37 | value | w bytes | 39 38 ----------------------------------------------------------- 39 40 40 """ 41 41 42 42 def __init__(self, name=None, values=None): 43 """ 44 Initialize an Attribute. This function can be called in three 45 different ways: 43 """Initialize an Attribute. This function can be called in 44 three different ways: 46 45 47 46 Attribute() -- creates an empty Attribute … … 57 56 58 57 values -- a list of Values. May not be empty. 58 59 59 """ 60 60 … … 73 73 @property 74 74 def packed_value(self): 75 """ 76 Packs the attribute data into binary data.75 """Packs the attribute data into binary data. 76 77 77 """ 78 78 … … 132 132 @property 133 133 def packed_value_size(self): 134 """Gets the total size of the attribute. 135 134 136 """ 135 Gets the total size of the attribute. 136 """ 137 137 138 return len(self.packed_value) 138 139 -
server/lib/gutenbach/ipp/attributegroup.py
rdf51061 r5c5fe6d 8 8 9 9 class AttributeGroup(object): 10 """ 11 An AttributeGroup consists of an attribute-group-tag, followed by 12 a sequence of Attributes. According to RFC 2565, "Within an 10 """An AttributeGroup consists of an attribute-group-tag, followed 11 by a sequence of Attributes. According to RFC 2565, 'Within an 13 12 attribute-sequence, if two attributes have the same name, the 14 first occurrence MUST be ignored. ", so we can effectively treat13 first occurrence MUST be ignored.', so we can effectively treat 15 14 this as an ordered dictionary. 15 16 16 """ 17 17 18 18 def __init__(self, attribute_group_tag=None, attributes=[]): 19 """ 20 Initialize an AttributeGroup. An AttributeGroup can be 19 """Initialize an AttributeGroup. An AttributeGroup can be 21 20 initialized in three ways: 22 21 … … 31 30 32 31 attributes -- a list of attributes 32 33 33 """ 34 34 … … 43 43 44 44 def __getitem__(self, name): 45 """ 46 Returns a list of attributes which have name 'name'.45 """Returns a list of attributes which have name 'name'. 46 47 47 """ 48 48 … … 62 62 63 63 def __setitem__(self, name, attribute): 64 """ 65 Sets an attribute in the attribute group. Note that the key is66 ignored and the attribute is queried for its name.64 """Sets an attribute in the attribute group. Note that the key 65 is ignored and the attribute is queried for its name. 66 67 67 """ 68 68 … … 77 77 78 78 def extend(self, attributes): 79 """ 80 Sets the attributes for the attribute group.79 """Sets the attributes for the attribute group. 80 81 81 """ 82 82 … … 93 93 @property 94 94 def packed_value(self): 95 """ 96 Convert the AttributeGroup to binary.95 """Convert the AttributeGroup to binary. 96 97 97 """ 98 98 -
server/lib/gutenbach/ipp/constants.py
rdf51061 r5c5fe6d 2 2 3 3 class Misc(): 4 """ 5 Miscellaneous config options for the IPP server.4 """Miscellaneous config options for the IPP server. 5 6 6 """ 7 7 … … 12 12 13 13 class JobStates(): 14 """ 15 Job state codes, as defined by RFC 2911, Section 4.3.714 """Job state codes, as defined by RFC 2911, Section 4.3.7 15 16 16 """ 17 17 … … 27 27 28 28 class PrinterStates(): 29 """ 30 Printer state codes, as defined by RFC 2911, Section 4.4.1129 """Printer state codes, as defined by RFC 2911, Section 4.4.11 30 31 31 """ 32 32 … … 38 38 39 39 class Operations(): 40 """ 41 IPP and CUPS IPP Operations, as defined in various RFCs: 40 """IPP and CUPS IPP Operations, as defined in various RFCs: 42 41 43 42 0x0002 - 0x0012 RFC 2911 (Section 4.4.15) … … 46 45 0x0022 - 0x0031 RFC 3998 (Section 14.3) 47 46 0x4000 - 0x4027 CUPS IPP Actions 47 48 48 """ 49 49 … … 120 120 121 121 class SuccessCodes(): 122 """ 123 Success status codes as defined in RFC 2911, Section 13122 """Success status codes as defined in RFC 2911, Section 13 123 124 124 """ 125 125 … … 135 135 136 136 class ClientErrorCodes(): 137 """ 138 Client error codes as defined in RFC 2911, Section 13137 """Client error codes as defined in RFC 2911, Section 13 138 139 139 """ 140 140 … … 167 167 168 168 class ServerErrorCodes(): 169 """ 170 Server error codes as defined in RFC 2911, Section 13169 """Server error codes as defined in RFC 2911, Section 13 170 171 171 """ 172 172 … … 189 189 190 190 class CUPSPrinterType(): 191 """ 192 Printer types as defined by cups_ptype_e in the CUPS API 191 """Printer types as defined by cups_ptype_e in the CUPS API 193 192 specification: 194 193 195 194 http://www.cups.org/documentation.php/doc-1.3/api-cups.html#cups_ptype_e 195 196 196 """ 197 197 … … 232 232 233 233 class AttributeTags(): 234 """ 235 Contains constants for the attribute IPP tags, as defined by RFC236 2565.234 """Contains constants for the attribute IPP tags, as defined by 235 RFC 2565. 236 237 237 """ 238 238 … … 249 249 250 250 class OutOfBandTags(): 251 """ 252 Contains constants for the out-of-band value IPP tags, as defined253 by RFC 2565.251 """Contains constants for the out-of-band value IPP tags, as 252 defined by RFC 2565. 253 254 254 """ 255 255 … … 265 265 266 266 class IntegerTags(): 267 """ 268 Contains constants for the integer value IPP tags, as defined by269 RFC 2565.267 """Contains constants for the integer value IPP tags, as defined 268 by RFC 2565. 269 270 270 """ 271 271 … … 278 278 279 279 class OctetStringTags(): 280 """ 281 Contains constants for the octetString value IPP tags, as defined282 by RFC 2565.280 """Contains constants for the octetString value IPP tags, as 281 defined by RFC 2565. 282 283 283 """ 284 284 … … 295 295 296 296 class CharacterStringTags(): 297 """ 298 Contains constants for the character-string value IPP tags, as 297 """Contains constants for the character-string value IPP tags, as 299 298 defined by RFC 2565. 299 300 300 """ 301 301 -
server/lib/gutenbach/ipp/request.py
rdf51061 r5c5fe6d 11 11 12 12 class Request(): 13 """ 14 From RFC 2565: 13 """From RFC 2565: 15 14 16 15 The encoding for an operation request or response consists of: … … 32 31 | data | q bytes - optional 33 32 ----------------------------------------------- 33 34 34 """ 35 35 … … 39 39 def __init__(self, version=None, operation_id=None, request_id=None, 40 40 attribute_groups=[], data=None, request=None, length=sys.maxint): 41 """ 42 Create a Request. Takes either the segments of the request 41 """Create a Request. Takes either the segments of the request 43 42 separately, or a file handle for the request to parse. If the 44 43 file handle is passed in, all other arguments are ignored. … … 65 64 request -- a file handle that supports the read() 66 65 operation 66 67 67 """ 68 68 … … 198 198 @property 199 199 def packed_value(self): 200 """ 201 Packs the value data into binary data.200 """Packs the value data into binary data. 201 202 202 """ 203 203 -
server/lib/gutenbach/ipp/value.py
rdf51061 r5c5fe6d 7 7 logger = logging.getLogger(__name__) 8 8 9 def setter(prop):10 def f(func):11 return property(prop.fget, func, prop.fdel, prop.__doc__)12 return f13 14 9 class Value(object): 15 """ 16 An IPP value consists of a tag and a value. 10 """An IPP value consists of a tag and a value. 17 11 18 12 From RFC 2565: … … 26 20 | value | v bytes 27 21 ----------------------------------------------- 22 28 23 """ 29 24 30 25 def __init__(self, value_tag=None, value=None): 31 """ 32 Initialize a Value. There are three different ways you can 26 """Initialize a Value. There are three different ways you can 33 27 call this method: 34 28 … … 48 42 value -- variable size, containing the actual value. 49 43 It should be a string or number. 44 50 45 """ 51 46 … … 62 57 @classmethod 63 58 def unpack(cls, value_tag, packed_value): 64 """Unpack a binary IPP value 65 66 Unpacks a binary string into a Value object. 59 """Unpack a binary IPP value into a Value object. 67 60 68 61 """ … … 71 64 @staticmethod 72 65 def _unpack(value_tag, packed_value): 73 """ 74 Given self.value_tag and self.packed_value, unpack the binary 75 value into either a string or number. These values MUST NOT 76 be null. 66 """Given self.value_tag and self.packed_value, unpack the 67 binary value into either a string or number. These values 68 MUST NOT be null. 77 69 78 70 Returns: unpacked value … … 170 162 @property 171 163 def packed_value(self): 172 """ 173 Given self.value_tag and self.value, pack the value into 164 """Given self.value_tag and self.value, pack the value into 174 165 binary form. These values MUST NOT be null. 175 166 … … 270 261 return packed_value 271 262 272 @ setter(packed_value)263 @packed_value.setter 273 264 def packed_value(self, packed_value): 274 265 """Replace a value using a new packed value … … 281 272 @property 282 273 def packed_value_size(self): 283 """ 284 Get the size of the value in bytes.274 """Get the size of the value in bytes. 275 285 276 """ 286 277 … … 289 280 @property 290 281 def total_size(self): 291 """ 292 Get the total size of the IPP value.282 """Get the total size of the IPP value. 283 293 284 """ 294 285 -
server/lib/gutenbach/server/__init__.py
- Property mode changed from 100755 to 100644
Note: See TracChangeset
for help on using the changeset viewer.