1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ 2 /* 3 * Copyright (C) 2000-2003, Ximian, Inc. 4 */ 5 6 #ifndef __SOUP_MISC_H__ 7 #define __SOUP_MISC_H__ 1 8 9 #include <libsoup/soup-types.h> 10 11 G_BEGIN_DECLS 12 13 /* Non-default-GMainContext operations */ 14 SOUP_AVAILABLE_IN_2_4 15 GSource *soup_add_io_watch (GMainContext *async_context, 16 GIOChannel *chan, 17 GIOCondition condition, 18 GIOFunc function, 19 gpointer data); 20 SOUP_AVAILABLE_IN_2_4 21 GSource *soup_add_idle (GMainContext *async_context, 22 GSourceFunc function, 23 gpointer data); 24 SOUP_AVAILABLE_IN_2_24 25 GSource *soup_add_completion (GMainContext *async_context, 26 GSourceFunc function, 27 gpointer data); 28 SOUP_AVAILABLE_IN_2_4 29 GSource *soup_add_timeout (GMainContext *async_context, 30 guint interval, 31 GSourceFunc function, 32 gpointer data); 33 34 /* Misc utils */ 35 36 SOUP_AVAILABLE_IN_2_4 37 guint soup_str_case_hash (gconstpointer key); 38 SOUP_AVAILABLE_IN_2_4 39 gboolean soup_str_case_equal (gconstpointer v1, 40 gconstpointer v2); 41 42 #define _SOUP_ATOMIC_INTERN_STRING(variable, value) ((const char *)(g_atomic_pointer_get (&(variable)) ? (variable) : (g_atomic_pointer_set (&(variable), (gpointer)g_intern_static_string (value)), (variable)))) 43 44 /* character classes */ 45 46 SOUP_AVAILABLE_IN_2_4 47 const char soup_char_attributes[]; 48 #define SOUP_CHAR_URI_PERCENT_ENCODED 0x01 49 #define SOUP_CHAR_URI_GEN_DELIMS 0x02 50 #define SOUP_CHAR_URI_SUB_DELIMS 0x04 51 #define SOUP_CHAR_HTTP_SEPARATOR 0x08 52 #define SOUP_CHAR_HTTP_CTL 0x10 53 54 #define soup_char_is_uri_percent_encoded(ch) (soup_char_attributes[(guchar)ch] & SOUP_CHAR_URI_PERCENT_ENCODED) 55 #define soup_char_is_uri_gen_delims(ch) (soup_char_attributes[(guchar)ch] & SOUP_CHAR_URI_GEN_DELIMS) 56 #define soup_char_is_uri_sub_delims(ch) (soup_char_attributes[(guchar)ch] & SOUP_CHAR_URI_SUB_DELIMS) 57 #define soup_char_is_uri_unreserved(ch) (!(soup_char_attributes[(guchar)ch] & (SOUP_CHAR_URI_PERCENT_ENCODED | SOUP_CHAR_URI_GEN_DELIMS | SOUP_CHAR_URI_SUB_DELIMS))) 58 #define soup_char_is_token(ch) (!(soup_char_attributes[(guchar)ch] & (SOUP_CHAR_HTTP_SEPARATOR | SOUP_CHAR_HTTP_CTL))) 59 60 /* SSL stuff */ 61 SOUP_AVAILABLE_IN_2_4 62 const gboolean soup_ssl_supported; 63 64 /* Part of a debugging API */ 65 66 typedef enum { 67 SOUP_CONNECTION_NEW, 68 SOUP_CONNECTION_CONNECTING, 69 SOUP_CONNECTION_IDLE, 70 SOUP_CONNECTION_IN_USE, 71 SOUP_CONNECTION_REMOTE_DISCONNECTED, 72 SOUP_CONNECTION_DISCONNECTED 73 } SoupConnectionState; 74 75 G_END_DECLS 76 77 #endif /* __SOUP_MISC_H__ */ 78