Trying to do some more protocol decoding.

This commit is contained in:
Solomon Peachy 2016-01-31 11:53:01 -05:00
parent ccc11bb264
commit 760ae66887
1 changed files with 227 additions and 0 deletions

227
PROTOCOL Normal file
View File

@ -0,0 +1,227 @@
Canon CPNP protocol
-------------------
This is another attempt to formalize the CPNP spec.
Taken from the CP900
All fields are BIG ENDIAN unless otherwise specified.
Packet Header: 16 bytes
43:50:4e:50 'CPNP'
YX:XX Command. Bit 15 is 0 for request, 1 for resp.
00:00:00:00 Msg Sequence Num -- should increment monotically
and responses must have the same seq as request.
00:00:00:00 Options for command, usually null
00:00 Payload length
Identified commands:
* 0x000 NULL ??? No idea what this does
* 0x101 DISCOVER
* 0x130 GET_ID (IEEE1284 Printer ID)
* 0x120 GET_STATUS
* 0x151 FLUSH
* 0x110 START_TCP
* 0x111 END_JOB ?? Sent at end of job
* 0x121 DATA
DISCOVER_REQ (0x0121)
---------------------
43:50:4e:50 CPNP
01:01 DISCOVER
00:00:00:06 SEQUENCE
00:00:00:00 (no args)
00:00 (no payload)
DISCOVER_RESP (0x8121)
----------------------
43:50:4e:50 CPNP
81:01 DISCOVER
00:00:00:06 SEQUENCE
00:00:00:00 (no args)
00:10 16-byte payload
00:01:08:00 (???)
06 MAC ADDR length
04 IP ADDR length
18:0c:ac:a4:b8:17 Printer MAC Address
c0:a8:01:b5 IP address (192.168.1.181)
GET_ID_REQ (0x0130)
-------------------
43 50 4e 50 CPNP
01 30 GET_ID
00 00 00 07 SEQUENCE
00 00 00 00 (no args)
00 04 4-byte payload
00 00 00 00
GET_ID_RESP (0x8130)
--------------------
43 50 4e 50 CPNP
81 30 GET_ID
00 00 00 07 SEQUENCE
00 00 00 00 (no args)
00 47 71-byte payload
00 45 IEEE1284 string length
[rest] IEEE1284 data, semicolon separated tokens
NULL_REQ (0x0000)
-----------------
43 50 4e 50 CPNP
00 00 NULL
00 00 00 08 SEQUENCE
00 00 00 00 (no args)
00 00 (no payload)
NULL_RESP (0x8000)
------------------
43 50 4e 50 CPNP
00 00 NULL
00 00 00 08 SEQUENCE
00 00 00 00 (no args)
00 08 (8-byte payload)
86 09 01 00 (???)
00 00 00 00
GET_STATUS_REQ (0x0120)
-----------------------
43 50 4e 50 CPNP
01 20 GET_STATUS
00 00 00 00 SEQUENCE
00 XX 00 00 status type == Seen 0x00 (via udp) and 0x01/0x02 (via tcp)
00 00 (no payload)
GET_STATUS_RESP (0x8120) (type 0x00)
------------------------------------
43 50 4e 50 CPNP
81 20 GET_STATUS
00 00 00 00 SEQUENCE
00 00 00 00 (type 0x00)
02 00 (512-byte payload)
01 01 YY XX 43 61 6e 6f 6e 20 43 50 39 30 30 00 YY paper, XX ribbon. 01 = missing, 04 = ready
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 01 01 02 01 01 01
00 80 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ff ff ff ff 40 00 40 00 40 1f 40 1f d0 04 10 07
03 00 00 00 01 00 00 00 11 0f 2f 32 00 00 00 00
01 00 00 00 0e 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 07 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
GET_STATUS_RESP (0x8120) (type 0x01 or 0x02)
------------------------------------
43 50 4e 50 CPNP
81 20 GET_STATUS
00 00 00 00 SEQUENCE
00 01 00 00 (type 0x01 -- or 0x02)
00 40 (64-byte payload)
00 00 01 10 04 04 00 00 00 00 00 00 00 00 00 00 (??? variation 1)
00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00
00 90 01 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 01 10 04 04 00 00 00 00 00 00 00 00 00 00 (??? variation 2)
00 00 01 00 01 00 00 00 00 00 00 00 98 8f 01 00
00 90 01 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 40 00 00 00 01 00 00 00 00 00 04 00 (??? variation 3)
00 00 00 02 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 01 10 04 04 00 00 01 ff 00 00 00 00 00 00 (??? variation 4)
00 00 01 00 01 00 00 00 00 00 00 00 98 8f 01 00
00 90 01 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[ data payload starts ]
00 00 01 10 04 04 00 00 05 ff 00 00 00 00 00 00 (??? variation 5)
02 00 02 00 00 00 00 00 00 00 00 00 98 8f 01 00
00 90 01 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 01 10 04 04 00 00 03 ff 00 00 00 00 00 00 (??? variation 6)
02 00 02 00 00 00 00 00 00 00 00 00 98 8f 01 00
00 90 01 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 01 10 04 04 00 00 07 ff 00 00 00 00 00 00 (??? variation 6)
02 00 02 00 00 00 00 00 00 00 00 00 98 8f 01 00
00 90 01 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 01 10 04 04 00 00 09 ff 00 00 00 00 00 00 (??? variation 7)
02 00 02 00 00 00 00 00 00 00 00 00 98 8f 01 00
00 90 01 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 01 10 04 04 00 00 0a ff 00 00 00 00 00 00 (??? variarion 8)
00 00 03 00 00 00 00 00 00 00 00 00 00 00 00 00
00 90 01 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 03 00 40 00 00 00 00 00 00 00 00 00 00 00 (??? variation 9. done?)
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[... printing with exhausted ribbon ...]
00 00 01 10 04 04 00 00 01 ff 00 00 00 00 00 00 (??? variation 5a)
00 00 00 00 00 00 00 00 00 00 00 00 98 8f 01 00
00 90 01 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 01 10 04 04 00 00 00 ff 00 00 01 02 02 00 (??? variation 5b)
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 90 01 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
END_JOB_REQ (0x0111)
--------------------
43 50 4e 50 CPNP
01 11 END_JOB
00 00 00 00 SEQUENCE
00 01 00 00 (args, also seen 0x02)
00 00 (no payload)
END_JOB_RESP (0x8111)
---------------------
43 50 4e 50 CPNP
81 11 END_JOB
00 00 00 00 SEQUENCE
00 01 00 00 (args)
00 00 (no payload)