summaryrefslogtreecommitdiffabout
path: root/lib/libeclat.h
blob: 670c51bae792106aaad619b91fa223836b340ffe (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
64
65
66
67
68
69
70
71
72
73
/* This file is part of Eclat.
   Copyright (C) 2012 Sergey Poznyakoff.
 
   Eclat 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, or (at your option)
   any later version.
 
   Eclat 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 Eclat.  If not, see <http://www.gnu.org/licenses/>. */

#include <stddef.h>
#include <expat.h>
#include "grecs.h"

void hmac_sha1(const void *text, size_t textlen,
	       const void *key, size_t keylen,
	       void *digest);
void urlencode(const char *input, size_t len,
	       char **poutput, size_t *poutlen);

void eclat_base64_encode(const unsigned char *input, size_t input_len,
			 unsigned char **output, size_t *output_len);
int eclat_base64_decode(const unsigned char *input, size_t input_len,
			unsigned char **output, size_t *output_len);


struct ec2_param {
	char *name;
	char *value;
};

#define EC2_API_VERSION "2012-08-15"

#define EC2_QF_HTTPS 0x01
#define EC2_QF_POST  0x02

struct ec2_query {
	int flags;       /* Composed from EC2_QF_* bits */
	char *endpoint;  /* endpoint  */
	char *uri;       /* URI without parameters */
	struct grecs_symtab *params; /* Query parameters */
	char *signature;
	unsigned long ttl; /* Time-to-live in seconds */
};

struct ec2_query *eclat_query_create(int flags, const char *endpoint,
				     const char *uri);
void eclat_query_free(struct ec2_query *);

int eclat_query_signature(struct ec2_query *req, char *secret);

char *eclat_query_to_url(struct ec2_query *req, char **post_params);

void eclat_query_encode(struct ec2_query *q);

typedef struct eclat_partial_tree *eclat_partial_tree_t;

eclat_partial_tree_t eclat_partial_tree_create(void);
void eclat_partial_tree_destroy(eclat_partial_tree_t);
struct grecs_node *eclat_partial_tree_finish(eclat_partial_tree_t);
void eclat_partial_tree_data_handler(void *data, const XML_Char *s, int len);
void eclat_partial_tree_start_handler(void *data, const XML_Char *name,
				      const XML_Char **atts);
void eclat_partial_tree_end_handler(void *data, const XML_Char *name);



Return to:

Send suggestions and report system problems to the System administrator.