Apache HTTPD
md_event.c
Go to the documentation of this file.
1/* Licensed to the Apache Software Foundation (ASF) under one or more
2* contributor license agreements. See the NOTICE file distributed with
3* this work for additional information regarding copyright ownership.
4* The ASF licenses this file to You under the Apache License, Version 2.0
5* (the "License"); you may not use this file except in compliance with
6* the License. You may obtain a copy of the License at
7*
8* http://www.apache.org/licenses/LICENSE-2.0
9*
10* Unless required by applicable law or agreed to in writing, software
11* distributed under the License is distributed on an "AS IS" BASIS,
12* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13* See the License for the specific language governing permissions and
14* limitations under the License.
15*/
16
17#include <assert.h>
18#include <apr_optional.h>
19#include <apr_strings.h>
20
21#include "md.h"
22#include "md_event.h"
23
24
30
31static struct {
35
37{
38 (void)dummy;
39 memset(&EVNT, 0, sizeof(EVNT));
40 return APR_SUCCESS;
41}
42
49
51{
52 md_subscription *sub;
53
54 sub = apr_pcalloc(EVNT.p, sizeof(*sub));
55 sub->cb = cb;
56 sub->baton = baton;
57 sub->next = EVNT.subs;
58 EVNT.subs = sub;
59}
60
62 const char *mdomain,
63 struct md_job_t *job,
64 struct md_result_t *result,
66{
67 md_subscription *sub = EVNT.subs;
68 apr_status_t rv;
69
70 while (sub) {
71 rv = sub->cb(event, mdomain, sub->baton, job, result, p);
72 if (APR_SUCCESS != rv) return rv;
73 sub = sub->next;
74 }
75 return APR_SUCCESS;
76}
77
78void md_event_holler(const char *event,
79 const char *mdomain,
80 struct md_job_t *job,
81 struct md_result_t *result,
83{
84 md_subscription *sub = EVNT.subs;
85 while (sub) {
86 sub->cb(event, mdomain, sub->baton, job, result, p);
87 sub = sub->next;
88 }
89}
APR-UTIL registration of functions exported by modules.
APR Strings library.
ap_vhost_iterate_conn_cb void * baton
Definition http_vhost.h:87
void * dummy
Definition http_vhost.h:62
apr_size_t size
#define APR_SUCCESS
Definition apr_errno.h:225
int apr_status_t
Definition apr_errno.h:44
apr_array_header_t ** result
#define apr_pcalloc(p, size)
Definition apr_pools.h:465
void md_event_subscribe(md_event_cb *cb, void *baton)
Definition md_event.c:50
apr_pool_t * p
Definition md_event.c:32
void md_event_init(apr_pool_t *p)
Definition md_event.c:43
static apr_status_t cleanup_setup(void *dummy)
Definition md_event.c:36
static struct @25 EVNT
md_subscription * subs
Definition md_event.c:33
apr_status_t md_event_raise(const char *event, const char *mdomain, struct md_job_t *job, struct md_result_t *result, apr_pool_t *p)
Definition md_event.c:61
void md_event_holler(const char *event, const char *mdomain, struct md_job_t *job, struct md_result_t *result, apr_pool_t *p)
Definition md_event.c:78
apr_status_t md_event_cb(const char *event, const char *mdomain, void *baton, struct md_job_t *job, struct md_result_t *result, apr_pool_t *p)
Definition md_event.h:23
return NULL
Definition mod_so.c:359
struct md_subscription * next
Definition md_event.c:26
md_event_cb * cb
Definition md_event.c:27