ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/src/conf_service.c
Revision: 7248
Committed: Thu Feb 4 17:21:58 2016 UTC (9 years, 6 months ago) by michael
Content type: text/x-csrc
File size: 1885 byte(s)
Log Message:
- Move service {} block configuration management into its own module

File Contents

# User Rev Content
1 michael 7248 /*
2     * ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd)
3     *
4     * Copyright (c) 2012-2016 ircd-hybrid development team
5     *
6     * This program is free software; you can redistribute it and/or modify
7     * it under the terms of the GNU General Public License as published by
8     * the Free Software Foundation; either version 2 of the License, or
9     * (at your option) any later version.
10     *
11     * This program is distributed in the hope that it will be useful,
12     * but WITHOUT ANY WARRANTY; without even the implied warranty of
13     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14     * GNU General Public License for more details.
15     *
16     * You should have received a copy of the GNU General Public License
17     * along with this program; if not, write to the Free Software
18     * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
19     * USA
20     */
21    
22     /*! \file conf_service.c
23     * \brief Implements service {} block configuration management.
24     * \version $Id: conf_service.c 7240 2016-02-03 16:40:25Z michael $
25     */
26    
27     #include "stdinc.h"
28     #include "list.h"
29     #include "irc_string.h"
30     #include "memory.h"
31     #include "conf_service.h"
32    
33    
34     static dlink_list service_list;
35    
36    
37     const dlink_list *
38     service_get_list(void)
39     {
40     return &service_list;
41     }
42    
43     void
44     service_clear(void)
45     {
46     while (service_list.head)
47     {
48     struct ServiceItem *service = service_list.head->data;
49    
50     dlinkDelete(&service->node, &service_list);
51     xfree(service);
52     }
53     }
54    
55     struct ServiceItem *
56     service_make(void)
57     {
58     struct ServiceItem *service = xcalloc(sizeof(*service));
59     dlinkAdd(service, &service->node, &service_list);
60    
61     return service;
62     }
63    
64     const struct ServiceItem *
65     service_find(const char *name)
66     {
67     dlink_node *node;
68    
69     DLINK_FOREACH(node, service_list.head)
70     {
71     const struct ServiceItem *service = node->data;
72    
73     if (!irccmp(service->name, name))
74     return service;
75     }
76    
77     return NULL;
78     }