OSDN Git Service

Delete urla module files.
authorKohei TANUMA <tanuma@users.sourceforge.jp>
Mon, 3 Aug 2009 23:48:37 +0000 (08:48 +0900)
committerKohei TANUMA <tanuma@users.sourceforge.jp>
Mon, 3 Aug 2009 23:48:37 +0000 (08:48 +0900)
module/protocol/module_urla_map.cpp [deleted file]
module/protocol/module_urla_map.h [deleted file]
module/protocol/protomod_urla.c [deleted file]

diff --git a/module/protocol/module_urla_map.cpp b/module/protocol/module_urla_map.cpp
deleted file mode 100644 (file)
index 993587f..0000000
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * @file  module_urla_map.cpp
- * @brief this module provide session persistence by URL session ID.
- *
- * L7VSD: Linux Virtual Server for Layer7 Load Balancing
- * Copyright (C) 2009  NTT COMWARE Corporation.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA
- *
- **********************************************************************/
-
-#include "module_urla_map.h"
-
-session* session_area = NULL;
-session_list_t session_list;
-session_map_t  session_map;
-
-int
-create_session_area(int size) {
-    // free old session area
-    if (session_area) {
-        free(session_area);
-    }
-
-    // allocate new session area
-    session_area = (session*) calloc(sizeof(session), size);
-    if (session_area == NULL) {
-        //XXX
-        return -1;
-    }
-
-    // clear all session
-    session_list.clear();
-
-    // create session_list
-    int i;
-    for (i = 0; i < size; i++) {
-        session_list.push_back(map + i);
-    }
-    return 0;
-}
-
-void
-insert_session(char* id, sockaddr_in* dest) {
-    struct timeval now;
-    // get current time
-    gettimeofday(&now, NULL);
-
-    // search session id
-    session_map_t::iterator i = session_map.find(id);
-    // exists session id
-    if (i != session.end()) {
-        // session overwrite
-        (*(i->second))->dest = dest;
-        (*(i->second))->time = now.tv_sec;
-        // move to top
-        session_list.erase(i->second);
-        session_list.push_front(*(i->second));
-    } else { // insert new session
-        // pop oldest session
-        session* map = session_list.back();
-        session_list.pop_back();
-        // search oldest session id
-        i = session_map.find(string(map->session_id));
-        // exists session id
-        if (i != session_map.end())
-            session_map.erase(i);
-        // set session id and destination
-        strncpy(map->id, id, SESSION_ID_LENGTH);
-        map->dest = *dest;
-        // move to top
-        session_list.push_front(map);
-        // insert session to map
-        session_map.insert(std::pair<std::string, std::list<session*>::iterator>(string(id), session_list.begin()));
-    }
-}
-
-sockaddr_in
-find_session(char* id) {
-    session_map::iterator i = session_map.find(id);
-    // exists session id
-    if (i != session_map.end()) {
-        return (*(i->second))->dest;
-    }
-    return NULL;
-}
diff --git a/module/protocol/module_urla_map.h b/module/protocol/module_urla_map.h
deleted file mode 100644 (file)
index 112503f..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * @file  module_urla_map.h
- * @brief this module provide session persistence by URL session ID.
- *
- * L7VSD: Linux Virtual Server for Layer7 Load Balancing
- * Copyright (C) 2009  NTT COMWARE Corporation.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA
- *
- **********************************************************************/
-
-#ifndef MODULE_URLA_MAP_H
-#define MODULE_URLA_MAP_H
-
-#include <map>
-#include <string>
-#include <list>
-#include <sys/time.h>
-#include "l7vs_dest.h"
-
-#define SESSION_ID_LENGTH
-
-struct session {
-    char id[SESSION_ID_LENGTH];
-    sockaddr_in dest;
-    time_t time;
-};
-
-typedef std::list<session*> session_list_t;
-typedef std::map<std::string, std::list<session*>::iterator> session_map_t;
-
-extern "C" {
-    int create_session_area(int);
-    int insert_session(char*, struct sockaddr_in*);
-    sockaddr_in find_session(char*);
-}
-
-#endif // MODULE_URLA_MAP_H
diff --git a/module/protocol/protomod_urla.c b/module/protocol/protomod_urla.c
deleted file mode 100644 (file)
index db07d31..0000000
+++ /dev/null
@@ -1,1332 +0,0 @@
-/*
- * @file  protomod_urla.c
- * @brief protocol module of HTTP.
- * @brief this module provide session persistence by URL key.
- *
- * L7VSD: Linux Virtual Server for Layer7 Load Balancing
- * Copyright (C) 2008  NTT COMWARE Corporation.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA
- *
- **********************************************************************/
-
-#define    __STDC_LIMIT_MACROS
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
-#include <getopt.h>
-#include "l7vs_service.h"
-#include "l7vs_conn.h"
-#include "l7vs_dest.h"
-#include "l7vs_module.h"
-#include "module_http.h"
-#include <fnmatch.h>
-
-#include <iostream>
-#ifdef USE_BOOST_XPRESSIVE
-    #include <boost/xpressive/xpressive.hpp>
-#else
-    #include <boost/regex.hpp>
-#endif
-
-#define SERVICE_ARG_MAXSIZE          (512)
-#define KEY_NAME_MAXSIZE             (128)
-#define URLA_SERVICE_NUMBER          (128)
-#define X_FORWARDED_FOR_LENGTH       (48)
-
-struct l7vs_urla_service {
-    handle_t service_handle;
-    char key_name[KEY_NAME_MAXSIZE];
-    int forwarded_for;
-#ifdef USE_BOOST_XPRESSIVE
-    boost::xpressive::sregex key_name_regex;
-#else
-    boost::regex key_name_regex;
-#endif
-    int reschedule;
-};
-
-struct  l7vs_urla_service_arg {
-    char key_name[KEY_NAME_MAXSIZE];
-    int forwarded_for;
-    int reschedule;
-};
-
-static void  fini(void);
-static int   create(void*, handle_t);
-static void* create_sa(struct l7vs_service_arg*);
-static int   compare(handle_t, handle_t);
-static int   match_cldata(struct l7vs_service*, struct l7vs_conn*,
-    char*, size_t*, struct l7vs_dest**, int*);
-static int   analyze_rsdata(struct l7vs_service*, struct l7vs_conn*,
-    char*, size_t*);
-static int   destroy(handle_t);
-static void  destroy_sa(void**);
-static int   service_arg(struct l7vs_service_arg_multi*, handle_t);
-static int   parse(void*, int, char**);
-
-static struct l7vs_urla_service *l7vs_protomod_urla_search_service(handle_t);
-static struct l7vs_urla_service *l7vs_protomod_urla_create_service();
-static struct l7vs_urla_service *l7vs_protomod_urla_create_temp_service();
-
-static void l7vs_urla_service_c_str(char*, struct l7vs_urla_service*);
-static void l7vs_urla_service_arg_c_str(char*, struct l7vs_urla_service_arg*);
-
-struct l7vs_urla_service *urla_service_list[URLA_SERVICE_NUMBER];
-
-static struct l7vs_protomod urla_protomod = {
-    NULL,           /* handle */
-    "urla",          /* modname */
-    0,              /* refcnt */
-    0,              /* fast schedule */
-    create,         /* create function */
-    compare,        /* compare function */
-    match_cldata,   /* match_cldata function */
-    analyze_rsdata, /* analyze_rsdata function */
-    destroy,        /* destroy function */
-    fini,           /* fini function */
-    create_sa,      /* create_sa function */
-    service_arg,    /* service_arg function */
-    parse,          /* parse function */
-    destroy_sa,     /* destroy_sa function */
-    NULL,           /* initialize function */
-    NULL,           /* finalize function */
-    NULL,           /* get_log_level function */
-    NULL,           /* put_log_debug function */
-    NULL,           /* put_log_info function */
-    NULL,           /* put_log_warn function */
-    NULL,           /* put_log_error function */
-    NULL            /* put_log_fatal function */
-};
-
-/*!
- * Protocol module initialize function. This function run when dlopen and dlsym at first time.
- * @param[in] handle dlopen's handle
- * @return l7vs_protomod struct
- */
-extern "C" struct l7vs_protomod *
-init(void *handle)
-{
-    struct l7vs_protomod* return_value = NULL;
-
-    /*-------- DEBUG LOG --------*/
-    if (urla_protomod.get_log_level != NULL &&
-        LOG_LV_DEBUG == urla_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
-        PUT_LOG_DEBUG(urla_protomod, LOG_CAT_L7VSD_PROTOCOL,135,
-                "in_function: struct l7vs_protomod* init(void* handle): handle=%p", handle);
-    }
-    /*------ DEBUG LOG END ------*/
-
-    /* check null */
-    if (handle == NULL) {
-        PUT_LOG_ERROR(urla_protomod, LOG_CAT_L7VSD_PROTOCOL,117, "Arg(handle) is NULL pointer.");
-        goto init_out;
-    }
-
-    /* initialize urla service list */
-    memset(urla_service_list, 0, sizeof(struct l7vs_urla_service *) * URLA_SERVICE_NUMBER);
-    /* set dlopen's handle */
-    urla_protomod.handle = handle;
-
-    return_value = &urla_protomod;
-
-init_out:
-    /*-------- DEBUG LOG --------*/
-    if (urla_protomod.get_log_level != NULL &&
-        LOG_LV_DEBUG == urla_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
-        char protomod_str[DEBUG_STR_LEN] = {0};
-        l7vs_protomod_c_str(protomod_str, &urla_protomod);
-        PUT_LOG_DEBUG(urla_protomod, LOG_CAT_L7VSD_PROTOCOL,136,
-            "out_function: struct l7vs_protomod* init(void* handle): return=&(%s)", protomod_str);
-    }
-    /*------ DEBUG LOG END ------*/
-    return return_value;
-}
-
-/*!
- * Protocol module finalize function. free all urla service list just in case.
- * @param   void
- * @return  void
- */
-static void
-fini(void)
-{
-    /* urla service list counter */
-    int service_number = 0;
-
-    /*-------- DEBUG LOG --------*/
-    if (urla_protomod.get_log_level != NULL &&
-        LOG_LV_DEBUG == urla_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
-        PUT_LOG_DEBUG(urla_protomod, LOG_CAT_L7VSD_PROTOCOL,137, "in_function: void fini(void)");
-    }
-    /*------ DEBUG LOG END ------*/
-
-    /* check all urla service list */
-    for (service_number = 0; service_number < URLA_SERVICE_NUMBER; ++service_number) {
-        /* if pointer that does not point NULL exists ... */
-        if (urla_service_list[service_number] != NULL) {
-
-            /*-------- DEBUG LOG --------*/
-            if (urla_protomod.get_log_level != NULL &&
-                LOG_LV_DEBUG == urla_protomod.get_log_level(LOG_CAT_L7VSD_SYSTEM_MEMORY)) {
-                PUT_LOG_DEBUG(urla_protomod, LOG_CAT_L7VSD_SYSTEM_MEMORY,34, "free: %p",
-                    urla_service_list[service_number]);
-            }
-            /*------ DEBUG LOG END ------*/
-
-            /* free and points NULL */
-            free(urla_service_list[service_number]);
-            urla_service_list[service_number] = NULL;
-        }
-    }
-    /*-------- DEBUG LOG --------*/
-    if (urla_protomod.get_log_level != NULL &&
-        LOG_LV_DEBUG == urla_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
-        PUT_LOG_DEBUG(urla_protomod, LOG_CAT_L7VSD_PROTOCOL,138, "out_function: void fini(void)");
-    }
-    /*------ DEBUG LOG END ------*/
-}
-
-/*!
- * Create urla service struct.
- * @param  urla_arg    urla service argument struct
- * @param  service_handle a unique service ID
- * @retval 0  successfully create urla service.
- * @retval -1 some errors occur.
- */
-static int
-create(void *urla_arg, handle_t service_handle)
-{
-    struct l7vs_urla_service *urla_service;
-    struct l7vs_urla_service_arg *urla_service_arg;
-    int return_value = 0;
-
-    /*-------- DEBUG LOG --------*/
-    if (urla_protomod.get_log_level != NULL &&
-        LOG_LV_DEBUG == urla_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
-        char urla_arg_str[DEBUG_STR_LEN] = {0};
-        l7vs_urla_service_arg_c_str(urla_arg_str, (struct l7vs_urla_service_arg*) urla_arg);
-        PUT_LOG_DEBUG(urla_protomod, LOG_CAT_L7VSD_PROTOCOL,139,
-            "in_function: int create(void* urla_arg, handle_t service_handle):urla_arg=&(%s), "
-            "service_handle=%d", urla_arg_str, service_handle);
-    }
-    /*------ DEBUG LOG END ------*/
-
-    /* check null */
-    if (urla_arg == NULL) {
-        PUT_LOG_ERROR(urla_protomod, LOG_CAT_L7VSD_PROTOCOL,118, "Arg(urla_arg) is NULL pointer.");
-        return_value = -1;
-        goto create_out;
-    }
-
-    if (service_handle != TEMP_SERVICEHANDLE) {
-        /* search empty urla service list and create urla service */
-        urla_service = l7vs_protomod_urla_create_service();
-    } else {
-        /* create temporary urla service */
-        urla_service = l7vs_protomod_urla_create_temp_service();
-    }
-
-    /*-------- DEBUG LOG --------*/
-    if (urla_protomod.get_log_level != NULL &&
-        LOG_LV_DEBUG == urla_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
-        char urla_str[DEBUG_STR_LEN] = {0};
-        l7vs_urla_service_c_str(urla_str, urla_service);
-        PUT_LOG_DEBUG(urla_protomod, LOG_CAT_L7VSD_PROTOCOL,140, "pointer assign: urla_service=&(%s)",
-            urla_str);
-    }
-    /*------ DEBUG LOG END ------*/
-
-    if (urla_service == NULL) {
-        PUT_LOG_ERROR(urla_protomod, LOG_CAT_L7VSD_PROTOCOL,119, "Could not make urla service.");
-        return_value = -1;
-        goto create_out;
-    }
-
-    urla_service_arg = (struct l7vs_urla_service_arg *) urla_arg;
-
-    /* set service handle, key name and reschedule flag */
-    urla_service->service_handle = service_handle;
-    urla_service->forwarded_for = urla_service_arg->forwarded_for;
-    if ( strnlen(urla_service_arg->key_name, KEY_NAME_MAXSIZE) ) {
-        try {
-#ifdef USE_BOOST_XPRESSIVE
-            urla_service->key_name_regex = boost::xpressive::sregex::compile(urla_service_arg->key_name);
-#else
-            urla_service->key_name_regex.assign(urla_service_arg->key_name);
-#endif
-        }
-        catch (...) {
-            PUT_LOG_ERROR(urla_protomod, LOG_CAT_L7VSD_PROTOCOL,284, "Regex pattern error of key_name");
-            return_value = -1;
-            goto create_out;
-        }
-    }
-    urla_service->reschedule = urla_service_arg->reschedule;
-
-create_out:
-    /*-------- DEBUG LOG --------*/
-    if (urla_protomod.get_log_level != NULL &&
-        LOG_LV_DEBUG == urla_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
-        PUT_LOG_DEBUG(urla_protomod, LOG_CAT_L7VSD_PROTOCOL,141,
-            "out_function: int create(void* urla_arg, handle_t service_handle):return_value=%d",
-            return_value);
-    }
-    /*------ DEBUG LOG END ------*/
-
-    return return_value;
-}
-
-/*!
- * Create urla service argument struct.
- * @param[out] srv_arg service argument struct
- * @return urla service argument struct
- */
-static void *
-create_sa(struct l7vs_service_arg *srv_arg)
-{
-    struct l7vs_urla_service_arg *urla_service_arg;
-
-    /*-------- DEBUG LOG --------*/
-    if (urla_protomod.get_log_level != NULL &&
-        LOG_LV_DEBUG == urla_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
-        char service_arg_str[DEBUG_STR_LEN] = {0};
-        l7vs_service_arg_c_str(service_arg_str, srv_arg);
-        PUT_LOG_DEBUG(urla_protomod, LOG_CAT_L7VSD_PROTOCOL,142,
-            "in_function: void* create_sa(struct l7vs_service_arg* srv_arg):srv_arg=&(%s)",
-            service_arg_str);
-    }
-    /*------ DEBUG LOG END ------*/
-
-    /* check null */
-    if (srv_arg == NULL) {
-        PUT_LOG_ERROR(urla_protomod, LOG_CAT_L7VSD_PROTOCOL,120, "Arg(srv_arg) is NULL pointer.");
-        urla_service_arg = NULL;
-        goto create_sa_out;
-    }
-
-    /* create urla service argument struct */
-    urla_service_arg = (struct l7vs_urla_service_arg *) calloc(1, sizeof(struct l7vs_urla_service_arg));
-
-    /*-------- DEBUG LOG --------*/
-    if (urla_protomod.get_log_level != NULL &&
-        LOG_LV_DEBUG == urla_protomod.get_log_level(LOG_CAT_L7VSD_SYSTEM_MEMORY)) {
-        PUT_LOG_DEBUG(urla_protomod, LOG_CAT_L7VSD_SYSTEM_MEMORY,35, "calloc: addr=%p, size=%ld",
-            urla_service_arg, (unsigned long int) sizeof(struct l7vs_urla_service_arg));
-    }
-    /*------ DEBUG LOG END ------*/
-
-    if (urla_service_arg == NULL) {
-        PUT_LOG_ERROR(urla_protomod, LOG_CAT_L7VSD_SYSTEM_MEMORY,27, "Could not allocate memory.");
-        goto create_sa_out;
-    }
-
-    /* set urla service argument size and protomod name "urla" */
-    srv_arg->len = sizeof(struct l7vs_urla_service_arg);
-    strcpy(srv_arg->protomod, urla_protomod.modname);
-
-create_sa_out:
-    /*-------- DEBUG LOG --------*/
-    if (urla_protomod.get_log_level != NULL &&
-        LOG_LV_DEBUG == urla_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
-        char urla_service_arg_str[DEBUG_STR_LEN] = {0};
-        l7vs_urla_service_arg_c_str(urla_service_arg_str, urla_service_arg);
-        PUT_LOG_DEBUG(urla_protomod, LOG_CAT_L7VSD_PROTOCOL,143,
-            "out_function: void* create_sa(struct l7vs_service_arg* srv_arg):return_value=&(%s)",
-            urla_service_arg_str);
-    }
-    /*------ DEBUG LOG END ------*/
-
-    return (void*) urla_service_arg;
-}
-
-/*!
- * Compare two service.
- * @param[in] srv_handle1 one of a unique service ID
- * @param[in] srv_handle2 one of a unique service ID
- * @retval 0  they matched perfectly.
- * @retval -1 they are different.
- */
-static int
-compare(handle_t srv_handle1, handle_t srv_handle2)
-{
-    struct l7vs_urla_service *urla_srv1, *urla_srv2;
-    int return_value = 0;
-
-    /*-------- DEBUG LOG --------*/
-    if (urla_protomod.get_log_level != NULL &&
-        LOG_LV_DEBUG == urla_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
-        PUT_LOG_DEBUG(urla_protomod, LOG_CAT_L7VSD_PROTOCOL,144,
-            "in_function: int compare(handle_t srv_handle1, handle_t srv_handle2):"
-            "srv_handle1=%u, srv_handle2=%u", srv_handle1, srv_handle2);
-    }
-    /*------ DEBUG LOG END ------*/
-
-    /* search service that has such a service ID(1) */
-    urla_srv1 = l7vs_protomod_urla_search_service(srv_handle1);
-
-    /*-------- DEBUG LOG --------*/
-    if (urla_protomod.get_log_level != NULL &&
-        LOG_LV_DEBUG == urla_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
-        char urla_str[DEBUG_STR_LEN] = {0};
-        l7vs_urla_service_c_str(urla_str, urla_srv1);
-        PUT_LOG_DEBUG(urla_protomod, LOG_CAT_L7VSD_PROTOCOL,145, "pointer assign: urla_srv1=&(%s)",
-            urla_str);
-    }
-    /*------ DEBUG LOG END ------*/
-
-    if (urla_srv1 == NULL) {
-        PUT_LOG_ERROR(urla_protomod, LOG_CAT_L7VSD_PROTOCOL,121,
-            "Could not find such service handle's urla service.");
-        return_value = -1;
-        goto compare_out;
-    }
-
-    /* search service that has such a service ID(2) */
-    urla_srv2 = l7vs_protomod_urla_search_service(srv_handle2);
-
-    /*-------- DEBUG LOG --------*/
-    if (urla_protomod.get_log_level != NULL &&
-        LOG_LV_DEBUG == urla_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
-        char urla_str[DEBUG_STR_LEN] = {0};
-        l7vs_urla_service_c_str(urla_str, urla_srv2);
-        PUT_LOG_DEBUG(urla_protomod, LOG_CAT_L7VSD_PROTOCOL,146, "pointer assign: urla_srv2=&(%s)",
-            urla_str);
-    }
-    /*------ DEBUG LOG END ------*/
-
-    if (urla_srv2 == NULL) {
-        PUT_LOG_ERROR(urla_protomod, LOG_CAT_L7VSD_PROTOCOL,122,
-            "Could not find such service handle's urla service.");
-        return_value = -1;
-        goto compare_out;
-    }
-
-    /* compare two key name */
-    if (strncmp(urla_srv1->key_name, urla_srv2->key_name, KEY_NAME_MAXSIZE) != 0) {
-        return_value = -1;
-        goto compare_out;
-    }
-
-compare_out:
-    /*-------- DEBUG LOG --------*/
-    if (urla_protomod.get_log_level != NULL &&
-        LOG_LV_DEBUG == urla_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
-        PUT_LOG_DEBUG(urla_protomod, LOG_CAT_L7VSD_PROTOCOL,147,
-            "out_function: int compare(handle_t srv_handle1, handle_t srv_handle2):return_value=%d",
-            return_value);
-    }
-    /*------ DEBUG LOG END ------*/
-
-    return return_value;
-}
-
-/*!
- * Check the client packet and determine a real server.
- * @param[in]  srv service struct include service handle, protocol module and schedule module.
- * @param[in]  conn connection data.
- * @param[in]  request packet data from client
- * @param[in]  len length of packet data
- * @param[out] dest destination (real server) list
- * @param[out] tcps TCP Splicer flag
- * @retval 0  successfully check packet data
- * @retval -1 some errors occur.
- */
-static int
-match_cldata(struct l7vs_service *srv, struct l7vs_conn *conn,
-      char *request, size_t *len, struct l7vs_dest **dest, int *tcps)
-{
-    struct l7vs_urla_service *urla_service;
-    int ret;
-    int i;
-    size_t key_name_len;
-    char *location, pattern[PATTERN_MATCH_MAXSIZE + 2];
-    int offset_length;
-    char *x_forwarded_value;
-    char *next_line = NULL;
-    char x_forwarded_for_header[X_FORWARDED_FOR_LENGTH];
-    char backup_char;
-    int return_value = 0;
-
-    std::string packet_data;
-
-    /*-------- DEBUG LOG --------*/
-    if (urla_protomod.get_log_level != NULL &&
-        LOG_LV_DEBUG == urla_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
-        char srv_str[DEBUG_STR_LEN] = {0};
-        char conn_str[DEBUG_STR_LEN] = {0};
-        char dest_str[DEBUG_STR_LEN] = {0};
-        char len_str[DEBUG_STR_LEN] = {0};
-        char tcps_str[DEBUG_STR_LEN] = {0};
-        l7vs_service_c_str(srv_str, srv);
-        l7vs_conn_c_str(conn_str, conn);
-        if (dest != NULL) {
-            l7vs_dest_c_str(dest_str, *dest);
-        }
-        else {
-            strncpy(dest_str, "NULL", DEBUG_STR_LEN);
-        }
-        if (len != NULL) {
-            snprintf(len_str, DEBUG_STR_LEN, "%lu", (unsigned long int) *len);
-        }
-        else {
-            strncpy(len_str, "NULL", DEBUG_STR_LEN);
-        }
-        if (tcps != NULL) {
-            snprintf(tcps_str, DEBUG_STR_LEN, "%d", *tcps);
-        }
-        else {
-            strncpy(tcps_str, "NULL", DEBUG_STR_LEN);
-        }
-        PUT_LOG_DEBUG(urla_protomod, LOG_CAT_L7VSD_PROTOCOL,148,
-            "in_function: int match_cldata(struct l7vs_service* srv, struct l7vs_conn* conn, "
-            "char* request, size_t* len, struct l7vs_dest** dest, int* tcps):srv=&(%s), conn=&(%s), "
-            "request=\"%s\", len=&(%s), dest=&(&(%s)), tcps=&(%s)",
-            srv_str, conn_str, request, len_str, dest_str, tcps_str);
-    }
-    /*------ DEBUG LOG END ------*/
-
-    /* check null */
-    if (srv == NULL) {
-        PUT_LOG_ERROR(urla_protomod, LOG_CAT_L7VSD_PROTOCOL,123, "Arg(srv) is NULL pointer.");
-        return_value = -1;
-        goto match_cldata_out;
-    }
-    if (srv->pm == NULL) {
-        PUT_LOG_ERROR(urla_protomod, LOG_CAT_L7VSD_PROTOCOL,124, "Arg(srv->pm) is NULL pointer.");
-        return_value = -1;
-        goto match_cldata_out;
-    }
-    if (request == NULL) {
-        PUT_LOG_ERROR(urla_protomod, LOG_CAT_L7VSD_PROTOCOL,125, "Arg(request) is NULL pointer.");
-        return_value = -1;
-        goto match_cldata_out;
-    }
-    if (len == NULL) {
-        PUT_LOG_ERROR(urla_protomod, LOG_CAT_L7VSD_PROTOCOL,126, "Arg(len) is NULL pointer.");
-        return_value = -1;
-        goto match_cldata_out;
-    }
-    if (dest == NULL) {
-        PUT_LOG_ERROR(urla_protomod, LOG_CAT_L7VSD_PROTOCOL,127, "Arg(dest) is NULL pointer.");
-        return_value = -1;
-        goto match_cldata_out;
-    }
-    if (tcps == NULL) {
-        PUT_LOG_ERROR(urla_protomod, LOG_CAT_L7VSD_PROTOCOL,128, "Arg(tcps) is NULL pointer.");
-        return_value = -1;
-        goto match_cldata_out;
-    }
-
-    /* search service that has such a service ID */
-    urla_service = l7vs_protomod_urla_search_service(srv->handle);
-
-    /*-------- DEBUG LOG --------*/
-    if (urla_protomod.get_log_level != NULL &&
-        LOG_LV_DEBUG == urla_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
-        char urla_str[DEBUG_STR_LEN] = {0};
-        l7vs_urla_service_c_str(urla_str, urla_service);
-        PUT_LOG_DEBUG(urla_protomod, LOG_CAT_L7VSD_PROTOCOL,149, "pointer assign: urla_service=&(%s)",
-            urla_str);
-    }
-    /*------ DEBUG LOG END ------*/
-
-    if (urla_service == NULL) {
-        PUT_LOG_ERROR(urla_protomod, LOG_CAT_L7VSD_PROTOCOL,129, "Could not find such service handle's urla service.");
-        return_value = -1;
-        goto match_cldata_out;
-    }
-
-    /* initialize protocol module ... clear destination list */
-    ret = srv->pm->initialize(srv, conn, request, *len, dest);
-    if (ret != 0) {
-        PUT_LOG_ERROR(urla_protomod, LOG_CAT_L7VSD_PROTOCOL,130, "Could not initialize protomod.");
-        return_value = -1;
-        goto match_cldata_out;
-    }
-
-    /* check key_name length */
-    if (urla_service->key_name[0] == '\0') {
-        PUT_LOG_ERROR(urla_protomod, LOG_CAT_L7VSD_PROTOCOL,131, "key name is NULL pointer");
-        return_value = -1;
-        goto match_cldata_out;
-    }
-
-    /* check the size of request data */
-    key_name_len = strnlen(urla_service->key_name, KEY_NAME_MAXSIZE);
-    if (*len < (15 + key_name_len) ) {
-        PUT_LOG_INFO(urla_protomod, LOG_CAT_L7VSD_PROTOCOL,6, "Request data is too short.");
-        return_value = 1;
-        goto match_cldata_out;
-    }
-    
-    /* check the HTTP method in HTTP request header */
-    uri_len = *len;
-    uri = http_check_request_method(request, &uri_len);
-    if (uri == NULL) {
-        PUT_LOG_INFO(urla_protomod, LOG_CAT_L7VSD_PROTOCOL,7, "Client message is not HTTP request.");
-        return_value = 1;
-        goto match_cldata_out;
-    }
-    
-    /* check key name */
-    packet_data = std::string(uri, uri_len);
-#ifdef USE_BOOST_XPRESSIVE
-    if ( !boost::xpressive::regex_search(packet_data, urla_service->key_name_regex) ) {
-#else
-    if ( !boost::regex_search(packet_data, urla_service->key_name_regex) ) {
-#endif
-            return_value = -1;
-            goto match_cldata_out;
-        }
-    }
-
-    /* add X-Forwarded-For field */
-    if (urla_service->forwarded_for) {
-        x_forwarded_value = http_search_header_field(request, "X-Forwarded-For");
-
-        /* already exists X-Forwarded-For field */
-        if (x_forwarded_value) {
-            next_line = http_skip_header_line(x_forwarded_value);
-            /* backtrack to look up insert point */
-            if (next_line) {
-                next_line--; // *next_line == '\n'
-                if (*(next_line - 1) == '\r') {
-                    next_line--;
-                }
-                /* append client IP address */
-                snprintf(x_forwarded_for_header, X_FORWARDED_FOR_LENGTH, ", %s", inet_ntoa(conn->caddr.sin_addr));
-            }
-        }
-
-        /* not exists X-Forwarded-For field */
-        if (!next_line) {
-            /* construct new X-Forwarded-For header item */
-            snprintf(x_forwarded_for_header, X_FORWARDED_FOR_LENGTH, "X-Forwarded-For: %s\r\n", inet_ntoa(conn->caddr.sin_addr));
-    
-            next_line = http_skip_header_line(request);
-        }
-
-        /* when insert point exist */
-        if (next_line != NULL) {
-            offset_length = (int) (next_line - request);
-    
-            /* insert X-Forwarded-For header field */
-            http_insert_field(request, offset_length, x_forwarded_for_header, *len);
-        
-            /* add header length */
-            *len += strlen(x_forwarded_for_header);
-        }
-    }
-
-    *tcps = 0;
-
-    /* finalize */
-    ret = srv->pm->finalize(srv, conn, request, *len, dest, urla_service->reschedule);
-    if (ret != 0) {
-        PUT_LOG_INFO(urla_protomod, LOG_CAT_L7VSD_PROTOCOL,12, "Could not finalize protomod. (Realserver decision failure)");
-        return_value = -1;
-        goto match_cldata_out;
-    }
-
-match_cldata_out:
-    /*-------- DEBUG LOG --------*/
-    if (urla_protomod.get_log_level != NULL &&
-        LOG_LV_DEBUG == urla_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
-        PUT_LOG_DEBUG(urla_protomod, LOG_CAT_L7VSD_PROTOCOL,150,
-            "out_function: int match_cldata(struct l7vs_service* srv, struct l7vs_conn* conn, "
-            "char* request, size_t* len, struct l7vs_dest** dest, int* tcps):return_value=%d",
-            return_value);
-    }
-    /*------ DEBUG LOG END ------*/
-
-    return return_value;
-}
-
-/*!
- * Check the real server packet and insert a Set-Cookie field.
- * @param[in] srv service struct include service handle, protocol module and schedule module.
- * @param[in] conn connection data.
- * @param[in] response packet data from real server
- * @param[in] len length of packet data. it will be lengthened.
- * @retval 0  successfully check packet data.
- * @retval -1 some errors occur.
- */
-static int
-analyze_rsdata(struct l7vs_service *srv, struct l7vs_conn *conn,
-    char *response, size_t *len)
-{
-    int return_value = 0;
-
-    /*-------- DEBUG LOG --------*/
-    if (urla_protomod.get_log_level != NULL &&
-        LOG_LV_DEBUG == urla_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
-        char srv_str[DEBUG_STR_LEN] = {0};
-        char conn_str[DEBUG_STR_LEN] = {0};
-        char len_str[DEBUG_STR_LEN] = {0};
-        l7vs_service_c_str(srv_str, srv);
-        l7vs_conn_c_str(conn_str, conn);
-        if (len != NULL) {
-            snprintf(len_str, DEBUG_STR_LEN, "%lu", (unsigned long int) *len);
-        }
-        else {
-            strncpy(len_str, "NULL", DEBUG_STR_LEN);
-        }
-        PUT_LOG_DEBUG(urla_protomod, LOG_CAT_L7VSD_PROTOCOL,151,
-            "in_function: int analyze_rsdata(struct l7vs_service* srv, struct l7vs_conn* conn, "
-            "char* response, size_t* len):srv=&(%s), conn=&(%s), response=\"%s\", len=&(%s)",
-            srv_str, conn_str, response, len_str);
-    }
-    /*------ DEBUG LOG END ------*/
-
-    /* check null */
-    if (srv == NULL) {
-        PUT_LOG_ERROR(urla_protomod, LOG_CAT_L7VSD_PROTOCOL,133, "Arg(srv) is NULL pointer.");
-        return_value = -1;
-        goto analyze_rsdata_out;
-    }
-    if (conn == NULL) {
-        PUT_LOG_ERROR(urla_protomod, LOG_CAT_L7VSD_PROTOCOL,134, "Arg(conn) is NULL pointer.");
-        return_value = -1;
-        goto analyze_rsdata_out;
-    }
-    if (conn->dest == NULL) {
-        PUT_LOG_ERROR(urla_protomod, LOG_CAT_L7VSD_PROTOCOL,135, "Arg(conn->dest) is NULL pointer.");
-        return_value = -1;
-        goto analyze_rsdata_out;
-    }
-    if (response == NULL) {
-        PUT_LOG_ERROR(urla_protomod, LOG_CAT_L7VSD_PROTOCOL,136, "Arg(response) is NULL pointer.");
-        return_value = -1;
-        goto analyze_rsdata_out;
-    }
-    if (len == NULL) {
-        PUT_LOG_ERROR(urla_protomod, LOG_CAT_L7VSD_PROTOCOL,137, "Arg(len) is NULL pointer.");
-        return_value = -1;
-        goto analyze_rsdata_out;
-    }
-
-    /* sorry flag check */
-    if (conn->sorry_conn_flag == 1) {
-        /*-------- DEBUG LOG --------*/
-        if (urla_protomod.get_log_level != NULL &&
-            LOG_LV_DEBUG == urla_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
-            PUT_LOG_DEBUG(urla_protomod, LOG_CAT_L7VSD_PROTOCOL,152, "Response from sorry server.");
-        }
-        /*------ DEBUG LOG END ------*/
-        goto analyze_rsdata_out;
-    }
-
-    /* search Location header field */
-    location = http_search_header_field(request, "Location");
-    if (location != NULL) {
-    }
-
-analyze_rsdata_out:
-    /*-------- DEBUG LOG --------*/
-    if (urla_protomod.get_log_level != NULL &&
-        LOG_LV_DEBUG == urla_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
-        PUT_LOG_DEBUG(urla_protomod, LOG_CAT_L7VSD_PROTOCOL,153,
-            "out_function: int analyze_rsdata(struct l7vs_service* srv, struct l7vs_conn* conn, "
-            "char* response, size_t* len):return_value=%d", return_value);
-    }
-    /*------ DEBUG LOG END ------*/
-
-    return return_value;
-}
-
-/*!
- * Destroy urla service
- * @param[in] srv_handle a unique service ID
- * @retval 0  successfully check packet data.
- * @retval -1 some errors occur.
- */
-static int
-destroy(handle_t srv_handle)
-{
-    /* urla service list counter */
-    int service_number = 0;
-    int free_flag = 0;
-    int return_value = 0;
-
-    /*-------- DEBUG LOG --------*/
-    if (urla_protomod.get_log_level != NULL &&
-        LOG_LV_DEBUG == urla_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
-        PUT_LOG_DEBUG(urla_protomod, LOG_CAT_L7VSD_PROTOCOL,154,
-            "in_function: int destroy(handle_t srv_handle):srv_handle=%u",
-            srv_handle);
-    }
-    /*------ DEBUG LOG END ------*/
-
-    /* check all urla service list */
-    for (service_number = 0; service_number < URLA_SERVICE_NUMBER; ++service_number) {
-        /* found urla service that has srv_handle */
-        if (urla_service_list[service_number] != NULL && 
-            urla_service_list[service_number]->service_handle == srv_handle) {
-
-            /*-------- DEBUG LOG --------*/
-            if (urla_protomod.get_log_level != NULL &&
-                LOG_LV_DEBUG == urla_protomod.get_log_level(LOG_CAT_L7VSD_SYSTEM_MEMORY)) {
-                PUT_LOG_DEBUG(urla_protomod, LOG_CAT_L7VSD_SYSTEM_MEMORY,36, "free: %p",
-                    urla_service_list[service_number]);
-            }
-            /*------ DEBUG LOG END ------*/
-
-            /* free and NULL */
-            free(urla_service_list[service_number]);
-            urla_service_list[service_number] = NULL;
-
-            free_flag = 1;
-            break;
-        }
-    }
-    
-    /* urla service was not found */
-    if (free_flag == 0) {
-        PUT_LOG_ERROR(urla_protomod, LOG_CAT_L7VSD_PROTOCOL,138, "Could not find such service handle's urla service.");
-        return_value = -1;
-        goto destroy_out;
-    }
-
-destroy_out:
-    /*-------- DEBUG LOG --------*/
-    if (urla_protomod.get_log_level != NULL &&
-        LOG_LV_DEBUG == urla_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
-        PUT_LOG_DEBUG(urla_protomod, LOG_CAT_L7VSD_PROTOCOL,155,
-            "out_function: int destroy(handle_t srv_handle):return_value=%d",
-            srv_handle);
-    }
-    /*------ DEBUG LOG END ------*/
-
-    return return_value;
-}
-
-/*!
- * Destroy urla service argument
- * @param[in] urla_arg urla service argument
- * @return void
- */
-static void
-destroy_sa(void **urla_arg)
-{
-    /*-------- DEBUG LOG --------*/
-    if (urla_protomod.get_log_level != NULL &&
-        LOG_LV_DEBUG == urla_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
-        char urla_arg_str[DEBUG_STR_LEN] = {0};
-        if (urla_arg != NULL) {
-            l7vs_urla_service_arg_c_str(urla_arg_str, (struct l7vs_urla_service_arg*) *urla_arg);
-        }
-        else {
-            strncpy(urla_arg_str, "NULL", DEBUG_STR_LEN);
-        }
-        PUT_LOG_DEBUG(urla_protomod, LOG_CAT_L7VSD_PROTOCOL,156,
-            "in_function: void destroy_sa(void** urla_arg):urla_arg=&(&(%s))",
-            urla_arg_str);
-    }
-    /*------ DEBUG LOG END ------*/
-
-    /* check null */
-    if (urla_arg == NULL) {
-        PUT_LOG_ERROR(urla_protomod, LOG_CAT_L7VSD_PROTOCOL,139, "Arg(urla_arg) is NULL pointer.");
-    }
-    else if (*urla_arg == NULL) {
-        PUT_LOG_ERROR(urla_protomod, LOG_CAT_L7VSD_PROTOCOL,140, "Arg(*urla_arg) is NULL pointer.");
-    }
-    else {
-        /*-------- DEBUG LOG --------*/
-        if (urla_protomod.get_log_level != NULL &&
-            LOG_LV_DEBUG == urla_protomod.get_log_level(LOG_CAT_L7VSD_SYSTEM_MEMORY)) {
-            PUT_LOG_DEBUG(urla_protomod, LOG_CAT_L7VSD_SYSTEM_MEMORY,37, "free: %p",
-                *urla_arg);
-        }
-        /*------ DEBUG LOG END ------*/
-
-        /* free and NULL */
-        free((struct l7vs_urla_service_arg*) *urla_arg);
-        *urla_arg = NULL;
-    }
-
-    /*-------- DEBUG LOG --------*/
-    if (urla_protomod.get_log_level != NULL &&
-        LOG_LV_DEBUG == urla_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
-        PUT_LOG_DEBUG(urla_protomod, LOG_CAT_L7VSD_PROTOCOL,157,
-            "out_function: void destroy_sa(void** urla_arg)");
-    }
-    /*------ DEBUG LOG END ------*/
-}
-
-/*!
- * Create strings for service list of l7vsadm
- * @param  srv_arg service argument struct
- * @param  srv_handle a unique service ID
- * @retval 0  successfully create strings
- * @retval -1 some errors occur.
- */
-static int
-service_arg(struct l7vs_service_arg_multi *srv_arg_mt, handle_t srv_handle)
-{
-    struct l7vs_urla_service *urla_service;
-    struct l7vs_urla_service_arg c_sarg;
-    char urla_argument[SERVICE_ARG_MAXSIZE];
-    int return_value = 0;
-
-    /*-------- DEBUG LOG --------*/
-    if (urla_protomod.get_log_level != NULL &&
-        LOG_LV_DEBUG == urla_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
-        char srv_arg_mt_str[DEBUG_STR_LEN] = {0};
-        l7vs_service_arg_multi_c_str(srv_arg_mt_str, srv_arg_mt);
-        PUT_LOG_DEBUG(urla_protomod, LOG_CAT_L7VSD_PROTOCOL,158,
-            "in_function: int service_arg(struct l7vs_service_arg_multi* srv_arg_mt, "
-            "handle_t srv_handle):srv_arg_mt=&(%s), srv_handle=%u",
-            srv_arg_mt_str, srv_handle);
-    }
-    /*------ DEBUG LOG END ------*/
-
-    /* check null */
-    if (srv_arg_mt == NULL) {
-        PUT_LOG_ERROR(urla_protomod, LOG_CAT_L7VSD_PROTOCOL,141, "Arg(srv_arg_mt) is NULL pointer.");
-        return_value = -1;
-        goto service_arg_out;
-    }
-
-    /* search service that has such a service ID */
-    urla_service = l7vs_protomod_urla_search_service(srv_handle);
-
-    /*-------- DEBUG LOG --------*/
-    if (urla_protomod.get_log_level != NULL &&
-        LOG_LV_DEBUG == urla_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
-        char urla_str[DEBUG_STR_LEN] = {0};
-        l7vs_urla_service_c_str(urla_str, urla_service);
-        PUT_LOG_DEBUG(urla_protomod, LOG_CAT_L7VSD_PROTOCOL,159, "pointer assign: urla_service=&(%s)",
-            urla_str);
-    }
-    /*------ DEBUG LOG END ------*/
-
-    if (urla_service == NULL) {
-        PUT_LOG_ERROR(urla_protomod, LOG_CAT_L7VSD_PROTOCOL,142, "Could not find such service handle's urla service.");
-        return_value = -1;
-        goto service_arg_out;
-    }
-
-    /* initialize argument strings */
-    memset(urla_argument, 0, SERVICE_ARG_MAXSIZE);
-
-    /* set urla args to service argument struct */
-    srv_arg_mt->srv_arg.reschedule = urla_service->reschedule;
-
-    /* create long argument (l7vsadm option -L/-l) */
-    if ( strnlen(urla_service->pattern_match, PATTERN_MATCH_MAXSIZE) ) {
-        snprintf(urla_argument, SERVICE_ARG_MAXSIZE, "--pattern-match %s", urla_service->pattern_match);
-    }
-    if ( strnlen(urla_service->uri_pattern_match, REGEX_PATTERN_MATCH_MAXSIZE) ) {
-        snprintf(urla_argument + strlen(urla_argument), SERVICE_ARG_MAXSIZE - strlen(urla_argument),
-            " --uri-pattern-match %s", urla_service->uri_pattern_match);
-    }
-    if ( strnlen(urla_service->host_pattern_match, REGEX_PATTERN_MATCH_MAXSIZE) ) {
-        snprintf(urla_argument + strlen(urla_argument), SERVICE_ARG_MAXSIZE - strlen(urla_argument),
-            " --host-pattern-match %s", urla_service->host_pattern_match);
-    }
-    strncpy(srv_arg_mt->srv_arg.protomod_key_string, urla_argument, 256);
-
-    /* create verbose argument (l7vsadm option -V/-v) */
-    if (urla_service->forwarded_for) {
-        snprintf(urla_argument + strlen(urla_argument), SERVICE_ARG_MAXSIZE - strlen(urla_argument),
-            " --forwarded-for");
-    }
-    strncpy(srv_arg_mt->srv_arg.protomod_opt_string, urla_argument, 512);
-
-    strncpy(c_sarg.pattern_match, urla_service->pattern_match, PATTERN_MATCH_MAXSIZE);
-    strncpy(c_sarg.uri_pattern_match, urla_service->uri_pattern_match, REGEX_PATTERN_MATCH_MAXSIZE);
-    strncpy(c_sarg.host_pattern_match, urla_service->host_pattern_match, REGEX_PATTERN_MATCH_MAXSIZE);
-    c_sarg.reschedule = urla_service->reschedule;
-
-    memcpy(srv_arg_mt->protomod_arg, &c_sarg, sizeof(struct l7vs_urla_service_arg));
-
-    /*-------- DEBUG LOG --------*/
-    if (urla_protomod.get_log_level != NULL &&
-        LOG_LV_DEBUG == urla_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
-        char urla_arg_str[DEBUG_STR_LEN] = {0};
-        l7vs_urla_service_arg_c_str(urla_arg_str, &c_sarg);
-        PUT_LOG_DEBUG(urla_protomod, LOG_CAT_L7VSD_PROTOCOL,160,
-            "pointer assign: srv_arg_mt->protomod_arg=&(%s)", urla_arg_str);
-    }
-    /*------ DEBUG LOG END ------*/
-
-service_arg_out:
-    /*-------- DEBUG LOG --------*/
-    if (urla_protomod.get_log_level != NULL &&
-        LOG_LV_DEBUG == urla_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
-        PUT_LOG_DEBUG(urla_protomod, LOG_CAT_L7VSD_PROTOCOL,161,
-            "out_function: int service_arg(struct l7vs_service_arg_multi* srv_arg_mt, "
-            "handle_t srv_handle):return_value=%d", return_value);
-    }
-    /*------ DEBUG LOG END ------*/
-
-    return return_value;
-}
-
-/*!
- * Parse l7vsadm options to urla argument
- * @param[out] urla_arg urla service argument struct
- * @param[int] argc number of l7vsadm argument
- * @param[int] argv l7vsadm argument list
- * @retval 0  successfully parse argument
- * @retval -1 some errors occur.
- */
-static int
-parse(void *urla_arg, int argc, char *argv[])
-{
-    struct l7vs_urla_service_arg *urla_service_arg;
-    static struct option opt[] = {
-        {"pattern-match",      required_argument, NULL, 'P'},
-        {"uri-pattern-match",  required_argument, NULL, 'U'},
-        {"host-pattern-match", required_argument, NULL, 'H'},
-        {"forwarded-for",      no_argument,       NULL, 'F'},
-        {NULL,                 0,                 NULL, 0  }
-    };
-    int c;
-    int key_name_flag = 0;
-    int forwarded_for_flag = 0;
-    int return_value = 0;
-#ifndef USE_BOOST_XPRESSIVE
-    boost::regex regex;
-#endif
-
-    /*-------- DEBUG LOG --------*/
-    if (urla_protomod.get_log_level != NULL &&
-        LOG_LV_DEBUG == urla_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
-        int i;
-        char argv_str[DEBUG_STR_LEN] = {0};
-        char urla_arg_str[DEBUG_STR_LEN] = {0};
-        l7vs_urla_service_arg_c_str(urla_arg_str, (struct l7vs_urla_service_arg*) urla_arg);
-        argv_str[0] = '\0';
-        if (argv == NULL)
-            snprintf(argv_str, DEBUG_STR_LEN, "NULL");
-        else {
-            for (i = 0; i < argc; i++) {
-                snprintf(argv_str, DEBUG_STR_LEN, "%sargv[%d]=\"%s\", ", argv_str, i, argv[i]);
-            }
-            i = strnlen(argv_str, DEBUG_STR_LEN);
-            if (i > 1)
-                argv_str[i - 2] = '\0';
-        }
-        PUT_LOG_DEBUG(urla_protomod, LOG_CAT_L7VSD_PROTOCOL,162,
-            "in_function: int parse(void* urla_arg, int argc, char* argv[]):urla_arg=&(%s), "
-            "argc=%d, %s", urla_arg_str, argc, argv_str);
-    }
-    /*------ DEBUG LOG END ------*/
-
-    /* check null */
-    if (urla_arg == NULL) {
-        PUT_LOG_ERROR(urla_protomod, LOG_CAT_L7VSD_PROTOCOL,143, "Arg(urla_arg) is NULL pointer.");
-        return_value = -1;
-        goto parse_out;
-    }
-    if (argv == NULL) {
-        PUT_LOG_ERROR(urla_protomod, LOG_CAT_L7VSD_PROTOCOL,144, "Arg(argv) is NULL pointer.");
-        return_value = -1;
-        goto parse_out;
-    }
-
-    urla_service_arg = (struct l7vs_urla_service_arg *) urla_arg;
-    optind = 0;
-
-    /* check all argument */
-    while ((c = getopt_long(argc, argv, "K:U:H:F", opt, NULL)) != -1) {
-        switch (c) {
-        /* --key-name / -K */
-        case 'K':
-            /* check maximum length */
-            if (strnlen(optarg, KEY_NAME_MAXSIZE) >= KEY_NAME_MAXSIZE) {
-                PUT_LOG_ERROR(urla_protomod, LOG_CAT_L7VSD_PROTOCOL,145,
-                    "-K/--key-name option value '%s' too long", optarg);
-                return_value = -1;
-                goto parse_out;
-            }
-            /* check minimum length */
-            if (strnlen(optarg, KEY_NAME_MAXSIZE) <= 0 ) {
-                PUT_LOG_ERROR(urla_protomod, LOG_CAT_L7VSD_PROTOCOL,146,
-                    "-K/--key-name option value '%s' invalid", optarg);
-                return_value = -1;
-                goto parse_out;
-            }
-            strncpy(urla_service_arg->key-name, optarg, KEY_NAME_MAXSIZE);
-            key_name_flag++;
-            break;
-
-        /* --forwarded-for / -F */
-        case 'F':
-            /* x-forwarded-for on */
-            urla_service_arg->forwarded_for = 1;
-            forwarded_for_flag++;
-            break;
-
-        /* else error */
-        default:
-            PUT_LOG_ERROR(urla_protomod, LOG_CAT_L7VSD_PROTOCOL,147, "Option error.");
-            return_value = -1;
-            goto parse_out;
-        }
-    }
-
-    /* set default no forwarded_for */
-    if (forwarded_for_flag == 0) {
-        urla_service_arg->forwarded_for = 0;
-    }
-
-    /* set default no reschedule */
-    urla_service_arg->reschedule = 0;
-
-    /* no key-name value */
-    if (key_name_flag == 0) {
-        PUT_LOG_ERROR(urla_protomod, LOG_CAT_L7VSD_PROTOCOL,148,
-            "You have to '--key-name' option.");
-        return_value = -1;
-        goto parse_out;
-    }
-
-    /* same option */
-    if (key_name_flag > 1) {
-        PUT_LOG_ERROR(urla_protomod, LOG_CAT_L7VSD_PROTOCOL,149,
-            "Cannot set multiple option '--key-name/-K'.");
-        return_value = -1;
-        goto parse_out;
-    }
-
-    /* compile regex */
-    if (key_name_flag) {
-        try {
-#ifdef USE_BOOST_XPRESSIVE
-            boost::xpressive::sregex::compile(urla_service_arg->key_name);
-#else
-            regex.assign(urla_service_arg->key_name);
-#endif
-        }
-        catch (...) {
-            PUT_LOG_ERROR(urla_protomod, LOG_CAT_L7VSD_PROTOCOL,292,
-                "Regex pattern error of option '--key-name/-K'.");
-            return_value = -1;
-            goto parse_out;
-        }
-    }
-
-parse_out:
-    /*-------- DEBUG LOG --------*/
-    if (urla_protomod.get_log_level != NULL &&
-        LOG_LV_DEBUG == urla_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
-        PUT_LOG_DEBUG(urla_protomod, LOG_CAT_L7VSD_PROTOCOL,163,
-            "out_function: int parse(void* urla_arg, int argc, char* argv[]):return_value=%d",
-            return_value);
-    }
-    /*------ DEBUG LOG END ------*/
-
-    return return_value;
-}
-
-/*!
- * Search urla service from urla service list using service handle
- * @param[in]  service_handle a unique service ID
- * @return urla service struct when service was found. NULL when service was not found.
- */
-static struct l7vs_urla_service *
-l7vs_protomod_urla_search_service(handle_t service_handle)
-{
-    /* urla service list counter */
-    int service_number = 0;
-    struct l7vs_urla_service* return_value = NULL;
-
-    /*-------- DEBUG LOG --------*/
-    if (urla_protomod.get_log_level != NULL &&
-        LOG_LV_DEBUG == urla_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
-        PUT_LOG_DEBUG(urla_protomod, LOG_CAT_L7VSD_PROTOCOL,164,
-            "in_function: struct l7vs_urla_service* l7vs_protomod_urla_search_service(handle_t service_handle):"
-            "service_handle=%d", service_handle);
-    }
-    /*------ DEBUG LOG END ------*/
-
-    /* check all urla service list */
-    for (service_number = 0; service_number < URLA_SERVICE_NUMBER; ++service_number) {
-        /* found the service has same service handle */
-        if (urla_service_list[service_number] != NULL && 
-            urla_service_list[service_number]->service_handle == service_handle) {
-            return_value = urla_service_list[service_number];
-            break;
-        }
-    }
-    
-    /*-------- DEBUG LOG --------*/
-    if (urla_protomod.get_log_level != NULL &&
-        LOG_LV_DEBUG == urla_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
-        char ssl_str[DEBUG_STR_LEN] = {0};
-        l7vs_urla_service_c_str(ssl_str, return_value);
-        PUT_LOG_DEBUG(urla_protomod, LOG_CAT_L7VSD_PROTOCOL,165,
-            "out_function: struct l7vs_urla_service* l7vs_protomod_urla_search_service(handle_t service_handle):"
-            "return_value=&(%s)", ssl_str);
-    }
-    /*------ DEBUG LOG END ------*/
-
-    return return_value;
-}
-
-/*!
- * Create urla service.
- * @param  void
- * @return urla service struct when create a service. NULL when cannot create service.
- */
-static struct l7vs_urla_service *
-l7vs_protomod_urla_create_service()
-{
-    struct l7vs_urla_service* return_value = NULL;
-    int service_number = 0;
-
-    /*-------- DEBUG LOG --------*/
-    if (urla_protomod.get_log_level != NULL &&
-        LOG_LV_DEBUG == urla_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
-        PUT_LOG_DEBUG(urla_protomod, LOG_CAT_L7VSD_PROTOCOL,166,
-            "in_function: struct l7vs_urla_service* l7vs_protomod_urla_create_service()");
-    }
-    /*------ DEBUG LOG END ------*/
-
-    /* check all urla service list */
-    for (service_number = 0; service_number < URLA_SERVICE_NUMBER - 1; ++service_number) {
-        /* if pointer that does not point NULL exists ... */
-        if (urla_service_list[service_number] == NULL) {
-            /* create a service at empty pointer */
-            urla_service_list[service_number] = (struct l7vs_urla_service *) calloc(1, sizeof(struct l7vs_urla_service));
-
-            /*-------- DEBUG LOG --------*/
-            if (urla_protomod.get_log_level != NULL &&
-                LOG_LV_DEBUG == urla_protomod.get_log_level(LOG_CAT_L7VSD_SYSTEM_MEMORY)) {
-                PUT_LOG_DEBUG(urla_protomod, LOG_CAT_L7VSD_SYSTEM_MEMORY,38, "calloc: addr=%p, size=%ld",
-                    urla_service_list[service_number], (unsigned long int) sizeof(struct l7vs_urla_service));
-            }
-            /*------ DEBUG LOG END ------*/
-
-            if (urla_service_list[service_number] == NULL) {
-                PUT_LOG_ERROR(urla_protomod, LOG_CAT_L7VSD_SYSTEM_MEMORY,28, "Could not allocate memory.");
-                goto create_service_out;
-            }
-            return_value = urla_service_list[service_number];
-            goto create_service_out;
-        }
-    }
-    
-    /* all service list is full */
-    PUT_LOG_ERROR(urla_protomod, LOG_CAT_L7VSD_PROTOCOL,150, "urla service list is full.");
-
-create_service_out:
-    /*-------- DEBUG LOG --------*/
-    if (urla_protomod.get_log_level != NULL &&
-        LOG_LV_DEBUG == urla_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
-        char ssl_str[DEBUG_STR_LEN] = {0};
-        l7vs_urla_service_c_str(ssl_str, return_value);
-        PUT_LOG_DEBUG(urla_protomod, LOG_CAT_L7VSD_PROTOCOL,167,
-            "out_function: struct l7vs_urla_service* l7vs_protomod_urla_create_service():"
-            "return_value=&(%s)", ssl_str);
-    }
-    /*------ DEBUG LOG END ------*/
-
-    return return_value;
-}
-
-/*!
- * Create temporary urla service.
- * @param  void
- * @return urla service struct when create a service. NULL when cannot create service.
- */
-static struct l7vs_urla_service *
-l7vs_protomod_urla_create_temp_service()
-{
-    struct l7vs_urla_service* return_value = NULL;
-
-    /*-------- DEBUG LOG --------*/
-    if (urla_protomod.get_log_level != NULL &&
-        LOG_LV_DEBUG == urla_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
-        PUT_LOG_DEBUG(urla_protomod, LOG_CAT_L7VSD_PROTOCOL,168,
-            "in_function: struct l7vs_urla_service* l7vs_protomod_urla_create_temp_service()");
-    }
-    /*------ DEBUG LOG END ------*/
-
-    /* if pointer that does not point NULL exists ... */
-    if (urla_service_list[URLA_SERVICE_NUMBER - 1] != NULL) {
-        PUT_LOG_ERROR(urla_protomod, LOG_CAT_L7VSD_PROTOCOL,151, "Temporary urla service is being used by other process.");
-        goto create_temp_service_out;
-    }
-
-    /* create temp service */
-    urla_service_list[URLA_SERVICE_NUMBER - 1] = (struct l7vs_urla_service *) calloc(1, sizeof(struct l7vs_urla_service));
-
-    /*-------- DEBUG LOG --------*/
-    if (urla_protomod.get_log_level != NULL &&
-        LOG_LV_DEBUG == urla_protomod.get_log_level(LOG_CAT_L7VSD_SYSTEM_MEMORY)) {
-        PUT_LOG_DEBUG(urla_protomod, LOG_CAT_L7VSD_SYSTEM_MEMORY,39, "calloc: addr=%p, size=%ld",
-            urla_service_list[URLA_SERVICE_NUMBER - 1], (unsigned long int) sizeof(struct l7vs_urla_service));
-    }
-    /*------ DEBUG LOG END ------*/
-
-    if (urla_service_list[URLA_SERVICE_NUMBER - 1] == NULL) {
-        PUT_LOG_ERROR(urla_protomod, LOG_CAT_L7VSD_SYSTEM_MEMORY,29, "Could not allocate memory");
-        goto create_temp_service_out;
-    }
-
-    return_value = urla_service_list[URLA_SERVICE_NUMBER - 1];
-
-create_temp_service_out:
-    /*-------- DEBUG LOG --------*/
-    if (urla_protomod.get_log_level != NULL &&
-        LOG_LV_DEBUG == urla_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
-        char ssl_str[DEBUG_STR_LEN] = {0};
-        l7vs_urla_service_c_str(ssl_str, return_value);
-        PUT_LOG_DEBUG(urla_protomod, LOG_CAT_L7VSD_PROTOCOL,169,
-            "out_function: struct l7vs_urla_service* l7vs_protomod_urla_create_service():"
-            "return_value=&(%s)", ssl_str);
-    }
-    /*------ DEBUG LOG END ------*/
-
-    return return_value;
-}
-
-/*!
- * Serialize struct l7vs_urla_service for debug log.
- * @param[out] buf   serialized string
- * @param[in]  urla l7vs_urla_service struct
- */
-static void l7vs_urla_service_c_str(char* buf, struct l7vs_urla_service* urla) {
-    if (urla == NULL) {
-        snprintf(buf, DEBUG_STR_LEN, "NULL");
-    }
-    else {
-        snprintf(buf, DEBUG_STR_LEN, "service_handle=%d, pattern_match=\"%s\", uri_pattern_match=\"%s\", host_pattern_match=\"%s\", "
-            "forwarded_for=%d, reschedule=%d", urla->service_handle, urla->pattern_match, urla->uri_pattern_match, urla->host_pattern_match,
-            urla->forwarded_for, urla->reschedule);
-    }
-}
-
-/*!
- * Serialize struct l7vs_urla_service_arg for debug log.
- * @param[out] buf       serialized string
- * @param[in]  urla_arg l7vs_urla_service_arg struct
- */
-void l7vs_urla_service_arg_c_str(char* buf, struct l7vs_urla_service_arg* urla_arg) {
-    if (urla_arg == NULL) {
-        snprintf(buf, DEBUG_STR_LEN, "NULL");
-    }
-    else {
-        snprintf(buf, DEBUG_STR_LEN, "pattern_match=\"%s\", uri_pattern_match=\"%s\", host_pattern_match=\"%s\", forwarded_for=%d, reschedule=%d",
-            urla_arg->pattern_match, urla_arg->uri_pattern_match, urla_arg->host_pattern_match, urla_arg->forwarded_for, urla_arg->reschedule);
-    }
-}