diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt
index 95b530e2b..e06ff794a 100644
--- a/include/CMakeLists.txt
+++ b/include/CMakeLists.txt
@@ -41,6 +41,7 @@ set(HEADER_FILES
factory.h
friend.h
friendlist.h
+ im_encryption_engine.h
im_notif_policy.h
ldapprovider.h
lpconfig.h
@@ -50,10 +51,10 @@ set(HEADER_FILES
ringtoneplayer.h
sipsetup.h
tunnel.h
+ types.h
vcard.h
- xmlrpc.h
- im_encryption_engine.h
wrapper_utils.h
+ xmlrpc.h
# Deprecated header files
linphonecore.h
diff --git a/include/linphone/Makefile.am b/include/linphone/Makefile.am
index e76175528..3a706de8d 100644
--- a/include/linphone/Makefile.am
+++ b/include/linphone/Makefile.am
@@ -18,8 +18,10 @@ linphone_include_HEADERS=\
dictionary.h \
error_info.h \
event.h \
+ factory.h \
friend.h \
friendlist.h \
+ im_encryption_engine.h \
im_notif_policy.h \
ldapprovider.h \
lpconfig.h \
@@ -29,15 +31,15 @@ linphone_include_HEADERS=\
ringtoneplayer.h \
sipsetup.h \
tunnel.h \
+ types.h \
vcard.h \
+ wrapper_utils.h \
xmlrpc.h \
- im_encryption_engine.h\
linphonecore.h \
linphonecore_utils.h \
linphonefriend.h \
linphonepresence.h \
linphone_proxy_config.h \
- linphone_tunnel.h \
- factory.h
+ linphone_tunnel.h
EXTRA_DIST=$(linphone_include_HEADERS)
diff --git a/include/linphone/call.h b/include/linphone/call.h
index d97a68ec7..5b9f4765f 100644
--- a/include/linphone/call.h
+++ b/include/linphone/call.h
@@ -30,6 +30,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "linphone/call_params.h"
#include "linphone/conference.h"
#include "linphone/error_info.h"
+#include "linphone/types.h"
/**
* @addtogroup call_control
@@ -78,16 +79,6 @@ enum _LinphoneAudioRoute {
typedef enum _LinphoneAudioRoute LinphoneAudioRoute;
-/**
- * The LinphoneCall object represents a call issued or received by the LinphoneCore
-**/
-struct _LinphoneCall;
-
-/**
- * The LinphoneCall object represents a call issued or received by the LinphoneCore
-**/
-typedef struct _LinphoneCall LinphoneCall;
-
/** Callback prototype */
typedef void (*LinphoneCallCbFunc)(LinphoneCall *call, void *user_data);
@@ -474,7 +465,7 @@ LINPHONE_PUBLIC bool_t linphone_call_echo_limiter_enabled(const LinphoneCall *ca
* @param call #LinphoneCall object
* @return #LinphoneChatRoom where messaging can take place.
*/
-LINPHONE_PUBLIC struct _LinphoneChatRoom * linphone_call_get_chat_room(LinphoneCall *call);
+LINPHONE_PUBLIC LinphoneChatRoom * linphone_call_get_chat_room(LinphoneCall *call);
/**
* Get the mesured playback volume level (received from remote) in dbm0.
diff --git a/include/linphone/chat.h b/include/linphone/chat.h
index 91fecae93..c1f72f67b 100644
--- a/include/linphone/chat.h
+++ b/include/linphone/chat.h
@@ -21,6 +21,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#define LINPHONE_CHAT_H_
+#include "linphone/types.h"
+
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -30,23 +33,6 @@ extern "C" {
* @{
*/
-/**
- * An object to handle the callbacks for the handling a LinphoneChatMessage objects.
- */
-typedef struct _LinphoneChatMessageCbs LinphoneChatMessageCbs;
-
-/**
- * A chat room message to hold content to be sent.
- *
Can be created by linphone_chat_room_create_message().
- */
-typedef struct _LinphoneChatMessage LinphoneChatMessage;
-
-/**
- * A chat room is the place where text messages are exchanged.
- *
Can be created by linphone_core_create_chat_room().
- */
-typedef struct _LinphoneChatRoom LinphoneChatRoom;
-
/**
* LinphoneChatMessageState is used to notify if messages have been succesfully delivered or not.
*/
diff --git a/include/linphone/types.h b/include/linphone/types.h
new file mode 100644
index 000000000..7da78b41f
--- /dev/null
+++ b/include/linphone/types.h
@@ -0,0 +1,57 @@
+/*
+types.h
+Copyright (C) 2010-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 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 LINPHONE_TYPES_H_
+#define LINPHONE_TYPES_H_
+
+
+/**
+ * The LinphoneCall object represents a call issued or received by the LinphoneCore
+ * @ingroup call_control
+**/
+struct _LinphoneCall;
+
+/**
+ * The LinphoneCall object represents a call issued or received by the LinphoneCore
+ * @ingroup call_control
+**/
+typedef struct _LinphoneCall LinphoneCall;
+
+/**
+ * An object to handle the callbacks for the handling a LinphoneChatMessage objects.
+ * @ingroup chatroom
+ */
+typedef struct _LinphoneChatMessageCbs LinphoneChatMessageCbs;
+
+/**
+ * A chat room message to hold content to be sent.
+ * Can be created by linphone_chat_room_create_message().
+ * @ingroup chatroom
+ */
+typedef struct _LinphoneChatMessage LinphoneChatMessage;
+
+/**
+ * A chat room is the place where text messages are exchanged.
+ * Can be created by linphone_core_create_chat_room().
+ * @ingroup chatroom
+ */
+typedef struct _LinphoneChatRoom LinphoneChatRoom;
+
+
+#endif /* LINPHONE_TYPES_H_ */
diff --git a/tools/python/apixml2python.py b/tools/python/apixml2python.py
index 13336a27b..340d705de 100755
--- a/tools/python/apixml2python.py
+++ b/tools/python/apixml2python.py
@@ -63,6 +63,7 @@ blacklisted_functions = [
'linphone_core_get_default_proxy',
'linphone_core_get_network_simulator_params', # missing OrtpNetworkSimulatorParams
'linphone_core_get_supported_video_sizes', # missing MSVideoSizeDef
+ 'linphone_core_get_tunnel', # blacklisted LinphoneTunnel
'linphone_core_get_video_policy', # missing LinphoneVideoPolicy
'linphone_core_get_video_port_range', # to be handwritten because of result via arguments
'linphone_core_new', # replaced by linphone_factory_create_core
diff --git a/tools/python/apixml2python/handwritten_definitions.mustache b/tools/python/apixml2python/handwritten_definitions.mustache
index f2da77190..008210e77 100644
--- a/tools/python/apixml2python/handwritten_definitions.mustache
+++ b/tools/python/apixml2python/handwritten_definitions.mustache
@@ -153,7 +153,6 @@ static PyObject * pylinphone_module_method_set_log_handler(PyObject *self, PyObj
static PyObject * pylinphone_Call_get_native_video_window_id(PyObject *self, void *closure) {
void * cresult;
- PyObject * pyresult;
PyObject * pyret;
const LinphoneCall *native_ptr;
native_ptr = pylinphone_Call_get_native_ptr(self);
@@ -202,7 +201,6 @@ static int pylinphone_Call_set_native_video_window_id(PyObject *self, PyObject *
static PyObject * pylinphone_Core_get_native_preview_window_id(PyObject *self, void *closure) {
void * cresult;
- PyObject * pyresult;
PyObject * pyret;
const LinphoneCore *native_ptr;
native_ptr = pylinphone_Core_get_native_ptr(self);
@@ -251,7 +249,6 @@ static int pylinphone_Core_set_native_preview_window_id(PyObject *self, PyObject
static PyObject * pylinphone_Core_get_native_video_window_id(PyObject *self, void *closure) {
void * cresult;
- PyObject * pyresult;
PyObject * pyret;
const LinphoneCore *native_ptr;
native_ptr = pylinphone_Core_get_native_ptr(self);
@@ -419,9 +416,11 @@ static PyObject * pylinphone_Core_get_video_devices(PyObject *self, void *closur
static void pylinphone_init_ms2_plugins(LinphoneCore *lc) {
MSFactory *factory = linphone_core_get_ms_factory(lc);
#ifdef ENABLE_OPENH264
+ extern void libmsopenh264_init(MSFactory *);
libmsopenh264_init(factory);
#endif
#ifdef ENABLE_WASAPI
+ extern void libmswasapi_init(MSFactory *);
libmswasapi_init(factory);
#endif
linphone_core_reload_ms_plugins(lc, NULL);
@@ -893,7 +892,6 @@ static PyObject * pylinphone_Buffer_get_content(PyObject *self, void *closure) {
size_t csize;
PyObject * pyresult;
PyObject * pyret;
- const char *pyret_fmt;
const LinphoneBuffer *native_ptr;
native_ptr = pylinphone_Buffer_get_native_ptr(self);
if (native_ptr == NULL) {
@@ -948,7 +946,6 @@ static PyObject * pylinphone_Content_get_buffer(PyObject *self, void *closure) {
size_t csize;
PyObject * pyresult;
PyObject * pyret;
- const char *pyret_fmt;
const LinphoneContent *native_ptr;
native_ptr = pylinphone_Content_get_native_ptr(self);
if (native_ptr == NULL) {
diff --git a/tools/python/apixml2python/linphone.py b/tools/python/apixml2python/linphone.py
index 2568b65fc..7e61d766b 100644
--- a/tools/python/apixml2python/linphone.py
+++ b/tools/python/apixml2python/linphone.py
@@ -89,8 +89,16 @@ class HandWrittenProperty(HandWrittenCode):
self.setter_cfunction = setter_cfunction
+class UnknownTypeException(Exception):
+ def __init__(self, typename):
+ self.typename = typename
+ def __str__(self):
+ return "Unknown type " + self.typename
+
class ArgumentType:
def __init__(self, basic_type, complete_type, contained_type, linphone_module):
+ if not basic_type in linphone_module.known_types:
+ raise UnknownTypeException(basic_type)
self.basic_type = basic_type
self.complete_type = complete_type
self.contained_type = contained_type
@@ -1032,6 +1040,7 @@ class EventCallbackMethodDefinition(MethodDefinition):
class LinphoneModule(object):
def __init__(self, tree, blacklisted_classes, blacklisted_events, blacklisted_functions, hand_written_codes):
+ self.known_types = ['char', 'int', 'int8_t', 'int16_t', 'int32_t', 'int64_t', 'uint8_t', 'uint16_t', 'uint32_t', 'uint64_t', 'bool_t', 'float', 'double', 'size_t', 'time_t', 'MSList', 'bctbx_list_t', 'MSVideoSize', 'LCSipTransports', 'PayloadType']
self.internal_instance_method_names = ['destroy', 'ref', 'unref']
self.internal_property_names = ['user_data']
self.bctbxlist_types = Set([])
@@ -1044,7 +1053,8 @@ class LinphoneModule(object):
xml_enums = tree.findall("./enums/enum")
for xml_enum in xml_enums:
e = {}
- e['enum_name'] = strip_leading_linphone(xml_enum.get('name'))
+ e['enum_cname'] = xml_enum.get('name')
+ e['enum_name'] = strip_leading_linphone(e['enum_cname'])
e['enum_doc'] = self.__format_doc_content(xml_enum.find('briefdescription'), xml_enum.find('detaileddescription'))
e['enum_doc'] = self.__replace_doc_special_chars(e['enum_doc'])
e['enum_doc'] += """
@@ -1076,6 +1086,7 @@ class LinphoneModule(object):
e['enum_doc'] = self.__replace_doc_special_chars(e['enum_doc'])
self.enums.append(e)
self.enum_names.append(e['enum_name'])
+ self.known_types.append(e['enum_cname'])
self.core_events = []
self.classes = []
xml_classes = tree.findall("./classes/class")
@@ -1109,6 +1120,7 @@ class LinphoneModule(object):
ev['event_name'] = compute_event_name(ev['event_cname'], c['class_name'])
ev['event_doc'] = self.__format_doc(xml_event.find('briefdescription'), xml_event.find('detaileddescription'))
c['class_events'].append(ev)
+ self.known_types.append(ev['event_cname'])
c['class_object_members'].append(ev['event_name'])
c['class_object_members_code'] += "\tPyObject *" + ev['event_name'] + ";\n"
for hand_written_code in hand_written_codes:
@@ -1203,6 +1215,7 @@ class LinphoneModule(object):
p['setter_reference'] = "NULL"
c['class_properties'].append(p)
self.classes.append(c)
+ self.known_types.append(c['class_cname'])
# Format events definitions
for c in self.classes:
for ev in c['class_events']:
@@ -1212,42 +1225,71 @@ class LinphoneModule(object):
xml_new_method = c['class_xml_node'].find("./classmethods/classmethod[@name='" + c['class_c_function_prefix'] + "new']")
try:
c['new_body'] = NewMethodDefinition(self, c, xml_new_method).format()
+ except UnknownTypeException, e:
+ print(e)
+ c['blacklisted'] = True
except Exception, e:
e.args += (c['class_name'], 'new_body')
raise
try:
c['init_body'] = InitMethodDefinition(self, c, xml_new_method).format()
+ except UnknownTypeException, e:
+ print(e)
+ c['blacklisted'] = True
except Exception, e:
e.args += (c['class_name'], 'init_body')
raise
try:
c['from_native_pointer_body'] = FromNativePointerMethodDefinition(self, c).format()
+ except UnknownTypeException, e:
+ print(e)
+ c['blacklisted'] = True
except Exception, e:
e.args += (c['class_name'], 'from_native_pointer_body')
raise
- try:
- for m in c['class_type_methods']:
+ for m in c['class_type_methods']:
+ try:
m['method_body'] = MethodDefinition(self, c, m['method_name'], m['method_xml_node']).format()
m['method_doc'] = self.__format_method_doc(m['method_xml_node'])
- for m in c['class_instance_methods']:
+ except UnknownTypeException, e:
+ print(e)
+ m['blacklisted'] = True
+ except Exception, e:
+ e.args += (c['class_name'], m['method_name'])
+ raise
+ for m in c['class_instance_methods']:
+ try:
m['method_body'] = MethodDefinition(self, c, m['method_name'], m['method_xml_node']).format()
m['method_doc'] = self.__format_method_doc(m['method_xml_node'])
- except Exception, e:
- e.args += (c['class_name'], m['method_name'])
- raise
- try:
- for p in c['class_properties']:
- p['property_doc'] = ''
- if p.has_key('setter_xml_node'):
+ except UnknownTypeException, e:
+ print(e)
+ m['blacklisted'] = True
+ except Exception, e:
+ e.args += (c['class_name'], m['method_name'])
+ raise
+ for p in c['class_properties']:
+ p['property_doc'] = ''
+ if p.has_key('setter_xml_node'):
+ try:
p['setter_body'] = SetterMethodDefinition(self, c, p['property_name'], p['setter_xml_node']).format()
p['property_doc'] = self.__format_setter_doc(p['setter_xml_node'])
- if p.has_key('getter_xml_node'):
+ except UnknownTypeException, e:
+ print(e)
+ p['blacklisted'] = True
+ except Exception, e:
+ e.args += (c['class_name'], p['property_name'])
+ raise
+ if p.has_key('getter_xml_node'):
+ try:
p['getter_body'] = GetterMethodDefinition(self, c, p['property_name'], p['getter_xml_node']).format()
if p['property_doc'] == '':
p['property_doc'] = self.__format_getter_doc(p['getter_xml_node'])
- except Exception, e:
- e.args += (c['class_name'], p['property_name'])
- raise
+ except UnknownTypeException, e:
+ print(e)
+ p['blacklisted'] = True
+ except Exception, e:
+ e.args += (c['class_name'], p['property_name'])
+ raise
if not 'class_has_hand_written_dealloc' in c:
try:
if c['class_refcountable']:
@@ -1258,9 +1300,18 @@ class LinphoneModule(object):
c['dealloc_definition'] = DeallocMethodDefinition(self, c, xml_instance_method).format()
else:
c['dealloc_definition'] = DeallocMethodDefinition(self, c).format()
+ except UnknownTypeException, e:
+ print(e)
+ c['blacklisted'] = True
except Exception, e:
e.args += (c['class_name'], 'dealloc_body')
raise
+ # Remove blacklisted classes and methods
+ self.classes = [c for c in self.classes if not c.has_key('blacklisted')]
+ for c in self.classes:
+ c['class_type_methods'] = [m for m in c['class_type_methods'] if not m.has_key('blacklisted')]
+ c['class_instance_methods'] = [m for m in c['class_instance_methods'] if not m.has_key('blacklisted')]
+ c['class_properties'] = [m for m in c['class_properties'] if not m.has_key('blacklisted')]
# Convert bctbxlist_types to a list of dictionaries for the template
d = []
for bctbxlist_type in self.bctbxlist_types: