summaryrefslogtreecommitdiff
path: root/src/libwebvi/webvicontext.h
blob: 7fa073825ae507eeb2a3fd1d4e871c0c010fe107 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/*
 * webvicontext.h
 *
 * Copyright (c) 2013 Antti Ajanki <antti.ajanki@iki.fi>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef __WEBVICONTEXT_H
#define __WEBVICONTEXT_H

#include <stdbool.h>
#include <curl/curl.h>
#include <glib.h>
#include "libwebvi.h"
#include "linktemplates.h"
#include "pipecomponent.h"

typedef struct WebviContext WebviContext;
typedef struct WebviRequest WebviRequest;

WebviContext *get_context_by_handle(WebviCtx handle);

WebviCtx webvi_context_initialize(void);
void webvi_context_cleanup(WebviCtx ctxhandle);
void webvi_context_cleanup_all();

void webvi_context_set_debug(WebviContext *self,
                             bool d);
void webvi_context_set_template_path(WebviContext *self,
                                     const char *path);
const char *webvi_context_get_template_path(const WebviContext *self);
const LinkTemplates *get_link_templates(WebviContext *self);
CURLM *webvi_context_get_curl_multi_handle(WebviContext *self);

WebviHandle webvi_context_add_request(WebviContext *self, WebviRequest *req);
void webvi_context_remove_request(WebviContext *self, WebviHandle h);
WebviRequest *webvi_context_get_request(WebviContext *self, WebviHandle h);

WebviResult webvi_context_fdset(WebviContext *ctx, fd_set *readfd,
                                fd_set *writefd, fd_set *excfd, int *max_fd);
void webvi_context_handle_socket_action(
  WebviContext *ctx, int sockfd, int ev_bitmask, long *running_handles);

void webvi_context_add_finished_message(WebviContext *messages,
                                        const WebviRequest *req,
                                        RequestState status_code,
                                        const char *message_text);
WebviMsg *webvi_context_next_message(WebviContext *ctx,
                                     int *remaining_messages);

#endif // __WEBVICONTEXT_H