OSDN Git Service

2013.10.24
[uclinux-h8/uClinux-dist.git] / freeswan / pluto / id.h
1 /* identity representation, as in IKE ID Payloads (RFC 2407 DOI 4.6.2.1)
2  * Copyright (C) 1999-2001  D. Hugh Redelmeier
3  *
4  * This program is free software; you can redistribute it and/or modify it
5  * under the terms of the GNU General Public License as published by the
6  * Free Software Foundation; either version 2 of the License, or (at your
7  * option) any later version.  See <http://www.fsf.org/copyleft/gpl.txt>.
8  *
9  * This program is distributed in the hope that it will be useful, but
10  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
11  * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12  * for more details.
13  *
14  * RCSID $Id: id.h,v 1.16 2002/01/21 03:14:17 dhr Exp $
15  */
16
17 struct id {
18     int kind;           /* ID_* value */
19     ip_address ip_addr; /* ID_IPV4_ADDR, ID_IPV6_ADDR     */
20     chunk_t name;       /* ID_FQDN, ID_USER_FQDN (with @) */
21                         /* ID_KEY_ID, ID_DER_ASN_DN       */
22 };
23
24 extern const struct id empty_id;
25
26 extern err_t atoid(char *src, struct id *id);
27 extern int keyidtoa(char *dst, size_t dstlen, chunk_t keyid);
28 extern void iptoid(const ip_address *ip, struct id *id);
29 extern char* temporary_cyclic_buffer(void);
30 extern int idtoa(const struct id *id, char *dst, size_t dstlen);
31 #define IDTOA_BUF 512
32 struct end;     /* forward declaration of tag (defined in connections.h) */
33 extern void unshare_id_content(struct id *id);
34 extern void free_id_content(struct id *id);
35 extern bool same_id(const struct id *a, const struct id *b);
36 #define id_is_ipaddr(id) ((id)->kind == ID_IPV4_ADDR || (id)->kind == ID_IPV6_ADDR)
37
38 struct isakmp_ipsec_id; /* forward declaration of tag (defined in packet.h) */
39 extern void
40     build_id_payload(struct isakmp_ipsec_id *hd, chunk_t *tl, struct end *end);