-extern const struct parsers client_patterns[];
-extern const struct parsers server_patterns[];
-
-extern void (* const add_client_headers[])(struct client_state *);
-extern void (* const add_server_headers[])(struct client_state *);
-
-extern int flush_socket(int fd, struct client_state *csp);
-extern int add_to_iob(struct client_state *csp, char *buf, int n);
-extern char *get_header(struct client_state *csp);
-
-extern char *sed(const struct parsers pats[], void (* const more_headers[])(struct client_state *), struct client_state *csp);
-
-extern void free_http_request(struct http_request *http);
-extern void parse_http_request(char *req, struct http_request *http, struct client_state *csp);
-
-extern char *crumble(const struct parsers *v, char *s, struct client_state *csp);
-
-extern char *client_referrer(const struct parsers *v, char *s, struct client_state *csp);
-extern char *client_uagent(const struct parsers *v, char *s, struct client_state *csp);
-extern char *client_ua(const struct parsers *v, char *s, struct client_state *csp);
-extern char *client_from(const struct parsers *v, char *s, struct client_state *csp);
-extern char *client_send_cookie(const struct parsers *v, char *s, struct client_state *csp);
-extern char *client_x_forwarded(const struct parsers *v, char *s, struct client_state *csp);
-extern void client_cookie_adder(struct client_state *csp);
-extern void client_xtra_adder(struct client_state *csp);
-extern void client_x_forwarded_adder(struct client_state *csp);
-extern char *server_set_cookie(const struct parsers *v, char *s, struct client_state *csp);
-
-#if defined(PCRS) || defined(KILLPOPUPS)
-extern char *content_type(const struct parsers *v, char *s, struct client_state *csp);
-#endif /* defined(PCRS) || defined(KILLPOPUPS) */
-
-#ifdef PCRS
-extern char *content_length(const struct parsers *v, char *s, struct client_state *csp);
-#endif /* def PCRS */
-
-#ifdef FORCE_LOAD
-char *client_host(const struct parsers *v, char *s, struct client_state *csp);
-int strclean(const char *string, const char *substring);
-#endif /* def FORCE_LOAD */
-
-#if defined(DETECT_MSIE_IMAGES)
-extern char *client_accept(const struct parsers *v, char *s, struct client_state *csp);
-#endif /* defined(DETECT_MSIE_IMAGES) */
+/* Used for sed()'s second argument. */
+#define FILTER_CLIENT_HEADERS 0
+#define FILTER_SERVER_HEADERS 1
+
+extern long flush_socket(jb_socket fd, struct iob *iob);
+extern jb_err add_to_iob(struct iob *iob, const size_t buffer_limit, char *src, long n);
+extern void clear_iob(struct iob *iob);
+extern jb_err decompress_iob(struct client_state *csp);
+extern char *get_header(struct iob *iob);
+extern char *get_header_value(const struct list *header_list, const char *header_name);
+extern jb_err sed(struct client_state *csp, int filter_server_headers);
+extern jb_err update_server_headers(struct client_state *csp);
+extern void get_http_time(int time_offset, char *buf, size_t buffer_size);
+extern jb_err get_destination_from_headers(const struct list *headers, struct http_request *http);
+extern unsigned long long get_expected_content_length(struct list *headers);
+extern jb_err client_transfer_encoding(struct client_state *csp, char **header);
+
+#ifdef FEATURE_FORCE_LOAD
+extern int strclean(char *string, const char *substring);
+#endif /* def FEATURE_FORCE_LOAD */