Beispiel #1
0
Datei: dbus.c Projekt: etix/vlc
/**
 * MPRISEntryPoint() routes incoming messages to their respective interface
 * implementation.
 *
 * This function is called during dbus_connection_dispatch()
 */
static DBusHandlerResult
MPRISEntryPoint ( DBusConnection *p_conn, DBusMessage *p_from, void *p_this )
{
    const char *psz_target_interface;
    const char *psz_interface = dbus_message_get_interface( p_from );
    const char *psz_method    = dbus_message_get_member( p_from );

    DBusError error;

    if( psz_interface && strcmp( psz_interface, DBUS_INTERFACE_PROPERTIES ) )
        psz_target_interface = psz_interface;

    else
    {
        dbus_error_init( &error );
        dbus_message_get_args( p_from, &error,
                               DBUS_TYPE_STRING, &psz_target_interface,
                               DBUS_TYPE_INVALID );

        if( dbus_error_is_set( &error ) )
        {
            msg_Err( (vlc_object_t*) p_this, "D-Bus error on %s.%s: %s",
                                             psz_interface, psz_method,
                                             error.message );
            dbus_error_free( &error );
            return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
        }
    }

    if( !strcmp( psz_target_interface, DBUS_INTERFACE_INTROSPECTABLE ) )
        return handle_introspect( p_conn, p_from, p_this );

    if( !strcmp( psz_target_interface, DBUS_MPRIS_ROOT_INTERFACE ) )
        return handle_root( p_conn, p_from, p_this );

    if( !strcmp( psz_target_interface, DBUS_MPRIS_PLAYER_INTERFACE ) )
        return handle_player( p_conn, p_from, p_this );

    if( !strcmp( psz_target_interface, DBUS_MPRIS_TRACKLIST_INTERFACE ) )
        return handle_tracklist( p_conn, p_from, p_this );

    return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
}
	void handler::handleRequest(fastcgi::Request* req, fastcgi::HandlerContext* context) {
		fastcgi::RequestStream stream(req);
		if(req->getURI() == std::string("/")) {
			handle_root(req, context);
		}
		else if(req->getURI() == std::string("/test")) {
		}
		else {
			handle_wrong_uri(req, context);
		}

		stream << "Hello, World!!!" << std::endl;
		stream << "getUrl: " << req->getUrl() << std::endl;
		stream << "countArgs: " << req->countArgs() << std::endl;
		stream << "getQueryString " << req->getQueryString() << std::endl;
		stream << "getRequestMethod " << req->getRequestMethod() << std::endl;
		stream << "getURI " << req->getURI() << std::endl;
		stream << "getPathInfo " << req->getPathInfo() << std::endl;
		stream << "countHeaders " << req->countHeaders() << std::endl;
		stream << "countCookie " << req->countCookie() << std::endl;
	}