3 * ====================================================================
4 * Licensed to the Apache Software Foundation (ASF) under one
5 * or more contributor license agreements. See the NOTICE file
6 * distributed with this work for additional information
7 * regarding copyright ownership. The ASF licenses this file
8 * to you under the Apache License, Version 2.0 (the
9 * "License"); you may not use this file except in compliance
10 * with the License. You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing,
15 * software distributed under the License is distributed on an
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 * KIND, either express or implied. See the License for the
18 * specific language governing permissions and limitations
20 * ====================================================================
24 * @brief Subversion interface to libmagic.
30 /* An opaque struct that wraps a libmagic cookie. */
31 typedef struct svn_magic__cookie_t svn_magic__cookie_t;
33 /* This routine initialises libmagic.
34 * Upon success a new *MAGIC_COOKIE is allocated in RESULT_POOL.
35 * On failure *MAGIC_COOKIE is set to NULL.
36 * All resources used by libmagic are freed by a cleanup handler
37 * installed on RESULT_POOL, i.e. *MAGIC_COOKIE becomes invalid when
38 * the pool is cleared! */
40 svn_magic__init(svn_magic__cookie_t **magic_cookie,
41 apr_pool_t *result_pool);
43 /* Detect the mime-type of the file at LOCAL_ABSPATH using MAGIC_COOKIE.
44 * If the mime-type is binary return the result in *MIMETYPE.
45 * If the file is not a binary file or if its mime-type cannot be determined
46 * set *MIMETYPE to NULL. Allocate *MIMETYPE in RESULT_POOL.
47 * Use SCRATCH_POOL for temporary allocations. */
49 svn_magic__detect_binary_mimetype(const char **mimetype,
50 const char *local_abspath,
51 svn_magic__cookie_t *magic_cookie,
52 apr_pool_t *result_pool,
53 apr_pool_t *scratch_pool);
55 #endif /* SVN_MAGIC_H */