WSDiscovery - Devices list returned by dpws_probe getting corrupted

81 views
Skip to first unread message

Raveesh Kumar B

unread,
Jun 24, 2009, 3:19:24 AM6/24/09
to ws4d-gs...@googlegroups.com
Hi,

This is regarding WSDiscovery APIs provided by WS4D-GSoap stack. I have followed reference manual, ws4d-gsoap-refman.pdf provided in GSoap kit. In this document section 6.11.3.4 there is descrption how to find WSD devices of specific type, on the network.

Following is the C routine, I wrote based on that. It discovers the devices on the network but the program hangs at the following statement dpws_done() (made bold in the C routine below) - printing "corrupt list node" in the console. Can you please let me know what is wrong here.?

Thanks
Raveesh

void WSDiscovery_demo()
{
//////////////////// Start Discovery ///////////////////////
  int ret;
  int timeout = 3000;

  struct dpws_s dpws1;
  struct ws4d_epr device1;
  struct ws4d_abs_eprlist results;
  ws4d_qnamelist type_list;
  ws4d_alloc_list alist1;
  char *XAddrs1 = NULL;

  dpws_init(&dpws1, "10.208.24.83");
  ws4d_eprlist_init (&results, ws4d_eprllist_init, NULL);
  WS4D_ALLOCLIST_INIT (&alist1);

  ws4d_qnamelist_init (&type_list);
  ws4d_qnamelist_addstring
  ("\"http://schemas.microsoft.com/windows/2006/08/wdp/print/PrinterServiceType\"",
   &type_list, &alist1);
  ret = dpws_probe (&dpws1, &type_list, NULL, timeout, 1000, NULL, NULL, &results);

  if (ret != SOAP_OK)
  {
    if (ret == SOAP_EOF)
    {
      //No device matches
    }
    else
    {
      //Internal error when probing for devices
    }
  }
  else
  {
    struct ws4d_epr * temp = results.fget_first(&results);
    printf("\nDiscovered device address : %s Service Name :%s Port Name :%s \n", temp->Address, temp->ServiceName,
        temp->PortName);

    ws4d_epr_init (&device1);
    ws4d_epr_set_Addrs (&device1, temp->Address);

    // resolve address
    XAddrs1 = (char *) dpws_resolve_addr(&dpws1, &device1, NULL, 10000);

    if (XAddrs1 != NULL)
    {
      printf("WSD Print client: device %s found at addr %s\n\n",
             ws4d_epr_get_Addrs(&device1), XAddrs1);
    }

    while(1)
    {
        temp = results.fget_next(&results, temp);
        if(temp != NULL)
        {
            printf("\nDiscovered device address : %s Service Name :%s Port Name :%s \n", temp->Address, temp->ServiceName,
                temp->PortName);
            ws4d_epr_init (&device1);
            ws4d_epr_set_Addrs (&device1, temp->Address);

            XAddrs1 = (char *) dpws_resolve_addr(&dpws1, &device1, NULL, 10000);

            if (XAddrs1 != NULL)
            {
                printf("WSD Print client: device %s found at addr %s\n\n",
                ws4d_epr_get_Addrs(&device1), XAddrs1);

            }   
        }
        else
            break;
    }
    //work with results here
  }

  ws4d_qnamelist_done (&type_list);
  dpws_done(&dpws1); // Program hangs here printing "corrupt list node" on the console
  ws4d_eprlist_done (&results);
 
  ws4d_epr_reset(&device1);
  ws4d_alloclist_done(&alist1);
  ///////////////////////////////////////////// End  Discovery ////////////////////////////
}

Elmar Zeeb

unread,
Jun 24, 2009, 4:19:06 AM6/24/09
to ravees...@gmail.com, ws4d-gs...@googlegroups.com
Raveesh Kumar B schrieb:
Hi,

This is regarding WSDiscovery APIs provided by WS4D-GSoap stack. I have followed reference manual, ws4d-gsoap-refman.pdf provided in GSoap kit. In this document section 6.11.3.4 there is descrption how to find WSD devices of specific type, on the network.

Following is the C routine, I wrote based on that. It discovers the devices on the network but the program hangs at the following statement dpws_done() (made bold in the C routine below) - printing "corrupt list node" in the console. Can you please let me know what is wrong here.?#
Often this is the case if you mix ws4d-gsoap libraries with multithreading support with source code that doesn't define WITH_MUTEXES. The libraries with multihreading support have a different application binary interface. In the Airconditioner-Example WITH_MUTEXES is defined with the cmake macro
EXTEND_TGT_COMPILE_FLAGS(acs_advanced_device FLAGS "-DDPWS_DEVICE -DWITH_MUTEXES")
You can use this macro instead of defining WITH_MUTEXES everywhere in your source code.

Regards,
Elmar Zeeb
-- 
*******************************************************************************
  Dipl.-Inf. Elmar Zeeb
  Universität Rostock, Fakultät f. Informatik und Elektrotechnik
  Institut f. Angewandte Mikroelektronik und Datentechnik
  University of Rostock, Faculty of CS and EE
  Institute of Applied Microelectronics and Computer Engineering,
  18051 Rostock
  Deutschland/Germany
  Tel. : ++49 (0)381 498 - 7262
  Fax  : ++49 (0)381 498 - 7252
  Email: elmar...@uni-rostock.de
  www  : http://www.imd.uni-rostock.de/, http://www.ws4d.org/
*******************************************************************************
Reply all
Reply to author
Forward
0 new messages