diff options
author | Rene Mayrhofer <rene@mayrhofer.eu.org> | 2008-02-07 13:56:17 +0000 |
---|---|---|
committer | Rene Mayrhofer <rene@mayrhofer.eu.org> | 2008-02-07 13:56:17 +0000 |
commit | bcc8f7ca7fd8e8ff6e8a4d579251458313133598 (patch) | |
tree | a86b42b486c954937b32ffeaaa725804cb1458ec /src/manager | |
parent | 49104abddf3d71d5abf5cf75dc7f95fa6c55fa63 (diff) | |
download | vyos-strongswan-bcc8f7ca7fd8e8ff6e8a4d579251458313133598.tar.gz vyos-strongswan-bcc8f7ca7fd8e8ff6e8a4d579251458313133598.zip |
[svn-upgrade] Integrating new upstream version, strongswan (4.1.10)
Diffstat (limited to 'src/manager')
27 files changed, 1105 insertions, 128 deletions
diff --git a/src/manager/Makefile.am b/src/manager/Makefile.am index 17eecdbab..7f77d1dba 100644 --- a/src/manager/Makefile.am +++ b/src/manager/Makefile.am @@ -3,7 +3,9 @@ ipsec_PROGRAMS = manager.fcgi manager_fcgi_SOURCES = \ main.c manager.c manager.h gateway.h gateway.c database.h database.c \ controller/auth_controller.c controller/auth_controller.h \ -controller/status_controller.c controller/status_controller.h \ +controller/ikesa_controller.c controller/ikesa_controller.h \ +controller/control_controller.c controller/control_controller.h \ +controller/config_controller.c controller/config_controller.h \ controller/gateway_controller.c controller/gateway_controller.h manager_fcgi_LDADD = $(top_builddir)/src/manager/libappserv.la -lsqlite3 @@ -34,20 +36,31 @@ ipsec_templates_auth_DATA = templates/auth/login.cs ipsec_templates_gatewaydir = ${ipsec_templatesdir}/gateway ipsec_templates_gateway_DATA = templates/gateway/list.cs -ipsec_templates_statusdir = ${ipsec_templatesdir}/status -ipsec_templates_status_DATA = templates/status/ikesalist.cs +ipsec_templates_ikesadir = ${ipsec_templatesdir}/ikesa +ipsec_templates_ikesa_DATA = templates/ikesa/list.cs + +ipsec_templates_controldir = ${ipsec_templatesdir}/control +ipsec_templates_control_DATA = templates/control/result.cs + +ipsec_templates_configdir = ${ipsec_templatesdir}/config +ipsec_templates_config_DATA = templates/config/list.cs ipsec_templates_staticdir = ${ipsec_templatesdir}/static ipsec_templates_static_DATA = templates/static/style.css templates/static/script.js templates/static/jquery.js \ templates/static/pipe.png templates/static/pipe-good.png templates/static/pipe-bad.png \ templates/static/pipe-thin.png templates/static/pipe-thin-left.png templates/static/pipe-thin-right.png \ +templates/static/pipe-thin-green.png templates/static/pipe-thin-left-green.png templates/static/pipe-thin-right-green.png \ templates/static/gateway-left.png templates/static/client-left.png templates/static/strongswan.png \ -templates/static/router.png templates/static/gateway-right.png templates/static/client-right.png +templates/static/router.png templates/static/gateway-right.png templates/static/client-right.png \ +templates/static/close.png templates/static/initiate.png EXTRA_DIST = manager.db templates/header.cs templates/footer.cs templates/error.cs \ -templates/auth/login.cs templates/gateway/list.cs templates/status/ikesalist.cs \ +templates/auth/login.cs templates/gateway/list.cs templates/ikesa/list.cs \ +templates/config/list.cs templates/control/result.cs \ templates/static/style.css templates/static/script.js templates/static/jquery.js \ templates/static/pipe.png templates/static/pipe-good.png templates/static/pipe-bad.png \ templates/static/pipe-thin.png templates/static/pipe-thin-left.png templates/static/pipe-thin-right.png \ +templates/static/pipe-thin-green.png templates/static/pipe-thin-left-green.png templates/static/pipe-thin-right-green.png \ templates/static/gateway-left.png templates/static/client-left.png templates/static/strongswan.png \ -templates/static/router.png templates/static/gateway-right.png templates/static/client-right.png +templates/static/router.png templates/static/gateway-right.png templates/static/client-right.png \ +templates/static/close.png templates/static/initiate.png diff --git a/src/manager/Makefile.in b/src/manager/Makefile.in index 5c09c22d4..3830d37fc 100644 --- a/src/manager/Makefile.in +++ b/src/manager/Makefile.in @@ -52,9 +52,11 @@ am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(ipsecdir)" \ "$(DESTDIR)$(ipsecdir)" "$(DESTDIR)$(ipsec_templatesdir)" \ "$(DESTDIR)$(ipsec_templates_authdir)" \ + "$(DESTDIR)$(ipsec_templates_configdir)" \ + "$(DESTDIR)$(ipsec_templates_controldir)" \ "$(DESTDIR)$(ipsec_templates_gatewaydir)" \ - "$(DESTDIR)$(ipsec_templates_staticdir)" \ - "$(DESTDIR)$(ipsec_templates_statusdir)" + "$(DESTDIR)$(ipsec_templates_ikesadir)" \ + "$(DESTDIR)$(ipsec_templates_staticdir)" libLTLIBRARIES_INSTALL = $(INSTALL) LTLIBRARIES = $(lib_LTLIBRARIES) am__DEPENDENCIES_1 = @@ -67,7 +69,8 @@ ipsecPROGRAMS_INSTALL = $(INSTALL_PROGRAM) PROGRAMS = $(ipsec_PROGRAMS) am_manager_fcgi_OBJECTS = main.$(OBJEXT) manager.$(OBJEXT) \ gateway.$(OBJEXT) database.$(OBJEXT) auth_controller.$(OBJEXT) \ - status_controller.$(OBJEXT) gateway_controller.$(OBJEXT) + ikesa_controller.$(OBJEXT) control_controller.$(OBJEXT) \ + config_controller.$(OBJEXT) gateway_controller.$(OBJEXT) manager_fcgi_OBJECTS = $(am_manager_fcgi_OBJECTS) manager_fcgi_DEPENDENCIES = $(top_builddir)/src/manager/libappserv.la DEFAULT_INCLUDES = -I.@am__isrc@ @@ -87,12 +90,16 @@ DIST_SOURCES = $(libappserv_la_SOURCES) $(manager_fcgi_SOURCES) ipsecDATA_INSTALL = $(INSTALL_DATA) ipsec_templatesDATA_INSTALL = $(INSTALL_DATA) ipsec_templates_authDATA_INSTALL = $(INSTALL_DATA) +ipsec_templates_configDATA_INSTALL = $(INSTALL_DATA) +ipsec_templates_controlDATA_INSTALL = $(INSTALL_DATA) ipsec_templates_gatewayDATA_INSTALL = $(INSTALL_DATA) +ipsec_templates_ikesaDATA_INSTALL = $(INSTALL_DATA) ipsec_templates_staticDATA_INSTALL = $(INSTALL_DATA) -ipsec_templates_statusDATA_INSTALL = $(INSTALL_DATA) DATA = $(ipsec_DATA) $(ipsec_templates_DATA) \ - $(ipsec_templates_auth_DATA) $(ipsec_templates_gateway_DATA) \ - $(ipsec_templates_static_DATA) $(ipsec_templates_status_DATA) + $(ipsec_templates_auth_DATA) $(ipsec_templates_config_DATA) \ + $(ipsec_templates_control_DATA) \ + $(ipsec_templates_gateway_DATA) $(ipsec_templates_ikesa_DATA) \ + $(ipsec_templates_static_DATA) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) @@ -229,7 +236,9 @@ xml_LIBS = @xml_LIBS@ manager_fcgi_SOURCES = \ main.c manager.c manager.h gateway.h gateway.c database.h database.c \ controller/auth_controller.c controller/auth_controller.h \ -controller/status_controller.c controller/status_controller.h \ +controller/ikesa_controller.c controller/ikesa_controller.h \ +controller/control_controller.c controller/control_controller.h \ +controller/config_controller.c controller/config_controller.h \ controller/gateway_controller.c controller/gateway_controller.h manager_fcgi_LDADD = $(top_builddir)/src/manager/libappserv.la -lsqlite3 @@ -251,22 +260,31 @@ ipsec_templates_authdir = ${ipsec_templatesdir}/auth ipsec_templates_auth_DATA = templates/auth/login.cs ipsec_templates_gatewaydir = ${ipsec_templatesdir}/gateway ipsec_templates_gateway_DATA = templates/gateway/list.cs -ipsec_templates_statusdir = ${ipsec_templatesdir}/status -ipsec_templates_status_DATA = templates/status/ikesalist.cs +ipsec_templates_ikesadir = ${ipsec_templatesdir}/ikesa +ipsec_templates_ikesa_DATA = templates/ikesa/list.cs +ipsec_templates_controldir = ${ipsec_templatesdir}/control +ipsec_templates_control_DATA = templates/control/result.cs +ipsec_templates_configdir = ${ipsec_templatesdir}/config +ipsec_templates_config_DATA = templates/config/list.cs ipsec_templates_staticdir = ${ipsec_templatesdir}/static ipsec_templates_static_DATA = templates/static/style.css templates/static/script.js templates/static/jquery.js \ templates/static/pipe.png templates/static/pipe-good.png templates/static/pipe-bad.png \ templates/static/pipe-thin.png templates/static/pipe-thin-left.png templates/static/pipe-thin-right.png \ +templates/static/pipe-thin-green.png templates/static/pipe-thin-left-green.png templates/static/pipe-thin-right-green.png \ templates/static/gateway-left.png templates/static/client-left.png templates/static/strongswan.png \ -templates/static/router.png templates/static/gateway-right.png templates/static/client-right.png +templates/static/router.png templates/static/gateway-right.png templates/static/client-right.png \ +templates/static/close.png templates/static/initiate.png EXTRA_DIST = manager.db templates/header.cs templates/footer.cs templates/error.cs \ -templates/auth/login.cs templates/gateway/list.cs templates/status/ikesalist.cs \ +templates/auth/login.cs templates/gateway/list.cs templates/ikesa/list.cs \ +templates/config/list.cs templates/control/result.cs \ templates/static/style.css templates/static/script.js templates/static/jquery.js \ templates/static/pipe.png templates/static/pipe-good.png templates/static/pipe-bad.png \ templates/static/pipe-thin.png templates/static/pipe-thin-left.png templates/static/pipe-thin-right.png \ +templates/static/pipe-thin-green.png templates/static/pipe-thin-left-green.png templates/static/pipe-thin-right-green.png \ templates/static/gateway-left.png templates/static/client-left.png templates/static/strongswan.png \ -templates/static/router.png templates/static/gateway-right.png templates/static/client-right.png +templates/static/router.png templates/static/gateway-right.png templates/static/client-right.png \ +templates/static/close.png templates/static/initiate.png all: all-am @@ -369,15 +387,17 @@ distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/auth_controller.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/config_controller.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/control_controller.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/database.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dispatcher.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gateway.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gateway_controller.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ikesa_controller.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/manager.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/request.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/session.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/status_controller.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xml.Plo@am__quote@ .c.o: @@ -443,19 +463,47 @@ auth_controller.obj: controller/auth_controller.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o auth_controller.obj `if test -f 'controller/auth_controller.c'; then $(CYGPATH_W) 'controller/auth_controller.c'; else $(CYGPATH_W) '$(srcdir)/controller/auth_controller.c'; fi` -status_controller.o: controller/status_controller.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT status_controller.o -MD -MP -MF $(DEPDIR)/status_controller.Tpo -c -o status_controller.o `test -f 'controller/status_controller.c' || echo '$(srcdir)/'`controller/status_controller.c -@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/status_controller.Tpo $(DEPDIR)/status_controller.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='controller/status_controller.c' object='status_controller.o' libtool=no @AMDEPBACKSLASH@ +ikesa_controller.o: controller/ikesa_controller.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT ikesa_controller.o -MD -MP -MF $(DEPDIR)/ikesa_controller.Tpo -c -o ikesa_controller.o `test -f 'controller/ikesa_controller.c' || echo '$(srcdir)/'`controller/ikesa_controller.c +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/ikesa_controller.Tpo $(DEPDIR)/ikesa_controller.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='controller/ikesa_controller.c' object='ikesa_controller.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o status_controller.o `test -f 'controller/status_controller.c' || echo '$(srcdir)/'`controller/status_controller.c +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o ikesa_controller.o `test -f 'controller/ikesa_controller.c' || echo '$(srcdir)/'`controller/ikesa_controller.c -status_controller.obj: controller/status_controller.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT status_controller.obj -MD -MP -MF $(DEPDIR)/status_controller.Tpo -c -o status_controller.obj `if test -f 'controller/status_controller.c'; then $(CYGPATH_W) 'controller/status_controller.c'; else $(CYGPATH_W) '$(srcdir)/controller/status_controller.c'; fi` -@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/status_controller.Tpo $(DEPDIR)/status_controller.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='controller/status_controller.c' object='status_controller.obj' libtool=no @AMDEPBACKSLASH@ +ikesa_controller.obj: controller/ikesa_controller.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT ikesa_controller.obj -MD -MP -MF $(DEPDIR)/ikesa_controller.Tpo -c -o ikesa_controller.obj `if test -f 'controller/ikesa_controller.c'; then $(CYGPATH_W) 'controller/ikesa_controller.c'; else $(CYGPATH_W) '$(srcdir)/controller/ikesa_controller.c'; fi` +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/ikesa_controller.Tpo $(DEPDIR)/ikesa_controller.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='controller/ikesa_controller.c' object='ikesa_controller.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o status_controller.obj `if test -f 'controller/status_controller.c'; then $(CYGPATH_W) 'controller/status_controller.c'; else $(CYGPATH_W) '$(srcdir)/controller/status_controller.c'; fi` +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o ikesa_controller.obj `if test -f 'controller/ikesa_controller.c'; then $(CYGPATH_W) 'controller/ikesa_controller.c'; else $(CYGPATH_W) '$(srcdir)/controller/ikesa_controller.c'; fi` + +control_controller.o: controller/control_controller.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT control_controller.o -MD -MP -MF $(DEPDIR)/control_controller.Tpo -c -o control_controller.o `test -f 'controller/control_controller.c' || echo '$(srcdir)/'`controller/control_controller.c +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/control_controller.Tpo $(DEPDIR)/control_controller.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='controller/control_controller.c' object='control_controller.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o control_controller.o `test -f 'controller/control_controller.c' || echo '$(srcdir)/'`controller/control_controller.c + +control_controller.obj: controller/control_controller.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT control_controller.obj -MD -MP -MF $(DEPDIR)/control_controller.Tpo -c -o control_controller.obj `if test -f 'controller/control_controller.c'; then $(CYGPATH_W) 'controller/control_controller.c'; else $(CYGPATH_W) '$(srcdir)/controller/control_controller.c'; fi` +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/control_controller.Tpo $(DEPDIR)/control_controller.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='controller/control_controller.c' object='control_controller.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o control_controller.obj `if test -f 'controller/control_controller.c'; then $(CYGPATH_W) 'controller/control_controller.c'; else $(CYGPATH_W) '$(srcdir)/controller/control_controller.c'; fi` + +config_controller.o: controller/config_controller.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT config_controller.o -MD -MP -MF $(DEPDIR)/config_controller.Tpo -c -o config_controller.o `test -f 'controller/config_controller.c' || echo '$(srcdir)/'`controller/config_controller.c +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/config_controller.Tpo $(DEPDIR)/config_controller.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='controller/config_controller.c' object='config_controller.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o config_controller.o `test -f 'controller/config_controller.c' || echo '$(srcdir)/'`controller/config_controller.c + +config_controller.obj: controller/config_controller.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT config_controller.obj -MD -MP -MF $(DEPDIR)/config_controller.Tpo -c -o config_controller.obj `if test -f 'controller/config_controller.c'; then $(CYGPATH_W) 'controller/config_controller.c'; else $(CYGPATH_W) '$(srcdir)/controller/config_controller.c'; fi` +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/config_controller.Tpo $(DEPDIR)/config_controller.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='controller/config_controller.c' object='config_controller.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o config_controller.obj `if test -f 'controller/config_controller.c'; then $(CYGPATH_W) 'controller/config_controller.c'; else $(CYGPATH_W) '$(srcdir)/controller/config_controller.c'; fi` gateway_controller.o: controller/gateway_controller.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gateway_controller.o -MD -MP -MF $(DEPDIR)/gateway_controller.Tpo -c -o gateway_controller.o `test -f 'controller/gateway_controller.c' || echo '$(srcdir)/'`controller/gateway_controller.c @@ -527,6 +575,40 @@ uninstall-ipsec_templates_authDATA: echo " rm -f '$(DESTDIR)$(ipsec_templates_authdir)/$$f'"; \ rm -f "$(DESTDIR)$(ipsec_templates_authdir)/$$f"; \ done +install-ipsec_templates_configDATA: $(ipsec_templates_config_DATA) + @$(NORMAL_INSTALL) + test -z "$(ipsec_templates_configdir)" || $(MKDIR_P) "$(DESTDIR)$(ipsec_templates_configdir)" + @list='$(ipsec_templates_config_DATA)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f=$(am__strip_dir) \ + echo " $(ipsec_templates_configDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(ipsec_templates_configdir)/$$f'"; \ + $(ipsec_templates_configDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(ipsec_templates_configdir)/$$f"; \ + done + +uninstall-ipsec_templates_configDATA: + @$(NORMAL_UNINSTALL) + @list='$(ipsec_templates_config_DATA)'; for p in $$list; do \ + f=$(am__strip_dir) \ + echo " rm -f '$(DESTDIR)$(ipsec_templates_configdir)/$$f'"; \ + rm -f "$(DESTDIR)$(ipsec_templates_configdir)/$$f"; \ + done +install-ipsec_templates_controlDATA: $(ipsec_templates_control_DATA) + @$(NORMAL_INSTALL) + test -z "$(ipsec_templates_controldir)" || $(MKDIR_P) "$(DESTDIR)$(ipsec_templates_controldir)" + @list='$(ipsec_templates_control_DATA)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f=$(am__strip_dir) \ + echo " $(ipsec_templates_controlDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(ipsec_templates_controldir)/$$f'"; \ + $(ipsec_templates_controlDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(ipsec_templates_controldir)/$$f"; \ + done + +uninstall-ipsec_templates_controlDATA: + @$(NORMAL_UNINSTALL) + @list='$(ipsec_templates_control_DATA)'; for p in $$list; do \ + f=$(am__strip_dir) \ + echo " rm -f '$(DESTDIR)$(ipsec_templates_controldir)/$$f'"; \ + rm -f "$(DESTDIR)$(ipsec_templates_controldir)/$$f"; \ + done install-ipsec_templates_gatewayDATA: $(ipsec_templates_gateway_DATA) @$(NORMAL_INSTALL) test -z "$(ipsec_templates_gatewaydir)" || $(MKDIR_P) "$(DESTDIR)$(ipsec_templates_gatewaydir)" @@ -544,6 +626,23 @@ uninstall-ipsec_templates_gatewayDATA: echo " rm -f '$(DESTDIR)$(ipsec_templates_gatewaydir)/$$f'"; \ rm -f "$(DESTDIR)$(ipsec_templates_gatewaydir)/$$f"; \ done +install-ipsec_templates_ikesaDATA: $(ipsec_templates_ikesa_DATA) + @$(NORMAL_INSTALL) + test -z "$(ipsec_templates_ikesadir)" || $(MKDIR_P) "$(DESTDIR)$(ipsec_templates_ikesadir)" + @list='$(ipsec_templates_ikesa_DATA)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f=$(am__strip_dir) \ + echo " $(ipsec_templates_ikesaDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(ipsec_templates_ikesadir)/$$f'"; \ + $(ipsec_templates_ikesaDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(ipsec_templates_ikesadir)/$$f"; \ + done + +uninstall-ipsec_templates_ikesaDATA: + @$(NORMAL_UNINSTALL) + @list='$(ipsec_templates_ikesa_DATA)'; for p in $$list; do \ + f=$(am__strip_dir) \ + echo " rm -f '$(DESTDIR)$(ipsec_templates_ikesadir)/$$f'"; \ + rm -f "$(DESTDIR)$(ipsec_templates_ikesadir)/$$f"; \ + done install-ipsec_templates_staticDATA: $(ipsec_templates_static_DATA) @$(NORMAL_INSTALL) test -z "$(ipsec_templates_staticdir)" || $(MKDIR_P) "$(DESTDIR)$(ipsec_templates_staticdir)" @@ -561,23 +660,6 @@ uninstall-ipsec_templates_staticDATA: echo " rm -f '$(DESTDIR)$(ipsec_templates_staticdir)/$$f'"; \ rm -f "$(DESTDIR)$(ipsec_templates_staticdir)/$$f"; \ done -install-ipsec_templates_statusDATA: $(ipsec_templates_status_DATA) - @$(NORMAL_INSTALL) - test -z "$(ipsec_templates_statusdir)" || $(MKDIR_P) "$(DESTDIR)$(ipsec_templates_statusdir)" - @list='$(ipsec_templates_status_DATA)'; for p in $$list; do \ - if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ - f=$(am__strip_dir) \ - echo " $(ipsec_templates_statusDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(ipsec_templates_statusdir)/$$f'"; \ - $(ipsec_templates_statusDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(ipsec_templates_statusdir)/$$f"; \ - done - -uninstall-ipsec_templates_statusDATA: - @$(NORMAL_UNINSTALL) - @list='$(ipsec_templates_status_DATA)'; for p in $$list; do \ - f=$(am__strip_dir) \ - echo " rm -f '$(DESTDIR)$(ipsec_templates_statusdir)/$$f'"; \ - rm -f "$(DESTDIR)$(ipsec_templates_statusdir)/$$f"; \ - done ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ @@ -657,7 +739,7 @@ check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(DATA) installdirs: - for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(ipsecdir)" "$(DESTDIR)$(ipsecdir)" "$(DESTDIR)$(ipsec_templatesdir)" "$(DESTDIR)$(ipsec_templates_authdir)" "$(DESTDIR)$(ipsec_templates_gatewaydir)" "$(DESTDIR)$(ipsec_templates_staticdir)" "$(DESTDIR)$(ipsec_templates_statusdir)"; do \ + for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(ipsecdir)" "$(DESTDIR)$(ipsecdir)" "$(DESTDIR)$(ipsec_templatesdir)" "$(DESTDIR)$(ipsec_templates_authdir)" "$(DESTDIR)$(ipsec_templates_configdir)" "$(DESTDIR)$(ipsec_templates_controldir)" "$(DESTDIR)$(ipsec_templates_gatewaydir)" "$(DESTDIR)$(ipsec_templates_ikesadir)" "$(DESTDIR)$(ipsec_templates_staticdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am @@ -707,9 +789,11 @@ info-am: install-data-am: install-ipsecDATA install-ipsecPROGRAMS \ install-ipsec_templatesDATA install-ipsec_templates_authDATA \ + install-ipsec_templates_configDATA \ + install-ipsec_templates_controlDATA \ install-ipsec_templates_gatewayDATA \ - install-ipsec_templates_staticDATA \ - install-ipsec_templates_statusDATA + install-ipsec_templates_ikesaDATA \ + install-ipsec_templates_staticDATA install-dvi: install-dvi-am @@ -748,9 +832,11 @@ ps-am: uninstall-am: uninstall-ipsecDATA uninstall-ipsecPROGRAMS \ uninstall-ipsec_templatesDATA \ uninstall-ipsec_templates_authDATA \ + uninstall-ipsec_templates_configDATA \ + uninstall-ipsec_templates_controlDATA \ uninstall-ipsec_templates_gatewayDATA \ - uninstall-ipsec_templates_staticDATA \ - uninstall-ipsec_templates_statusDATA uninstall-libLTLIBRARIES + uninstall-ipsec_templates_ikesaDATA \ + uninstall-ipsec_templates_staticDATA uninstall-libLTLIBRARIES .MAKE: install-am install-strip @@ -763,9 +849,11 @@ uninstall-am: uninstall-ipsecDATA uninstall-ipsecPROGRAMS \ install-exec-am install-html install-html-am install-info \ install-info-am install-ipsecDATA install-ipsecPROGRAMS \ install-ipsec_templatesDATA install-ipsec_templates_authDATA \ + install-ipsec_templates_configDATA \ + install-ipsec_templates_controlDATA \ install-ipsec_templates_gatewayDATA \ - install-ipsec_templates_staticDATA \ - install-ipsec_templates_statusDATA install-libLTLIBRARIES \ + install-ipsec_templates_ikesaDATA \ + install-ipsec_templates_staticDATA install-libLTLIBRARIES \ install-man install-pdf install-pdf-am install-ps \ install-ps-am install-strip installcheck installcheck-am \ installdirs maintainer-clean maintainer-clean-generic \ @@ -774,9 +862,11 @@ uninstall-am: uninstall-ipsecDATA uninstall-ipsecPROGRAMS \ uninstall-am uninstall-ipsecDATA uninstall-ipsecPROGRAMS \ uninstall-ipsec_templatesDATA \ uninstall-ipsec_templates_authDATA \ + uninstall-ipsec_templates_configDATA \ + uninstall-ipsec_templates_controlDATA \ uninstall-ipsec_templates_gatewayDATA \ - uninstall-ipsec_templates_staticDATA \ - uninstall-ipsec_templates_statusDATA uninstall-libLTLIBRARIES + uninstall-ipsec_templates_ikesaDATA \ + uninstall-ipsec_templates_staticDATA uninstall-libLTLIBRARIES # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. diff --git a/src/manager/controller/auth_controller.c b/src/manager/controller/auth_controller.c index fd4a3c7a5..e9b86941a 100644 --- a/src/manager/controller/auth_controller.c +++ b/src/manager/controller/auth_controller.c @@ -60,7 +60,7 @@ static void check(private_auth_controller_t *this, request_t *request) if (username && password && this->manager->login(this->manager, username, password)) { - request->redirect(request, "status/ikesalist"); + request->redirect(request, "ikesa/list"); } else { diff --git a/src/manager/controller/config_controller.c b/src/manager/controller/config_controller.c new file mode 100644 index 000000000..e7941ada4 --- /dev/null +++ b/src/manager/controller/config_controller.c @@ -0,0 +1,214 @@ +/** + * @file config_controller.c + * + * @brief Implementation of config_controller_t. + * + */ + +/* + * Copyright (C) 2007 Martin Willi + * Hochschule fuer Technik Rapperswil + * + * 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. + */ + +#include "config_controller.h" +#include "../manager.h" +#include "../gateway.h" + +#include <xml.h> + +#include <library.h> + + +typedef struct private_config_controller_t private_config_controller_t; + +/** + * private data of the task manager + */ +struct private_config_controller_t { + + /** + * public functions + */ + config_controller_t public; + + /** + * manager instance + */ + manager_t *manager; +}; + +/** + * read XML of a peerconfig element and fill template + */ +static void process_peerconfig(private_config_controller_t *this, + enumerator_t *e, request_t *r) +{ + xml_t *xml; + enumerator_t *e1, *e2, *e3; + char *name, *value, *config = "", *child = "", *section = ""; + + while (e->enumerate(e, &xml, &name, &value)) + { + if (streq(name, "name")) + { + config = value; + } + else if (streq(name, "ikeconfig")) + { + e1 = xml->children(xml); + while (e1->enumerate(e1, &xml, &name, &value)) + { + if (streq(name, "local") || streq(name, "remote")) + { + if (streq(value, "0.0.0.0") || streq(value, "::")) + { + value = "%any"; + } + r->setf(r, "peercfgs.%s.ikecfg.%s=%s", config, name, value); + } + } + e1->destroy(e1); + } + else if (streq(name, "childconfiglist")) + { + e1 = xml->children(xml); + while (e1->enumerate(e1, &xml, &name, &value)) + { + if (streq(name, "childconfig")) + { + int num = 0; + + e2 = xml->children(xml); + while (e2->enumerate(e2, &xml, &name, &value)) + { + if (streq(name, "name")) + { + child = value; + } + else if (streq(name, "local") || streq(name, "remote")) + { + section = name; + e3 = xml->children(xml); + while (e3->enumerate(e3, &xml, &name, &value)) + { + if (streq(name, "network")) + { + r->setf(r, "peercfgs.%s.childcfgs.%s.%s.networks.%d=%s", + config, child, section, ++num, value); + } + } + e3->destroy(e3); + } + } + e2->destroy(e2); + } + } + e1->destroy(e1); + } + else + { + r->setf(r, "peercfgs.%s.%s=%s", config, name, value); + } + } +} + +static void list(private_config_controller_t *this, request_t *r) +{ + gateway_t *gateway; + xml_t *xml; + enumerator_t *e1, *e2; + char *name, *value; + + gateway = this->manager->select_gateway(this->manager, 0); + e1 = gateway->query_configlist(gateway); + if (e1 == NULL) + { + r->set(r, "title", "Error"); + r->set(r, "error", "querying the gateway failed"); + r->render(r, "templates/error.cs"); + } + else + { + r->set(r, "title", "Configuration overview"); + + while (e1->enumerate(e1, &xml, &name, &value)) + { + if (streq(name, "peerconfig")) + { + e2 = xml->children(xml); + process_peerconfig(this, e2, r); + e2->destroy(e2); + } + } + e1->destroy(e1); + + r->render(r, "templates/config/list.cs"); + } +} + +/** + * Implementation of controller_t.get_name + */ +static char* get_name(private_config_controller_t *this) +{ + return "config"; +} + +/** + * Implementation of controller_t.handle + */ +static void handle(private_config_controller_t *this, + request_t *request, char *action) +{ + if (!this->manager->logged_in(this->manager)) + { + return request->redirect(request, "auth/login"); + } + if (this->manager->select_gateway(this->manager, 0) == NULL) + { + return request->redirect(request, "gateway/list"); + } + if (action) + { + if (streq(action, "list")) + { + return list(this, request); + } + } + return request->redirect(request, "config/list"); +} + +/** + * Implementation of controller_t.destroy + */ +static void destroy(private_config_controller_t *this) +{ + free(this); +} + +/* + * see header file + */ +controller_t *config_controller_create(context_t *context, void *param) +{ + private_config_controller_t *this = malloc_thing(private_config_controller_t); + + this->public.controller.get_name = (char*(*)(controller_t*))get_name; + this->public.controller.handle = (void(*)(controller_t*,request_t*,char*,char*,char*,char*,char*))handle; + this->public.controller.destroy = (void(*)(controller_t*))destroy; + + this->manager = (manager_t*)context; + + return &this->public.controller; +} + diff --git a/src/manager/controller/status_controller.h b/src/manager/controller/config_controller.h index a736dda83..fcf5f5c49 100644 --- a/src/manager/controller/status_controller.h +++ b/src/manager/controller/config_controller.h @@ -1,7 +1,7 @@ /** - * @file status_controller.h + * @file config_controller.h * - * @brief Interface of status_controller_t. + * @brief Interface of config_controller_t. * */ @@ -20,18 +20,18 @@ * for more details. */ -#ifndef STATUS_CONTROLLER_H_ -#define STATUS_CONTROLLER_H_ +#ifndef CONFIG_CONTROLLER_H_ +#define CONFIG_CONTROLLER_H_ #include <controller.h> -typedef struct status_controller_t status_controller_t; +typedef struct config_controller_t config_controller_t; /** * @brief Status controller. */ -struct status_controller_t { +struct config_controller_t { /** * Implements controller_t interface. @@ -40,8 +40,8 @@ struct status_controller_t { }; /** - * @brief Create a status_controller controller instance. + * @brief Create a config_controller controller instance. */ -controller_t *status_controller_create(context_t *context, void *param); +controller_t *config_controller_create(context_t *context, void *param); -#endif /* STATUS_CONTROLLER_H_ */ +#endif /* CONFIG_CONTROLLER_H_ */ diff --git a/src/manager/controller/control_controller.c b/src/manager/controller/control_controller.c new file mode 100644 index 000000000..12cb5e907 --- /dev/null +++ b/src/manager/controller/control_controller.c @@ -0,0 +1,211 @@ +/** + * @file control_controller.c + * + * @brief Implementation of control_controller_t. + * + */ + +/* + * Copyright (C) 2007 Martin Willi + * Hochschule fuer Technik Rapperswil + * + * 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. + */ + +#include "control_controller.h" +#include "../manager.h" +#include "../gateway.h" + +#include <xml.h> + +#include <library.h> + + +typedef struct private_control_controller_t private_control_controller_t; + +/** + * private data of the task manager + */ +struct private_control_controller_t { + + /** + * public functions + */ + control_controller_t public; + + /** + * manager instance + */ + manager_t *manager; +}; + +/** + * handle the result of a control operation + */ +static void handle_result(private_control_controller_t *this, request_t *r, + enumerator_t *e) +{ + enumerator_t *e1; + xml_t *xml; + char *name, *value; + int num = 0; + + if (e) + { + while (e->enumerate(e, &xml, &name, &value)) + { + if (streq(name, "status")) + { + if (value && atoi(value) == 0) + { + r->set(r, "result", "Operation executed successfully:"); + } + else + { + r->set(r, "result", "Operation failed:"); + } + } + else if (streq(name, "log")) + { + e1 = xml->children(xml); + while (e1->enumerate(e1, &xml, &name, &value)) + { + if (streq(name, "item")) + { + r->setf(r, "log.%d=%s", ++num, value); + } + } + e1->destroy(e1); + } + } + e->destroy(e); + r->render(r, "templates/control/result.cs"); + } + else + { + r->set(r, "title", "Error"); + r->set(r, "error", "controlling the gateway failed"); + r->render(r, "templates/error.cs"); + } +} + +/** + * initiate an IKE or CHILD SA + */ +static void initiate(private_control_controller_t *this, request_t *r, + bool ike, char *config) +{ + gateway_t *gateway; + enumerator_t *e; + + r->setf(r, "title=Establishing %s SA %s", ike ? "IKE" : "CHILD", config); + gateway = this->manager->select_gateway(this->manager, 0); + e = gateway->initiate(gateway, ike, config); + handle_result(this, r, e); +} + +/** + * terminate an IKE or CHILD SA + */ +static void terminate(private_control_controller_t *this, request_t *r, + bool ike, u_int32_t id) +{ + gateway_t *gateway; + enumerator_t *e; + + r->setf(r, "title=Terminate %s SA %d", ike ? "IKE" : "CHILD", id); + gateway = this->manager->select_gateway(this->manager, 0); + e = gateway->terminate(gateway, ike, id); + handle_result(this, r, e); +} + +/** + * Implementation of controller_t.get_name + */ +static char* get_name(private_control_controller_t *this) +{ + return "control"; +} + +/** + * Implementation of controller_t.handle + */ +static void handle(private_control_controller_t *this, + request_t *request, char *action, char *str) +{ + if (!this->manager->logged_in(this->manager)) + { + return request->redirect(request, "auth/login"); + } + if (this->manager->select_gateway(this->manager, 0) == NULL) + { + return request->redirect(request, "gateway/list"); + } + if (action) + { + u_int32_t id; + + if (streq(action, "terminateike")) + { + if (str && (id = atoi(str))) + { + return terminate(this, request, TRUE, id); + } + } + if (streq(action, "terminatechild")) + { + if (str && (id = atoi(str))) + { + return terminate(this, request, FALSE, id); + } + } + if (streq(action, "initiateike")) + { + if (str) + { + return initiate(this, request, TRUE, str); + } + } + if (streq(action, "initiatechild")) + { + if (str) + { + return initiate(this, request, FALSE, str); + } + } + } + return request->redirect(request, "ikesa/list"); +} + +/** + * Implementation of controller_t.destroy + */ +static void destroy(private_control_controller_t *this) +{ + free(this); +} + +/* + * see header file + */ +controller_t *control_controller_create(context_t *context, void *param) +{ + private_control_controller_t *this = malloc_thing(private_control_controller_t); + + this->public.controller.get_name = (char*(*)(controller_t*))get_name; + this->public.controller.handle = (void(*)(controller_t*,request_t*,char*,char*,char*,char*,char*))handle; + this->public.controller.destroy = (void(*)(controller_t*))destroy; + + this->manager = (manager_t*)context; + + return &this->public.controller; +} + diff --git a/src/manager/controller/control_controller.h b/src/manager/controller/control_controller.h new file mode 100644 index 000000000..6a55170aa --- /dev/null +++ b/src/manager/controller/control_controller.h @@ -0,0 +1,47 @@ +/** + * @file control_controller.h + * + * @brief Interface of control_controller_t. + * + */ + +/* + * Copyright (C) 2007 Martin Willi + * Hochschule fuer Technik Rapperswil + * + * 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. + */ + +#ifndef CONTROL_CONTROLLER_H_ +#define CONTROL_CONTROLLER_H_ + + +#include <controller.h> + +typedef struct control_controller_t control_controller_t; + +/** + * @brief Status controller. + */ +struct control_controller_t { + + /** + * Implements controller_t interface. + */ + controller_t controller; +}; + +/** + * @brief Create a control_controller controller instance. + */ +controller_t *control_controller_create(context_t *context, void *param); + +#endif /* CONTROL_CONTROLLER_H_ */ diff --git a/src/manager/controller/gateway_controller.c b/src/manager/controller/gateway_controller.c index bdc779256..dff1cf3cf 100644 --- a/src/manager/controller/gateway_controller.c +++ b/src/manager/controller/gateway_controller.c @@ -82,7 +82,7 @@ static void _select(private_gateway_controller_t *this, request_t *request) { if (this->manager->select_gateway(this->manager, atoi(id))) { - request->redirect(request, "status/ikesalist"); + request->redirect(request, "ikesa/list"); return; } } diff --git a/src/manager/controller/status_controller.c b/src/manager/controller/ikesa_controller.c index bcdbd26ea..2b282b79c 100644 --- a/src/manager/controller/status_controller.c +++ b/src/manager/controller/ikesa_controller.c @@ -1,7 +1,7 @@ /** - * @file status_controller.c + * @file ikesa_controller.c * - * @brief Implementation of status_controller_t. + * @brief Implementation of ikesa_controller_t. * */ @@ -20,7 +20,7 @@ * for more details. */ -#include "status_controller.h" +#include "ikesa_controller.h" #include "../manager.h" #include "../gateway.h" @@ -29,17 +29,17 @@ #include <library.h> -typedef struct private_status_controller_t private_status_controller_t; +typedef struct private_ikesa_controller_t private_ikesa_controller_t; /** * private data of the task manager */ -struct private_status_controller_t { +struct private_ikesa_controller_t { /** * public functions */ - status_controller_t public; + ikesa_controller_t public; /** * manager instance @@ -50,7 +50,7 @@ struct private_status_controller_t { /** * read XML of a childsa element and fill template */ -static void process_childsa(private_status_controller_t *this, char *id, +static void process_childsa(private_ikesa_controller_t *this, char *id, enumerator_t *e, request_t *r) { xml_t *xml; @@ -102,7 +102,7 @@ static void process_childsa(private_status_controller_t *this, char *id, /** * read XML of a ikesa element and fill template */ -static void process_ikesa(private_status_controller_t *this, +static void process_ikesa(private_ikesa_controller_t *this, enumerator_t *e, request_t *r) { xml_t *xml; @@ -146,7 +146,7 @@ static void process_ikesa(private_status_controller_t *this, } } -static void ikesalist(private_status_controller_t *this, request_t *r) +static void list(private_ikesa_controller_t *this, request_t *r) { gateway_t *gateway; xml_t *xml; @@ -176,22 +176,22 @@ static void ikesalist(private_status_controller_t *this, request_t *r) } e1->destroy(e1); - r->render(r, "templates/status/ikesalist.cs"); + r->render(r, "templates/ikesa/list.cs"); } } /** * Implementation of controller_t.get_name */ -static char* get_name(private_status_controller_t *this) +static char* get_name(private_ikesa_controller_t *this) { - return "status"; + return "ikesa"; } /** * Implementation of controller_t.handle */ -static void handle(private_status_controller_t *this, +static void handle(private_ikesa_controller_t *this, request_t *request, char *action) { if (!this->manager->logged_in(this->manager)) @@ -204,18 +204,18 @@ static void handle(private_status_controller_t *this, } if (action) { - if (streq(action, "ikesalist")) + if (streq(action, "list")) { - return ikesalist(this, request); + return list(this, request); } } - return request->redirect(request, "status/ikesalist"); + return request->redirect(request, "ikesa/list"); } /** * Implementation of controller_t.destroy */ -static void destroy(private_status_controller_t *this) +static void destroy(private_ikesa_controller_t *this) { free(this); } @@ -223,9 +223,9 @@ static void destroy(private_status_controller_t *this) /* * see header file */ -controller_t *status_controller_create(context_t *context, void *param) +controller_t *ikesa_controller_create(context_t *context, void *param) { - private_status_controller_t *this = malloc_thing(private_status_controller_t); + private_ikesa_controller_t *this = malloc_thing(private_ikesa_controller_t); this->public.controller.get_name = (char*(*)(controller_t*))get_name; this->public.controller.handle = (void(*)(controller_t*,request_t*,char*,char*,char*,char*,char*))handle; diff --git a/src/manager/controller/ikesa_controller.h b/src/manager/controller/ikesa_controller.h new file mode 100644 index 000000000..753cccad1 --- /dev/null +++ b/src/manager/controller/ikesa_controller.h @@ -0,0 +1,47 @@ +/** + * @file ikesa_controller.h + * + * @brief Interface of ikesa_controller_t. + * + */ + +/* + * Copyright (C) 2007 Martin Willi + * Hochschule fuer Technik Rapperswil + * + * 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. + */ + +#ifndef IKESA_CONTROLLER_H_ +#define IKESA_CONTROLLER_H_ + + +#include <controller.h> + +typedef struct ikesa_controller_t ikesa_controller_t; + +/** + * @brief Status controller. + */ +struct ikesa_controller_t { + + /** + * Implements controller_t interface. + */ + controller_t controller; +}; + +/** + * @brief Create a ikesa_controller controller instance. + */ +controller_t *ikesa_controller_create(context_t *context, void *param); + +#endif /* IKESA_CONTROLLER_H_ */ diff --git a/src/manager/gateway.c b/src/manager/gateway.c index 5f5a4b477..d4eb5279e 100644 --- a/src/manager/gateway.c +++ b/src/manager/gateway.c @@ -57,6 +57,11 @@ struct private_gateway_t { * socket file descriptor, > 0 if connected */ int fd; + + /** + * unique id assigned to each xml message + */ + int xmlid; }; struct sockaddr_un unix_addr = { AF_UNIX, IPSEC_PIDDIR "/charon.xml"}; @@ -103,7 +108,7 @@ static bool connect_(private_gateway_t *this) /** * Implementation of gateway_t.request. */ -static char* request(private_gateway_t *this, char *xml) +static char* request(private_gateway_t *this, char *xml, ...) { if (this->fd < 0) { @@ -116,18 +121,25 @@ static char* request(private_gateway_t *this, char *xml) { char buf[8096]; ssize_t len; + va_list args; - len = strlen(xml); - if (send(this->fd, xml, len, 0) != len) + va_start(args, xml); + len = vsnprintf(buf, sizeof(buf), xml, args); + va_end(args); + if (len < 0 || len >= sizeof(buf)) { return NULL; } - len = recv(this->fd, buf, sizeof(buf) - 1, 0); - if (len < 0) + if (send(this->fd, buf, len, 0) != len) { - return NULL; + if (!connect_(this)) + { + return NULL; + } + continue; } - if (len == 0) + len = recv(this->fd, buf, sizeof(buf) - 1, 0); + if (len <= 0) { if (!connect_(this)) { @@ -149,11 +161,11 @@ static enumerator_t* query_ikesalist(private_gateway_t *this) xml_t *xml; enumerator_t *e1, *e2, *e3, *e4 = NULL; - str = request(this, "<message type=\"request\" id=\"1\">" + str = request(this, "<message type=\"request\" id=\"%d\">" "<query>" "<ikesalist/>" "</query>" - "</message>"); + "</message>", this->xmlid++); if (str == NULL) { return NULL; @@ -197,6 +209,152 @@ static enumerator_t* query_ikesalist(private_gateway_t *this) return NULL; } + +/** + * Implementation of gateway_t.query_configlist. + */ +static enumerator_t* query_configlist(private_gateway_t *this) +{ + char *str, *name, *value; + xml_t *xml; + enumerator_t *e1, *e2, *e3, *e4 = NULL; + + str = request(this, "<message type=\"request\" id=\"%d\">" + "<query>" + "<configlist/>" + "</query>" + "</message>", this->xmlid++); + if (str == NULL) + { + return NULL; + } + xml = xml_create(str); + if (xml == NULL) + { + return NULL; + } + + e1 = xml->children(xml); + free(str); + while (e1->enumerate(e1, &xml, &name, &value)) + { + if (streq(name, "message")) + { + e2 = xml->children(xml); + while (e2->enumerate(e2, &xml, &name, &value)) + { + if (streq(name, "query")) + { + e3 = xml->children(xml); + while (e3->enumerate(e3, &xml, &name, &value)) + { + if (streq(name, "configlist")) + { + e4 = xml->children(xml); + e1->destroy(e1); + e2->destroy(e2); + e3->destroy(e3); + return e4; + } + } + e3->destroy(e3); + } + } + e2->destroy(e2); + } + } + e1->destroy(e1); + return NULL; +} + +/** + * create enumerator over control elements children of a control response + */ +static enumerator_t* read_result(private_gateway_t *this, char *res) +{ + char *name, *value; + xml_t *xml; + enumerator_t *e1, *e2, *e3; + + if (res == NULL) + { + return NULL; + } + xml = xml_create(res); + if (xml == NULL) + { + return NULL; + } + e1 = xml->children(xml); + free(res); + while (e1->enumerate(e1, &xml, &name, &value)) + { + if (streq(name, "message")) + { + e2 = xml->children(xml); + while (e2->enumerate(e2, &xml, &name, &value)) + { + if (streq(name, "control")) + { + e3 = xml->children(xml); + e1->destroy(e1); + e2->destroy(e2); + return e3; + } + } + e2->destroy(e2); + } + } + e1->destroy(e1); + return NULL; +} + +/** + * Implementation of gateway_t.initiate. + */ +static enumerator_t* initiate(private_gateway_t *this, bool ike, char *name) +{ + char *str, *kind; + + if (ike) + { + kind = "ike"; + } + else + { + kind = "child"; + } + str = request(this, "<message type=\"request\" id=\"%d\">" + "<control>" + "<%ssainitiate>%s</%ssainitiate>" + "</control>" + "</message>", this->xmlid++, kind, name, kind); + return read_result(this, str); +} + +/** + * Implementation of gateway_t.terminate. + */ +static enumerator_t* terminate(private_gateway_t *this, bool ike, u_int32_t id) +{ + char *str, *kind; + + if (ike) + { + kind = "ike"; + } + else + { + kind = "child"; + } + str = request(this, "<message type=\"request\" id=\"%d\">" + "<control>" + "<%ssaterminate>%d</%ssaterminate>" + "</control>" + "</message>", this->xmlid++, kind, id, kind); + return read_result(this, str); +} + /** * Implementation of gateway_t.destroy */ @@ -220,11 +378,15 @@ static private_gateway_t *gateway_create(char *name) this->public.request = (char*(*)(gateway_t*, char *xml))request; this->public.query_ikesalist = (enumerator_t*(*)(gateway_t*))query_ikesalist; + this->public.query_configlist = (enumerator_t*(*)(gateway_t*))query_configlist; + this->public.initiate = (enumerator_t*(*)(gateway_t*, bool ike, char *name))initiate; + this->public.terminate = (enumerator_t*(*)(gateway_t*, bool ike, u_int32_t id))terminate; this->public.destroy = (void(*)(gateway_t*))destroy; this->name = strdup(name); this->host = NULL; this->fd = -1; + this->xmlid = 1; return this; } diff --git a/src/manager/gateway.h b/src/manager/gateway.h index 1fe2aef4b..81d8b9c3f 100644 --- a/src/manager/gateway.h +++ b/src/manager/gateway.h @@ -49,6 +49,31 @@ struct gateway_t { enumerator_t* (*query_ikesalist)(gateway_t *this); /** + * @brief Query the list of peer configs and its subconfigs. + * + * @return enumerator over peerconfig XML elements + */ + enumerator_t* (*query_configlist)(gateway_t *this); + + /** + * @brief Terminate an IKE or a CHILD SA. + * + * @param ike TRUE for IKE-, FALSE for a CHILD-SA + * @param id ID of the SA to terminate + * @return enumerator over control response XML children + */ + enumerator_t* (*terminate)(gateway_t *this, bool ike, u_int32_t id); + + /** + * @brief Initiate an IKE or a CHILD SA. + * + * @param ike TRUE for IKE-, FALSE for CHILD-SA + * @param name name of the peer/child config + * @return enumerator over control response XML children + */ + enumerator_t* (*initiate)(gateway_t *this, bool ike, char *name); + + /** * @brief Destroy a gateway instance. */ void (*destroy)(gateway_t *this); diff --git a/src/manager/lib/dispatcher.c b/src/manager/lib/dispatcher.c index df669ceb6..ce53d39ea 100644 --- a/src/manager/lib/dispatcher.c +++ b/src/manager/lib/dispatcher.c @@ -30,6 +30,7 @@ #include <signal.h> #include <unistd.h> +#include <debug.h> #include <utils/linked_list.h> typedef struct private_dispatcher_t private_dispatcher_t; @@ -122,8 +123,8 @@ typedef struct { session_t *session; /** condvar to wait for session */ pthread_cond_t cond; - /** number of threads waiting for session */ - int waiting; + /** TRUE if session is in use */ + bool in_use; /** last use of the session */ time_t used; } session_entry_t; @@ -164,7 +165,7 @@ static session_entry_t *session_entry_create(private_dispatcher_t *this) session_entry_t *entry; entry = malloc_thing(session_entry_t); - entry->waiting = 1; + entry->in_use = FALSE; pthread_cond_init(&entry->cond, NULL); entry->session = load_session(this); entry->used = time(NULL); @@ -228,11 +229,12 @@ static void dispatch(private_dispatcher_t *this) now = time(NULL); /* find session */ - iterator = this->sessions->create_iterator_locked(this->sessions, &this->mutex); + pthread_mutex_lock(&this->mutex); + iterator = this->sessions->create_iterator(this->sessions, TRUE); while (iterator->iterate(iterator, (void**)¤t)) { /* check all sessions for timeout */ - if (current->waiting == 0 && + if (!current->in_use && current->used < now - this->timeout) { iterator->remove(iterator); @@ -243,27 +245,24 @@ static void dispatch(private_dispatcher_t *this) streq(current->session->get_sid(current->session), sid)) { found = current; - found->waiting++; } } iterator->destroy(iterator); if (found) { /* wait until session is unused */ - pthread_mutex_lock(&this->mutex); - while (found->waiting > 1) + while (found->in_use) { pthread_cond_wait(&found->cond, &this->mutex); } - pthread_mutex_unlock(&this->mutex); } else { /* create a new session if not found */ found = session_entry_create(this); - pthread_mutex_lock(&this->mutex); this->sessions->insert_first(this->sessions, found); - pthread_mutex_unlock(&this->mutex); } + found->in_use = TRUE; + pthread_mutex_unlock(&this->mutex); /* start processing */ found->session->process(found->session, request); @@ -271,7 +270,7 @@ static void dispatch(private_dispatcher_t *this) /* release session */ pthread_mutex_lock(&this->mutex); - found->waiting--; + found->in_use = FALSE; pthread_cond_signal(&found->cond); pthread_mutex_unlock(&this->mutex); diff --git a/src/manager/lib/request.c b/src/manager/lib/request.c index 4623b3860..2e18bded5 100644 --- a/src/manager/lib/request.c +++ b/src/manager/lib/request.c @@ -179,12 +179,18 @@ static void add_cookie(private_request_t *this, char *name, char *value) /** * Implementation of request_t.redirect. */ -static void redirect(private_request_t *this, char *location) +static void redirect(private_request_t *this, char *fmt, ...) { + va_list args; + FCGX_FPrintF(this->req->out, "Status: 303 See Other\n"); - FCGX_FPrintF(this->req->out, "Location: %s%s%s\n\n", + FCGX_FPrintF(this->req->out, "Location: %s%s", FCGX_GetParam("SCRIPT_NAME", this->req->envp), - *location == '/' ? "" : "/", location); + *fmt == '/' ? "" : "/"); + va_start(args, fmt); + FCGX_VFPrintF(this->req->out, fmt, args); + va_end(args); + FCGX_FPrintF(this->req->out, "\n\n"); } /** @@ -196,6 +202,16 @@ static char* get_base(private_request_t *this) } /** + * Implementation of request_t.serve. + */ +static void serve(private_request_t *this, char *headers, chunk_t chunk) +{ + FCGX_FPrintF(this->req->out, "%s\n\n", headers); + + FCGX_PutStr(chunk.ptr, chunk.len, this->req->out); +} + +/** * Implementation of request_t.render. */ static void render(private_request_t *this, char *template) @@ -254,8 +270,9 @@ request_t *request_create(FCGX_Request *request, bool debug) this->public.add_cookie = (void(*)(request_t*, char *name, char *value))add_cookie; this->public.get_cookie = (char*(*)(request_t*,char*))get_cookie; this->public.get_query_data = (char*(*)(request_t*, char *name))get_query_data; - this->public.redirect = (void(*)(request_t*, char *location))redirect; + this->public.redirect = (void(*)(request_t*, char *fmt,...))redirect; this->public.render = (void(*)(request_t*,char*))render; + this->public.serve = (void(*)(request_t*,char*,chunk_t))serve; this->public.set = (void(*)(request_t*, char *, char*))set; this->public.setf = (void(*)(request_t*, char *format, ...))setf; this->public.destroy = (void(*)(request_t*))destroy; diff --git a/src/manager/lib/request.h b/src/manager/lib/request.h index e6fd71e71..f78741d37 100644 --- a/src/manager/lib/request.h +++ b/src/manager/lib/request.h @@ -75,9 +75,10 @@ struct request_t { /** * @brief Redirect the client to another location. * - * @param location location to redirect to + * @param fmt location format string + * @param ... variable argument for fmt */ - void (*redirect)(request_t *this, char *location); + void (*redirect)(request_t *this, char *fmt, ...); /** * @brief Set a template value. @@ -106,11 +107,18 @@ struct request_t { * other targets without to worry about path location. * * @param template clearsilver template file location - * @return rendered template string */ void (*render)(request_t *this, char *template); /** + * @brief Serve a request with headers and a body. + * + * @param headers HTTP headers, \n separated + * @param chunk body to write to output + */ + void (*serve)(request_t *this, char *headers, chunk_t chunk); + + /** * @brief Destroy the request_t. */ void (*destroy) (request_t *this); diff --git a/src/manager/main.c b/src/manager/main.c index bbe07cbf3..eb4654ced 100644 --- a/src/manager/main.c +++ b/src/manager/main.c @@ -26,11 +26,13 @@ #include "manager.h" #include "database.h" #include "controller/auth_controller.h" -#include "controller/status_controller.h" +#include "controller/ikesa_controller.h" #include "controller/gateway_controller.h" +#include "controller/control_controller.h" +#include "controller/config_controller.h" #define DBFILE IPSECDIR "/manager.db" -#define SESSION_TIMEOUT 180 +#define SESSION_TIMEOUT 900 #define THREADS 10 int main (int arc, char *argv[]) @@ -52,9 +54,11 @@ int main (int arc, char *argv[]) dispatcher = dispatcher_create(socket, SESSION_TIMEOUT, (context_constructor_t)manager_create, database); - dispatcher->add_controller(dispatcher, status_controller_create, NULL); + dispatcher->add_controller(dispatcher, ikesa_controller_create, NULL); dispatcher->add_controller(dispatcher, gateway_controller_create, NULL); dispatcher->add_controller(dispatcher, auth_controller_create, NULL); + dispatcher->add_controller(dispatcher, control_controller_create, NULL); + dispatcher->add_controller(dispatcher, config_controller_create, NULL); dispatcher->run(dispatcher, THREADS, NULL, NULL, NULL, NULL); diff --git a/src/manager/templates/config/list.cs b/src/manager/templates/config/list.cs new file mode 100644 index 000000000..e71830d4d --- /dev/null +++ b/src/manager/templates/config/list.cs @@ -0,0 +1,104 @@ +<?cs include:"templates/header.cs" ?> +<?cs each:peercfg = peercfgs ?> + <div class="expand" id="peercfg-<?cs name:peercfg ?>"> + <h1><?cs name:peercfg ?>: + <span><?cs var:peercfg.local ?></span> <-> + <span><?cs var:peercfg.remote ?></span> + </h1> + <div class="controls"> + <?cs if:peercfg.remote != "%any" ?> + <a title="initiate SA" href="<?cs var:base ?>/control/initiateike/<?cs name:peercfg ?>"> + <img src="<?cs var:base ?>/static/initiate.png"/> + </a> + <?cs else ?> + + <?cs /if ?> + </div> + <div class="expander"> + <hr/> + <table class="drawing"> + <tr> + <td class="left" colspan="3"> + <?cs var:peercfg.local ?> + </td> + <td> + </td> + <td class="right" colspan="3"> + <?cs var:peercfg.remote ?> + </td> + </tr> + <tr class="images"> + <td> + <?cs if:peercfg.remote != "%any" ?> + <img title="Local host can be the initiator" src="<?cs var:base ?>/static/client-left.png"></img> + <?cs else ?> + <img title="Local host must be the responder" src="<?cs var:base ?>/static/gateway-left.png"></img> + <?cs /if ?> + </td> + <td style="background-image:url(<?cs var:base ?>/static/pipe.png)"> + <font color="#e5bf5e">0123456789abdcef</font><br/><br/><br/> + <?cs var:peercfg.ikecfg.local ?> + </td> + <td> + <img src="<?cs var:base ?>/static/pipe.png"></img> + </td> + <td> + <img title="IKE connection is down" src="<?cs var:base ?>/static/pipe.png"></img> + </td> + <td> + <img src="<?cs var:base ?>/static/pipe.png"></img> + </td> + <td class="right" style="background-image:url(<?cs var:base ?>/static/pipe.png)"> + <font color="#e5bf5e">0123456789abcdef</font><br/><br/><br/> + <?cs var:peercfg.ikecfg.remote ?> + </td> + <td> + <?cs if:peercfg.remote == "%any" ?> + <img title="Remote host must be the initiator" src="<?cs var:base ?>/static/client-right.png"></img> + <?cs else ?> + <img title="Remote host can be the responder" src="<?cs var:base ?>/static/gateway-right.png"></img> + <?cs /if ?> + </td> + </tr> + <?cs each:childcfg = peercfg.childcfgs ?> + <tr> + <td colspan="6" class="expand"> + <h1><?cs name:childcfg ?>:</h1> + </td> + <td class="controls"> + <?cs if:peercfg.remote != "%any" ?> + <a title="initiate SA" href="<?cs var:base ?>/control/initiatechild/<?cs name:childcfg ?>"> + <img src="<?cs var:base ?>/static/initiate.png"/> + </a> + <?cs /if ?> + </td> + </tr> + <tr> + <td colspan="7"><hr/></td> + </tr> + <tr class="images"> + <td colspan="2"> + <?cs each:net = childcfg.local.networks ?> + <p><?cs var:net ?></p> + <?cs /each ?> + </td> + <td style="background-image:url(<?cs var:base ?>/static/pipe-thin-left.png)"> + <br/><br/><br/> + </td> + <td style="background-image:url(<?cs var:base ?>/static/pipe-thin.png)"> + </td> + <td class="right" style="background-image:url(<?cs var:base ?>/static/pipe-thin-right.png)"> + <br/><br/><br/> + </td> + <td class="right" colspan="2"> + <?cs each:net = childcfg.remote.networks ?> + <p><?cs var:net ?></p> + <?cs /each ?> + </td> + </tr> + <?cs /each ?> + </table> + </div> + </div> +<?cs /each ?> +<?cs include:"templates/footer.cs" ?> diff --git a/src/manager/templates/control/result.cs b/src/manager/templates/control/result.cs new file mode 100644 index 000000000..1d59df65f --- /dev/null +++ b/src/manager/templates/control/result.cs @@ -0,0 +1,14 @@ +<?cs include:"templates/header.cs" ?> +<div class="expand"> + <h1><?cs var:result ?></h1> + <div class="controls"> </div> + <div class="expander"> + <hr/> + <ul> + <?cs each:item = log ?> + <li><?cs var:item ?></li> + <?cs /each ?> + </ul> + </div> +</div> +<?cs include:"templates/footer.cs" ?> diff --git a/src/manager/templates/header.cs b/src/manager/templates/header.cs index 64a859a9a..bacd833e0 100644 --- a/src/manager/templates/header.cs +++ b/src/manager/templates/header.cs @@ -9,13 +9,15 @@ </head> <body> <div class="fleft"> - <a href="<?cs var:base ?>/status/ikesalist"> + <a href="<?cs var:base ?>/ikesa/list"> <img class="fleft" src="<?cs var:base ?>/static/strongswan.png"/> </a> <h1>strongSwan Manager</h1> <h2><?cs var:title ?></h2> </div> <div class="menu"> + | <a href="<?cs var:base ?>/ikesa/list">IKE SAs</a> + | <a href="<?cs var:base ?>/config/list">Config</a> | <a href="<?cs var:base ?>/gateway/list">Select Gateway</a> | <a href="<?cs var:base ?>/auth/logout">Logout</a> </div> diff --git a/src/manager/templates/status/ikesalist.cs b/src/manager/templates/ikesa/list.cs index 2238aafd3..f9a8e5c68 100644 --- a/src/manager/templates/status/ikesalist.cs +++ b/src/manager/templates/ikesa/list.cs @@ -2,11 +2,16 @@ <?cs each:ikesa = ikesas ?> <div class="expand" id="ikesa-<?cs name:ikesa ?>"> <h1> - IKE #<?cs name:ikesa ?> [<?cs var:ikesa.peerconfig ?>]: + <?cs var:ikesa.peerconfig ?> [IKE #<?cs name:ikesa ?>]: <span><?cs var:ikesa.local.identification ?></span> <-> <span><?cs var:ikesa.remote.identification ?></span> - </h1> - <div> + </h1> + <div class="controls"> + <a title="close IKE_SA" href="<?cs var:base ?>/control/terminateike/<?cs name:ikesa ?>"> + <img src="<?cs var:base ?>/static/close.png"/> + </a> + </div> + <div class="expander"> <hr/> <table class="drawing"> <tr> @@ -66,8 +71,13 @@ </tr> <?cs each:childsa = ikesa.childsas ?> <tr> - <td colspan="7" class="expand"> - <h1>IPsec #<?cs name:childsa ?> [<?cs var:childsa.childconfig ?>]:</h1> + <td colspan="6" class="expand"> + <h1><?cs var:childsa.childconfig ?> [IPsec #<?cs name:childsa ?>]:</h1> + </td> + <td class="controls"> + <a title="close CHILD_SA" href="<?cs var:base ?>/control/terminatechild/<?cs name:childsa ?>"> + <img src="<?cs var:base ?>/static/close.png"/> + </a> </td> </tr> <tr> @@ -79,12 +89,12 @@ <p><?cs var:net ?></p> <?cs /each ?> </td> - <td style="background-image:url(<?cs var:base ?>/static/pipe-thin-left.png)"> + <td style="background-image:url(<?cs var:base ?>/static/pipe-thin-left-green.png)"> <?cs var:childsa.local.spi ?> <-<br/><br/><br/> </td> - <td style="background-image:url(<?cs var:base ?>/static/pipe-thin.png)"> + <td style="background-image:url(<?cs var:base ?>/static/pipe-thin-green.png)"> </td> - <td class="right" style="background-image:url(<?cs var:base ?>/static/pipe-thin-right.png)"> + <td class="right" style="background-image:url(<?cs var:base ?>/static/pipe-thin-right-green.png)"> -> <?cs var:childsa.remote.spi ?><br/><br/><br/> </td> <td class="right" colspan="2"> diff --git a/src/manager/templates/static/close.png b/src/manager/templates/static/close.png Binary files differnew file mode 100644 index 000000000..7cb058d69 --- /dev/null +++ b/src/manager/templates/static/close.png diff --git a/src/manager/templates/static/initiate.png b/src/manager/templates/static/initiate.png Binary files differnew file mode 100644 index 000000000..4463e3b7a --- /dev/null +++ b/src/manager/templates/static/initiate.png diff --git a/src/manager/templates/static/pipe-thin-green.png b/src/manager/templates/static/pipe-thin-green.png Binary files differnew file mode 100644 index 000000000..df3026ec5 --- /dev/null +++ b/src/manager/templates/static/pipe-thin-green.png diff --git a/src/manager/templates/static/pipe-thin-left-green.png b/src/manager/templates/static/pipe-thin-left-green.png Binary files differnew file mode 100644 index 000000000..b76432a94 --- /dev/null +++ b/src/manager/templates/static/pipe-thin-left-green.png diff --git a/src/manager/templates/static/pipe-thin-right-green.png b/src/manager/templates/static/pipe-thin-right-green.png Binary files differnew file mode 100644 index 000000000..f193af9cc --- /dev/null +++ b/src/manager/templates/static/pipe-thin-right-green.png diff --git a/src/manager/templates/static/script.js b/src/manager/templates/static/script.js index 7b2a5823c..c9105c372 100644 --- a/src/manager/templates/static/script.js +++ b/src/manager/templates/static/script.js @@ -1,8 +1,7 @@ $(function(){ - $(".expand > div").hide(); $(".expand > h1").toggle( - function(){$(this).parent(".expand").find("div").slideDown('fast');}, - function(){$(this).parent(".expand").find("div").slideUp('fast');} + function(){$(this).parent(".expand").find(".expander").slideUp('fast');}, + function(){$(this).parent(".expand").find(".expander").slideDown('fast');} ); }); diff --git a/src/manager/templates/static/style.css b/src/manager/templates/static/style.css index 8a7f4960d..9550b8291 100644 --- a/src/manager/templates/static/style.css +++ b/src/manager/templates/static/style.css @@ -57,6 +57,8 @@ a img { font-size: 1em; cursor: pointer; margin: 0; + float: left; + padding-top: 3px; } .expand h1 span { @@ -64,6 +66,15 @@ a img { margin-right: 2em; } +.expander { + clear:left; +} + +.controls { + margin-top: 3px; + text-align: right; +} + .center { text-align: center; } |