/*en    Laurent Constantin's network library (lcrzo)
                 lcrzo_priv module

  Functions herein are private.
*/
/*fr    Bibliotheque reseau de Laurent Constantin (lcrzo)
                 Module lcrzo_priv

  Les fonctions presentes dans ce module sont privees a la bibliotheque.
*/

/*-------------------------------------------------------------*/
int lcrzo_priv_err_fprint(LCRZOFILE *pf,
			  int err, 
			  int language);

/*-------------------------------------------------------------*/
int lcrzo_priv_global_set_errmsglcrzo(lcrzo_conststring string);
int lcrzo_priv_global_get_errmsglcrzo(lcrzo_string *pstring);
int lcrzo_priv_global_set_errmsgsys(lcrzo_conststring string);
int lcrzo_priv_global_get_errmsgsys(lcrzo_string *pstring);

/*-------------------------------------------------------------*/
typedef struct
{ lcrzo_uint32 time_sleep_usec_numberforloop;
  lcrzo_uint16 sniff_reas_threshold_ipvu;
  lcrzo_uint16 sniff_reas_threshold_ipat;
  lcrzo_uint16 sniff_reas_threshold_tcp;
  lcrzo_bool intspoof_eth_randconstdone;
  lcrzo_bool intspoof_eth_compconstdone;
  lcrzo_etha intspoof_eth_savedetha;
  lcrzo_bool intspoof_ip_randconstdone;
  lcrzo_bool intspoof_ip_compconstdone;
  lcrzo_ipa  intspoof_ip_savedipa;
} lcrzo_priv_staticvars;
int lcrzo_priv_staticvars_init(lcrzo_priv_staticvars *ptr);
int lcrzo_priv_staticvars_close(lcrzo_priv_staticvars *ptr);
int lcrzo_priv_staticvars_ptr_get(lcrzo_priv_staticvars **pptr);
int lcrzo_priv_staticvars_copy(lcrzo_priv_staticvars *srcptr,
                               lcrzo_priv_staticvars *dstptr);

/*-------------------------------------------------------------*/
typedef struct
{ lcrzo_uint32 seed;
} lcrzo_priv_randomvars;
int lcrzo_priv_randomvars_init(lcrzo_priv_randomvars *ptr);
int lcrzo_priv_randomvars_close(lcrzo_priv_randomvars *ptr);
int lcrzo_priv_randomvars_ptr_get(lcrzo_priv_randomvars **pptr);
int lcrzo_priv_randomvars_copy(lcrzo_priv_randomvars *srcptr,
                               lcrzo_priv_randomvars *dstptr);

/*-------------------------------------------------------------*/
typedef struct {
  lcrzo_list list_system_devices;
  lcrzo_list list_system_arpperm;
  lcrzo_list list_system_arpcache;
  lcrzo_list list_system_routes;
  lcrzo_list list_systemdel_devices;
  lcrzo_list list_systemdel_arpperm;
  lcrzo_list list_systemdel_arpcache;
  lcrzo_list list_systemdel_routes;
  lcrzo_list list_user_devices;
  lcrzo_list list_user_arpperm;
  lcrzo_list list_user_arpcache;
  lcrzo_list list_user_routes;
  lcrzo_list list_sys_devices;
  lcrzo_list list_sys_arpperm;
  lcrzo_list list_sys_arpcache;
  lcrzo_list list_sys_routes;
  lcrzo_list list_conf_devices;
  lcrzo_list list_conf_arpperm;
  lcrzo_list list_conf_arpcache;
  lcrzo_list list_conf_routes;
  lcrzo_list list_devicenumbername;
  lcrzo_list list_localeth;
  lcrzo_list list_localip;
  lcrzo_list list_validdhcpinfo;
  lcrzo_bool sysrenew_allow;
  lcrzo_bool sysrenew_allow_devices;
  lcrzo_bool sysrenew_allow_arpperm;
  lcrzo_bool sysrenew_allow_arpcache;
  lcrzo_bool sysrenew_allow_routes;
  lcrzo_bool sysrenew_now;
  lcrzo_bool sysrenew_now_devices;
  lcrzo_bool sysrenew_now_arpperm;
  lcrzo_bool sysrenew_now_arpcache;
  lcrzo_bool sysrenew_now_routes;
  lcrzo_bool compute_sys_devices;
  lcrzo_bool compute_sys_arpperm;
  lcrzo_bool compute_sys_arpcache;
  lcrzo_bool compute_sys_routes;
  lcrzo_bool compute_conf_devices;
  lcrzo_bool compute_conf_arpperm;
  lcrzo_bool compute_conf_arpcache;
  lcrzo_bool compute_conf_routes;
  lcrzo_uint32 cacheentriestimeout;
  lcrzo_uint32 permentriesperiod;
  lcrzo_uint32 permentrieslastupdatetime;
} lcrzo_priv_confvars;
int lcrzo_priv_confvars_init(lcrzo_priv_confvars *ptr);
int lcrzo_priv_confvars_close(lcrzo_priv_confvars *ptr);
int lcrzo_priv_confvars_ptr_get(lcrzo_priv_confvars **pptr);
int lcrzo_priv_confvars_copy(lcrzo_priv_confvars *srcptr,
                             lcrzo_priv_confvars *dstptr);

/*-------------------------------------------------------------*/
typedef struct
{ lcrzo_string errmsglcrzo;
  lcrzo_string errmsgsys;
  lcrzo_int16 language;
  lcrzo_uint8 sock_tcpser_backlog;
  lcrzo_uint32 time_sleep_threshold1;
  lcrzo_uint32 time_sleep_threshold2;
  lcrzo_uint32 time_sleep_threshold3;
  lcrzo_bool record_open_mustbeanexistentfile;
  lcrzo_bool record_open_mustbeanewfile;
  lcrzo_bool hdr_compfields;
  lcrzo_bool hdr_compfield_ethtype;
  lcrzo_bool hdr_compfield_iptotlen;
  lcrzo_bool hdr_compfield_ipihl;
  lcrzo_bool hdr_compfield_ipcheck;
  lcrzo_bool hdr_compfield_ipprotocol;
  lcrzo_bool hdr_compfield_udplen;
  lcrzo_bool hdr_compfield_udpcheck;
  lcrzo_bool hdr_compfield_tcpdoff;
  lcrzo_bool hdr_compfield_tcpcheck;
  lcrzo_bool hdr_compfield_icmpcheck;
  lcrzo_uint8 intspoof_eth_type;
  lcrzo_etha  intspoof_eth_address;
  lcrzo_uint8 intspoof_ip_type;
  lcrzo_ipa   intspoof_ip_address;
  lcrzo_uint8 resolver_timeout;
  lcrzo_uint16 sniff_ipreastimeout1;
  lcrzo_uint16 sniff_ipreastimeout2;
  lcrzo_uint16 sniff_tcpreortimeout1;
  lcrzo_uint16 sniff_tcpreortimeout2;
  lcrzo_uint16 spoof_fragoctosize;
  lcrzo_bool spoof_printbeforesending;
  lcrzo_printprofile spoof_printprofile;
  lcrzo_bool spoof_useethforip;
  lcrzo_bool sock_virt_answeralive;
  lcrzo_bool data_regexp_casesensitive;
  lcrzo_uint8 (*pprocess_int2uint8)(int ret);
  int (*perr_displayfunction)(int ret);
  lcrzo_uint32 windows_systemversion;
  lcrzo_priv_staticvars staticvars;
  lcrzo_priv_randomvars randomvars;
  lcrzo_priv_confvars confvars;
} lcrzo_priv_globalvars;
int lcrzo_priv_globalvars_init(void);
int lcrzo_priv_globalvars_close(void);
int lcrzo_priv_globalvars_ptr_get(lcrzo_priv_globalvars **pptr);
int lcrzo_priv_globalvars_copy(lcrzo_priv_globalvars *srcptr);

/*-------------------------------------------------------------*/
int lcrzo_priv_conf_devices_add_system(lcrzo_constdevice device,
	  		               lcrzo_constetha etha,
			               lcrzo_ipl ipl,
			               lcrzo_ipl netmask,
			               lcrzo_uint32 mtu,
			               lcrzo_bool isup,
			               lcrzo_bool isanalias);
int lcrzo_priv_conf_arp_add_system(lcrzo_constdevice device,
		                   lcrzo_constetha etha,
		                   lcrzo_ipl ipl,
		                   lcrzo_bool ispermanent);
int lcrzo_priv_conf_routes_add_system(lcrzo_constdevice device, 
			              lcrzo_ipl dest,
			              lcrzo_ipl mask,
			              lcrzo_ipl ipsource,
			              lcrzo_ipl gateway,
                                      lcrzo_uint32 metric,
			              lcrzo_bool isup);
