• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2 /*
3  * Copyright (C) 2012 Igalia, S.L.
4  */
5 
6 
7 #ifndef __SOUP_CONTENT_PROCESSOR_H__
8 #define __SOUP_CONTENT_PROCESSOR_H__ 1
9 
10 #include <libsoup/soup-types.h>
11 #include <gio/gio.h>
12 
13 G_BEGIN_DECLS
14 
15 #define SOUP_TYPE_CONTENT_PROCESSOR                 (soup_content_processor_get_type ())
16 #define SOUP_CONTENT_PROCESSOR(obj)                 (G_TYPE_CHECK_INSTANCE_CAST ((obj), SOUP_TYPE_CONTENT_PROCESSOR, SoupContentProcessor))
17 #define SOUP_IS_CONTENT_PROCESSOR(obj)              (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SOUP_TYPE_CONTENT_PROCESSOR))
18 #define SOUP_CONTENT_PROCESSOR_GET_INTERFACE(inst)  (G_TYPE_INSTANCE_GET_INTERFACE ((inst), SOUP_TYPE_CONTENT_PROCESSOR, SoupContentProcessorInterface))
19 
20 typedef enum {
21 	SOUP_STAGE_INVALID,
22 
23 	SOUP_STAGE_MESSAGE_BODY,      /* Raw network data */
24 	SOUP_STAGE_TRANSFER_ENCODING, /* SoupBodyInputStream is here */
25 	SOUP_STAGE_ENTITY_BODY,       /* Has Transfer-Encoding removed */
26 	SOUP_STAGE_CONTENT_ENCODING,  /* SoupContentDecoder works here */
27 	SOUP_STAGE_BODY_DATA          /* Actual body data */
28 } SoupProcessingStage;
29 
30 typedef struct _SoupContentProcessor             SoupContentProcessor;
31 typedef struct _SoupContentProcessorInterface    SoupContentProcessorInterface;
32 
33 struct _SoupContentProcessorInterface {
34 	GTypeInterface parent;
35 
36 	SoupProcessingStage processing_stage;
37 
38 	/* methods */
39 	GInputStream*       (*wrap_input)             (SoupContentProcessor *processor,
40 						       GInputStream         *base_stream,
41 						       SoupMessage          *msg,
42 						       GError              **error);
43 };
44 
45 GType soup_content_processor_get_type (void);
46 
47 GInputStream       *soup_content_processor_wrap_input           (SoupContentProcessor *processor,
48 								 GInputStream         *base_stream,
49 								 SoupMessage          *msg,
50 								 GError              **error);
51 
52 SoupProcessingStage soup_content_processor_get_processing_stage (SoupContentProcessor *processor);
53 
54 G_END_DECLS
55 
56 #endif /* __SOUP_CONTENT_PROCESSOR_H__ */
57