soup-misc.h 2.7 KB

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