Move the new sal code in the src folder, respect the file naming conventions and add missing license headers.

This commit is contained in:
Ghislain MARY 2017-10-05 10:52:09 +02:00
parent 9b6d115836
commit 6beb962517
38 changed files with 508 additions and 385 deletions

View file

@ -44,7 +44,6 @@ list(APPEND LINPHONE_PRIVATE_HEADER_FILES
offeranswer.h
private.h
quality_reporting.h
sal/sal.h
sqlite3_bctbx_vfs.h
vcard_private.h
xml2lpc.h
@ -99,7 +98,6 @@ set(LINPHONE_SOURCE_FILES_C
quality_reporting.c
remote_provisioning.c
ringtoneplayer.c
sal/sal.c
siplogin.c
sipsetup.c
sqlite3_bctbx_vfs.c
@ -111,13 +109,6 @@ set(LINPHONE_SOURCE_FILES_C
)
set(LINPHONE_SOURCE_FILES_CXX
conference.cc
sal/call_op.cpp
sal/event_op.cpp
sal/message_op.cpp
sal/presence_op.cpp
sal/register_op.cpp
sal/sal.cpp
sal/sal_op.cpp
tester_utils.cpp
)
set(LINPHONE_INCLUDE_DIRS ${LINPHONE_INCLUDE_DIRS})

View file

@ -24,7 +24,7 @@
#include "linphone/core.h"
#include "linphone/lpconfig.h"
#include "sal/sal.hpp"
#include "sal/sal.h"
#include "c-wrapper/c-wrapper.h"

View file

@ -20,7 +20,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#ifndef SAL_IMPL_H_
#define SAL_IMPL_H_
#include "sal/sal.h"
#include "c-wrapper/internal/c-sal.h"
#include "belle-sip/belle-sip.h"
#include "belle-sip/belle-sdp.h"

View file

@ -17,7 +17,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "sal_impl.h"
#include "sal/sal.hpp"
#include "sal/sal.h"
using namespace LinphonePrivate;

View file

@ -18,9 +18,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "sal/sal.h"
#include "sal/call_op.h"
#include "sal/message_op.h"
#include "c-wrapper/internal/c-sal.h"
#include "sal/call-op.h"
#include "sal/message-op.h"
#include "linphone/core.h"
#include "private.h"

View file

@ -19,7 +19,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "linphone/event.h"
#include "linphone/lpconfig.h"
#include "sal/event_op.h"
#include "sal/event-op.h"
#include "c-wrapper/c-wrapper.h"

View file

@ -17,8 +17,8 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "c-wrapper/internal/c-sal.h"
#include "sal/sal.h"
#include "sal/sal.hpp"
#include "offeranswer.h"
#include "private.h"

View file

@ -31,12 +31,12 @@
#include "linphone/tunnel.h"
#include "linphone/core_utils.h"
#include "linphone/conference.h"
#include "sal/sal.h"
#include "sal/call_op.h"
#include "sal/event_op.h"
#include "sal/message_op.h"
#include "sal/presence_op.h"
#include "sal/register_op.h"
#include "c-wrapper/internal/c-sal.h"
#include "sal/call-op.h"
#include "sal/event-op.h"
#include "sal/message-op.h"
#include "sal/presence-op.h"
#include "sal/register-op.h"
#include "linphone/sipsetup.h"
#include "quality_reporting.h"
#include "linphone/ringtoneplayer.h"

View file

@ -23,8 +23,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "linphone/core.h"
#include "private.h"
#include "c-wrapper/internal/c-sal.h"
#include "sal/sal.h"
#include "sal/sal.hpp"
#include "ortp/rtpsession.h"
#include <math.h>

View file

@ -21,7 +21,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#define quality_reporting_h
#include "linphone/core.h"
#include "sal/sal.h"
#include "c-wrapper/internal/c-sal.h"
#ifdef __cplusplus
extern "C"{

View file

@ -1,47 +0,0 @@
/*
message_op.h
Copyright (C) 2017 Belledonne Communications <info@belledonne-communications.com>
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _SAL_MASSAGE_OP_H_
#define _SAL_MASSAGE_OP_H_
#include "sal_op.h"
#include "message_op_interface.h"
LINPHONE_BEGIN_NAMESPACE
class SalMessageOp: public SalOp, public SalMessageOpInterface {
public:
SalMessageOp(Sal *sal): SalOp(sal) {}
int send_message(const char *from, const char *to, const char* content_type, const char *msg, const char *peer_uri) override;
int reply(SalReason reason) override {return SalOp::reply_message(reason);}
private:
virtual void fill_cbs() override;
void process_error();
static void process_io_error_cb(void *user_ctx, const belle_sip_io_error_event_t *event);
static void process_response_event_cb(void *op_base, const belle_sip_response_event_t *event);
static void process_timeout_cb(void *user_ctx, const belle_sip_timeout_event_t *event);
static void process_request_event_cb(void *op_base, const belle_sip_request_event_t *event);
};
LINPHONE_END_NAMESPACE
#endif

View file

@ -1,38 +0,0 @@
/*
message_op_interface.h
Copyright (C) 2017 Belledonne Communications <info@belledonne-communications.com>
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _SAL_MESSAGE_OP_INTERFACE_H_
#define _SAL_MESSAGE_OP_INTERFACE_H_
LINPHONE_BEGIN_NAMESPACE
class SalMessageOpInterface {
public:
virtual ~SalMessageOpInterface() = default;
int send_message(const char *from, const char *to, const char *msg) {return send_message(from,to,"text/plain",msg, nullptr);}
virtual int send_message(const char *from, const char *to, const char* content_type, const char *msg, const char *peer_uri) = 0;
virtual int reply(SalReason reason) = 0;
protected:
void prepare_message_request(belle_sip_request_t *req, const char* content_type, const char *msg, const char *peer_uri);
};
LINPHONE_END_NAMESPACE
#endif

View file

@ -1,43 +0,0 @@
/*
register_op.h
Copyright (C) 2017 Belledonne Communications <info@belledonne-communications.com>
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _SAL_REGISTER_OP_H_
#define _SAL_REGISTER_OP_H_
#include "sal_op.h"
LINPHONE_BEGIN_NAMESPACE
class SalRegisterOp: public SalOp {
public:
SalRegisterOp(Sal *sal): SalOp(sal) {}
int register_(const char *proxy, const char *from, int expires, const SalAddress* old_contact);
int register_refresh(int expires) {return this->refresher ? belle_sip_refresher_refresh(this->refresher,expires) : -1;}
int unregister() {return register_refresh(0);}
virtual void authenticate(const SalAuthInfo *info) override {register_refresh(-1);}
private:
virtual void fill_cbs() override {};
static void register_refresher_listener(belle_sip_refresher_t* refresher, void* user_pointer, unsigned int status_code, const char* reason_phrase, int will_retry);
};
LINPHONE_END_NAMESPACE
#endif

View file

@ -23,7 +23,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "account_creator_private.h"
#include "linphone/core.h"
#include "linphone/tunnel.h"
#include "sal/sal.h"
#include "c-wrapper/internal/c-sal.h"
#include <sqlite3.h>
#include "quality_reporting.h"
#include "vcard_private.h"

View file

@ -26,7 +26,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "linphone/wrapper_utils.h"
#include "c-wrapper/c-wrapper.h"
#include "sal/sal.h"
#include "c-wrapper/internal/c-sal.h"
#include "vcard_private.h"
#define VCARD_MD5_HASH_SIZE 16

View file

@ -25,6 +25,7 @@ set(LINPHONE_CXX_OBJECTS_PRIVATE_HEADER_FILES
address/address.h
c-wrapper/c-wrapper.h
c-wrapper/internal/c-tools.h
c-wrapper/internal/c-sal.h
call/call-listener.h
call/call-p.h
call/call.h
@ -96,6 +97,7 @@ set(LINPHONE_CXX_OBJECTS_PRIVATE_HEADER_FILES
object/object.h
object/property-container.h
object/singleton.h
sal/sal.h
utils/payload-type-handler.h
variant/variant.h
xml/conference-info.h
@ -116,6 +118,7 @@ set(LINPHONE_CXX_OBJECTS_SOURCE_FILES
c-wrapper/api/c-chat-room-cbs.cpp
c-wrapper/api/c-event-log.cpp
c-wrapper/api/c-participant.cpp
c-wrapper/internal/c-sal.cpp
call/call.cpp
chat/basic-chat-room.cpp
chat/chat-message.cpp
@ -162,6 +165,13 @@ set(LINPHONE_CXX_OBJECTS_SOURCE_FILES
object/clonable-object.cpp
object/object.cpp
object/property-container.cpp
sal/call-op.cpp
sal/event-op.cpp
sal/message-op.cpp
sal/op.cpp
sal/presence-op.cpp
sal/register-op.cpp
sal/sal.cpp
utils/general.cpp
utils/payload-type-handler.cpp
utils/utils.cpp

View file

@ -23,7 +23,7 @@ This file contains SAL API functions that do not depend on the underlying implem
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "sal/sal.h"
#include "c-wrapper/internal/c-sal.h"
#include <ctype.h>

View file

@ -27,7 +27,7 @@
#include "content/content.h"
#include "chat-message-p.h"
#include "chat-room.h"
#include "sal/message_op.h"
#include "sal/message-op.h"
#include "logger/logger.h"
// =============================================================================

View file

@ -22,8 +22,8 @@
#include "object/clonable-object.h"
#include "linphone/types.h"
#include "c-wrapper/internal/c-sal.h"
#include "sal/sal.h"
#include "sal/sal.hpp"
// =============================================================================

View file

@ -22,7 +22,7 @@
#include "object/object-p.h"
#include "call-session.h"
#include "sal/call_op.h"
#include "sal/call-op.h"
// =============================================================================

View file

@ -24,7 +24,7 @@
#include "conference/conference.h"
#include "conference/params/call-session-params.h"
#include "conference/session/call-session-listener.h"
#include "sal/call_op.h"
#include "sal/call-op.h"
// =============================================================================

View file

@ -1,6 +1,25 @@
#include "call_op.h"
/*
* call-op.cpp
* Copyright (C) 2017 Belledonne Communications SARL
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*/
#include "bellesip_sal/sal_impl.h"
#include "offeranswer.h"
#include "sal/call-op.h"
#include <bctoolbox/defs.h>
#include <belle-sip/provider.h>

View file

@ -1,27 +1,26 @@
/*
sal_op.h
Copyright (C) 2017 Belledonne Communications <info@belledonne-communications.com>
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
* call-op.h
* Copyright (C) 2017 Belledonne Communications SARL
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*/
#ifndef _SAL_CALL_OP_H_
#define _SAL_CALL_OP_H_
#include "sal_op.h"
#include "message_op_interface.h"
#include "sal/op.h"
#include "sal/message-op-interface.h"
LINPHONE_BEGIN_NAMESPACE
@ -29,15 +28,15 @@ class SalCallOp: public SalOp, public SalMessageOpInterface {
public:
SalCallOp(Sal *sal): SalOp(sal) {}
~SalCallOp() override;
int set_local_media_description(SalMediaDescription *desc);
int set_local_body(const Content &body);
int set_local_body(const Content &&body);
SalMediaDescription *get_remote_media_description() {return this->remote_media;}
const Content &get_remote_body() const {return this->remote_body;}
SalMediaDescription *get_final_media_description();
int call(const char *from, const char *to, const char *subject);
int notify_ringing(bool_t early_media);
int accept();
@ -63,7 +62,7 @@ public:
const char *get_remote_tag() {return belle_sip_dialog_get_remote_tag(this->dialog);}
void set_replaces(const char *call_id, const char *from_tag, const char *to_tag);
void set_sdp_handling(SalOpSDPHandling handling);
// Implementation of SalMessageOpInterface
int send_message(const char *from, const char *to, const char* content_type, const char *msg, const char *peer_uri) override;
int reply(SalReason reason) override {return SalOp::reply_message(reason);}
@ -71,18 +70,18 @@ public:
private:
virtual void fill_cbs() override;
void set_released();
void set_error(belle_sip_response_t* response, bool_t fatal);
void call_terminated(belle_sip_server_transaction_t* server_transaction, int status_code, belle_sip_request_t* cancel_request);
void reset_descriptions();
int parse_sdp_body(const Content &body,belle_sdp_session_description_t** session_desc, SalReason *error);
void sdp_process();
void handle_body_from_response(belle_sip_response_t* response);
SalReason process_body_for_invite(belle_sip_request_t* invite);
SalReason process_body_for_ack(belle_sip_request_t *ack);
void handle_offer_answer_response(belle_sip_response_t* response);
void fill_invite(belle_sip_request_t* invite);
void cancelling_invite(const SalErrorInfo *info);
int refer_to(belle_sip_header_refer_to_t* refer_to, belle_sip_header_referred_by_t* referred_by);
@ -90,7 +89,7 @@ private:
void notify_last_response(SalCallOp *newcall);
void process_refer(const belle_sip_request_event_t *event, belle_sip_server_transaction_t *server_transaction);
void process_notify(const belle_sip_request_event_t *event, belle_sip_server_transaction_t* server_transaction);
static void set_addr_to_0000(char value[], size_t sz);
static int is_media_description_acceptable(SalMediaDescription *md);
static bool_t is_a_pending_invite_incoming_transaction(belle_sip_transaction_t *tr);
@ -99,14 +98,14 @@ private:
static belle_sip_header_reason_t *make_reason_header( const SalErrorInfo *info);
static belle_sip_header_allow_t *create_allow(bool_t enable_update);
static std::vector<char> marshal_media_description(belle_sdp_session_description_t *session_desc, belle_sip_error_code &error);
// belle_sip_message handlers
static int set_custom_body(belle_sip_message_t *msg, const Content &body);
static int set_sdp(belle_sip_message_t *msg,belle_sdp_session_description_t* session_desc);
static int set_sdp_from_desc(belle_sip_message_t *msg, const SalMediaDescription *desc);
static void process_io_error_cb(void *user_ctx, const belle_sip_io_error_event_t *event);
static Content extract_body(belle_sip_message_t *message);
// Callbacks
static int vfu_retry_cb (void *user_data, unsigned int events);
static void process_response_cb(void *op_base, const belle_sip_response_event_t *event);
@ -114,10 +113,10 @@ private:
static void process_transaction_terminated_cb(void *user_ctx, const belle_sip_transaction_terminated_event_t *event);
static void process_request_event_cb(void *op_base, const belle_sip_request_event_t *event);
static void process_dialog_terminated_cb(void *ctx, const belle_sip_dialog_terminated_event_t *event);
// Private constants
static const size_t SIP_MESSAGE_BODY_LIMIT = 16*1024; // 16kB
// Attributes
SalMediaDescription *local_media = NULL;
SalMediaDescription *remote_media = NULL;
@ -127,4 +126,4 @@ private:
LINPHONE_END_NAMESPACE
#endif
#endif // ifndef _SAL_CALL_OP_H_

View file

@ -1,4 +1,22 @@
#include "event_op.h"
/*
* event-op.cpp
* Copyright (C) 2017 Belledonne Communications SARL
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*/
#include "sal/event-op.h"
using namespace std;

View file

@ -1,38 +1,37 @@
/*
event_op.h
Copyright (C) 2017 Belledonne Communications <info@belledonne-communications.com>
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
* event-op.h
* Copyright (C) 2017 Belledonne Communications SARL
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*/
#ifndef _SAL_EVENT_OP_H_
#define _SAL_EVENT_OP_H_
#include "sal_op.h"
#include "sal/op.h"
LINPHONE_BEGIN_NAMESPACE
class SalEventOp: public SalOp {
public:
SalEventOp(Sal *sal): SalOp(sal) {}
SalEventOp(Sal *sal): SalOp(sal) {}
};
class SalSubscribeOp: public SalEventOp {
public:
SalSubscribeOp(Sal *sal): SalEventOp(sal) {}
int subscribe(const char *from, const char *to, const char *eventname, int expires, const SalBodyHandler *body_handler);
int unsubscribe() {return SalOp::unsubscribe();}
int accept();
@ -44,7 +43,7 @@ public:
private:
virtual void fill_cbs() override;
void handle_notify(belle_sip_request_t *req, const char *eventname, SalBodyHandler* body_handler);
static void subscribe_process_io_error_cb(void *user_ctx, const belle_sip_io_error_event_t *event);
static void subscribe_response_event_cb(void *op_base, const belle_sip_response_event_t *event);
static void subscribe_process_timeout_cb(void *user_ctx, const belle_sip_timeout_event_t *event);
@ -57,18 +56,18 @@ private:
class SalPublishOp: public SalEventOp {
public:
SalPublishOp(Sal *sal): SalEventOp(sal) {}
SalPublishOp(Sal *sal): SalEventOp(sal) {}
int publish(const char *from, const char *to, const char *eventname, int expires, const SalBodyHandler *body_handler);
int unpublish();
private:
virtual void fill_cbs() override;
static void publish_response_event_cb(void *userctx, const belle_sip_response_event_t *event);
static void publish_refresher_listener_cb (belle_sip_refresher_t* refresher,void* user_pointer,unsigned int status_code,const char* reason_phrase, int will_retry);
};
LINPHONE_END_NAMESPACE
#endif
#endif // ifndef _SAL_EVENT_OP_H_

View file

@ -0,0 +1,38 @@
/*
* message-op-interface.h
* Copyright (C) 2017 Belledonne Communications SARL
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*/
#ifndef _SAL_MESSAGE_OP_INTERFACE_H_
#define _SAL_MESSAGE_OP_INTERFACE_H_
LINPHONE_BEGIN_NAMESPACE
class SalMessageOpInterface {
public:
virtual ~SalMessageOpInterface() = default;
int send_message(const char *from, const char *to, const char *msg) {return send_message(from,to,"text/plain",msg, nullptr);}
virtual int send_message(const char *from, const char *to, const char* content_type, const char *msg, const char *peer_uri) = 0;
virtual int reply(SalReason reason) = 0;
protected:
void prepare_message_request(belle_sip_request_t *req, const char* content_type, const char *msg, const char *peer_uri);
};
LINPHONE_END_NAMESPACE
#endif // ifndef _SAL_MESSAGE_OP_INTERFACE_H_

View file

@ -1,4 +1,22 @@
#include "message_op.h"
/*
* message-op.cpp
* Copyright (C) 2017 Belledonne Communications SARL
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*/
#include "sal/message-op.h"
using namespace std;

46
src/sal/message-op.h Normal file
View file

@ -0,0 +1,46 @@
/*
* message-op.h
* Copyright (C) 2017 Belledonne Communications SARL
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*/
#ifndef _SAL_MESSAGE_OP_H_
#define _SAL_MESSAGE_OP_H_
#include "sal/op.h"
#include "sal/message-op-interface.h"
LINPHONE_BEGIN_NAMESPACE
class SalMessageOp: public SalOp, public SalMessageOpInterface {
public:
SalMessageOp(Sal *sal): SalOp(sal) {}
int send_message(const char *from, const char *to, const char* content_type, const char *msg, const char *peer_uri) override;
int reply(SalReason reason) override {return SalOp::reply_message(reason);}
private:
virtual void fill_cbs() override;
void process_error();
static void process_io_error_cb(void *user_ctx, const belle_sip_io_error_event_t *event);
static void process_response_event_cb(void *op_base, const belle_sip_response_event_t *event);
static void process_timeout_cb(void *user_ctx, const belle_sip_timeout_event_t *event);
static void process_request_event_cb(void *op_base, const belle_sip_request_event_t *event);
};
LINPHONE_END_NAMESPACE
#endif // ifndef _SAL_MESSAGE_OP_H_

View file

@ -1,5 +1,24 @@
/*
* op.cpp
* Copyright (C) 2017 Belledonne Communications SARL
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*/
#include <cstring>
#include "sal_op.h"
#include "sal/op.h"
#include "bellesip_sal/sal_impl.h"
using namespace std;

View file

@ -1,21 +1,21 @@
/*
sal_op.h
Copyright (C) 2017 Belledonne Communications <info@belledonne-communications.com>
* op.h
* Copyright (C) 2017 Belledonne Communications SARL
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*/
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _SAL_OP_H_
#define _SAL_OP_H_
@ -23,9 +23,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include <bctoolbox/list.h>
#include <bctoolbox/port.h>
#include <belle-sip/types.h>
#include "sal.h"
#include "sal.hpp"
#include "c-wrapper/internal/c-sal.h"
#include "content/content.h"
#include "sal/sal.h"
LINPHONE_BEGIN_NAMESPACE
@ -33,16 +34,15 @@ class SalOp {
public:
SalOp(Sal *sal);
virtual ~SalOp();
SalOp *ref();
void *unref();
Sal *get_sal() const {return this->root;}
void set_user_pointer(void *up) {this->user_pointer=up;}
void *get_user_pointer() const {return this->user_pointer;}
void set_subject (const char *subject);
const char *get_subject () const { return this->subject; }
@ -50,43 +50,43 @@ public:
void set_from_address(const SalAddress *from);
const char *get_from() const {return this->from;}
const SalAddress *get_from_address() const {return this->from_address;}
void set_to(const char *to);
void set_to_address(const SalAddress *to);
const char *get_to() const {return this->to;}
const SalAddress *get_to_address() const {return this->to_address;}
void set_contact_address(const SalAddress* address);
const SalAddress *get_contact_address() const {return this->contact_address;}
void set_route(const char *route);
void set_route_address(const SalAddress* address);
const bctbx_list_t *get_route_addresses() const {return this->route_addresses;}
void add_route_address(const SalAddress* address);
void set_diversion_address(const SalAddress *diversion);
const SalAddress *get_diversion_address() const {return this->diversion_address;}
void set_service_route(const SalAddress* service_route);
const SalAddress *get_service_route() const {return this->service_route;}
void set_manual_refresher_mode(bool_t enabled) {this->manual_refresher=enabled;}
void set_entity_tag(const char* entity_tag);
const char *get_entity_tag() const {return this->entity_tag;}
void set_event(const char *eventname);
void set_privacy(SalPrivacyMask privacy) {this->privacy=privacy;}
SalPrivacyMask get_privacy() const {return this->privacy;}
void set_realm(const char *realm);
void set_sent_custom_header(SalCustomHeader* ch);
void enable_cnx_ip_to_0000_if_sendonly(bool_t yesno) {this->_cnx_ip_to_0000_if_sendonly_enabled = yesno;}
bool_t cnx_ip_to_0000_if_sendonly_enabled() const {return this->_cnx_ip_to_0000_if_sendonly_enabled;}
const char *get_proxy() const {return this->route;}
const char *get_network_origin() const {return this->origin;}
const char* get_call_id() const {return this->call_id;}
@ -96,28 +96,28 @@ public:
const char *get_remote_contact() const {return this->remote_contact;}
const SalAddress *get_remote_contact_address() const {return this->remote_contact_address;}
const char *get_remote_ua() const {return this->remote_ua;}
const char *get_public_address(int *port) {return this->refresher ? belle_sip_refresher_get_public_address(this->refresher, port) : NULL;}
const char *get_local_address(int *port) {return this->refresher ? belle_sip_refresher_get_local_address(this->refresher, port) : NULL;}
const SalErrorInfo *get_error_info() const {return &this->error_info;}
const SalErrorInfo *get_reason_error_info() const {return &this->reason_error_info;}
bool_t is_forked_of(const SalOp *op2) const {return this->call_id && op2->call_id && strcmp(this->call_id, op2->call_id) == 0;}
bool_t is_idle() const ;
void stop_refreshing() {if (this->refresher) belle_sip_refresher_stop(this->refresher);}
int refresh();
void kill_dialog();
void release();
virtual void authenticate(const SalAuthInfo *info) {process_authentication();}
void cancel_authentication() {ms_fatal("sal_op_cancel_authentication not implemented yet");}
SalAuthInfo *get_auth_requested() {return this->auth_info;}
int ping(const char *from, const char *to);
int send_info(const char *from, const char *to, const SalBodyHandler *body_handler);
protected:
enum class State {
Early = 0,
@ -125,14 +125,14 @@ protected:
Terminating, /*this state is used to wait until a proceeding state, so we can send the cancel*/
Terminated
};
static const char* to_string(const State value);
enum class Dir {
Incoming = 0,
Outgoing
};
enum class Type {
Unknown,
Register,
@ -142,60 +142,60 @@ protected:
Publish,
Subscribe
};
static const char *to_string(const SalOp::Type type);
typedef void (*ReleaseCb)(SalOp *op);
virtual void fill_cbs() {}
void release_impl();
void process_authentication();
int process_redirect();
belle_sip_request_t* build_request(const char* method);
int send_request(belle_sip_request_t* request);
int send_request_with_contact(belle_sip_request_t* request, bool_t add_contact);
int send_request_with_expires(belle_sip_request_t* request,int expires);
void resend_request(belle_sip_request_t* request);
int send_and_create_refresher(belle_sip_request_t* req, int expires,belle_sip_refresher_listener_t listener);
void set_reason_error_info(belle_sip_message_t *msg);
void set_error_info_from_response(belle_sip_response_t *response);
void set_referred_by(belle_sip_header_referred_by_t* referred_by);
void set_replaces(belle_sip_header_replaces_t* replaces);
void set_remote_contact(const char* remote_contact);
void set_network_origin(const char *origin);
void set_network_origin_address(SalAddress *origin);
void set_privacy_from_message(belle_sip_message_t* msg);
void set_remote_ua(belle_sip_message_t* message);
belle_sip_response_t *create_response_from_request(belle_sip_request_t *req, int code) {return this->root->create_response_from_request(req,code);}
belle_sip_header_contact_t *create_contact();
void set_or_update_dialog(belle_sip_dialog_t* dialog);
belle_sip_dialog_t *link_op_with_dialog(belle_sip_dialog_t* dialog);
void unlink_op_with_dialog(belle_sip_dialog_t* dialog);
SalBodyHandler *get_body_handler(belle_sip_message_t *msg);
void assign_recv_headers(belle_sip_message_t *incoming);
bool_t is_secure() const;
void add_headers(belle_sip_header_t *h, belle_sip_message_t *msg);
void add_custom_headers(belle_sip_message_t *msg);
int unsubscribe();
void process_incoming_message(const belle_sip_request_event_t *event);
int reply_message(SalReason reason);
void add_message_accept(belle_sip_message_t *msg);
static bool_t is_external_body(belle_sip_header_content_type_t* content_type);
static void assign_address(SalAddress** address, const char *value);
static void assign_string(char **str, const char *arg);
static void add_initial_route_set(belle_sip_request_t *request, const MSList *list);
// SalOpBase
Sal *root = NULL;
char *route = NULL; /*or request-uri for REGISTER*/
@ -220,7 +220,7 @@ protected:
SalCustomHeader *recv_custom_headers = NULL;
char* entity_tag = NULL; /*as defined by rfc3903 (I.E publih)*/
ReleaseCb release_cb = NULL;
// BelleSip implementation
const belle_sip_listener_callbacks_t *callbacks = NULL;
SalErrorInfo error_info;
@ -252,10 +252,10 @@ protected:
bool_t has_auth_pending = FALSE;
bool_t supports_session_timers = FALSE;
bool_t op_released = FALSE;
friend class Sal;
};
LINPHONE_END_NAMESPACE
#endif
#endif // ifndef _SAL_OP_H_

View file

@ -1,4 +1,22 @@
#include "presence_op.h"
/*
* presence-op.cpp
* Copyright (C) 2017 Belledonne Communications SARL
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*/
#include "sal/presence-op.h"
using namespace std;

View file

@ -1,35 +1,34 @@
/*
presence_op.h
Copyright (C) 2017 Belledonne Communications <info@belledonne-communications.com>
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
* presence-op.h
* Copyright (C) 2017 Belledonne Communications SARL
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*/
#ifndef _SAL_PRESENCE_OP_H_
#define _SAL_PRESENCE_OP_H_
#include "event_op.h"
#include "sal/event-op.h"
LINPHONE_BEGIN_NAMESPACE
class SalPresenceOp: public SalSubscribeOp {
public:
SalPresenceOp(Sal *sal): SalSubscribeOp(sal) {}
SalPresenceOp(Sal *sal): SalSubscribeOp(sal) {}
int subscribe(const char *from, const char *to, int expires);
int unsubscribe() {return SalOp::unsubscribe();}
int unsubscribe() {return SalOp::unsubscribe();}
int notify_presence(SalPresenceModel *presence);
int notify_presence_close();
@ -40,9 +39,9 @@ private:
int check_dialog_state();
belle_sip_request_t *create_presence_notify();
void add_presence_info(belle_sip_message_t *notify, SalPresenceModel *presence);
static SalSubscribeStatus belle_sip_message_get_subscription_state(const belle_sip_message_t *msg);
static void presence_process_io_error_cb(void *user_ctx, const belle_sip_io_error_event_t *event);
static void presence_response_event_cb(void *op_base, const belle_sip_response_event_t *event);
static void presence_refresher_listener_cb(belle_sip_refresher_t* refresher, void* user_pointer, unsigned int status_code, const char* reason_phrase, int will_retry);
@ -55,4 +54,4 @@ private:
LINPHONE_END_NAMESPACE
#endif
#endif // ifndef _SAL_PRESENCE_OP_H_

View file

@ -1,4 +1,22 @@
#include "register_op.h"
/*
* register-op.cpp
* Copyright (C) 2017 Belledonne Communications SARL
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*/
#include "sal/register-op.h"
#include "bellesip_sal/sal_impl.h"
using namespace std;

43
src/sal/register-op.h Normal file
View file

@ -0,0 +1,43 @@
/*
* register-op.h
* Copyright (C) 2017 Belledonne Communications SARL
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*/
#ifndef _SAL_REGISTER_OP_H_
#define _SAL_REGISTER_OP_H_
#include "sal/op.h"
LINPHONE_BEGIN_NAMESPACE
class SalRegisterOp: public SalOp {
public:
SalRegisterOp(Sal *sal): SalOp(sal) {}
int register_(const char *proxy, const char *from, int expires, const SalAddress* old_contact);
int register_refresh(int expires) {return this->refresher ? belle_sip_refresher_refresh(this->refresher,expires) : -1;}
int unregister() {return register_refresh(0);}
virtual void authenticate(const SalAuthInfo *info) override {register_refresh(-1);}
private:
virtual void fill_cbs() override {};
static void register_refresher_listener(belle_sip_refresher_t* refresher, void* user_pointer, unsigned int status_code, const char* reason_phrase, int will_retry);
};
LINPHONE_END_NAMESPACE
#endif // ifndef _SAL_REGISTER_OP_H_

View file

@ -1,8 +1,26 @@
#include "sal.hpp"
#include "call_op.h"
#include "presence_op.h"
#include "event_op.h"
#include "message_op.h"
/*
* sal.cpp
* Copyright (C) 2017 Belledonne Communications SARL
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*/
#include "sal/sal.h"
#include "sal/call-op.h"
#include "sal/presence-op.h"
#include "sal/event-op.h"
#include "sal/message-op.h"
#include "bellesip_sal/sal_impl.h"
#include "tester_utils.h"
#include "private.h"

View file

@ -1,26 +1,25 @@
/*
sal.hpp
Copyright (C) 2017 Belledonne Communications <info@belledonne-communications.com>
* sal.h
* Copyright (C) 2017 Belledonne Communications SARL
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*/
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.
#ifndef _SAL_H_
#define _SAL_H_
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _SAL_HPP_
#define _SAL_HPP_
#include "sal/sal.h"
#include "c-wrapper/internal/c-sal.h"
#include "linphone/utils/general.h"
LINPHONE_BEGIN_NAMESPACE
@ -68,7 +67,7 @@ public:
typedef void (*OnPublishResponseCb)(SalOp *salop);
typedef void (*OnNotifyResponseCb)(SalOp *salop);
typedef void (*OnExpireCb)(SalOp *salop);
struct Callbacks {
OnCallReceivedCb call_received;
OnCallReceivedCb call_rejected;
@ -106,23 +105,23 @@ public:
OnExpireCb on_expire;
OnNotifyResponseCb on_notify_response;
};
Sal(MSFactory *factory);
~Sal();
void set_user_pointer(void *user_data) {this->up=user_data;}
void *get_user_pointer() const {return this->up;}
void set_callbacks(const Callbacks *cbs);
void *get_stack_impl() {return this->stack;}
int iterate() {belle_sip_stack_sleep(this->stack,0); return 0;}
void set_send_error(int value) {belle_sip_stack_set_send_error(this->stack,value);}
void set_recv_error(int value) {belle_sip_provider_set_recv_error(this->prov,value);}
/******************/
/* SIP parameters */
/******************/
@ -130,30 +129,30 @@ public:
const char *get_supported_tags() const {return this->supported ? belle_sip_header_get_unparsed_value(this->supported) : NULL;}
void add_supported_tag(const char* tag);
void remove_supported_tag(const char* tag);
void set_user_agent(const char *user_agent);
const char* get_user_agent() const;
void append_stack_string_to_user_agent();
bool_t content_encoding_available(const char *content_encoding) {return (bool_t)belle_sip_stack_content_encoding_available(this->stack, content_encoding);}
bool_t is_content_type_supported(const char *content_type) const;
void add_content_type_support(const char *content_type);
void set_default_sdp_handling(SalOpSDPHandling sdp_handling_method);
void set_uuid(const char *uuid);
int create_uuid(char *uuid, size_t len);
static int generate_uuid(char *uuid, size_t len);
void enable_nat_helper(bool_t enable);
bool_t nat_helper_enabled() const {return this->_nat_helper_enabled;}
bool_t pending_trans_checking_enabled() const {return this->pending_trans_checking;}
int enable_pending_trans_checking(bool_t value) {this->pending_trans_checking = value; return 0;}
void set_refresher_retry_after(int value) {this->refresher_retry_after=value;}
int get_refresher_retry_after() const {return this->refresher_retry_after;}
void enable_sip_update_method(bool_t value) {this->enable_sip_update=value;}
void use_session_timers(int expires) {this->session_expires=expires;}
void use_dates(bool_t enabled) {this->_use_dates=enabled;}
@ -163,42 +162,42 @@ public:
void enable_test_features(bool_t enabled) {this->_enable_test_features=enabled;}
void use_no_initial_route(bool_t enabled) {this->no_initial_route=enabled;}
void enable_unconditional_answer(int value) {belle_sip_provider_enable_unconditional_answer(this->prov,value);}
bctbx_list_t *get_pending_auths() const {return bctbx_list_copy(this->pending_auths);}
/**********************/
/* Network parameters */
/**********************/
int set_listen_port(const char *addr, int port, SalTransport tr, bool_t is_tunneled);
int get_listening_port(SalTransport tr);
int transport_available(SalTransport t);
void get_default_local_ip(int address_family, char *ip, size_t iplen);
void set_transport_timeout(int timeout) {belle_sip_stack_set_transport_timeout(this->stack, timeout);}
int get_transport_timeout() const {return belle_sip_stack_get_transport_timeout(this->stack);}
void set_keepalive_period(unsigned int value);
unsigned int get_keepalive_period() const {return this->keep_alive;}
void use_tcp_tls_keepalive(bool_t enabled) {this->use_tcp_tls_keep_alive=enabled;}
void set_dscp(int dscp) {belle_sip_stack_set_default_dscp(this->stack,dscp);}
int set_tunnel(void *tunnelclient);
void set_http_proxy_host(const char *host) {belle_sip_stack_set_http_proxy_host(this->stack, host);}
const char *get_http_proxy_host() const {return belle_sip_stack_get_http_proxy_host(this->stack);}
void set_http_proxy_port(int port) {belle_sip_stack_set_http_proxy_port(this->stack, port);}
int get_http_proxy_port() const {return belle_sip_stack_get_http_proxy_port(this->stack);}
ortp_socket_t get_socket() const;
int unlisten_ports();
int reset_transports();
/******************/
/* TLS parameters */
/******************/
@ -206,41 +205,41 @@ public:
void set_root_ca(const char* rootCa);
void set_root_ca_data(const char* data);
const char *get_root_ca() const {return this->root_ca;}
void verify_server_certificates(bool_t verify);
void verify_server_cn(bool_t verify);
/******************/
/* DNS resolution */
/******************/
void set_dns_timeout(int timeout) {belle_sip_stack_set_dns_timeout(this->stack, timeout);}
int get_dns_timeout() const {return belle_sip_stack_get_dns_timeout(this->stack);}
void set_dns_servers(const bctbx_list_t *servers);
void enable_dns_search(bool_t enable) {belle_sip_stack_enable_dns_search(this->stack, (unsigned char)enable);}
bool_t dns_search_enabled() const {return (bool_t)belle_sip_stack_dns_search_enabled(this->stack);}
void enable_dns_srv(bool_t enable) {belle_sip_stack_enable_dns_srv(this->stack, (unsigned char)enable);}
bool_t dns_srv_enabled() const {return (bool_t)belle_sip_stack_dns_srv_enabled(this->stack);}
void set_dns_user_hosts_file(const char *hosts_file) {belle_sip_stack_set_dns_user_hosts_file(this->stack, hosts_file);}
const char *get_dns_user_hosts_file() const {return belle_sip_stack_get_dns_user_hosts_file(this->stack);}
belle_sip_resolver_context_t *resolve_a(const char *name, int port, int family, belle_sip_resolver_callback_t cb, void *data)
{return belle_sip_stack_resolve_a(this->stack,name,port,family,cb,data);}
belle_sip_resolver_context_t *resolve(const char *service, const char *transport, const char *name, int port, int family, belle_sip_resolver_callback_t cb, void *data)
{return belle_sip_stack_resolve(this->stack, service, transport, name, port, family, cb, data);}
/**********/
/* Timers */
/**********/
belle_sip_source_t *create_timer(belle_sip_source_func_t func, void *data, unsigned int timeout_value_ms, const char* timer_name);
void cancel_timer(belle_sip_source_t *timer);
private:
struct sal_uuid_t {
unsigned int time_low;
@ -250,17 +249,17 @@ private:
unsigned char clock_seq_low;
unsigned char node[6];
};
void set_tls_properties();
int add_listen_port(SalAddress* addr, bool_t is_tunneled);
void make_supported_header();
void add_pending_auth(SalOp *op);
void remove_pending_auth(SalOp *op);
belle_sip_response_t* create_response_from_request (belle_sip_request_t* req, int code );
static void unimplemented_stub() {ms_warning("Unimplemented SAL callback");}
static void remove_listening_point(belle_sip_listening_point_t* lp,belle_sip_provider_t* prov) {belle_sip_provider_remove_listening_point(prov,lp);}
/* Internal callbacks */
static void process_dialog_terminated_cb(void *sal, const belle_sip_dialog_terminated_event_t *event);
static void process_io_error_cb(void *user_ctx, const belle_sip_io_error_event_t *event);
@ -269,7 +268,7 @@ private:
static void process_timeout_cb(void *user_ctx, const belle_sip_timeout_event_t *event);
static void process_transaction_terminated_cb(void *user_ctx, const belle_sip_transaction_terminated_event_t *event);
static void process_auth_requested_cb(void *sal, belle_sip_auth_event_t *event);
MSFactory *factory = NULL;
Callbacks callbacks = {0};
MSList *pending_auths = NULL;/*MSList of SalOp */
@ -301,7 +300,7 @@ private:
bool_t pending_trans_checking = TRUE; /*testing purpose*/
void *ssl_config = NULL;
bctbx_list_t *supported_content_types = NULL; /* list of char* */
friend class SalOp;
friend class SalCallOp;
friend class SalRegisterOp;
@ -315,5 +314,4 @@ int to_sip_code(SalReason r);
LINPHONE_END_NAMESPACE
#endif // _LINPHONE_SAL_HH
#endif // ifndef _SAL_H_

View file

@ -21,7 +21,7 @@
#include "linphone/utils/general.h"
#include "sal/sal.h"
#include "c-wrapper/internal/c-sal.h"
#define PAYLOAD_TYPE_ENABLED PAYLOAD_TYPE_USER_FLAG_0
#define PAYLOAD_TYPE_BITRATE_OVERRIDE PAYLOAD_TYPE_USER_FLAG_3