#ifndef _REMOTECONF_H
#define _REMOTECONF_H
#include <sys/queue.h>
#include "genlist.h"
#ifdef ENABLE_HYBRID
#include "isakmp_var.h"
#include "isakmp_xauth.h"
#endif
struct ph1handle;
struct secprotospec;
struct etypes {
int type;
struct etypes *next;
};
struct isakmpsa {
int prop_no;
int trns_no;
time_t lifetime;
size_t lifebyte;
int enctype;
int encklen;
int authmethod;
int hashtype;
int vendorid;
#ifdef HAVE_GSSAPI
vchar_t *gssid;
#endif
int dh_group;
struct dhgroup *dhgrp;
struct isakmpsa *next;
};
struct rmconf_cert {
vchar_t *data;
char *filename;
};
#define SCRIPT_PHASE1_UP 0
#define SCRIPT_PHASE1_DOWN 1
#define SCRIPT_PHASE1_DEAD 2
#define SCRIPT_MAX 2
extern const char *script_names[SCRIPT_MAX + 1];
struct remoteconf {
char *name;
struct sockaddr *remote;
struct etypes *etypes;
int doitype;
int sittype;
int idvtype;
vchar_t *idv;
vchar_t *key;
struct genlist *idvl_p;
char *myprivfile;
char *mycertfile;
vchar_t *mycert;
char *peerscertfile;
vchar_t *peerscert;
char *cacertfile;
vchar_t *cacert;
int send_cert;
int send_cr;
int match_empty_cr;
int verify_cert;
int verify_identifier;
int nonce_size;
int passive;
int ike_frag;
int esp_frag;
int mode_cfg;
int support_proxy;
#define GENERATE_POLICY_NONE 0
#define GENERATE_POLICY_REQUIRE 1
#define GENERATE_POLICY_UNIQUE 2
int gen_policy;
int ini_contact;
int pcheck_level;
int nat_traversal;
vchar_t *script[SCRIPT_MAX + 1];
int dh_group;
struct dhgroup *dhgrp;
int dpd;
int dpd_retry;
int dpd_interval;
int dpd_maxfails;
int rekey;
#define REKEY_OFF FALSE
#define REKEY_ON TRUE
#define REKEY_FORCE 2
uint32_t ph1id;
int weak_phase1_check;
struct isakmpsa *proposal;
struct remoteconf *inherited_from;
time_t lifetime;
int lifebyte;
struct secprotospec *spspec;
struct genlist *rsa_private,
*rsa_public;
#ifdef ENABLE_HYBRID
struct xauth_rmconf *xauth;
#endif
TAILQ_ENTRY(remoteconf) chain;
};
#define RMCONF_NONCE_SIZE(rmconf) \
(rmconf != NULL ? rmconf->nonce_size : DEFAULT_NONCE_SIZE)
struct dhgroup;
struct idspec {
int idtype;
vchar_t *id;
};
struct rmconfselector {
int flags;
struct sockaddr *remote;
int etype;
struct isakmpsa *approval;
vchar_t *identity;
vchar_t *certificate_request;
};
extern void rmconf_selector_from_ph1(struct rmconfselector *rmsel,
struct ph1handle *iph1);
extern int enumrmconf(struct rmconfselector *rmsel,
int (* enum_func)(struct remoteconf *rmconf, void *arg), void *enum_arg);
#define GETRMCONF_F_NO_ANONYMOUS 0x0001
#define GETRMCONF_F_NO_PASSIVE 0x0002
#define RMCONF_ERR_MULTIPLE ((struct remoteconf *) -1)
extern int rmconf_match_identity(struct remoteconf *rmconf, vchar_t *id_p);
extern struct remoteconf *getrmconf(struct sockaddr *remote, int flags);
extern struct remoteconf *getrmconf_by_ph1(struct ph1handle *iph1);
extern struct remoteconf *getrmconf_by_name(const char *name);
extern struct remoteconf *newrmconf(void);
extern struct remoteconf *duprmconf_shallow(struct remoteconf *);
extern int duprmconf_finish(struct remoteconf *);
extern void delrmconf(struct remoteconf *);
extern void deletypes(struct etypes *);
extern struct etypes * dupetypes(struct etypes *);
extern void insrmconf(struct remoteconf *);
extern void remrmconf(struct remoteconf *);
extern void flushrmconf(void);
extern void dupspspec_list(struct remoteconf *, struct remoteconf *);
extern void flushspspec(struct remoteconf *);
extern void initrmconf(void);
extern void rmconf_start_reload(void);
extern void rmconf_finish_reload(void);
extern int check_etypeok(struct remoteconf *, void *);
extern struct isakmpsa *newisakmpsa(void);
extern struct isakmpsa *dupisakmpsa(struct isakmpsa *);
extern void delisakmpsa(struct isakmpsa *);
extern void insisakmpsa(struct isakmpsa *, struct remoteconf *);
#ifdef ENABLE_HYBRID
extern int isakmpsa_switch_authmethod(int authmethod);
#else
static inline int isakmpsa_switch_authmethod(int authmethod)
{
return authmethod;
}
#endif
extern struct isakmpsa * checkisakmpsa(int pcheck, struct isakmpsa *proposal,
struct isakmpsa *acceptable);
extern void dumprmconf(void);
extern struct idspec *newidspec(void);
extern vchar_t *script_path_add(vchar_t *);
#endif