2004-08-18 15:01:06 +04:00
/*
Unix SMB / CIFS implementation .
Copyright ( C ) Stefan Metzmacher 2004
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
2007-07-10 06:07:03 +04:00
the Free Software Foundation ; either version 3 of the License , or
2004-08-18 15:01:06 +04:00
( 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
2007-07-10 06:07:03 +04:00
along with this program . If not , see < http : //www.gnu.org/licenses/>.
2004-08-18 15:01:06 +04:00
*/
# include "includes.h"
2004-11-02 14:42:35 +03:00
# include "libnet/libnet.h"
2005-06-16 15:36:09 +04:00
# include "lib/events/events.h"
2007-09-08 16:42:09 +04:00
# include "param/param.h"
2004-08-18 15:01:06 +04:00
2005-06-16 15:36:09 +04:00
struct libnet_context * libnet_context_init ( struct event_context * ev )
2004-08-18 15:01:06 +04:00
{
struct libnet_context * ctx ;
2005-07-02 18:32:49 +04:00
/* create brand new libnet context */
2006-09-16 21:59:33 +04:00
ctx = talloc ( ev , struct libnet_context ) ;
2004-08-18 15:01:06 +04:00
if ( ! ctx ) {
return NULL ;
}
2005-07-02 18:32:49 +04:00
/* events */
2005-06-16 15:36:09 +04:00
if ( ev = = NULL ) {
2005-11-19 02:27:58 +03:00
ev = event_context_find ( ctx ) ;
2005-06-16 15:36:09 +04:00
if ( ev = = NULL ) {
talloc_free ( ctx ) ;
return NULL ;
}
}
ctx - > event_ctx = ev ;
2004-08-18 15:01:06 +04:00
2005-11-21 01:00:47 +03:00
/* name resolution methods */
2006-01-13 03:54:53 +03:00
ctx - > name_res_methods = str_list_copy ( ctx , lp_name_resolve_order ( ) ) ;
2006-05-16 01:49:27 +04:00
2006-08-22 00:52:14 +04:00
/* connected services' params */
ZERO_STRUCT ( ctx - > samr ) ;
2007-05-12 01:44:18 +04:00
ZERO_STRUCT ( ctx - > lsa ) ;
/* default buffer size for various operations requiring specifying a buffer */
ctx - > samr . buf_size = 128 ;
2006-05-18 02:21:24 +04:00
2004-08-18 15:01:06 +04:00
return ctx ;
}