libpsl/include/libpsl.h

91 lines
2.4 KiB
C
Raw Normal View History

2014-03-20 22:43:04 +01:00
/*
* Copyright(c) 2014 Tim Ruehsen
*
2014-03-24 17:29:56 +01:00
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
2014-03-20 22:43:04 +01:00
*
2014-03-24 17:29:56 +01:00
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
2014-03-20 22:43:04 +01:00
*
2014-03-24 17:29:56 +01:00
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
2014-03-20 22:43:04 +01:00
*
2014-03-24 17:29:56 +01:00
* This file is part of libpsl.
2014-03-20 22:43:04 +01:00
*
* Header file for libpsl library routines
*
* Changelog
* 20.03.2014 Tim Ruehsen created
*
*/
#ifndef _LIBPSL_LIBPSL_H
#define _LIBPSL_LIBPSL_H
2014-03-22 14:28:55 +01:00
#include <stdio.h>
2014-03-20 22:43:04 +01:00
// Let C++ include C headers
#ifdef __cplusplus
# define PSL_BEGIN_DECLS extern "C" {
# define PSL_END_DECLS }
#else
# define PSL_BEGIN_DECLS
# define PSL_END_DECLS
#endif
#if ENABLE_NLS != 0
# include <libintl.h>
# define _(STRING) gettext(STRING)
#else
# define _(STRING) STRING
# define ngettext(STRING1,STRING2,N) STRING2
#endif
PSL_BEGIN_DECLS
typedef struct _psl_ctx_st psl_ctx_t;
2014-03-24 17:29:56 +01:00
int
psl_global_init(void);
void
psl_global_deinit(void);
2014-03-20 22:43:04 +01:00
void
psl_free(psl_ctx_t **psl);
psl_ctx_t *
psl_load_file(const char *fname);
2014-03-22 14:28:55 +01:00
psl_ctx_t *
psl_load_fp(FILE *fp);
2014-03-24 17:29:56 +01:00
psl_ctx_t *
psl_builtin(void);
2014-03-20 22:43:04 +01:00
int
psl_is_public(const psl_ctx_t *psl, const char *domain);
2014-03-24 17:29:56 +01:00
// does not include exceptions
int
psl_suffix_count(const psl_ctx_t *psl);
2014-03-24 17:29:56 +01:00
// just counts exceptions
int
psl_suffix_exception_count(const psl_ctx_t *psl);
2014-03-24 17:29:56 +01:00
// returns compilation time
time_t
psl_builtin_compile_time(void);
// returns mtime of PSL source file
time_t
psl_builtin_file_time(void);
// returns MD5 checksum (hex-encoded, lowercase) of PSL source file
const char *
psl_builtin_sha1sum(void);
2014-03-20 22:43:04 +01:00
PSL_END_DECLS
#endif /* _LIBPSL_LIBPSL_H */