• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2 /*
3  * Copyright (C) 2003 Novell, Inc.
4  * Copyright (C) 2008 Red Hat, Inc.
5  */
6 
7 #ifndef __SOUP_MESSAGE_QUEUE_H__
8 #define __SOUP_MESSAGE_QUEUE_H__ 1
9 
10 #include "soup-connection.h"
11 #include "soup-message.h"
12 #include "soup-session.h"
13 
14 G_BEGIN_DECLS
15 
16 typedef enum {
17 	SOUP_MESSAGE_STARTING,
18 	SOUP_MESSAGE_GOT_CONNECTION,
19 	SOUP_MESSAGE_CONNECTING,
20 	SOUP_MESSAGE_CONNECTED,
21 	SOUP_MESSAGE_TUNNELING,
22 	SOUP_MESSAGE_TUNNELED,
23 	SOUP_MESSAGE_READY,
24 	SOUP_MESSAGE_RUNNING,
25 	SOUP_MESSAGE_CACHED,
26 	SOUP_MESSAGE_RESTARTING,
27 	SOUP_MESSAGE_FINISHING,
28 	SOUP_MESSAGE_FINISHED
29 } SoupMessageQueueItemState;
30 
31 struct _SoupMessageQueueItem {
32 	/*< public >*/
33 	SoupSession *session;
34 	SoupMessageQueue *queue;
35 	SoupMessage *msg;
36 	SoupSessionCallback callback;
37 	gpointer callback_data;
38 	GMainContext *async_context;
39 
40 	GCancellable *cancellable;
41 	GError *error;
42 
43 	SoupConnection *conn;
44 	GTask *task;
45 	GSource *io_source;
46 
47 	guint paused            : 1;
48 	guint new_api           : 1;
49 	guint io_started        : 1;
50 	guint async             : 1;
51 	guint async_pending     : 1;
52 	guint conn_is_dedicated : 1;
53 	guint connect_only      : 1;
54 	guint priority          : 3;
55 	guint resend_count      : 5;
56 
57 	SoupMessageQueueItemState state;
58 
59 	/*< private >*/
60 	guint removed           : 1;
61 	guint ref_count         : 31;
62 	SoupMessageQueueItem *prev, *next;
63 	SoupMessageQueueItem *related;
64 };
65 
66 SoupMessageQueue     *soup_message_queue_new        (SoupSession          *session);
67 SoupMessageQueueItem *soup_message_queue_append     (SoupMessageQueue     *queue,
68 						     SoupMessage          *msg,
69 						     SoupSessionCallback   callback,
70 						     gpointer              user_data);
71 
72 SoupMessageQueueItem *soup_message_queue_lookup     (SoupMessageQueue     *queue,
73 						     SoupMessage          *msg);
74 
75 SoupMessageQueueItem *soup_message_queue_first      (SoupMessageQueue     *queue);
76 SoupMessageQueueItem *soup_message_queue_next       (SoupMessageQueue     *queue,
77 						     SoupMessageQueueItem *item);
78 
79 void                  soup_message_queue_remove     (SoupMessageQueue     *queue,
80 						     SoupMessageQueueItem *item);
81 
82 void                  soup_message_queue_destroy    (SoupMessageQueue     *queue);
83 
84 void soup_message_queue_item_ref            (SoupMessageQueueItem *item);
85 void soup_message_queue_item_unref          (SoupMessageQueueItem *item);
86 
87 G_END_DECLS
88 
89 #endif /* __SOUP_MESSAGE_QUEUE_H__ */
90