2012-04-14 22:19:31 +04:00
|
|
|
/**
|
2012-10-09 07:02:04 +04:00
|
|
|
* FreeRDP: A Remote Desktop Protocol Implementation
|
2012-04-14 22:19:31 +04:00
|
|
|
* Hypertext Transfer Protocol (HTTP)
|
|
|
|
*
|
|
|
|
* Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
|
2017-06-06 15:01:41 +03:00
|
|
|
#ifndef FREERDP_LIB_CORE_GATEWAY_HTTP_H
|
|
|
|
#define FREERDP_LIB_CORE_GATEWAY_HTTP_H
|
2012-04-14 22:19:31 +04:00
|
|
|
|
2018-09-27 16:04:41 +03:00
|
|
|
#include <winpr/stream.h>
|
|
|
|
#include <winpr/winhttp.h>
|
2012-04-17 00:21:46 +04:00
|
|
|
|
2016-08-10 10:12:55 +03:00
|
|
|
#include <freerdp/api.h>
|
2018-09-27 16:04:41 +03:00
|
|
|
#include <freerdp/crypto/tls.h>
|
2012-12-14 05:23:37 +04:00
|
|
|
|
2018-09-27 16:04:41 +03:00
|
|
|
/* HTTP context */
|
|
|
|
typedef struct _http_context HttpContext;
|
2012-04-14 22:19:31 +04:00
|
|
|
|
2018-09-27 16:04:41 +03:00
|
|
|
FREERDP_LOCAL HttpContext* http_context_new(void);
|
|
|
|
FREERDP_LOCAL void http_context_free(HttpContext* context);
|
2012-04-14 22:19:31 +04:00
|
|
|
|
2016-08-10 10:12:55 +03:00
|
|
|
FREERDP_LOCAL BOOL http_context_set_method(HttpContext* context,
|
|
|
|
const char* Method);
|
2018-09-27 16:04:41 +03:00
|
|
|
FREERDP_LOCAL const char* http_context_get_uri(HttpContext* context);
|
2016-08-10 10:12:55 +03:00
|
|
|
FREERDP_LOCAL BOOL http_context_set_uri(HttpContext* context, const char* URI);
|
|
|
|
FREERDP_LOCAL BOOL http_context_set_user_agent(HttpContext* context,
|
|
|
|
const char* UserAgent);
|
|
|
|
FREERDP_LOCAL BOOL http_context_set_host(HttpContext* context,
|
|
|
|
const char* Host);
|
|
|
|
FREERDP_LOCAL BOOL http_context_set_accept(HttpContext* context,
|
|
|
|
const char* Accept);
|
|
|
|
FREERDP_LOCAL BOOL http_context_set_cache_control(HttpContext* context,
|
|
|
|
const char* CacheControl);
|
|
|
|
FREERDP_LOCAL BOOL http_context_set_connection(HttpContext* context,
|
|
|
|
const char* Connection);
|
|
|
|
FREERDP_LOCAL BOOL http_context_set_pragma(HttpContext* context,
|
|
|
|
const char* Pragma);
|
|
|
|
FREERDP_LOCAL BOOL http_context_set_rdg_connection_id(HttpContext* context,
|
|
|
|
const char* RdgConnectionId);
|
2018-02-13 18:40:23 +03:00
|
|
|
FREERDP_LOCAL BOOL http_context_set_rdg_auth_scheme(HttpContext* context,
|
|
|
|
const char* RdgAuthScheme);
|
2012-04-14 22:19:31 +04:00
|
|
|
|
2018-09-27 16:04:41 +03:00
|
|
|
/* HTTP request */
|
|
|
|
typedef struct _http_request HttpRequest;
|
|
|
|
|
|
|
|
FREERDP_LOCAL HttpRequest* http_request_new(void);
|
|
|
|
FREERDP_LOCAL void http_request_free(HttpRequest* request);
|
2012-04-14 22:19:31 +04:00
|
|
|
|
2016-08-10 10:12:55 +03:00
|
|
|
FREERDP_LOCAL BOOL http_request_set_method(HttpRequest* request,
|
|
|
|
const char* Method);
|
2018-09-27 16:04:41 +03:00
|
|
|
FREERDP_LOCAL SSIZE_T http_request_get_content_length(HttpRequest* request);
|
|
|
|
FREERDP_LOCAL BOOL http_request_set_content_length(HttpRequest* request, size_t length);
|
|
|
|
|
|
|
|
FREERDP_LOCAL const char* http_request_get_uri(HttpRequest* request);
|
2016-08-10 10:12:55 +03:00
|
|
|
FREERDP_LOCAL BOOL http_request_set_uri(HttpRequest* request, const char* URI);
|
|
|
|
FREERDP_LOCAL BOOL http_request_set_auth_scheme(HttpRequest* request,
|
|
|
|
const char* AuthScheme);
|
|
|
|
FREERDP_LOCAL BOOL http_request_set_auth_param(HttpRequest* request,
|
|
|
|
const char* AuthParam);
|
|
|
|
FREERDP_LOCAL BOOL http_request_set_transfer_encoding(HttpRequest* request,
|
|
|
|
const char* TransferEncoding);
|
2012-04-14 22:19:31 +04:00
|
|
|
|
2016-08-10 10:12:55 +03:00
|
|
|
FREERDP_LOCAL wStream* http_request_write(HttpContext* context,
|
|
|
|
HttpRequest* request);
|
2012-04-14 22:19:31 +04:00
|
|
|
|
2018-09-27 16:04:41 +03:00
|
|
|
/* HTTP response */
|
|
|
|
typedef struct _http_response HttpResponse;
|
2012-04-17 00:21:46 +04:00
|
|
|
|
2018-09-27 16:04:41 +03:00
|
|
|
FREERDP_LOCAL HttpResponse* http_response_new(void);
|
|
|
|
FREERDP_LOCAL void http_response_free(HttpResponse* response);
|
2012-04-22 00:18:07 +04:00
|
|
|
|
2018-09-27 16:04:41 +03:00
|
|
|
FREERDP_LOCAL BOOL http_response_print(HttpResponse* response);
|
2018-11-12 17:40:10 +03:00
|
|
|
FREERDP_LOCAL HttpResponse* http_response_recv(rdpTls* tls, BOOL readContentLength);
|
2012-04-17 00:21:46 +04:00
|
|
|
|
2018-09-27 16:04:41 +03:00
|
|
|
FREERDP_LOCAL long http_response_get_status_code(HttpResponse* response);
|
|
|
|
FREERDP_LOCAL SSIZE_T http_response_get_body_length(HttpResponse* response);
|
|
|
|
FREERDP_LOCAL const char* http_response_get_auth_token(HttpResponse* respone, const char* method);
|
2012-04-17 00:21:46 +04:00
|
|
|
|
2017-06-06 15:01:41 +03:00
|
|
|
#endif /* FREERDP_LIB_CORE_GATEWAY_HTTP_H */
|