Scott Dattalo wrote :
> That's what I get when I do this:
> 
> setsockopt(fd, SOL_IRLMP, IRLMP_IAS_SET, 
>            (const char *) pIASSet_Name, 
>            IASSet_Name_Len) 
> 
> Is it possible to set the IAS services with a setsockopt call? If this is not
> the way to do it, can someone point me to an example that illustrates how?
> 
> What I'm trying to do: I'm working on a simple IrDA server program that talks to
> a Palm Pilot client. I have a similar working program that runs under windows
> (w2k) and I'd like it to work under Linux as well. The client is looking for a
> specific service that the server is supposed to supply.

        First of all, if you are using an IrDA stack without my
patches, you are asking for trouble. The latest official stack from
Dag contains the preliminary support for IRLMP_IAS_SET that I wrote,
but you *really* need my patch you you want to avoid troubles.
        My patch my be found there :
                http://www.hpl.hp.com/personal/Jean_Tourrilhes/IrDA/Java.html
        More recent versions for 2.4 :
                http://www.hpl.hp.com/personal/Jean_Tourrilhes/IrDA/IrNET.html
        Dag told me that he was planning to integrate those patches in
the official IrDA stack, so maybe he can give you more info on the
subject.

        Now, a sample program do exist to show you how to use this
stuff, and it was in fact part of my test suite. I did post it ages
ago on the list, and I hope that Dag will include it in the sample
directory of irda-utils sometimes (along with other useful sample
programs that I did).
        Currently, this program is available in a subdirectory of the
Java-IrDA package, called irdaspray.magic.c. Check the tar file for
details (url above). Maybe I should bring those programs closer to the
surface...
        Anyway, to set a string in IAS, it look likes :

---------------------------------------
        struct irda_ias_set ias_query;

        /* Set a string in IAS */
        strcpy(ias_query.irda_class_name, "my:object");
        ias_query.irda_attrib_type = IAS_STRING;
        strcpy(ias_query.irda_attrib_name, "my:string");
        strcpy(ias_query.attribute.irda_attrib_string.string, "The String");
        ias_query.attribute.irda_attrib_string.len = strlen("The String");
        if (setsockopt(fd, SOL_IRLMP, IRLMP_IAS_SET, &ias_query, 
                       sizeof(ias_query))) 
          {
            perror("setsockopt");
            exit(-1);
          }
---------------------------------------

        I looked at your code, and honestly it gives me headackes
because it's to ugly. You are playing with arrays and pointers in
weirds ways instead of getting things straight. I mean, compare your
code and mine !
        Anyway, your error is trivial. The error is returned by the
following line in net/irda/af_irda.c (line 1761 in my source) :
-----------------------
                if (optlen != sizeof(struct irda_ias_set))
                        return -EINVAL;
-----------------------

        By the way, I'm curious at what you are doing. I originally
implemente IAS support for something very similar.
        Have fun, and good luck in debugging...

        Jean

_______________________________________________
Linux-IrDA mailing list  -  [EMAIL PROTECTED]
http://www4.pasta.cs.UiT.No/mailman/listinfo/linux-irda

Reply via email to