This patch file is what happens to squid version 2.5 STABLE 14 after Secure Computing's "Smart Filter" version 4.1.1.01 for Solaris patches it. Secure Computing: http://www.securecomputing.com/ SmartFilter software: ftp://ftp.activations.securecomputing.com/pub/smartfilter/sfv4/solaris/sf411_01_solaris_squid.bin Squid: http://www.squid-cache.org/ ###################################################################### --- ../squid-2.5.STABLE14.orig/configure 2006-05-20 09:43:18.000000000 -0400 +++ configure 2007-01-24 01:02:39.001425000 -0500 @@ -234,6 +234,8 @@ use internal copies of the headers from Samba-2.2.7) " ac_help="$ac_help + --enable-smartfilter Enable SmartFilter web filtering." +ac_help="$ac_help --disable-unlinkd Do not use unlinkd" ac_help="$ac_help --enable-stacktraces Enable automatic call backtrace on fatal errors" @@ -2009,6 +2011,22 @@ echo "With dl" fi +# Check whether --enable-smartfilter or --disable-smartfilter was given. +if test "${enable_smartfilter+set}" = set; then + enableval="$enable_smartfilter" + case $enableval in + yes) + CFLAGS="$CFLAGS -DSMARTFILTER -DUNIX -D_REENTRANT" + SF_SRCS="smartfilter_squid.c smartfilter_userinfo.c smartfilter_thread.c" + SF_LIBS="-lsfplugin -lsflog_client -lsfcontrol -lsmartfilteragent -lpthread " + ;; + no) + ;; + *) + ;; + esac +fi + # Check whether --enable-storeio or --disable-storeio was given. if test "${enable_storeio+set}" = set; then enableval="$enable_storeio" @@ -9170,6 +9188,8 @@ s%@LIBOBJS@%$LIBOBJS%g s%@XTRA_OBJS@%$XTRA_OBJS%g s%@XTRA_LIBS@%$XTRA_LIBS%g +s%@SF_LIBS@%$SF_LIBS%g +s%@SF_SRCS@%$SF_SRCS%g CEOF EOF Common subdirectories: ../squid-2.5.STABLE14.orig/contrib/nextstep and contrib/nextstep Common subdirectories: ../squid-2.5.STABLE14.orig/errors/Azerbaijani and errors/Azerbaijani Common subdirectories: ../squid-2.5.STABLE14.orig/errors/Bulgarian and errors/Bulgarian Common subdirectories: ../squid-2.5.STABLE14.orig/errors/Catalan and errors/Catalan Common subdirectories: ../squid-2.5.STABLE14.orig/errors/Czech and errors/Czech Common subdirectories: ../squid-2.5.STABLE14.orig/errors/Danish and errors/Danish Common subdirectories: ../squid-2.5.STABLE14.orig/errors/Dutch and errors/Dutch Common subdirectories: ../squid-2.5.STABLE14.orig/errors/English and errors/English Common subdirectories: ../squid-2.5.STABLE14.orig/errors/Estonian and errors/Estonian Common subdirectories: ../squid-2.5.STABLE14.orig/errors/Finnish and errors/Finnish Common subdirectories: ../squid-2.5.STABLE14.orig/errors/French and errors/French Common subdirectories: ../squid-2.5.STABLE14.orig/errors/German and errors/German Common subdirectories: ../squid-2.5.STABLE14.orig/errors/Greek and errors/Greek Common subdirectories: ../squid-2.5.STABLE14.orig/errors/Hebrew and errors/Hebrew Common subdirectories: ../squid-2.5.STABLE14.orig/errors/Hungarian and errors/Hungarian Common subdirectories: ../squid-2.5.STABLE14.orig/errors/Italian and errors/Italian Common subdirectories: ../squid-2.5.STABLE14.orig/errors/Japanese and errors/Japanese Common subdirectories: ../squid-2.5.STABLE14.orig/errors/Korean and errors/Korean Common subdirectories: ../squid-2.5.STABLE14.orig/errors/Lithuanian and errors/Lithuanian Common subdirectories: ../squid-2.5.STABLE14.orig/errors/Polish and errors/Polish Common subdirectories: ../squid-2.5.STABLE14.orig/errors/Portuguese and errors/Portuguese Common subdirectories: ../squid-2.5.STABLE14.orig/errors/Romanian and errors/Romanian Common subdirectories: ../squid-2.5.STABLE14.orig/errors/Russian-1251 and errors/Russian-1251 Common subdirectories: ../squid-2.5.STABLE14.orig/errors/Russian-koi8-r and errors/Russian-koi8-r Common subdirectories: ../squid-2.5.STABLE14.orig/errors/Serbian and errors/Serbian Common subdirectories: ../squid-2.5.STABLE14.orig/errors/Simplify_Chinese and errors/Simplify_Chinese Common subdirectories: ../squid-2.5.STABLE14.orig/errors/Slovak and errors/Slovak Common subdirectories: ../squid-2.5.STABLE14.orig/errors/Spanish and errors/Spanish Common subdirectories: ../squid-2.5.STABLE14.orig/errors/Swedish and errors/Swedish Common subdirectories: ../squid-2.5.STABLE14.orig/errors/Traditional_Chinese and errors/Traditional_Chinese Common subdirectories: ../squid-2.5.STABLE14.orig/errors/Turkish and errors/Turkish Common subdirectories: ../squid-2.5.STABLE14.orig/helpers/basic_auth and helpers/basic_auth Common subdirectories: ../squid-2.5.STABLE14.orig/helpers/digest_auth and helpers/digest_auth Common subdirectories: ../squid-2.5.STABLE14.orig/helpers/external_acl and helpers/external_acl Common subdirectories: ../squid-2.5.STABLE14.orig/helpers/ntlm_auth and helpers/ntlm_auth Common subdirectories: ../squid-2.5.STABLE14.orig/include/samba and include/samba diff -uN ../squid-2.5.STABLE14.orig/include/sf_control.h include/sf_control.h --- ../squid-2.5.STABLE14.orig/include/sf_control.h 1969-12-31 19:00:00.000000000 -0500 +++ include/sf_control.h 2006-08-14 12:06:38.000000000 -0400 @@ -0,0 +1,630 @@ +/*--------------------------------------------------------------------------*\ + * + * SmartFilter Control List Library + * + * Copyright (c) 2003-2006, Secure Computing Corporation. All rights reserved. + * + * $RCSfile: sf_control.h,v $ + * $Revision: 1.4.2.5 $ + * $Date: 2006/08/14 16:06:38 $ + * $State: Exp $ +\*--------------------------------------------------------------------------*/ + +#ifndef SF_CONTROL_H +#define SF_CONTROL_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/*--------------------------------------------------------------*\ + * + * GENERAL + * +\*--------------------------------------------------------------*/ +#ifdef WIN32 +# ifdef SFCL_API_BUILD +# define SFCL_API_PUBLIC __declspec(dllexport) +# else /* SFCL_API_BUILD */ +# define SFCL_API_PUBLIC __declspec(dllimport) +# endif /* SFCL_API_BUILD */ +#else +# define SFCL_API_PUBLIC extern +#endif /* WIN32 */ + +#define SFCL_API_INTERNAL extern +#define SFCL_API_PRIVATE static +#define SFCL_API_PROTECTED SFCL_API_PUBLIC + +/* + * Library version information + */ +#define SFCL_API_VERSION_MAJOR 4 +#define SFCL_API_VERSION_MINOR 2 +#define SFCL_API_VERSION_DESC_LEN 80 + +/* + * Return values from functions + */ +#define SFCL_OK 0 +#define SFCL_ERROR 1 + +#define SFCL_NOMEM 10 +#define SFCL_INSUFFICIENT_SPACE 11 + +#define SFCL_INVALID_URL 20 + +#define SFCL_INVALID_LIST 30 +#define SFCL_NO_LIST 31 +#define SFCL_EXPIRED_LIST 32 + +#define SFCL_INVALID_FILE 40 +#define SFCL_DOWNLOAD_FAILED 41 +#define SFCL_MERGE_FAILED 42 + + +SFCL_API_PUBLIC int +SFCL_Init(void); + +/*--------------------------------------------------------------*\ + * + * HANDLE + * +\*--------------------------------------------------------------*/ +typedef struct sfcl_handle *SFCL_Handle; + +SFCL_API_PUBLIC int +SFCL_HandleCreate(SFCL_Handle *sfcl_handle); + +SFCL_API_PUBLIC int +SFCL_HandleDestroy(SFCL_Handle *sfcl_handle); + +typedef enum +{ + SFCL_HANDLE_INFO_FIRST, /* do not use */ + + SFCL_HANDLE_INFO_LIST_EXPIRED, + SFCL_HANDLE_INFO_LIST_EXPIRE_TIME, + SFCL_HANDLE_INFO_LIST_SERIAL_NUM, + SFCL_HANDLE_INFO_API_VERSION_MAJOR, + SFCL_HANDLE_INFO_API_VERSION_MINOR, + SFCL_HANDLE_INFO_API_VERSION_DESC, + + SFCL_HANDLE_INFO_LAST, /* do not use */ +} SFCL_Handle_Info; + +SFCL_API_PUBLIC int +SFCL_HandleInfoGet(SFCL_Handle sfcl_handle, + SFCL_Handle_Info info_type, + void *info); + + +/*--------------------------------------------------------------*\ + * + * CATEGORIES + * +\*--------------------------------------------------------------*/ +typedef struct sfcl_categories *SFCL_Categories; +typedef unsigned int SFCL_Category; + +typedef enum +{ + SFCL_LANGUAGE_FIRST, /* do not use */ + + SFCL_LANGUAGE_ENGLISH, + SFCL_LANGUAGE_ENGLISH_CATEGORY_SHORT, + + SFCL_LANGUAGE_LAST /* do not use */ +} SFCL_Language; + +typedef enum +{ + SFCL_ENCODING_FIRST, /* do not use */ + + SFCL_ENCODING_UTF8, + + SFCL_ENCODING_LAST /* do not use */ +} SFCL_Encoding; + +SFCL_API_PUBLIC int +SFCL_CategoriesCategoryAdd(SFCL_Handle sfcl_handle, + SFCL_Categories categories, + SFCL_Category category); + +SFCL_API_PUBLIC int +SFCL_CategoriesCategoryAddAll(SFCL_Handle sfcl_handle, + SFCL_Categories categories); + +SFCL_API_PUBLIC int +SFCL_CategoriesCategoryIsMember(SFCL_Handle sfcl_handle, + SFCL_Categories categories, + SFCL_Category category, + int *member); + +SFCL_API_PUBLIC int +SFCL_CategoriesCategoryRemove(SFCL_Handle sfcl_handle, + SFCL_Categories categories, + SFCL_Category category); + +SFCL_API_PUBLIC int +SFCL_CategoriesCategoryRemoveAll(SFCL_Handle sfcl_handle, + SFCL_Categories categories); + +SFCL_API_PUBLIC int +SFCL_CategoriesCopy(SFCL_Handle sfcl_handle, + SFCL_Categories src, + SFCL_Categories dst); + +SFCL_API_PUBLIC int +SFCL_CategoriesCount(SFCL_Handle sfcl_handle, + SFCL_Categories categories, + int *count); + +SFCL_API_PUBLIC int +SFCL_CategoriesCreate(SFCL_Handle sfcl_handle, + SFCL_Categories *categories); + +SFCL_API_PUBLIC int +SFCL_CategoriesDestroy(SFCL_Handle sfcl_handle, + SFCL_Categories *categories); + +SFCL_API_PUBLIC int +SFCL_CategoriesEqual(SFCL_Handle sfcl_handle, + SFCL_Categories categories1, + SFCL_Categories categories2, + int *equal); + +SFCL_API_PUBLIC int +SFCL_CategoriesIntersect(SFCL_Handle sfcl_handle, + SFCL_Categories categories1, + SFCL_Categories categories2, + SFCL_Categories result, + int *num_cats); + +SFCL_API_PUBLIC int +SFCL_CategoriesToArray(SFCL_Handle sfcl_handle, + SFCL_Categories categories, + SFCL_Category *cat_array, + int *num_cats); + +SFCL_API_PUBLIC int +SFCL_CategoriesToString(SFCL_Handle sfcl_handle, + SFCL_Categories categories, + SFCL_Language language, + SFCL_Encoding encoding, + char *delimiter, + size_t delimiter_len, + char *cat_string, + size_t *cat_string_len); + +SFCL_API_PUBLIC int +SFCL_CategoriesUnion(SFCL_Handle sfcl_handle, + SFCL_Categories categories1, + SFCL_Categories categories2, + SFCL_Categories result, + int *num_cats); + + +/*--------------------------------------------------------------*\ + * + * URLS + * +\*--------------------------------------------------------------*/ +typedef struct sfcl_url *SFCL_Url; + +#define SFCL_URL_CAT_SKIP_CUSTOM_KEYWORDS 0x00000001 +#define SFCL_URL_CAT_SKIP_CUSTOM_SITES 0x00000002 +#define SFCL_URL_CAT_SKIP_LIST 0x00000004 +#define SFCL_URL_CAT_SKIP_LIST_KEYWORDS 0x00000008 +#define SFCL_URL_CAT_SKIP_PATTERNS 0x00000010 +#define SFCL_URL_CAT_SKIP_MASK 0x0000001F +#define SFCL_URL_CAT_SKIP_ALL (0xFFFFFFFF & SFCL_URL_CAT_SKIP_MASK) + +SFCL_API_PUBLIC int +SFCL_UrlCategorize(SFCL_Handle sfcl_handle, + SFCL_Url url, + SFCL_Categories categories, + int *num_cats, + int skip_methods); + +SFCL_API_PUBLIC int +SFCL_UrlCreate(SFCL_Handle sfcl_handle, + SFCL_Url *url); + +SFCL_API_PUBLIC int +SFCL_UrlDestroy(SFCL_Handle sfcl_handle, + SFCL_Url *url); + +SFCL_API_PUBLIC int +SFCL_UrlDomainRewrite(SFCL_Handle sfcl_handle, + SFCL_Url url, + const char *new_domain); + +typedef enum +{ + SFCL_URL_INFO_FIRST, /* do not use */ + + SFCL_URL_INFO_DOMAIN, + SFCL_URL_INFO_FILE_EXT, + SFCL_URL_INFO_NUM_PATHS, + SFCL_URL_INFO_DOMAIN_IS_IP, + SFCL_URL_INFO_IS_USER_PAGE, + SFCL_URL_INFO_PROTOCOL, + SFCL_URL_INFO_PORT, + SFCL_URL_INFO_PATH, + SFCL_URL_INFO_CGI, + + SFCL_URL_INFO_LAST, /* do not use */ +} SFCL_Url_Info; + +SFCL_API_PUBLIC int +SFCL_UrlInfoGet(SFCL_Handle sfcl_handle, + SFCL_Url url, + SFCL_Url_Info info_type, + void *info); + + +SFCL_API_PUBLIC int +SFCL_UrlParse(SFCL_Handle sfcl_handle, + const char *url, + const char *host_header, + SFCL_Url parsed_url); + + +/*--------------------------------------------------------------*\ + * + * CUSTOM SEARCH KEYWORDS + * +\*--------------------------------------------------------------*/ +SFCL_API_PUBLIC int +SFCL_CustomSearchKeywordsAdd(SFCL_Handle sfcl_handle, + const char *keyword, + SFCL_Categories categories); + +SFCL_API_PUBLIC int +SFCL_CustomSearchKeywordsPost(SFCL_Handle sfcl_handle); + +SFCL_API_PUBLIC int +SFCL_CustomSearchKeywordsRemove(SFCL_Handle sfcl_handle, + const char *keyword); + +typedef enum SFCL_Custom_Search_Keywords_Reset_Type +{ + SFCL_CUSTOM_SEARCH_KEYWORDS_RESET_FIRST, /* Do not use */ + + SFCL_CUSTOM_SEARCH_KEYWORDS_RESET_ACTIVE, + SFCL_CUSTOM_SEARCH_KEYWORDS_RESET_PENDING, + SFCL_CUSTOM_SEARCH_KEYWORDS_RESET_ALL, + + SFCL_CUSTOM_SEARCH_KEYWORDS_RESET_LAST /* Do not use */ +} SFCL_Custom_Search_Keywords_Reset_Type; + +SFCL_API_PUBLIC int +SFCL_CustomSearchKeywordsReset(SFCL_Handle sfcl_handle, + SFCL_Custom_Search_Keywords_Reset_Type type); + + +/*--------------------------------------------------------------*\ + * + * CUSTOM SITES + * +\*--------------------------------------------------------------*/ + +#define SFCL_CUSTOM_SITES_MATCH_PORT 0x00000001 +#define SFCL_CUSTOM_SITES_MATCH_PROTOCOL 0x00000002 + +typedef enum +{ + SFCL_CUSTOM_SITES_TYPE_FIRST, /* Do not use */ + + SFCL_CUSTOM_SITES_TYPE_NONE, + SFCL_CUSTOM_SITES_TYPE_SEARCH_PHRASE, + + SFCL_CUSTOM_SITES_TYPE_LAST, /* Do not use */ +} SFCL_Custom_Sites_Data; + + +typedef enum SFCL_Custom_Sites_State +{ + SFCL_CUSTOM_SITES_STATE_FIRST, /* Do not use */ + + SFCL_CUSTOM_SITES_STATE_INITIAL, + SFCL_CUSTOM_SITES_STATE_FINAL, + + SFCL_CUSTOM_SITES_STATE_LAST /* Do not use */ +} SFCL_Custom_Sites_State; + + +SFCL_API_PUBLIC int +SFCL_CustomSitesAdd(SFCL_Handle sfcl_handle, + SFCL_Url url, + int url_match, + SFCL_Categories categories, + SFCL_Custom_Sites_State state, + SFCL_Custom_Sites_Data data_type, + void *data); + +SFCL_API_PUBLIC int +SFCL_CustomSitesPost(SFCL_Handle sfcl_handle); + +SFCL_API_PUBLIC int +SFCL_CustomSitesRemove(SFCL_Handle sfcl_handle, + SFCL_Url url, + int match); + +typedef enum SFCL_Custom_Sites_Reset_Type +{ + SFCL_CUSTOM_SITES_RESET_FIRST, /* Do not use */ + + SFCL_CUSTOM_SITES_RESET_ACTIVE, + SFCL_CUSTOM_SITES_RESET_PENDING, + SFCL_CUSTOM_SITES_RESET_ALL, + + SFCL_CUSTOM_SITES_RESET_LAST /* Do not use */ +} SFCL_Custom_Sites_Reset_Type; + + + +SFCL_API_PUBLIC int +SFCL_CustomSitesReset(SFCL_Handle sfcl_handle, + SFCL_Custom_Sites_Reset_Type type); + + + + + +/*--------------------------------------------------------------*\ + * + * LOGGING + * +\*--------------------------------------------------------------*/ +typedef enum +{ + SFCL_LOG_LEVEL_FIRST = 0, + + SFCL_LOG_LEVEL_NONE, /* Turns all logging off */ + SFCL_LOG_LEVEL_FATAL, /* Bad error, going away or crashing */ + SFCL_LOG_LEVEL_ERROR, /* Bad error, will try to recover */ + SFCL_LOG_LEVEL_WARNING, /* Shouldn't have happened, but can recover */ + SFCL_LOG_LEVEL_INFO, /* Something interesting (and normal) occurred */ + SFCL_LOG_LEVEL_DEBUG1, /* DEBUG1 through DEBUG9 and also DEBUG */ + SFCL_LOG_LEVEL_DEBUG2, /* represent the different debugging levels */ + SFCL_LOG_LEVEL_DEBUG3, /* that an application may use. Typically, */ + SFCL_LOG_LEVEL_DEBUG4, /* the larger the number, the more logging */ + SFCL_LOG_LEVEL_DEBUG5, /* you will see. */ + SFCL_LOG_LEVEL_DEBUG6, + SFCL_LOG_LEVEL_DEBUG7, + SFCL_LOG_LEVEL_DEBUG8, + SFCL_LOG_LEVEL_DEBUG9, + SFCL_LOG_LEVEL_DEBUG, /* All debugging except for trace logs */ + SFCL_LOG_LEVEL_TRACE, /* All debugging as well as trace logs */ + /* which mark the entrance and exit of */ + /* functions. */ + SFCL_LOG_LEVEL_ALL, /* All log messages */ + + SFCL_LOG_LEVEL_LAST +} SFCL_Log_Level; + + +typedef int SFCL_Log_Area; + +#define SFCL_LOG_AREA_CUSTOM_SITES 0x00000001 +#define SFCL_LOG_AREA_CUSTOM_KEYWORDS 0x00000002 +#define SFCL_LOG_AREA_CUSTOM_PATTERNS 0x00000004 +#define SFCL_LOG_AREA_LIST_DOWNLOAD 0x00000008 +#define SFCL_LOG_AREA_LIST_LOAD 0x00000010 +#define SFCL_LOG_AREA_LIST_SEARCH 0x00000020 +#define SFCL_LOG_AREA_LOG 0x00000040 +#define SFCL_LOG_AREA_URL 0x00000080 +#define SFCL_LOG_AREA_CATEGORIES 0x00000100 +#define SFCL_LOG_AREA_HANDLE 0x00000200 +#define SFCL_LOG_AREA_MASK 0x000003FF +#define SFCL_LOG_AREA_ALL (0xFFFFFFFF & SFCL_LOG_AREA_MASK) + +typedef void (*SFCL_Log_Func)(SFCL_Log_Level level, + SFCL_Log_Area area, + const char *message); + +SFCL_API_PUBLIC int +SFCL_LogFunctionSet(SFCL_Handle sfcl_handle, + SFCL_Log_Func log_func); + +SFCL_API_PUBLIC int +SFCL_LogLevelSet(SFCL_Handle sfcl_handle, + SFCL_Log_Level level, + SFCL_Log_Area areas); + + + + +/*--------------------------------------------------------------*\ + * + * CONTROL LIST + * +\*--------------------------------------------------------------*/ +typedef void *(*SFCL_List_Alloc_Func)(size_t bytes); +typedef void (*SFCL_List_Free_Func)(void *ptr); + + +SFCL_API_PUBLIC int +SFCL_ListAccessFunctionsSet(SFCL_Handle sfcl_handle, + SFCL_List_Alloc_Func list_alloc_func, + SFCL_List_Free_Func list_free_func); + +typedef enum +{ + SFCL_LIST_DOWNLOAD_MODE_FIRST, /* do not use */ + + SFCL_LIST_DOWNLOAD_MODE_FULL, + SFCL_LIST_DOWNLOAD_MODE_INCR, + SFCL_LIST_DOWNLOAD_MODE_INCR_LOW_CPU, + + SFCL_LIST_DOWNLOAD_MODE_LAST, /* do not use */ + +} SFCL_List_Download_Mode; + +#define SFCL_LIST_DOWNLOAD_COMPLETE 1 +#define SFCL_LIST_DOWNLOAD_PARTIAL 2 +#define SFCL_LIST_DOWNLOAD_NOT_NEEDED 3 + +SFCL_API_PUBLIC int +SFCL_ListDownload(SFCL_Handle sfcl_handle, + const char *local_filename, + SFCL_List_Download_Mode download_mode, + int *download_status, + void *data); + +typedef enum SFCL_List_Download_Error +{ + SFCL_LIST_DOWNLOAD_ERROR_FIRST, /* do not use */ + + SFCL_LIST_DOWNLOAD_ERROR_INTERNAL, + SFCL_LIST_DOWNLOAD_ERROR_RESPONSE_INVALID, + SFCL_LIST_DOWNLOAD_ERROR_FILE_PERMISSIONS, + SFCL_LIST_DOWNLOAD_ERROR_CONNECT, + SFCL_LIST_DOWNLOAD_ERROR_HOSTNAME_INVALID, + SFCL_LIST_DOWNLOAD_ERROR_HTTP_STATUS, + + SFCL_LIST_DOWNLOAD_ERROR_LAST /* do not use */ +} SFCL_List_Download_Error; + + +typedef enum SFCL_List_Download_List_Type +{ + SFCL_LIST_DOWNLOAD_LIST_TYPE_FIRST, /* do not use */ + + SFCL_LIST_DOWNLOAD_LIST_TYPE_STANDARD, + + SFCL_LIST_DOWNLOAD_LIST_TYPE_LAST /* do not use */ +} SFCL_List_Download_List_Type; + + +typedef struct SFCL_List_Download_Func_Info +{ + SFCL_Handle sfcl_handle; + char dest_host[80]; + unsigned short dest_port; + char proxy_host[80]; + unsigned short proxy_port; + char proxy_username[80]; + char proxy_password[80]; + char path[1024]; + char serial_number[80]; + char perm_serial_number[80]; + SFCL_List_Download_List_Type list_type; + char product_type[80]; + char product_version[20]; + char os[20]; + char *distributes_to; /* For Secure Computing use only */ + int user_count; + char expiration[80]; + SFCL_List_Download_Error status; + int http_status; + char message[1024]; + SFCL_Log_Level message_level; + int message_code; +} SFCL_List_Download_Func_Info; + + +#define SFCL_FILE_TYPE_SUBSCRIPTION -4 +#define SFCL_FILE_TYPE_INFO -3 +#define SFCL_FILE_TYPE_FULL -2 +#define SFCL_FILE_TYPE_CURRENT -1 + +typedef int (*SFCL_List_Download_Func)(const char *local_file, + int file_type, + void *data); + +SFCL_API_PUBLIC int +SFCL_ListDownloadFunctionSet(SFCL_Handle sfcl_handle, + SFCL_List_Download_Func download_func); + + +SFCL_API_PUBLIC int +SFCL_ListSubscriptionInfoDownload(SFCL_Handle sfcl_handle, + SFCL_List_Download_Func_Info *data); + +typedef enum +{ + SFCL_LIST_ACCESS_FIRST, /* do not use */ + + SFCL_LIST_ACCESS_DISK, + SFCL_LIST_ACCESS_MEMORY, + SFCL_LIST_ACCESS_EXTERNAL, + + SFCL_LIST_ACCESS_LAST /* do not use */ +} SFCL_List_Access; + +SFCL_API_PUBLIC int +SFCL_ListLoad(SFCL_Handle sfcl_handle, + const char *filename, + SFCL_List_Access access); + +SFCL_API_PUBLIC int +SFCL_ListLoadFromHandle(SFCL_Handle sfcl_handle_src, + SFCL_Handle sfcl_handle_dst); + +SFCL_API_PUBLIC int +SFCL_ListReload(SFCL_Handle sfcl_handle, + const char *filename); + +SFCL_API_PUBLIC int +SFCL_ListUnload(SFCL_Handle sfcl_handle); + + + +/*--------------------------------------------------------------*\ + * + * PATTERNS + * +\*--------------------------------------------------------------*/ +typedef enum +{ + SFCL_CATEGORIES_ACTION_FIRST, /* do not use */ + + SFCL_CATEGORIES_ACTION_OVERRIDE, + SFCL_CATEGORIES_ACTION_AUGMENT, + + SFCL_CATEGORIES_ACTION_LAST, /* do not use */ +} SFCL_Patterns_Categories_Action; + + + +SFCL_API_PUBLIC int +SFCL_PatternsAdd(SFCL_Handle sfcl_handle, + SFCL_Categories input_categories, + const char *protocol, + const char *domain_pattern, + const char *path_pattern, + SFCL_Categories output_categories, + SFCL_Patterns_Categories_Action categories_action); + +SFCL_API_PUBLIC int +SFCL_PatternsPost(SFCL_Handle sfcl_handle); + +typedef enum SFCL_Patterns_Reset_Type +{ + SFCL_PATTERNS_RESET_FIRST, /* Do not use */ + + SFCL_PATTERNS_RESET_ACTIVE, + SFCL_PATTERNS_RESET_PENDING, + SFCL_PATTERNS_RESET_ALL, + + SFCL_PATTERNS_RESET_LAST /* Do not use */ +} SFCL_Patterns_Reset_Type; + + + +SFCL_API_PUBLIC int +SFCL_PatternsReset(SFCL_Handle sfcl_handle, + SFCL_Patterns_Reset_Type type); + + +#ifdef __cplusplus +} +#endif/* __cplusplus */ + + +#endif /* SF_CONTROL_H */ diff -uN ../squid-2.5.STABLE14.orig/include/sf_plugin.h include/sf_plugin.h --- ../squid-2.5.STABLE14.orig/include/sf_plugin.h 1969-12-31 19:00:00.000000000 -0500 +++ include/sf_plugin.h 2006-08-17 12:35:18.000000000 -0400 @@ -0,0 +1,1085 @@ +/*--------------------------------------------------------------------------*\ + * + * SmartFilter Plugin Library + * + * Copyright (c) 2006, Secure Computing Corporation. All rights reserved. + * + * $RCSfile: sf_plugin.h,v $ + * $Revision: 1.70.2.12 $ + * $Date: 2006/08/17 16:35:18 $ + * $State: Exp $ +\*--------------------------------------------------------------------------*/ + +#ifndef SFPL_PLUGIN_H +#define SFPL_PLUGIN_H + +#include "sf_control.h" +#include "sf_util.h" + +#ifdef WIN32 +#include "sfpl_msg.h" +#endif + +#if defined(__cplusplus) +extern "C" { +#endif /* __cplusplus */ + +/*--------------------------------------------------------------*\ + * + * GENERAL + * +\*--------------------------------------------------------------*/ +#ifdef WIN32 +# ifdef SFPL_API_BUILD +# define SFPL_API_PUBLIC __declspec(dllexport) +# else /* SFPL_API_BUILD */ +# define SFPL_API_PUBLIC __declspec(dllimport) +# endif /* SFPL_API_BUILD */ +#else +# define SFPL_API_PUBLIC extern +#endif /* WIN32 */ + +#define SFPL_API_INTERNAL extern +#define SFPL_API_PRIVATE static + +#ifndef SFPL_API_PROTECTED_BUILD +# define SFPL_API_PROTECTED extern +#else /* SFPL_API_PROTECTED_BUILD */ +# define SFPL_API_PROTECTED SFPL_API_PUBLIC +#endif /* SFPL_API_PROTECTED_BUILD */ + +/* + * Library version information + */ +#define SFPL_API_VERSION_MAJOR 4 +#define SFPL_API_VERSION_MINOR 1 +#define SFPL_API_VERSION_UPDATE 1 +#define SFPL_API_VERSION_PATCH "01" +#define SFPL_API_VERSION_DESC_LEN 80 + +/* + * Return values from functions + */ +#define SFPL_OK 0 +#define SFPL_ERROR 1 + +#define SFPL_NOMEM 10 +#define SFPL_INSUFFICIENT_SPACE 11 + +#define SFPL_INVALID_URL 20 + +#define SFPL_INVALID_LIST 30 +#define SFPL_NO_LIST 31 +#define SFPL_EXPIRED_LIST 32 + +#define SFPL_INVALID_FILE 40 +#define SFPL_DOWNLOAD_FAILED 41 +#define SFPL_MERGE_FAILED 42 + +#define SFPL_NULL 50 +#define SFPL_INVALID_HANDLE 51 +#define SFPL_SERVER_FAILED 52 +#define SFPL_NOT_FOUND 53 +#define SFPL_RETRY 54 +#define SFPL_INVALID 55 +#define SFPL_DUPLICATE_GROUP 56 +#define SFPL_EXPIRED_ACTIVATION 57 +#define SFPL_FOUND 58 + +#define SFPL_LOOKUP_REVERSE 70 +#define SFPL_LOOKUP_FORWARD 71 + +#define SFPL_TRANSAUTH_REDIRECT 100 +#define SFPL_TRANSAUTH_CHECK 101 + + + +#define SFPL_DISABLE 1 +#define SFPL_ENABLE 2 + +/*--------------------------------------------------------------*\ + * + * BLOCKED MESSAGES + * +\*--------------------------------------------------------------*/ + +/* Define Action codes */ +typedef unsigned char SFPL_Action_Code; + +/* + * These must be kept in order from most restrictive (smallest + * integer means greatest priority) to least restrictive. Note + * that exempt is a special case and we just decided it has the + * highest priority. + */ +#define SFPL_EXEMPT 0 +#define SFPL_AUTHOVER 1 +#define SFPL_BLOCK 2 +#define SFPL_WARN 3 +#define SFPL_BYPASS 4 +#define SFPL_DELAY 5 +#define SFPL_MONITOR 6 +#define SFPL_ALLOW 7 + +#define SFPL_EXEMPT_STR "EXEMPT" +#define SFPL_AUTHOVER_STR "AUTHOVERRIDE" +#define SFPL_BLOCK_STR "BLOCK" +#define SFPL_WARN_STR "WARN" +#define SFPL_BYPASS_STR "BYPASS" +#define SFPL_DELAY_STR "DELAY" +#define SFPL_MONITOR_STR "MONITOR" +#define SFPL_ALLOW_STR "ALLOW" +#define SFPL_INVALID_ACTION_STR "INVALID_ACTION" + + +/* These are for error messages and logging */ +#define SFPL_MAX_MESSAGE 1024 +#define SFPL_MAX_LOG 1024 + +#define SFPL_MAX_URL 2048 + + +/*--------------------------------------------------------------*\ + * + * HANDLE + * +\*--------------------------------------------------------------*/ +typedef struct sfpl_handle *SFPL_Handle; + +SFPL_API_PUBLIC int +SFPL_HandleCreate(SFPL_Handle *sfpl_handle); + +SFPL_API_PUBLIC int +SFPL_HandleDestroy(SFPL_Handle *sfpl_handle); + +typedef enum +{ + SFPL_HANDLE_INFO_FIRST, /* do not use */ + + SFPL_HANDLE_INFO_API_VERSION_MAJOR, + SFPL_HANDLE_INFO_API_VERSION_MINOR, + SFPL_HANDLE_INFO_API_VERSION_DESC, + SFPL_HANDLE_INFO_CONTROL_HANDLE, + SFPL_HANDLE_INFO_DOWNLOAD_SETTINGS, + SFPL_HANDLE_INFO_REVERSE_LOOKUPS, + SFPL_HANDLE_INFO_SERIAL_NUMBER, + SFPL_HANDLE_INFO_PERM_SERIAL_NUMBER, + SFPL_HANDLE_INFO_CONTROL_PATH, + SFPL_HANDLE_INFO_LOG_OPTION, + SFPL_HANDLE_INFO_LOG_TYPE, + SFPL_HANDLE_INFO_LOG_TEXT_DIR, + SFPL_HANDLE_INFO_ODBC_DSN, + SFPL_HANDLE_INFO_ODBC_TABLE, + SFPL_HANDLE_INFO_SQL_USER, + SFPL_HANDLE_INFO_SQL_PASS, + SFPL_HANDLE_INFO_IP_RATING, + SFPL_HANDLE_INFO_MAIL_SETTINGS, + SFPL_HANDLE_INFO_AUTHSERV_SETTINGS, + + SFPL_HANDLE_INFO_LAST /* do not use */ +} SFPL_Handle_Info; + +SFPL_API_PUBLIC int +SFPL_HandleInfoGet(SFPL_Handle sfpl_handle, + SFPL_Handle_Info info_type, + void *info); + +/*--------------------------------------------------------------*\ + * + * USERS, GROUPS, AND POLICY + * +\*--------------------------------------------------------------*/ + +typedef struct sfpl_policy SFPL_Policy; + +/* Define user/group/policy maximums */ +#define SFPL_MAX_GROUPNAME 32 +#define SFPL_MAX_USERNAME 32 +#define SFPL_MAX_POLICYNAME 65 /* 64 + 1 for the null-terminator */ + +typedef struct sfpl_group_list +{ + struct sfpl_group_list *next; + char group_name[SFPL_MAX_GROUPNAME]; + char policy_name[SFPL_MAX_POLICYNAME]; + SFPL_Policy *policy; +} SFPL_Group_List; + +typedef struct user_grouplist +{ + struct user_grouplist *next; + char group_name[SFPL_MAX_GROUPNAME]; +} SFPL_User_Group_List; + +typedef struct user_data +{ + struct user_data *next; + SFPL_Group_List *group; +} SFPL_User_Data; + +SFPL_API_PUBLIC int /* Needed for Squid. */ +SFPL_GetIPRangeGroups(SFPL_Handle sfpl_handle, + char *ipaddr_char, + SFPL_User_Group_List **grouplist, + int *total); + +SFPL_API_PUBLIC int /* Needed for Squid. */ +SFPL_GetUserGroups(SFPL_Handle sfpl_handle, + char *username, + SFPL_User_Group_List **grouplist, + int *total_groups, + char *err_msg, + int msg_len, + int *log_err_msg); + +#define SFPL_USER_QUERY_USERNAME 0 +#define SFPL_USER_QUERY_IP 1 + +SFPL_API_PUBLIC int +SFPL_IsAuthOverrideUser(SFPL_Handle sfpl_handle, + const char *authover_username); + +SFPL_API_PUBLIC int +SFPL_AuthOverrideUserAdd(SFPL_Handle sfpl_handle, + const char *authover_username, + const char *username, + const char *client_ip, + time_t date, + int duration, + const char *url, + const char *reason, + const char *reasondata); + +SFPL_API_PUBLIC int +SFPL_AuthOverrideUserRemove(SFPL_Handle sfpl_handle, + const char *authover_username, + const char *username, + const char *client_ip); + +SFPL_API_PUBLIC int +SFPL_BypassUserAdd(SFPL_Handle sfpl_handle, + const char *username, + const char *client_ip, + time_t date, + const char *url, + const char *reason, + const char *reasondata); + +SFPL_API_PUBLIC void +SFPL_RedirectionHashCompute(SFPL_Handle sfpl_handle, + unsigned char *hash, + size_t hash_len, + const char *epochseconds, + const char *requestedurl, + const char *categorylist, + const char *useripaddress, + const char *username, + const char *actiontaken, + const char *actionreason, + const char *actionreasondata); + + +SFPL_API_PUBLIC int /* needed for authserver */ +SFPL_ErrorRedirUrlBuild(SFPL_Handle sfpl_handle, + char *redirurl, + size_t redirurl_len, + const char *url, + const char *client_ip, + const char *username); + +SFPL_API_PUBLIC int /* Needed for Squid. */ +SFPL_CheckUserCache(SFPL_Handle sfpl_handle, + char *query, + int type, + SFPL_User_Data **reply); + +SFPL_API_PUBLIC int /* Needed for Squid. */ +SFPL_AddUserCacheEntry(SFPL_Handle sfpl_handle, + char *query, + int query_type, + SFPL_User_Data *grouplist); + +SFPL_API_PUBLIC void /* Needed for Squid. */ +SFPL_FreeGroupList(SFPL_Handle sfpl_handle, + SFPL_User_Group_List *grouplist); + +SFPL_API_PUBLIC void /* Needed for Squid. */ +SFPL_FreeUserData(SFPL_Handle sfpl_handle, + SFPL_User_Data *data); + +/* + * Policy + */ +SFPL_API_PUBLIC int /* Needed for Squid. */ +SFPL_UserLocalPolicyGet(SFPL_Handle sfpl_handle, + char *username, + char *ipaddr, + SFPL_Policy **policy, + SFPL_User_Data **user_data, + char *err_msg, + int msg_len, + int *log_error); + +SFPL_API_PUBLIC int +SFPL_UserPolicyGet(SFPL_Handle sfpl_handle, + char *username, + char *ipaddr, + SFPL_Policy **policy, + SFPL_User_Data **user_data, + char *err_msg, + int msg_len, + int *log_error); + +SFPL_API_PUBLIC int +SFPL_GroupPolicyGet(SFPL_Handle sfpl_handle, + SFPL_User_Group_List *user_grouplist, + SFPL_User_Data **user_data_list); + +SFPL_API_PUBLIC int +SFPL_GroupPolicyMerge(SFPL_Handle sfpl_handle, + SFPL_User_Data *grouplist, + SFPL_Policy **policy, + char *err_msg, + int msg_len, + int *log_error); + +SFPL_API_PUBLIC int +SFPL_PolicyFree(SFPL_Handle sfpl_handle, + SFPL_Policy *policy); + +SFPL_API_PUBLIC char * +SFPL_PolicyNameGet(SFPL_Handle sfpl_handle, + SFPL_Policy *policy); + +SFPL_API_PUBLIC unsigned int +SFPL_PolicyFlagsGet(SFPL_Handle sfpl_handle, + SFPL_Policy *policy); + +SFPL_API_PUBLIC int +SFPL_UrlWithProtocol(SFPL_Handle sfpl_handle, + const char *url, + char *built, + size_t built_len); + +/*--------------------------------------------------------------*\ + * + * LOGGING + * +\*--------------------------------------------------------------*/ + +typedef SFCL_Log_Level SFPL_Log_Level; + +#define SFPL_LOG_LEVEL_FIRST SFCL_LOG_LEVEL_FIRST +#define SFPL_LOG_LEVEL_NONE SFCL_LOG_LEVEL_NONE +#define SFPL_LOG_LEVEL_FATAL SFCL_LOG_LEVEL_FATAL +#define SFPL_LOG_LEVEL_ERROR SFCL_LOG_LEVEL_ERROR +#define SFPL_LOG_LEVEL_WARNING SFCL_LOG_LEVEL_WARNING +#define SFPL_LOG_LEVEL_INFO SFCL_LOG_LEVEL_INFO +#define SFPL_LOG_LEVEL_DEBUG1 SFCL_LOG_LEVEL_DEBUG1 +#define SFPL_LOG_LEVEL_DEBUG2 SFCL_LOG_LEVEL_DEBUG2 +#define SFPL_LOG_LEVEL_DEBUG3 SFCL_LOG_LEVEL_DEBUG3 +#define SFPL_LOG_LEVEL_DEBUG4 SFCL_LOG_LEVEL_DEBUG4 +#define SFPL_LOG_LEVEL_DEBUG5 SFCL_LOG_LEVEL_DEBUG5 +#define SFPL_LOG_LEVEL_DEBUG6 SFCL_LOG_LEVEL_DEBUG6 +#define SFPL_LOG_LEVEL_DEBUG7 SFCL_LOG_LEVEL_DEBUG7 +#define SFPL_LOG_LEVEL_DEBUG8 SFCL_LOG_LEVEL_DEBUG8 +#define SFPL_LOG_LEVEL_DEBUG9 SFCL_LOG_LEVEL_DEBUG9 +#define SFPL_LOG_LEVEL_DEBUG SFCL_LOG_LEVEL_DEBUG +#define SFPL_LOG_LEVEL_TRACE SFCL_LOG_LEVEL_TRACE +#define SFPL_LOG_LEVEL_ALL SFCL_LOG_LEVEL_ALL +#define SFPL_LOG_LEVEL_LAST SFCL_LOG_LEVEL_LAST + +typedef int SFPL_Log_Area; + +#define SFPL_NUM_LOG_AREAS 13 /* Not including MASK or ALL */ + +#define SFPL_LOG_AREA_CONFIG 0x00010000 +#define SFPL_LOG_AREA_USERS 0x00020000 +#define SFPL_LOG_AREA_ACTIVATION 0x00040000 +#define SFPL_LOG_AREA_POLICY 0x00080000 +#define SFPL_LOG_AREA_URL_FILTER 0x00100000 +#define SFPL_LOG_AREA_MAIL_SEND 0x00200000 +#define SFPL_LOG_AREA_LOG 0x00400000 +#define SFPL_LOG_AREA_PLUGIN 0x00800000 +#define SFPL_LOG_AREA_HANDLE 0x01000000 +#define SFPL_LOG_AREA_CATEGORIES 0x02000000 +#define SFPL_LOG_AREA_AUTH_OVER 0x04000000 +#define SFPL_LOG_AREA_BYPASS 0x08000000 +#define SFPL_LOG_AREA_FILTER_SUMMARY 0x10000000 +#define SFPL_LOG_AREA_MASK 0x1FFF0000 +#define SFPL_LOG_AREA_ALL (0xFFFFFFFF & SFPL_LOG_AREA_MASK) + +#define _LOG_AREA_TO_INDEX(area) \ +( \ + ((SFPL_LOG_AREA_CONFIG == (area)) ? 0 : \ + (SFPL_LOG_AREA_USERS == (area)) ? 1 : \ + (SFPL_LOG_AREA_ACTIVATION == (area)) ? 2 : \ + (SFPL_LOG_AREA_POLICY == (area)) ? 3 : \ + (SFPL_LOG_AREA_URL_FILTER == (area)) ? 4 : \ + (SFPL_LOG_AREA_MAIL_SEND == (area)) ? 5 : \ + (SFPL_LOG_AREA_LOG == (area)) ? 6 : \ + (SFPL_LOG_AREA_PLUGIN == (area)) ? 7 : \ + (SFPL_LOG_AREA_HANDLE == (area)) ? 8 : \ + (SFPL_LOG_AREA_CATEGORIES == (area)) ? 9 : \ + (SFPL_LOG_AREA_AUTH_OVER == (area)) ? 10 : \ + (SFPL_LOG_AREA_BYPASS == (area)) ? 11 : \ + (SFPL_LOG_AREA_FILTER_SUMMARY == (area)) ? 12 : 0) \ +) + +#define _LOG_INDEX_TO_AREA(index) \ +( \ + ((0 == (index)) ? SFPL_LOG_AREA_CONFIG : \ + (1 == (index)) ? SFPL_LOG_AREA_USERS : \ + (2 == (index)) ? SFPL_LOG_AREA_ACTIVATION : \ + (3 == (index)) ? SFPL_LOG_AREA_POLICY : \ + (4 == (index)) ? SFPL_LOG_AREA_URL_FILTER : \ + (5 == (index)) ? SFPL_LOG_AREA_MAIL_SEND : \ + (6 == (index)) ? SFPL_LOG_AREA_LOG : \ + (7 == (index)) ? SFPL_LOG_AREA_PLUGIN : \ + (8 == (index)) ? SFPL_LOG_AREA_HANDLE : \ + (9 == (index)) ? SFPL_LOG_AREA_CATEGORIES : \ + (10 == (index)) ? SFPL_LOG_AREA_AUTH_OVER : \ + (11 == (index)) ? SFPL_LOG_AREA_BYPASS : \ + (12 == (index)) ? SFPL_LOG_AREA_FILTER_SUMMARY : 0) \ +) + +typedef void (*SFPL_Log_Func)(SFPL_Log_Level level, + SFPL_Log_Area area, + const char *message); + +SFPL_API_PUBLIC SFUT_Mutex sfpl_log_mutex; + +#define SFPL_LOG_LEVEL_VALID(level) \ +( \ + (SFPL_LOG_LEVEL_FIRST < (level)) && \ + ((SFPL_LOG_LEVEL_LAST) > (level)) \ +) + +#define SFPL_LOG_AREA_VALID(area) \ +( \ + (area) == ((area) & ((int) SFPL_LOG_AREA_ALL)) \ +) + +SFPL_API_PUBLIC char * +sfpl_log_format_msg(const char *fmt, ...); + +SFPL_API_PUBLIC void +sfpl_log_log_msg(SFPL_Handle sfpl_handle, + SFPL_Log_Level level, + SFPL_Log_Area area, + const char *function, + const char *file, + int line, + const char *msg); + +typedef struct sfpl_log_info +{ + SFPL_Log_Level log_areas[SFPL_NUM_LOG_AREAS]; + SFPL_Log_Func log_func; + char *log_file; + char log_name[80]; +} sfpl_log_info; + +#define _SFPL_MSG_LOGGABLE(log_areas, level, area) \ +( \ + SFPL_LOG_LEVEL_VALID((level)) && \ + SFPL_LOG_AREA_VALID((area)) && \ + ((level) <= (log_areas)[(_LOG_AREA_TO_INDEX(area))]) \ +) + +#define _SFPL_MSG_LOG(sfpl_handle, level, area, func, file, line, msg)\ +{ \ + if (NULL != sfpl_handle) \ + { \ + unsigned char *tmp_handle = (unsigned char *)(sfpl_handle); \ + sfpl_log_info *log_info = (sfpl_log_info *) (tmp_handle + 4); \ + if (_SFPL_MSG_LOGGABLE(log_info->log_areas, (level), (area))) \ + { \ + char *p = NULL; \ + if (0 != SFUT_MutexLock(&sfpl_log_mutex)) \ + { \ + char f[200]; \ + const char *fname = NULL; \ + p = sfpl_log_format_msg msg; \ + if (SFPL_LOG_FUNC_ENTER == (void *)(func)) \ + { \ + SFUT_Snprintf(f, sizeof(f), "%s-ENTER", \ + __PRETTY_FUNCTION__); \ + fname = f; \ + } \ + else if (SFPL_LOG_FUNC_EXIT == (void *)(func)) \ + { \ + SFUT_Snprintf(f, sizeof(f), "%s-EXIT", \ + __PRETTY_FUNCTION__); \ + fname = f; \ + } \ + else \ + { \ + fname = (func); \ + } \ + sfpl_log_log_msg((sfpl_handle), (level), (area), \ + fname, (file), (line), p); \ + SFUT_MutexUnlock(&sfpl_log_mutex); \ + } \ + } \ + } \ +} + +#define SFPL_LOG_FUNC_ENTER ((void *) -1) +#define SFPL_LOG_FUNC_EXIT ((void *) -2) +#define SFPL_LOG_FATAL(sfpl_handle, area, msg) \ +{ \ + _SFPL_MSG_LOG(sfpl_handle, SFPL_LOG_LEVEL_FATAL, area, \ + __PRETTY_FUNCTION__, __FILE__, __LINE__, msg) \ +} + +#define SFPL_LOG_ERROR(sfpl_handle, area, msg) \ +{ \ + _SFPL_MSG_LOG(sfpl_handle, SFPL_LOG_LEVEL_ERROR, area, \ + __PRETTY_FUNCTION__, __FILE__, __LINE__, msg) \ +} + +#define SFPL_LOG_WARNING(sfpl_handle, area, msg) \ +{ \ + _SFPL_MSG_LOG(sfpl_handle, SFPL_LOG_LEVEL_WARNING, area, \ + __PRETTY_FUNCTION__, __FILE__, __LINE__, msg) \ +} + +#define SFPL_LOG_INFO(sfpl_handle, area, msg) \ +{ \ + _SFPL_MSG_LOG(sfpl_handle, SFPL_LOG_LEVEL_INFO, area, \ + __PRETTY_FUNCTION__, __FILE__, __LINE__, msg) \ +} + +#define SFPL_LOG_DEBUG1(sfpl_handle, area, msg) \ +{ \ + _SFPL_MSG_LOG(sfpl_handle, SFPL_LOG_LEVEL_DEBUG1, area, \ + __PRETTY_FUNCTION__, __FILE__, __LINE__, msg) \ +} + +#define SFPL_LOG_DEBUG2(sfpl_handle, area, msg) \ +{ \ + _SFPL_MSG_LOG(sfpl_handle, SFPL_LOG_LEVEL_DEBUG2, area, \ + __PRETTY_FUNCTION__, __FILE__, __LINE__, msg) \ +} + +#define SFPL_LOG_DEBUG3(sfpl_handle, area, msg) \ +{ \ + _SFPL_MSG_LOG(sfpl_handle, SFPL_LOG_LEVEL_DEBUG3, area, \ + __PRETTY_FUNCTION__, __FILE__, __LINE__, msg) \ +} + +#define SFPL_LOG_DEBUG4(sfpl_handle, area, msg) \ +{ \ + _SFPL_MSG_LOG(sfpl_handle, SFPL_LOG_LEVEL_DEBUG4, area, \ + __PRETTY_FUNCTION__, __FILE__, __LINE__, msg) \ +} + +#define SFPL_LOG_DEBUG5(sfpl_handle, area, msg) \ +{ \ + _SFPL_MSG_LOG(sfpl_handle, SFPL_LOG_LEVEL_DEBUG5, area, \ + __PRETTY_FUNCTION__, __FILE__, __LINE__, msg) \ +} + +#define SFPL_LOG_DEBUG6(sfpl_handle, area, msg) \ +{ \ + _SFPL_MSG_LOG(sfpl_handle, SFPL_LOG_LEVEL_DEBUG6, area, \ + __PRETTY_FUNCTION__, __FILE__, __LINE__, msg) \ +} + +#define SFPL_LOG_DEBUG7(sfpl_handle, area, msg) \ +{ \ + _SFPL_MSG_LOG(sfpl_handle, SFPL_LOG_LEVEL_DEBUG7, area, \ + __PRETTY_FUNCTION__, __FILE__, __LINE__, msg) \ +} + +#define SFPL_LOG_DEBUG8(sfpl_handle, area, msg) \ +{ \ + _SFPL_MSG_LOG(sfpl_handle, SFPL_LOG_LEVEL_DEBUG8, area, \ + __PRETTY_FUNCTION__, __FILE__, __LINE__, msg) \ +} + +#define SFPL_LOG_DEBUG9(sfpl_handle, area, msg) \ +{ \ + _SFPL_MSG_LOG(sfpl_handle, SFPL_LOG_LEVEL_DEBUG9, area, \ + __PRETTY_FUNCTION__, __FILE__, __LINE__, msg) \ +} + +#define SFPL_LOG_DEBUG(sfpl_handle, area, msg) \ +{ \ + _SFPL_MSG_LOG(sfpl_handle, SFPL_LOG_LEVEL_DEBUG, area, \ + __PRETTY_FUNCTION__, __FILE__, __LINE__, msg) \ +} + +#define SFPL_LOG_TRACE_ENTER(sfpl_handle, area, msg) \ +{ \ + _SFPL_MSG_LOG(sfpl_handle, SFPL_LOG_LEVEL_TRACE, area, \ + SFPL_LOG_FUNC_ENTER, __FILE__, __LINE__, msg) \ +} + +#define SFPL_LOG_TRACE_EXIT(sfpl_handle, area, msg) \ +{ \ + _SFPL_MSG_LOG(sfpl_handle, SFPL_LOG_LEVEL_TRACE, area, \ + SFPL_LOG_FUNC_EXIT, __FILE__, __LINE__, msg) \ +} + +SFPL_API_PUBLIC int +SFPL_Startup(void); + +SFPL_API_PUBLIC void +SFPL_Shutdown(void); + +SFPL_API_PUBLIC void * +SFPL_LogHandleGet(SFPL_Handle sfpl_handle); + +SFPL_API_PUBLIC int +SFPL_LogLevelSet(SFPL_Handle sfpl_handle, + SFPL_Log_Level level, + SFPL_Log_Area areas); + +SFPL_API_PUBLIC int +SFPL_LogFunctionSet(SFPL_Handle sfpl_handle, + SFCL_Log_Func log_func); + +SFPL_API_PUBLIC void +SFPL_LogFileClose(); + +SFPL_API_PUBLIC int +SFPL_LogFileOpen(SFPL_Handle sfpl_handle); + +SFPL_API_PUBLIC int +SFPL_LogFilenameSet(SFPL_Handle sfpl_handle, + const char *name); + +SFPL_API_PUBLIC int +SFPL_LogFileOpen(SFPL_Handle sfpl_handle); + +SFPL_API_PUBLIC void +SFPL_PluginLogFunction(SFCL_Log_Level level, + SFCL_Log_Area area, + const char *message); + +SFPL_API_PUBLIC void +SFPL_LogRegister(char *ident); + +#define SFPL_LOG_OPTION_NONE_STRING "\"-\"" + + +/*--------------------------------------------------------------*\ + * + * Log Server Logging + * +\*--------------------------------------------------------------*/ +SFPL_API_PUBLIC void +SFPL_LogServerLog(SFPL_Handle sfpl_handle, + const char *client_hostname, + const char *request_url, + const char *client_username, + const char *zone_name, + const char *categories, + unsigned int bytes_xfer, + SFPL_Action_Code action); + +/*--------------------------------------------------------------*\ + * + * Filter Summary Logging + * +\*--------------------------------------------------------------*/ +SFPL_API_PUBLIC void +SFPL_LogFilterSummary(SFPL_Handle sfpl_handle, + const char *client_ip, + const char *username, + SFPL_User_Data *user_data, + const char *policy_name, + unsigned int policy_flags, + const char *url, + const char *all_cats, + const char *restricted_cats, + const char *redir_url, + int delay_time, + SFPL_Action_Code action); + +/*--------------------------------------------------------------*\ + * + * CATEGORIES + * +\*--------------------------------------------------------------*/ +SFPL_API_PUBLIC void +SFPL_CategoriesStringToCategories(SFPL_Handle sfpl_handle, + const char *str, + SFCL_Categories categories); + +SFPL_API_PUBLIC int +SFPL_CategoriesToSortedArray(SFPL_Handle sfpl_handle, + SFCL_Categories categories, + SFCL_Category *cat_array, + int *num_cats); + +SFPL_API_PUBLIC int +SFPL_CategoryCustomMessageGet(SFPL_Handle sfpl_handle, + SFCL_Category category, + SFPL_Action_Code action, + char *message, + int message_len); + +SFPL_API_PUBLIC const char * +SFPL_CategoryToName(SFPL_Handle sfpl_handle, + SFCL_Category category); + +/*--------------------------------------------------------------*\ + * + * CONFIG OPTIONS + * +\*--------------------------------------------------------------*/ +#define SFPL_LOG_OPTION_NONE 0 +#define SFPL_LOG_OPTION_RESTRICTED 1 +#define SFPL_LOG_OPTION_ALL_CATS 2 +#define SFPL_LOG_OPTION_ALL_URLS 3 + +/* Define NT Log options */ +#define SFPL_LOG_TYPE_TEXT 0 +#define SFPL_LOG_TYPE_MSSQL 2 +#define SFPL_LOG_TYPE_ACCESS 3 + +/*--------------------------------------------------------------*\ + * + * DOWNLOAD + * +\*--------------------------------------------------------------*/ +#define SFPL_MAX_DOWNLOAD_SITE 128 +#define SFPL_MAX_DOWNLOAD_ADDRESS 16 +#define SFPL_MAX_DOWNLOAD_USER 64 +#define SFPL_MAX_DOWNLOAD_PASS 32 +#define SFPL_MAX_DOWNLOAD_PATH 512 +#define SFPL_MAX_DOWNLOAD_FILE 256 +#define SFPL_MAX_DOWNLOAD_MSG 512 + +typedef enum SFPL_Download_Method +{ + SFPL_DOWNLOAD_METHOD_NONE, + SFPL_DOWNLOAD_METHOD_HTTP, + SFPL_DOWNLOAD_METHOD_ADMIN_SERVER_CONTROLLED +} SFPL_Download_Method; + +typedef enum SFPL_Download_Mode +{ + SFPL_DOWNLOAD_MODE_INCREMENTAL, + SFPL_DOWNLOAD_MODE_FULL, +} SFPL_Download_Mode; + +typedef struct SFPL_Http_Info +{ + char site[SFPL_MAX_DOWNLOAD_SITE]; + char address[SFPL_MAX_DOWNLOAD_ADDRESS]; + int port; + char username[SFPL_MAX_DOWNLOAD_USER]; + char password[SFPL_MAX_DOWNLOAD_PASS]; + char path[SFPL_MAX_DOWNLOAD_PATH]; /* Source HTTP Path */ + char proxy[SFPL_MAX_DOWNLOAD_SITE]; + int proxyport; +} SFPL_Http_Info; + +typedef struct SFPL_Download_Info +{ + SFPL_Download_Method method; + SFCL_List_Download_Mode mode; + SFPL_Http_Info http; +} SFPL_Download_Info; + + +/*--------------------------------------------------------------*\ + * + * FILENAMES + * +\*--------------------------------------------------------------*/ +#define SFPL_CONFIG_FILE_NAME "config.txt" +#define SFPL_SITE_FILE_NAME "site.txt" +#define SFPL_PATTERNS_FILE_NAME "patterns.txt" +#define SFPL_KEYWORDS_FILE_NAME "keywords.txt" +#define SFPL_USERS_FILE_NAME "users.txt" +#define SFPL_AGENT_FILE_NAME "sfagent.txt" +#define SFPL_PSERIAL_FILE_NAME "pserial.txt" +#define SFPL_CLIST_FILE_NAME "sfcontrol" + +/*--------------------------------------------------------------*\ + * + * FILTERING + * +\*--------------------------------------------------------------*/ + +SFPL_API_PUBLIC int +SFPL_UrlFilter(SFPL_Handle sfpl_handle, + SFPL_Policy *policy, + const char *url, + SFCL_Url parsed_url, + const char *dest_addr, + const char *username, + const char *client_ip, + SFPL_Action_Code *action, + int *delay_time, + char *redirurl, + int redirurl_len, + char *all_cats, + int all_cats_len, + char *restricted_cats, + int restricted_cats_len, + char **log_string, + char **reporter_string, + int *should_log); + +SFPL_API_PUBLIC SFPL_Action_Code +SFPL_Warn(SFPL_Handle sfpl_handle, + char *url, + char *referer_url, + char *range); + +/*--------------------------------------------------------------*\ + * + * CONFIG FILES + * +\*--------------------------------------------------------------*/ + +typedef enum +{ + SFPL_LOCK_READ = 0, + SFPL_LOCK_WRITE = 1 +} SFPL_Lock_Mode; + + +SFPL_API_PUBLIC int +SFPL_ConfigLock(SFPL_Handle sfpl_handle, + SFPL_Lock_Mode mode); + +SFPL_API_PUBLIC int +SFPL_ConfigUnlock(SFPL_Handle sfpl_handle, + SFPL_Lock_Mode mode); + +SFPL_API_PUBLIC int +SFPL_ProcessConfigFile(SFPL_Handle, + const char *, + char *); + +SFPL_API_PUBLIC int +SFPL_ProcessUserInfo(SFPL_Handle sfpl_handle, + const char *full_path, + char *err_msg, + int msg_len); + +SFPL_API_PUBLIC int +SFPL_ReloadConfigFile(SFPL_Handle, + const char *, + char *); + +SFPL_API_PUBLIC int +SFPL_ReloadControlList(SFPL_Handle, + const char *new_list); + +SFPL_API_PUBLIC int +SFPL_EnableExternalListAccess(SFPL_Handle sfpl_handle, + int value); + +SFPL_API_PUBLIC int +SFPL_GetControlListSerialNumber(SFPL_Handle, + int *); + +/*--------------------------------------------------------------*\ + * + * ACTIVATION + * +\*--------------------------------------------------------------*/ +/* + * Features + */ +#define SFPL_ACT_KEY_FEATURE_MERGE_TOOL 0x1 + +/* Define Activation Key codes */ +#define SFPL_ACT_OK 1 +#define SFPL_ACT_OLD15 15 +#define SFPL_ACT_OLD30 30 +#define SFPL_ACT_OLD60 60 +#define SFPL_ACT_GRACE 100 +#define SFPL_ACT_INVALID (-1) +#define SFPL_ACT_EXPIRED 0 + +typedef struct SFPL_ActivationKey +{ + int version; + char userID[6]; + int userLicenses; + int userLevel; + int level; + int expirationYear; + int expirationMonth; + int expirationDay; + int duration; + int features; +} SFPL_Activation_Key; + +SFPL_API_PUBLIC char * +SFPL_ActKeyCreate(SFPL_Handle sfpl_handle, + SFPL_Activation_Key *key); + +SFPL_API_PUBLIC int +SFPL_ActKeyDurationGet(SFPL_Handle sfpl_handle, + SFPL_Activation_Key *key); + +SFPL_API_PUBLIC int +SFPL_ActKeyExpirationDayGet(SFPL_Handle sfpl_handle, + SFPL_Activation_Key *key); + +SFPL_API_PUBLIC int +SFPL_ActKeyExpirationMonthGet(SFPL_Handle sfpl_handle, + SFPL_Activation_Key *key); + +SFPL_API_PUBLIC int +SFPL_ActKeyExpirationTimeCheck(SFPL_Handle sfpl_handle, + const time_t exp, + const time_t now); + +SFPL_API_PUBLIC time_t +SFPL_ActKeyExpirationTimeGet(SFPL_Handle sfpl_handle, + char *key_string); + +SFPL_API_PUBLIC int +SFPL_ActKeyExpirationYearGet(SFPL_Handle sfpl_handle, + SFPL_Activation_Key *key); + +SFPL_API_PUBLIC int +SFPL_ActKeyFeatureVerify(SFPL_Handle sfpl_handle, + int fbit, + SFPL_Activation_Key *key); + +SFPL_API_PUBLIC int +SFPL_ActKeyIsExpired(SFPL_Handle sfpl_handle, + char *key_string, + time_t installationTime); + +SFPL_API_PUBLIC int +SFPL_ActKeyIsValid(SFPL_Handle sfpl_handle, + char *serialNumber, + SFPL_Activation_Key *key); + +SFPL_API_PUBLIC int +SFPL_ActKeyMasterIdIsValid(SFPL_Handle sfpl_handle, + char *masterID); + +SFPL_API_PUBLIC int +SFPL_ActKeySmartFilterVersionGet(SFPL_Handle sfpl_handle, + SFPL_Activation_Key *key); + +SFPL_API_PUBLIC char * +SFPL_ActKeyUserIdGet(SFPL_Handle sfpl_handle, + SFPL_Activation_Key *key); + +SFPL_API_PUBLIC int +SFPL_ActKeyUserIdIsValid(SFPL_Handle sfpl_handle, + char *userID); + +SFPL_API_PUBLIC int +SFPL_ActKeyUserLevelGet(SFPL_Handle sfpl_handle, + SFPL_Activation_Key *key); + +/*--------------------------------------------------------------*\ + * + * REVERSE DNS + * +\*--------------------------------------------------------------*/ +/* + * Call to set a flag specifying DNS lookups should be performed externally. + */ +SFPL_API_PUBLIC int +SFPL_EnableExternalDNS(SFPL_Handle, + int); + + +/*--------------------------------------------------------------*\ + * + * MAIL + * +\*--------------------------------------------------------------*/ + +typedef struct +{ + char *primary_email; + char *secondary_email; + char *from_email; + char *mail_server; +} SFPL_Mail_Info; + +#define SFPL_MAIL_SUBJ_ADD_HOST 0x00000001 + +SFPL_API_PUBLIC int +SFPL_MailSend(SFPL_Handle sfpl_handle, + const char *subject, + const char *message, + unsigned int flags); + + + + + +/*--------------------------------------------------------------*\ + * + * Authentication Server + * +\*--------------------------------------------------------------*/ + +typedef struct { + int enabled; + char authserver_address[256]; + char authserver_hostname[256]; + int authserver_auth_port; + int authserver_ao_port; + char authserver_password[64]; + int block_on_fail; + SFUT_List exempt_ips; + SFUT_List exempt_urls; +} SFPL_Trans_Auth; + +SFPL_API_PUBLIC int +SFPL_TransauthCheck(SFPL_Handle sfpl_handle, + SFCL_Url processed_url, + const char *url, + const char *ipaddr, + char *username, + size_t username_len); + +SFPL_API_PUBLIC int +SFPL_TransauthUserGet(SFPL_Handle sfpl_handle, + const char *ipaddr, + char *username, + size_t username_len); + +SFPL_API_PUBLIC int +SFPL_TransauthUserIdentify(SFPL_Handle sfpl_handle, + const char *ipaddr, + char *username, + size_t usernamelen, + int *block_on_fail); + +SFPL_API_PUBLIC int +SFPL_TransauthRedirUrlBuild(SFPL_Handle sfpl_handle, + const char *ipaddr, + const char *original_url, + char *redir_url, + size_t redir_url_len); + +SFPL_API_PUBLIC int /* Needed for Squid */ +SFPL_TransauthUserCacheAdd(SFPL_Handle sfpl_handle, + const char *ipaddr, + const char *username, + time_t timeout_hard, + time_t timeout_soft); + +SFPL_API_PUBLIC int +SFPL_TransauthUserTimeoutsGet(SFPL_Handle sfpl_handle, + const char *ipaddr, + time_t *timeout_hard, + time_t *timout_soft); + +#if defined(__cplusplus) +} +#endif /* __cplusplus */ + +#endif /* SFPL_PLUGIN_H */ + diff -uN ../squid-2.5.STABLE14.orig/include/sf_util.h include/sf_util.h --- ../squid-2.5.STABLE14.orig/include/sf_util.h 1969-12-31 19:00:00.000000000 -0500 +++ include/sf_util.h 2006-08-14 12:06:38.000000000 -0400 @@ -0,0 +1,901 @@ +/*--------------------------------------------------------------------------*\ + * + * SmartFilter Utility Library + * + * Copyright (c) 2003-2006, Secure Computing Corporation. All rights reserved. + * + * $RCSfile: sf_util.h,v $ + * $Revision: 1.2.2.5 $ + * $Date: 2006/08/14 16:06:38 $ + * $State: Exp $ +\*--------------------------------------------------------------------------*/ + +#ifndef _SF_UTIL_H +#define _SF_UTIL_H + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#ifdef WIN32 +# include +# include +# ifdef __FUNCTION__ +# define __PRETTY_FUNCTION__ __FUNCTION__ +# else /* __FUNCTION__ */ +# define __PRETTY_FUNCTION__ "Unknown" +# endif /* __FUNCTION__ */ +#else /* WIN32 */ +# include +# include +#endif /* WIN32 */ + +#ifdef WIN32 +# ifdef SFUT_API_BUILD +# define SFUT_API_PUBLIC __declspec(dllexport) +# else /* SFUT_API_BUILD */ +# define SFUT_API_PUBLIC __declspec(dllimport) +# endif /* SFUT_API_BUILD */ +#else +# define SFUT_API_PUBLIC extern +#endif /* WIN32 */ + +#define SFUT_API_INTERNAL extern +#define SFUT_API_PRIVATE static + +#ifndef SFUT_API_PROTECTED_BUILD +# define SFUT_API_PROTECTED extern +#else /* SFUT_API_PROTECTED_BUILD */ +# define SFUT_API_PROTECTED SFUT_API_PUBLIC +#endif /* SFUT_API_PROTECTED_BUILD */ + + +/* + * General + */ +#ifdef WIN32 + typedef unsigned __int64 SFUT_Int64; +# define SFUT_Getcwd(buf, len) _getcwd(buf, len) +# define SFUT_PATH_SEP_CHAR '\\' +#else /* WIN32 */ +# define SFUT_Getcwd(buf, len) getcwd(buf, len) + typedef unsigned long long SFUT_Int64; +# define SFUT_PATH_SEP_CHAR '/' +#endif /* WIN32 */ + +typedef unsigned char SFUT_Bool; +#define SFUT_FALSE 0 +#define SFUT_TRUE 1 + +/* + * Errors + */ +#ifdef WIN32 + #define SFUT_LastError() GetLastError() +#else /* WIN32 */ + #define SFUT_LastError() errno +#endif /* WIN32 */ +/* + * Base 64 + */ +SFUT_API_PUBLIC int +SFUT_Base64Encode(const unsigned char *in, + int in_size, + char *out, + int out_size); +SFUT_API_PUBLIC int +SFUT_Base64Decode(const char *in, + char *out, + int out_size, + int *decoded_len); + + +/* + * File + */ +#include +#include +#include +#include +#include +#ifndef NAME_MAX +# define NAME_MAX 1024 +#endif /* NAME_MAX */ + + +#ifdef WIN32 +# define O_APPEND _O_APPEND +# define O_CREAT _O_CREAT +# define O_EXCL _O_EXCL +# define O_RDONLY _O_RDONLY +# define O_RDWR _O_RDWR +# define O_TRUNC _O_TRUNC +# define O_WRONLY _O_WRONLY +# define O_TEXT _O_TEXT +# define O_BINARY _O_BINARY + +# define A_HIDDEN _A_HIDDEN +# define A_NORMAL _A_NORMAL +# define A_RDONLY _A_RDONLY +# define A_SUBDIR _A_SUBDIR +# define S_IRWXU (_S_IREAD | _S_IWRITE) +# define S_IRUSR _S_IREAD +# define S_IWUSR _S_IWRITE +# define S_IXUSR (_S_IREAD | _S_IWRITE) +# define S_IRWXG (_S_IREAD | _S_IWRITE) +# define S_IRGRP _S_IREAD +# define S_IWGRP _S_IWRITE +# define S_IXGRP (_S_IREAD | _S_IWRITE) +# define S_IRWXO (_S_IREAD | _S_IWRITE) +# define S_IROTH _S_IREAD +# define S_IWOTH _S_IWRITE +# define S_IXOTH (_S_IREAD | _S_IWRITE) +#else /* WIN32 */ +# define O_BINARY 0 +# define O_TEXT 0 +# define A_SUBDIR 1 +#endif /* WIN32 */ + +#ifdef WIN32 +typedef struct _stat SFUT_File_Stat; +#else /* WIN32 */ +typedef struct stat SFUT_File_Stat; +#endif /* WIN32 */ +typedef int SFUT_File; +SFUT_API_PUBLIC int +SFUT_FileOpen(SFUT_File *f, + const char *name, + int flags, + int mode); + +SFUT_API_PUBLIC int +SFUT_FileClose(SFUT_File *f); + +SFUT_API_PUBLIC int +SFUT_FileWrite(SFUT_File *f, + const void *buffer, + size_t len); + +SFUT_API_PUBLIC int +SFUT_FileRead(SFUT_File *f, + void *buffer, + size_t len, + size_t *bytes_read); + +SFUT_API_PUBLIC int +SFUT_FileSeek(SFUT_File *f, + int offset, + int whence, + long *result_offset); + +SFUT_API_PUBLIC int +SFUT_FileSize(SFUT_File *f, + size_t *size); + +SFUT_API_PUBLIC int +SFUT_FileStat(const char *filename, + SFUT_File_Stat *statbuf); + +SFUT_API_PUBLIC int +SFUT_FileRemove(const char *name); + +SFUT_API_PUBLIC int +SFUT_FileRename(const char *prev_name, const char *new_name); + +/* + * List + */ +typedef struct sfut_list *SFUT_List; +typedef struct sfut_list_entry +{ + struct sfut_list_entry *prev; + struct sfut_list_entry *next; +} SFUT_List_Entry; + +typedef int (*SFUT_List_Iterate_Func)(SFUT_List_Entry *le, void *arg); +typedef void (*SFUT_List_Show_Func)(SFUT_List_Entry *le, void *arg, FILE *fp); + +SFUT_API_PUBLIC int +SFUT_ListCreate(SFUT_List *l); + +SFUT_API_PUBLIC int +SFUT_ListAdd(SFUT_List l, + SFUT_List_Entry *le); + +SFUT_API_PUBLIC SFUT_List_Entry * +SFUT_ListFind(SFUT_List l, + SFUT_List_Entry *le); + +SFUT_API_PUBLIC SFUT_List_Entry * +SFUT_ListGetFirst(SFUT_List l); + +SFUT_API_PUBLIC SFUT_List_Entry * +SFUT_ListGetNext(SFUT_List l, + SFUT_List_Entry *le); + +SFUT_API_PUBLIC int +SFUT_ListRemove(SFUT_List l, + SFUT_List_Entry *le); + +SFUT_API_PUBLIC SFUT_List_Entry * +SFUT_ListRemoveHead(SFUT_List l); + +SFUT_API_PUBLIC SFUT_List_Entry * +SFUT_ListRetrieve(SFUT_List l); + +SFUT_API_PUBLIC int +SFUT_ListCount(SFUT_List l, + int *count); + +SFUT_API_PUBLIC int +SFUT_ListIterate(SFUT_List l, + SFUT_List_Iterate_Func f, + void *arg); + +SFUT_API_PUBLIC void +SFUT_ListShow(SFUT_List l, + SFUT_List_Show_Func f, + void *arg, + FILE *fp); + +SFUT_API_PUBLIC void +SFUT_ListDestroy(SFUT_List l); + + +/* + * OS + */ +SFUT_API_PUBLIC int +SFUT_OSNameGet(char *name, + size_t name_len); + + +/* + * Memory + */ +SFUT_API_PUBLIC int +SFUT_MemInit(void); + +#ifdef SFUTMEMINTERNAL +# define SFUT_MemAlloc(bytes) SFUT_MemAlloc_((bytes), \ + __FILE__, \ + __PRETTY_FUNCTION__, \ + __LINE__) + +# define SFUT_MemRealloc(ptr, bytes) SFUT_MemRealloc_((ptr), \ + (bytes), \ + __FILE__, \ + __PRETTY_FUNCTION__, \ + __LINE__) + +# define SFUT_MemFree(ptr) SFUT_MemFree_((ptr), \ + __FILE__, \ + __PRETTY_FUNCTION__, \ + __LINE__) +#else /* SFUTMEMINTERNAL */ +# define SFUT_MemAlloc(bytes) malloc(bytes) +# define SFUT_MemRealloc(ptr, bytes) realloc(ptr, bytes) +# define SFUT_MemFree(ptr) free(ptr) +#endif /* SFUTMEMINTERNAL */ + +SFUT_API_PUBLIC void * +SFUT_MemAlloc_(size_t bytes, + const char *file, + const char *function, + int line); + +SFUT_API_PUBLIC void * +SFUT_MemRealloc_(void *ptr, + size_t bytes, + const char *file, + const char *function, + int line); + +SFUT_API_PUBLIC void +SFUT_MemFree_(void *ptr, + const char *file, + const char *function, + int line); + +SFUT_API_PUBLIC void +SFUT_MemShow(FILE *fp); + +SFUT_API_PUBLIC int +sfut_mem_check(); + + +/* + * Mapped Memory + */ +SFUT_API_PUBLIC int +SFUT_MemMapInit(void); + +#define SFUT_MemMapAlloc(filename) SFUT_MemMapAlloc_((filename), \ + __FILE__, \ + __PRETTY_FUNCTION__, \ + __LINE__) +SFUT_API_PUBLIC void * +SFUT_MemMapAlloc_(const char *filename, + const char *file, + const char *function, + int line); + +#define SFUT_MemMapFree(ptr) SFUT_MemMapFree_((ptr), \ + __FILE__, \ + __PRETTY_FUNCTION__, \ + __LINE__) + +SFUT_API_PUBLIC void +SFUT_MemMapFree_(void *ptr, + const char *filename, + const char *file, + int line); + +SFUT_API_PUBLIC void +SFUT_MemMapShow(FILE *fp); + +SFUT_API_PUBLIC int +sfut_memmap_check(); + +/* + * Memory Pool + */ +typedef struct sfut_mem_pool *SFUT_Mem_Pool; + +SFUT_API_PUBLIC int +SFUT_MemPoolCreate(SFUT_Mem_Pool *mp, + size_t entry_size, + size_t num_entries); + +#define SFUT_MemPoolAlloc(mp) SFUT_MemPoolAlloc_((mp), \ + __FILE__, \ + __PRETTY_FUNCTION__, \ + __LINE__) + +SFUT_API_PUBLIC void * +SFUT_MemPoolAlloc_(SFUT_Mem_Pool mp, + const char *file, + const char *function, + int line); + +#define SFUT_MemPoolFree(mp, arg) SFUT_MemPoolFree_((mp), \ + (arg), \ + __FILE__, \ + __PRETTY_FUNCTION__, \ + __LINE__) + +SFUT_API_PUBLIC void +SFUT_MemPoolFree_(SFUT_Mem_Pool mp, + void *arg, + const char *file, + const char *function, + int line); + +SFUT_API_PUBLIC void +SFUT_MemPoolDestroy(SFUT_Mem_Pool mp); + +SFUT_API_PUBLIC void +SFUT_MemPoolShow(SFUT_Mem_Pool mp, + FILE *fp); + + + + + +/* + * Queue + */ +typedef struct _sf_queue *SFUT_Queue; + +SFUT_API_PUBLIC int +SFUT_QueueCreate(SFUT_Queue *q); + +SFUT_API_PUBLIC int +SFUT_QueueAdd(SFUT_Queue q, + void *id, + void *data); + +SFUT_API_PUBLIC int +SFUT_QueueRemove(SFUT_Queue q, + void **id, + void **data); + +SFUT_API_PUBLIC int +SFUT_QueueCount(SFUT_Queue q, + int *count); + +SFUT_API_PUBLIC int +SFUT_QueueDestroy(SFUT_Queue q); + + + + +/* + * Socket + */ +#ifdef WIN32 +# include +# include +#else /* WIN32 */ +# ifndef BSD_COMP +# define BSD_COMP +# endif /* BSD_COMP */ +# include +# include +# include +# include +# include +# include +# include +#endif + +#define SFUT_TIME_INFINITE (-1) +typedef struct SFUT_Socket +{ +#ifdef WIN32 + SOCKET socket; +#else /* WIN32 */ + int socket; +#endif /* WIN32 */ +} SFUT_Socket; + +#ifndef INADDR_NONE +#define INADDR_NONE 0xffffffff +#endif + +typedef struct in_addr SFUT_IP_Addr; + +SFUT_API_PUBLIC int +SFUT_SocketInit(void); + +SFUT_API_PUBLIC int +SFUT_SocketCleanup(void); + +SFUT_API_PUBLIC int +SFUT_SocketCreate(SFUT_Socket *s); + +SFUT_API_PUBLIC int +SFUT_SocketCreateUDP(SFUT_Socket *s); + +SFUT_API_PUBLIC int +SFUT_SocketClose(SFUT_Socket *s); + +SFUT_API_PUBLIC int +SFUT_SocketWrite(SFUT_Socket s, + const char *buffer, + size_t len); + +SFUT_API_PUBLIC int +SFUT_SocketWriteTo(SFUT_Socket s, + const char *buffer, + size_t buf_len, + const struct sockaddr *to, + int to_len); + +SFUT_API_PUBLIC int +SFUT_SocketRead(SFUT_Socket s, + char *buffer, + size_t len); + +SFUT_API_PUBLIC int +SFUT_SocketReadFrom(SFUT_Socket s, + char *buffer, + size_t len, + struct sockaddr *from, + int *from_len); + +SFUT_API_PUBLIC int +SFUT_SocketPeek(SFUT_Socket s, + char *buffer, + size_t len); + +SFUT_API_PUBLIC int +SFUT_SocketConnect(SFUT_Socket s, + SFUT_IP_Addr addr, + unsigned short port); + +SFUT_API_PUBLIC int +SFUT_SocketBind(SFUT_Socket s, + SFUT_IP_Addr addr, + unsigned short port); + +SFUT_API_PUBLIC int +SFUT_SocketListen(SFUT_Socket s, + size_t backlog); + +SFUT_API_PUBLIC int +SFUT_SocketAccept(SFUT_Socket s, + SFUT_Socket *ns, + SFUT_IP_Addr *ip); + +SFUT_API_PUBLIC int +SFUT_SocketError(void); + +SFUT_API_PUBLIC int +SFUT_SocketWait(SFUT_Socket s, + int read, + int write, + int milliseconds); + +SFUT_API_PUBLIC int +SF_SocketAvailableReadBytes(SFUT_Socket s); + +SFUT_API_PUBLIC int +SFUT_SocketNameToAddr(const char *name, + SFUT_IP_Addr *ip, + int *error); + +SFUT_API_PUBLIC int +SFUT_SocketAddrToName(const char *ip, + char *name, + size_t name_len); + + + + +/* + * Threads + */ +# ifdef WIN32 +# include +# include +# include +# define THREAD_ENTRYTYPE WINAPI +typedef HANDLE SFUT_Thread; +typedef DWORD SFUT_ThreadId; +typedef CRITICAL_SECTION SFUT_Mutex; +typedef struct SFUT_Cond +{ + CRITICAL_SECTION waiters_lock; + int waiters_count; + HANDLE events[2]; +} SFUT_Cond; +# else /* WIN32 */ +# include +# include +# define THREAD_ENTRYTYPE +typedef pthread_t SFUT_Thread; +typedef pthread_t SFUT_ThreadId; +typedef void *(*SFUT_PTHREAD_START_ROUTINE) (void *arg); +typedef pthread_mutex_t SFUT_Mutex; +typedef pthread_cond_t SFUT_Cond; +#endif /* WIN32 */ + +typedef struct sfut_semaphore +{ + int magic; + + /* lock counters */ + int write_lock; + int read_lock; + + /* mutual exclusion protection for lock counters */ + SFUT_Mutex mutex; + + /* Signals release of write lock */ + SFUT_Cond wtest; + + /* Signals release of final read lock */ + SFUT_Cond rtest; + +} SFUT_Semaphore; + +typedef int (THREAD_ENTRYTYPE *SFUT_Thread_Func)(void *arg); + +#define SFUT_THREAD_STACK_SIZE_DEFAULT 0 + +SFUT_API_PUBLIC int +SFUT_ThreadCreate(SFUT_Thread *t, + size_t stack_size, + SFUT_Thread_Func func, + void *arg); + +SFUT_API_PUBLIC void +SFUT_ThreadSleep(int milliseconds); + +SFUT_API_PUBLIC void +SFUT_ThreadStop(SFUT_Thread *t); + +SFUT_API_PUBLIC void +SFUT_ThreadExit(SFUT_Thread *t, + int exit_value); + +SFUT_API_PUBLIC SFUT_Thread +SFUT_ThreadSelf(void); + +SFUT_API_PUBLIC SFUT_ThreadId +SFUT_ThreadSelfId(void); + + + +/* + * Mutexes + */ +SFUT_API_PUBLIC int +SFUT_MutexCreate(SFUT_Mutex *m); + +SFUT_API_PUBLIC int +SFUT_MutexLock(SFUT_Mutex *m); + +SFUT_API_PUBLIC int +SFUT_MutexUnlock(SFUT_Mutex *m); + +SFUT_API_PUBLIC void +SFUT_MutexDestroy(SFUT_Mutex *m); + + + + +/* + * Conditions + */ +SFUT_API_PUBLIC int +SFUT_CondCreate(SFUT_Cond *c); + +SFUT_API_PUBLIC int +SFUT_CondSignal(SFUT_Cond *c); + +SFUT_API_PUBLIC int +SFUT_CondBroadcast(SFUT_Cond *c); + +SFUT_API_PUBLIC int +SFUT_CondWait(SFUT_Cond *c, + SFUT_Mutex *m); + +SFUT_API_PUBLIC void +SFUT_CondDestroy(SFUT_Cond *c); + + +/* + * Semaphores + */ +SFUT_API_PUBLIC int +SFUT_SemaphoreCreate(SFUT_Semaphore *s); + +SFUT_API_PUBLIC int +SFUT_SemaphoreReadLock(SFUT_Semaphore *s); + +SFUT_API_PUBLIC int +SFUT_SemaphoreReadUnlock(SFUT_Semaphore *s); + +SFUT_API_PUBLIC int +SFUT_SemaphoreWriteUnlock(SFUT_Semaphore *s); + +SFUT_API_PUBLIC int +SFUT_SemaphoreWriteLock(SFUT_Semaphore *s); + +SFUT_API_PUBLIC void +SFUT_SemaphoreDestroy(SFUT_Semaphore *s); + + + + + +/* + * Thread Pool + */ +typedef struct _sfut_thread_pool SFUT_Thread_Pool; + +SFUT_API_PUBLIC int +SFUT_ThreadPoolCreate(SFUT_Thread_Pool **p, + size_t stack_size, + int num_threads); + +SFUT_API_PUBLIC int +SFUT_ThreadPoolAddJob(SFUT_Thread_Pool *p, + void *job_id, + SFUT_Thread_Func func, + void *arg); + +SFUT_API_PUBLIC int +SFUT_ThreadPoolRemoveJob(SFUT_Thread_Pool *p, + void *job_id); + +SFUT_API_PUBLIC int +SFUT_ThreadPoolDestroy(SFUT_Thread_Pool *p); + + +/* + * Network + */ +SFUT_API_PUBLIC int +SFUT_IsIP(const char *str); + +SFUT_API_PUBLIC int +SFUT_InetNtoa(unsigned long addr, + char *str, + size_t str_len); + +SFUT_API_PUBLIC int +SFUT_InetAton(const char *addr_str, + unsigned long *addr); + + +/* + * RFC 1738 + */ +SFUT_API_PUBLIC void +SFUT_RFC1738Escape(char *dest, + const unsigned char *src, + size_t src_len); + +SFUT_API_PUBLIC void +SFUT_RFC1738Unescape(unsigned char *str, + size_t *unescaped_len); + + +/* + * Strings + */ +#include +SFUT_API_PUBLIC int +SFUT_Vsnprintf(char *str, + size_t size, + const char *format, + va_list ap); + +SFUT_API_PUBLIC int +SFUT_Snprintf(char *str, + size_t size, + const char *format, + ...); + +SFUT_API_PUBLIC int +SFUT_Stristr(const char *s, + const char *find, + char **result); + +SFUT_API_PUBLIC int +SFUT_Strncat(char *dest, + const char *src, + size_t n); + +SFUT_API_PUBLIC int +SFUT_Strncpy(char *dest, + const char *src, + size_t n); + +SFUT_API_PUBLIC int +SFUT_Strcasecmp(const char *s1, + const char *s2); + +SFUT_API_PUBLIC int +SFUT_Strncasecmp(const char *s1, + const char *s2, + size_t n); + +/* + * Time + */ +SFUT_API_PUBLIC int +SFUT_TimeLocalGet(const time_t *clock, + struct tm *local); + +SFUT_API_PUBLIC int +SFUT_TimezoneGMTOffsetGet(void); + + +/* + * MD4 functions. + */ +typedef struct { + unsigned long int state[4]; /* state (ABCD) */ + unsigned long int count[2]; /* number of bits, modulo 2^64 (lsb first) */ + unsigned char buffer[64]; /* input buffer */ +} SFUT_MD4_CTX; + +SFUT_API_PUBLIC void +SFUT_MD4Init(SFUT_MD4_CTX *); + +SFUT_API_PUBLIC void +SFUT_MD4Update(SFUT_MD4_CTX *, + const unsigned char *, + unsigned int); + +SFUT_API_PUBLIC void +SFUT_MD4Final(unsigned char[12], + SFUT_MD4_CTX *); + +/* + * CRC32 functions. + */ + +SFUT_API_PUBLIC unsigned long +SFUT_CRC32Init(); + +SFUT_API_PUBLIC unsigned long +SFUT_CRC32Proc(unsigned char *buf, + size_t len, + unsigned long crc); + +SFUT_API_PUBLIC unsigned long +SFUT_CRC32Term(unsigned long crc); + +SFUT_API_PUBLIC unsigned long +SFUT_UpdateCRC32(unsigned char ch, + unsigned long crc); + +SFUT_API_PUBLIC int +SFUT_CRC32File(char *name, + unsigned long *crc, + long *charcnt); + +SFUT_API_PUBLIC unsigned long +SFUT_CRC32Buf(char *buf, + size_t len); + +/* + * Byte swapping + */ +#ifdef BIGENDIAN +# define SFUT_Swap64(x) ( \ + (((x) & 0x00000000000000ff) << 56) | \ + (((x) & 0x000000000000ff00) << 40) | \ + (((x) & 0x0000000000ff0000) << 24) | \ + (((x) & 0x00000000ff000000) << 8) | \ + (((x) & 0x000000ff00000000) >> 8) | \ + (((x) & 0x0000ff0000000000) >> 24) | \ + (((x) & 0x00ff000000000000) >> 40) | \ + (((x) & 0xff00000000000000) >> 56) \ +) + +# define SFUT_Swap32(x) ( \ + (((x) & 0x000000ff) << 24) | \ + (((x) & 0x0000ff00) << 8) | \ + (((x) & 0x00ff0000) >> 8) | \ + (((x) & 0xff000000) >> 24) \ +) + +# define SFUT_Swap16(x) ( \ + (((x) & 0x00ff) << 8) | \ + (((x) & 0xff00) >> 8) \ +) + +#else /* BIGENDIAN */ +# define SFUT_Swap64(x) x +# define SFUT_Swap32(x) x +# define SFUT_Swap16(x) x +#endif /* BIGENDIAN */ + + +/* + * Search Tree + */ +typedef void (*SFUT_TREE_FREE_FUNC)(void *); +typedef struct sfut_tree *SFUT_Tree; + +SFUT_API_PUBLIC int +SFUT_TreeCreate(SFUT_Tree *t); + +SFUT_API_PUBLIC int +SFUT_TreeInsert(SFUT_Tree t, + void *key, + void *data); + +SFUT_API_PUBLIC void +SFUT_TreeShow(SFUT_Tree t); + +SFUT_API_PUBLIC int +SFUT_TreeCount(SFUT_Tree tree); + +SFUT_API_PUBLIC int +SFUT_TreeLocate(SFUT_Tree t, + void *key, + void **data); + +SFUT_API_PUBLIC int +SFUT_TreeRemove(SFUT_Tree t, + void *key, + void **data); + +SFUT_API_PUBLIC int +SFUT_TreeDestroy(SFUT_Tree t, + SFUT_TREE_FREE_FUNC free_func); + + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* SF_UTIL_H */ diff -uN ../squid-2.5.STABLE14.orig/include/sfagentipc.h include/sfagentipc.h --- ../squid-2.5.STABLE14.orig/include/sfagentipc.h 1969-12-31 19:00:00.000000000 -0500 +++ include/sfagentipc.h 2005-04-05 12:39:39.000000000 -0400 @@ -0,0 +1,351 @@ + +#ifndef INCLUDE_SFA_COMM_IPC_H +#define INCLUDE_SFA_COMM_IPC_H + +# ifdef __cplusplus +extern "C" { +# endif /* __cplusplus */ + +/*--------------------------------------------------------------*\ + * + * Definitions + * +\*--------------------------------------------------------------*/ +/* + * Makes calls to SFA_Comm_Recvmsg and SFA_Comm_Sendmsg + * block until a message is received or sent respectively. + */ +#define SFA_COMM_TIMEOUT_INFINITE 0xffffffff + +/* + * Makes calls to SFA_Comm_Recvmsg and SFA_Comm_Sendmsg + * wait a relatively long time (30 minutes) until a message + * is received or sent respectively. + */ +#define SFA_COMM_TIMEOUT_LONG (60 * 30) + +/* + * Makes calls to SFA_Comm_Recvmsg and SFA_Comm_Sendmsg + * wait a midrange amount of time (10 minutes) until a message + * is received or sent respectively. + */ +#define SFA_COMM_TIMEOUT_MEDIUM (60 * 10) + +/* + * Lengths of strings + */ +#define SFA_COMM_VERSION_LEN 80 +#define SFA_COMM_PLUGIN_LEN 30 +#define SFA_COMM_PLATFORM_LEN 30 +#define SFA_COMM_FILENAME_LEN 1024 +#define SFA_COMM_USERNAME_LEN 1024 +#define SFA_COMM_URL_LEN SFPL_MAX_URL + + + +/*--------------------------------------------------------------*\ + * + * Types + * +\*--------------------------------------------------------------*/ + +/* + * Values to be returned by functions. SFA_COMM_RETURN_OK + * is the only non-error return. + */ +typedef enum { + SFA_COMM_RETURN_FIRST = 1, /* Must be first */ + + /* + * All platforms + */ + SFA_COMM_RETURN_OK, + SFA_COMM_RETURN_ERROR, + SFA_COMM_RETURN_INVALID_HANDLE, + SFA_COMM_RETURN_INVALID_MSG_TYPE, + SFA_COMM_RETURN_INVALID_PARAMETER, + SFA_COMM_RETURN_MALFORMED_MESSAGE, + SFA_COMM_RETURN_NO_COMM_CHANNEL, + SFA_COMM_RETURN_CONNECT, + SFA_COMM_RETURN_SEND, + SFA_COMM_RETURN_SEND_TIMEOUT, + SFA_COMM_RETURN_RECEIVE, + SFA_COMM_RETURN_RECEIVE_TIMEOUT, + SFA_COMM_RETURN_NO_MEMORY, + SFA_COMM_RETURN_CONNECTION_CLOSED, + +#ifdef WIN32 + /* + * Windows only + */ + SFA_COMM_RETURN_CREATEPIPE, + SFA_COMM_RETURN_WAITNAMEDPIPE, + SFA_COMM_RETURN_OPENPIPE, + SFA_COMM_RETURN_WAITFAILED, + SFA_COMM_RETURN_OVERLAPPEDFAILED, + +#else /* WIN32 */ + + /* + * UNIX only + */ + SFA_COMM_RETURN_MALFORMED_MESSAGE_HEADER, + SFA_COMM_RETURN_SELECT, + SFA_COMM_RETURN_ACCEPT, + SFA_COMM_RETURN_UNLINK, + SFA_COMM_RETURN_SOCKET, + SFA_COMM_RETURN_BIND, + SFA_COMM_RETURN_LISTEN, +#endif /* WIN32 */ + + SFA_COMM_RETURN_LAST, /* Must be last */ +} SFA_Comm_Return_Type; + +/* + * Types of messages that are sent between the client and the server + */ +typedef enum { + SFA_COMM_MSG_FIRST = 1, /* Must be first */ + + /* Request messages (sent by client) */ + SFA_COMM_MSG_PLUGIN_INFO, + SFA_COMM_MSG_PLUGIN_RELOAD_CONFIG, + SFA_COMM_MSG_PLUGIN_RELOAD_CONTROL_LIST, + SFA_COMM_MSG_PLUGIN_ADD_AUTHOVER_USER, + SFA_COMM_MSG_PLUGIN_REMOVE_AUTHOVER_USER, + SFA_COMM_MSG_PLUGIN_ADD_BYPASS_USER, + + /* Response messages (sent by server) */ + SFA_COMM_MSG_PLUGIN_INFO_RESP, + SFA_COMM_MSG_PLUGIN_RELOAD_CONFIG_RESP, + SFA_COMM_MSG_PLUGIN_RELOAD_CONTROL_LIST_RESP, + SFA_COMM_MSG_PLUGIN_ADD_AUTHOVER_USER_RESP, + SFA_COMM_MSG_PLUGIN_REMOVE_AUTHOVER_USER_RESP, + SFA_COMM_MSG_PLUGIN_ADD_BYPASS_USER_RESP, + + SFA_COMM_MSG_LAST, /* Must be last */ +} SFA_Comm_Msg_Type; + +/* + * Used to hold the results of an SFA_COMM_MSG_PLUGIN_INFO_RESP + * response which is returned in response to an + * SFA_COMM_MSG_PLUGIN_INFO request. + */ +typedef struct { + SFA_Comm_Return_Type remote_status; + char version[SFA_COMM_VERSION_LEN + 1]; + char plugin_name[SFA_COMM_PLUGIN_LEN + 1]; + char platform_name[SFA_COMM_PLATFORM_LEN + 1]; +} SFA_Comm_Plugin_Info; + +/* + * Specifies the information to be sent in an + * SFA_COMM_MSG_RELOAD_CONFIG request. + */ +typedef struct { + SFA_Comm_Return_Type remote_status; + char filename[SFA_COMM_FILENAME_LEN + 1]; +} SFA_Comm_Plugin_Reload_Config; + +/* + * Specifies the information to be sent in an + * SFA_COMM_MSG_PLUGIN_RELOAD_CONTROL_LIST request. + */ +typedef struct { + SFA_Comm_Return_Type remote_status; + char filename[SFA_COMM_FILENAME_LEN + 1]; +} SFA_Comm_Plugin_Reload_Control_List; + + +/* + * Specifies the information to be sent in an + * SFA_COMM_MSG_PLUGIN_ADD_AUTHOVER_USER request. + */ +typedef struct { + SFA_Comm_Return_Type remote_status; + char authover_username[SFA_COMM_USERNAME_LEN]; + char username[SFA_COMM_USERNAME_LEN]; + char client_ip[20]; + unsigned int duration; + char url[SFA_COMM_URL_LEN]; + char reason[80]; + char reasondata[80]; + time_t date; +} SFA_Comm_Plugin_Add_AuthOver_User; + +/* + * Specifies the information to be sent in an + * SFA_COMM_MSG_PLUGIN_REMOVE_AUTHOVER_USER request. + */ +typedef SFA_Comm_Plugin_Add_AuthOver_User SFA_Comm_Plugin_Remove_AuthOver_User; + +/* + * Specifies the information to be sent in an + * SFA_COMM_MSG_PLUGIN_ADD_BYPASS_USER request. + */ +typedef struct { + SFA_Comm_Return_Type remote_status; + char username[SFA_COMM_USERNAME_LEN]; + char client_ip[20]; + char url[SFA_COMM_URL_LEN]; + char reason[80]; + char reasondata[80]; + time_t date; +} SFA_Comm_Plugin_Add_Bypass_User; + +/* + * An opaque definition of the SmartFilter Agent Communications Handle + */ +typedef struct SFA_Comm_Handle_s SFA_Comm_Handle; + + + + +/*--------------------------------------------------------------*\ + * + * Prototypes + * +\*--------------------------------------------------------------*/ + +/*--------------------------------------------------------------*\ + * + * Name: SFA_Comm_Client_Init + * + * Purpose: Used by the client to initialize the communications + * layer. + * + * Parameters: out - hdl - Filled in with a handle to the opened + * communications layer. + * + * Notes: Call SFA_Comm_End to close the communications layer. + * +\*--------------------------------------------------------------*/ +SFA_Comm_Return_Type +SFA_Comm_Client_Init(SFA_Comm_Handle **hdl, + SFPL_Handle sfpl_handle); + +/*--------------------------------------------------------------*\ + * + * Name: SFA_Comm_Server_Init + * + * Purpose: Used by the server to initialize the communications + * layer. + * + * Parameters: out - hdl - Filled in with a handle to the opened + * communications layer. + * + * Notes: Call SFA_Comm_End to close the communications layer. + * +\*--------------------------------------------------------------*/ +SFA_Comm_Return_Type +SFA_Comm_Server_Init(SFA_Comm_Handle **hdl, + SFPL_Handle sfpl_handle); + +/*--------------------------------------------------------------*\ + * + * Name: SFA_Comm_Recvmsg + * + * Purpose: Receives a message from the other end of the + * communications channel. + * + * Parameters: in - hdl - must be the handle returned by + * SFA_Comm_[Client|Server]_Init. + * out - type - the type of message that was + * received -- must not be NULL. + * out - info - set to point to allocated memory that + * must be freed by the caller after the + * caller is finished with the received + * message. The allocated memory is a + * message-specific structure that is + * filled in with message-specific data. + * in - timeout - the number of seconds to wait + * to receive a message before + * returning control to the caller. + * Specifying SFA_COMM_TIMEOUT_INFINITE + * results in the call blocking until + * a message is received. + * + * Notes: If a timeout or an error occurs, type and info are + * not updated and should not be accessed. + * + * Must call SFA_Comm_[Client|Server]_Init first. + * +\*--------------------------------------------------------------*/ +SFA_Comm_Return_Type +SFA_Comm_Recvmsg(SFA_Comm_Handle *hdl, + SFA_Comm_Msg_Type *type, + void **info, + unsigned int timeout); + +/*--------------------------------------------------------------*\ + * + * Name: SFA_Comm_Sendmsg + * + * Purpose: Sends a message to the other end of the + * communications channel. + * + * Parameters: in - hdl - must be the handle returned by + * SF_Comm_[Client|Server]_Init. + * in - type - the type of message to be sent. + * in - info - the message-specific informational + * structure used to build the message + * before it is sent. + * in - timeout - the number of seconds to wait + * to send the message before + * returning control to the caller. + * Specifying SFA_COMM_TIMEOUT_INFINITE + * results in the call blocking until + * the message is sent. + * + * Notes: Must call SFA_Comm_[Client|Server]_Init first. + * +\*--------------------------------------------------------------*/ +SFA_Comm_Return_Type +SFA_Comm_Sendmsg(SFA_Comm_Handle *hdl, + SFA_Comm_Msg_Type type, + const void *info, + unsigned int timeout); + +/*--------------------------------------------------------------*\ + * + * Name: SFA_Comm_Strerror + * + * Purpose: Gets an error message string + * + * Parameters: in - ret - The error for which to get the + * message string. + * + * Notes: The returned string must not be freed by the caller + * +\*--------------------------------------------------------------*/ +char * +SFA_Comm_Strerror(SFA_Comm_Return_Type ret); + +/*--------------------------------------------------------------*\ + * + * Name: SFA_Comm_End + * + * Purpose: Closes down the communications channel that was + * opened with SFA_Comm_[Client|Server]_Init. + * + * Parameters: update - hdl - must be the handle returned by + * SFA_Comm_[Client|Server]_Init. + * After this call, hdl is no + * longer valid. + * + * Notes: Call SFA_Comm_[Client|Server]_Init to open the + * communications channel. After this call, no more + * communications can be done unless + * SFA_Comm_[Client|Server]_Init is called again. + * +\*--------------------------------------------------------------*/ +void +SFA_Comm_End(SFA_Comm_Handle **hdl); + + + +# ifdef __cplusplus +} +# endif /* __cplusplus */ + +#endif /*INCLUDE_SFA_COMM_IPC_H */ Binary files ../squid-2.5.STABLE14.orig/lib/libsfcontrol.a and lib/libsfcontrol.a differ Binary files ../squid-2.5.STABLE14.orig/lib/libsflog_client.a and lib/libsflog_client.a differ Binary files ../squid-2.5.STABLE14.orig/lib/libsfplugin.a and lib/libsfplugin.a differ Binary files ../squid-2.5.STABLE14.orig/lib/libsmartfilteragent.a and lib/libsmartfilteragent.a differ --- ../squid-2.5.STABLE14.orig/patchfile 1969-12-31 19:00:00.000000000 -0500 +++ patchfile 2007-01-24 01:08:01.341483000 -0500 @@ -0,0 +1,3066 @@ +--- ../squid-2.5.STABLE14.orig/configure 2006-05-20 09:43:18.000000000 -0400 ++++ configure 2007-01-24 01:02:39.001425000 -0500 +@@ -234,6 +234,8 @@ + use internal copies of the headers from Samba-2.2.7) + " + ac_help="$ac_help ++ --enable-smartfilter Enable SmartFilter web filtering." ++ac_help="$ac_help + --disable-unlinkd Do not use unlinkd" + ac_help="$ac_help + --enable-stacktraces Enable automatic call backtrace on fatal errors" +@@ -2009,6 +2011,22 @@ + echo "With dl" + fi + ++# Check whether --enable-smartfilter or --disable-smartfilter was given. ++if test "${enable_smartfilter+set}" = set; then ++ enableval="$enable_smartfilter" ++ case $enableval in ++ yes) ++ CFLAGS="$CFLAGS -DSMARTFILTER -DUNIX -D_REENTRANT" ++ SF_SRCS="smartfilter_squid.c smartfilter_userinfo.c smartfilter_thread.c" ++ SF_LIBS="-lsfplugin -lsflog_client -lsfcontrol -lsmartfilteragent -lpthread " ++ ;; ++ no) ++ ;; ++ *) ++ ;; ++ esac ++fi ++ + # Check whether --enable-storeio or --disable-storeio was given. + if test "${enable_storeio+set}" = set; then + enableval="$enable_storeio" +@@ -9170,6 +9188,8 @@ + s%@LIBOBJS@%$LIBOBJS%g + s%@XTRA_OBJS@%$XTRA_OBJS%g + s%@XTRA_LIBS@%$XTRA_LIBS%g ++s%@SF_LIBS@%$SF_LIBS%g ++s%@SF_SRCS@%$SF_SRCS%g + + CEOF + EOF +Common subdirectories: ../squid-2.5.STABLE14.orig/contrib/nextstep and contrib/nextstep +Common subdirectories: ../squid-2.5.STABLE14.orig/errors/Azerbaijani and errors/Azerbaijani +Common subdirectories: ../squid-2.5.STABLE14.orig/errors/Bulgarian and errors/Bulgarian +Common subdirectories: ../squid-2.5.STABLE14.orig/errors/Catalan and errors/Catalan +Common subdirectories: ../squid-2.5.STABLE14.orig/errors/Czech and errors/Czech +Common subdirectories: ../squid-2.5.STABLE14.orig/errors/Danish and errors/Danish +Common subdirectories: ../squid-2.5.STABLE14.orig/errors/Dutch and errors/Dutch +Common subdirectories: ../squid-2.5.STABLE14.orig/errors/English and errors/English +Common subdirectories: ../squid-2.5.STABLE14.orig/errors/Estonian and errors/Estonian +Common subdirectories: ../squid-2.5.STABLE14.orig/errors/Finnish and errors/Finnish +Common subdirectories: ../squid-2.5.STABLE14.orig/errors/French and errors/French +Common subdirectories: ../squid-2.5.STABLE14.orig/errors/German and errors/German +Common subdirectories: ../squid-2.5.STABLE14.orig/errors/Greek and errors/Greek +Common subdirectories: ../squid-2.5.STABLE14.orig/errors/Hebrew and errors/Hebrew +Common subdirectories: ../squid-2.5.STABLE14.orig/errors/Hungarian and errors/Hungarian +Common subdirectories: ../squid-2.5.STABLE14.orig/errors/Italian and errors/Italian +Common subdirectories: ../squid-2.5.STABLE14.orig/errors/Japanese and errors/Japanese +Common subdirectories: ../squid-2.5.STABLE14.orig/errors/Korean and errors/Korean +Common subdirectories: ../squid-2.5.STABLE14.orig/errors/Lithuanian and errors/Lithuanian +Common subdirectories: ../squid-2.5.STABLE14.orig/errors/Polish and errors/Polish +Common subdirectories: ../squid-2.5.STABLE14.orig/errors/Portuguese and errors/Portuguese +Common subdirectories: ../squid-2.5.STABLE14.orig/errors/Romanian and errors/Romanian +Common subdirectories: ../squid-2.5.STABLE14.orig/errors/Russian-1251 and errors/Russian-1251 +Common subdirectories: ../squid-2.5.STABLE14.orig/errors/Russian-koi8-r and errors/Russian-koi8-r +Common subdirectories: ../squid-2.5.STABLE14.orig/errors/Serbian and errors/Serbian +Common subdirectories: ../squid-2.5.STABLE14.orig/errors/Simplify_Chinese and errors/Simplify_Chinese +Common subdirectories: ../squid-2.5.STABLE14.orig/errors/Slovak and errors/Slovak +Common subdirectories: ../squid-2.5.STABLE14.orig/errors/Spanish and errors/Spanish +Common subdirectories: ../squid-2.5.STABLE14.orig/errors/Swedish and errors/Swedish +Common subdirectories: ../squid-2.5.STABLE14.orig/errors/Traditional_Chinese and errors/Traditional_Chinese +Common subdirectories: ../squid-2.5.STABLE14.orig/errors/Turkish and errors/Turkish +Common subdirectories: ../squid-2.5.STABLE14.orig/helpers/basic_auth and helpers/basic_auth +Common subdirectories: ../squid-2.5.STABLE14.orig/helpers/digest_auth and helpers/digest_auth +Common subdirectories: ../squid-2.5.STABLE14.orig/helpers/external_acl and helpers/external_acl +Common subdirectories: ../squid-2.5.STABLE14.orig/helpers/ntlm_auth and helpers/ntlm_auth +Common subdirectories: ../squid-2.5.STABLE14.orig/include/samba and include/samba +diff -uN ../squid-2.5.STABLE14.orig/include/sf_control.h include/sf_control.h +--- ../squid-2.5.STABLE14.orig/include/sf_control.h 1969-12-31 19:00:00.000000000 -0500 ++++ include/sf_control.h 2006-08-14 12:06:38.000000000 -0400 +@@ -0,0 +1,630 @@ ++/*--------------------------------------------------------------------------*\ ++ * ++ * SmartFilter Control List Library ++ * ++ * Copyright (c) 2003-2006, Secure Computing Corporation. All rights reserved. ++ * ++ * $RCSfile: sf_control.h,v $ ++ * $Revision: 1.4.2.5 $ ++ * $Date: 2006/08/14 16:06:38 $ ++ * $State: Exp $ ++\*--------------------------------------------------------------------------*/ ++ ++#ifndef SF_CONTROL_H ++#define SF_CONTROL_H ++ ++#include ++ ++#ifdef __cplusplus ++extern "C" { ++#endif /* __cplusplus */ ++ ++/*--------------------------------------------------------------*\ ++ * ++ * GENERAL ++ * ++\*--------------------------------------------------------------*/ ++#ifdef WIN32 ++# ifdef SFCL_API_BUILD ++# define SFCL_API_PUBLIC __declspec(dllexport) ++# else /* SFCL_API_BUILD */ ++# define SFCL_API_PUBLIC __declspec(dllimport) ++# endif /* SFCL_API_BUILD */ ++#else ++# define SFCL_API_PUBLIC extern ++#endif /* WIN32 */ ++ ++#define SFCL_API_INTERNAL extern ++#define SFCL_API_PRIVATE static ++#define SFCL_API_PROTECTED SFCL_API_PUBLIC ++ ++/* ++ * Library version information ++ */ ++#define SFCL_API_VERSION_MAJOR 4 ++#define SFCL_API_VERSION_MINOR 2 ++#define SFCL_API_VERSION_DESC_LEN 80 ++ ++/* ++ * Return values from functions ++ */ ++#define SFCL_OK 0 ++#define SFCL_ERROR 1 ++ ++#define SFCL_NOMEM 10 ++#define SFCL_INSUFFICIENT_SPACE 11 ++ ++#define SFCL_INVALID_URL 20 ++ ++#define SFCL_INVALID_LIST 30 ++#define SFCL_NO_LIST 31 ++#define SFCL_EXPIRED_LIST 32 ++ ++#define SFCL_INVALID_FILE 40 ++#define SFCL_DOWNLOAD_FAILED 41 ++#define SFCL_MERGE_FAILED 42 ++ ++ ++SFCL_API_PUBLIC int ++SFCL_Init(void); ++ ++/*--------------------------------------------------------------*\ ++ * ++ * HANDLE ++ * ++\*--------------------------------------------------------------*/ ++typedef struct sfcl_handle *SFCL_Handle; ++ ++SFCL_API_PUBLIC int ++SFCL_HandleCreate(SFCL_Handle *sfcl_handle); ++ ++SFCL_API_PUBLIC int ++SFCL_HandleDestroy(SFCL_Handle *sfcl_handle); ++ ++typedef enum ++{ ++ SFCL_HANDLE_INFO_FIRST, /* do not use */ ++ ++ SFCL_HANDLE_INFO_LIST_EXPIRED, ++ SFCL_HANDLE_INFO_LIST_EXPIRE_TIME, ++ SFCL_HANDLE_INFO_LIST_SERIAL_NUM, ++ SFCL_HANDLE_INFO_API_VERSION_MAJOR, ++ SFCL_HANDLE_INFO_API_VERSION_MINOR, ++ SFCL_HANDLE_INFO_API_VERSION_DESC, ++ ++ SFCL_HANDLE_INFO_LAST, /* do not use */ ++} SFCL_Handle_Info; ++ ++SFCL_API_PUBLIC int ++SFCL_HandleInfoGet(SFCL_Handle sfcl_handle, ++ SFCL_Handle_Info info_type, ++ void *info); ++ ++ ++/*--------------------------------------------------------------*\ ++ * ++ * CATEGORIES ++ * ++\*--------------------------------------------------------------*/ ++typedef struct sfcl_categories *SFCL_Categories; ++typedef unsigned int SFCL_Category; ++ ++typedef enum ++{ ++ SFCL_LANGUAGE_FIRST, /* do not use */ ++ ++ SFCL_LANGUAGE_ENGLISH, ++ SFCL_LANGUAGE_ENGLISH_CATEGORY_SHORT, ++ ++ SFCL_LANGUAGE_LAST /* do not use */ ++} SFCL_Language; ++ ++typedef enum ++{ ++ SFCL_ENCODING_FIRST, /* do not use */ ++ ++ SFCL_ENCODING_UTF8, ++ ++ SFCL_ENCODING_LAST /* do not use */ ++} SFCL_Encoding; ++ ++SFCL_API_PUBLIC int ++SFCL_CategoriesCategoryAdd(SFCL_Handle sfcl_handle, ++ SFCL_Categories categories, ++ SFCL_Category category); ++ ++SFCL_API_PUBLIC int ++SFCL_CategoriesCategoryAddAll(SFCL_Handle sfcl_handle, ++ SFCL_Categories categories); ++ ++SFCL_API_PUBLIC int ++SFCL_CategoriesCategoryIsMember(SFCL_Handle sfcl_handle, ++ SFCL_Categories categories, ++ SFCL_Category category, ++ int *member); ++ ++SFCL_API_PUBLIC int ++SFCL_CategoriesCategoryRemove(SFCL_Handle sfcl_handle, ++ SFCL_Categories categories, ++ SFCL_Category category); ++ ++SFCL_API_PUBLIC int ++SFCL_CategoriesCategoryRemoveAll(SFCL_Handle sfcl_handle, ++ SFCL_Categories categories); ++ ++SFCL_API_PUBLIC int ++SFCL_CategoriesCopy(SFCL_Handle sfcl_handle, ++ SFCL_Categories src, ++ SFCL_Categories dst); ++ ++SFCL_API_PUBLIC int ++SFCL_CategoriesCount(SFCL_Handle sfcl_handle, ++ SFCL_Categories categories, ++ int *count); ++ ++SFCL_API_PUBLIC int ++SFCL_CategoriesCreate(SFCL_Handle sfcl_handle, ++ SFCL_Categories *categories); ++ ++SFCL_API_PUBLIC int ++SFCL_CategoriesDestroy(SFCL_Handle sfcl_handle, ++ SFCL_Categories *categories); ++ ++SFCL_API_PUBLIC int ++SFCL_CategoriesEqual(SFCL_Handle sfcl_handle, ++ SFCL_Categories categories1, ++ SFCL_Categories categories2, ++ int *equal); ++ ++SFCL_API_PUBLIC int ++SFCL_CategoriesIntersect(SFCL_Handle sfcl_handle, ++ SFCL_Categories categories1, ++ SFCL_Categories categories2, ++ SFCL_Categories result, ++ int *num_cats); ++ ++SFCL_API_PUBLIC int ++SFCL_CategoriesToArray(SFCL_Handle sfcl_handle, ++ SFCL_Categories categories, ++ SFCL_Category *cat_array, ++ int *num_cats); ++ ++SFCL_API_PUBLIC int ++SFCL_CategoriesToString(SFCL_Handle sfcl_handle, ++ SFCL_Categories categories, ++ SFCL_Language language, ++ SFCL_Encoding encoding, ++ char *delimiter, ++ size_t delimiter_len, ++ char *cat_string, ++ size_t *cat_string_len); ++ ++SFCL_API_PUBLIC int ++SFCL_CategoriesUnion(SFCL_Handle sfcl_handle, ++ SFCL_Categories categories1, ++ SFCL_Categories categories2, ++ SFCL_Categories result, ++ int *num_cats); ++ ++ ++/*--------------------------------------------------------------*\ ++ * ++ * URLS ++ * ++\*--------------------------------------------------------------*/ ++typedef struct sfcl_url *SFCL_Url; ++ ++#define SFCL_URL_CAT_SKIP_CUSTOM_KEYWORDS 0x00000001 ++#define SFCL_URL_CAT_SKIP_CUSTOM_SITES 0x00000002 ++#define SFCL_URL_CAT_SKIP_LIST 0x00000004 ++#define SFCL_URL_CAT_SKIP_LIST_KEYWORDS 0x00000008 ++#define SFCL_URL_CAT_SKIP_PATTERNS 0x00000010 ++#define SFCL_URL_CAT_SKIP_MASK 0x0000001F ++#define SFCL_URL_CAT_SKIP_ALL (0xFFFFFFFF & SFCL_URL_CAT_SKIP_MASK) ++ ++SFCL_API_PUBLIC int ++SFCL_UrlCategorize(SFCL_Handle sfcl_handle, ++ SFCL_Url url, ++ SFCL_Categories categories, ++ int *num_cats, ++ int skip_methods); ++ ++SFCL_API_PUBLIC int ++SFCL_UrlCreate(SFCL_Handle sfcl_handle, ++ SFCL_Url *url); ++ ++SFCL_API_PUBLIC int ++SFCL_UrlDestroy(SFCL_Handle sfcl_handle, ++ SFCL_Url *url); ++ ++SFCL_API_PUBLIC int ++SFCL_UrlDomainRewrite(SFCL_Handle sfcl_handle, ++ SFCL_Url url, ++ const char *new_domain); ++ ++typedef enum ++{ ++ SFCL_URL_INFO_FIRST, /* do not use */ ++ ++ SFCL_URL_INFO_DOMAIN, ++ SFCL_URL_INFO_FILE_EXT, ++ SFCL_URL_INFO_NUM_PATHS, ++ SFCL_URL_INFO_DOMAIN_IS_IP, ++ SFCL_URL_INFO_IS_USER_PAGE, ++ SFCL_URL_INFO_PROTOCOL, ++ SFCL_URL_INFO_PORT, ++ SFCL_URL_INFO_PATH, ++ SFCL_URL_INFO_CGI, ++ ++ SFCL_URL_INFO_LAST, /* do not use */ ++} SFCL_Url_Info; ++ ++SFCL_API_PUBLIC int ++SFCL_UrlInfoGet(SFCL_Handle sfcl_handle, ++ SFCL_Url url, ++ SFCL_Url_Info info_type, ++ void *info); ++ ++ ++SFCL_API_PUBLIC int ++SFCL_UrlParse(SFCL_Handle sfcl_handle, ++ const char *url, ++ const char *host_header, ++ SFCL_Url parsed_url); ++ ++ ++/*--------------------------------------------------------------*\ ++ * ++ * CUSTOM SEARCH KEYWORDS ++ * ++\*--------------------------------------------------------------*/ ++SFCL_API_PUBLIC int ++SFCL_CustomSearchKeywordsAdd(SFCL_Handle sfcl_handle, ++ const char *keyword, ++ SFCL_Categories categories); ++ ++SFCL_API_PUBLIC int ++SFCL_CustomSearchKeywordsPost(SFCL_Handle sfcl_handle); ++ ++SFCL_API_PUBLIC int ++SFCL_CustomSearchKeywordsRemove(SFCL_Handle sfcl_handle, ++ const char *keyword); ++ ++typedef enum SFCL_Custom_Search_Keywords_Reset_Type ++{ ++ SFCL_CUSTOM_SEARCH_KEYWORDS_RESET_FIRST, /* Do not use */ ++ ++ SFCL_CUSTOM_SEARCH_KEYWORDS_RESET_ACTIVE, ++ SFCL_CUSTOM_SEARCH_KEYWORDS_RESET_PENDING, ++ SFCL_CUSTOM_SEARCH_KEYWORDS_RESET_ALL, ++ ++ SFCL_CUSTOM_SEARCH_KEYWORDS_RESET_LAST /* Do not use */ ++} SFCL_Custom_Search_Keywords_Reset_Type; ++ ++SFCL_API_PUBLIC int ++SFCL_CustomSearchKeywordsReset(SFCL_Handle sfcl_handle, ++ SFCL_Custom_Search_Keywords_Reset_Type type); ++ ++ ++/*--------------------------------------------------------------*\ ++ * ++ * CUSTOM SITES ++ * ++\*--------------------------------------------------------------*/ ++ ++#define SFCL_CUSTOM_SITES_MATCH_PORT 0x00000001 ++#define SFCL_CUSTOM_SITES_MATCH_PROTOCOL 0x00000002 ++ ++typedef enum ++{ ++ SFCL_CUSTOM_SITES_TYPE_FIRST, /* Do not use */ ++ ++ SFCL_CUSTOM_SITES_TYPE_NONE, ++ SFCL_CUSTOM_SITES_TYPE_SEARCH_PHRASE, ++ ++ SFCL_CUSTOM_SITES_TYPE_LAST, /* Do not use */ ++} SFCL_Custom_Sites_Data; ++ ++ ++typedef enum SFCL_Custom_Sites_State ++{ ++ SFCL_CUSTOM_SITES_STATE_FIRST, /* Do not use */ ++ ++ SFCL_CUSTOM_SITES_STATE_INITIAL, ++ SFCL_CUSTOM_SITES_STATE_FINAL, ++ ++ SFCL_CUSTOM_SITES_STATE_LAST /* Do not use */ ++} SFCL_Custom_Sites_State; ++ ++ ++SFCL_API_PUBLIC int ++SFCL_CustomSitesAdd(SFCL_Handle sfcl_handle, ++ SFCL_Url url, ++ int url_match, ++ SFCL_Categories categories, ++ SFCL_Custom_Sites_State state, ++ SFCL_Custom_Sites_Data data_type, ++ void *data); ++ ++SFCL_API_PUBLIC int ++SFCL_CustomSitesPost(SFCL_Handle sfcl_handle); ++ ++SFCL_API_PUBLIC int ++SFCL_CustomSitesRemove(SFCL_Handle sfcl_handle, ++ SFCL_Url url, ++ int match); ++ ++typedef enum SFCL_Custom_Sites_Reset_Type ++{ ++ SFCL_CUSTOM_SITES_RESET_FIRST, /* Do not use */ ++ ++ SFCL_CUSTOM_SITES_RESET_ACTIVE, ++ SFCL_CUSTOM_SITES_RESET_PENDING, ++ SFCL_CUSTOM_SITES_RESET_ALL, ++ ++ SFCL_CUSTOM_SITES_RESET_LAST /* Do not use */ ++} SFCL_Custom_Sites_Reset_Type; ++ ++ ++ ++SFCL_API_PUBLIC int ++SFCL_CustomSitesReset(SFCL_Handle sfcl_handle, ++ SFCL_Custom_Sites_Reset_Type type); ++ ++ ++ ++ ++ ++/*--------------------------------------------------------------*\ ++ * ++ * LOGGING ++ * ++\*--------------------------------------------------------------*/ ++typedef enum ++{ ++ SFCL_LOG_LEVEL_FIRST = 0, ++ ++ SFCL_LOG_LEVEL_NONE, /* Turns all logging off */ ++ SFCL_LOG_LEVEL_FATAL, /* Bad error, going away or crashing */ ++ SFCL_LOG_LEVEL_ERROR, /* Bad error, will try to recover */ ++ SFCL_LOG_LEVEL_WARNING, /* Shouldn't have happened, but can recover */ ++ SFCL_LOG_LEVEL_INFO, /* Something interesting (and normal) occurred */ ++ SFCL_LOG_LEVEL_DEBUG1, /* DEBUG1 through DEBUG9 and also DEBUG */ ++ SFCL_LOG_LEVEL_DEBUG2, /* represent the different debugging levels */ ++ SFCL_LOG_LEVEL_DEBUG3, /* that an application may use. Typically, */ ++ SFCL_LOG_LEVEL_DEBUG4, /* the larger the number, the more logging */ ++ SFCL_LOG_LEVEL_DEBUG5, /* you will see. */ ++ SFCL_LOG_LEVEL_DEBUG6, ++ SFCL_LOG_LEVEL_DEBUG7, ++ SFCL_LOG_LEVEL_DEBUG8, ++ SFCL_LOG_LEVEL_DEBUG9, ++ SFCL_LOG_LEVEL_DEBUG, /* All debugging except for trace logs */ ++ SFCL_LOG_LEVEL_TRACE, /* All debugging as well as trace logs */ ++ /* which mark the entrance and exit of */ ++ /* functions. */ ++ SFCL_LOG_LEVEL_ALL, /* All log messages */ ++ ++ SFCL_LOG_LEVEL_LAST ++} SFCL_Log_Level; ++ ++ ++typedef int SFCL_Log_Area; ++ ++#define SFCL_LOG_AREA_CUSTOM_SITES 0x00000001 ++#define SFCL_LOG_AREA_CUSTOM_KEYWORDS 0x00000002 ++#define SFCL_LOG_AREA_CUSTOM_PATTERNS 0x00000004 ++#define SFCL_LOG_AREA_LIST_DOWNLOAD 0x00000008 ++#define SFCL_LOG_AREA_LIST_LOAD 0x00000010 ++#define SFCL_LOG_AREA_LIST_SEARCH 0x00000020 ++#define SFCL_LOG_AREA_LOG 0x00000040 ++#define SFCL_LOG_AREA_URL 0x00000080 ++#define SFCL_LOG_AREA_CATEGORIES 0x00000100 ++#define SFCL_LOG_AREA_HANDLE 0x00000200 ++#define SFCL_LOG_AREA_MASK 0x000003FF ++#define SFCL_LOG_AREA_ALL (0xFFFFFFFF & SFCL_LOG_AREA_MASK) ++ ++typedef void (*SFCL_Log_Func)(SFCL_Log_Level level, ++ SFCL_Log_Area area, ++ const char *message); ++ ++SFCL_API_PUBLIC int ++SFCL_LogFunctionSet(SFCL_Handle sfcl_handle, ++ SFCL_Log_Func log_func); ++ ++SFCL_API_PUBLIC int ++SFCL_LogLevelSet(SFCL_Handle sfcl_handle, ++ SFCL_Log_Level level, ++ SFCL_Log_Area areas); ++ ++ ++ ++ ++/*--------------------------------------------------------------*\ ++ * ++ * CONTROL LIST ++ * ++\*--------------------------------------------------------------*/ ++typedef void *(*SFCL_List_Alloc_Func)(size_t bytes); ++typedef void (*SFCL_List_Free_Func)(void *ptr); ++ ++ ++SFCL_API_PUBLIC int ++SFCL_ListAccessFunctionsSet(SFCL_Handle sfcl_handle, ++ SFCL_List_Alloc_Func list_alloc_func, ++ SFCL_List_Free_Func list_free_func); ++ ++typedef enum ++{ ++ SFCL_LIST_DOWNLOAD_MODE_FIRST, /* do not use */ ++ ++ SFCL_LIST_DOWNLOAD_MODE_FULL, ++ SFCL_LIST_DOWNLOAD_MODE_INCR, ++ SFCL_LIST_DOWNLOAD_MODE_INCR_LOW_CPU, ++ ++ SFCL_LIST_DOWNLOAD_MODE_LAST, /* do not use */ ++ ++} SFCL_List_Download_Mode; ++ ++#define SFCL_LIST_DOWNLOAD_COMPLETE 1 ++#define SFCL_LIST_DOWNLOAD_PARTIAL 2 ++#define SFCL_LIST_DOWNLOAD_NOT_NEEDED 3 ++ ++SFCL_API_PUBLIC int ++SFCL_ListDownload(SFCL_Handle sfcl_handle, ++ const char *local_filename, ++ SFCL_List_Download_Mode download_mode, ++ int *download_status, ++ void *data); ++ ++typedef enum SFCL_List_Download_Error ++{ ++ SFCL_LIST_DOWNLOAD_ERROR_FIRST, /* do not use */ ++ ++ SFCL_LIST_DOWNLOAD_ERROR_INTERNAL, ++ SFCL_LIST_DOWNLOAD_ERROR_RESPONSE_INVALID, ++ SFCL_LIST_DOWNLOAD_ERROR_FILE_PERMISSIONS, ++ SFCL_LIST_DOWNLOAD_ERROR_CONNECT, ++ SFCL_LIST_DOWNLOAD_ERROR_HOSTNAME_INVALID, ++ SFCL_LIST_DOWNLOAD_ERROR_HTTP_STATUS, ++ ++ SFCL_LIST_DOWNLOAD_ERROR_LAST /* do not use */ ++} SFCL_List_Download_Error; ++ ++ ++typedef enum SFCL_List_Download_List_Type ++{ ++ SFCL_LIST_DOWNLOAD_LIST_TYPE_FIRST, /* do not use */ ++ ++ SFCL_LIST_DOWNLOAD_LIST_TYPE_STANDARD, ++ ++ SFCL_LIST_DOWNLOAD_LIST_TYPE_LAST /* do not use */ ++} SFCL_List_Download_List_Type; ++ ++ ++typedef struct SFCL_List_Download_Func_Info ++{ ++ SFCL_Handle sfcl_handle; ++ char dest_host[80]; ++ unsigned short dest_port; ++ char proxy_host[80]; ++ unsigned short proxy_port; ++ char proxy_username[80]; ++ char proxy_password[80]; ++ char path[1024]; ++ char serial_number[80]; ++ char perm_serial_number[80]; ++ SFCL_List_Download_List_Type list_type; ++ char product_type[80]; ++ char product_version[20]; ++ char os[20]; ++ char *distributes_to; /* For Secure Computing use only */ ++ int user_count; ++ char expiration[80]; ++ SFCL_List_Download_Error status; ++ int http_status; ++ char message[1024]; ++ SFCL_Log_Level message_level; ++ int message_code; ++} SFCL_List_Download_Func_Info; ++ ++ ++#define SFCL_FILE_TYPE_SUBSCRIPTION -4 ++#define SFCL_FILE_TYPE_INFO -3 ++#define SFCL_FILE_TYPE_FULL -2 ++#define SFCL_FILE_TYPE_CURRENT -1 ++ ++typedef int (*SFCL_List_Download_Func)(const char *local_file, ++ int file_type, ++ void *data); ++ ++SFCL_API_PUBLIC int ++SFCL_ListDownloadFunctionSet(SFCL_Handle sfcl_handle, ++ SFCL_List_Download_Func download_func); ++ ++ ++SFCL_API_PUBLIC int ++SFCL_ListSubscriptionInfoDownload(SFCL_Handle sfcl_handle, ++ SFCL_List_Download_Func_Info *data); ++ ++typedef enum ++{ ++ SFCL_LIST_ACCESS_FIRST, /* do not use */ ++ ++ SFCL_LIST_ACCESS_DISK, ++ SFCL_LIST_ACCESS_MEMORY, ++ SFCL_LIST_ACCESS_EXTERNAL, ++ ++ SFCL_LIST_ACCESS_LAST /* do not use */ ++} SFCL_List_Access; ++ ++SFCL_API_PUBLIC int ++SFCL_ListLoad(SFCL_Handle sfcl_handle, ++ const char *filename, ++ SFCL_List_Access access); ++ ++SFCL_API_PUBLIC int ++SFCL_ListLoadFromHandle(SFCL_Handle sfcl_handle_src, ++ SFCL_Handle sfcl_handle_dst); ++ ++SFCL_API_PUBLIC int ++SFCL_ListReload(SFCL_Handle sfcl_handle, ++ const char *filename); ++ ++SFCL_API_PUBLIC int ++SFCL_ListUnload(SFCL_Handle sfcl_handle); ++ ++ ++ ++/*--------------------------------------------------------------*\ ++ * ++ * PATTERNS ++ * ++\*--------------------------------------------------------------*/ ++typedef enum ++{ ++ SFCL_CATEGORIES_ACTION_FIRST, /* do not use */ ++ ++ SFCL_CATEGORIES_ACTION_OVERRIDE, ++ SFCL_CATEGORIES_ACTION_AUGMENT, ++ ++ SFCL_CATEGORIES_ACTION_LAST, /* do not use */ ++} SFCL_Patterns_Categories_Action; ++ ++ ++ ++SFCL_API_PUBLIC int ++SFCL_PatternsAdd(SFCL_Handle sfcl_handle, ++ SFCL_Categories input_categories, ++ const char *protocol, ++ const char *domain_pattern, ++ const char *path_pattern, ++ SFCL_Categories output_categories, ++ SFCL_Patterns_Categories_Action categories_action); ++ ++SFCL_API_PUBLIC int ++SFCL_PatternsPost(SFCL_Handle sfcl_handle); ++ ++typedef enum SFCL_Patterns_Reset_Type ++{ ++ SFCL_PATTERNS_RESET_FIRST, /* Do not use */ ++ ++ SFCL_PATTERNS_RESET_ACTIVE, ++ SFCL_PATTERNS_RESET_PENDING, ++ SFCL_PATTERNS_RESET_ALL, ++ ++ SFCL_PATTERNS_RESET_LAST /* Do not use */ ++} SFCL_Patterns_Reset_Type; ++ ++ ++ ++SFCL_API_PUBLIC int ++SFCL_PatternsReset(SFCL_Handle sfcl_handle, ++ SFCL_Patterns_Reset_Type type); ++ ++ ++#ifdef __cplusplus ++} ++#endif/* __cplusplus */ ++ ++ ++#endif /* SF_CONTROL_H */ +diff -uN ../squid-2.5.STABLE14.orig/include/sf_plugin.h include/sf_plugin.h +--- ../squid-2.5.STABLE14.orig/include/sf_plugin.h 1969-12-31 19:00:00.000000000 -0500 ++++ include/sf_plugin.h 2006-08-17 12:35:18.000000000 -0400 +@@ -0,0 +1,1085 @@ ++/*--------------------------------------------------------------------------*\ ++ * ++ * SmartFilter Plugin Library ++ * ++ * Copyright (c) 2006, Secure Computing Corporation. All rights reserved. ++ * ++ * $RCSfile: sf_plugin.h,v $ ++ * $Revision: 1.70.2.12 $ ++ * $Date: 2006/08/17 16:35:18 $ ++ * $State: Exp $ ++\*--------------------------------------------------------------------------*/ ++ ++#ifndef SFPL_PLUGIN_H ++#define SFPL_PLUGIN_H ++ ++#include "sf_control.h" ++#include "sf_util.h" ++ ++#ifdef WIN32 ++#include "sfpl_msg.h" ++#endif ++ ++#if defined(__cplusplus) ++extern "C" { ++#endif /* __cplusplus */ ++ ++/*--------------------------------------------------------------*\ ++ * ++ * GENERAL ++ * ++\*--------------------------------------------------------------*/ ++#ifdef WIN32 ++# ifdef SFPL_API_BUILD ++# define SFPL_API_PUBLIC __declspec(dllexport) ++# else /* SFPL_API_BUILD */ ++# define SFPL_API_PUBLIC __declspec(dllimport) ++# endif /* SFPL_API_BUILD */ ++#else ++# define SFPL_API_PUBLIC extern ++#endif /* WIN32 */ ++ ++#define SFPL_API_INTERNAL extern ++#define SFPL_API_PRIVATE static ++ ++#ifndef SFPL_API_PROTECTED_BUILD ++# define SFPL_API_PROTECTED extern ++#else /* SFPL_API_PROTECTED_BUILD */ ++# define SFPL_API_PROTECTED SFPL_API_PUBLIC ++#endif /* SFPL_API_PROTECTED_BUILD */ ++ ++/* ++ * Library version information ++ */ ++#define SFPL_API_VERSION_MAJOR 4 ++#define SFPL_API_VERSION_MINOR 1 ++#define SFPL_API_VERSION_UPDATE 1 ++#define SFPL_API_VERSION_PATCH "01" ++#define SFPL_API_VERSION_DESC_LEN 80 ++ ++/* ++ * Return values from functions ++ */ ++#define SFPL_OK 0 ++#define SFPL_ERROR 1 ++ ++#define SFPL_NOMEM 10 ++#define SFPL_INSUFFICIENT_SPACE 11 ++ ++#define SFPL_INVALID_URL 20 ++ ++#define SFPL_INVALID_LIST 30 ++#define SFPL_NO_LIST 31 ++#define SFPL_EXPIRED_LIST 32 ++ ++#define SFPL_INVALID_FILE 40 ++#define SFPL_DOWNLOAD_FAILED 41 ++#define SFPL_MERGE_FAILED 42 ++ ++#define SFPL_NULL 50 ++#define SFPL_INVALID_HANDLE 51 ++#define SFPL_SERVER_FAILED 52 ++#define SFPL_NOT_FOUND 53 ++#define SFPL_RETRY 54 ++#define SFPL_INVALID 55 ++#define SFPL_DUPLICATE_GROUP 56 ++#define SFPL_EXPIRED_ACTIVATION 57 ++#define SFPL_FOUND 58 ++ ++#define SFPL_LOOKUP_REVERSE 70 ++#define SFPL_LOOKUP_FORWARD 71 ++ ++#define SFPL_TRANSAUTH_REDIRECT 100 ++#define SFPL_TRANSAUTH_CHECK 101 ++ ++ ++ ++#define SFPL_DISABLE 1 ++#define SFPL_ENABLE 2 ++ ++/*--------------------------------------------------------------*\ ++ * ++ * BLOCKED MESSAGES ++ * ++\*--------------------------------------------------------------*/ ++ ++/* Define Action codes */ ++typedef unsigned char SFPL_Action_Code; ++ ++/* ++ * These must be kept in order from most restrictive (smallest ++ * integer means greatest priority) to least restrictive. Note ++ * that exempt is a special case and we just decided it has the ++ * highest priority. ++ */ ++#define SFPL_EXEMPT 0 ++#define SFPL_AUTHOVER 1 ++#define SFPL_BLOCK 2 ++#define SFPL_WARN 3 ++#define SFPL_BYPASS 4 ++#define SFPL_DELAY 5 ++#define SFPL_MONITOR 6 ++#define SFPL_ALLOW 7 ++ ++#define SFPL_EXEMPT_STR "EXEMPT" ++#define SFPL_AUTHOVER_STR "AUTHOVERRIDE" ++#define SFPL_BLOCK_STR "BLOCK" ++#define SFPL_WARN_STR "WARN" ++#define SFPL_BYPASS_STR "BYPASS" ++#define SFPL_DELAY_STR "DELAY" ++#define SFPL_MONITOR_STR "MONITOR" ++#define SFPL_ALLOW_STR "ALLOW" ++#define SFPL_INVALID_ACTION_STR "INVALID_ACTION" ++ ++ ++/* These are for error messages and logging */ ++#define SFPL_MAX_MESSAGE 1024 ++#define SFPL_MAX_LOG 1024 ++ ++#define SFPL_MAX_URL 2048 ++ ++ ++/*--------------------------------------------------------------*\ ++ * ++ * HANDLE ++ * ++\*--------------------------------------------------------------*/ ++typedef struct sfpl_handle *SFPL_Handle; ++ ++SFPL_API_PUBLIC int ++SFPL_HandleCreate(SFPL_Handle *sfpl_handle); ++ ++SFPL_API_PUBLIC int ++SFPL_HandleDestroy(SFPL_Handle *sfpl_handle); ++ ++typedef enum ++{ ++ SFPL_HANDLE_INFO_FIRST, /* do not use */ ++ ++ SFPL_HANDLE_INFO_API_VERSION_MAJOR, ++ SFPL_HANDLE_INFO_API_VERSION_MINOR, ++ SFPL_HANDLE_INFO_API_VERSION_DESC, ++ SFPL_HANDLE_INFO_CONTROL_HANDLE, ++ SFPL_HANDLE_INFO_DOWNLOAD_SETTINGS, ++ SFPL_HANDLE_INFO_REVERSE_LOOKUPS, ++ SFPL_HANDLE_INFO_SERIAL_NUMBER, ++ SFPL_HANDLE_INFO_PERM_SERIAL_NUMBER, ++ SFPL_HANDLE_INFO_CONTROL_PATH, ++ SFPL_HANDLE_INFO_LOG_OPTION, ++ SFPL_HANDLE_INFO_LOG_TYPE, ++ SFPL_HANDLE_INFO_LOG_TEXT_DIR, ++ SFPL_HANDLE_INFO_ODBC_DSN, ++ SFPL_HANDLE_INFO_ODBC_TABLE, ++ SFPL_HANDLE_INFO_SQL_USER, ++ SFPL_HANDLE_INFO_SQL_PASS, ++ SFPL_HANDLE_INFO_IP_RATING, ++ SFPL_HANDLE_INFO_MAIL_SETTINGS, ++ SFPL_HANDLE_INFO_AUTHSERV_SETTINGS, ++ ++ SFPL_HANDLE_INFO_LAST /* do not use */ ++} SFPL_Handle_Info; ++ ++SFPL_API_PUBLIC int ++SFPL_HandleInfoGet(SFPL_Handle sfpl_handle, ++ SFPL_Handle_Info info_type, ++ void *info); ++ ++/*--------------------------------------------------------------*\ ++ * ++ * USERS, GROUPS, AND POLICY ++ * ++\*--------------------------------------------------------------*/ ++ ++typedef struct sfpl_policy SFPL_Policy; ++ ++/* Define user/group/policy maximums */ ++#define SFPL_MAX_GROUPNAME 32 ++#define SFPL_MAX_USERNAME 32 ++#define SFPL_MAX_POLICYNAME 65 /* 64 + 1 for the null-terminator */ ++ ++typedef struct sfpl_group_list ++{ ++ struct sfpl_group_list *next; ++ char group_name[SFPL_MAX_GROUPNAME]; ++ char policy_name[SFPL_MAX_POLICYNAME]; ++ SFPL_Policy *policy; ++} SFPL_Group_List; ++ ++typedef struct user_grouplist ++{ ++ struct user_grouplist *next; ++ char group_name[SFPL_MAX_GROUPNAME]; ++} SFPL_User_Group_List; ++ ++typedef struct user_data ++{ ++ struct user_data *next; ++ SFPL_Group_List *group; ++} SFPL_User_Data; ++ ++SFPL_API_PUBLIC int /* Needed for Squid. */ ++SFPL_GetIPRangeGroups(SFPL_Handle sfpl_handle, ++ char *ipaddr_char, ++ SFPL_User_Group_List **grouplist, ++ int *total); ++ ++SFPL_API_PUBLIC int /* Needed for Squid. */ ++SFPL_GetUserGroups(SFPL_Handle sfpl_handle, ++ char *username, ++ SFPL_User_Group_List **grouplist, ++ int *total_groups, ++ char *err_msg, ++ int msg_len, ++ int *log_err_msg); ++ ++#define SFPL_USER_QUERY_USERNAME 0 ++#define SFPL_USER_QUERY_IP 1 ++ ++SFPL_API_PUBLIC int ++SFPL_IsAuthOverrideUser(SFPL_Handle sfpl_handle, ++ const char *authover_username); ++ ++SFPL_API_PUBLIC int ++SFPL_AuthOverrideUserAdd(SFPL_Handle sfpl_handle, ++ const char *authover_username, ++ const char *username, ++ const char *client_ip, ++ time_t date, ++ int duration, ++ const char *url, ++ const char *reason, ++ const char *reasondata); ++ ++SFPL_API_PUBLIC int ++SFPL_AuthOverrideUserRemove(SFPL_Handle sfpl_handle, ++ const char *authover_username, ++ const char *username, ++ const char *client_ip); ++ ++SFPL_API_PUBLIC int ++SFPL_BypassUserAdd(SFPL_Handle sfpl_handle, ++ const char *username, ++ const char *client_ip, ++ time_t date, ++ const char *url, ++ const char *reason, ++ const char *reasondata); ++ ++SFPL_API_PUBLIC void ++SFPL_RedirectionHashCompute(SFPL_Handle sfpl_handle, ++ unsigned char *hash, ++ size_t hash_len, ++ const char *epochseconds, ++ const char *requestedurl, ++ const char *categorylist, ++ const char *useripaddress, ++ const char *username, ++ const char *actiontaken, ++ const char *actionreason, ++ const char *actionreasondata); ++ ++ ++SFPL_API_PUBLIC int /* needed for authserver */ ++SFPL_ErrorRedirUrlBuild(SFPL_Handle sfpl_handle, ++ char *redirurl, ++ size_t redirurl_len, ++ const char *url, ++ const char *client_ip, ++ const char *username); ++ ++SFPL_API_PUBLIC int /* Needed for Squid. */ ++SFPL_CheckUserCache(SFPL_Handle sfpl_handle, ++ char *query, ++ int type, ++ SFPL_User_Data **reply); ++ ++SFPL_API_PUBLIC int /* Needed for Squid. */ ++SFPL_AddUserCacheEntry(SFPL_Handle sfpl_handle, ++ char *query, ++ int query_type, ++ SFPL_User_Data *grouplist); ++ ++SFPL_API_PUBLIC void /* Needed for Squid. */ ++SFPL_FreeGroupList(SFPL_Handle sfpl_handle, ++ SFPL_User_Group_List *grouplist); ++ ++SFPL_API_PUBLIC void /* Needed for Squid. */ ++SFPL_FreeUserData(SFPL_Handle sfpl_handle, ++ SFPL_User_Data *data); ++ ++/* ++ * Policy ++ */ ++SFPL_API_PUBLIC int /* Needed for Squid. */ ++SFPL_UserLocalPolicyGet(SFPL_Handle sfpl_handle, ++ char *username, ++ char *ipaddr, ++ SFPL_Policy **policy, ++ SFPL_User_Data **user_data, ++ char *err_msg, ++ int msg_len, ++ int *log_error); ++ ++SFPL_API_PUBLIC int ++SFPL_UserPolicyGet(SFPL_Handle sfpl_handle, ++ char *username, ++ char *ipaddr, ++ SFPL_Policy **policy, ++ SFPL_User_Data **user_data, ++ char *err_msg, ++ int msg_len, ++ int *log_error); ++ ++SFPL_API_PUBLIC int ++SFPL_GroupPolicyGet(SFPL_Handle sfpl_handle, ++ SFPL_User_Group_List *user_grouplist, ++ SFPL_User_Data **user_data_list); ++ ++SFPL_API_PUBLIC int ++SFPL_GroupPolicyMerge(SFPL_Handle sfpl_handle, ++ SFPL_User_Data *grouplist, ++ SFPL_Policy **policy, ++ char *err_msg, ++ int msg_len, ++ int *log_error); ++ ++SFPL_API_PUBLIC int ++SFPL_PolicyFree(SFPL_Handle sfpl_handle, ++ SFPL_Policy *policy); ++ ++SFPL_API_PUBLIC char * ++SFPL_PolicyNameGet(SFPL_Handle sfpl_handle, ++ SFPL_Policy *policy); ++ ++SFPL_API_PUBLIC unsigned int ++SFPL_PolicyFlagsGet(SFPL_Handle sfpl_handle, ++ SFPL_Policy *policy); ++ ++SFPL_API_PUBLIC int ++SFPL_UrlWithProtocol(SFPL_Handle sfpl_handle, ++ const char *url, ++ char *built, ++ size_t built_len); ++ ++/*--------------------------------------------------------------*\ ++ * ++ * LOGGING ++ * ++\*--------------------------------------------------------------*/ ++ ++typedef SFCL_Log_Leve