本文整理汇总了C++中DBG_log函数的典型用法代码示例。如果您正苦于以下问题:C++ DBG_log函数的具体用法?C++ DBG_log怎么用?C++ DBG_log使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了DBG_log函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: db_prop_print
static void db_prop_print(struct db_prop *p)
{
struct db_trans *t;
struct db_attr *a;
int ti, ai;
enum_names *n, *n_at, *n_av;
DBG_log("protoid=\"%s\"\n", enum_name(&protocol_names, p->protoid));
for (ti=0, t=p->trans; ti< p->trans_cnt; ti++, t++) {
switch( p->protoid) {
case PROTO_ISAKMP:
n=&isakmp_transformid_names;
break;
case PROTO_IPSEC_ESP:
n=&esp_transformid_names;
break;
case PROTO_IPSEC_AH:
n=&ah_transformid_names;
break;
default:
continue;
}
DBG_log(" transid=\"%s\"\n", enum_name(n, t->transid));
for (ai=0, a=t->attrs; ai < t->attr_cnt; ai++, a++) {
int i;
switch( p->protoid) {
case PROTO_ISAKMP:
n_at=&oakley_attr_names;
i=a->type|ISAKMP_ATTR_AF_TV;
n_av=oakley_attr_val_descs[(i)&ISAKMP_ATTR_RTYPE_MASK];
break;
case PROTO_IPSEC_AH:
case PROTO_IPSEC_ESP:
n_at=&ipsec_attr_names;
i=a->type|ISAKMP_ATTR_AF_TV;
n_av=ipsec_attr_val_descs[(i)&ISAKMP_ATTR_RTYPE_MASK];
break;
default:
continue;
}
DBG_log(" type=\"%s\" value=\"%s\"\n",
enum_name(n_at, i),
enum_name(n_av, a->val));
}
}
}
示例2: _natd_hash
static void _natd_hash(const struct hash_desc *hasher, unsigned char *hash
, u_int8_t *icookie, u_int8_t *rcookie
, const ip_address *ip, u_int16_t port)
{
union hash_ctx ctx;
if (is_zero_cookie(icookie))
DBG_log("_natd_hash: Warning, icookie is zero !!");
if (is_zero_cookie(rcookie))
DBG_log("_natd_hash: Warning, rcookie is zero !!");
/**
* draft-ietf-ipsec-nat-t-ike-01.txt
*
* HASH = HASH(CKY-I | CKY-R | IP | Port)
*
* All values in network order
*/
hasher->hash_init(&ctx);
hasher->hash_update(&ctx, icookie, COOKIE_SIZE);
hasher->hash_update(&ctx, rcookie, COOKIE_SIZE);
switch (addrtypeof(ip)) {
case AF_INET:
hasher->hash_update(&ctx,
(const u_char *)&ip->u.v4.sin_addr.s_addr,
sizeof(ip->u.v4.sin_addr.s_addr));
break;
case AF_INET6:
hasher->hash_update(&ctx,
(const u_char *)&ip->u.v6.sin6_addr.s6_addr,
sizeof(ip->u.v6.sin6_addr.s6_addr));
break;
}
hasher->hash_update(&ctx, (const u_char *)&port, sizeof(u_int16_t));
hasher->hash_final(hash, &ctx);
#ifdef NAT_D_DEBUG
DBG(DBG_NATT,
DBG_log("_natd_hash: hasher=%p(%d)", hasher, (int)hasher->hash_digest_len);
DBG_dump("_natd_hash: icookie=", icookie, COOKIE_SIZE);
DBG_dump("_natd_hash: rcookie=", rcookie, COOKIE_SIZE);
switch (addrtypeof(ip)) {
case AF_INET:
DBG_dump("_natd_hash: ip=", &ip->u.v4.sin_addr.s_addr,
sizeof(ip->u.v4.sin_addr.s_addr));
break;
}
DBG_log("_natd_hash: port=%d", ntohs(port));
DBG_dump("_natd_hash: hash=", hash, hasher->hash_digest_len);
);
示例3: kernel_alg_db_new
/*
* Create proposal with runtime kernel algos, merging
* with passed proposal if not NULL
*
* for now this function does free() previous returned
* malloced pointer (this quirk allows easier spdb.c change)
*/
struct db_context *
kernel_alg_db_new(struct alg_info_esp *alg_info, lset_t policy, bool logit)
{
int ealg_i, aalg_i, tn=0;
int i;
const struct esp_info *esp_info;
struct esp_info tmp_esp_info;
struct db_context *ctx_new=NULL;
struct db_trans *t;
struct db_prop *prop;
int trans_cnt;
bool success = TRUE;
if (!(policy & POLICY_ENCRYPT)) { /* possible for AH-only modes */
DBG(DBG_CONTROL
, DBG_log("algo code only works for encryption modes"));
return NULL;
}
trans_cnt=(esp_ealg_num*esp_aalg_num);
DBG(DBG_EMITTING, DBG_log("kernel_alg_db_new() "
"initial trans_cnt=%d",
trans_cnt));
/* pass aprox. number of transforms and attributes */
ctx_new = db_prop_new(PROTO_IPSEC_ESP, trans_cnt, trans_cnt * 2);
/*
* Loop: for each element (struct esp_info) of
* alg_info, if kernel support is present then
* build the transform (and attrs)
*
* if NULL alg_info, propose everything ...
*/
/* passert(alg_info!=0); */
if (alg_info) {
ALG_INFO_ESP_FOREACH(alg_info, esp_info, i) {
bool thistime;
tmp_esp_info = *esp_info;
thistime = kernel_alg_db_add(ctx_new
, &tmp_esp_info
, policy, logit);
if(thistime == FALSE) {
success=FALSE;
}
}
} else {
示例4: kernel_alg_add
/* used by kernel_netlink.c and kernel_bsdkame.c */
int kernel_alg_add(int satype, int exttype, const struct sadb_alg *sadb_alg)
{
struct sadb_alg *alg_p, tmp_alg;
uint8_t alg_id = sadb_alg->sadb_alg_id;
if (DBGP(DBG_KERNEL|DBG_CRYPT)) {
const char *exttype_name =
exttype == SADB_EXT_SUPPORTED_AUTH ? "SADB_EXT_SUPPORTED_AUTH"
: exttype == SADB_EXT_SUPPORTED_ENCRYPT ? "SADB_EXT_SUPPORTED_ENCRYPT"
: "SADB_EXT_SUPPORTED_???";
struct esb_buf alg_name_buf;
/*
* XXX: The ALG_ID value found here comes from the
* Linux kernel (see libreswan/pfkeyv2.h) so using
* AH_TRANSFORMID_NAMES and ESP_TRANSFORMID_NAMES is
* only an approximation.
*/
const char *alg_name =
exttype == SADB_EXT_SUPPORTED_AUTH ? enum_showb(&ah_transformid_names, alg_id, &alg_name_buf)
: exttype == SADB_EXT_SUPPORTED_ENCRYPT ? enum_showb(&esp_transformid_names, alg_id, &alg_name_buf)
: "???";
const char *satype_name =
satype == SADB_SATYPE_ESP ? "SADB_SATYPE_ESP"
: satype == SADB_SATYPE_AH ? "SADB_SATYPE_AH"
: "SADB_SATYPE_???";
DBG_log("kernel_alg_add(): satype=%d(%s), exttype=%d(%s), alg_id=%d(%s), alg_ivlen=%d, alg_minbits=%d, alg_maxbits=%d",
satype, satype_name,
exttype, exttype_name,
alg_id, alg_name,
sadb_alg->sadb_alg_ivlen,
sadb_alg->sadb_alg_minbits,
sadb_alg->sadb_alg_maxbits);
}
alg_p = sadb_alg_ptr(satype, exttype, alg_id, TRUE);
if (alg_p == NULL) {
DBG(DBG_KERNEL,
DBG_log("kernel_alg_add(%d,%d,%d) fails because alg combo is invalid",
satype, exttype, alg_id));
return -1;
}
/* This logic "mimics" KLIPS: first algo implementation will be used */
if (alg_p->sadb_alg_id != 0) {
DBG(DBG_KERNEL,
DBG_log("kernel_alg_add(): discarding already setup satype=%d, exttype=%d, alg_id=%d",
satype, exttype,
alg_id);
);
示例5: load_setup
static void load_setup(starter_config_t *cfg, config_parsed_t *cfgp)
{
kw_list_t *kw;
DBG(DBG_CONTROL,
DBG_log("Loading config setup")
)
for (kw = cfgp->config_setup; kw; kw = kw->next)
{
bool assigned = FALSE;
kw_token_t token = kw->entry->token;
if (token < KW_SETUP_FIRST || token > KW_SETUP_LAST)
{
plog("# unsupported keyword '%s' in config setup", kw->entry->name);
cfg->err++;
continue;
}
if (!assign_arg(token, KW_SETUP_FIRST, kw, (char *)cfg, &assigned))
{
plog(" bad argument value in config setup");
cfg->err++;
continue;
}
}
}
示例6: unpack_KE
/*
* Processing FOR KE values.
*/
void
unpack_KE(struct state *st
, struct pluto_crypto_req *r
, chunk_t *g)
{
struct pcr_kenonce *kn = &r->pcr_d.kn;
if (!st->st_sec_in_use)
{
st->st_sec_in_use = TRUE;
freeanychunk(*g); /* happens in odd error cases */
clonetochunk(*g, wire_chunk_ptr(kn, &(kn->gi))
, kn->gi.len, "saved gi value");
#ifdef HAVE_LIBNSS
DBG(DBG_CRYPT, DBG_log("saving DH priv (local secret) and pub key into state struc"));
clonetochunk(st->st_sec_chunk
, wire_chunk_ptr(kn, &(kn->secret))
, kn->secret.len, "pointer to DH private key (secret)");
clonetochunk(st->pubk
, wire_chunk_ptr(kn, &(kn->pubk))
, kn->pubk.len, "pointer to DH public key");
#else
n_to_mpz(&st->st_sec
, wire_chunk_ptr(kn, &(kn->secret))
, kn->secret.len);
clonetochunk(st->st_sec_chunk
, wire_chunk_ptr(kn, &(kn->secret))
, kn->secret.len, "long term secret");
#endif
}
}
示例7: lock_authcert_list
/**
* Lock access to the chained authcert list
*/
void lock_authcert_list(const char *who)
{
pthread_mutex_lock(&authcert_list_mutex);
DBG(DBG_CONTROLMORE,
DBG_log("authcert list locked by '%s'", who)
)
}
示例8: unlock_ocsp_fetch_list
/**
* Unlock access to the chained ocsp fetch request list
*/
static void unlock_ocsp_fetch_list(const char *who)
{
DBG(DBG_CONTROLMORE,
DBG_log("ocsp fetch request list unlocked by '%s'", who)
)
pthread_mutex_unlock(&ocsp_fetch_list_mutex);
}
示例9: unlock_ca_info_list
/**
* Unlock access to the ca info list
*/
extern void unlock_ca_info_list(const char *who)
{
DBG(DBG_CONTROLMORE,
DBG_log("ca info list unlocked by '%s'", who)
)
pthread_mutex_unlock(&ca_info_list_mutex);
}
示例10: unlock_crl_list
/**
* Unlock access to the chained crl list
*/
void unlock_crl_list(const char *who)
{
DBG(DBG_CONTROLMORE,
DBG_log("crl list unlocked by '%s'", who)
)
pthread_mutex_unlock(&crl_list_mutex);
}
示例11: add_authcert
/*
* add an authority certificate to the chained list
*/
void add_authcert(x509cert_t *cert, u_char auth_flags)
{
x509cert_t *old_cert;
/* set authority flags */
cert->authority_flags |= auth_flags;
lock_authcert_list("add_authcert");
old_cert = get_authcert(cert->subject, cert->serialNumber,
cert->subjectKeyID, auth_flags);
if (old_cert != NULL) {
if (same_x509cert(cert, old_cert)) {
/*
* cert is already present, just add additional
* authority flags
*/
old_cert->authority_flags |= cert->authority_flags;
DBG(DBG_X509 | DBG_PARSING,
DBG_log(" authcert is already present and identical");
);
unlock_authcert_list("add_authcert");
free_x509cert(cert);
return;
} else {
示例12: parse_attributes
/**
* Parse X.501 attributes
*/
bool parse_attributes(chunk_t blob, scep_attributes_t *attrs)
{
asn1_parser_t *parser;
chunk_t object;
int oid = OID_UNKNOWN;
int objectID;
bool success = FALSE;
parser = asn1_parser_create(attributesObjects, blob);
DBG(DBG_CONTROL | DBG_PARSING,
DBG_log("parsing attributes")
)
while (parser->iterate(parser, &objectID, &object))
{
switch (objectID)
{
case ATTRIBUTE_OBJ_TYPE:
oid = asn1_known_oid(object);
break;
case ATTRIBUTE_OBJ_VALUE:
if (!extract_attribute(oid, object, parser->get_level(parser), attrs))
{
goto end;
}
}
}
success = parser->success(parser);
end:
parser->destroy(parser);
return success;
}
示例13: _iface_down
static int
_iface_down(int sock, struct st_ipsec_if *iface)
{
struct ifreq req;
int ret = 0;
iface->up = 0;
strncpy(req.ifr_name, iface->name, IFNAMSIZ);
if (ioctl(sock, SIOCGIFFLAGS, &req)!=0)
return ret;
if (req.ifr_flags & IFF_UP)
{
DBG(DBG_CONTROL,
DBG_log("shutting down interface %s/%s", iface->name, iface->phys)
)
req.ifr_flags &= ~IFF_UP;
ioctl(sock, SIOCSIFFLAGS, &req);
ret = 1;
}
/* unset addr */
memset(&req.ifr_addr, 0, sizeof(req.ifr_addr));
req.ifr_addr.sa_family = AF_INET;
ioctl(sock, SIOCSIFADDR, &req);
/* tncfg --detach */
ioctl(sock, IPSEC_DEL_DEV, &req);
memset(iface->phys, 0, sizeof(iface->phys));
return ret;
}
示例14: init_nat_traversal
void init_nat_traversal(unsigned int keep_alive_period)
{
{
FILE *f = fopen("/proc/net/ipsec/natt", "r");
/* ??? this only checks if the file starts with '0'; seems sloppy */
if (f != NULL) {
int n = getc(f);
if (n == '0') {
nat_traversal_enabled = FALSE;
libreswan_log(
" KLIPS does not have NAT-Traversal built in (see /proc/net/ipsec/natt)\n");
}
fclose(f);
}
}
if (keep_alive_period != 0)
nat_kap = keep_alive_period;
DBG(DBG_NATT, DBG_log("init_nat_traversal() initialized with keep_alive=%d",
keep_alive_period));
libreswan_log("NAT-Traversal support %s",
nat_traversal_enabled ? " [enabled]" : " [disabled]");
}
示例15: parse_attributes
/*
* parse X.501 attributes
*/
bool
parse_attributes(chunk_t blob, scep_attributes_t *attrs)
{
asn1_ctx_t ctx;
chunk_t object;
u_int level;
int oid = OID_UNKNOWN;
int objectID = 0;
asn1_init(&ctx, blob, 0, FALSE, DBG_RAW);
DBG(DBG_CONTROL | DBG_PARSING,
DBG_log("parsing attributes")
)
while (objectID < ATTRIBUTE_OBJ_ROOF)
{
if (!extract_object(attributesObjects, &objectID
, &object, &level, &ctx))
return FALSE;
switch (objectID)
{
case ATTRIBUTE_OBJ_TYPE:
oid = known_oid(object);
break;
case ATTRIBUTE_OBJ_VALUE:
if (!extract_attribute(oid, object, level, attrs))
return FALSE;
}
objectID++;
}
return TRUE;
}