http-message.h 2.62 KB
Newer Older
Simon Morlat's avatar
Simon Morlat committed
1 2 3 4 5 6
/*
	belle-sip - SIP (RFC3261) library.
    Copyright (C) 2010  Belledonne Communications SARL

    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
7
    the Free Software Foundation, either version 2 of the License, or
Simon Morlat's avatar
Simon Morlat committed
8 9 10 11 12 13 14 15 16 17 18 19 20
    (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 BELLE_HTTP_MESSAGE_H
#define BELLE_HTTP_MESSAGE_H

Simon Morlat's avatar
Simon Morlat committed
21
#include "belle-sip/generic-uri.h"
Simon Morlat's avatar
Simon Morlat committed
22 23 24 25 26 27

#define BELLE_HTTP_REQUEST(obj)		BELLE_SIP_CAST(obj,belle_http_request_t)
#define BELLE_HTTP_RESPONSE(obj)	BELLE_SIP_CAST(obj,belle_http_response_t)

BELLE_SIP_BEGIN_DECLS

Simon Morlat's avatar
Simon Morlat committed
28 29 30 31 32
/**
 * Create an http request.
 * @param method
 * @param uri the http uri
 * @param ... optional list of belle_sip_header_t* to be included in the request, ending with NULL.
jehan's avatar
jehan committed
33
 */
Simon Morlat's avatar
Simon Morlat committed
34
BELLESIP_EXPORT belle_http_request_t *belle_http_request_create(const char *method, belle_generic_uri_t *uri, ...);
jehan's avatar
jehan committed
35 36 37
BELLESIP_EXPORT belle_http_request_t* belle_http_request_new();
BELLESIP_EXPORT belle_http_request_t* belle_http_request_parse(const char* raw);

38 39 40
BELLESIP_EXPORT int belle_http_request_is_cancelled(const belle_http_request_t *req);
BELLESIP_EXPORT void belle_http_request_cancel(belle_http_request_t *req);

jehan's avatar
jehan committed
41 42 43 44 45
BELLESIP_EXPORT belle_generic_uri_t* belle_http_request_get_uri(const belle_http_request_t* request);
BELLESIP_EXPORT void belle_http_request_set_uri(belle_http_request_t* request, belle_generic_uri_t* uri);
BELLESIP_EXPORT const char* belle_http_request_get_method(const belle_http_request_t* request);
BELLESIP_EXPORT void belle_http_request_set_method(belle_http_request_t* request,const char* method);

Simon Morlat's avatar
Simon Morlat committed
46
 BELLESIP_EXPORT belle_http_response_t *belle_http_request_get_response(belle_http_request_t *req);
jehan's avatar
jehan committed
47 48 49 50 51 52 53 54 55 56 57 58 59

/**
 * http response
 * */
BELLESIP_EXPORT int belle_http_response_get_status_code(const belle_http_response_t *response);
BELLESIP_EXPORT void belle_http_response_set_status_code(belle_http_response_t *response,int status);

BELLESIP_EXPORT const char* belle_http_response_get_reason_phrase(const belle_http_response_t *response);
BELLESIP_EXPORT void belle_http_response_set_reason_phrase(belle_http_response_t *response,const char* reason_phrase);


BELLESIP_EXPORT belle_http_response_t *belle_http_response_new(void);

Simon Morlat's avatar
Simon Morlat committed
60 61 62 63

BELLE_SIP_END_DECLS

#endif