Commit af2ecd8c authored by Ghislain MARY's avatar Ghislain MARY

Add CMakeLists.txt for daemon + use bctbx_list_t instead of MSList in the daemon.

parent 026b8b85
......@@ -40,6 +40,7 @@ option(ENABLE_SHARED "Build shared library." YES)
option(ENABLE_STATIC "Build static library." YES)
option(ENABLE_CONSOLE_UI "Turn on or off compilation of console interface." YES)
option(ENABLE_DATE "Use build date in internal version number." NO)
option(ENABLE_DAEMON "Enable the linphone daemon interface." YES)
option(ENABLE_DOC "Enable documentation generation with Doxygen." YES)
option(ENABLE_GTK_UI "Turn on or off compilation of gtk interface." YES)
option(ENABLE_LDAP "Enable LDAP support." NO)
......@@ -295,6 +296,9 @@ add_subdirectory(share)
if(ENABLE_CONSOLE_UI)
add_subdirectory(console)
endif()
if(ENABLE_DAEMON)
add_subdirectory(daemon)
endif()
if(ENABLE_GTK_UI)
add_subdirectory(gtk)
add_subdirectory(pixmaps)
......
############################################################################
# CMakeLists.txt
# Copyright (C) 2016 Belledonne Communications, Grenoble France
#
############################################################################
#
# 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-1307, USA.
#
############################################################################
set(DAEMON_SOURCE_FILES
commands/adaptive-jitter-compensation.cc
commands/adaptive-jitter-compensation.h
commands/answer.cc
commands/answer.h
commands/audio-codec-get.cc
commands/audio-codec-get.h
commands/audio-codec-move.cc
commands/audio-codec-move.h
commands/audio-codec-set.cc
commands/audio-codec-set.h
commands/audio-codec-toggle.cc
commands/audio-codec-toggle.h
commands/audio-stream-start.cc
commands/audio-stream-start.h
commands/audio-stream-stats.cc
commands/audio-stream-stats.h
commands/audio-stream-stop.cc
commands/audio-stream-stop.h
commands/auth-infos-clear.cc
commands/auth-infos-clear.h
commands/call.cc
commands/call.h
commands/call-mute.cc
commands/call-mute.h
commands/call-pause.cc
commands/call-pause.h
commands/call-resume.cc
commands/call-resume.h
commands/call-stats.cc
commands/call-stats.h
commands/call-status.cc
commands/call-status.h
commands/call-transfer.cc
commands/call-transfer.h
commands/cn.cc
commands/cn.h
commands/conference.cc
commands/conference.h
commands/config.cc
commands/configcommand.h
commands/contact.cc
commands/contact.h
commands/dtmf.cc
commands/dtmf.h
commands/firewall-policy.cc
commands/firewall-policy.h
commands/help.cc
commands/help.h
commands/ipv6.cc
commands/ipv6.h
commands/jitterbuffer.cc
commands/jitterbuffer.h
commands/media-encryption.cc
commands/media-encryption.h
commands/msfilter-add-fmtp.cc
commands/msfilter-add-fmtp.h
commands/netsim.cc
commands/netsim.h
commands/play-wav.cc
commands/play-wav.h
commands/pop-event.cc
commands/pop-event.h
commands/port.cc
commands/port.h
commands/ptime.cc
commands/ptime.h
commands/quit.cc
commands/quit.h
commands/register.cc
commands/register.h
commands/register-status.cc
commands/register-status.h
commands/terminate.cc
commands/terminate.h
commands/unregister.cc
commands/unregister.h
commands/version.cc
commands/version.h
commands/video.cc
commands/video.h
daemon.cc
daemon.h
)
set(DAEMON_PIPETEST_SOURCE_FILES
daemon-pipetest.c
)
apply_compile_flags(DAEMON_SOURCE_FILES "CPP" "CXX")
apply_compile_flags(DAEMON_PIPETEST_SOURCE_FILES "CPP" "C")
add_executable(linphone-daemon ${DAEMON_SOURCE_FILES})
target_include_directories(linphone-daemon PRIVATE ${CMAKE_CURRENT_LIST_DIR})
target_link_libraries(linphone-daemon linphone)
add_executable(linphone-daemon-pipetest ${DAEMON_PIPETEST_SOURCE_FILES})
target_link_libraries(linphone-daemon-pipetest linphone)
set(INSTALL_TARGETS linphone-daemon linphone-daemon-pipetest)
install(TARGETS ${INSTALL_TARGETS}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
)
......@@ -54,7 +54,7 @@ void AudioCodecGetCommand::exec(Daemon *app, const char *args) {
}
int index = 0;
for (const MSList *node = linphone_core_get_audio_codecs(app->getCore()); node != NULL; node = ms_list_next(node)) {
for (const bctbx_list_t *node = linphone_core_get_audio_codecs(app->getCore()); node != NULL; node = bctbx_list_next(node)) {
PayloadType *payload = reinterpret_cast<PayloadType*>(node->data);
if (list) {
ost << PayloadTypeResponse(app->getCore(), payload, index).getBody() << "\n";
......
......@@ -65,21 +65,21 @@ void AudioCodecMoveCommand::exec(Daemon *app, const char *args) {
}
int i = 0;
MSList *mslist = NULL;
for (const MSList *node = linphone_core_get_audio_codecs(app->getCore()); node != NULL; node = ms_list_next(node)) {
bctbx_list_t *mslist = NULL;
for (const bctbx_list_t *node = linphone_core_get_audio_codecs(app->getCore()); node != NULL; node = bctbx_list_next(node)) {
PayloadType *payload = reinterpret_cast<PayloadType*>(node->data);
if (i == index) {
mslist = ms_list_append(mslist, selected_payload);
mslist = bctbx_list_append(mslist, selected_payload);
++i;
}
if (selected_payload != payload) {
mslist = ms_list_append(mslist, payload);
mslist = bctbx_list_append(mslist, payload);
++i;
}
}
if (i <= index) {
index = i;
mslist = ms_list_append(mslist, selected_payload);
mslist = bctbx_list_append(mslist, selected_payload);
}
linphone_core_set_audio_codecs(app->getCore(), mslist);
......
......@@ -49,7 +49,7 @@ AudioCodecSetCommand::AudioCodecSetCommand() :
static PayloadType *findPayload(LinphoneCore *lc, int payload_type, int *index){
if (index) *index=0;
for (const MSList *node = linphone_core_get_audio_codecs(lc); node != NULL; node = ms_list_next(node)) {
for (const bctbx_list_t *node = linphone_core_get_audio_codecs(lc); node != NULL; node = bctbx_list_next(node)) {
PayloadType *payload = reinterpret_cast<PayloadType*>(node->data);
if (index) (*index)++;
if (payload_type == linphone_core_get_payload_type_number(lc, payload)) {
......
......@@ -24,7 +24,7 @@ void AudioCodecToggleCommand::exec(Daemon *app, const char *args) {
if (!parser.all()) pt = parser.getPayloadType();
int index = 0;
for (const MSList *node = linphone_core_get_audio_codecs(app->getCore()); node != NULL; node = ms_list_next(node)) {
for (const bctbx_list_t *node = linphone_core_get_audio_codecs(app->getCore()); node != NULL; node = bctbx_list_next(node)) {
PayloadType *payload = reinterpret_cast<PayloadType*>(node->data);
if (parser.all()) {
linphone_core_enable_payload_type(app->getCore(), payload, mEnable);
......
......@@ -20,10 +20,13 @@ void DtmfCommand::exec(Daemon *app, const char *args) {
if (ist.fail()) {
app->sendResponse(Response("Missing digit parameter.", Response::Error));
} else {
digit = digit_str.at(0);
digit = digit_str.at(0);
if (isdigit(digit) || (digit == 'A') || (digit == 'B') || (digit == 'C') || (digit == 'D') || (digit == '*') || (digit == '#')) {
LinphoneCall *call = linphone_core_get_current_call(app->getCore());
linphone_core_play_dtmf(app->getCore(), digit, 100);
linphone_core_send_dtmf(app->getCore(), digit);
if (call == NULL) {
linphone_call_send_dtmf(call, digit);
}
app->sendResponse(Response());
} else {
app->sendResponse(Response("Incorrect digit parameter.", Response::Error));
......
......@@ -10,15 +10,17 @@
static int running=1;
int main(int argc, char *argv[]){
struct pollfd pfds[2]={{0}};
char buf[4096];
int fd;
/* handle args */
if (argc < 2) {
ortp_error("Usage: %s pipename", argv[0]);
return 1;
}
int fd=ortp_client_pipe_connect(argv[1]);
struct pollfd pfds[2]={{0}};
char buf[4096];
fd=ortp_client_pipe_connect(argv[1]);
ortp_init();
ortp_set_log_level_mask(NULL,ORTP_MESSAGE|ORTP_WARNING|ORTP_ERROR|ORTP_FATAL);
......
......@@ -251,9 +251,9 @@ PayloadTypeParser::PayloadTypeParser(LinphoneCore *core, const string &mime_type
return;
}
mPayloadType = linphone_core_find_payload_type(core, type, rate, channels);
if (mPayloadType) mPosition=ms_list_index(linphone_core_get_audio_codecs(core), mPayloadType);
if (mPayloadType) mPosition=bctbx_list_index(linphone_core_get_audio_codecs(core), mPayloadType);
}else if (number!=-1){
const MSList *elem;
const bctbx_list_t *elem;
for(elem=linphone_core_get_audio_codecs(core);elem!=NULL;elem=elem->next){
if (number==linphone_core_get_payload_type_number(core,(PayloadType*)elem->data)){
mPayloadType=(PayloadType*)elem->data;
......@@ -355,7 +355,7 @@ int Daemon::updateCallId(LinphoneCall *call) {
}
LinphoneCall *Daemon::findCall(int id) {
const MSList *elem = linphone_core_get_calls(mLc);
const bctbx_list_t *elem = linphone_core_get_calls(mLc);
for (; elem != NULL; elem = elem->next) {
LinphoneCall *call = (LinphoneCall *) elem->data;
if (linphone_call_get_user_pointer(call) == (void*) (long) id)
......@@ -374,7 +374,7 @@ int Daemon::updateProxyId(LinphoneProxyConfig *cfg) {
}
LinphoneProxyConfig *Daemon::findProxy(int id) {
const MSList *elem = linphone_core_get_proxy_config_list(mLc);
const bctbx_list_t *elem = linphone_core_get_proxy_config_list(mLc);
for (; elem != NULL; elem = elem->next) {
LinphoneProxyConfig *proxy = (LinphoneProxyConfig *) elem->data;
if (linphone_proxy_config_get_user_data(proxy) == (void*) (long) id)
......@@ -384,8 +384,8 @@ LinphoneProxyConfig *Daemon::findProxy(int id) {
}
LinphoneAuthInfo *Daemon::findAuthInfo(int id) {
const MSList *elem = linphone_core_get_auth_info_list(mLc);
if (elem == NULL || id < 1 || (unsigned int)id > ms_list_size(elem)) {
const bctbx_list_t *elem = linphone_core_get_auth_info_list(mLc);
if (elem == NULL || id < 1 || (unsigned int)id > bctbx_list_size(elem)) {
return NULL;
}
while (id > 1) {
......
......@@ -5,6 +5,7 @@
#include <linphonecore_utils.h>
#include <mediastreamer2/mediastream.h>
#include <mediastreamer2/mscommon.h>
#include <bctoolbox/list.h>
#include <string>
#include <list>
......@@ -212,7 +213,7 @@ public:
int updateCallId(LinphoneCall *call);
int updateProxyId(LinphoneProxyConfig *proxy);
inline int maxProxyId() { return mProxyIds; }
inline int maxAuthInfoId() { return ms_list_size(linphone_core_get_auth_info_list(mLc)); }
inline int maxAuthInfoId() { return bctbx_list_size(linphone_core_get_auth_info_list(mLc)); }
int updateAudioStreamId(AudioStream *audio_stream);
void dumpCommandsHelp();
void dumpCommandsHelpHtml();
......
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