mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-18 03:28:07 +00:00
40 lines
1.4 KiB
Text
40 lines
1.4 KiB
Text
#include "private.h"
|
|
|
|
static PyObject * pylinphone_testing_module_method_set_dns_user_hosts_file(PyObject *self, PyObject *args) {
|
|
PyObject *_core;
|
|
char *_path;
|
|
LinphoneCore *_core_native_ptr;
|
|
|
|
if (!PyArg_ParseTuple(args, "Oz", &_core, &_path)) {
|
|
return NULL;
|
|
}
|
|
if ((_core != Py_None) && !PyObject_IsInstance(_core, (PyObject *)&pylinphone_CoreType)) {
|
|
PyErr_SetString(PyExc_TypeError, "The '_core' argument must be a linphone.Core instance.");
|
|
return NULL;
|
|
}
|
|
|
|
if ((_core != NULL) && (_core != Py_None)) {
|
|
if ((_core_native_ptr = pylinphone_Core_get_native_ptr(_core)) == NULL) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
pylinphone_trace(1, "[PYLINPHONE] >>> %s(%p [%p], %s)", __FUNCTION__, _core, _core_native_ptr, _path);
|
|
sal_set_dns_user_hosts_file(_core_native_ptr->sal, _path);
|
|
pylinphone_dispatch_messages();
|
|
|
|
pylinphone_trace(-1, "[PYLINPHONE] <<< %s -> None", __FUNCTION__);
|
|
Py_RETURN_NONE;
|
|
}
|
|
|
|
static PyMethodDef pylinphone_TestingModuleMethods[] = {
|
|
{ "set_dns_user_hosts_file", pylinphone_testing_module_method_set_dns_user_hosts_file, METH_VARARGS, "Allows to set a user specified hosts file." },
|
|
/* Sentinel */
|
|
{ NULL, NULL, 0, NULL }
|
|
};
|
|
|
|
static void pylinphone_init_testing_module(PyObject *linphone_module) {
|
|
PyObject *mtesting = Py_InitModule3("testing", pylinphone_TestingModuleMethods, "Python module adding some testing features for the Linphone library.");
|
|
Py_INCREF(mtesting);
|
|
if (PyModule_AddObject(linphone_module, "testing", mtesting) < 0) return;
|
|
}
|