-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmod_magick.h
98 lines (87 loc) · 3.27 KB
/
mod_magick.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
/* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* mod_magick.h
*
* Created on: 03 Aug 2020
* Author: minfrin
*/
#ifndef MOD_MAGICK_H_
#define MOD_MAGICK_H_
#include <apr_buckets.h>
#include <wand/wand_api.h>
/**
* The MAGICK bucket type. This bucket represents a magick wand. If this bucket
* is still available when the pool is cleared, the data is copied on to the heap
* and becomes a MAGICK_HEAP bucket.
*/
AP_DECLARE_DATA extern const apr_bucket_type_t ap_bucket_type_magick;
/**
* The MAGICK_HEAP bucket type. This bucket represents a data that was generated
* from a magick wand.
*/
AP_DECLARE_DATA extern const apr_bucket_type_t ap_bucket_type_magick_heap;
/**
* Determine if a bucket is a MAGICK bucket
* @param e The bucket to inspect
* @return true or false
*/
#define AP_BUCKET_IS_MAGICK(e) ((e)->type == &ap_bucket_type_magick)
/**
* Determine if a bucket is a MAGICK_HEAP bucket
* @param e The bucket to inspect
* @return true or false
*/
#define AP_BUCKET_IS_MAGICK_HEAP(e) ((e)->type == &ap_bucket_type_magick_heap)
/**
* Make the bucket passed in a Magick (MAGICK) bucket
* @param b The bucket to make into an EOR bucket
* @param wand The wand to destroy when this bucket is destroyed
* @return The new bucket, or NULL if allocation failed
*/
AP_DECLARE(apr_bucket *) ap_bucket_magick_make(apr_bucket *b);
/**
* Create a bucket referring to a Magick Wand (MAGICK). This bucket
* holds a pointer to the wand, so that the request can be
* destroyed right after all of the output has been sent to the client.
*
* @param list The freelist from which this bucket should be allocated
* @param wand The wand to destroy when this bucket is destroyed
* @return The new bucket, or NULL if allocation failed
*/
AP_DECLARE(apr_bucket *) ap_bucket_magick_create(apr_bucket_alloc_t *list);
/** @see apr_bucket_pool */
typedef struct ap_bucket_magick ap_bucket_magick;
/**
* A bucket referring to data generated by a Magick Wand.
*/
struct ap_bucket_magick {
/** Number of buckets using this memory */
apr_bucket_refcount refcount;
/** The start of the data actually allocated.
*/
char *base;
/** how much memory was allocated */
apr_size_t alloc_len;
/** The block of data actually allocated from the pool.
* Segments of this block are referenced by adjusting
* the start and length of the apr_bucket accordingly.
* This will be NULL after the pool gets cleaned up.
*/
/** The magick wand wrapped by this bucket. */
MagickWand *wand;
};
#endif /* MOD_MAGICK_H_ */