diff options
Diffstat (limited to 'source4/libcli')
-rw-r--r-- | source4/libcli/cldap/cldap.h | 2 | ||||
-rw-r--r-- | source4/libcli/config.mk | 32 | ||||
-rw-r--r-- | source4/libcli/ldap/ldap.c | 2 | ||||
-rw-r--r-- | source4/libcli/ldap/ldap_client.c | 2 | ||||
-rw-r--r-- | source4/libcli/ldap/ldap_controls.c | 2 | ||||
-rw-r--r-- | source4/libcli/swig/libcli_nbt.i | 1 | ||||
-rw-r--r-- | source4/libcli/swig/libcli_nbt.py | 117 | ||||
-rw-r--r-- | source4/libcli/swig/libcli_nbt_wrap.c | 375 | ||||
-rw-r--r-- | source4/libcli/swig/libcli_smb.i | 3 | ||||
-rw-r--r-- | source4/libcli/swig/libcli_smb.py | 11 | ||||
-rw-r--r-- | source4/libcli/swig/libcli_smb_wrap.c | 229 | ||||
-rw-r--r-- | source4/libcli/util/asn1.c | 770 | ||||
-rw-r--r-- | source4/libcli/util/asn_1.h | 54 |
13 files changed, 321 insertions, 1279 deletions
diff --git a/source4/libcli/cldap/cldap.h b/source4/libcli/cldap/cldap.h index 8aa98f0331..7a222e0652 100644 --- a/source4/libcli/cldap/cldap.h +++ b/source4/libcli/cldap/cldap.h @@ -19,7 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include "libcli/util/asn_1.h" +#include "lib/util/asn1.h" #include "librpc/gen_ndr/nbt.h" struct ldap_message; diff --git a/source4/libcli/config.mk b/source4/libcli/config.mk index adb51c6c9a..a538d607bb 100644 --- a/source4/libcli/config.mk +++ b/source4/libcli/config.mk @@ -8,11 +8,6 @@ OBJ_FILES = util/doserr.o \ util/errormap.o \ util/nterr.o \ -[SUBSYSTEM::ASN1_UTIL] -PUBLIC_PROTO_HEADER = util/asn1_proto.h -PUBLIC_HEADERS = util/asn_1.h -OBJ_FILES = util/asn1.o - [SUBSYSTEM::LIBCLI_LSA] PRIVATE_PROTO_HEADER = util/clilsa.h OBJ_FILES = util/clilsa.o @@ -55,17 +50,13 @@ OBJ_FILES = \ PUBLIC_DEPENDENCIES = LIBNDR NDR_NBT LIBCLI_COMPOSITE LIBEVENTS \ NDR_SECURITY samba-socket LIBSAMBA-UTIL -[LIBRARY::swig_libcli_nbt] -LIBRARY_REALNAME = swig/_libcli_nbt.$(SHLIBEXT) -OBJ_FILES = swig/libcli_nbt_wrap.o +[PYTHON::python_libcli_nbt] +SWIG_FILE = swig/libcli_nbt.i PUBLIC_DEPENDENCIES = LIBCLI_NBT DYNCONFIG LIBSAMBA-CONFIG -ENABLE = NO -[LIBRARY::swig_libcli_smb] -LIBRARY_REALNAME = swig/_libcli_smb.$(SHLIBEXT) -OBJ_FILES = swig/libcli_smb_wrap.o +[PYTHON::python_libcli_smb] +SWIG_FILE = swig/libcli_smb.i PUBLIC_DEPENDENCIES = LIBCLI_SMB DYNCONFIG LIBSAMBA-CONFIG -ENABLE = NO [SUBSYSTEM::LIBCLI_DGRAM] OBJ_FILES = \ @@ -76,20 +67,14 @@ OBJ_FILES = \ dgram/browse.o PUBLIC_DEPENDENCIES = LIBCLI_NBT LIBNDR LIBCLI_RESOLVE -[LIBRARY::LIBCLI_CLDAP] -VERSION = 0.0.1 -SO_VERSION = 0 -DESCRIPTION = CLDAP client library +[SUBSYSTEM::LIBCLI_CLDAP] OBJ_FILES = cldap/cldap.o PUBLIC_HEADERS = cldap/cldap.h PUBLIC_DEPENDENCIES = LIBCLI_LDAP PRIVATE_DEPENDENCIES = LIBSAMBA-UTIL LIBLDB -[LIBRARY::LIBCLI_WREPL] +[SUBSYSTEM::LIBCLI_WREPL] PRIVATE_PROTO_HEADER = wrepl/winsrepl_proto.h -VERSION = 0.0.1 -SO_VERSION = 0 -DESCRIPTION = WINS Replication client library OBJ_FILES = \ wrepl/winsrepl.o PUBLIC_DEPENDENCIES = NDR_WINSREPL samba-socket LIBCLI_RESOLVE LIBEVENTS \ @@ -117,12 +102,9 @@ OBJ_FILES = \ finddcs.o PUBLIC_DEPENDENCIES = LIBCLI_NBT MESSAGING -[LIBRARY::LIBCLI_SMB] +[SUBSYSTEM::LIBCLI_SMB] PUBLIC_HEADERS = libcli.h PUBLIC_PROTO_HEADER = libcli_proto.h -VERSION = 0.0.1 -SO_VERSION = 0 -DESCRIPTION = SMB/CIFS client library OBJ_FILES = clireadwrite.o \ cliconnect.o \ clifile.o \ diff --git a/source4/libcli/ldap/ldap.c b/source4/libcli/ldap/ldap.c index 586f2fa653..00a0631753 100644 --- a/source4/libcli/ldap/ldap.c +++ b/source4/libcli/ldap/ldap.c @@ -23,7 +23,7 @@ */ #include "includes.h" -#include "libcli/util/asn_1.h" +#include "lib/util/asn1.h" #include "libcli/ldap/ldap.h" diff --git a/source4/libcli/ldap/ldap_client.c b/source4/libcli/ldap/ldap_client.c index 6b8a7a3f28..d99851ee15 100644 --- a/source4/libcli/ldap/ldap_client.c +++ b/source4/libcli/ldap/ldap_client.c @@ -23,7 +23,7 @@ */ #include "includes.h" -#include "libcli/util/asn_1.h" +#include "lib/util/asn1.h" #include "lib/util/dlinklist.h" #include "lib/events/events.h" #include "lib/socket/socket.h" diff --git a/source4/libcli/ldap/ldap_controls.c b/source4/libcli/ldap/ldap_controls.c index 34e5cccf75..3b94580033 100644 --- a/source4/libcli/ldap/ldap_controls.c +++ b/source4/libcli/ldap/ldap_controls.c @@ -20,7 +20,7 @@ */ #include "includes.h" -#include "libcli/util/asn_1.h" +#include "lib/util/asn1.h" #include "libcli/ldap/ldap.h" #include "lib/ldb/include/ldb.h" diff --git a/source4/libcli/swig/libcli_nbt.i b/source4/libcli/swig/libcli_nbt.i index 6fd85c2b8c..827230b113 100644 --- a/source4/libcli/swig/libcli_nbt.i +++ b/source4/libcli/swig/libcli_nbt.i @@ -31,6 +31,7 @@ #include "lib/talloc/talloc.h" #include "libcli/nbt/libnbt.h" #include "param/param.h" +#include "lib/events/events.h" /* Undo strcpy safety macro as it's used by swig )-: */ diff --git a/source4/libcli/swig/libcli_nbt.py b/source4/libcli/swig/libcli_nbt.py index 938ab382f6..b49e240bc2 100644 --- a/source4/libcli/swig/libcli_nbt.py +++ b/source4/libcli/swig/libcli_nbt.py @@ -2,7 +2,6 @@ # Version 1.3.33 # # Don't modify this file, modify the SWIG interface instead. -# This file is compatible with both classic and new-style classes. import _libcli_nbt import new @@ -48,6 +47,16 @@ except AttributeError: del types +def _swig_setattr_nondynamic_method(set): + def set_attr(self,name,value): + if (name == "thisown"): return self.this.own(value) + if hasattr(self,name) or (name == "this"): + set(self,name,value) + else: + raise AttributeError("You cannot add attributes to %s" % self) + return set_attr + + import events nbt_name_socket_init = _libcli_nbt.nbt_name_socket_init NBT_NAME_CLIENT = _libcli_nbt.NBT_NAME_CLIENT @@ -58,106 +67,54 @@ NBT_NAME_PDC = _libcli_nbt.NBT_NAME_PDC NBT_NAME_LOGON = _libcli_nbt.NBT_NAME_LOGON NBT_NAME_MASTER = _libcli_nbt.NBT_NAME_MASTER NBT_NAME_BROWSER = _libcli_nbt.NBT_NAME_BROWSER -class nbt_name(_object): - __swig_setmethods__ = {} - __setattr__ = lambda self, name, value: _swig_setattr(self, nbt_name, name, value) - __swig_getmethods__ = {} - __getattr__ = lambda self, name: _swig_getattr(self, nbt_name, name) +class nbt_name(object): + thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr - __swig_setmethods__["name"] = _libcli_nbt.nbt_name_name_set - __swig_getmethods__["name"] = _libcli_nbt.nbt_name_name_get - if _newclass:name = _swig_property(_libcli_nbt.nbt_name_name_get, _libcli_nbt.nbt_name_name_set) - __swig_setmethods__["scope"] = _libcli_nbt.nbt_name_scope_set - __swig_getmethods__["scope"] = _libcli_nbt.nbt_name_scope_get - if _newclass:scope = _swig_property(_libcli_nbt.nbt_name_scope_get, _libcli_nbt.nbt_name_scope_set) - __swig_setmethods__["type"] = _libcli_nbt.nbt_name_type_set - __swig_getmethods__["type"] = _libcli_nbt.nbt_name_type_get - if _newclass:type = _swig_property(_libcli_nbt.nbt_name_type_get, _libcli_nbt.nbt_name_type_set) + name = _swig_property(_libcli_nbt.nbt_name_name_get, _libcli_nbt.nbt_name_name_set) + scope = _swig_property(_libcli_nbt.nbt_name_scope_get, _libcli_nbt.nbt_name_scope_set) + type = _swig_property(_libcli_nbt.nbt_name_type_get, _libcli_nbt.nbt_name_type_set) def __init__(self, *args, **kwargs): - this = _libcli_nbt.new_nbt_name(*args, **kwargs) - try: self.this.append(this) - except: self.this = this + _libcli_nbt.nbt_name_swiginit(self,_libcli_nbt.new_nbt_name(*args, **kwargs)) __swig_destroy__ = _libcli_nbt.delete_nbt_name - __del__ = lambda self : None; nbt_name_swigregister = _libcli_nbt.nbt_name_swigregister nbt_name_swigregister(nbt_name) -class nbt_name_query(_object): - __swig_setmethods__ = {} - __setattr__ = lambda self, name, value: _swig_setattr(self, nbt_name_query, name, value) - __swig_getmethods__ = {} - __getattr__ = lambda self, name: _swig_getattr(self, nbt_name_query, name) +class nbt_name_query(object): + thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr - __swig_getmethods__["data_out"] = _libcli_nbt.nbt_name_query_data_out_get - if _newclass:data_out = _swig_property(_libcli_nbt.nbt_name_query_data_out_get) - __swig_getmethods__["data_in"] = _libcli_nbt.nbt_name_query_data_in_get - if _newclass:data_in = _swig_property(_libcli_nbt.nbt_name_query_data_in_get) + data_out = _swig_property(_libcli_nbt.nbt_name_query_data_out_get) + data_in = _swig_property(_libcli_nbt.nbt_name_query_data_in_get) def __init__(self, *args, **kwargs): - this = _libcli_nbt.new_nbt_name_query(*args, **kwargs) - try: self.this.append(this) - except: self.this = this + _libcli_nbt.nbt_name_query_swiginit(self,_libcli_nbt.new_nbt_name_query(*args, **kwargs)) __swig_destroy__ = _libcli_nbt.delete_nbt_name_query - __del__ = lambda self : None; nbt_name_query_swigregister = _libcli_nbt.nbt_name_query_swigregister nbt_name_query_swigregister(nbt_name_query) -class nbt_name_query_out(_object): - __swig_setmethods__ = {} - __setattr__ = lambda self, name, value: _swig_setattr(self, nbt_name_query_out, name, value) - __swig_getmethods__ = {} - __getattr__ = lambda self, name: _swig_getattr(self, nbt_name_query_out, name) +class nbt_name_query_out(object): + thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr - __swig_setmethods__["reply_from"] = _libcli_nbt.nbt_name_query_out_reply_from_set - __swig_getmethods__["reply_from"] = _libcli_nbt.nbt_name_query_out_reply_from_get - if _newclass:reply_from = _swig_property(_libcli_nbt.nbt_name_query_out_reply_from_get, _libcli_nbt.nbt_name_query_out_reply_from_set) - __swig_setmethods__["name"] = _libcli_nbt.nbt_name_query_out_name_set - __swig_getmethods__["name"] = _libcli_nbt.nbt_name_query_out_name_get - if _newclass:name = _swig_property(_libcli_nbt.nbt_name_query_out_name_get, _libcli_nbt.nbt_name_query_out_name_set) - __swig_setmethods__["num_addrs"] = _libcli_nbt.nbt_name_query_out_num_addrs_set - __swig_getmethods__["num_addrs"] = _libcli_nbt.nbt_name_query_out_num_addrs_get - if _newclass:num_addrs = _swig_property(_libcli_nbt.nbt_name_query_out_num_addrs_get, _libcli_nbt.nbt_name_query_out_num_addrs_set) - __swig_setmethods__["reply_addrs"] = _libcli_nbt.nbt_name_query_out_reply_addrs_set - __swig_getmethods__["reply_addrs"] = _libcli_nbt.nbt_name_query_out_reply_addrs_get - if _newclass:reply_addrs = _swig_property(_libcli_nbt.nbt_name_query_out_reply_addrs_get, _libcli_nbt.nbt_name_query_out_reply_addrs_set) + reply_from = _swig_property(_libcli_nbt.nbt_name_query_out_reply_from_get, _libcli_nbt.nbt_name_query_out_reply_from_set) + name = _swig_property(_libcli_nbt.nbt_name_query_out_name_get, _libcli_nbt.nbt_name_query_out_name_set) + num_addrs = _swig_property(_libcli_nbt.nbt_name_query_out_num_addrs_get, _libcli_nbt.nbt_name_query_out_num_addrs_set) + reply_addrs = _swig_property(_libcli_nbt.nbt_name_query_out_reply_addrs_get, _libcli_nbt.nbt_name_query_out_reply_addrs_set) def __init__(self, *args, **kwargs): - this = _libcli_nbt.new_nbt_name_query_out(*args, **kwargs) - try: self.this.append(this) - except: self.this = this + _libcli_nbt.nbt_name_query_out_swiginit(self,_libcli_nbt.new_nbt_name_query_out(*args, **kwargs)) __swig_destroy__ = _libcli_nbt.delete_nbt_name_query_out - __del__ = lambda self : None; nbt_name_query_out_swigregister = _libcli_nbt.nbt_name_query_out_swigregister nbt_name_query_out_swigregister(nbt_name_query_out) -class nbt_name_query_in(_object): - __swig_setmethods__ = {} - __setattr__ = lambda self, name, value: _swig_setattr(self, nbt_name_query_in, name, value) - __swig_getmethods__ = {} - __getattr__ = lambda self, name: _swig_getattr(self, nbt_name_query_in, name) +class nbt_name_query_in(object): + thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr - __swig_setmethods__["name"] = _libcli_nbt.nbt_name_query_in_name_set - __swig_getmethods__["name"] = _libcli_nbt.nbt_name_query_in_name_get - if _newclass:name = _swig_property(_libcli_nbt.nbt_name_query_in_name_get, _libcli_nbt.nbt_name_query_in_name_set) - __swig_setmethods__["dest_addr"] = _libcli_nbt.nbt_name_query_in_dest_addr_set - __swig_getmethods__["dest_addr"] = _libcli_nbt.nbt_name_query_in_dest_addr_get - if _newclass:dest_addr = _swig_property(_libcli_nbt.nbt_name_query_in_dest_addr_get, _libcli_nbt.nbt_name_query_in_dest_addr_set) - __swig_setmethods__["broadcast"] = _libcli_nbt.nbt_name_query_in_broadcast_set - __swig_getmethods__["broadcast"] = _libcli_nbt.nbt_name_query_in_broadcast_get - if _newclass:broadcast = _swig_property(_libcli_nbt.nbt_name_query_in_broadcast_get, _libcli_nbt.nbt_name_query_in_broadcast_set) - __swig_setmethods__["wins_lookup"] = _libcli_nbt.nbt_name_query_in_wins_lookup_set - __swig_getmethods__["wins_lookup"] = _libcli_nbt.nbt_name_query_in_wins_lookup_get - if _newclass:wins_lookup = _swig_property(_libcli_nbt.nbt_name_query_in_wins_lookup_get, _libcli_nbt.nbt_name_query_in_wins_lookup_set) - __swig_setmethods__["timeout"] = _libcli_nbt.nbt_name_query_in_timeout_set - __swig_getmethods__["timeout"] = _libcli_nbt.nbt_name_query_in_timeout_get - if _newclass:timeout = _swig_property(_libcli_nbt.nbt_name_query_in_timeout_get, _libcli_nbt.nbt_name_query_in_timeout_set) - __swig_setmethods__["retries"] = _libcli_nbt.nbt_name_query_in_retries_set - __swig_getmethods__["retries"] = _libcli_nbt.nbt_name_query_in_retries_get - if _newclass:retries = _swig_property(_libcli_nbt.nbt_name_query_in_retries_get, _libcli_nbt.nbt_name_query_in_retries_set) + name = _swig_property(_libcli_nbt.nbt_name_query_in_name_get, _libcli_nbt.nbt_name_query_in_name_set) + dest_addr = _swig_property(_libcli_nbt.nbt_name_query_in_dest_addr_get, _libcli_nbt.nbt_name_query_in_dest_addr_set) + broadcast = _swig_property(_libcli_nbt.nbt_name_query_in_broadcast_get, _libcli_nbt.nbt_name_query_in_broadcast_set) + wins_lookup = _swig_property(_libcli_nbt.nbt_name_query_in_wins_lookup_get, _libcli_nbt.nbt_name_query_in_wins_lookup_set) + timeout = _swig_property(_libcli_nbt.nbt_name_query_in_timeout_get, _libcli_nbt.nbt_name_query_in_timeout_set) + retries = _swig_property(_libcli_nbt.nbt_name_query_in_retries_get, _libcli_nbt.nbt_name_query_in_retries_set) def __init__(self, *args, **kwargs): - this = _libcli_nbt.new_nbt_name_query_in(*args, **kwargs) - try: self.this.append(this) - except: self.this = this + _libcli_nbt.nbt_name_query_in_swiginit(self,_libcli_nbt.new_nbt_name_query_in(*args, **kwargs)) __swig_destroy__ = _libcli_nbt.delete_nbt_name_query_in - __del__ = lambda self : None; nbt_name_query_in_swigregister = _libcli_nbt.nbt_name_query_in_swigregister nbt_name_query_in_swigregister(nbt_name_query_in) diff --git a/source4/libcli/swig/libcli_nbt_wrap.c b/source4/libcli/swig/libcli_nbt_wrap.c index 149e63884a..6c1b501359 100644 --- a/source4/libcli/swig/libcli_nbt_wrap.c +++ b/source4/libcli/swig/libcli_nbt_wrap.c @@ -9,7 +9,7 @@ * ----------------------------------------------------------------------------- */ #define SWIGPYTHON -#define SWIG_PYTHON_DIRECTOR_NO_VTABLE +#define SWIG_PYTHON_NO_BUILD_NONE /* ----------------------------------------------------------------------------- * This section contains generic SWIG labels for method/variable * declarations/attributes, and other compiler dependent labels. @@ -2485,6 +2485,19 @@ static swig_module_info swig_module = {swig_types, 17, 0, 0, 0, 0}; # error "This python version requires swig to be run with the '-classic' option" # endif #endif +#if (PY_VERSION_HEX <= 0x02020000) +# error "This python version requires swig to be run with the '-nomodern' option" +#endif +#if (PY_VERSION_HEX <= 0x02020000) +# error "This python version requires swig to be run with the '-nomodernargs' option" +#endif +#ifndef METH_O +# error "This python version requires swig to be run with the '-nofastunpack' option" +#endif +#ifdef SWIG_TypeQuery +# undef SWIG_TypeQuery +#endif +#define SWIG_TypeQuery SWIG_Python_TypeQuery /*----------------------------------------------- @(target):= _libcli_nbt.so @@ -2506,6 +2519,7 @@ static swig_module_info swig_module = {swig_types, 17, 0, 0, 0, 0}; #include "lib/talloc/talloc.h" #include "libcli/nbt/libnbt.h" #include "param/param.h" +#include "lib/events/events.h" /* Undo strcpy safety macro as it's used by swig )-: */ @@ -2912,12 +2926,8 @@ SWIGINTERN PyObject *_wrap_nbt_name_socket_init(PyObject *SWIGUNUSEDPARM(self), (char *) "event_ctx", NULL }; - { - arg2 = event_context_init(NULL); - } - { - arg1 = NULL; - } + arg2 = event_context_init(NULL); + arg1 = NULL; if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"|O:nbt_name_socket_init",kwnames,&obj0)) SWIG_fail; if (obj0) { res2 = SWIG_ConvertPtr(obj0, &argp2,SWIGTYPE_p_event_context, 0 | 0 ); @@ -2943,16 +2953,15 @@ SWIGINTERN PyObject *_wrap_nbt_name_name_set(PyObject *SWIGUNUSEDPARM(self), PyO int res2 ; char *buf2 = 0 ; int alloc2 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; + PyObject *swig_obj[2] ; - if (!PyArg_ParseTuple(args,(char *)"OO:nbt_name_name_set",&obj0,&obj1)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nbt_name, 0 | 0 ); + if (!SWIG_Python_UnpackTuple(args,"nbt_name_name_set",2,2,swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nbt_name, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "nbt_name_name_set" "', argument " "1"" of type '" "struct nbt_name *""'"); } arg1 = (struct nbt_name *)(argp1); - res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); + res2 = SWIG_AsCharPtrAndSize(swig_obj[1], &buf2, NULL, &alloc2); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "nbt_name_name_set" "', argument " "2"" of type '" "char const *""'"); } @@ -2978,10 +2987,11 @@ SWIGINTERN PyObject *_wrap_nbt_name_name_get(PyObject *SWIGUNUSEDPARM(self), PyO char *result = 0 ; void *argp1 = 0 ; int res1 = 0 ; - PyObject * obj0 = 0 ; + PyObject *swig_obj[1] ; - if (!PyArg_ParseTuple(args,(char *)"O:nbt_name_name_get",&obj0)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nbt_name, 0 | 0 ); + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nbt_name, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "nbt_name_name_get" "', argument " "1"" of type '" "struct nbt_name *""'"); } @@ -3003,16 +3013,15 @@ SWIGINTERN PyObject *_wrap_nbt_name_scope_set(PyObject *SWIGUNUSEDPARM(self), Py int res2 ; char *buf2 = 0 ; int alloc2 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; + PyObject *swig_obj[2] ; - if (!PyArg_ParseTuple(args,(char *)"OO:nbt_name_scope_set",&obj0,&obj1)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nbt_name, 0 | 0 ); + if (!SWIG_Python_UnpackTuple(args,"nbt_name_scope_set",2,2,swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nbt_name, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "nbt_name_scope_set" "', argument " "1"" of type '" "struct nbt_name *""'"); } arg1 = (struct nbt_name *)(argp1); - res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); + res2 = SWIG_AsCharPtrAndSize(swig_obj[1], &buf2, NULL, &alloc2); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "nbt_name_scope_set" "', argument " "2"" of type '" "char const *""'"); } @@ -3038,10 +3047,11 @@ SWIGINTERN PyObject *_wrap_nbt_name_scope_get(PyObject *SWIGUNUSEDPARM(self), Py char *result = 0 ; void *argp1 = 0 ; int res1 = 0 ; - PyObject * obj0 = 0 ; + PyObject *swig_obj[1] ; - if (!PyArg_ParseTuple(args,(char *)"O:nbt_name_scope_get",&obj0)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nbt_name, 0 | 0 ); + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nbt_name, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "nbt_name_scope_get" "', argument " "1"" of type '" "struct nbt_name *""'"); } @@ -3062,16 +3072,15 @@ SWIGINTERN PyObject *_wrap_nbt_name_type_set(PyObject *SWIGUNUSEDPARM(self), PyO int res1 = 0 ; int val2 ; int ecode2 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; + PyObject *swig_obj[2] ; - if (!PyArg_ParseTuple(args,(char *)"OO:nbt_name_type_set",&obj0,&obj1)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nbt_name, 0 | 0 ); + if (!SWIG_Python_UnpackTuple(args,"nbt_name_type_set",2,2,swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nbt_name, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "nbt_name_type_set" "', argument " "1"" of type '" "struct nbt_name *""'"); } arg1 = (struct nbt_name *)(argp1); - ecode2 = SWIG_AsVal_int(obj1, &val2); + ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "nbt_name_type_set" "', argument " "2"" of type '" "enum nbt_name_type""'"); } @@ -3091,10 +3100,11 @@ SWIGINTERN PyObject *_wrap_nbt_name_type_get(PyObject *SWIGUNUSEDPARM(self), PyO enum nbt_name_type result; void *argp1 = 0 ; int res1 = 0 ; - PyObject * obj0 = 0 ; + PyObject *swig_obj[1] ; - if (!PyArg_ParseTuple(args,(char *)"O:nbt_name_type_get",&obj0)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nbt_name, 0 | 0 ); + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nbt_name, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "nbt_name_type_get" "', argument " "1"" of type '" "struct nbt_name *""'"); } @@ -3111,7 +3121,7 @@ SWIGINTERN PyObject *_wrap_new_nbt_name(PyObject *SWIGUNUSEDPARM(self), PyObject PyObject *resultobj = 0; struct nbt_name *result = 0 ; - if (!PyArg_ParseTuple(args,(char *)":new_nbt_name")) SWIG_fail; + if (!SWIG_Python_UnpackTuple(args,"new_nbt_name",0,0,0)) SWIG_fail; result = (struct nbt_name *)(struct nbt_name *) calloc(1, sizeof(struct nbt_name)); resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_nbt_name, SWIG_POINTER_NEW | 0 ); return resultobj; @@ -3125,10 +3135,11 @@ SWIGINTERN PyObject *_wrap_delete_nbt_name(PyObject *SWIGUNUSEDPARM(self), PyObj struct nbt_name *arg1 = (struct nbt_name *) 0 ; void *argp1 = 0 ; int res1 = 0 ; - PyObject * obj0 = 0 ; + PyObject *swig_obj[1] ; - if (!PyArg_ParseTuple(args,(char *)"O:delete_nbt_name",&obj0)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nbt_name, SWIG_POINTER_DISOWN | 0 ); + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nbt_name, SWIG_POINTER_DISOWN | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_nbt_name" "', argument " "1"" of type '" "struct nbt_name *""'"); } @@ -3144,21 +3155,26 @@ fail: SWIGINTERN PyObject *nbt_name_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *obj; - if (!PyArg_ParseTuple(args,(char*)"O|swigregister", &obj)) return NULL; + if (!SWIG_Python_UnpackTuple(args,(char*)"swigregister", 1, 1,&obj)) return NULL; SWIG_TypeNewClientData(SWIGTYPE_p_nbt_name, SWIG_NewClientData(obj)); return SWIG_Py_Void(); } +SWIGINTERN PyObject *nbt_name_swiginit(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + return SWIG_Python_InitShadowInstance(args); +} + SWIGINTERN PyObject *_wrap_nbt_name_query_data_out_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; struct nbt_name_query *arg1 = (struct nbt_name_query *) 0 ; nbt_name_query_out *result = 0 ; void *argp1 = 0 ; int res1 = 0 ; - PyObject * obj0 = 0 ; + PyObject *swig_obj[1] ; - if (!PyArg_ParseTuple(args,(char *)"O:nbt_name_query_data_out_get",&obj0)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nbt_name_query, 0 | 0 ); + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nbt_name_query, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "nbt_name_query_data_out_get" "', argument " "1"" of type '" "struct nbt_name_query *""'"); } @@ -3177,10 +3193,11 @@ SWIGINTERN PyObject *_wrap_nbt_name_query_data_in_get(PyObject *SWIGUNUSEDPARM(s nbt_name_query_in *result = 0 ; void *argp1 = 0 ; int res1 = 0 ; - PyObject * obj0 = 0 ; + PyObject *swig_obj[1] ; - if (!PyArg_ParseTuple(args,(char *)"O:nbt_name_query_data_in_get",&obj0)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nbt_name_query, 0 | 0 ); + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nbt_name_query, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "nbt_name_query_data_in_get" "', argument " "1"" of type '" "struct nbt_name_query *""'"); } @@ -3197,7 +3214,7 @@ SWIGINTERN PyObject *_wrap_new_nbt_name_query(PyObject *SWIGUNUSEDPARM(self), Py PyObject *resultobj = 0; struct nbt_name_query *result = 0 ; - if (!PyArg_ParseTuple(args,(char *)":new_nbt_name_query")) SWIG_fail; + if (!SWIG_Python_UnpackTuple(args,"new_nbt_name_query",0,0,0)) SWIG_fail; result = (struct nbt_name_query *)(struct nbt_name_query *) calloc(1, sizeof(struct nbt_name_query)); resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_nbt_name_query, SWIG_POINTER_NEW | 0 ); return resultobj; @@ -3211,10 +3228,11 @@ SWIGINTERN PyObject *_wrap_delete_nbt_name_query(PyObject *SWIGUNUSEDPARM(self), struct nbt_name_query *arg1 = (struct nbt_name_query *) 0 ; void *argp1 = 0 ; int res1 = 0 ; - PyObject * obj0 = 0 ; + PyObject *swig_obj[1] ; - if (!PyArg_ParseTuple(args,(char *)"O:delete_nbt_name_query",&obj0)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nbt_name_query, SWIG_POINTER_DISOWN | 0 ); + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nbt_name_query, SWIG_POINTER_DISOWN | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_nbt_name_query" "', argument " "1"" of type '" "struct nbt_name_query *""'"); } @@ -3230,11 +3248,15 @@ fail: SWIGINTERN PyObject *nbt_name_query_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *obj; - if (!PyArg_ParseTuple(args,(char*)"O|swigregister", &obj)) return NULL; + if (!SWIG_Python_UnpackTuple(args,(char*)"swigregister", 1, 1,&obj)) return NULL; SWIG_TypeNewClientData(SWIGTYPE_p_nbt_name_query, SWIG_NewClientData(obj)); return SWIG_Py_Void(); } +SWIGINTERN PyObject *nbt_name_query_swiginit(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + return SWIG_Python_InitShadowInstance(args); +} + SWIGINTERN PyObject *_wrap_nbt_name_query_out_reply_from_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; nbt_name_query_out *arg1 = (nbt_name_query_out *) 0 ; @@ -3244,16 +3266,15 @@ SWIGINTERN PyObject *_wrap_nbt_name_query_out_reply_from_set(PyObject *SWIGUNUSE int res2 ; char *buf2 = 0 ; int alloc2 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; + PyObject *swig_obj[2] ; - if (!PyArg_ParseTuple(args,(char *)"OO:nbt_name_query_out_reply_from_set",&obj0,&obj1)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nbt_name_query_out, 0 | 0 ); + if (!SWIG_Python_UnpackTuple(args,"nbt_name_query_out_reply_from_set",2,2,swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nbt_name_query_out, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "nbt_name_query_out_reply_from_set" "', argument " "1"" of type '" "nbt_name_query_out *""'"); } arg1 = (nbt_name_query_out *)(argp1); - res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); + res2 = SWIG_AsCharPtrAndSize(swig_obj[1], &buf2, NULL, &alloc2); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "nbt_name_query_out_reply_from_set" "', argument " "2"" of type '" "char const *""'"); } @@ -3279,10 +3300,11 @@ SWIGINTERN PyObject *_wrap_nbt_name_query_out_reply_from_get(PyObject *SWIGUNUSE char *result = 0 ; void *argp1 = 0 ; int res1 = 0 ; - PyObject * obj0 = 0 ; + PyObject *swig_obj[1] ; - if (!PyArg_ParseTuple(args,(char *)"O:nbt_name_query_out_reply_from_get",&obj0)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nbt_name_query_out, 0 | 0 ); + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nbt_name_query_out, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "nbt_name_query_out_reply_from_get" "', argument " "1"" of type '" "nbt_name_query_out *""'"); } @@ -3303,16 +3325,15 @@ SWIGINTERN PyObject *_wrap_nbt_name_query_out_name_set(PyObject *SWIGUNUSEDPARM( int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; + PyObject *swig_obj[2] ; - if (!PyArg_ParseTuple(args,(char *)"OO:nbt_name_query_out_name_set",&obj0,&obj1)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nbt_name_query_out, 0 | 0 ); + if (!SWIG_Python_UnpackTuple(args,"nbt_name_query_out_name_set",2,2,swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nbt_name_query_out, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "nbt_name_query_out_name_set" "', argument " "1"" of type '" "nbt_name_query_out *""'"); } arg1 = (nbt_name_query_out *)(argp1); - res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_nbt_name, 0 | 0 ); + res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_nbt_name, 0 | 0 ); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "nbt_name_query_out_name_set" "', argument " "2"" of type '" "struct nbt_name *""'"); } @@ -3332,10 +3353,11 @@ SWIGINTERN PyObject *_wrap_nbt_name_query_out_name_get(PyObject *SWIGUNUSEDPARM( struct nbt_name *result = 0 ; void *argp1 = 0 ; int res1 = 0 ; - PyObject * obj0 = 0 ; + PyObject *swig_obj[1] ; - if (!PyArg_ParseTuple(args,(char *)"O:nbt_name_query_out_name_get",&obj0)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nbt_name_query_out, 0 | 0 ); + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nbt_name_query_out, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "nbt_name_query_out_name_get" "', argument " "1"" of type '" "nbt_name_query_out *""'"); } @@ -3356,16 +3378,15 @@ SWIGINTERN PyObject *_wrap_nbt_name_query_out_num_addrs_set(PyObject *SWIGUNUSED int res1 = 0 ; short val2 ; int ecode2 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; + PyObject *swig_obj[2] ; - if (!PyArg_ParseTuple(args,(char *)"OO:nbt_name_query_out_num_addrs_set",&obj0,&obj1)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nbt_name_query_out, 0 | 0 ); + if (!SWIG_Python_UnpackTuple(args,"nbt_name_query_out_num_addrs_set",2,2,swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nbt_name_query_out, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "nbt_name_query_out_num_addrs_set" "', argument " "1"" of type '" "nbt_name_query_out *""'"); } arg1 = (nbt_name_query_out *)(argp1); - ecode2 = SWIG_AsVal_short(obj1, &val2); + ecode2 = SWIG_AsVal_short(swig_obj[1], &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "nbt_name_query_out_num_addrs_set" "', argument " "2"" of type '" "int16_t""'"); } @@ -3385,10 +3406,11 @@ SWIGINTERN PyObject *_wrap_nbt_name_query_out_num_addrs_get(PyObject *SWIGUNUSED int16_t result; void *argp1 = 0 ; int res1 = 0 ; - PyObject * obj0 = 0 ; + PyObject *swig_obj[1] ; - if (!PyArg_ParseTuple(args,(char *)"O:nbt_name_query_out_num_addrs_get",&obj0)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nbt_name_query_out, 0 | 0 ); + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nbt_name_query_out, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "nbt_name_query_out_num_addrs_get" "', argument " "1"" of type '" "nbt_name_query_out *""'"); } @@ -3409,16 +3431,15 @@ SWIGINTERN PyObject *_wrap_nbt_name_query_out_reply_addrs_set(PyObject *SWIGUNUS int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; + PyObject *swig_obj[2] ; - if (!PyArg_ParseTuple(args,(char *)"OO:nbt_name_query_out_reply_addrs_set",&obj0,&obj1)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nbt_name_query_out, 0 | 0 ); + if (!SWIG_Python_UnpackTuple(args,"nbt_name_query_out_reply_addrs_set",2,2,swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nbt_name_query_out, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "nbt_name_query_out_reply_addrs_set" "', argument " "1"" of type '" "nbt_name_query_out *""'"); } arg1 = (nbt_name_query_out *)(argp1); - res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_p_char, 0 | 0 ); + res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_p_char, 0 | 0 ); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "nbt_name_query_out_reply_addrs_set" "', argument " "2"" of type '" "char const **""'"); } @@ -3438,10 +3459,11 @@ SWIGINTERN PyObject *_wrap_nbt_name_query_out_reply_addrs_get(PyObject *SWIGUNUS char **result = 0 ; void *argp1 = 0 ; int res1 = 0 ; - PyObject * obj0 = 0 ; + PyObject *swig_obj[1] ; - if (!PyArg_ParseTuple(args,(char *)"O:nbt_name_query_out_reply_addrs_get",&obj0)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nbt_name_query_out, 0 | 0 ); + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nbt_name_query_out, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "nbt_name_query_out_reply_addrs_get" "', argument " "1"" of type '" "nbt_name_query_out *""'"); } @@ -3458,7 +3480,7 @@ SWIGINTERN PyObject *_wrap_new_nbt_name_query_out(PyObject *SWIGUNUSEDPARM(self) PyObject *resultobj = 0; nbt_name_query_out *result = 0 ; - if (!PyArg_ParseTuple(args,(char *)":new_nbt_name_query_out")) SWIG_fail; + if (!SWIG_Python_UnpackTuple(args,"new_nbt_name_query_out",0,0,0)) SWIG_fail; result = (nbt_name_query_out *)(nbt_name_query_out *) calloc(1, sizeof(nbt_name_query_out)); resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_nbt_name_query_out, SWIG_POINTER_NEW | 0 ); return resultobj; @@ -3472,10 +3494,11 @@ SWIGINTERN PyObject *_wrap_delete_nbt_name_query_out(PyObject *SWIGUNUSEDPARM(se nbt_name_query_out *arg1 = (nbt_name_query_out *) 0 ; void *argp1 = 0 ; int res1 = 0 ; - PyObject * obj0 = 0 ; + PyObject *swig_obj[1] ; - if (!PyArg_ParseTuple(args,(char *)"O:delete_nbt_name_query_out",&obj0)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nbt_name_query_out, SWIG_POINTER_DISOWN | 0 ); + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nbt_name_query_out, SWIG_POINTER_DISOWN | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_nbt_name_query_out" "', argument " "1"" of type '" "nbt_name_query_out *""'"); } @@ -3491,11 +3514,15 @@ fail: SWIGINTERN PyObject *nbt_name_query_out_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *obj; - if (!PyArg_ParseTuple(args,(char*)"O|swigregister", &obj)) return NULL; + if (!SWIG_Python_UnpackTuple(args,(char*)"swigregister", 1, 1,&obj)) return NULL; SWIG_TypeNewClientData(SWIGTYPE_p_nbt_name_query_out, SWIG_NewClientData(obj)); return SWIG_Py_Void(); } +SWIGINTERN PyObject *nbt_name_query_out_swiginit(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + return SWIG_Python_InitShadowInstance(args); +} + SWIGINTERN PyObject *_wrap_nbt_name_query_in_name_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; nbt_name_query_in *arg1 = (nbt_name_query_in *) 0 ; @@ -3504,16 +3531,15 @@ SWIGINTERN PyObject *_wrap_nbt_name_query_in_name_set(PyObject *SWIGUNUSEDPARM(s int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; + PyObject *swig_obj[2] ; - if (!PyArg_ParseTuple(args,(char *)"OO:nbt_name_query_in_name_set",&obj0,&obj1)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nbt_name_query_in, 0 | 0 ); + if (!SWIG_Python_UnpackTuple(args,"nbt_name_query_in_name_set",2,2,swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nbt_name_query_in, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "nbt_name_query_in_name_set" "', argument " "1"" of type '" "nbt_name_query_in *""'"); } arg1 = (nbt_name_query_in *)(argp1); - res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_nbt_name, 0 | 0 ); + res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_nbt_name, 0 | 0 ); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "nbt_name_query_in_name_set" "', argument " "2"" of type '" "struct nbt_name *""'"); } @@ -3533,10 +3559,11 @@ SWIGINTERN PyObject *_wrap_nbt_name_query_in_name_get(PyObject *SWIGUNUSEDPARM(s struct nbt_name *result = 0 ; void *argp1 = 0 ; int res1 = 0 ; - PyObject * obj0 = 0 ; + PyObject *swig_obj[1] ; - if (!PyArg_ParseTuple(args,(char *)"O:nbt_name_query_in_name_get",&obj0)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nbt_name_query_in, 0 | 0 ); + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nbt_name_query_in, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "nbt_name_query_in_name_get" "', argument " "1"" of type '" "nbt_name_query_in *""'"); } @@ -3558,16 +3585,15 @@ SWIGINTERN PyObject *_wrap_nbt_name_query_in_dest_addr_set(PyObject *SWIGUNUSEDP int res2 ; char *buf2 = 0 ; int alloc2 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; + PyObject *swig_obj[2] ; - if (!PyArg_ParseTuple(args,(char *)"OO:nbt_name_query_in_dest_addr_set",&obj0,&obj1)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nbt_name_query_in, 0 | 0 ); + if (!SWIG_Python_UnpackTuple(args,"nbt_name_query_in_dest_addr_set",2,2,swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nbt_name_query_in, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "nbt_name_query_in_dest_addr_set" "', argument " "1"" of type '" "nbt_name_query_in *""'"); } arg1 = (nbt_name_query_in *)(argp1); - res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); + res2 = SWIG_AsCharPtrAndSize(swig_obj[1], &buf2, NULL, &alloc2); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "nbt_name_query_in_dest_addr_set" "', argument " "2"" of type '" "char const *""'"); } @@ -3593,10 +3619,11 @@ SWIGINTERN PyObject *_wrap_nbt_name_query_in_dest_addr_get(PyObject *SWIGUNUSEDP char *result = 0 ; void *argp1 = 0 ; int res1 = 0 ; - PyObject * obj0 = 0 ; + PyObject *swig_obj[1] ; - if (!PyArg_ParseTuple(args,(char *)"O:nbt_name_query_in_dest_addr_get",&obj0)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nbt_name_query_in, 0 | 0 ); + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nbt_name_query_in, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "nbt_name_query_in_dest_addr_get" "', argument " "1"" of type '" "nbt_name_query_in *""'"); } @@ -3617,16 +3644,15 @@ SWIGINTERN PyObject *_wrap_nbt_name_query_in_broadcast_set(PyObject *SWIGUNUSEDP int res1 = 0 ; bool val2 ; int ecode2 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; + PyObject *swig_obj[2] ; - if (!PyArg_ParseTuple(args,(char *)"OO:nbt_name_query_in_broadcast_set",&obj0,&obj1)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nbt_name_query_in, 0 | 0 ); + if (!SWIG_Python_UnpackTuple(args,"nbt_name_query_in_broadcast_set",2,2,swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nbt_name_query_in, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "nbt_name_query_in_broadcast_set" "', argument " "1"" of type '" "nbt_name_query_in *""'"); } arg1 = (nbt_name_query_in *)(argp1); - ecode2 = SWIG_AsVal_bool(obj1, &val2); + ecode2 = SWIG_AsVal_bool(swig_obj[1], &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "nbt_name_query_in_broadcast_set" "', argument " "2"" of type '" "bool""'"); } @@ -3646,10 +3672,11 @@ SWIGINTERN PyObject *_wrap_nbt_name_query_in_broadcast_get(PyObject *SWIGUNUSEDP bool result; void *argp1 = 0 ; int res1 = 0 ; - PyObject * obj0 = 0 ; + PyObject *swig_obj[1] ; - if (!PyArg_ParseTuple(args,(char *)"O:nbt_name_query_in_broadcast_get",&obj0)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nbt_name_query_in, 0 | 0 ); + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nbt_name_query_in, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "nbt_name_query_in_broadcast_get" "', argument " "1"" of type '" "nbt_name_query_in *""'"); } @@ -3670,16 +3697,15 @@ SWIGINTERN PyObject *_wrap_nbt_name_query_in_wins_lookup_set(PyObject *SWIGUNUSE int res1 = 0 ; bool val2 ; int ecode2 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; + PyObject *swig_obj[2] ; - if (!PyArg_ParseTuple(args,(char *)"OO:nbt_name_query_in_wins_lookup_set",&obj0,&obj1)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nbt_name_query_in, 0 | 0 ); + if (!SWIG_Python_UnpackTuple(args,"nbt_name_query_in_wins_lookup_set",2,2,swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nbt_name_query_in, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "nbt_name_query_in_wins_lookup_set" "', argument " "1"" of type '" "nbt_name_query_in *""'"); } arg1 = (nbt_name_query_in *)(argp1); - ecode2 = SWIG_AsVal_bool(obj1, &val2); + ecode2 = SWIG_AsVal_bool(swig_obj[1], &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "nbt_name_query_in_wins_lookup_set" "', argument " "2"" of type '" "bool""'"); } @@ -3699,10 +3725,11 @@ SWIGINTERN PyObject *_wrap_nbt_name_query_in_wins_lookup_get(PyObject *SWIGUNUSE bool result; void *argp1 = 0 ; int res1 = 0 ; - PyObject * obj0 = 0 ; + PyObject *swig_obj[1] ; - if (!PyArg_ParseTuple(args,(char *)"O:nbt_name_query_in_wins_lookup_get",&obj0)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nbt_name_query_in, 0 | 0 ); + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nbt_name_query_in, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "nbt_name_query_in_wins_lookup_get" "', argument " "1"" of type '" "nbt_name_query_in *""'"); } @@ -3723,16 +3750,15 @@ SWIGINTERN PyObject *_wrap_nbt_name_query_in_timeout_set(PyObject *SWIGUNUSEDPAR int res1 = 0 ; int val2 ; int ecode2 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; + PyObject *swig_obj[2] ; - if (!PyArg_ParseTuple(args,(char *)"OO:nbt_name_query_in_timeout_set",&obj0,&obj1)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nbt_name_query_in, 0 | 0 ); + if (!SWIG_Python_UnpackTuple(args,"nbt_name_query_in_timeout_set",2,2,swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nbt_name_query_in, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "nbt_name_query_in_timeout_set" "', argument " "1"" of type '" "nbt_name_query_in *""'"); } arg1 = (nbt_name_query_in *)(argp1); - ecode2 = SWIG_AsVal_int(obj1, &val2); + ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "nbt_name_query_in_timeout_set" "', argument " "2"" of type '" "int""'"); } @@ -3752,10 +3778,11 @@ SWIGINTERN PyObject *_wrap_nbt_name_query_in_timeout_get(PyObject *SWIGUNUSEDPAR int result; void *argp1 = 0 ; int res1 = 0 ; - PyObject * obj0 = 0 ; + PyObject *swig_obj[1] ; - if (!PyArg_ParseTuple(args,(char *)"O:nbt_name_query_in_timeout_get",&obj0)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nbt_name_query_in, 0 | 0 ); + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nbt_name_query_in, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "nbt_name_query_in_timeout_get" "', argument " "1"" of type '" "nbt_name_query_in *""'"); } @@ -3776,16 +3803,15 @@ SWIGINTERN PyObject *_wrap_nbt_name_query_in_retries_set(PyObject *SWIGUNUSEDPAR int res1 = 0 ; int val2 ; int ecode2 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; + PyObject *swig_obj[2] ; - if (!PyArg_ParseTuple(args,(char *)"OO:nbt_name_query_in_retries_set",&obj0,&obj1)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nbt_name_query_in, 0 | 0 ); + if (!SWIG_Python_UnpackTuple(args,"nbt_name_query_in_retries_set",2,2,swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nbt_name_query_in, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "nbt_name_query_in_retries_set" "', argument " "1"" of type '" "nbt_name_query_in *""'"); } arg1 = (nbt_name_query_in *)(argp1); - ecode2 = SWIG_AsVal_int(obj1, &val2); + ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "nbt_name_query_in_retries_set" "', argument " "2"" of type '" "int""'"); } @@ -3805,10 +3831,11 @@ SWIGINTERN PyObject *_wrap_nbt_name_query_in_retries_get(PyObject *SWIGUNUSEDPAR int result; void *argp1 = 0 ; int res1 = 0 ; - PyObject * obj0 = 0 ; + PyObject *swig_obj[1] ; - if (!PyArg_ParseTuple(args,(char *)"O:nbt_name_query_in_retries_get",&obj0)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nbt_name_query_in, 0 | 0 ); + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nbt_name_query_in, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "nbt_name_query_in_retries_get" "', argument " "1"" of type '" "nbt_name_query_in *""'"); } @@ -3825,7 +3852,7 @@ SWIGINTERN PyObject *_wrap_new_nbt_name_query_in(PyObject *SWIGUNUSEDPARM(self), PyObject *resultobj = 0; nbt_name_query_in *result = 0 ; - if (!PyArg_ParseTuple(args,(char *)":new_nbt_name_query_in")) SWIG_fail; + if (!SWIG_Python_UnpackTuple(args,"new_nbt_name_query_in",0,0,0)) SWIG_fail; result = (nbt_name_query_in *)(nbt_name_query_in *) calloc(1, sizeof(nbt_name_query_in)); resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_nbt_name_query_in, SWIG_POINTER_NEW | 0 ); return resultobj; @@ -3839,10 +3866,11 @@ SWIGINTERN PyObject *_wrap_delete_nbt_name_query_in(PyObject *SWIGUNUSEDPARM(sel nbt_name_query_in *arg1 = (nbt_name_query_in *) 0 ; void *argp1 = 0 ; int res1 = 0 ; - PyObject * obj0 = 0 ; + PyObject *swig_obj[1] ; - if (!PyArg_ParseTuple(args,(char *)"O:delete_nbt_name_query_in",&obj0)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nbt_name_query_in, SWIG_POINTER_DISOWN | 0 ); + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nbt_name_query_in, SWIG_POINTER_DISOWN | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_nbt_name_query_in" "', argument " "1"" of type '" "nbt_name_query_in *""'"); } @@ -3858,11 +3886,15 @@ fail: SWIGINTERN PyObject *nbt_name_query_in_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *obj; - if (!PyArg_ParseTuple(args,(char*)"O|swigregister", &obj)) return NULL; + if (!SWIG_Python_UnpackTuple(args,(char*)"swigregister", 1, 1,&obj)) return NULL; SWIG_TypeNewClientData(SWIGTYPE_p_nbt_name_query_in, SWIG_NewClientData(obj)); return SWIG_Py_Void(); } +SWIGINTERN PyObject *nbt_name_query_in_swiginit(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + return SWIG_Python_InitShadowInstance(args); +} + SWIGINTERN PyObject *_wrap_new_char_ptr_array(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { PyObject *resultobj = 0; size_t arg1 ; @@ -4007,9 +4039,7 @@ SWIGINTERN PyObject *_wrap_do_nbt_name_query(PyObject *SWIGUNUSEDPARM(self), PyO (char *) "nbtsock",(char *) "io", NULL }; - { - arg2 = NULL; - } + arg2 = NULL; if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:do_nbt_name_query",kwnames,&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nbt_name_socket, 0 | 0 ); if (!SWIG_IsOK(res1)) { @@ -4022,13 +4052,12 @@ SWIGINTERN PyObject *_wrap_do_nbt_name_query(PyObject *SWIGUNUSEDPARM(self), PyO } arg3 = (struct nbt_name_query *)(argp3); result = do_nbt_name_query(arg1,arg2,arg3); - { - if (NT_STATUS_IS_ERR(result)) { - PyObject *obj = Py_BuildValue("(i,s)", (&result)->v, nt_errstr(result)); - PyErr_SetObject(PyExc_RuntimeError, obj); - } else if (resultobj == NULL) { - resultobj = Py_None; - } + if (NT_STATUS_IS_ERR(result)) { + PyObject *obj = Py_BuildValue((char *)"(i,s)", (&result)->v, nt_errstr(result)); + PyErr_SetObject(PyExc_RuntimeError, obj); + SWIG_fail; + } else if (resultobj == NULL) { + resultobj = Py_None; } return resultobj; fail: @@ -4039,45 +4068,49 @@ fail: static PyMethodDef SwigMethods[] = { { (char *)"nbt_name_socket_init", (PyCFunction) _wrap_nbt_name_socket_init, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"nbt_name_name_set", _wrap_nbt_name_name_set, METH_VARARGS, NULL}, - { (char *)"nbt_name_name_get", _wrap_nbt_name_name_get, METH_VARARGS, NULL}, + { (char *)"nbt_name_name_get", (PyCFunction)_wrap_nbt_name_name_get, METH_O, NULL}, { (char *)"nbt_name_scope_set", _wrap_nbt_name_scope_set, METH_VARARGS, NULL}, - { (char *)"nbt_name_scope_get", _wrap_nbt_name_scope_get, METH_VARARGS, NULL}, + { (char *)"nbt_name_scope_get", (PyCFunction)_wrap_nbt_name_scope_get, METH_O, NULL}, { (char *)"nbt_name_type_set", _wrap_nbt_name_type_set, METH_VARARGS, NULL}, - { (char *)"nbt_name_type_get", _wrap_nbt_name_type_get, METH_VARARGS, NULL}, - { (char *)"new_nbt_name", _wrap_new_nbt_name, METH_VARARGS, NULL}, - { (char *)"delete_nbt_name", _wrap_delete_nbt_name, METH_VARARGS, NULL}, + { (char *)"nbt_name_type_get", (PyCFunction)_wrap_nbt_name_type_get, METH_O, NULL}, + { (char *)"new_nbt_name", (PyCFunction)_wrap_new_nbt_name, METH_NOARGS, NULL}, + { (char *)"delete_nbt_name", (PyCFunction)_wrap_delete_nbt_name, METH_O, NULL}, { (char *)"nbt_name_swigregister", nbt_name_swigregister, METH_VARARGS, NULL}, - { (char *)"nbt_name_query_data_out_get", _wrap_nbt_name_query_data_out_get, METH_VARARGS, NULL}, - { (char *)"nbt_name_query_data_in_get", _wrap_nbt_name_query_data_in_get, METH_VARARGS, NULL}, - { (char *)"new_nbt_name_query", _wrap_new_nbt_name_query, METH_VARARGS, NULL}, - { (char *)"delete_nbt_name_query", _wrap_delete_nbt_name_query, METH_VARARGS, NULL}, + { (char *)"nbt_name_swiginit", nbt_name_swiginit, METH_VARARGS, NULL}, + { (char *)"nbt_name_query_data_out_get", (PyCFunction)_wrap_nbt_name_query_data_out_get, METH_O, NULL}, + { (char *)"nbt_name_query_data_in_get", (PyCFunction)_wrap_nbt_name_query_data_in_get, METH_O, NULL}, + { (char *)"new_nbt_name_query", (PyCFunction)_wrap_new_nbt_name_query, METH_NOARGS, NULL}, + { (char *)"delete_nbt_name_query", (PyCFunction)_wrap_delete_nbt_name_query, METH_O, NULL}, { (char *)"nbt_name_query_swigregister", nbt_name_query_swigregister, METH_VARARGS, NULL}, + { (char *)"nbt_name_query_swiginit", nbt_name_query_swiginit, METH_VARARGS, NULL}, { (char *)"nbt_name_query_out_reply_from_set", _wrap_nbt_name_query_out_reply_from_set, METH_VARARGS, NULL}, - { (char *)"nbt_name_query_out_reply_from_get", _wrap_nbt_name_query_out_reply_from_get, METH_VARARGS, NULL}, + { (char *)"nbt_name_query_out_reply_from_get", (PyCFunction)_wrap_nbt_name_query_out_reply_from_get, METH_O, NULL}, { (char *)"nbt_name_query_out_name_set", _wrap_nbt_name_query_out_name_set, METH_VARARGS, NULL}, - { (char *)"nbt_name_query_out_name_get", _wrap_nbt_name_query_out_name_get, METH_VARARGS, NULL}, + { (char *)"nbt_name_query_out_name_get", (PyCFunction)_wrap_nbt_name_query_out_name_get, METH_O, NULL}, { (char *)"nbt_name_query_out_num_addrs_set", _wrap_nbt_name_query_out_num_addrs_set, METH_VARARGS, NULL}, - { (char *)"nbt_name_query_out_num_addrs_get", _wrap_nbt_name_query_out_num_addrs_get, METH_VARARGS, NULL}, + { (char *)"nbt_name_query_out_num_addrs_get", (PyCFunction)_wrap_nbt_name_query_out_num_addrs_get, METH_O, NULL}, { (char *)"nbt_name_query_out_reply_addrs_set", _wrap_nbt_name_query_out_reply_addrs_set, METH_VARARGS, NULL}, - { (char *)"nbt_name_query_out_reply_addrs_get", _wrap_nbt_name_query_out_reply_addrs_get, METH_VARARGS, NULL}, - { (char *)"new_nbt_name_query_out", _wrap_new_nbt_name_query_out, METH_VARARGS, NULL}, - { (char *)"delete_nbt_name_query_out", _wrap_delete_nbt_name_query_out, METH_VARARGS, NULL}, + { (char *)"nbt_name_query_out_reply_addrs_get", (PyCFunction)_wrap_nbt_name_query_out_reply_addrs_get, METH_O, NULL}, + { (char *)"new_nbt_name_query_out", (PyCFunction)_wrap_new_nbt_name_query_out, METH_NOARGS, NULL}, + { (char *)"delete_nbt_name_query_out", (PyCFunction)_wrap_delete_nbt_name_query_out, METH_O, NULL}, { (char *)"nbt_name_query_out_swigregister", nbt_name_query_out_swigregister, METH_VARARGS, NULL}, + { (char *)"nbt_name_query_out_swiginit", nbt_name_query_out_swiginit, METH_VARARGS, NULL}, { (char *)"nbt_name_query_in_name_set", _wrap_nbt_name_query_in_name_set, METH_VARARGS, NULL}, - { (char *)"nbt_name_query_in_name_get", _wrap_nbt_name_query_in_name_get, METH_VARARGS, NULL}, + { (char *)"nbt_name_query_in_name_get", (PyCFunction)_wrap_nbt_name_query_in_name_get, METH_O, NULL}, { (char *)"nbt_name_query_in_dest_addr_set", _wrap_nbt_name_query_in_dest_addr_set, METH_VARARGS, NULL}, - { (char *)"nbt_name_query_in_dest_addr_get", _wrap_nbt_name_query_in_dest_addr_get, METH_VARARGS, NULL}, + { (char *)"nbt_name_query_in_dest_addr_get", (PyCFunction)_wrap_nbt_name_query_in_dest_addr_get, METH_O, NULL}, { (char *)"nbt_name_query_in_broadcast_set", _wrap_nbt_name_query_in_broadcast_set, METH_VARARGS, NULL}, - { (char *)"nbt_name_query_in_broadcast_get", _wrap_nbt_name_query_in_broadcast_get, METH_VARARGS, NULL}, + { (char *)"nbt_name_query_in_broadcast_get", (PyCFunction)_wrap_nbt_name_query_in_broadcast_get, METH_O, NULL}, { (char *)"nbt_name_query_in_wins_lookup_set", _wrap_nbt_name_query_in_wins_lookup_set, METH_VARARGS, NULL}, - { (char *)"nbt_name_query_in_wins_lookup_get", _wrap_nbt_name_query_in_wins_lookup_get, METH_VARARGS, NULL}, + { (char *)"nbt_name_query_in_wins_lookup_get", (PyCFunction)_wrap_nbt_name_query_in_wins_lookup_get, METH_O, NULL}, { (char *)"nbt_name_query_in_timeout_set", _wrap_nbt_name_query_in_timeout_set, METH_VARARGS, NULL}, - { (char *)"nbt_name_query_in_timeout_get", _wrap_nbt_name_query_in_timeout_get, METH_VARARGS, NULL}, + { (char *)"nbt_name_query_in_timeout_get", (PyCFunction)_wrap_nbt_name_query_in_timeout_get, METH_O, NULL}, { (char *)"nbt_name_query_in_retries_set", _wrap_nbt_name_query_in_retries_set, METH_VARARGS, NULL}, - { (char *)"nbt_name_query_in_retries_get", _wrap_nbt_name_query_in_retries_get, METH_VARARGS, NULL}, - { (char *)"new_nbt_name_query_in", _wrap_new_nbt_name_query_in, METH_VARARGS, NULL}, - { (char *)"delete_nbt_name_query_in", _wrap_delete_nbt_name_query_in, METH_VARARGS, NULL}, + { (char *)"nbt_name_query_in_retries_get", (PyCFunction)_wrap_nbt_name_query_in_retries_get, METH_O, NULL}, + { (char *)"new_nbt_name_query_in", (PyCFunction)_wrap_new_nbt_name_query_in, METH_NOARGS, NULL}, + { (char *)"delete_nbt_name_query_in", (PyCFunction)_wrap_delete_nbt_name_query_in, METH_O, NULL}, { (char *)"nbt_name_query_in_swigregister", nbt_name_query_in_swigregister, METH_VARARGS, NULL}, + { (char *)"nbt_name_query_in_swiginit", nbt_name_query_in_swiginit, METH_VARARGS, NULL}, { (char *)"new_char_ptr_array", (PyCFunction) _wrap_new_char_ptr_array, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"delete_char_ptr_array", (PyCFunction) _wrap_delete_char_ptr_array, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"char_ptr_array_getitem", (PyCFunction) _wrap_char_ptr_array_getitem, METH_VARARGS | METH_KEYWORDS, NULL}, @@ -4091,7 +4124,7 @@ static PyMethodDef SwigMethods[] = { static swig_type_info _swigt__p_TALLOC_CTX = {"_p_TALLOC_CTX", "TALLOC_CTX *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_char = {"_p_char", "char *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_event_context = {"_p_event_context", "struct event_context *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_event_context = {"_p_event_context", "struct event_context *|event *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_int = {"_p_int", "intptr_t *|int *|int_least32_t *|int_fast32_t *|int32_t *|int_fast16_t *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_long_long = {"_p_long_long", "int_least64_t *|int_fast64_t *|int64_t *|long long *|intmax_t *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_nbt_name = {"_p_nbt_name", "struct nbt_name *|nbt_name *", 0, 0, (void*)0, 0}; diff --git a/source4/libcli/swig/libcli_smb.i b/source4/libcli/swig/libcli_smb.i index 32e043b2c6..4125bcf5a9 100644 --- a/source4/libcli/swig/libcli_smb.i +++ b/source4/libcli/swig/libcli_smb.i @@ -9,8 +9,9 @@ #include "libcli/raw/libcliraw.h" %} -struct smbcli_socket *smbcli_sock_connect_byname(const char *host, int port, +struct smbcli_socket *smbcli_sock_connect_byname(const char *host, const char **ports, TALLOC_CTX *mem_ctx, + struct resolve_context *resolve_ctx, struct event_context *event_ctx); void smbcli_sock_dead(struct smbcli_socket *sock); diff --git a/source4/libcli/swig/libcli_smb.py b/source4/libcli/swig/libcli_smb.py index 466a04b9eb..80c4040237 100644 --- a/source4/libcli/swig/libcli_smb.py +++ b/source4/libcli/swig/libcli_smb.py @@ -2,7 +2,6 @@ # Version 1.3.33 # # Don't modify this file, modify the SWIG interface instead. -# This file is compatible with both classic and new-style classes. import _libcli_smb import new @@ -48,6 +47,16 @@ except AttributeError: del types +def _swig_setattr_nondynamic_method(set): + def set_attr(self,name,value): + if (name == "thisown"): return self.this.own(value) + if hasattr(self,name) or (name == "this"): + set(self,name,value) + else: + raise AttributeError("You cannot add attributes to %s" % self) + return set_attr + + import events smbcli_sock_connect_byname = _libcli_smb.smbcli_sock_connect_byname smbcli_sock_dead = _libcli_smb.smbcli_sock_dead diff --git a/source4/libcli/swig/libcli_smb_wrap.c b/source4/libcli/swig/libcli_smb_wrap.c index 313bcfeed3..8b71f2c3be 100644 --- a/source4/libcli/swig/libcli_smb_wrap.c +++ b/source4/libcli/swig/libcli_smb_wrap.c @@ -9,7 +9,7 @@ * ----------------------------------------------------------------------------- */ #define SWIGPYTHON -#define SWIG_PYTHON_DIRECTOR_NO_VTABLE +#define SWIG_PYTHON_NO_BUILD_NONE /* ----------------------------------------------------------------------------- * This section contains generic SWIG labels for method/variable * declarations/attributes, and other compiler dependent labels. @@ -2459,9 +2459,11 @@ SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int argnum, int flags) #define SWIGTYPE_p_TALLOC_CTX swig_types[0] #define SWIGTYPE_p_char swig_types[1] #define SWIGTYPE_p_event_context swig_types[2] -#define SWIGTYPE_p_smbcli_socket swig_types[3] -static swig_type_info *swig_types[5]; -static swig_module_info swig_module = {swig_types, 4, 0, 0, 0, 0}; +#define SWIGTYPE_p_p_char swig_types[3] +#define SWIGTYPE_p_resolve_context swig_types[4] +#define SWIGTYPE_p_smbcli_socket swig_types[5] +static swig_type_info *swig_types[7]; +static swig_module_info swig_module = {swig_types, 6, 0, 0, 0, 0}; #define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name) #define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name) @@ -2472,6 +2474,19 @@ static swig_module_info swig_module = {swig_types, 4, 0, 0, 0, 0}; # error "This python version requires swig to be run with the '-classic' option" # endif #endif +#if (PY_VERSION_HEX <= 0x02020000) +# error "This python version requires swig to be run with the '-nomodern' option" +#endif +#if (PY_VERSION_HEX <= 0x02020000) +# error "This python version requires swig to be run with the '-nomodernargs' option" +#endif +#ifndef METH_O +# error "This python version requires swig to be run with the '-nofastunpack' option" +#endif +#ifdef SWIG_TypeQuery +# undef SWIG_TypeQuery +#endif +#define SWIG_TypeQuery SWIG_Python_TypeQuery /*----------------------------------------------- @(target):= _libcli_smb.so @@ -2560,200 +2575,60 @@ SWIG_AsCharPtrAndSize(PyObject *obj, char** cptr, size_t* psize, int *alloc) - -#include <limits.h> -#if !defined(SWIG_NO_LLONG_MAX) -# if !defined(LLONG_MAX) && defined(__GNUC__) && defined (__LONG_LONG_MAX__) -# define LLONG_MAX __LONG_LONG_MAX__ -# define LLONG_MIN (-LLONG_MAX - 1LL) -# define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL) -# endif -#endif - - -SWIGINTERN int -SWIG_AsVal_double (PyObject *obj, double *val) -{ - int res = SWIG_TypeError; - if (PyFloat_Check(obj)) { - if (val) *val = PyFloat_AsDouble(obj); - return SWIG_OK; - } else if (PyInt_Check(obj)) { - if (val) *val = PyInt_AsLong(obj); - return SWIG_OK; - } else if (PyLong_Check(obj)) { - double v = PyLong_AsDouble(obj); - if (!PyErr_Occurred()) { - if (val) *val = v; - return SWIG_OK; - } else { - PyErr_Clear(); - } - } -#ifdef SWIG_PYTHON_CAST_MODE - { - int dispatch = 0; - double d = PyFloat_AsDouble(obj); - if (!PyErr_Occurred()) { - if (val) *val = d; - return SWIG_AddCast(SWIG_OK); - } else { - PyErr_Clear(); - } - if (!dispatch) { - long v = PyLong_AsLong(obj); - if (!PyErr_Occurred()) { - if (val) *val = v; - return SWIG_AddCast(SWIG_AddCast(SWIG_OK)); - } else { - PyErr_Clear(); - } - } - } -#endif - return res; -} - - -#include <float.h> - - -#include <math.h> - - -SWIGINTERNINLINE int -SWIG_CanCastAsInteger(double *d, double min, double max) { - double x = *d; - if ((min <= x && x <= max)) { - double fx = floor(x); - double cx = ceil(x); - double rd = ((x - fx) < 0.5) ? fx : cx; /* simple rint */ - if ((errno == EDOM) || (errno == ERANGE)) { - errno = 0; - } else { - double summ, reps, diff; - if (rd < x) { - diff = x - rd; - } else if (rd > x) { - diff = rd - x; - } else { - return 1; - } - summ = rd + x; - reps = diff/summ; - if (reps < 8*DBL_EPSILON) { - *d = rd; - return 1; - } - } - } - return 0; -} - - -SWIGINTERN int -SWIG_AsVal_long (PyObject *obj, long* val) -{ - if (PyInt_Check(obj)) { - if (val) *val = PyInt_AsLong(obj); - return SWIG_OK; - } else if (PyLong_Check(obj)) { - long v = PyLong_AsLong(obj); - if (!PyErr_Occurred()) { - if (val) *val = v; - return SWIG_OK; - } else { - PyErr_Clear(); - } - } -#ifdef SWIG_PYTHON_CAST_MODE - { - int dispatch = 0; - long v = PyInt_AsLong(obj); - if (!PyErr_Occurred()) { - if (val) *val = v; - return SWIG_AddCast(SWIG_OK); - } else { - PyErr_Clear(); - } - if (!dispatch) { - double d; - int res = SWIG_AddCast(SWIG_AsVal_double (obj,&d)); - if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, LONG_MIN, LONG_MAX)) { - if (val) *val = (long)(d); - return res; - } - } - } -#endif - return SWIG_TypeError; -} - - -SWIGINTERN int -SWIG_AsVal_int (PyObject * obj, int *val) -{ - long v; - int res = SWIG_AsVal_long (obj, &v); - if (SWIG_IsOK(res)) { - if ((v < INT_MIN || v > INT_MAX)) { - return SWIG_OverflowError; - } else { - if (val) *val = (int)(v); - } - } - return res; -} - #ifdef __cplusplus extern "C" { #endif SWIGINTERN PyObject *_wrap_smbcli_sock_connect_byname(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { PyObject *resultobj = 0; char *arg1 = (char *) 0 ; - int arg2 ; + char **arg2 = (char **) 0 ; TALLOC_CTX *arg3 = (TALLOC_CTX *) 0 ; - struct event_context *arg4 = (struct event_context *) 0 ; + struct resolve_context *arg4 = (struct resolve_context *) 0 ; + struct event_context *arg5 = (struct event_context *) 0 ; struct smbcli_socket *result = 0 ; int res1 ; char *buf1 = 0 ; int alloc1 = 0 ; - int val2 ; - int ecode2 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; void *argp4 = 0 ; int res4 = 0 ; + void *argp5 = 0 ; + int res5 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; + PyObject * obj3 = 0 ; char * kwnames[] = { - (char *) "host",(char *) "port",(char *) "event_ctx", NULL + (char *) "host",(char *) "ports",(char *) "resolve_ctx",(char *) "event_ctx", NULL }; - { - arg4 = event_context_init(NULL); - } - { - arg3 = NULL; - } - if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO|O:smbcli_sock_connect_byname",kwnames,&obj0,&obj1,&obj2)) SWIG_fail; + arg5 = event_context_init(NULL); + arg3 = NULL; + if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO|O:smbcli_sock_connect_byname",kwnames,&obj0,&obj1,&obj2,&obj3)) SWIG_fail; res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "smbcli_sock_connect_byname" "', argument " "1"" of type '" "char const *""'"); } arg1 = (char *)(buf1); - ecode2 = SWIG_AsVal_int(obj1, &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "smbcli_sock_connect_byname" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - if (obj2) { - res4 = SWIG_ConvertPtr(obj2, &argp4,SWIGTYPE_p_event_context, 0 | 0 ); - if (!SWIG_IsOK(res4)) { - SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "smbcli_sock_connect_byname" "', argument " "4"" of type '" "struct event_context *""'"); + res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_p_char, 0 | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "smbcli_sock_connect_byname" "', argument " "2"" of type '" "char const **""'"); + } + arg2 = (char **)(argp2); + res4 = SWIG_ConvertPtr(obj2, &argp4,SWIGTYPE_p_resolve_context, 0 | 0 ); + if (!SWIG_IsOK(res4)) { + SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "smbcli_sock_connect_byname" "', argument " "4"" of type '" "struct resolve_context *""'"); + } + arg4 = (struct resolve_context *)(argp4); + if (obj3) { + res5 = SWIG_ConvertPtr(obj3, &argp5,SWIGTYPE_p_event_context, 0 | 0 ); + if (!SWIG_IsOK(res5)) { + SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "smbcli_sock_connect_byname" "', argument " "5"" of type '" "struct event_context *""'"); } - arg4 = (struct event_context *)(argp4); + arg5 = (struct event_context *)(argp5); } - result = (struct smbcli_socket *)smbcli_sock_connect_byname((char const *)arg1,arg2,arg3,arg4); + result = (struct smbcli_socket *)smbcli_sock_connect_byname((char const *)arg1,(char const **)arg2,arg3,arg4,arg5); resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_smbcli_socket, 0 | 0 ); if (alloc1 == SWIG_NEWOBJ) free((char*)buf1); return resultobj; @@ -2798,25 +2673,33 @@ static PyMethodDef SwigMethods[] = { static swig_type_info _swigt__p_TALLOC_CTX = {"_p_TALLOC_CTX", "TALLOC_CTX *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_char = {"_p_char", "char *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_event_context = {"_p_event_context", "struct event_context *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_event_context = {"_p_event_context", "struct event_context *|event *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_p_char = {"_p_p_char", "char **", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_resolve_context = {"_p_resolve_context", "struct resolve_context *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_smbcli_socket = {"_p_smbcli_socket", "struct smbcli_socket *", 0, 0, (void*)0, 0}; static swig_type_info *swig_type_initial[] = { &_swigt__p_TALLOC_CTX, &_swigt__p_char, &_swigt__p_event_context, + &_swigt__p_p_char, + &_swigt__p_resolve_context, &_swigt__p_smbcli_socket, }; static swig_cast_info _swigc__p_TALLOC_CTX[] = { {&_swigt__p_TALLOC_CTX, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_char[] = { {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_event_context[] = { {&_swigt__p_event_context, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_p_char[] = { {&_swigt__p_p_char, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_resolve_context[] = { {&_swigt__p_resolve_context, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_smbcli_socket[] = { {&_swigt__p_smbcli_socket, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info *swig_cast_initial[] = { _swigc__p_TALLOC_CTX, _swigc__p_char, _swigc__p_event_context, + _swigc__p_p_char, + _swigc__p_resolve_context, _swigc__p_smbcli_socket, }; diff --git a/source4/libcli/util/asn1.c b/source4/libcli/util/asn1.c deleted file mode 100644 index aad55382d9..0000000000 --- a/source4/libcli/util/asn1.c +++ /dev/null @@ -1,770 +0,0 @@ -/* - Unix SMB/CIFS implementation. - simple ASN1 routines - Copyright (C) Andrew Tridgell 2001 - - 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 "includes.h" -#include "libcli/util/asn_1.h" - -/* allocate an asn1 structure */ -struct asn1_data *asn1_init(TALLOC_CTX *mem_ctx) -{ - struct asn1_data *ret = talloc_zero(mem_ctx, struct asn1_data); - if (ret == NULL) { - DEBUG(0,("asn1_init failed! out of memory\n")); - } - return ret; -} - -/* free an asn1 structure */ -void asn1_free(struct asn1_data *data) -{ - talloc_free(data); -} - -/* write to the ASN1 buffer, advancing the buffer pointer */ -bool asn1_write(struct asn1_data *data, const void *p, int len) -{ - if (data->has_error) return false; - if (data->length < data->ofs+len) { - uint8_t *newp; - newp = talloc_realloc(data, data->data, uint8_t, data->ofs+len); - if (!newp) { - asn1_free(data); - data->has_error = true; - return false; - } - data->data = newp; - data->length = data->ofs+len; - } - memcpy(data->data + data->ofs, p, len); - data->ofs += len; - return true; -} - -/* useful fn for writing a uint8_t */ -bool asn1_write_uint8(struct asn1_data *data, uint8_t v) -{ - return asn1_write(data, &v, 1); -} - -/* push a tag onto the asn1 data buffer. Used for nested structures */ -bool asn1_push_tag(struct asn1_data *data, uint8_t tag) -{ - struct nesting *nesting; - - asn1_write_uint8(data, tag); - nesting = talloc(data, struct nesting); - if (!nesting) { - data->has_error = true; - return false; - } - - nesting->start = data->ofs; - nesting->next = data->nesting; - data->nesting = nesting; - return asn1_write_uint8(data, 0xff); -} - -/* pop a tag */ -bool asn1_pop_tag(struct asn1_data *data) -{ - struct nesting *nesting; - size_t len; - - nesting = data->nesting; - - if (!nesting) { - data->has_error = true; - return false; - } - len = data->ofs - (nesting->start+1); - /* yes, this is ugly. We don't know in advance how many bytes the length - of a tag will take, so we assumed 1 byte. If we were wrong then we - need to correct our mistake */ - if (len > 0xFFFFFF) { - data->data[nesting->start] = 0x84; - if (!asn1_write_uint8(data, 0)) return false; - if (!asn1_write_uint8(data, 0)) return false; - if (!asn1_write_uint8(data, 0)) return false; - if (!asn1_write_uint8(data, 0)) return false; - memmove(data->data+nesting->start+5, data->data+nesting->start+1, len); - data->data[nesting->start+1] = (len>>24) & 0xFF; - data->data[nesting->start+2] = (len>>16) & 0xFF; - data->data[nesting->start+3] = (len>>8) & 0xFF; - data->data[nesting->start+4] = len&0xff; - } else if (len > 0xFFFF) { - data->data[nesting->start] = 0x83; - if (!asn1_write_uint8(data, 0)) return false; - if (!asn1_write_uint8(data, 0)) return false; - if (!asn1_write_uint8(data, 0)) return false; - memmove(data->data+nesting->start+4, data->data+nesting->start+1, len); - data->data[nesting->start+1] = (len>>16) & 0xFF; - data->data[nesting->start+2] = (len>>8) & 0xFF; - data->data[nesting->start+3] = len&0xff; - } else if (len > 255) { - data->data[nesting->start] = 0x82; - if (!asn1_write_uint8(data, 0)) return false; - if (!asn1_write_uint8(data, 0)) return false; - memmove(data->data+nesting->start+3, data->data+nesting->start+1, len); - data->data[nesting->start+1] = len>>8; - data->data[nesting->start+2] = len&0xff; - } else if (len > 127) { - data->data[nesting->start] = 0x81; - if (!asn1_write_uint8(data, 0)) return false; - memmove(data->data+nesting->start+2, data->data+nesting->start+1, len); - data->data[nesting->start+1] = len; - } else { - data->data[nesting->start] = len; - } - - data->nesting = nesting->next; - talloc_free(nesting); - return true; -} - -/* "i" is the one's complement representation, as is the normal result of an - * implicit signed->unsigned conversion */ - -static bool push_int_bigendian(struct asn1_data *data, unsigned int i, bool negative) -{ - uint8_t lowest = i & 0xFF; - - i = i >> 8; - if (i != 0) - if (!push_int_bigendian(data, i, negative)) - return false; - - if (data->nesting->start+1 == data->ofs) { - - /* We did not write anything yet, looking at the highest - * valued byte */ - - if (negative) { - /* Don't write leading 0xff's */ - if (lowest == 0xFF) - return true; - - if ((lowest & 0x80) == 0) { - /* The only exception for a leading 0xff is if - * the highest bit is 0, which would indicate - * a positive value */ - if (!asn1_write_uint8(data, 0xff)) - return false; - } - } else { - if (lowest & 0x80) { - /* The highest bit of a positive integer is 1, - * this would indicate a negative number. Push - * a 0 to indicate a positive one */ - if (!asn1_write_uint8(data, 0)) - return false; - } - } - } - - return asn1_write_uint8(data, lowest); -} - -/* write an Integer without the tag framing. Needed for example for the LDAP - * Abandon Operation */ - -bool asn1_write_implicit_Integer(struct asn1_data *data, int i) -{ - if (i == -1) { - /* -1 is special as it consists of all-0xff bytes. In - push_int_bigendian this is the only case that is not - properly handled, as all 0xff bytes would be handled as - leading ones to be ignored. */ - return asn1_write_uint8(data, 0xff); - } else { - return push_int_bigendian(data, i, i<0); - } -} - - -/* write an integer */ -bool asn1_write_Integer(struct asn1_data *data, int i) -{ - if (!asn1_push_tag(data, ASN1_INTEGER)) return false; - if (!asn1_write_implicit_Integer(data, i)) return false; - return asn1_pop_tag(data); -} - -bool ber_write_OID_String(DATA_BLOB *blob, const char *OID) -{ - uint_t v, v2; - const char *p = (const char *)OID; - char *newp; - int i; - - v = strtoul(p, &newp, 10); - if (newp[0] != '.') return false; - p = newp + 1; - - v2 = strtoul(p, &newp, 10); - if (newp[0] != '.') return false; - p = newp + 1; - - /*the ber representation can't use more space then the string one */ - *blob = data_blob(NULL, strlen(OID)); - if (!blob->data) return false; - - blob->data[0] = 40*v + v2; - - i = 1; - while (*p) { - v = strtoul(p, &newp, 10); - if (newp[0] == '.') { - p = newp + 1; - } else if (newp[0] == '\0') { - p = newp; - } else { - data_blob_free(blob); - return false; - } - if (v >= (1<<28)) blob->data[i++] = (0x80 | ((v>>28)&0x7f)); - if (v >= (1<<21)) blob->data[i++] = (0x80 | ((v>>21)&0x7f)); - if (v >= (1<<14)) blob->data[i++] = (0x80 | ((v>>14)&0x7f)); - if (v >= (1<<7)) blob->data[i++] = (0x80 | ((v>>7)&0x7f)); - blob->data[i++] = (v&0x7f); - } - - blob->length = i; - - return true; -} - -/* write an object ID to a ASN1 buffer */ -bool asn1_write_OID(struct asn1_data *data, const char *OID) -{ - DATA_BLOB blob; - - if (!asn1_push_tag(data, ASN1_OID)) return false; - - if (!ber_write_OID_String(&blob, OID)) { - data->has_error = true; - return false; - } - - if (!asn1_write(data, blob.data, blob.length)) { - data->has_error = true; - return false; - } - data_blob_free(&blob); - return asn1_pop_tag(data); -} - -/* write an octet string */ -bool asn1_write_OctetString(struct asn1_data *data, const void *p, size_t length) -{ - asn1_push_tag(data, ASN1_OCTET_STRING); - asn1_write(data, p, length); - asn1_pop_tag(data); - return !data->has_error; -} - -/* write a LDAP string */ -bool asn1_write_LDAPString(struct asn1_data *data, const char *s) -{ - asn1_write(data, s, strlen(s)); - return !data->has_error; -} - -/* write a LDAP string from a DATA_BLOB */ -bool asn1_write_DATA_BLOB_LDAPString(struct asn1_data *data, const DATA_BLOB *s) -{ - asn1_write(data, s->data, s->length); - return !data->has_error; -} - -/* write a general string */ -bool asn1_write_GeneralString(struct asn1_data *data, const char *s) -{ - asn1_push_tag(data, ASN1_GENERAL_STRING); - asn1_write_LDAPString(data, s); - asn1_pop_tag(data); - return !data->has_error; -} - -bool asn1_write_ContextSimple(struct asn1_data *data, uint8_t num, DATA_BLOB *blob) -{ - asn1_push_tag(data, ASN1_CONTEXT_SIMPLE(num)); - asn1_write(data, blob->data, blob->length); - asn1_pop_tag(data); - return !data->has_error; -} - -/* write a BOOLEAN */ -bool asn1_write_BOOLEAN(struct asn1_data *data, bool v) -{ - asn1_push_tag(data, ASN1_BOOLEAN); - asn1_write_uint8(data, v ? 0xFF : 0); - asn1_pop_tag(data); - return !data->has_error; -} - -bool asn1_read_BOOLEAN(struct asn1_data *data, bool *v) -{ - uint8_t tmp = 0; - asn1_start_tag(data, ASN1_BOOLEAN); - asn1_read_uint8(data, &tmp); - if (tmp == 0xFF) { - *v = true; - } else { - *v = false; - } - asn1_end_tag(data); - return !data->has_error; -} - -/* check a BOOLEAN */ -bool asn1_check_BOOLEAN(struct asn1_data *data, bool v) -{ - uint8_t b = 0; - - asn1_read_uint8(data, &b); - if (b != ASN1_BOOLEAN) { - data->has_error = true; - return false; - } - asn1_read_uint8(data, &b); - if (b != v) { - data->has_error = true; - return false; - } - return !data->has_error; -} - - -/* load a struct asn1_data structure with a lump of data, ready to be parsed */ -bool asn1_load(struct asn1_data *data, DATA_BLOB blob) -{ - ZERO_STRUCTP(data); - data->data = talloc_memdup(data, blob.data, blob.length); - if (!data->data) { - data->has_error = true; - return false; - } - data->length = blob.length; - return true; -} - -/* Peek into an ASN1 buffer, not advancing the pointer */ -bool asn1_peek(struct asn1_data *data, void *p, int len) -{ - if (data->has_error) - return false; - - if (len < 0 || data->ofs + len < data->ofs || data->ofs + len < len) - return false; - - if (data->ofs + len > data->length) { - /* we need to mark the buffer as consumed, so the caller knows - this was an out of data error, and not a decode error */ - data->ofs = data->length; - return false; - } - - memcpy(p, data->data + data->ofs, len); - return true; -} - -/* read from a ASN1 buffer, advancing the buffer pointer */ -bool asn1_read(struct asn1_data *data, void *p, int len) -{ - if (!asn1_peek(data, p, len)) { - data->has_error = true; - return false; - } - - data->ofs += len; - return true; -} - -/* read a uint8_t from a ASN1 buffer */ -bool asn1_read_uint8(struct asn1_data *data, uint8_t *v) -{ - return asn1_read(data, v, 1); -} - -bool asn1_peek_uint8(struct asn1_data *data, uint8_t *v) -{ - return asn1_peek(data, v, 1); -} - -bool asn1_peek_tag(struct asn1_data *data, uint8_t tag) -{ - uint8_t b; - - if (asn1_tag_remaining(data) <= 0) { - return false; - } - - if (!asn1_peek_uint8(data, &b)) - return false; - - return (b == tag); -} - -/* start reading a nested asn1 structure */ -bool asn1_start_tag(struct asn1_data *data, uint8_t tag) -{ - uint8_t b; - struct nesting *nesting; - - if (!asn1_read_uint8(data, &b)) - return false; - - if (b != tag) { - data->has_error = true; - return false; - } - nesting = talloc(data, struct nesting); - if (!nesting) { - data->has_error = true; - return false; - } - - if (!asn1_read_uint8(data, &b)) { - return false; - } - - if (b & 0x80) { - int n = b & 0x7f; - if (!asn1_read_uint8(data, &b)) - return false; - nesting->taglen = b; - while (n > 1) { - if (!asn1_read_uint8(data, &b)) - return false; - nesting->taglen = (nesting->taglen << 8) | b; - n--; - } - } else { - nesting->taglen = b; - } - nesting->start = data->ofs; - nesting->next = data->nesting; - data->nesting = nesting; - if (asn1_tag_remaining(data) == -1) { - return false; - } - return !data->has_error; -} - -/* stop reading a tag */ -bool asn1_end_tag(struct asn1_data *data) -{ - struct nesting *nesting; - - /* make sure we read it all */ - if (asn1_tag_remaining(data) != 0) { - data->has_error = true; - return false; - } - - nesting = data->nesting; - - if (!nesting) { - data->has_error = true; - return false; - } - - data->nesting = nesting->next; - talloc_free(nesting); - return true; -} - -/* work out how many bytes are left in this nested tag */ -int asn1_tag_remaining(struct asn1_data *data) -{ - int remaining; - if (data->has_error) { - return -1; - } - - if (!data->nesting) { - data->has_error = true; - return -1; - } - remaining = data->nesting->taglen - (data->ofs - data->nesting->start); - if (remaining > (data->length - data->ofs)) { - data->has_error = true; - return -1; - } - return remaining; -} - -/* read an object ID from a data blob */ -bool ber_read_OID_String(TALLOC_CTX *mem_ctx, DATA_BLOB blob, const char **OID) -{ - int i; - uint8_t *b; - uint_t v; - char *tmp_oid = NULL; - - if (blob.length < 2) return false; - - b = blob.data; - - tmp_oid = talloc_asprintf(mem_ctx, "%u", b[0]/40); - if (!tmp_oid) goto nomem; - tmp_oid = talloc_asprintf_append_buffer(tmp_oid, ".%u", b[0]%40); - if (!tmp_oid) goto nomem; - - for(i = 1, v = 0; i < blob.length; i++) { - v = (v<<7) | (b[i]&0x7f); - if ( ! (b[i] & 0x80)) { - tmp_oid = talloc_asprintf_append_buffer(tmp_oid, ".%u", v); - v = 0; - } - if (!tmp_oid) goto nomem; - } - - if (v != 0) { - talloc_free(tmp_oid); - return false; - } - - *OID = tmp_oid; - return true; - -nomem: - return false; -} - -/* read an object ID from a ASN1 buffer */ -bool asn1_read_OID(struct asn1_data *data, TALLOC_CTX *mem_ctx, const char **OID) -{ - DATA_BLOB blob; - int len; - - if (!asn1_start_tag(data, ASN1_OID)) return false; - - len = asn1_tag_remaining(data); - if (len < 0) { - data->has_error = true; - return false; - } - - blob = data_blob(NULL, len); - if (!blob.data) { - data->has_error = true; - return false; - } - - asn1_read(data, blob.data, len); - asn1_end_tag(data); - if (data->has_error) { - data_blob_free(&blob); - return false; - } - - if (!ber_read_OID_String(mem_ctx, blob, OID)) { - data->has_error = true; - data_blob_free(&blob); - return false; - } - - data_blob_free(&blob); - return true; -} - -/* check that the next object ID is correct */ -bool asn1_check_OID(struct asn1_data *data, const char *OID) -{ - const char *id; - - if (!asn1_read_OID(data, data, &id)) return false; - - if (strcmp(id, OID) != 0) { - talloc_free(discard_const(id)); - data->has_error = true; - return false; - } - talloc_free(discard_const(id)); - return true; -} - -/* read a LDAPString from a ASN1 buffer */ -bool asn1_read_LDAPString(struct asn1_data *data, TALLOC_CTX *mem_ctx, char **s) -{ - int len; - len = asn1_tag_remaining(data); - if (len < 0) { - data->has_error = true; - return false; - } - *s = talloc_array(mem_ctx, char, len+1); - if (! *s) { - data->has_error = true; - return false; - } - asn1_read(data, *s, len); - (*s)[len] = 0; - return !data->has_error; -} - - -/* read a GeneralString from a ASN1 buffer */ -bool asn1_read_GeneralString(struct asn1_data *data, TALLOC_CTX *mem_ctx, char **s) -{ - if (!asn1_start_tag(data, ASN1_GENERAL_STRING)) return false; - if (!asn1_read_LDAPString(data, mem_ctx, s)) return false; - return asn1_end_tag(data); -} - - -/* read a octet string blob */ -bool asn1_read_OctetString(struct asn1_data *data, TALLOC_CTX *mem_ctx, DATA_BLOB *blob) -{ - int len; - ZERO_STRUCTP(blob); - if (!asn1_start_tag(data, ASN1_OCTET_STRING)) return false; - len = asn1_tag_remaining(data); - if (len < 0) { - data->has_error = true; - return false; - } - *blob = data_blob_talloc(mem_ctx, NULL, len+1); - if (!blob->data) { - data->has_error = true; - return false; - } - asn1_read(data, blob->data, len); - asn1_end_tag(data); - blob->length--; - blob->data[len] = 0; - - if (data->has_error) { - data_blob_free(blob); - *blob = data_blob(NULL, 0); - return false; - } - return true; -} - -bool asn1_read_ContextSimple(struct asn1_data *data, uint8_t num, DATA_BLOB *blob) -{ - int len; - ZERO_STRUCTP(blob); - if (!asn1_start_tag(data, ASN1_CONTEXT_SIMPLE(num))) return false; - len = asn1_tag_remaining(data); - if (len < 0) { - data->has_error = true; - return false; - } - *blob = data_blob(NULL, len); - if ((len != 0) && (!blob->data)) { - data->has_error = true; - return false; - } - asn1_read(data, blob->data, len); - asn1_end_tag(data); - return !data->has_error; -} - -/* read an integer without tag*/ -bool asn1_read_implicit_Integer(struct asn1_data *data, int *i) -{ - uint8_t b; - *i = 0; - - while (!data->has_error && asn1_tag_remaining(data)>0) { - if (!asn1_read_uint8(data, &b)) return false; - *i = (*i << 8) + b; - } - return !data->has_error; - -} - -/* read an integer */ -bool asn1_read_Integer(struct asn1_data *data, int *i) -{ - *i = 0; - - if (!asn1_start_tag(data, ASN1_INTEGER)) return false; - if (!asn1_read_implicit_Integer(data, i)) return false; - return asn1_end_tag(data); -} - -/* read an integer */ -bool asn1_read_enumerated(struct asn1_data *data, int *v) -{ - *v = 0; - - if (!asn1_start_tag(data, ASN1_ENUMERATED)) return false; - while (!data->has_error && asn1_tag_remaining(data)>0) { - uint8_t b; - asn1_read_uint8(data, &b); - *v = (*v << 8) + b; - } - return asn1_end_tag(data); -} - -/* check a enumerated value is correct */ -bool asn1_check_enumerated(struct asn1_data *data, int v) -{ - uint8_t b; - if (!asn1_start_tag(data, ASN1_ENUMERATED)) return false; - asn1_read_uint8(data, &b); - asn1_end_tag(data); - - if (v != b) - data->has_error = false; - - return !data->has_error; -} - -/* write an enumerated value to the stream */ -bool asn1_write_enumerated(struct asn1_data *data, uint8_t v) -{ - if (!asn1_push_tag(data, ASN1_ENUMERATED)) return false; - asn1_write_uint8(data, v); - asn1_pop_tag(data); - return !data->has_error; -} - -/* - check if a ASN.1 blob is a full tag -*/ -NTSTATUS asn1_full_tag(DATA_BLOB blob, uint8_t tag, size_t *packet_size) -{ - struct asn1_data *asn1 = asn1_init(NULL); - int size; - - NT_STATUS_HAVE_NO_MEMORY(asn1); - - asn1->data = blob.data; - asn1->length = blob.length; - asn1_start_tag(asn1, tag); - if (asn1->has_error) { - talloc_free(asn1); - return STATUS_MORE_ENTRIES; - } - size = asn1_tag_remaining(asn1) + asn1->ofs; - - talloc_free(asn1); - - if (size > blob.length) { - return STATUS_MORE_ENTRIES; - } - - *packet_size = size; - return NT_STATUS_OK; -} diff --git a/source4/libcli/util/asn_1.h b/source4/libcli/util/asn_1.h deleted file mode 100644 index 612a8a932f..0000000000 --- a/source4/libcli/util/asn_1.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - Unix SMB/CIFS implementation. - simple ASN1 code - Copyright (C) Andrew Tridgell 2001 - - 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 _ASN_1_H -#define _ASN_1_H - -struct nesting { - off_t start; - size_t taglen; /* for parsing */ - struct nesting *next; -}; - -struct asn1_data { - uint8_t *data; - size_t length; - off_t ofs; - struct nesting *nesting; - bool has_error; -}; - -#define ASN1_APPLICATION(x) ((x)+0x60) -#define ASN1_APPLICATION_SIMPLE(x) ((x)+0x40) -#define ASN1_SEQUENCE(x) ((x)+0x30) -#define ASN1_CONTEXT(x) ((x)+0xa0) -#define ASN1_CONTEXT_SIMPLE(x) ((x)+0x80) -#define ASN1_GENERAL_STRING 0x1b -#define ASN1_OCTET_STRING 0x4 -#define ASN1_OID 0x6 -#define ASN1_BOOLEAN 0x1 -#define ASN1_INTEGER 0x2 -#define ASN1_ENUMERATED 0xa -#define ASN1_SET 0x31 - -#define ASN1_MAX_OIDS 20 - -#include "libcli/util/asn1_proto.h" - -#endif /* _ASN_1_H */ |