summaryrefslogtreecommitdiff
path: root/scripts/id2sql.c
diff options
context:
space:
mode:
authorRene Mayrhofer <rene@mayrhofer.eu.org>2008-10-29 11:11:01 +0000
committerRene Mayrhofer <rene@mayrhofer.eu.org>2008-10-29 11:11:01 +0000
commit8b80ab5a6950ce6515f477624794defd7531642a (patch)
treeaa8303f3806c5615fbeafc4dc82febe3cd7c24dc /scripts/id2sql.c
parentdb67c87db3c9089ea8d2e14f617bf3d9e2af261f (diff)
downloadvyos-strongswan-8b80ab5a6950ce6515f477624794defd7531642a.tar.gz
vyos-strongswan-8b80ab5a6950ce6515f477624794defd7531642a.zip
[svn-upgrade] Integrating new upstream version, strongswan (4.2.8)
Diffstat (limited to 'scripts/id2sql.c')
-rw-r--r--scripts/id2sql.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/scripts/id2sql.c b/scripts/id2sql.c
new file mode 100644
index 000000000..3990e88da
--- /dev/null
+++ b/scripts/id2sql.c
@@ -0,0 +1,36 @@
+
+#include <stdio.h>
+#include <library.h>
+
+/**
+ * convert an identity to type and encoding
+ */
+int main(int argc, char *argv[])
+{
+ identification_t *id;
+ chunk_t enc;
+ int i;
+
+ if (argc < 2)
+ {
+ return -1;
+ }
+
+ id = identification_create_from_string(argv[1]);
+ if (!id)
+ {
+ return -2;
+ }
+ printf("type\tencoding\n");
+ printf("%d,\t", id->get_type(id));
+ enc = id->get_encoding(id);
+
+ printf("X'");
+ for (i = 0; i < enc.len; i++)
+ {
+ printf("%02x", (unsigned int)enc.ptr[i]);
+ }
+ printf("'\n");
+ return 0;
+}
+