1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ 2 /* 3 * Copyright (C) 2005 Novell, Inc. 4 */ 5 6 #ifndef __SOUP_MESSAGE_HEADERS_H__ 7 #define __SOUP_MESSAGE_HEADERS_H__ 1 8 9 #include <libsoup/soup-types.h> 10 11 G_BEGIN_DECLS 12 13 typedef struct SoupMessageHeaders SoupMessageHeaders; 14 SOUP_AVAILABLE_IN_2_4 15 GType soup_message_headers_get_type (void); 16 #define SOUP_TYPE_MESSAGE_HEADERS (soup_message_headers_get_type ()) 17 18 typedef enum { 19 SOUP_MESSAGE_HEADERS_REQUEST, 20 SOUP_MESSAGE_HEADERS_RESPONSE, 21 SOUP_MESSAGE_HEADERS_MULTIPART 22 } SoupMessageHeadersType; 23 24 SOUP_AVAILABLE_IN_2_4 25 SoupMessageHeaders *soup_message_headers_new (SoupMessageHeadersType type); 26 27 SOUP_AVAILABLE_IN_2_4 28 void soup_message_headers_free (SoupMessageHeaders *hdrs); 29 30 SOUP_AVAILABLE_IN_2_4 31 void soup_message_headers_append (SoupMessageHeaders *hdrs, 32 const char *name, 33 const char *value); 34 SOUP_AVAILABLE_IN_2_4 35 void soup_message_headers_replace (SoupMessageHeaders *hdrs, 36 const char *name, 37 const char *value); 38 39 SOUP_AVAILABLE_IN_2_4 40 void soup_message_headers_remove (SoupMessageHeaders *hdrs, 41 const char *name); 42 SOUP_AVAILABLE_IN_2_4 43 void soup_message_headers_clear (SoupMessageHeaders *hdrs); 44 45 SOUP_AVAILABLE_IN_2_36 46 void soup_message_headers_clean_connection_headers (SoupMessageHeaders *hdrs); 47 48 #ifndef SOUP_DISABLE_DEPRECATED 49 SOUP_AVAILABLE_IN_2_4 50 SOUP_DEPRECATED_IN_2_28_FOR ("soup_message_headers_get_one or soup_message_headers_get_list") 51 const char *soup_message_headers_get (SoupMessageHeaders *hdrs, 52 const char *name); 53 #endif 54 SOUP_AVAILABLE_IN_2_28 55 const char *soup_message_headers_get_one (SoupMessageHeaders *hdrs, 56 const char *name); 57 SOUP_AVAILABLE_IN_2_28 58 const char *soup_message_headers_get_list (SoupMessageHeaders *hdrs, 59 const char *name); 60 SOUP_AVAILABLE_IN_2_50 61 gboolean soup_message_headers_header_contains (SoupMessageHeaders *hdrs, 62 const char *name, 63 const char *token); 64 SOUP_AVAILABLE_IN_2_50 65 gboolean soup_message_headers_header_equals (SoupMessageHeaders *hdrs, 66 const char *name, 67 const char *value); 68 69 typedef void (*SoupMessageHeadersForeachFunc)(const char *name, 70 const char *value, 71 gpointer user_data); 72 73 SOUP_AVAILABLE_IN_2_4 74 void soup_message_headers_foreach (SoupMessageHeaders *hdrs, 75 SoupMessageHeadersForeachFunc func, 76 gpointer user_data); 77 78 SOUP_AVAILABLE_IN_2_50 79 SoupMessageHeadersType soup_message_headers_get_headers_type (SoupMessageHeaders *hdrs); 80 81 typedef struct { 82 /*< private >*/ 83 gpointer dummy[3]; 84 } SoupMessageHeadersIter; 85 86 SOUP_AVAILABLE_IN_2_4 87 void soup_message_headers_iter_init (SoupMessageHeadersIter *iter, 88 SoupMessageHeaders *hdrs); 89 SOUP_AVAILABLE_IN_2_4 90 gboolean soup_message_headers_iter_next (SoupMessageHeadersIter *iter, 91 const char **name, 92 const char **value); 93 94 /* Specific headers */ 95 96 typedef enum { 97 SOUP_ENCODING_UNRECOGNIZED, 98 SOUP_ENCODING_NONE, 99 SOUP_ENCODING_CONTENT_LENGTH, 100 SOUP_ENCODING_EOF, 101 SOUP_ENCODING_CHUNKED, 102 SOUP_ENCODING_BYTERANGES 103 } SoupEncoding; 104 105 SOUP_AVAILABLE_IN_2_4 106 SoupEncoding soup_message_headers_get_encoding (SoupMessageHeaders *hdrs); 107 SOUP_AVAILABLE_IN_2_4 108 void soup_message_headers_set_encoding (SoupMessageHeaders *hdrs, 109 SoupEncoding encoding); 110 111 SOUP_AVAILABLE_IN_2_4 112 goffset soup_message_headers_get_content_length (SoupMessageHeaders *hdrs); 113 SOUP_AVAILABLE_IN_2_4 114 void soup_message_headers_set_content_length (SoupMessageHeaders *hdrs, 115 goffset content_length); 116 117 typedef enum { 118 SOUP_EXPECTATION_UNRECOGNIZED = (1 << 0), 119 SOUP_EXPECTATION_CONTINUE = (1 << 1) 120 } SoupExpectation; 121 122 SOUP_AVAILABLE_IN_2_4 123 SoupExpectation soup_message_headers_get_expectations (SoupMessageHeaders *hdrs); 124 SOUP_AVAILABLE_IN_2_4 125 void soup_message_headers_set_expectations (SoupMessageHeaders *hdrs, 126 SoupExpectation expectations); 127 128 typedef struct { 129 goffset start; 130 goffset end; 131 } SoupRange; 132 133 SOUP_AVAILABLE_IN_2_26 134 gboolean soup_message_headers_get_ranges (SoupMessageHeaders *hdrs, 135 goffset total_length, 136 SoupRange **ranges, 137 int *length); 138 SOUP_AVAILABLE_IN_2_26 139 void soup_message_headers_free_ranges (SoupMessageHeaders *hdrs, 140 SoupRange *ranges); 141 SOUP_AVAILABLE_IN_2_26 142 void soup_message_headers_set_ranges (SoupMessageHeaders *hdrs, 143 SoupRange *ranges, 144 int length); 145 SOUP_AVAILABLE_IN_2_26 146 void soup_message_headers_set_range (SoupMessageHeaders *hdrs, 147 goffset start, 148 goffset end); 149 150 SOUP_AVAILABLE_IN_2_26 151 gboolean soup_message_headers_get_content_range (SoupMessageHeaders *hdrs, 152 goffset *start, 153 goffset *end, 154 goffset *total_length); 155 SOUP_AVAILABLE_IN_2_26 156 void soup_message_headers_set_content_range (SoupMessageHeaders *hdrs, 157 goffset start, 158 goffset end, 159 goffset total_length); 160 161 162 SOUP_AVAILABLE_IN_2_26 163 const char *soup_message_headers_get_content_type (SoupMessageHeaders *hdrs, 164 GHashTable **params); 165 SOUP_AVAILABLE_IN_2_26 166 void soup_message_headers_set_content_type (SoupMessageHeaders *hdrs, 167 const char *content_type, 168 GHashTable *params); 169 170 SOUP_AVAILABLE_IN_2_26 171 gboolean soup_message_headers_get_content_disposition (SoupMessageHeaders *hdrs, 172 char **disposition, 173 GHashTable **params); 174 SOUP_AVAILABLE_IN_2_26 175 void soup_message_headers_set_content_disposition (SoupMessageHeaders *hdrs, 176 const char *disposition, 177 GHashTable *params); 178 179 G_END_DECLS 180 181 #endif /* __SOUP_MESSAGE_HEADERS_H__ */ 182