SlideShare une entreprise Scribd logo
1  sur  74
Télécharger pour lire hors ligne
AirPrintで遊んでみた
                Hiroyuki-Fujikawa. (@cqa02303)




12年5月26日土曜日
おわび




              今日は   レベルの低い 話をします


12年5月26日土曜日
• AirPrintとは?
                 • iPhoneから簡単に印刷できる
                 • メール・Safari・地図・etc...




12年5月26日土曜日
• テスト用プリントアプリ
               • 「Printer Simulator」
                 • Xcode.app/Contents/Developer/
                   Platforms/iPhoneOS.platform/
                   Developer/Applications




12年5月26日土曜日
• AirPrintとは?
                 • Bonjour で プリンタ を特定
                 • プリント内容を転送するプロトコル


12年5月26日土曜日
• iOS SDK の AirPrint 対応

                            (略)

12年5月26日土曜日
BONJOUR?




12年5月26日土曜日
occidentale:MacOS fujikawa$ dns-sd
                                 dns-sd -E           (Enumerate recommended registration domains)
                                 dns-sd -F              (Enumerate recommended browsing domains)
                                 dns-sd -R <Name> <Type> <Domain> <Port> [<TXT>...] (Register a service)
                                 dns-sd -B     <Type> <Domain>        (Browse for services instances)
                                 dns-sd -L <Name> <Type> <Domain>            (Look up a service instance)
                                 dns-sd -P <Name> <Type> <Domain> <Port> <Host> <IP> [<TXT>...] (Proxy)
                                 dns-sd -q <name> <rrtype> <rrclass> (Generic query for any record type)
                                 dns-sd -Z     <Type> <Domain> (Output results in Zone File format)



              • Bonjourの裏側
                                 dns-sd -G v4/v6/v4v6 <name> (Get address information for hostname)
                                 dns-sd -V (Get version of currently running daemon / system service)




               • http://www.apple.com/support/bonjour/
                  • dns-sd (status確認コマンド)


12年5月26日土曜日
occidentale:~ fujikawa$ dns-sd -B _ipp._tcp
                               Browsing for _ipp._tcp
                               DATE: ---Wed 23 May 2012---
                               20:16:26.974 ...STARTING...
                               Timestamp A/R Flags if Domain                  Service Type       Instance Name
                               20:16:26.976 Add 3 1 local.                 _ipp._tcp.        Simulated InkJet @ 腰果
                               20:16:26.976 Add     3 1 local.            _ipp._tcp.         Simulated 2-Sided InkJet @ 腰果
                               20:16:26.976 Add     3 1 local.            _ipp._tcp.         Simulated Laser @ 腰果
                               20:16:26.976 Add     3 1 local.            _ipp._tcp.         Simulated Color Laser @ 腰果
                               20:16:26.976 Add     2 1 local.            _ipp._tcp.         Save Original to Simulator @ 腰果




              •    Bonjourの情報を見る

                  • dns-sd -B _ipp._tcp



12年5月26日土曜日
occidentale:~ fujikawa$ dns-sd -L "Save Original to Simulator @ 腰果" _ipp._tcp
      Lookup Save Original to Simulator @ 腰果._ipp._tcp.local
      DATE: ---Wed 23 May 2012---
      20:18:27.962 ...STARTING...
      20:18:28.153 Save032Original032to032Simulator032@032腰果._ipp._tcp.local. can be reached at occidentale.local.:8632 (interface 1)
      txtvers=1 qtotal=1 rp=printers/save ty=Save Original adminurl=http://%E8%85%B0%E6%9E%9C:8632/ note=腰果 priority=0 product=Save Original
      Transparent=T Binary=T Color=T Duplex=F Staple=F Copies=T Collate=F Punch=F Bind=F Sort=F Scan=F Fax=F pdl=image/jpeg,application/pdf,image/
      png,image/urf URF=W8,SRGB24,ADOBERGB24-48,CP255,IS1-2-3-4-5,OB1-8,FN3-4-5-6-7-8-9-10,PQ3-4-5,RS300-600,V1.2 UUID=f41759d5-
      d406-3efa-70e6-dafd6383af5b




               •         Bonjourの情報を見る

                     • dns-sd -L (プリンタ名) _ipp._tcp



12年5月26日土曜日
occidentale:~ fujikawa$ dns-sd -L "Save Original to Simulator @ 腰果" _ipp._tcp
      Lookup Save Original to Simulator @ 腰果._ipp._tcp.local
      DATE: ---Wed 23 May 2012---
      20:18:27.962 ...STARTING...
      20:18:28.153 Save032Original032to032Simulator032@032腰果._ipp._tcp.local. can be reached at occidentale.local.:8632 (interface 1)
      txtvers=1 qtotal=1 rp=printers/save ty=Save Original adminurl=http://%E8%85%B0%E6%9E%9C:8632/ note=腰果 priority=0 product=Save Original
      Transparent=T Binary=T Color=T Duplex=F Staple=F Copies=T Collate=F Punch=F Bind=F Sort=F Scan=F Fax=F pdl=image/jpeg,application/pdf,image/
      png,image/urf URF=W8,SRGB24,ADOBERGB24-48,CP255,IS1-2-3-4-5,OB1-8,FN3-4-5-6-7-8-9-10,PQ3-4-5,RS300-600,V1.2 UUID=f41759d5-
      d406-3efa-70e6-dafd6383af5b




                     • 情報を整理してみる




12年5月26日土曜日
occidentale:~ fujikawa$ dns-sd -L "Save Original to Simulator @ 腰果" _ipp._tcp
      Lookup Save Original to Simulator @ 腰果._ipp._tcp.local
      DATE: ---Wed 23 May 2012---
      20:18:27.962 ...STARTING...
      20:18:28.153 Save032Original032to032Simulator032@032腰果._ipp._tcp.local. can be reached at occidentale.local.:8632
      (interface 1)
       txtvers=1 qtotal=1 rp=printers/save ty=Save Original adminurl=http://%E8%85%B0%E6%9E%9C:8632/ note=腰果 priority=0 product=Save Original
      Transparent=T Binary=T Color=T Duplex=F Staple=F Copies=T Collate=F Punch=F Bind=F Sort=F Scan=F Fax=F pdl=image/jpeg,application/pdf,image/
      png,image/urf URF=W8,SRGB24,ADOBERGB24-48,CP255,IS1-2-3-4-5,OB1-8,FN3-4-5-6-7-8-9-10,PQ3-4-5,RS300-600,V1.2 UUID=f41759d5-
      d406-3efa-70e6-dafd6383af5b




                     • プリンタ名、アクセス手段




12年5月26日土曜日
occidentale:~ fujikawa$ dns-sd -L "Save Original to Simulator @ 腰果" _ipp._tcp
      Lookup Save Original to Simulator @ 腰果._ipp._tcp.local
      DATE: ---Wed 23 May 2012---
      20:18:27.962 ...STARTING...
      20:18:28.153 Save032Original032to032Simulator032@032腰果._ipp._tcp.local. can be reached at occidentale.local.:8632
      (interface 1)
       txtvers=1 qtotal=1 rp=printers/save ty=Save Original adminurl=http://%E8%85%B0%E6%9E%9C:8632/ note=腰果
      priority=0 product=Save Original Transparent=T Binary=T Color=T Duplex=F Staple=F Copies=T Collate=F Punch=F
      Bind=F Sort=F Scan=F Fax=F pdl=image/jpeg,application/pdf,image/png,image/urf
      URF=W8,SRGB24,ADOBERGB24-48,CP255,IS1-2-3-4-5,OB1-8,FN3-4-5-6-7-8-9-10,PQ3-4-5,RS300-600,V1.2
      UUID=f41759d5-d406-3efa-70e6-dafd6383af5b




                     • サービスインスタンス




12年5月26日土曜日
• txtvers=1
              • qtotal=1
              • rp=printers/save
              • ty=Save Original
              • adminurl=http://
                %E8%85%B0%E6%9E%9C:8632/
              • note=腰果
              • priority=0
              • product=Save Original
12年5月26日土曜日
•   Transparent=T
                  Binary=T Color=T
              • Duplex=F Staple=F
                  Copies=T
              •   Collate=F Punch=F Bind=F
                  Sort=F
              •   Scan=F Fax=F

12年5月26日土曜日
•pdl=
               •image/jpeg,
               •application/pdf,
               •image/png,
               •image/urf

12年5月26日土曜日
•   URF=
                  •W8,
                  •SRGB24,
                  •ADOBERGB24-48,
                  •CP255,
                  •IS1-2-3-4-5,
                  •OB1-8,
                  •FN3-4-5-6-7-8-9-10,
                  •PQ3-4-5,
                  •RS300-600,
                  •V1.2


12年5月26日土曜日
•UUID=
               •f41759d5-
                d406-3efa-70e6-
                dafd6383af5b


12年5月26日土曜日
• だいたいわかりましたね?




12年5月26日土曜日
PRINTERを偽装する




12年5月26日土曜日
• 自作アプリをmDNSに登録する
               • 関連するサンプルコード
                 • BonjourWeb
                 • SimpleNetworkStreams
               • NSNetService Class
                 • -setTXTRecordData:
                 • -publishWithOptions:
12年5月26日土曜日
• _ipp._tcp → Bonjour Printer


              • AirPrint
               • → サブカテゴリ: universalが必要


12年5月26日土曜日
NSNetService Class Reference
         - (id)initWithDomain:(NSString *)domain type:(NSString
         *)type name:(NSString *)name port:(int)port




                  • サブカテゴリ?

         使用例)
         [[NSNetService alloc] initWithDomain:@"local."
         type:@"_http._tcp." name:@"my web server" port:port];




12年5月26日土曜日
• プログラムの文字リソースを推定する
              • 文字リソース @”hogehoge”
               • 実行fileに保存されている可能性大


12年5月26日土曜日
• プログラムの文字リソースを推定する
              • strings (実行ファイル) | grep “hogehoge”



12年5月26日土曜日
• 実行ファイルの場所
              • Printer Simulator.app/Contents/MacOS
                    • Printer Simulator
                    • PrinterSimulatorServer


12年5月26日土曜日
occidentale:MacOS fujikawa$ strings PrinterSimulatorServer | grep _ipp._tcp
         _ipp._tcp,_cups
         _ipp._tcp,_universal
         _ipp._tcp




               • @”_ipp._tcp,_universal” …かな?




12年5月26日土曜日
• 試してみる




12年5月26日土曜日
self.netService = [[NSNetService alloc]
         initWithDomain:@"local." type:@"_ipp._tcp.,_universal"
         name:@"てすとぷりんた" port:port];




              • Bonjourに登録する基本情報




12年5月26日土曜日
NSMutableDictionary *dictionary = [NSMutableDictionary
         dictionaryWithCapacity:10];

         [dictionary setObject:@"printers/save" forKey:@"rp"];
         [dictionary setObject:@"Save Original" forKey:@"ty"];
         [dictionary setObject:@"1" forKey:@"txtvers"];

         ・・・

         [self.netService setTXTRecordData:[NSNetService
         dataFromTXTRecordDictionary:dictionary]];


              • サービスインスタンスを登録する



12年5月26日土曜日
[self.netService
         publishWithOptions:NSNetServiceNoAutoRename];




              • サービスを登録・公開する




12年5月26日土曜日
• 表示された!




12年5月26日土曜日
• まとめ
               • @”_ipp._tcp” → Bonjour Printer
               • @”_ipp._tcp,universal” → AirPrint Printer



12年5月26日土曜日
PRINTER SERVER




12年5月26日土曜日
• 選べない…
              • 何が起きているかダンプで確認



12年5月26日土曜日
• ifconfig -a
               • ネットワークインタフェースを知る
              • tcpdump (ポート番号) -i (インタフェー
                ス) port
                          -x -X -s 20480


               • パケット確認


12年5月26日土曜日
nucifera:~ root# tcpdump -x -X -s 20480 -i en1 port 8632
                      tcpdump: verbose output suppressed, use -v or -vv for full protocol
                      decode
                      listening on en1, link-type EN10MB (Ethernet), capture size 20480
                      bytes
                      11:06:27.025902 IP iphone4s.59584 > nucifera.8632: Flags [S], seq
                      401995709, win 65535, options [mss 1460,nop,wscale 4,nop,nop,TS val



              • 出力例
                      1366143176 ecr 0,sackOK,eol], length 0
                      ! 0x0000: 4500 0040 dc29 4000 4006 8650 c0a8 2bea E..@.)@.@..P..+.
                      ! 0x0010: c0a8 2b03 e8c0 21b8 17f5 f7bd 0000 0000 ..+...!.........
                      ! 0x0020: b002 ffff 425e 0000 0204 05b4 0103 0304 ....B^..........
                      ! 0x0030: 0101 080a 516d b0c8 0000 0000 0402 0000 ....Qm..........
                      11:06:27.026208 IP nucifera.8632 > iphone4s.59584: Flags [S.], seq
                      834319381, ack 401995710, win 65535, options [mss 1460,nop,wscale
                      1,nop,nop,TS val 627011836 ecr 1366143176,sackOK,eol], length 0
                      ! 0x0000: 4500 0040 da70 4000 4006 8809 c0a8 2b03 E..@.p@.@.....+.
                      ! 0x0010: c0a8 2bea 21b8 e8c0 31ba b415 17f5 f7be ..+.!...1.......
                      ! 0x0020: b012 ffff c624 0000 0204 05b4 0103 0301 .....$..........
                      ! 0x0030: 0101 080a 255f 70fc 516d b0c8 0402 0000 ....%_p.Qm......
                      11:06:27.031403 IP iphone4s.59584 > nucifera.8632: Flags [.], ack 1,
                      win 8235, options [nop,nop,TS val 1366143181 ecr 627011836], length 0
                      ! 0x0000: 4500 0034 1e4d 4000 4006 4439 c0a8 2bea E..4.M@.@.D9..+.
                      ! 0x0010: c0a8 2b03 e8c0 21b8 17f5 f7be 31ba b416 ..+...!.....1...
                      ! 0x0020: 8010 202b e5bf 0000 0101 080a 516d b0cd ...+........Qm..
                      ! 0x0030: 255f 70fc                                  %_p.




12年5月26日土曜日
09:11:53.565515 IP6 localhost.52819 > localhost.8632: Flags [P.], seq
1:153, ack 1, win 65535, options [nop,nop,TS val 396944919 ecr
396944919], length 152
!   0x0000: 6000 0000 00b8 0640 0000 0000 0000 0000 `......@........
!   0x0010: 0000 0000 0000 0001 0000 0000 0000 0000 ................
!   0x0020: 0000 0000 0000 0001 ce53 21b8 4e3f 4bbf .........S!.N?K.
!   0x0030: 5660 9cae 8018 ffff 00c0 0000 0101 080a V`..............
!   0x0040: 17a8 e617 17a8 e617 504f 5354 202f 7072 ........POST./pr
!   0x0050: 696e 7465 7273 2f73 6176 6520 4854 5450 inters/save.HTTP
!   0x0060: 2f31 2e31 0d0a 436f 6e74 656e 742d 4c65 /1.1..Content-Le




                                                                        • リクエスト部分
!   0x0070: 6e67 7468 3a20 3435 380d 0a43 6f6e 7465 ngth:.458..Conte
!   0x0080: 6e74 2d54 7970 653a 2061 7070 6c69 6361 nt-Type:.applica
!   0x0090: 7469 6f6e 2f69 7070 0d0a 486f 7374 3a20 tion/ipp..Host:.
!   0x00a0: 6e75 6369 6665 7261 2e6c 6f63 616c 0d0a nucifera.local..
!   0x00b0: 5573 6572 2d41 6765 6e74 3a20 4355 5053 User-Agent:.CUPS
!   0x00c0: 2f31 2e35 2e31 0d0a 4578 7065 6374 3a20 /1.5.1..Expect:.
!   0x00d0: 3130 302d 636f 6e74 696e 7565 0d0a 0d0a 100-continue....
09:11:53.565534 IP6 localhost.52819 > localhost.8632: Flags [P.], seq
153:611, ack 1, win 65535, options [nop,nop,TS val 396944919 ecr




                                                                        • HTTPヘッダ?
396944919], length 458
!   0x0000: 6000 0000 01ea 0640 0000 0000 0000 0000 `......@........
!   0x0010: 0000 0000 0000 0001 0000 0000 0000 0000 ................
!   0x0020: 0000 0000 0000 0001 ce53 21b8 4e3f 4c57 .........S!.N?LW
!   0x0030: 5660 9cae 8018 ffff 01f2 0000 0101 080a V`..............
!   0x0040: 17a8 e617 17a8 e617 0101 000b 0000 0001 ................
!   0x0050: 0147 0012 6174 7472 6962 7574 6573 2d63 .G..attributes-c
!   0x0060: 6861 7273 6574 0005 7574 662d 3848 001b harset..utf-8H..
!   0x0070: 6174 7472 6962 7574 6573 2d6e 6174 7572 attributes-natur




                                                                        • BODYがバイナリ?
!   0x0080: 616c 2d6c 616e 6775 6167 6500 026a 6145 al-language..jaE
!   0x0090: 000b 7072 696e 7465 722d 7572 6900 2869 ..printer-uri.(i
!   0x00a0: 7070 3a2f 2f6e 7563 6966 6572 612e 6c6f pp://nucifera.lo
!   0x00b0: 6361 6c2e 3a38 3633 322f 7072 696e 7465 cal.:8632/printe
!   0x00c0: 7273 2f73 6176 6542 0014 7265 7175 6573 rs/saveB..reques
!   0x00d0: 7469 6e67 2d75 7365 722d 6e61 6d65 0008 ting-user-name..
!   0x00e0: 6675 6a69 6b61 7761 4400 1472 6571 7565 fujikawaD..reque
!   0x00f0: 7374 6564 2d61 7474 7269 6275 7465 7300 sted-attributes.
!   0x0100: 1261 7574 682d 696e 666f 2d72 6571 7569 .auth-info-requi
!   0x0110: 7265 6444 0000 000a 6465 7669 6365 2d75 redD....device-u
!   0x0120: 7269 4400 0000 126d 6172 6b65 722d 6368 riD....marker-ch
!   0x0130: 616e 6765 2d74 696d 6544 0000 000d 6d61 ange-timeD....ma
!   0x0140: 726b 6572 2d63 6f6c 6f72 7344 0000 0012 rker-colorsD....
!   0x0150: 6d61 726b 6572 2d68 6967 682d 6c65 7665 marker-high-leve
!   0x0160: 6c73 4400 0000 0d6d 6172 6b65 722d 6c65 lsD....marker-le




12年5月26日土曜日
• ダンプ結果
               • 一般的な HTTP 通信
                 • Bonjourで指示したBaseURL (adminurl)
                 • /printers/save (rp)
               • HTTP BODY は IPP
                 • IPP = Internet Printing Protocol

12年5月26日土曜日
• IPPのパケット構造




12年5月26日土曜日
• RFC 2910 Internet Printing Protocol/1.1:
                Encoding and Transport

               • http://tools.ietf.org/html/rfc2910
                       HTTP Stream       IPP カプセル
                       HTTP Header         Header
                                          Attributes
                                              …
                        HTTP Body        Attribute End

                                             Data




12年5月26日土曜日
-----------------------------------------------
         |                  version-number             |   2 bytes - required
         -----------------------------------------------
         |               operation-id (request)        |
         |                      or                     |   2 bytes - required
         |               status-code (response)        |
         -----------------------------------------------
         |                   request-id                |   4 bytes - required

         |    • IPPのパケット構造
         -----------------------------------------------------------
                  tag (delimiter-tag or value-tag)     |
         -----------------------------------------------
                                                           1 byte |
                                                                   |-0 or more
         |           empty or rest of attribute        |   x bytes |
         -----------------------------------------------------------
         |              end-of-attributes-tag          |   1 byte    - required
         -----------------------------------------------
         |                     data                    |   y bytes - optional
         -----------------------------------------------




12年5月26日土曜日
09:11:53.565534 IP6 localhost.52819 > localhost.8632: Flags [P.], seq
153:611, ack 1, win 65535, options [nop,nop,TS val 396944919 ecr




                                                                        • IPPを読む
396944919], length 458
!   0x0000: 6000 0000 01ea 0640 0000 0000 0000 0000 `......@........
!   0x0010: 0000 0000 0000 0001 0000 0000 0000 0000 ................
!   0x0020: 0000 0000 0000 0001 ce53 21b8 4e3f 4c57 .........S!.N?LW
!   0x0030: 5660 9cae 8018 ffff 01f2 0000 0101 080a V`..............
!   0x0040: 17a8 e617 17a8 e617 0101 000b 0000 0001 ................
!   0x0050: 0147 0012 6174 7472 6962 7574 6573 2d63 .G..attributes-c
!   0x0060: 6861 7273 6574 0005 7574 662d 3848 001b harset..utf-8H..
!   0x0070: 6174 7472 6962 7574 6573 2d6e 6174 7572 attributes-natur




                                                                         • ver = 1.1
!   0x0080: 616c 2d6c 616e 6775 6167 6500 026a 6145 al-language..jaE
!   0x0090: 000b 7072 696e 7465 722d 7572 6900 2869 ..printer-uri.(i
!   0x00a0: 7070 3a2f 2f6e 7563 6966 6572 612e 6c6f pp://nucifera.lo
!   0x00b0: 6361 6c2e 3a38 3633 322f 7072 696e 7465 cal.:8632/printe
!   0x00c0: 7273 2f73 6176 6542 0014 7265 7175 6573 rs/saveB..reques
!   0x00d0: 7469 6e67 2d75 7365 722d 6e61 6d65 0008 ting-user-name..
!   0x00e0: 6675 6a69 6b61 7761 4400 1472 6571 7565 fujikawaD..reque




                                                                         • コマンド = Get
!   0x00f0: 7374 6564 2d61 7474 7269 6275 7465 7300 sted-attributes.
!   0x0100: 1261 7574 682d 696e 666f 2d72 6571 7569 .auth-info-requi
!   0x0110: 7265 6444 0000 000a 6465 7669 6365 2d75 redD....device-u
!   0x0120: 7269 4400 0000 126d 6172 6b65 722d 6368 riD....marker-ch
!   0x0130: 616e 6765 2d74 696d 6544 0000 000d 6d61 ange-timeD....ma
!   0x0140: 726b 6572 2d63 6f6c 6f72 7344 0000 0012 rker-colorsD....
!   0x0150: 6d61 726b 6572 2d68 6967 682d 6c65 7665 marker-high-leve


                                                                          Printer Attributes
!   0x0160: 6c73 4400 0000 0d6d 6172 6b65 722d 6c65 lsD....marker-le
!   0x0170: 7665 6c73 4400 0000 116d 6172 6b65 722d velsD....marker-
!   0x0180: 6c6f 772d 6c65 7665 6c73 4400 0000 0e6d low-levelsD....m
!   0x0190: 6172 6b65 722d 6d65 7373 6167 6544 0000 arker-messageD..
!   0x01a0: 000c 6d61 726b 6572 2d6e 616d 6573 4400 ..marker-namesD.
!   0x01b0: 0000 0c6d 6172 6b65 722d 7479 7065 7344 ...marker-typesD




                                                                         • シーケンス = 1
!   0x01c0: 0000 0010 7072 696e 7465 722d 636f 6d6d ....printer-comm
!   0x01d0: 616e 6473 4400 0000 1570 7269 6e74 6572 andsD....printer
!   0x01e0: 2d73 7461 7465 2d72 6561 736f 6e73 4400 -state-reasonsD.
!   0x01f0: 0000 0d70 7269 6e74 6572 2d73 7461 7465 ...printer-state
!   0x0200: 4400 0000 0c70 7269 6e74 6572 2d74 7970 D....printer-typ
!   0x0210: 6503                                      e.




12年5月26日土曜日
09:11:53.565534 IP6 localhost.52819 > localhost.8632: Flags [P.], seq
153:611, ack 1, win 65535, options [nop,nop,TS val 396944919 ecr
396944919], length 458
!   0x0000: 6000 0000 01ea 0640 0000 0000 0000 0000 `......@........
!   0x0010: 0000 0000 0000 0001 0000 0000 0000 0000 ................
!   0x0020: 0000 0000 0000 0001 ce53 21b8 4e3f 4c57 .........S!.N?LW
!   0x0030: 5660 9cae 8018 ffff 01f2 0000 0101 080a V`..............
!   0x0040: 17a8 e617 17a8 e617 0101 000b 0000 0001 ................
!   0x0050: 0147 0012 6174 7472 6962 7574 6573 2d63 .G..attributes-c




                                                                        • IPPを読む
!   0x0060: 6861 7273 6574 0005 7574 662d 3848 001b harset..utf-8H..
!   0x0070: 6174 7472 6962 7574 6573 2d6e 6174 7572 attributes-natur
!   0x0080: 616c 2d6c 616e 6775 6167 6500 026a 6145 al-language..jaE
!   0x0090: 000b 7072 696e 7465 722d 7572 6900 2869 ..printer-uri.(i
!   0x00a0: 7070 3a2f 2f6e 7563 6966 6572 612e 6c6f pp://nucifera.lo
!   0x00b0: 6361 6c2e 3a38 3633 322f 7072 696e 7465 cal.:8632/printe
!   0x00c0: 7273 2f73 6176 6542 0014 7265 7175 6573 rs/saveB..reques
!   0x00d0: 7469 6e67 2d75 7365 722d 6e61 6d65 0008 ting-user-name..
!   0x00e0: 6675 6a69 6b61 7761 4400 1472 6571 7565 fujikawaD..reque




                                                                         • 0x01:オペレーショ
!   0x00f0: 7374 6564 2d61 7474 7269 6275 7465 7300 sted-attributes.
!   0x0100: 1261 7574 682d 696e 666f 2d72 6571 7569 .auth-info-requi
!   0x0110: 7265 6444 0000 000a 6465 7669 6365 2d75 redD....device-u
!   0x0120: 7269 4400 0000 126d 6172 6b65 722d 6368 riD....marker-ch
!   0x0130: 616e 6765 2d74 696d 6544 0000 000d 6d61 ange-timeD....ma
!   0x0140: 726b 6572 2d63 6f6c 6f72 7344 0000 0012 rker-colorsD....
!   0x0150: 6d61 726b 6572 2d68 6967 682d 6c65 7665 marker-high-leve


                                                                          ン開始
!   0x0160: 6c73 4400 0000 0d6d 6172 6b65 722d 6c65 lsD....marker-le
!   0x0170: 7665 6c73 4400 0000 116d 6172 6b65 722d velsD....marker-
!   0x0180: 6c6f 772d 6c65 7665 6c73 4400 0000 0e6d low-levelsD....m
!   0x0190: 6172 6b65 722d 6d65 7373 6167 6544 0000 arker-messageD..
!   0x01a0: 000c 6d61 726b 6572 2d6e 616d 6573 4400 ..marker-namesD.
!   0x01b0: 0000 0c6d 6172 6b65 722d 7479 7065 7344 ...marker-typesD
!   0x01c0: 0000 0010 7072 696e 7465 722d 636f 6d6d ....printer-comm
!   0x01d0: 616e 6473 4400 0000 1570 7269 6e74 6572 andsD....printer
!   0x01e0: 2d73 7461 7465 2d72 6561 736f 6e73 4400 -state-reasonsD.
!   0x01f0: 0000 0d70 7269 6e74 6572 2d73 7461 7465 ...printer-state
!   0x0200: 4400 0000 0c70 7269 6e74 6572 2d74 7970 D....printer-typ
!   0x0210: 6503                                      e.




12年5月26日土曜日
09:11:53.565534 IP6 localhost.52819 > localhost.8632: Flags [P.], seq
153:611, ack 1, win 65535, options [nop,nop,TS val 396944919 ecr
396944919], length 458
!   0x0000: 6000 0000 01ea 0640 0000 0000 0000 0000 `......@........
                                                                        • IPPを読む
!   0x0010: 0000 0000 0000 0001 0000 0000 0000 0000 ................
!   0x0020: 0000 0000 0000 0001 ce53 21b8 4e3f 4c57 .........S!.N?LW




                                                                         • 0x47: charset
!   0x0030: 5660 9cae 8018 ffff 01f2 0000 0101 080a V`..............
!   0x0040: 17a8 e617 17a8 e617 0101 000b 0000 0001 ................
!   0x0050: 0147 0012 6174 7472 6962 7574 6573 2d63 .G..attributes-c
!   0x0060: 6861 7273 6574 0005 7574 662d 3848 001b harset..utf-8H..
!   0x0070: 6174 7472 6962 7574 6573 2d6e 6174 7572 attributes-natur
!   0x0080: 616c 2d6c 616e 6775 6167 6500 026a 6145 al-language..jaE
!   0x0090: 000b 7072 696e 7465 722d 7572 6900 2869 ..printer-uri.(i




                                                                         • length =12
!   0x00a0: 7070 3a2f 2f6e 7563 6966 6572 612e 6c6f pp://nucifera.lo
!   0x00b0: 6361 6c2e 3a38 3633 322f 7072 696e 7465 cal.:8632/printe
!   0x00c0: 7273 2f73 6176 6542 0014 7265 7175 6573 rs/saveB..reques
!   0x00d0: 7469 6e67 2d75 7365 722d 6e61 6d65 0008 ting-user-name..
!   0x00e0: 6675 6a69 6b61 7761 4400 1472 6571 7565 fujikawaD..reque
!   0x00f0: 7374 6564 2d61 7474 7269 6275 7465 7300 sted-attributes.
!   0x0100: 1261 7574 682d 696e 666f 2d72 6571 7569 .auth-info-requi
!   0x0110: 7265 6444 0000 000a 6465 7669 6365 2d75 redD....device-u




                                                                          • attributes-charset
!   0x0120: 7269 4400 0000 126d 6172 6b65 722d 6368 riD....marker-ch
!   0x0130: 616e 6765 2d74 696d 6544 0000 000d 6d61 ange-timeD....ma
!   0x0140: 726b 6572 2d63 6f6c 6f72 7344 0000 0012 rker-colorsD....
!   0x0150: 6d61 726b 6572 2d68 6967 682d 6c65 7665 marker-high-leve
!   0x0160: 6c73 4400 0000 0d6d 6172 6b65 722d 6c65 lsD....marker-le
!   0x0170: 7665 6c73 4400 0000 116d 6172 6b65 722d velsD....marker-
!   0x0180: 6c6f 772d 6c65 7665 6c73 4400 0000 0e6d low-levelsD....m




                                                                         • length = 5
!   0x0190: 6172 6b65 722d 6d65 7373 6167 6544 0000 arker-messageD..
!   0x01a0: 000c 6d61 726b 6572 2d6e 616d 6573 4400 ..marker-namesD.
!   0x01b0: 0000 0c6d 6172 6b65 722d 7479 7065 7344 ...marker-typesD
!   0x01c0: 0000 0010 7072 696e 7465 722d 636f 6d6d ....printer-comm
!   0x01d0: 616e 6473 4400 0000 1570 7269 6e74 6572 andsD....printer
!   0x01e0: 2d73 7461 7465 2d72 6561 736f 6e73 4400 -state-reasonsD.
!   0x01f0: 0000 0d70 7269 6e74 6572 2d73 7461 7465 ...printer-state
!   0x0200: 4400 0000 0c70 7269 6e74 6572 2d74 7970 D....printer-typ




                                                                          • utf-8
!   0x0210: 6503                                      e.




12年5月26日土曜日
09:11:53.565534 IP6 localhost.52819 > localhost.8632: Flags [P.], seq
153:611, ack 1, win 65535, options [nop,nop,TS val 396944919 ecr
396944919], length 458
                                                                        •   IPPを読む
!   0x0000: 6000 0000 01ea 0640 0000 0000 0000 0000 `......@........
!   0x0010: 0000 0000 0000 0001 0000 0000 0000 0000 ................




                                                                            •
!   0x0020: 0000 0000 0000 0001 ce53 21b8 4e3f 4c57 .........S!.N?LW
!   0x0030: 5660 9cae 8018 ffff 01f2 0000 0101 080a V`..............
!
!
!
    0x0040: 17a8 e617 17a8 e617 0101 000b 0000 0001 ................
    0x0050: 0147 0012 6174 7472 6962 7574 6573 2d63 .G..attributes-c
    0x0060: 6861 7273 6574 0005 7574 662d 3848 001b harset..utf-8H..
                                                                                0x48: natural-language
!   0x0070: 6174 7472 6962 7574 6573 2d6e 6174 7572 attributes-natur
!   0x0080: 616c 2d6c 616e 6775 6167 6500 026a 6145 al-language..jaE




                                                                            •
!   0x0090: 000b 7072 696e 7465 722d 7572 6900 2869 ..printer-uri.(i


                                                                                length =0x1b(27)
!   0x00a0: 7070 3a2f 2f6e 7563 6966 6572 612e 6c6f pp://nucifera.lo
!   0x00b0: 6361 6c2e 3a38 3633 322f 7072 696e 7465 cal.:8632/printe
!   0x00c0: 7273 2f73 6176 6542 0014 7265 7175 6573 rs/saveB..reques
!   0x00d0: 7469 6e67 2d75 7365 722d 6e61 6d65 0008 ting-user-name..
!   0x00e0: 6675 6a69 6b61 7761 4400 1472 6571 7565 fujikawaD..reque
!   0x00f0: 7374 6564 2d61 7474 7269 6275 7465 7300 sted-attributes.




                                                                                •
!   0x0100: 1261 7574 682d 696e 666f 2d72 6571 7569 .auth-info-requi


                                                                                    attributes-natural-
!   0x0110: 7265 6444 0000 000a 6465 7669 6365 2d75 redD....device-u
!   0x0120: 7269 4400 0000 126d 6172 6b65 722d 6368 riD....marker-ch
!   0x0130: 616e 6765 2d74 696d 6544 0000 000d 6d61 ange-timeD....ma
!   0x0140: 726b 6572 2d63 6f6c 6f72 7344 0000 0012 rker-colorsD....
!
!
!
    0x0150: 6d61 726b 6572 2d68 6967 682d 6c65 7665 marker-high-leve
    0x0160: 6c73 4400 0000 0d6d 6172 6b65 722d 6c65 lsD....marker-le
    0x0170: 7665 6c73 4400 0000 116d 6172 6b65 722d velsD....marker-
                                                                                    language
!   0x0180: 6c6f 772d 6c65 7665 6c73 4400 0000 0e6d low-levelsD....m
!   0x0190: 6172 6b65 722d 6d65 7373 6167 6544 0000 arker-messageD..
!   0x01a0: 000c 6d61 726b 6572 2d6e 616d 6573 4400 ..marker-namesD.



                                                                            •
!   0x01b0: 0000 0c6d 6172 6b65 722d 7479 7065 7344 ...marker-typesD
!
!
!
    0x01c0: 0000 0010 7072 696e 7465 722d 636f 6d6d ....printer-comm
    0x01d0: 616e 6473 4400 0000 1570 7269 6e74 6572 andsD....printer
    0x01e0: 2d73 7461 7465 2d72 6561 736f 6e73 4400 -state-reasonsD.
                                                                                length = 2
!   0x01f0: 0000 0d70 7269 6e74 6572 2d73 7461 7465 ...printer-state
!   0x0200: 4400 0000 0c70 7269 6e74 6572 2d74 7970 D....printer-typ




                                                                                •
!   0x0210: 6503                                      e.


                                                                                    ja


12年5月26日土曜日
…以下(略)




12年5月26日土曜日
09:11:53.565534 IP6 localhost.52819 > localhost.8632: Flags [P.], seq
153:611, ack 1, win 65535, options [nop,nop,TS val 396944919 ecr
396944919], length 458
!   0x0000: 6000 0000 01ea 0640 0000 0000 0000 0000 `......@........
!   0x0010: 0000 0000 0000 0001 0000 0000 0000 0000 ................
!   0x0020: 0000 0000 0000 0001 ce53 21b8 4e3f 4c57 .........S!.N?LW
!   0x0030: 5660 9cae 8018 ffff 01f2 0000 0101 080a V`..............
!   0x0040: 17a8 e617 17a8 e617 0101 000b 0000 0001 ................
!   0x0050: 0147 0012 6174 7472 6962 7574 6573 2d63 .G..attributes-c




                                                                        • IPPを読む
!   0x0060: 6861 7273 6574 0005 7574 662d 3848 001b harset..utf-8H..
!   0x0070: 6174 7472 6962 7574 6573 2d6e 6174 7572 attributes-natur
!   0x0080: 616c 2d6c 616e 6775 6167 6500 026a 6145 al-language..jaE
!   0x0090: 000b 7072 696e 7465 722d 7572 6900 2869 ..printer-uri.(i
!   0x00a0: 7070 3a2f 2f6e 7563 6966 6572 612e 6c6f pp://nucifera.lo
!   0x00b0: 6361 6c2e 3a38 3633 322f 7072 696e 7465 cal.:8632/printe
!   0x00c0: 7273 2f73 6176 6542 0014 7265 7175 6573 rs/saveB..reques
!   0x00d0: 7469 6e67 2d75 7365 722d 6e61 6d65 0008 ting-user-name..
!   0x00e0: 6675 6a69 6b61 7761 4400 1472 6571 7565 fujikawaD..reque




                                                                         • 0x03:オペレーショ
!   0x00f0: 7374 6564 2d61 7474 7269 6275 7465 7300 sted-attributes.
!   0x0100: 1261 7574 682d 696e 666f 2d72 6571 7569 .auth-info-requi
!   0x0110: 7265 6444 0000 000a 6465 7669 6365 2d75 redD....device-u
!   0x0120: 7269 4400 0000 126d 6172 6b65 722d 6368 riD....marker-ch
!   0x0130: 616e 6765 2d74 696d 6544 0000 000d 6d61 ange-timeD....ma
!   0x0140: 726b 6572 2d63 6f6c 6f72 7344 0000 0012 rker-colorsD....
!   0x0150: 6d61 726b 6572 2d68 6967 682d 6c65 7665 marker-high-leve


                                                                          ン終了!
!   0x0160: 6c73 4400 0000 0d6d 6172 6b65 722d 6c65 lsD....marker-le
!   0x0170: 7665 6c73 4400 0000 116d 6172 6b65 722d velsD....marker-
!   0x0180: 6c6f 772d 6c65 7665 6c73 4400 0000 0e6d low-levelsD....m
!   0x0190: 6172 6b65 722d 6d65 7373 6167 6544 0000 arker-messageD..
!   0x01a0: 000c 6d61 726b 6572 2d6e 616d 6573 4400 ..marker-namesD.
!   0x01b0: 0000 0c6d 6172 6b65 722d 7479 7065 7344 ...marker-typesD
!   0x01c0: 0000 0010 7072 696e 7465 722d 636f 6d6d ....printer-comm
!   0x01d0: 616e 6473 4400 0000 1570 7269 6e74 6572 andsD....printer
!   0x01e0: 2d73 7461 7465 2d72 6561 736f 6e73 4400 -state-reasonsD.
!   0x01f0: 0000 0d70 7269 6e74 6572 2d73 7461 7465 ...printer-state
!   0x0200: 4400 0000 0c70 7269 6e74 6572 2d74 7970 D....printer-typ
!   0x0210: 6503                                      e.




12年5月26日土曜日
attributes-charset = utf-8
attributes-natural-language = ja
printer-uri = ipp://nucifera.local.:8632/printers/save
requesting-user-name = fujikawa
requested-attributes = (
   ・auth-info-required
   ・device-uri
   ・marker-change-time
   ・marker-colors
   ・marker-high-levels
   ・marker-levels
   ・marker-low-levels
                                                         • IPPを読めた!
   ・marker-message
   ・marker-names
   ・marker-types
   ・printer-commands
   ・printer-state-reasons
   ・printer-state
   ・printer-type
)




12年5月26日土曜日
つまり、


               • Get Printer Attrコマンドが来ている
               (Printerの機能を確認している)




12年5月26日土曜日
• Get Printer Attrの応答は?
               • rfc嫁!



12年5月26日土曜日
09:11:53.565907 IP6 localhost.8632 > localhost.52819: Flags [P.], seq
26:182, ack 611, win 65535, options [nop,nop,TS val 396944919 ecr
396944919], length 156
!   0x0000: 6001 6097 00bc 0640 0000 0000 0000 0000 `.`....@........
                                                                            IPP Response形式
!   0x0010: 0000 0000 0000 0001 0000 0000 0000 0000 ................
!   0x0020: 0000 0000 0000 0001 21b8 ce53 5660 9cc7 ........!..SV`..
!   0x0030: 4e3f 4e21 8018 ffff 00c4 0000 0101 080a N?N!............




                                                                        •
!   0x0040: 17a8 e617 17a8 e617 4854 5450 2f31 2e31 ........HTTP/1.1
!   0x0050: 2032 3030 204f 4b0d 0a44 6174 653a 2057 .200.OK..Date:.W
!
!
!
    0x0060: 6564 2c20 3034 2041 7072 2032 3031 3220 ed,.04.Apr.2012.
    0x0070: 3030 3a31 313a 3533 2047 4d54 0d0a 436f 00:11:53.GMT..Co
    0x0080: 6e6e 6563 7469 6f6e 3a20 4b65 6570 2d41 nnection:.Keep-A
                                                                            HTTP Response
!   0x0090: 6c69 7665 0d0a 4b65 6570 2d41 6c69 7665 live..Keep-Alive
!   0x00a0: 3a20 7469 6d65 6f75 743d 3130 0d0a 436f :.timeout=10..Co



                                                                            •
!   0x00b0: 6e74 656e 742d 5479 7065 3a20 6170 706c ntent-Type:.appl
!
!
!
    0x00c0: 6963 6174 696f 6e2f 6970 700d 0a43 6f6e ication/ipp..Con
    0x00d0: 7465 6e74 2d4c 656e 6774 683a 2034 3934 tent-Length:.494
    0x00e0: 0d0a 0d0a                                 ....
                                                                                BODY=IPP
09:11:53.565929 IP6 localhost.8632 > localhost.52819: Flags [P.], seq
182:676, ack 611, win 65535, options [nop,nop,TS val 396944919 ecr



                                                                                •
396944919], length 494

                                                                                    ver 1.1
!   0x0000: 6001 6097 020e 0640 0000 0000 0000 0000 `.`....@........
!   0x0010: 0000 0000 0000 0001 0000 0000 0000 0000 ................
!   0x0020: 0000 0000 0000 0001 21b8 ce53 5660 9d63 ........!..SV`.c
!   0x0030: 4e3f 4e21 8018 ffff 0216 0000 0101 080a N?N!............
!   0x0040: 17a8 e617 17a8 e617 0101 0000 0000 0001 ................




                                                                                •
!   0x0050: 0147 0012 6174 7472 6962 7574 6573 2d63 .G..attributes-c
!   0x0060: 6861 7273 6574 0005 7574 662d 3848 001b harset..utf-8H..
!
!
!
    0x0070: 6174 7472 6962 7574 6573 2d6e 6174 7572 attributes-natur
    0x0080: 616c 2d6c 616e 6775 6167 6500 026a 6104 al-language..ja.
    0x0090: 2300 0d70 7269 6e74 6572 2d73 7461 7465 #..printer-state
                                                                                    seq = 1
!   0x00a0: 0004 0000 0003 4400 1570 7269 6e74 6572 ......D..printer
!   0x00b0: 2d73 7461 7465 2d72 6561 736f 6e73 0004 -state-reasons..



                                                                                •
!   0x00c0: 6e6f 6e65 4500 0a64 6576 6963 652d 7572 noneE..device-ur
!
!
!
    0x00d0: 6900 0a6e 756c 6c3a 2f2f 2f32 3042 000d i..null:///20B..
    0x00e0: 6d61 726b 6572 2d63 6f6c 6f72 7300 0723 marker-colors..#
    0x00f0: 3030 3030 3030 4200 0000 0723 3030 4646 000000B....#00FF
                                                                                    Status-OK
!   0x0100: 4646 4200 0000 0723 4646 3030 4646 4200 FFB....#FF00FFB.
!   0x0110: 0000 0723 4646 4646 3030 2100 126d 6172 ...#FFFF00!..mar



                                                                                •
!   0x0120: 6b65 722d 6869 6768 2d6c 6576 656c 7300 ker-high-levels.
!
!
!
    0x0130: 0400 0000 6421 0000 0004 0000 0064 2100 ....d!.......d!.
    0x0140: 0000 0400 0000 6421 0000 0004 0000 0064 ......d!.......d
    0x0150: 2100 0d6d 6172 6b65 722d 6c65 7665 6c73 !..marker-levels
                                                                                    …


12年5月26日土曜日
•   iPhoneが送るパケットを確認


                  •   プリンタ一覧を表示する時


                  •   プリンタを選んだ時


                  •   プリントする時


              •   IPPコマンドを解析


                  •   RFCとにらめっこしよう!


12年5月26日土曜日
• HTTPDとして(HTTP/1.1)
               • KeepAlive
               • Chunk転送
               • HTTP Status 100 Continue

12年5月26日土曜日
CHUNKED?




12年5月26日土曜日
• transfer-encoding: chunked とは?

                  chunk       HTTP Body      IPP カプセル
              size(改行)                           Header
                              Data Block
                                              Attributes
                Data Block
                              Data Block           …

               (改行)              …           Attribute End

                  chunk                           Data
                   …
                 (改行)

12年5月26日土曜日
• 二つのバイトカウンタが必要
              • HTTP 1.1 KeepAlive + chunk転送
              • IPPパケット解析 (不定長)


12年5月26日土曜日
• 二つのバイトカウンタ
              • Bound Pair で解決
               • CFStreamCreateBoundPair()
                          Bound Stream Pair
                           write     read
                          Stream    Stream



12年5月26日土曜日
• transfer-encoding: chunked とは?
                        chunkパーサー               IPPパーサー


                TCP         chunk      Bound    IPP カプセル
               Stream                  Stream
                        size(改行)                  Header
                                         Pair
                                                 Attributes
                          Data Block
                                                     …

                         (改行)                   Attribute End

                            chunk                   Data
                             …
                           (改行)

12年5月26日土曜日
PRINTデーター




12年5月26日土曜日
• 様々な困難を乗り越えて…
                     Print-Job Request

              キタ━━━━━━(゚ ゚)━━━━━━ !!!!!




12年5月26日土曜日
11:06:28.162632 IP iphone4s.59585 > nucifera.8632: Flags [P.], seq
891:1356, ack 568, win 8200, options [nop,nop,TS val 1366144288 ecr
627012944], length 465
!   0x0000: 4500 0205 527d 4000 4006 0e38 c0a8 2bea E...R}@.@..8..+.
!   0x0010: c0a8 2b03 e8c1 21b8 055c cc50 3a20 36f1 ..+...!...P:.6.
!   0x0020: 8018 2008 ad3a 0000 0101 080a 516d b520 .....:......Qm..
!   0x0030: 255f 7550 0101 0002 0000 0001 0147 0012 %_uP.........G..
!   0x0040: 6174 7472 6962 7574 6573 2d63 6861 7273 attributes-chars
!   0x0050: 6574 0005 7574 662d 3848 001b 6174 7472 et..utf-8H..attr
!   0x0060: 6962 7574 6573 2d6e 6174 7572 616c 2d6c ibutes-natural-l
!   0x0070: 616e 6775 6167 6500 026a 6145 000b 7072 anguage..jaE..pr
!   0x0080: 696e 7465 722d 7572 6900 2869 7070 3a2f inter-uri.(ipp:/
!   0x0090: 2f6e 7563 6966 6572 612e 6c6f 6361 6c2e /nucifera.local.
!   0x00a0: 3a38 3633 322f 7072 696e 7465 7273 2f73 :8632/printers/s
!   0x00b0: 6176 6542 0014 7265 7175 6573 7469 6e67 aveB..requesting




                                                                       • Print-Job (0x0002)
!   0x00c0: 2d75 7365 722d 6e61 6d65 0005 6775 6573 -user-name..gues
!   0x00d0: 7449 000f 646f 6375 6d65 6e74 2d66 6f72 tI..document-for
!   0x00e0: 6d61 7400 0a69 6d61 6765 2f6a 7065 6742 mat..image/jpegB
!   0x00f0: 0008 6a6f 622d 6e61 6d65 0006 e586 99e7 ..job-name......
!   0x0100: 9c9f 0221 0006 636f 7069 6573 0004 0000 ...!..copies....
!   0x0110: 0001 3400 096d 6564 6961 2d63 6f6c 0000 ..4..media-col..
!   0x0120: 4a00 0000 0a6d 6564 6961 2d73 697a 6534 J....media-size4
!   0x0130: 0000 0000 4a00 0000 0b78 2d64 696d 656e ....J....x-dimen




                                                                        • IPP Data: 印刷内容
!   0x0140: 7369 6f6e 2100 0000 0400 0022 ba4a 0000 sion!......".J..
!   0x0150: 000b 792d 6469 6d65 6e73 696f 6e21 0000 ..y-dimension!..
!   0x0160: 0004 0000 319c 3700 0000 004a 0000 0013 ....1.7....J....
!   0x0170: 6d65 6469 612d 626f 7474 6f6d 2d6d 6172 media-bottom-mar
!   0x0180: 6769 6e21 0000 0004 0000 0000 4a00 0000 gin!........J...
!   0x0190: 116d 6564 6961 2d6c 6566 742d 6d61 7267 .media-left-marg
!   0x01a0: 696e 2100 0000 0400 0000 004a 0000 0012 in!........J....
!   0x01b0: 6d65 6469 612d 7269 6768 742d 6d61 7267 media-right-marg
!   0x01c0: 696e 2100 0000 0400 0000 004a 0000 0010 in!........J....
!   0x01d0: 6d65 6469 612d 746f 702d 6d61 7267 696e media-top-margin
!   0x01e0: 2100 0000 0400 0000 0037 0000 0000 2300 !........7....#.
!   0x01f0: 0d70 7269 6e74 2d71 7561 6c69 7479 0004 .print-quality..
!   0x0200: 0000 0005 03                              .....
11:06:28.168985 IP iphone4s.59585 > nucifera.8632: Flags [.], seq
1364:2812, ack 593, win 8198, options [nop,nop,TS val 1366144294 ecr
627012950], length 1448
!   0x0000: 4500 05dc 384d 4000 4006 2491 c0a8 2bea E...8M@.@.$...+.
!   0x0010: c0a8 2b03 e8c1 21b8 055c ce29 3a20 370a ..+...!...):.7.
!   0x0020: 8010 2006 7698 0000 0101 080a 516d b526 ....v.......Qm.&
!   0x0030: 255f 7556 ffd8 ffe1 3ffe 4578 6966 0000 %_uV....?.Exif..
!   0x0040: 4d4d 002a 0000 0008 000a 010f 0002 0000 MM.*............
!   0x0050: 0006 0000 0086 0110 0002 0000 000a 0000 ................
!   0x0060: 008c 011a 0005 0000 0001 0000 0096 011b ................
!   0x0070: 0005 0000 0001 0000 009e 0128 0003 0000 ...........(....
!   0x0080: 0001 0002 0000 0131 0002 0000 0004 352e .......1......5.
!   0x0090: 3100 0132 0002 0000 0014 0000 00a6 0213 1..2............
!   0x00a0: 0003 0000 0001 0001 0000 8769 0004 0000 ...........i....
!   0x00b0: 0001 0000 00ba 8825 0004 0000 0001 0000 .......%........
12年5月26日土曜日
11:06:28.162632 IP iphone4s.59585 > nucifera.8632: Flags [P.], seq
891:1356, ack 568, win 8200, options [nop,nop,TS val 1366144288 ecr
627012944], length 465
!   0x0000: 4500 0205 527d 4000 4006 0e38 c0a8 2bea E...R}@.@..8..+.
!   0x0010: c0a8 2b03 e8c1 21b8 055c cc50 3a20 36f1 ..+...!...P:.6.
!   0x0020: 8018 2008 ad3a 0000 0101 080a 516d b520 .....:......Qm..
!   0x0030: 255f 7550 0101 0002 0000 0001 0147 0012 %_uP.........G..
!   0x0040: 6174 7472 6962 7574 6573 2d63 6861 7273 attributes-chars
!   0x0050: 6574 0005 7574 662d 3848 001b 6174 7472 et..utf-8H..attr
!   0x0060: 6962 7574 6573 2d6e 6174 7572 616c 2d6c ibutes-natural-l
!   0x0070: 616e 6775 6167 6500 026a 6145 000b 7072 anguage..jaE..pr
!   0x0080: 696e 7465 722d 7572 6900 2869 7070 3a2f inter-uri.(ipp:/
!   0x0090: 2f6e 7563 6966 6572 612e 6c6f 6361 6c2e /nucifera.local.
!   0x00a0: 3a38 3633 322f 7072 696e 7465 7273 2f73 :8632/printers/s
!   0x00b0: 6176 6542 0014 7265 7175 6573 7469 6e67 aveB..requesting
!   0x00c0: 2d75 7365 722d 6e61 6d65 0005 6775 6573 -user-name..gues
!   0x00d0: 7449 000f 646f 6375 6d65 6e74 2d66 6f72 tI..document-for
!   0x00e0: 6d61 7400 0a69 6d61 6765 2f6a 7065 6742 mat..image/jpegB
!   0x00f0: 0008 6a6f 622d 6e61 6d65 0006 e586 99e7 ..job-name......




                                                                       • Exif !?
!   0x0100: 9c9f 0221 0006 636f 7069 6573 0004 0000 ...!..copies....
!   0x0110: 0001 3400 096d 6564 6961 2d63 6f6c 0000 ..4..media-col..
!   0x0120: 4a00 0000 0a6d 6564 6961 2d73 697a 6534 J....media-size4
!   0x0130: 0000 0000 4a00 0000 0b78 2d64 696d 656e ....J....x-dimen
!   0x0140: 7369 6f6e 2100 0000 0400 0022 ba4a 0000 sion!......".J..
!   0x0150: 000b 792d 6469 6d65 6e73 696f 6e21 0000 ..y-dimension!..
!   0x0160: 0004 0000 319c 3700 0000 004a 0000 0013 ....1.7....J....
!   0x0170: 6d65 6469 612d 626f 7474 6f6d 2d6d 6172 media-bottom-mar
!   0x0180: 6769 6e21 0000 0004 0000 0000 4a00 0000 gin!........J...
!   0x0190: 116d 6564 6961 2d6c 6566 742d 6d61 7267 .media-left-marg
!   0x01a0: 696e 2100 0000 0400 0000 004a 0000 0012 in!........J....
!   0x01b0: 6d65 6469 612d 7269 6768 742d 6d61 7267 media-right-marg
!   0x01c0: 696e 2100 0000 0400 0000 004a 0000 0010 in!........J....
!   0x01d0: 6d65 6469 612d 746f 702d 6d61 7267 696e media-top-margin
!   0x01e0: 2100 0000 0400 0000 0037 0000 0000 2300 !........7....#.
!   0x01f0: 0d70 7269 6e74 2d71 7561 6c69 7479 0004 .print-quality..
!   0x0200: 0000 0005 03                              .....
11:06:28.168985 IP iphone4s.59585 > nucifera.8632: Flags [.], seq
1364:2812, ack 593, win 8198, options [nop,nop,TS val 1366144294 ecr
627012950], length 1448
!   0x0000: 4500 05dc 384d 4000 4006 2491 c0a8 2bea E...8M@.@.$...+.
!   0x0010: c0a8 2b03 e8c1 21b8 055c ce29 3a20 370a ..+...!...):.7.
!   0x0020: 8010 2006 7698 0000 0101 080a 516d b526 ....v.......Qm.&
!   0x0030: 255f 7556 ffd8 ffe1 3ffe 4578 6966 0000 %_uV....?.Exif..
!   0x0040: 4d4d 002a 0000 0008 000a 010f 0002 0000 MM.*............
!   0x0050: 0006 0000 0086 0110 0002 0000 000a 0000 ................
!   0x0060: 008c 011a 0005 0000 0001 0000 0096 011b ................
!   0x0070: 0005 0000 0001 0000 009e 0128 0003 0000 ...........(....
!   0x0080: 0001 0002 0000 0131 0002 0000 0004 352e .......1......5.
!   0x0090: 3100 0132 0002 0000 0014 0000 00a6 0213 1..2............
!   0x00a0: 0003 0000 0001 0001 0000 8769 0004 0000 ...........i....
!   0x00b0: 0001 0000 00ba 8825 0004 0000 0001 0000 .......%........
12年5月26日土曜日
パケットダンプ
11:06:28.168985 IP iphone4s.59585 > nucifera.8632: Flags [.], seq
1364:2812, ack 593, win 8198, options [nop,nop,TS val 1366144294 ecr
627012950], length 1448
!   0x0000: 4500 05dc 384d 4000 4006 2491 c0a8 2bea E...8M@.@.$...+.
!   0x0010: c0a8 2b03 e8c1 21b8 055c ce29 3a20 370a ..+...!...):.7.




                                                                                • 元ファイルと比較
!   0x0020: 8010 2006 7698 0000 0101 080a 516d b526 ....v.......Qm.&
!   0x0030: 255f 7556 ffd8 ffe1 3ffe 4578 6966 0000 %_uV....?.Exif..
!   0x0040: 4d4d 002a 0000 0008 000a 010f 0002 0000 MM.*............
!   0x0050: 0006 0000 0086 0110 0002 0000 000a 0000 ................
!   0x0060: 008c 011a 0005 0000 0001 0000 0096 011b ................
!   0x0070: 0005 0000 0001 0000 009e 0128 0003 0000 ...........(....
!   0x0080: 0001 0002 0000 0131 0002 0000 0004 352e .......1......5.
!   0x0090: 3100 0132 0002 0000 0014 0000 00a6 0213 1..2............
!   0x00a0: 0003 0000 0001 0001 0000 8769 0004 0000 ...........i....




                                                                                • 長さ
!   0x00b0: 0001 0000 00ba 8825 0004 0000 0001 0000 .......%........
!   0x00c0: 024c 0000 0316 4170 706c 6500 6950 686f .L....Apple.iPho
!   0x00d0: 6e65 2034 5300 0000 0048 0000 0001 0000 ne.4S....H......
!   0x00e0: 0048 0000 0001 3230 3132 3a30 343a 3032 .H....2012:04:02
!   0x00f0: 2031 353a 3439 3a31 3000 0019 829a 0005 .15:49:10.......
!   0x0100: 0000 0001 0000 01ec 829d 0005 0000 0001 ................
!   0x0110: 0000 01f4 8822 0003 0000 0001 0002 0000 ....."..........
!   0x0120: 8827 0003 0000 0001 0040 0000 9000 0007 .'.......@......




0000000
               ファイルダンプ
occidentale:Desktop fujikawa$ od -x -a 169654957.jpg
             d8ff    e1ff    fe3f    7845    6669
                                                       | head -200
                                                       0000    4d4d      2a00
                                                                                • 先頭
           ?   ?   ?   ?   ?   ?   E   x   i   f nul   nul   M   M nul     *
0000020      0000    0800    0a00    0f01    0200      0000    0600      0000




                                                                                • 末尾
         nul nul nul bs nul nl soh si nul stx nul      nul nul ack nul   nul
0000040      8600    1001    0200    0000    0a00      0000    8c00      1a01
         nul 86 soh dle nul stx nul nul nul nl nul     nul nul 8c soh    sub
0000060      0500    0000    0100    0000    9600      1b01    0500      0000
         nul enq nul nul nul soh nul nul nul 96 soh    esc nul enq nul   nul
0000100      0100    0000    9e00    2801    0300      0000    0100      0200
         nul soh nul nul nul 9e soh    ( nul etx nul   nul nul soh nul   stx
0000120      0000    3101    0200    0000    0400      2e35    0031      3201
         nul nul soh   1 nul stx nul nul nul eot   5     .   1 nul soh     2
0000140      0200    0000    1400    0000    a600      1302    0300      0000
         nul stx nul nul nul dc4 nul nul nul   ? stx   dc3 nul etx nul   nul
0000160      0100    0100    0000    6987    0400      0000    0100      0000
         nul soh nul soh nul nul 87    i nul eot nul   nul nul soh nul   nul
0000200      ba00    2588    0400    0000    0100      0000    4c02      0000
         nul   ? 88    % nul eot nul nul nul soh nul   nul stx   L nul   nul
0000220      1603    7041    6c70    0065    5069      6f68    656e      3420
         etx syn   A   p   p   l   e nul   i   P   h     o   n   e sp      4
0000240      0053    0000    4800    0000    0100      0000    4800      0000

12年5月26日土曜日
• Print-Job Request
               • IPP Data
                 • 中身は印刷対象ファイルそのもの
               • pdf, jpeg, pngで確認


12年5月26日土曜日
• プリントデーターを表示する
              • UIWebViewController ←万能!凄い!
               •   - (void)loadData:(NSData *)data MIMEType:
                   (NSString *)MIMEType textEncodingName:
                   (NSString *)encodingName baseURL:(NSURL
                   *)baseURL




12年5月26日土曜日
結果




12年5月26日土曜日
プログラム構造


              •   Application Main

                  •   ViewController

                      •   Print データー表示


                  •   Server Control

                      •   Bonjour登録


                      •   HTTP Server

                          •       HTTP/1.1 Chunked Stream Control

                              •       IPP Command Control

                                  •     Ipp Capsule Parser / Selealizer

                      •   Printer Status Model

12年5月26日土曜日
demo


              •http://www.youtube.com/watch?
               v=GgJ3DiYereA




12年5月26日土曜日
さいごに




12年5月26日土曜日
本を書いたよ

              • インプレスジャパン
              • 6/8発売 3,360円
               • 第二章 Storyboards
                     担当しました



12年5月26日土曜日
本を書いたよ

              第二章 Storyboards

              • プログラマ向け
                   &

              • 非プログラマ向け

12年5月26日土曜日
本を書いたよ
              デザインが得意な同僚




              …そんな彼の為に

                    買うべし!


12年5月26日土曜日
おわり




12年5月26日土曜日

Contenu connexe

En vedette

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by HubspotMarius Sescu
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTExpeed Software
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsPixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 

En vedette (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

Air printで遊んでみた

  • 1. AirPrintで遊んでみた Hiroyuki-Fujikawa. (@cqa02303) 12年5月26日土曜日
  • 2. おわび 今日は レベルの低い 話をします 12年5月26日土曜日
  • 3. • AirPrintとは? • iPhoneから簡単に印刷できる • メール・Safari・地図・etc... 12年5月26日土曜日
  • 4. • テスト用プリントアプリ • 「Printer Simulator」 • Xcode.app/Contents/Developer/ Platforms/iPhoneOS.platform/ Developer/Applications 12年5月26日土曜日
  • 5. • AirPrintとは? • Bonjour で プリンタ を特定 • プリント内容を転送するプロトコル 12年5月26日土曜日
  • 6. • iOS SDK の AirPrint 対応 (略) 12年5月26日土曜日
  • 8. occidentale:MacOS fujikawa$ dns-sd dns-sd -E (Enumerate recommended registration domains) dns-sd -F (Enumerate recommended browsing domains) dns-sd -R <Name> <Type> <Domain> <Port> [<TXT>...] (Register a service) dns-sd -B <Type> <Domain> (Browse for services instances) dns-sd -L <Name> <Type> <Domain> (Look up a service instance) dns-sd -P <Name> <Type> <Domain> <Port> <Host> <IP> [<TXT>...] (Proxy) dns-sd -q <name> <rrtype> <rrclass> (Generic query for any record type) dns-sd -Z <Type> <Domain> (Output results in Zone File format) • Bonjourの裏側 dns-sd -G v4/v6/v4v6 <name> (Get address information for hostname) dns-sd -V (Get version of currently running daemon / system service) • http://www.apple.com/support/bonjour/ • dns-sd (status確認コマンド) 12年5月26日土曜日
  • 9. occidentale:~ fujikawa$ dns-sd -B _ipp._tcp Browsing for _ipp._tcp DATE: ---Wed 23 May 2012--- 20:16:26.974 ...STARTING... Timestamp A/R Flags if Domain Service Type Instance Name 20:16:26.976 Add 3 1 local. _ipp._tcp. Simulated InkJet @ 腰果 20:16:26.976 Add 3 1 local. _ipp._tcp. Simulated 2-Sided InkJet @ 腰果 20:16:26.976 Add 3 1 local. _ipp._tcp. Simulated Laser @ 腰果 20:16:26.976 Add 3 1 local. _ipp._tcp. Simulated Color Laser @ 腰果 20:16:26.976 Add 2 1 local. _ipp._tcp. Save Original to Simulator @ 腰果 • Bonjourの情報を見る • dns-sd -B _ipp._tcp 12年5月26日土曜日
  • 10. occidentale:~ fujikawa$ dns-sd -L "Save Original to Simulator @ 腰果" _ipp._tcp Lookup Save Original to Simulator @ 腰果._ipp._tcp.local DATE: ---Wed 23 May 2012--- 20:18:27.962 ...STARTING... 20:18:28.153 Save032Original032to032Simulator032@032腰果._ipp._tcp.local. can be reached at occidentale.local.:8632 (interface 1) txtvers=1 qtotal=1 rp=printers/save ty=Save Original adminurl=http://%E8%85%B0%E6%9E%9C:8632/ note=腰果 priority=0 product=Save Original Transparent=T Binary=T Color=T Duplex=F Staple=F Copies=T Collate=F Punch=F Bind=F Sort=F Scan=F Fax=F pdl=image/jpeg,application/pdf,image/ png,image/urf URF=W8,SRGB24,ADOBERGB24-48,CP255,IS1-2-3-4-5,OB1-8,FN3-4-5-6-7-8-9-10,PQ3-4-5,RS300-600,V1.2 UUID=f41759d5- d406-3efa-70e6-dafd6383af5b • Bonjourの情報を見る • dns-sd -L (プリンタ名) _ipp._tcp 12年5月26日土曜日
  • 11. occidentale:~ fujikawa$ dns-sd -L "Save Original to Simulator @ 腰果" _ipp._tcp Lookup Save Original to Simulator @ 腰果._ipp._tcp.local DATE: ---Wed 23 May 2012--- 20:18:27.962 ...STARTING... 20:18:28.153 Save032Original032to032Simulator032@032腰果._ipp._tcp.local. can be reached at occidentale.local.:8632 (interface 1) txtvers=1 qtotal=1 rp=printers/save ty=Save Original adminurl=http://%E8%85%B0%E6%9E%9C:8632/ note=腰果 priority=0 product=Save Original Transparent=T Binary=T Color=T Duplex=F Staple=F Copies=T Collate=F Punch=F Bind=F Sort=F Scan=F Fax=F pdl=image/jpeg,application/pdf,image/ png,image/urf URF=W8,SRGB24,ADOBERGB24-48,CP255,IS1-2-3-4-5,OB1-8,FN3-4-5-6-7-8-9-10,PQ3-4-5,RS300-600,V1.2 UUID=f41759d5- d406-3efa-70e6-dafd6383af5b • 情報を整理してみる 12年5月26日土曜日
  • 12. occidentale:~ fujikawa$ dns-sd -L "Save Original to Simulator @ 腰果" _ipp._tcp Lookup Save Original to Simulator @ 腰果._ipp._tcp.local DATE: ---Wed 23 May 2012--- 20:18:27.962 ...STARTING... 20:18:28.153 Save032Original032to032Simulator032@032腰果._ipp._tcp.local. can be reached at occidentale.local.:8632 (interface 1) txtvers=1 qtotal=1 rp=printers/save ty=Save Original adminurl=http://%E8%85%B0%E6%9E%9C:8632/ note=腰果 priority=0 product=Save Original Transparent=T Binary=T Color=T Duplex=F Staple=F Copies=T Collate=F Punch=F Bind=F Sort=F Scan=F Fax=F pdl=image/jpeg,application/pdf,image/ png,image/urf URF=W8,SRGB24,ADOBERGB24-48,CP255,IS1-2-3-4-5,OB1-8,FN3-4-5-6-7-8-9-10,PQ3-4-5,RS300-600,V1.2 UUID=f41759d5- d406-3efa-70e6-dafd6383af5b • プリンタ名、アクセス手段 12年5月26日土曜日
  • 13. occidentale:~ fujikawa$ dns-sd -L "Save Original to Simulator @ 腰果" _ipp._tcp Lookup Save Original to Simulator @ 腰果._ipp._tcp.local DATE: ---Wed 23 May 2012--- 20:18:27.962 ...STARTING... 20:18:28.153 Save032Original032to032Simulator032@032腰果._ipp._tcp.local. can be reached at occidentale.local.:8632 (interface 1) txtvers=1 qtotal=1 rp=printers/save ty=Save Original adminurl=http://%E8%85%B0%E6%9E%9C:8632/ note=腰果 priority=0 product=Save Original Transparent=T Binary=T Color=T Duplex=F Staple=F Copies=T Collate=F Punch=F Bind=F Sort=F Scan=F Fax=F pdl=image/jpeg,application/pdf,image/png,image/urf URF=W8,SRGB24,ADOBERGB24-48,CP255,IS1-2-3-4-5,OB1-8,FN3-4-5-6-7-8-9-10,PQ3-4-5,RS300-600,V1.2 UUID=f41759d5-d406-3efa-70e6-dafd6383af5b • サービスインスタンス 12年5月26日土曜日
  • 14. • txtvers=1 • qtotal=1 • rp=printers/save • ty=Save Original • adminurl=http:// %E8%85%B0%E6%9E%9C:8632/ • note=腰果 • priority=0 • product=Save Original 12年5月26日土曜日
  • 15. Transparent=T Binary=T Color=T • Duplex=F Staple=F Copies=T • Collate=F Punch=F Bind=F Sort=F • Scan=F Fax=F 12年5月26日土曜日
  • 16. •pdl= •image/jpeg, •application/pdf, •image/png, •image/urf 12年5月26日土曜日
  • 17. URF= •W8, •SRGB24, •ADOBERGB24-48, •CP255, •IS1-2-3-4-5, •OB1-8, •FN3-4-5-6-7-8-9-10, •PQ3-4-5, •RS300-600, •V1.2 12年5月26日土曜日
  • 18. •UUID= •f41759d5- d406-3efa-70e6- dafd6383af5b 12年5月26日土曜日
  • 21. • 自作アプリをmDNSに登録する • 関連するサンプルコード • BonjourWeb • SimpleNetworkStreams • NSNetService Class • -setTXTRecordData: • -publishWithOptions: 12年5月26日土曜日
  • 22. • _ipp._tcp → Bonjour Printer • AirPrint • → サブカテゴリ: universalが必要 12年5月26日土曜日
  • 23. NSNetService Class Reference - (id)initWithDomain:(NSString *)domain type:(NSString *)type name:(NSString *)name port:(int)port • サブカテゴリ? 使用例) [[NSNetService alloc] initWithDomain:@"local." type:@"_http._tcp." name:@"my web server" port:port]; 12年5月26日土曜日
  • 24. • プログラムの文字リソースを推定する • 文字リソース @”hogehoge” • 実行fileに保存されている可能性大 12年5月26日土曜日
  • 25. • プログラムの文字リソースを推定する • strings (実行ファイル) | grep “hogehoge” 12年5月26日土曜日
  • 26. • 実行ファイルの場所 • Printer Simulator.app/Contents/MacOS • Printer Simulator • PrinterSimulatorServer 12年5月26日土曜日
  • 27. occidentale:MacOS fujikawa$ strings PrinterSimulatorServer | grep _ipp._tcp _ipp._tcp,_cups _ipp._tcp,_universal _ipp._tcp • @”_ipp._tcp,_universal” …かな? 12年5月26日土曜日
  • 29. self.netService = [[NSNetService alloc] initWithDomain:@"local." type:@"_ipp._tcp.,_universal" name:@"てすとぷりんた" port:port]; • Bonjourに登録する基本情報 12年5月26日土曜日
  • 30. NSMutableDictionary *dictionary = [NSMutableDictionary dictionaryWithCapacity:10]; [dictionary setObject:@"printers/save" forKey:@"rp"]; [dictionary setObject:@"Save Original" forKey:@"ty"]; [dictionary setObject:@"1" forKey:@"txtvers"]; ・・・ [self.netService setTXTRecordData:[NSNetService dataFromTXTRecordDictionary:dictionary]]; • サービスインスタンスを登録する 12年5月26日土曜日
  • 31. [self.netService publishWithOptions:NSNetServiceNoAutoRename]; • サービスを登録・公開する 12年5月26日土曜日
  • 33. • まとめ • @”_ipp._tcp” → Bonjour Printer • @”_ipp._tcp,universal” → AirPrint Printer 12年5月26日土曜日
  • 35. • 選べない… • 何が起きているかダンプで確認 12年5月26日土曜日
  • 36. • ifconfig -a • ネットワークインタフェースを知る • tcpdump (ポート番号) -i (インタフェー ス) port -x -X -s 20480 • パケット確認 12年5月26日土曜日
  • 37. nucifera:~ root# tcpdump -x -X -s 20480 -i en1 port 8632 tcpdump: verbose output suppressed, use -v or -vv for full protocol decode listening on en1, link-type EN10MB (Ethernet), capture size 20480 bytes 11:06:27.025902 IP iphone4s.59584 > nucifera.8632: Flags [S], seq 401995709, win 65535, options [mss 1460,nop,wscale 4,nop,nop,TS val • 出力例 1366143176 ecr 0,sackOK,eol], length 0 ! 0x0000: 4500 0040 dc29 4000 4006 8650 c0a8 2bea E..@.)@.@..P..+. ! 0x0010: c0a8 2b03 e8c0 21b8 17f5 f7bd 0000 0000 ..+...!......... ! 0x0020: b002 ffff 425e 0000 0204 05b4 0103 0304 ....B^.......... ! 0x0030: 0101 080a 516d b0c8 0000 0000 0402 0000 ....Qm.......... 11:06:27.026208 IP nucifera.8632 > iphone4s.59584: Flags [S.], seq 834319381, ack 401995710, win 65535, options [mss 1460,nop,wscale 1,nop,nop,TS val 627011836 ecr 1366143176,sackOK,eol], length 0 ! 0x0000: 4500 0040 da70 4000 4006 8809 c0a8 2b03 E..@.p@.@.....+. ! 0x0010: c0a8 2bea 21b8 e8c0 31ba b415 17f5 f7be ..+.!...1....... ! 0x0020: b012 ffff c624 0000 0204 05b4 0103 0301 .....$.......... ! 0x0030: 0101 080a 255f 70fc 516d b0c8 0402 0000 ....%_p.Qm...... 11:06:27.031403 IP iphone4s.59584 > nucifera.8632: Flags [.], ack 1, win 8235, options [nop,nop,TS val 1366143181 ecr 627011836], length 0 ! 0x0000: 4500 0034 1e4d 4000 4006 4439 c0a8 2bea E..4.M@.@.D9..+. ! 0x0010: c0a8 2b03 e8c0 21b8 17f5 f7be 31ba b416 ..+...!.....1... ! 0x0020: 8010 202b e5bf 0000 0101 080a 516d b0cd ...+........Qm.. ! 0x0030: 255f 70fc %_p. 12年5月26日土曜日
  • 38. 09:11:53.565515 IP6 localhost.52819 > localhost.8632: Flags [P.], seq 1:153, ack 1, win 65535, options [nop,nop,TS val 396944919 ecr 396944919], length 152 ! 0x0000: 6000 0000 00b8 0640 0000 0000 0000 0000 `......@........ ! 0x0010: 0000 0000 0000 0001 0000 0000 0000 0000 ................ ! 0x0020: 0000 0000 0000 0001 ce53 21b8 4e3f 4bbf .........S!.N?K. ! 0x0030: 5660 9cae 8018 ffff 00c0 0000 0101 080a V`.............. ! 0x0040: 17a8 e617 17a8 e617 504f 5354 202f 7072 ........POST./pr ! 0x0050: 696e 7465 7273 2f73 6176 6520 4854 5450 inters/save.HTTP ! 0x0060: 2f31 2e31 0d0a 436f 6e74 656e 742d 4c65 /1.1..Content-Le • リクエスト部分 ! 0x0070: 6e67 7468 3a20 3435 380d 0a43 6f6e 7465 ngth:.458..Conte ! 0x0080: 6e74 2d54 7970 653a 2061 7070 6c69 6361 nt-Type:.applica ! 0x0090: 7469 6f6e 2f69 7070 0d0a 486f 7374 3a20 tion/ipp..Host:. ! 0x00a0: 6e75 6369 6665 7261 2e6c 6f63 616c 0d0a nucifera.local.. ! 0x00b0: 5573 6572 2d41 6765 6e74 3a20 4355 5053 User-Agent:.CUPS ! 0x00c0: 2f31 2e35 2e31 0d0a 4578 7065 6374 3a20 /1.5.1..Expect:. ! 0x00d0: 3130 302d 636f 6e74 696e 7565 0d0a 0d0a 100-continue.... 09:11:53.565534 IP6 localhost.52819 > localhost.8632: Flags [P.], seq 153:611, ack 1, win 65535, options [nop,nop,TS val 396944919 ecr • HTTPヘッダ? 396944919], length 458 ! 0x0000: 6000 0000 01ea 0640 0000 0000 0000 0000 `......@........ ! 0x0010: 0000 0000 0000 0001 0000 0000 0000 0000 ................ ! 0x0020: 0000 0000 0000 0001 ce53 21b8 4e3f 4c57 .........S!.N?LW ! 0x0030: 5660 9cae 8018 ffff 01f2 0000 0101 080a V`.............. ! 0x0040: 17a8 e617 17a8 e617 0101 000b 0000 0001 ................ ! 0x0050: 0147 0012 6174 7472 6962 7574 6573 2d63 .G..attributes-c ! 0x0060: 6861 7273 6574 0005 7574 662d 3848 001b harset..utf-8H.. ! 0x0070: 6174 7472 6962 7574 6573 2d6e 6174 7572 attributes-natur • BODYがバイナリ? ! 0x0080: 616c 2d6c 616e 6775 6167 6500 026a 6145 al-language..jaE ! 0x0090: 000b 7072 696e 7465 722d 7572 6900 2869 ..printer-uri.(i ! 0x00a0: 7070 3a2f 2f6e 7563 6966 6572 612e 6c6f pp://nucifera.lo ! 0x00b0: 6361 6c2e 3a38 3633 322f 7072 696e 7465 cal.:8632/printe ! 0x00c0: 7273 2f73 6176 6542 0014 7265 7175 6573 rs/saveB..reques ! 0x00d0: 7469 6e67 2d75 7365 722d 6e61 6d65 0008 ting-user-name.. ! 0x00e0: 6675 6a69 6b61 7761 4400 1472 6571 7565 fujikawaD..reque ! 0x00f0: 7374 6564 2d61 7474 7269 6275 7465 7300 sted-attributes. ! 0x0100: 1261 7574 682d 696e 666f 2d72 6571 7569 .auth-info-requi ! 0x0110: 7265 6444 0000 000a 6465 7669 6365 2d75 redD....device-u ! 0x0120: 7269 4400 0000 126d 6172 6b65 722d 6368 riD....marker-ch ! 0x0130: 616e 6765 2d74 696d 6544 0000 000d 6d61 ange-timeD....ma ! 0x0140: 726b 6572 2d63 6f6c 6f72 7344 0000 0012 rker-colorsD.... ! 0x0150: 6d61 726b 6572 2d68 6967 682d 6c65 7665 marker-high-leve ! 0x0160: 6c73 4400 0000 0d6d 6172 6b65 722d 6c65 lsD....marker-le 12年5月26日土曜日
  • 39. • ダンプ結果 • 一般的な HTTP 通信 • Bonjourで指示したBaseURL (adminurl) • /printers/save (rp) • HTTP BODY は IPP • IPP = Internet Printing Protocol 12年5月26日土曜日
  • 41. • RFC 2910 Internet Printing Protocol/1.1: Encoding and Transport • http://tools.ietf.org/html/rfc2910 HTTP Stream IPP カプセル HTTP Header Header Attributes … HTTP Body Attribute End Data 12年5月26日土曜日
  • 42. ----------------------------------------------- | version-number | 2 bytes - required ----------------------------------------------- | operation-id (request) | | or | 2 bytes - required | status-code (response) | ----------------------------------------------- | request-id | 4 bytes - required | • IPPのパケット構造 ----------------------------------------------------------- tag (delimiter-tag or value-tag) | ----------------------------------------------- 1 byte | |-0 or more | empty or rest of attribute | x bytes | ----------------------------------------------------------- | end-of-attributes-tag | 1 byte - required ----------------------------------------------- | data | y bytes - optional ----------------------------------------------- 12年5月26日土曜日
  • 43. 09:11:53.565534 IP6 localhost.52819 > localhost.8632: Flags [P.], seq 153:611, ack 1, win 65535, options [nop,nop,TS val 396944919 ecr • IPPを読む 396944919], length 458 ! 0x0000: 6000 0000 01ea 0640 0000 0000 0000 0000 `......@........ ! 0x0010: 0000 0000 0000 0001 0000 0000 0000 0000 ................ ! 0x0020: 0000 0000 0000 0001 ce53 21b8 4e3f 4c57 .........S!.N?LW ! 0x0030: 5660 9cae 8018 ffff 01f2 0000 0101 080a V`.............. ! 0x0040: 17a8 e617 17a8 e617 0101 000b 0000 0001 ................ ! 0x0050: 0147 0012 6174 7472 6962 7574 6573 2d63 .G..attributes-c ! 0x0060: 6861 7273 6574 0005 7574 662d 3848 001b harset..utf-8H.. ! 0x0070: 6174 7472 6962 7574 6573 2d6e 6174 7572 attributes-natur • ver = 1.1 ! 0x0080: 616c 2d6c 616e 6775 6167 6500 026a 6145 al-language..jaE ! 0x0090: 000b 7072 696e 7465 722d 7572 6900 2869 ..printer-uri.(i ! 0x00a0: 7070 3a2f 2f6e 7563 6966 6572 612e 6c6f pp://nucifera.lo ! 0x00b0: 6361 6c2e 3a38 3633 322f 7072 696e 7465 cal.:8632/printe ! 0x00c0: 7273 2f73 6176 6542 0014 7265 7175 6573 rs/saveB..reques ! 0x00d0: 7469 6e67 2d75 7365 722d 6e61 6d65 0008 ting-user-name.. ! 0x00e0: 6675 6a69 6b61 7761 4400 1472 6571 7565 fujikawaD..reque • コマンド = Get ! 0x00f0: 7374 6564 2d61 7474 7269 6275 7465 7300 sted-attributes. ! 0x0100: 1261 7574 682d 696e 666f 2d72 6571 7569 .auth-info-requi ! 0x0110: 7265 6444 0000 000a 6465 7669 6365 2d75 redD....device-u ! 0x0120: 7269 4400 0000 126d 6172 6b65 722d 6368 riD....marker-ch ! 0x0130: 616e 6765 2d74 696d 6544 0000 000d 6d61 ange-timeD....ma ! 0x0140: 726b 6572 2d63 6f6c 6f72 7344 0000 0012 rker-colorsD.... ! 0x0150: 6d61 726b 6572 2d68 6967 682d 6c65 7665 marker-high-leve Printer Attributes ! 0x0160: 6c73 4400 0000 0d6d 6172 6b65 722d 6c65 lsD....marker-le ! 0x0170: 7665 6c73 4400 0000 116d 6172 6b65 722d velsD....marker- ! 0x0180: 6c6f 772d 6c65 7665 6c73 4400 0000 0e6d low-levelsD....m ! 0x0190: 6172 6b65 722d 6d65 7373 6167 6544 0000 arker-messageD.. ! 0x01a0: 000c 6d61 726b 6572 2d6e 616d 6573 4400 ..marker-namesD. ! 0x01b0: 0000 0c6d 6172 6b65 722d 7479 7065 7344 ...marker-typesD • シーケンス = 1 ! 0x01c0: 0000 0010 7072 696e 7465 722d 636f 6d6d ....printer-comm ! 0x01d0: 616e 6473 4400 0000 1570 7269 6e74 6572 andsD....printer ! 0x01e0: 2d73 7461 7465 2d72 6561 736f 6e73 4400 -state-reasonsD. ! 0x01f0: 0000 0d70 7269 6e74 6572 2d73 7461 7465 ...printer-state ! 0x0200: 4400 0000 0c70 7269 6e74 6572 2d74 7970 D....printer-typ ! 0x0210: 6503 e. 12年5月26日土曜日
  • 44. 09:11:53.565534 IP6 localhost.52819 > localhost.8632: Flags [P.], seq 153:611, ack 1, win 65535, options [nop,nop,TS val 396944919 ecr 396944919], length 458 ! 0x0000: 6000 0000 01ea 0640 0000 0000 0000 0000 `......@........ ! 0x0010: 0000 0000 0000 0001 0000 0000 0000 0000 ................ ! 0x0020: 0000 0000 0000 0001 ce53 21b8 4e3f 4c57 .........S!.N?LW ! 0x0030: 5660 9cae 8018 ffff 01f2 0000 0101 080a V`.............. ! 0x0040: 17a8 e617 17a8 e617 0101 000b 0000 0001 ................ ! 0x0050: 0147 0012 6174 7472 6962 7574 6573 2d63 .G..attributes-c • IPPを読む ! 0x0060: 6861 7273 6574 0005 7574 662d 3848 001b harset..utf-8H.. ! 0x0070: 6174 7472 6962 7574 6573 2d6e 6174 7572 attributes-natur ! 0x0080: 616c 2d6c 616e 6775 6167 6500 026a 6145 al-language..jaE ! 0x0090: 000b 7072 696e 7465 722d 7572 6900 2869 ..printer-uri.(i ! 0x00a0: 7070 3a2f 2f6e 7563 6966 6572 612e 6c6f pp://nucifera.lo ! 0x00b0: 6361 6c2e 3a38 3633 322f 7072 696e 7465 cal.:8632/printe ! 0x00c0: 7273 2f73 6176 6542 0014 7265 7175 6573 rs/saveB..reques ! 0x00d0: 7469 6e67 2d75 7365 722d 6e61 6d65 0008 ting-user-name.. ! 0x00e0: 6675 6a69 6b61 7761 4400 1472 6571 7565 fujikawaD..reque • 0x01:オペレーショ ! 0x00f0: 7374 6564 2d61 7474 7269 6275 7465 7300 sted-attributes. ! 0x0100: 1261 7574 682d 696e 666f 2d72 6571 7569 .auth-info-requi ! 0x0110: 7265 6444 0000 000a 6465 7669 6365 2d75 redD....device-u ! 0x0120: 7269 4400 0000 126d 6172 6b65 722d 6368 riD....marker-ch ! 0x0130: 616e 6765 2d74 696d 6544 0000 000d 6d61 ange-timeD....ma ! 0x0140: 726b 6572 2d63 6f6c 6f72 7344 0000 0012 rker-colorsD.... ! 0x0150: 6d61 726b 6572 2d68 6967 682d 6c65 7665 marker-high-leve ン開始 ! 0x0160: 6c73 4400 0000 0d6d 6172 6b65 722d 6c65 lsD....marker-le ! 0x0170: 7665 6c73 4400 0000 116d 6172 6b65 722d velsD....marker- ! 0x0180: 6c6f 772d 6c65 7665 6c73 4400 0000 0e6d low-levelsD....m ! 0x0190: 6172 6b65 722d 6d65 7373 6167 6544 0000 arker-messageD.. ! 0x01a0: 000c 6d61 726b 6572 2d6e 616d 6573 4400 ..marker-namesD. ! 0x01b0: 0000 0c6d 6172 6b65 722d 7479 7065 7344 ...marker-typesD ! 0x01c0: 0000 0010 7072 696e 7465 722d 636f 6d6d ....printer-comm ! 0x01d0: 616e 6473 4400 0000 1570 7269 6e74 6572 andsD....printer ! 0x01e0: 2d73 7461 7465 2d72 6561 736f 6e73 4400 -state-reasonsD. ! 0x01f0: 0000 0d70 7269 6e74 6572 2d73 7461 7465 ...printer-state ! 0x0200: 4400 0000 0c70 7269 6e74 6572 2d74 7970 D....printer-typ ! 0x0210: 6503 e. 12年5月26日土曜日
  • 45. 09:11:53.565534 IP6 localhost.52819 > localhost.8632: Flags [P.], seq 153:611, ack 1, win 65535, options [nop,nop,TS val 396944919 ecr 396944919], length 458 ! 0x0000: 6000 0000 01ea 0640 0000 0000 0000 0000 `......@........ • IPPを読む ! 0x0010: 0000 0000 0000 0001 0000 0000 0000 0000 ................ ! 0x0020: 0000 0000 0000 0001 ce53 21b8 4e3f 4c57 .........S!.N?LW • 0x47: charset ! 0x0030: 5660 9cae 8018 ffff 01f2 0000 0101 080a V`.............. ! 0x0040: 17a8 e617 17a8 e617 0101 000b 0000 0001 ................ ! 0x0050: 0147 0012 6174 7472 6962 7574 6573 2d63 .G..attributes-c ! 0x0060: 6861 7273 6574 0005 7574 662d 3848 001b harset..utf-8H.. ! 0x0070: 6174 7472 6962 7574 6573 2d6e 6174 7572 attributes-natur ! 0x0080: 616c 2d6c 616e 6775 6167 6500 026a 6145 al-language..jaE ! 0x0090: 000b 7072 696e 7465 722d 7572 6900 2869 ..printer-uri.(i • length =12 ! 0x00a0: 7070 3a2f 2f6e 7563 6966 6572 612e 6c6f pp://nucifera.lo ! 0x00b0: 6361 6c2e 3a38 3633 322f 7072 696e 7465 cal.:8632/printe ! 0x00c0: 7273 2f73 6176 6542 0014 7265 7175 6573 rs/saveB..reques ! 0x00d0: 7469 6e67 2d75 7365 722d 6e61 6d65 0008 ting-user-name.. ! 0x00e0: 6675 6a69 6b61 7761 4400 1472 6571 7565 fujikawaD..reque ! 0x00f0: 7374 6564 2d61 7474 7269 6275 7465 7300 sted-attributes. ! 0x0100: 1261 7574 682d 696e 666f 2d72 6571 7569 .auth-info-requi ! 0x0110: 7265 6444 0000 000a 6465 7669 6365 2d75 redD....device-u • attributes-charset ! 0x0120: 7269 4400 0000 126d 6172 6b65 722d 6368 riD....marker-ch ! 0x0130: 616e 6765 2d74 696d 6544 0000 000d 6d61 ange-timeD....ma ! 0x0140: 726b 6572 2d63 6f6c 6f72 7344 0000 0012 rker-colorsD.... ! 0x0150: 6d61 726b 6572 2d68 6967 682d 6c65 7665 marker-high-leve ! 0x0160: 6c73 4400 0000 0d6d 6172 6b65 722d 6c65 lsD....marker-le ! 0x0170: 7665 6c73 4400 0000 116d 6172 6b65 722d velsD....marker- ! 0x0180: 6c6f 772d 6c65 7665 6c73 4400 0000 0e6d low-levelsD....m • length = 5 ! 0x0190: 6172 6b65 722d 6d65 7373 6167 6544 0000 arker-messageD.. ! 0x01a0: 000c 6d61 726b 6572 2d6e 616d 6573 4400 ..marker-namesD. ! 0x01b0: 0000 0c6d 6172 6b65 722d 7479 7065 7344 ...marker-typesD ! 0x01c0: 0000 0010 7072 696e 7465 722d 636f 6d6d ....printer-comm ! 0x01d0: 616e 6473 4400 0000 1570 7269 6e74 6572 andsD....printer ! 0x01e0: 2d73 7461 7465 2d72 6561 736f 6e73 4400 -state-reasonsD. ! 0x01f0: 0000 0d70 7269 6e74 6572 2d73 7461 7465 ...printer-state ! 0x0200: 4400 0000 0c70 7269 6e74 6572 2d74 7970 D....printer-typ • utf-8 ! 0x0210: 6503 e. 12年5月26日土曜日
  • 46. 09:11:53.565534 IP6 localhost.52819 > localhost.8632: Flags [P.], seq 153:611, ack 1, win 65535, options [nop,nop,TS val 396944919 ecr 396944919], length 458 • IPPを読む ! 0x0000: 6000 0000 01ea 0640 0000 0000 0000 0000 `......@........ ! 0x0010: 0000 0000 0000 0001 0000 0000 0000 0000 ................ • ! 0x0020: 0000 0000 0000 0001 ce53 21b8 4e3f 4c57 .........S!.N?LW ! 0x0030: 5660 9cae 8018 ffff 01f2 0000 0101 080a V`.............. ! ! ! 0x0040: 17a8 e617 17a8 e617 0101 000b 0000 0001 ................ 0x0050: 0147 0012 6174 7472 6962 7574 6573 2d63 .G..attributes-c 0x0060: 6861 7273 6574 0005 7574 662d 3848 001b harset..utf-8H.. 0x48: natural-language ! 0x0070: 6174 7472 6962 7574 6573 2d6e 6174 7572 attributes-natur ! 0x0080: 616c 2d6c 616e 6775 6167 6500 026a 6145 al-language..jaE • ! 0x0090: 000b 7072 696e 7465 722d 7572 6900 2869 ..printer-uri.(i length =0x1b(27) ! 0x00a0: 7070 3a2f 2f6e 7563 6966 6572 612e 6c6f pp://nucifera.lo ! 0x00b0: 6361 6c2e 3a38 3633 322f 7072 696e 7465 cal.:8632/printe ! 0x00c0: 7273 2f73 6176 6542 0014 7265 7175 6573 rs/saveB..reques ! 0x00d0: 7469 6e67 2d75 7365 722d 6e61 6d65 0008 ting-user-name.. ! 0x00e0: 6675 6a69 6b61 7761 4400 1472 6571 7565 fujikawaD..reque ! 0x00f0: 7374 6564 2d61 7474 7269 6275 7465 7300 sted-attributes. • ! 0x0100: 1261 7574 682d 696e 666f 2d72 6571 7569 .auth-info-requi attributes-natural- ! 0x0110: 7265 6444 0000 000a 6465 7669 6365 2d75 redD....device-u ! 0x0120: 7269 4400 0000 126d 6172 6b65 722d 6368 riD....marker-ch ! 0x0130: 616e 6765 2d74 696d 6544 0000 000d 6d61 ange-timeD....ma ! 0x0140: 726b 6572 2d63 6f6c 6f72 7344 0000 0012 rker-colorsD.... ! ! ! 0x0150: 6d61 726b 6572 2d68 6967 682d 6c65 7665 marker-high-leve 0x0160: 6c73 4400 0000 0d6d 6172 6b65 722d 6c65 lsD....marker-le 0x0170: 7665 6c73 4400 0000 116d 6172 6b65 722d velsD....marker- language ! 0x0180: 6c6f 772d 6c65 7665 6c73 4400 0000 0e6d low-levelsD....m ! 0x0190: 6172 6b65 722d 6d65 7373 6167 6544 0000 arker-messageD.. ! 0x01a0: 000c 6d61 726b 6572 2d6e 616d 6573 4400 ..marker-namesD. • ! 0x01b0: 0000 0c6d 6172 6b65 722d 7479 7065 7344 ...marker-typesD ! ! ! 0x01c0: 0000 0010 7072 696e 7465 722d 636f 6d6d ....printer-comm 0x01d0: 616e 6473 4400 0000 1570 7269 6e74 6572 andsD....printer 0x01e0: 2d73 7461 7465 2d72 6561 736f 6e73 4400 -state-reasonsD. length = 2 ! 0x01f0: 0000 0d70 7269 6e74 6572 2d73 7461 7465 ...printer-state ! 0x0200: 4400 0000 0c70 7269 6e74 6572 2d74 7970 D....printer-typ • ! 0x0210: 6503 e. ja 12年5月26日土曜日
  • 48. 09:11:53.565534 IP6 localhost.52819 > localhost.8632: Flags [P.], seq 153:611, ack 1, win 65535, options [nop,nop,TS val 396944919 ecr 396944919], length 458 ! 0x0000: 6000 0000 01ea 0640 0000 0000 0000 0000 `......@........ ! 0x0010: 0000 0000 0000 0001 0000 0000 0000 0000 ................ ! 0x0020: 0000 0000 0000 0001 ce53 21b8 4e3f 4c57 .........S!.N?LW ! 0x0030: 5660 9cae 8018 ffff 01f2 0000 0101 080a V`.............. ! 0x0040: 17a8 e617 17a8 e617 0101 000b 0000 0001 ................ ! 0x0050: 0147 0012 6174 7472 6962 7574 6573 2d63 .G..attributes-c • IPPを読む ! 0x0060: 6861 7273 6574 0005 7574 662d 3848 001b harset..utf-8H.. ! 0x0070: 6174 7472 6962 7574 6573 2d6e 6174 7572 attributes-natur ! 0x0080: 616c 2d6c 616e 6775 6167 6500 026a 6145 al-language..jaE ! 0x0090: 000b 7072 696e 7465 722d 7572 6900 2869 ..printer-uri.(i ! 0x00a0: 7070 3a2f 2f6e 7563 6966 6572 612e 6c6f pp://nucifera.lo ! 0x00b0: 6361 6c2e 3a38 3633 322f 7072 696e 7465 cal.:8632/printe ! 0x00c0: 7273 2f73 6176 6542 0014 7265 7175 6573 rs/saveB..reques ! 0x00d0: 7469 6e67 2d75 7365 722d 6e61 6d65 0008 ting-user-name.. ! 0x00e0: 6675 6a69 6b61 7761 4400 1472 6571 7565 fujikawaD..reque • 0x03:オペレーショ ! 0x00f0: 7374 6564 2d61 7474 7269 6275 7465 7300 sted-attributes. ! 0x0100: 1261 7574 682d 696e 666f 2d72 6571 7569 .auth-info-requi ! 0x0110: 7265 6444 0000 000a 6465 7669 6365 2d75 redD....device-u ! 0x0120: 7269 4400 0000 126d 6172 6b65 722d 6368 riD....marker-ch ! 0x0130: 616e 6765 2d74 696d 6544 0000 000d 6d61 ange-timeD....ma ! 0x0140: 726b 6572 2d63 6f6c 6f72 7344 0000 0012 rker-colorsD.... ! 0x0150: 6d61 726b 6572 2d68 6967 682d 6c65 7665 marker-high-leve ン終了! ! 0x0160: 6c73 4400 0000 0d6d 6172 6b65 722d 6c65 lsD....marker-le ! 0x0170: 7665 6c73 4400 0000 116d 6172 6b65 722d velsD....marker- ! 0x0180: 6c6f 772d 6c65 7665 6c73 4400 0000 0e6d low-levelsD....m ! 0x0190: 6172 6b65 722d 6d65 7373 6167 6544 0000 arker-messageD.. ! 0x01a0: 000c 6d61 726b 6572 2d6e 616d 6573 4400 ..marker-namesD. ! 0x01b0: 0000 0c6d 6172 6b65 722d 7479 7065 7344 ...marker-typesD ! 0x01c0: 0000 0010 7072 696e 7465 722d 636f 6d6d ....printer-comm ! 0x01d0: 616e 6473 4400 0000 1570 7269 6e74 6572 andsD....printer ! 0x01e0: 2d73 7461 7465 2d72 6561 736f 6e73 4400 -state-reasonsD. ! 0x01f0: 0000 0d70 7269 6e74 6572 2d73 7461 7465 ...printer-state ! 0x0200: 4400 0000 0c70 7269 6e74 6572 2d74 7970 D....printer-typ ! 0x0210: 6503 e. 12年5月26日土曜日
  • 49. attributes-charset = utf-8 attributes-natural-language = ja printer-uri = ipp://nucifera.local.:8632/printers/save requesting-user-name = fujikawa requested-attributes = ( ・auth-info-required ・device-uri ・marker-change-time ・marker-colors ・marker-high-levels ・marker-levels ・marker-low-levels • IPPを読めた! ・marker-message ・marker-names ・marker-types ・printer-commands ・printer-state-reasons ・printer-state ・printer-type ) 12年5月26日土曜日
  • 50. つまり、 • Get Printer Attrコマンドが来ている (Printerの機能を確認している) 12年5月26日土曜日
  • 51. • Get Printer Attrの応答は? • rfc嫁! 12年5月26日土曜日
  • 52. 09:11:53.565907 IP6 localhost.8632 > localhost.52819: Flags [P.], seq 26:182, ack 611, win 65535, options [nop,nop,TS val 396944919 ecr 396944919], length 156 ! 0x0000: 6001 6097 00bc 0640 0000 0000 0000 0000 `.`....@........ IPP Response形式 ! 0x0010: 0000 0000 0000 0001 0000 0000 0000 0000 ................ ! 0x0020: 0000 0000 0000 0001 21b8 ce53 5660 9cc7 ........!..SV`.. ! 0x0030: 4e3f 4e21 8018 ffff 00c4 0000 0101 080a N?N!............ • ! 0x0040: 17a8 e617 17a8 e617 4854 5450 2f31 2e31 ........HTTP/1.1 ! 0x0050: 2032 3030 204f 4b0d 0a44 6174 653a 2057 .200.OK..Date:.W ! ! ! 0x0060: 6564 2c20 3034 2041 7072 2032 3031 3220 ed,.04.Apr.2012. 0x0070: 3030 3a31 313a 3533 2047 4d54 0d0a 436f 00:11:53.GMT..Co 0x0080: 6e6e 6563 7469 6f6e 3a20 4b65 6570 2d41 nnection:.Keep-A HTTP Response ! 0x0090: 6c69 7665 0d0a 4b65 6570 2d41 6c69 7665 live..Keep-Alive ! 0x00a0: 3a20 7469 6d65 6f75 743d 3130 0d0a 436f :.timeout=10..Co • ! 0x00b0: 6e74 656e 742d 5479 7065 3a20 6170 706c ntent-Type:.appl ! ! ! 0x00c0: 6963 6174 696f 6e2f 6970 700d 0a43 6f6e ication/ipp..Con 0x00d0: 7465 6e74 2d4c 656e 6774 683a 2034 3934 tent-Length:.494 0x00e0: 0d0a 0d0a .... BODY=IPP 09:11:53.565929 IP6 localhost.8632 > localhost.52819: Flags [P.], seq 182:676, ack 611, win 65535, options [nop,nop,TS val 396944919 ecr • 396944919], length 494 ver 1.1 ! 0x0000: 6001 6097 020e 0640 0000 0000 0000 0000 `.`....@........ ! 0x0010: 0000 0000 0000 0001 0000 0000 0000 0000 ................ ! 0x0020: 0000 0000 0000 0001 21b8 ce53 5660 9d63 ........!..SV`.c ! 0x0030: 4e3f 4e21 8018 ffff 0216 0000 0101 080a N?N!............ ! 0x0040: 17a8 e617 17a8 e617 0101 0000 0000 0001 ................ • ! 0x0050: 0147 0012 6174 7472 6962 7574 6573 2d63 .G..attributes-c ! 0x0060: 6861 7273 6574 0005 7574 662d 3848 001b harset..utf-8H.. ! ! ! 0x0070: 6174 7472 6962 7574 6573 2d6e 6174 7572 attributes-natur 0x0080: 616c 2d6c 616e 6775 6167 6500 026a 6104 al-language..ja. 0x0090: 2300 0d70 7269 6e74 6572 2d73 7461 7465 #..printer-state seq = 1 ! 0x00a0: 0004 0000 0003 4400 1570 7269 6e74 6572 ......D..printer ! 0x00b0: 2d73 7461 7465 2d72 6561 736f 6e73 0004 -state-reasons.. • ! 0x00c0: 6e6f 6e65 4500 0a64 6576 6963 652d 7572 noneE..device-ur ! ! ! 0x00d0: 6900 0a6e 756c 6c3a 2f2f 2f32 3042 000d i..null:///20B.. 0x00e0: 6d61 726b 6572 2d63 6f6c 6f72 7300 0723 marker-colors..# 0x00f0: 3030 3030 3030 4200 0000 0723 3030 4646 000000B....#00FF Status-OK ! 0x0100: 4646 4200 0000 0723 4646 3030 4646 4200 FFB....#FF00FFB. ! 0x0110: 0000 0723 4646 4646 3030 2100 126d 6172 ...#FFFF00!..mar • ! 0x0120: 6b65 722d 6869 6768 2d6c 6576 656c 7300 ker-high-levels. ! ! ! 0x0130: 0400 0000 6421 0000 0004 0000 0064 2100 ....d!.......d!. 0x0140: 0000 0400 0000 6421 0000 0004 0000 0064 ......d!.......d 0x0150: 2100 0d6d 6172 6b65 722d 6c65 7665 6c73 !..marker-levels … 12年5月26日土曜日
  • 53. iPhoneが送るパケットを確認 • プリンタ一覧を表示する時 • プリンタを選んだ時 • プリントする時 • IPPコマンドを解析 • RFCとにらめっこしよう! 12年5月26日土曜日
  • 54. • HTTPDとして(HTTP/1.1) • KeepAlive • Chunk転送 • HTTP Status 100 Continue 12年5月26日土曜日
  • 56. • transfer-encoding: chunked とは? chunk HTTP Body IPP カプセル size(改行) Header Data Block Attributes Data Block Data Block … (改行) … Attribute End chunk Data … (改行) 12年5月26日土曜日
  • 57. • 二つのバイトカウンタが必要 • HTTP 1.1 KeepAlive + chunk転送 • IPPパケット解析 (不定長) 12年5月26日土曜日
  • 58. • 二つのバイトカウンタ • Bound Pair で解決 • CFStreamCreateBoundPair() Bound Stream Pair write read Stream Stream 12年5月26日土曜日
  • 59. • transfer-encoding: chunked とは? chunkパーサー IPPパーサー TCP chunk Bound IPP カプセル Stream Stream size(改行) Header Pair Attributes Data Block … (改行) Attribute End chunk Data … (改行) 12年5月26日土曜日
  • 61. • 様々な困難を乗り越えて… Print-Job Request キタ━━━━━━(゚ ゚)━━━━━━ !!!!! 12年5月26日土曜日
  • 62. 11:06:28.162632 IP iphone4s.59585 > nucifera.8632: Flags [P.], seq 891:1356, ack 568, win 8200, options [nop,nop,TS val 1366144288 ecr 627012944], length 465 ! 0x0000: 4500 0205 527d 4000 4006 0e38 c0a8 2bea E...R}@.@..8..+. ! 0x0010: c0a8 2b03 e8c1 21b8 055c cc50 3a20 36f1 ..+...!...P:.6. ! 0x0020: 8018 2008 ad3a 0000 0101 080a 516d b520 .....:......Qm.. ! 0x0030: 255f 7550 0101 0002 0000 0001 0147 0012 %_uP.........G.. ! 0x0040: 6174 7472 6962 7574 6573 2d63 6861 7273 attributes-chars ! 0x0050: 6574 0005 7574 662d 3848 001b 6174 7472 et..utf-8H..attr ! 0x0060: 6962 7574 6573 2d6e 6174 7572 616c 2d6c ibutes-natural-l ! 0x0070: 616e 6775 6167 6500 026a 6145 000b 7072 anguage..jaE..pr ! 0x0080: 696e 7465 722d 7572 6900 2869 7070 3a2f inter-uri.(ipp:/ ! 0x0090: 2f6e 7563 6966 6572 612e 6c6f 6361 6c2e /nucifera.local. ! 0x00a0: 3a38 3633 322f 7072 696e 7465 7273 2f73 :8632/printers/s ! 0x00b0: 6176 6542 0014 7265 7175 6573 7469 6e67 aveB..requesting • Print-Job (0x0002) ! 0x00c0: 2d75 7365 722d 6e61 6d65 0005 6775 6573 -user-name..gues ! 0x00d0: 7449 000f 646f 6375 6d65 6e74 2d66 6f72 tI..document-for ! 0x00e0: 6d61 7400 0a69 6d61 6765 2f6a 7065 6742 mat..image/jpegB ! 0x00f0: 0008 6a6f 622d 6e61 6d65 0006 e586 99e7 ..job-name...... ! 0x0100: 9c9f 0221 0006 636f 7069 6573 0004 0000 ...!..copies.... ! 0x0110: 0001 3400 096d 6564 6961 2d63 6f6c 0000 ..4..media-col.. ! 0x0120: 4a00 0000 0a6d 6564 6961 2d73 697a 6534 J....media-size4 ! 0x0130: 0000 0000 4a00 0000 0b78 2d64 696d 656e ....J....x-dimen • IPP Data: 印刷内容 ! 0x0140: 7369 6f6e 2100 0000 0400 0022 ba4a 0000 sion!......".J.. ! 0x0150: 000b 792d 6469 6d65 6e73 696f 6e21 0000 ..y-dimension!.. ! 0x0160: 0004 0000 319c 3700 0000 004a 0000 0013 ....1.7....J.... ! 0x0170: 6d65 6469 612d 626f 7474 6f6d 2d6d 6172 media-bottom-mar ! 0x0180: 6769 6e21 0000 0004 0000 0000 4a00 0000 gin!........J... ! 0x0190: 116d 6564 6961 2d6c 6566 742d 6d61 7267 .media-left-marg ! 0x01a0: 696e 2100 0000 0400 0000 004a 0000 0012 in!........J.... ! 0x01b0: 6d65 6469 612d 7269 6768 742d 6d61 7267 media-right-marg ! 0x01c0: 696e 2100 0000 0400 0000 004a 0000 0010 in!........J.... ! 0x01d0: 6d65 6469 612d 746f 702d 6d61 7267 696e media-top-margin ! 0x01e0: 2100 0000 0400 0000 0037 0000 0000 2300 !........7....#. ! 0x01f0: 0d70 7269 6e74 2d71 7561 6c69 7479 0004 .print-quality.. ! 0x0200: 0000 0005 03 ..... 11:06:28.168985 IP iphone4s.59585 > nucifera.8632: Flags [.], seq 1364:2812, ack 593, win 8198, options [nop,nop,TS val 1366144294 ecr 627012950], length 1448 ! 0x0000: 4500 05dc 384d 4000 4006 2491 c0a8 2bea E...8M@.@.$...+. ! 0x0010: c0a8 2b03 e8c1 21b8 055c ce29 3a20 370a ..+...!...):.7. ! 0x0020: 8010 2006 7698 0000 0101 080a 516d b526 ....v.......Qm.& ! 0x0030: 255f 7556 ffd8 ffe1 3ffe 4578 6966 0000 %_uV....?.Exif.. ! 0x0040: 4d4d 002a 0000 0008 000a 010f 0002 0000 MM.*............ ! 0x0050: 0006 0000 0086 0110 0002 0000 000a 0000 ................ ! 0x0060: 008c 011a 0005 0000 0001 0000 0096 011b ................ ! 0x0070: 0005 0000 0001 0000 009e 0128 0003 0000 ...........(.... ! 0x0080: 0001 0002 0000 0131 0002 0000 0004 352e .......1......5. ! 0x0090: 3100 0132 0002 0000 0014 0000 00a6 0213 1..2............ ! 0x00a0: 0003 0000 0001 0001 0000 8769 0004 0000 ...........i.... ! 0x00b0: 0001 0000 00ba 8825 0004 0000 0001 0000 .......%........ 12年5月26日土曜日
  • 63. 11:06:28.162632 IP iphone4s.59585 > nucifera.8632: Flags [P.], seq 891:1356, ack 568, win 8200, options [nop,nop,TS val 1366144288 ecr 627012944], length 465 ! 0x0000: 4500 0205 527d 4000 4006 0e38 c0a8 2bea E...R}@.@..8..+. ! 0x0010: c0a8 2b03 e8c1 21b8 055c cc50 3a20 36f1 ..+...!...P:.6. ! 0x0020: 8018 2008 ad3a 0000 0101 080a 516d b520 .....:......Qm.. ! 0x0030: 255f 7550 0101 0002 0000 0001 0147 0012 %_uP.........G.. ! 0x0040: 6174 7472 6962 7574 6573 2d63 6861 7273 attributes-chars ! 0x0050: 6574 0005 7574 662d 3848 001b 6174 7472 et..utf-8H..attr ! 0x0060: 6962 7574 6573 2d6e 6174 7572 616c 2d6c ibutes-natural-l ! 0x0070: 616e 6775 6167 6500 026a 6145 000b 7072 anguage..jaE..pr ! 0x0080: 696e 7465 722d 7572 6900 2869 7070 3a2f inter-uri.(ipp:/ ! 0x0090: 2f6e 7563 6966 6572 612e 6c6f 6361 6c2e /nucifera.local. ! 0x00a0: 3a38 3633 322f 7072 696e 7465 7273 2f73 :8632/printers/s ! 0x00b0: 6176 6542 0014 7265 7175 6573 7469 6e67 aveB..requesting ! 0x00c0: 2d75 7365 722d 6e61 6d65 0005 6775 6573 -user-name..gues ! 0x00d0: 7449 000f 646f 6375 6d65 6e74 2d66 6f72 tI..document-for ! 0x00e0: 6d61 7400 0a69 6d61 6765 2f6a 7065 6742 mat..image/jpegB ! 0x00f0: 0008 6a6f 622d 6e61 6d65 0006 e586 99e7 ..job-name...... • Exif !? ! 0x0100: 9c9f 0221 0006 636f 7069 6573 0004 0000 ...!..copies.... ! 0x0110: 0001 3400 096d 6564 6961 2d63 6f6c 0000 ..4..media-col.. ! 0x0120: 4a00 0000 0a6d 6564 6961 2d73 697a 6534 J....media-size4 ! 0x0130: 0000 0000 4a00 0000 0b78 2d64 696d 656e ....J....x-dimen ! 0x0140: 7369 6f6e 2100 0000 0400 0022 ba4a 0000 sion!......".J.. ! 0x0150: 000b 792d 6469 6d65 6e73 696f 6e21 0000 ..y-dimension!.. ! 0x0160: 0004 0000 319c 3700 0000 004a 0000 0013 ....1.7....J.... ! 0x0170: 6d65 6469 612d 626f 7474 6f6d 2d6d 6172 media-bottom-mar ! 0x0180: 6769 6e21 0000 0004 0000 0000 4a00 0000 gin!........J... ! 0x0190: 116d 6564 6961 2d6c 6566 742d 6d61 7267 .media-left-marg ! 0x01a0: 696e 2100 0000 0400 0000 004a 0000 0012 in!........J.... ! 0x01b0: 6d65 6469 612d 7269 6768 742d 6d61 7267 media-right-marg ! 0x01c0: 696e 2100 0000 0400 0000 004a 0000 0010 in!........J.... ! 0x01d0: 6d65 6469 612d 746f 702d 6d61 7267 696e media-top-margin ! 0x01e0: 2100 0000 0400 0000 0037 0000 0000 2300 !........7....#. ! 0x01f0: 0d70 7269 6e74 2d71 7561 6c69 7479 0004 .print-quality.. ! 0x0200: 0000 0005 03 ..... 11:06:28.168985 IP iphone4s.59585 > nucifera.8632: Flags [.], seq 1364:2812, ack 593, win 8198, options [nop,nop,TS val 1366144294 ecr 627012950], length 1448 ! 0x0000: 4500 05dc 384d 4000 4006 2491 c0a8 2bea E...8M@.@.$...+. ! 0x0010: c0a8 2b03 e8c1 21b8 055c ce29 3a20 370a ..+...!...):.7. ! 0x0020: 8010 2006 7698 0000 0101 080a 516d b526 ....v.......Qm.& ! 0x0030: 255f 7556 ffd8 ffe1 3ffe 4578 6966 0000 %_uV....?.Exif.. ! 0x0040: 4d4d 002a 0000 0008 000a 010f 0002 0000 MM.*............ ! 0x0050: 0006 0000 0086 0110 0002 0000 000a 0000 ................ ! 0x0060: 008c 011a 0005 0000 0001 0000 0096 011b ................ ! 0x0070: 0005 0000 0001 0000 009e 0128 0003 0000 ...........(.... ! 0x0080: 0001 0002 0000 0131 0002 0000 0004 352e .......1......5. ! 0x0090: 3100 0132 0002 0000 0014 0000 00a6 0213 1..2............ ! 0x00a0: 0003 0000 0001 0001 0000 8769 0004 0000 ...........i.... ! 0x00b0: 0001 0000 00ba 8825 0004 0000 0001 0000 .......%........ 12年5月26日土曜日
  • 64. パケットダンプ 11:06:28.168985 IP iphone4s.59585 > nucifera.8632: Flags [.], seq 1364:2812, ack 593, win 8198, options [nop,nop,TS val 1366144294 ecr 627012950], length 1448 ! 0x0000: 4500 05dc 384d 4000 4006 2491 c0a8 2bea E...8M@.@.$...+. ! 0x0010: c0a8 2b03 e8c1 21b8 055c ce29 3a20 370a ..+...!...):.7. • 元ファイルと比較 ! 0x0020: 8010 2006 7698 0000 0101 080a 516d b526 ....v.......Qm.& ! 0x0030: 255f 7556 ffd8 ffe1 3ffe 4578 6966 0000 %_uV....?.Exif.. ! 0x0040: 4d4d 002a 0000 0008 000a 010f 0002 0000 MM.*............ ! 0x0050: 0006 0000 0086 0110 0002 0000 000a 0000 ................ ! 0x0060: 008c 011a 0005 0000 0001 0000 0096 011b ................ ! 0x0070: 0005 0000 0001 0000 009e 0128 0003 0000 ...........(.... ! 0x0080: 0001 0002 0000 0131 0002 0000 0004 352e .......1......5. ! 0x0090: 3100 0132 0002 0000 0014 0000 00a6 0213 1..2............ ! 0x00a0: 0003 0000 0001 0001 0000 8769 0004 0000 ...........i.... • 長さ ! 0x00b0: 0001 0000 00ba 8825 0004 0000 0001 0000 .......%........ ! 0x00c0: 024c 0000 0316 4170 706c 6500 6950 686f .L....Apple.iPho ! 0x00d0: 6e65 2034 5300 0000 0048 0000 0001 0000 ne.4S....H...... ! 0x00e0: 0048 0000 0001 3230 3132 3a30 343a 3032 .H....2012:04:02 ! 0x00f0: 2031 353a 3439 3a31 3000 0019 829a 0005 .15:49:10....... ! 0x0100: 0000 0001 0000 01ec 829d 0005 0000 0001 ................ ! 0x0110: 0000 01f4 8822 0003 0000 0001 0002 0000 .....".......... ! 0x0120: 8827 0003 0000 0001 0040 0000 9000 0007 .'.......@...... 0000000 ファイルダンプ occidentale:Desktop fujikawa$ od -x -a 169654957.jpg d8ff e1ff fe3f 7845 6669 | head -200 0000 4d4d 2a00 • 先頭 ? ? ? ? ? ? E x i f nul nul M M nul * 0000020 0000 0800 0a00 0f01 0200 0000 0600 0000 • 末尾 nul nul nul bs nul nl soh si nul stx nul nul nul ack nul nul 0000040 8600 1001 0200 0000 0a00 0000 8c00 1a01 nul 86 soh dle nul stx nul nul nul nl nul nul nul 8c soh sub 0000060 0500 0000 0100 0000 9600 1b01 0500 0000 nul enq nul nul nul soh nul nul nul 96 soh esc nul enq nul nul 0000100 0100 0000 9e00 2801 0300 0000 0100 0200 nul soh nul nul nul 9e soh ( nul etx nul nul nul soh nul stx 0000120 0000 3101 0200 0000 0400 2e35 0031 3201 nul nul soh 1 nul stx nul nul nul eot 5 . 1 nul soh 2 0000140 0200 0000 1400 0000 a600 1302 0300 0000 nul stx nul nul nul dc4 nul nul nul ? stx dc3 nul etx nul nul 0000160 0100 0100 0000 6987 0400 0000 0100 0000 nul soh nul soh nul nul 87 i nul eot nul nul nul soh nul nul 0000200 ba00 2588 0400 0000 0100 0000 4c02 0000 nul ? 88 % nul eot nul nul nul soh nul nul stx L nul nul 0000220 1603 7041 6c70 0065 5069 6f68 656e 3420 etx syn A p p l e nul i P h o n e sp 4 0000240 0053 0000 4800 0000 0100 0000 4800 0000 12年5月26日土曜日
  • 65. • Print-Job Request • IPP Data • 中身は印刷対象ファイルそのもの • pdf, jpeg, pngで確認 12年5月26日土曜日
  • 66. • プリントデーターを表示する • UIWebViewController ←万能!凄い! • - (void)loadData:(NSData *)data MIMEType: (NSString *)MIMEType textEncodingName: (NSString *)encodingName baseURL:(NSURL *)baseURL 12年5月26日土曜日
  • 68. プログラム構造 • Application Main • ViewController • Print データー表示 • Server Control • Bonjour登録 • HTTP Server • HTTP/1.1 Chunked Stream Control • IPP Command Control • Ipp Capsule Parser / Selealizer • Printer Status Model 12年5月26日土曜日
  • 69. demo •http://www.youtube.com/watch? v=GgJ3DiYereA 12年5月26日土曜日
  • 71. 本を書いたよ • インプレスジャパン • 6/8発売 3,360円 • 第二章 Storyboards 担当しました 12年5月26日土曜日
  • 72. 本を書いたよ 第二章 Storyboards • プログラマ向け & • 非プログラマ向け 12年5月26日土曜日
  • 73. 本を書いたよ デザインが得意な同僚 …そんな彼の為に 買うべし! 12年5月26日土曜日