diff options
author | Martin Willi <martin@revosec.ch> | 2012-10-03 18:08:38 +0200 |
---|---|---|
committer | Martin Willi <martin@revosec.ch> | 2012-10-24 11:43:34 +0200 |
commit | 7877c463ea5cf1724e97833dfcd8b30b88bce47e (patch) | |
tree | c5fc1c4206874f042a6c98e553fdbdf1f13b1a53 /src | |
parent | 1edaa79c060dad9064bd09c2e913900cd1f5c3e0 (diff) | |
download | strongswan-7877c463ea5cf1724e97833dfcd8b30b88bce47e.tar.bz2 strongswan-7877c463ea5cf1724e97833dfcd8b30b88bce47e.tar.xz |
Defined on-the-wire format used on lookip socket
Diffstat (limited to 'src')
-rw-r--r-- | src/libcharon/plugins/lookip/Makefile.am | 5 | ||||
-rw-r--r-- | src/libcharon/plugins/lookip/lookip_msg.h | 90 |
2 files changed, 94 insertions, 1 deletions
diff --git a/src/libcharon/plugins/lookip/Makefile.am b/src/libcharon/plugins/lookip/Makefile.am index dfaa7793f..5d4603fbc 100644 --- a/src/libcharon/plugins/lookip/Makefile.am +++ b/src/libcharon/plugins/lookip/Makefile.am @@ -2,6 +2,9 @@ INCLUDES = -I$(top_srcdir)/src/libstrongswan -I$(top_srcdir)/src/libhydra \ -I$(top_srcdir)/src/libcharon +AM_CFLAGS = -rdynamic \ + -DIPSEC_PIDDIR=\"${piddir}\" + if MONOLITHIC noinst_LTLIBRARIES = libstrongswan-lookip.la else @@ -9,6 +12,6 @@ plugin_LTLIBRARIES = libstrongswan-lookip.la endif libstrongswan_lookip_la_SOURCES = lookip_plugin.h lookip_plugin.c \ - lookip_listener.h lookip_listener.c + lookip_listener.h lookip_listener.c lookip_msg.h libstrongswan_lookip_la_LDFLAGS = -module -avoid-version diff --git a/src/libcharon/plugins/lookip/lookip_msg.h b/src/libcharon/plugins/lookip/lookip_msg.h new file mode 100644 index 000000000..86ea42f11 --- /dev/null +++ b/src/libcharon/plugins/lookip/lookip_msg.h @@ -0,0 +1,90 @@ +/* + * Copyright (C) 2012 Martin Willi + * Copyright (C) 2012 revosec AG + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + */ + +/** + * @defgroup lookip_msg lookip_msg + * @{ @ingroup lookip + */ + +#ifndef LOOKIP_MSG_H_ +#define LOOKIP_MSG_H_ + +#define LOOKIP_SOCKET IPSEC_PIDDIR "/charon.lkp" + +typedef struct lookip_request_t lookip_request_t; +typedef struct lookip_response_t lookip_response_t; + +/** + * Message type. + * + * The client can send a batch of request messages, containing DUMP, LOOKUP or + * REGISTER_* messages. The server immediately starts sending responses for + * these messages, using ENTRY or NOTIFY_* messages. + * A client MUST send an END message to complete a batch. The server will + * send any remaining responses, but will not accept new requests and closes + * the connection when complete. + */ +enum { + /** request a dump of all entries */ + LOOKIP_DUMP = 1, + /** lookup a specific virtual IP */ + LOOKIP_LOOKUP = 2, + /** reply message for DUMP and LOOKUP */ + LOOKIP_ENTRY = 3, + /** register for notifications about new virtual IPs */ + LOOKIP_REGISTER_UP = 4, + /** register for notifications about virtual IPs released */ + LOOKIP_REGISTER_DOWN = 5, + /** notify reply message for REGISTER_UP */ + LOOKIP_NOTIFY_UP = 6, + /** notify reply message for REGISTER_DOWN */ + LOOKIP_NOTIFY_DOWN = 7, + /** end of request batch */ + LOOKIP_END = 8, +}; + +/** + * Request message sent from client. + * + * Valid request message types are DUMP, LOOKUP, REGISTER_UP/DOWN and END. + * + * The vip field is used only in LOOKUP requests, but ignored otherwise. + */ +struct lookip_request_t { + /** request message type */ + int type; + /** null terminated string representation of virtual IP */ + char vip[40]; +}; + +/** + * Response message sent to client. + * + * Valid response message types are ENTRY and NOTIFY_UP/DOWN. + */ +struct lookip_response_t { + /** response message type */ + int type; + /** null terminated string representation of virtual IP */ + char vip[40]; + /** null terminated string representation of outer IP */ + char ip[40]; + /** null terminated peer identity */ + char id[128]; + /** null connection name */ + char name[44]; +}; + +#endif /** LOOKIP_MSG_H_ @}*/ |