Commit ba894d9b authored by zorglub's avatar zorglub
Browse files

Remove SLP (Closes:#434)

parent bad8db30
......@@ -4520,43 +4520,6 @@ then
fi
fi
dnl
dnl SLP access plugin
dnl
AC_ARG_ENABLE(slp,
[ --enable-slp SLP service discovery support (default disabled)])
if test "${enable_slp}" = "yes"
then
AC_ARG_WITH(slp,
[ --with-slp=PATH libslp headers and libraries])
if test -z "${with_slp}"
then
AC_CHECK_HEADERS(slp.h, have_slp="true", have_slp="false")
if test "${have_slp}" = "true"
then
VLC_ADD_PLUGINS([slp])
VLC_ADD_LDFLAGS([slp],[-lslp])
VLC_ADD_LDFLAGS([stream_out_standard],[-lslp])
fi
else
AC_MSG_CHECKING(for slp headers in ${with_slp})
if test -f ${with_slp}/slp.h
then
dnl Use ${with_slp}/libslp/slp.h
AC_MSG_RESULT(yes)
VLC_ADD_PLUGINS([slp])
VLC_ADD_LDFLAGS([slp],[-L${with_slp} -lslp])
VLC_ADD_LDFLAGS([stream_out_standard],[-L${with_slp} -lslp])
VLC_ADD_CPPFLAGS([slp],[-I${with_slp}])
AC_DEFINE(HAVE_SLP_H)
else
dnl No libslp could be found, sorry
AC_MSG_RESULT(no)
AC_MSG_ERROR([cannot find ${with_slp}/slp.h])
fi
fi
fi
dnl
dnl DAAP access plugin and services discovery
dnl
......
......@@ -257,7 +257,6 @@ struct session_descriptor_t
};
#define METHOD_TYPE_SAP 1
#define METHOD_TYPE_SLP 2
struct announce_method_t
{
......
SOURCES_stream_out_dummy = dummy.c
SOURCES_stream_out_description = description.c
SOURCES_stream_out_standard = standard.c \
announce.c \
announce.h
SOURCES_stream_out_standard = standard.c
SOURCES_stream_out_transcode = transcode.c
SOURCES_stream_out_duplicate = duplicate.c
SOURCES_stream_out_es = es.c
......
/*****************************************************************************
* announce.c : Session announcement
*****************************************************************************
* Copyright (C) 2002 the VideoLAN team
*
* Authors: Clment Stenac <zorglub@via.ecp.fr>
* Damien Lucas <nitrox@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
/*****************************************************************************
* Preamble
*****************************************************************************/
#include <stdlib.h> /* free() */
#include <errno.h> /* ENOMEM */
#include <stdio.h> /* sprintf() */
#include <vlc/vlc.h>
#include <vlc/sout.h>
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#ifdef WIN32
# include <winsock2.h>
# include <ws2tcpip.h>
# ifndef IN_MULTICAST
# define IN_MULTICAST(a) IN_CLASSD(a)
# endif
#else
# include <sys/socket.h>
#endif
#ifdef HAVE_SLP_H
# include <slp.h>
#endif
#include "announce.h"
#include "network.h"
#define DEFAULT_PORT 1234
#ifdef HAVE_SLP_H
/*****************************************************************************
* sout_SLPBuildName: Builds a service name according to SLP standard
*****************************************************************************/
static char * sout_SLPBuildName(char *psz_url,char *psz_name)
{
char *psz_service;
unsigned int i_size;
/* name to build is: service:vlc.services.videolan://$(url) */
i_size = 8 + 12 + 12 + 5 + strlen(psz_url) + 1;
psz_service=(char *)malloc(i_size * sizeof(char));
snprintf( psz_service , i_size,
"service:vlc.services.videolan://udp:@%s",
psz_url);
/* How piggy ! */
psz_service[i_size]='\0'; /* Just to make sure */
return psz_service;
}
/*****************************************************************************
* sout_SLPReport: Reporting function. Unused at the moment but needed
*****************************************************************************/
static void sout_SLPReport(SLPHandle slp_handle,SLPError slp_error,void* cookie)
{
}
#endif
/*****************************************************************************
* sout_SLPReg: Registers the program with SLP
*****************************************************************************/
int sout_SLPReg( sout_instance_t *p_sout, char * psz_url,
char * psz_name)
{
#ifdef HAVE_SLP_H
SLPHandle slp_handle;
SLPError slp_res;
char *psz_service= sout_SLPBuildName(psz_url,psz_name);
if( SLPOpen( NULL, SLP_FALSE, &slp_handle ) != SLP_OK)
{
msg_Warn(p_sout,"Unable to initialize SLP");
return -1;
}
msg_Info(p_sout , "Registering %s (name: %s) in SLP",
psz_service , psz_name);
slp_res = SLPReg ( slp_handle,
psz_service,
SLP_LIFETIME_MAXIMUM,
NULL,
psz_name,
SLP_TRUE,
sout_SLPReport,
NULL );
if( slp_res != SLP_OK )
{
msg_Warn(p_sout,"Error while registering service: %i", slp_res );
return -1;
}
return 0;
#else /* This function should never be called if this is false */
return -1;
#endif
}
/*****************************************************************************
* sout_SLDePReg: Unregisters the program from SLP
*****************************************************************************/
int sout_SLPDereg( sout_instance_t *p_sout, char * psz_url,
char * psz_name)
{
#ifdef HAVE_SLP_H
SLPHandle slp_handle;
SLPError slp_res;
char *psz_service= sout_SLPBuildName(psz_url,psz_name);
if( SLPOpen( NULL, SLP_FALSE, &slp_handle ) != SLP_OK)
{
msg_Warn(p_sout,"Unable to initialize SLP");
return -1;
}
msg_Info(p_sout , "Unregistering %s from SLP",
psz_service);
slp_res = SLPDereg ( slp_handle,
psz_service,
sout_SLPReport,
NULL );
if( slp_res != SLP_OK )
{
msg_Warn(p_sout,"Error while registering service: %i", slp_res );
return -1;
}
return 0;
#else /* This function should never be called if this is false */
return -1;
#endif
}
/*****************************************************************************
* announce.h : Session announcement
*****************************************************************************
* Copyright (C) 2002 the VideoLAN team
* $Id$
*
* Authors: Clément Stenac <zorglub@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
/*****************************************************************************
* Preamble
*****************************************************************************/
#ifdef HAVE_SLP_H
# include <slp.h>
#endif
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
/*****************************************************************************
* slp_session_t: SLP Session descriptor
*****************************************************************************/
struct slp_session_t
{
char *psz_url;
char *psz_name;
};
typedef struct slp_session_t slp_session_t;
/*****************************************************************************
* Prototypes
*****************************************************************************/
int sout_SLPReg (sout_instance_t *,char *,char *);
int sout_SLPDereg (sout_instance_t *,char *,char *);
......@@ -34,7 +34,6 @@
# include <unistd.h>
#endif
#include "announce.h"
#include "network.h"
/*****************************************************************************
......@@ -59,7 +58,7 @@
#define NAME_TEXT N_("Session name")
#define NAME_LONGTEXT N_( \
"Name of the session that will be announced with SAP or SLP" )
"Name of the session that will be announced with SAP" )
#define GROUP_TEXT N_("Session groupname")
#define GROUP_LONGTEXT N_( \
......@@ -68,9 +67,6 @@
#define SAP_TEXT N_("SAP announcing")
#define SAP_LONGTEXT N_("Announce this session with SAP")
#define SLP_TEXT N_("SLP announcing")
#define SLP_LONGTEXT N_("Announce this session with SLP")
static int Open ( vlc_object_t * );
static void Close ( vlc_object_t * );
......@@ -101,8 +97,6 @@ vlc_module_begin();
VLC_TRUE );
add_suppressed_bool( SOUT_CFG_PREFIX "sap-ipv6" );
add_bool( SOUT_CFG_PREFIX "slp", 0, NULL, SLP_TEXT, SLP_LONGTEXT, VLC_TRUE );
set_callbacks( Open, Close );
vlc_module_end();
......@@ -112,7 +106,7 @@ vlc_module_end();
*****************************************************************************/
static const char *ppsz_sout_options[] = {
"access", "mux", "url", "dst",
"sap", "name", "group", "slp", NULL
"sap", "name", "group", NULL
};
#define DEFAULT_PORT 1234
......@@ -124,7 +118,6 @@ static int Send( sout_stream_t *, sout_stream_id_t *, block_t* );
struct sout_stream_sys_t
{
sout_mux_t *p_mux;
slp_session_t *p_slp;
session_descriptor_t *p_session;
};
......@@ -135,7 +128,6 @@ static int Open( vlc_object_t *p_this )
{
sout_stream_t *p_stream = (sout_stream_t*)p_this;
sout_instance_t *p_sout = p_stream->p_sout;
slp_session_t *p_slp = NULL;
char *psz_mux;
char *psz_access;
......@@ -384,46 +376,11 @@ static int Open( vlc_object_t *p_this )
free( p_method );
}
/* *** Register with slp *** */
#ifdef HAVE_SLP_H
var_Get( p_stream, SOUT_CFG_PREFIX "slp", &val );
if( val.b_bool &&
( strstr( psz_access, "udp" ) || strstr( psz_access , "rtp" ) ) )
{
int i_ret;
msg_Info( p_this, "SLP Enabled");
var_Get( p_stream, SOUT_CFG_PREFIX "name", &val );
if( *val.psz_string )
{
i_ret = sout_SLPReg( p_sout, psz_url, val.psz_string );
}
else
{
i_ret = sout_SLPReg( p_sout, psz_url, psz_url );
}
if( i_ret )
{
msg_Warn( p_sout, "SLP Registering failed");
}
else
{
p_slp = malloc(sizeof(slp_session_t));
p_slp->psz_url = strdup( psz_url );
p_slp->psz_name =
strdup( *val.psz_string ? val.psz_string : psz_url );
}
free( val.psz_string );
}
#endif
p_stream->pf_add = Add;
p_stream->pf_del = Del;
p_stream->pf_send = Send;
p_stream->p_sys->p_mux = p_mux;
p_stream->p_sys->p_slp = p_slp;
if( psz_access ) free( psz_access );
if( psz_mux ) free( psz_mux );
......@@ -448,16 +405,6 @@ static void Close( vlc_object_t * p_this )
sout_AnnounceSessionDestroy( p_sys->p_session );
}
#ifdef HAVE_SLP_H
if( p_sys->p_slp )
{
sout_SLPDereg( (sout_instance_t *)p_this,
p_sys->p_slp->psz_url,
p_sys->p_slp->psz_name);
free( p_sys->p_slp);
}
#endif
sout_MuxDelete( p_sys->p_mux );
sout_AccessOutDelete( p_access );
......
......@@ -194,7 +194,7 @@ void sout_AnnounceSessionDestroy( session_descriptor_t *p_session )
/**
* Create and initialize an announcement method structure
*
* \param i_type METHOD_TYPE_SAP or METHOD_TYPE_SLP
* \param i_type METHOD_TYPE_SAP
* \return a new announce_method structure
*/
announce_method_t * sout_AnnounceMethodCreate( int i_type )
......@@ -287,11 +287,6 @@ int announce_Register( announce_handler_t *p_announce,
msg_Dbg( p_announce, "adding SAP session");
p_announce->p_sap->pf_add( p_announce->p_sap, p_session );
}
else if( p_method->i_type == METHOD_TYPE_SLP )
{
msg_Dbg( p_announce, "SLP unsupported at the moment" );
return VLC_EGENERIC;
}
else
{
msg_Dbg( p_announce, "Announce type unsupported" );
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment