OSDN Git Service

Updated l7directord to newest version
[ultramonkey-l7/ultramonkey-l7-v2.git] / include / l7vs_iomuxlist.h
1 /*!
2  * @file l7vs_iomuxlist.c
3  * @brief This file manages sets of iomux. 
4  * @brief It becomes the foundation of the event call of FD using sets of iomux 
5  * @bried and epoll. 
6  * L7VSD: Linux Virtual Server for Layer7 Load Balancing
7  * Copyright (C) 2005  NTT COMWARE Corporation.
8  *
9  * This program is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Lesser General Public
11  * License as published by the Free Software Foundation; either
12  * version 2.1 of the License, or (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17  * Lesser General Public License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public
20  * License along with this library; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
22  * 02110-1301 USA
23  *
24  **********************************************************************/
25 #ifndef L7VS_IOMUXLIST_H
26 #define L7VS_IOMUXLIST_H
27
28 #define L7VS_IOMUX_LIST_UNCHANGED       0
29 #define L7VS_IOMUX_LIST_REMOVED_MYSELF  1
30 #define L7VS_IOMUX_LIST_REMOVED_OTHER   2
31
32 #include <stdint.h>
33 #include "l7vs_iom.h"
34 #include "logger_wrapper.h"
35
36 extern int                      l7vs_iomux_init();
37 extern void                     l7vs_iomux_fini();
38 extern struct l7vs_iomux*       l7vs_iomux_get_from_avail_list();
39 extern void                     l7vs_iomux_put_to_avail_list(struct l7vs_iomux*);
40 extern void                     l7vs_iomux_add( struct l7vs_iomux*, enum iomaction );
41 extern void                     l7vs_iomux_remove( struct l7vs_iomux* );
42 extern void                     l7vs_iomux_mod( struct l7vs_iomux*, enum iomaction );
43 extern void                     l7vs_iomux_removeall();
44 extern int                      l7vs_iomux_poll( struct timeval*, int blocking );
45
46 /*!
47  * serialize struct l7vs_iomux
48  *
49  * @param[out]  ret     serialized string
50  * @param[in]   conn    source l7vs_iomux
51  * @return      void
52  */
53 inline  void    l7vs_iomux_c_str(char* ret, const struct l7vs_iomux* iom)
54 {
55         if (!ret) {
56                 return;
57         }
58
59         if (!iom) {
60                 snprintf(ret, DEBUG_STR_LEN, "(nil)");
61                 return;
62         }
63
64         snprintf(ret, DEBUG_STR_LEN, 
65                 "l7vs_iomux={fd = %d: "
66                 "callback = %p: "
67                 "status = %d: "
68                 "data = %p}"
69                 , iom->fd
70                 , iom->callback
71                 , iom->status
72                 , iom->data);
73 }
74
75 #endif  //L7VS_IOMUXLIST_H