Ejemplo n.º 1
0
static int get_volume_dbrange(struct action_event *event) {
	// Ignoring instanceID and Channel
	char minval[16];
	snprintf(minval, sizeof(minval), "%lld", volume_db_range.min);
	upnp_add_response(event, "MinValue", minval);
	upnp_add_response(event, "MaxValue", "0");
	return 0;
}
Ejemplo n.º 2
0
static bool
cms_get_current_connection_info (struct action_event_t *event)
{
  extern struct mime_type_t MIME_Type_List[];
  struct mime_type_t *list = MIME_Type_List;

  if (!event)
    return false;

  upnp_add_response (event, SERVICE_CMS_ARG_CONNECTION_ID,
                     SERVICE_CMS_DEFAULT_CON_ID);
  upnp_add_response (event, SERVICE_CMS_ARG_RCS_ID, SERVICE_CMS_UNKNOW_ID);
  upnp_add_response (event, SERVICE_CMS_ARG_TRANSPORT_ID,
                     SERVICE_CMS_UNKNOW_ID);

  while (list->extension)
  {
    char *protocol = mime_get_protocol (list);
    upnp_add_response (event, SERVICE_CMS_ARG_PROT_INFO, protocol);
    free (protocol);
    list++;
  }

  upnp_add_response (event, SERVICE_CMS_ARG_PEER_CON_MANAGER, "");
  upnp_add_response (event, SERVICE_CMS_ARG_PEER_CON_ID,
                     SERVICE_CMS_UNKNOW_ID);
  upnp_add_response (event, SERVICE_CMS_ARG_DIRECTION, SERVICE_CMS_OUTPUT);
  upnp_add_response (event, SERVICE_CMS_ARG_STATUS, SERVICE_CMS_STATUS_OK);

  return event->status;
}
Ejemplo n.º 3
0
static bool
cds_get_sort_capabilities (struct action_event_t *event)
{
  upnp_add_response (event, SERVICE_CDS_ARG_SORT_CAPS, "");

  return event->status;
}
Ejemplo n.º 4
0
int upnp_append_variable(struct action_event *event,
			 int varnum, char *paramname)
{
	char *value;
	struct service *service = event->service;
	int retval = -1;

	ENTER();

	if (varnum >= service->variable_count) {
		upnp_set_error(event, UPNP_E_INTERNAL_ERROR,
			       "Internal Error - illegal variable number %d",
			       varnum);
		goto out;
	}

	ithread_mutex_lock(service->service_mutex);

	value = (char *) service->variable_values[varnum];
	if (value == NULL) {
		upnp_set_error(event, UPNP_E_INTERNAL_ERROR,
			       "Internal Error");
	} else {
		retval = upnp_add_response(event, paramname, value);
	}

	ithread_mutex_unlock(service->service_mutex);
out:
	LEAVE();
	return retval;
}
Ejemplo n.º 5
0
static bool
cms_get_protocol_info (struct action_event_t *event)
{
  extern struct mime_type_t MIME_Type_List[];
  struct mime_type_t *list;
  char *respText = NULL, *respPtr;
  size_t respLen = 0, len;

  if (!event)
    return false;

  // calculating length of response
  list = MIME_Type_List;
  while (list->extension)
  {
    char *protocol = mime_get_protocol (list);
    respLen += strlen (protocol) + 1;
    free (protocol);
    list++;
  }

  respText = (char*) malloc (respLen * sizeof (char));
  if (!respText)
    return event->status;

  list = MIME_Type_List;
  respPtr = respText;
  while (list->extension)
  {
    char *protocol = mime_get_protocol (list);
    len = strlen (protocol);
    strncpy (respPtr, protocol, len);
    free (protocol);
    respPtr += len;
    list++;
    if (list->extension)
      strcpy (respPtr++, ",");
  }
  *respPtr = '\0';

  upnp_add_response (event, SERVICE_CMS_ARG_SOURCE, respText);
  upnp_add_response (event, SERVICE_CMS_ARG_SINK, "");

  free (respText);
  return event->status;
}
Ejemplo n.º 6
0
static bool
cds_get_system_update_id (struct action_event_t *event)
{
  upnp_add_response (event, SERVICE_CDS_ARG_UPDATE_ID,
                     SERVICE_CDS_ROOT_OBJECT_ID);

  return event->status;
}
Ejemplo n.º 7
0
static bool
cms_get_current_connection_ids (struct action_event_t *event)
{
  if (!event)
    return false;

  upnp_add_response (event, SERVICE_CMS_ARG_CONNECTION_IDS, "");

  return event->status;
}
Ejemplo n.º 8
0
static bool
msr_is_validated (struct action_event_t *event)
{
  if (!event)
    return false;

  /* send a fake validation to these stupid MS players ;-) */
  upnp_add_response (event, SERVICE_MSR_ARG_RESULT, SERVICE_MSR_STATUS_OK);

  return event->status;
}
Ejemplo n.º 9
0
void upnp_append_variable(struct action_event *event,
                          int varnum, const char *paramname)
{
	const char *value;
	struct service *service = event->service;

	assert(event != NULL);
	assert(paramname != NULL);

	ithread_mutex_lock(service->service_mutex);

	value = VariableContainer_get(service->variable_container, varnum, NULL);
	assert(value != NULL);   // triggers on invalid variable.
	upnp_add_response(event, paramname, value);

	ithread_mutex_unlock(service->service_mutex);
}
Ejemplo n.º 10
0
int upnp_append_variable(struct action_event *event,
			 int varnum, const char *paramname)
{
	const char *value;
	struct service *service = event->service;
	int retval = -1;

	//ENTER();

	assert(event != NULL);
	assert(paramname != NULL);

	if (varnum >= service->variable_count) {
#ifdef HAVE_LIBUPNP
		upnp_set_error(event, UPNP_E_INTERNAL_ERROR,
			       "Internal Error - illegal variable number %d",
			       varnum);
#endif
		goto out;
	}

#ifdef HAVE_LIBUPNP
	ithread_mutex_lock(service->service_mutex);
#endif

#if 0
	fprintf(stderr, "\tHZ: %s = '%s'\n", service->variable_names[varnum],
		service->variable_values[varnum]);
#endif
	value = service->variable_values[varnum];
	assert(value != NULL);
	retval = upnp_add_response(event, paramname, value);

#ifdef HAVE_LIBUPNP
	ithread_mutex_unlock(service->service_mutex);
#endif
out:
	//LEAVE();
	return retval;
}