GithubHelp home page GithubHelp logo

Comments (9)

haesbaert avatar haesbaert commented on August 22, 2024

Indeed currently there is no support for publishing two TXT records, I was not aware of any service that needed that. It's possible that this became common in more recent years, I'll have to check the RFC, but this will require some modifications to the daemon as well.

from mdnsd.

scotia70 avatar scotia70 commented on August 22, 2024

I was hoping just a change to mdsctl. I've attached another example of a service requiring multiple text records, my printer.
screen shot 2017-03-14 at 21 12 33
Note that when I run mdsctl browse -r it shows only the first TXT field:

+++ Brother HL-1210W                                 pdl-datastream       tcp
 Name: Brother HL-1210W
 Port: 9100
 Target: BRNC03896916881.local
 Address: 10.1.1.207
 Txt: txtvers=1

from mdnsd.

haesbaert avatar haesbaert commented on August 22, 2024

from mdnsd.

scotia70 avatar scotia70 commented on August 22, 2024

This might be my reason to get into serious C programming :)

FYI: this is what MacOS reports when browsing for the printer:

$ dns-sd -L "Brother HL-1210W" _pdl-datastream
Lookup Brother HL-1210W._pdl-datastream._tcp.local
DATE: ---Tue 14 Mar 2017---
21:25:57.843  ...STARTING...
21:25:58.040  Brother\032HL-1210W._pdl-datastream._tcp.local. can be reached at BRNC03896916881.local.:9100 (interface 4)
 txtvers=1 qtotal=1 pdl= note= ty=Brother\ HL-1210W\ series product=\(Brother\ HL-1210W\ series\) adminurl=http://BRNC03896916881.local./ priority=25 usb_MFG=Brother usb_MDL=HL-1210W\ series usb_CMD=PJL,HBP Color=F Copies=T Duplex=F Fax=F Scan=F PaperCustom=T Binary=T Transparent=F TBCP=T UUID=e3248000-80ce-11db-8000-c03896916881

It breaks up each TXT with a space and escapes any spaces within a TXT.

from mdnsd.

haesbaert avatar haesbaert commented on August 22, 2024

from mdnsd.

scotia70 avatar scotia70 commented on August 22, 2024

Hi, thanks for your prompt responses.

According to:
http://www.zeroconf.org/rendezvous/txtrecords.html

Jaguar's DNSServiceDiscovery.h APIs are, like most Unix APIs, based on C strings. How then does a client encode multiple pascal strings containing name/value pairs using a single C string? The answer is that Jaguar's DNSServiceDiscovery.h APIs use ASCII 1 as the boundary marker between constituent strings within the DNS TXT record. This value can be inserted into a C string using '\001', as shown below:

DNSServiceRegistrationCreate(..., "a=1\001b=2\001c=3", ...);

So I tried:

mdnsctl publish nas-01 adisk tcp 9 sys=waMA=3c:d9:2b:04:2b:6f,adVF=0x100$'\001'dk0=adVF=0xa1,adVN=tm,adVU=12D28B6D-AFD0-1D56-7161-723FBFE36EDC

and got this from MacOS:

Lookup nas-01._adisk._tcp.local
DATE: ---Tue 14 Mar 2017---
21:44:39.420  ...STARTING...
21:44:39.421  nas-01._adisk._tcp.local. can be reached at nas-01.local.:9 (interface 4)
 sys=waMA=3c:d9:2b:04:2b:6f,adVF=0x100\\x01dk0=adVF=0xa1,adVN=tm,adVU=12D28B6D-AFD0-1D56-7161-723FBFE36EDC

If I substitute $\001\ for $\101 which is the letter 'A' then I see the 'A' in the lookup. So the shell is expanding the octal correctly.

Anyway I'm not sure if this is an Apple thing or RFC.

Thanks

from mdnsd.

scotia70 avatar scotia70 commented on August 22, 2024

Ahh ok, after reading some of rfc6763 it seems I may be barking up the wrong tree. What is really needed is a single TXT record with multiple key/value pairs: As per 6.1 of the RFC:

   The format of the data within a DNS TXT record is one or more
   strings, packed together in memory without any intervening gaps or
   padding bytes for word alignment.

   The format of each constituent string within the DNS TXT record is a
   single length byte, followed by 0-255 bytes of text data.

And the example:

        -------------------------------------------------------
        | 0x09 | key=value | 0x08 | paper=A4 | 0x07 | passreq |
        -------------------------------------------------------

So the parser needs to take multiple key/value pairs and break them up using their key/value pair length as the leading byte.

I'll take a look at parser.c and see what I come up with...

from mdnsd.

scotia70 avatar scotia70 commented on August 22, 2024

Which is how wireshark decodes a multi key/value pair TXT:

screen shot 2017-03-14 at 22 22 31

from mdnsd.

haesbaert avatar haesbaert commented on August 22, 2024

from mdnsd.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.