int target_cache_size = 10;
struct wsa_eprlist_elem *targets;
wsa_eprfixedlist target_cache;

void
new_device (struct soap *soap, struct wsa_eprlist_elem *device)
{

  if (device && wsa_eprlist_elem_get_Addrs (device))
    {
      int target_state = 0;

      target_state = wsd_target_fcache_check_epr (&target_cache, device);

      if (target_state == WSD_TARGETCACHE_NEW)
        {
          printf ("\nDiscovered New Device %s \n>> ",
                  wsa_eprlist_elem_get_Addrs (device));
        }
    }
}

void
invalidate_device (struct soap *soap, struct wsa_eprlist_elem *device)
{
  if (device && wsa_eprlist_elem_get_Addrs (device))
    {
      int err = 0;

      err = wsd_target_fcache_invalidate_epr (&target_cache, device);

      if (err == SOAP_OK)
        {
          printf ("\nDevice removed %s \n>> ",
                  wsa_eprlist_elem_get_Addrs (device));
        }
    }
}



struct wsd_dis_hooks_t discovery_hooks = {
  new_device, invalidate_device
};
  
main ()
{

  /* ... */

  targets = wsa_eprlist_alloc_elem (10, &alist);
  wsa_fixedlist_head_init (&target_cache, 10, targets);

  if (dpws_init (&dpws, host) != SOAP_OK)
    {
      dpws_done (&dpws);
      exit (0);
    }

  if (dpws_init_implicit_discovery
      (&dpws, &discovery, &discovery_hooks) != SOAP_OK)
    {
      dpws_done (&dpws);
      exit (0);
    }

  /* ... */

}