Blame src/plugins/https-utils.h

Packit 8ea169
/*
Packit 8ea169
    Copyright (C) 2012  ABRT Team
Packit 8ea169
    Copyright (C) 2012  Red Hat, Inc.
Packit 8ea169
Packit 8ea169
    This program is free software; you can redistribute it and/or modify
Packit 8ea169
    it under the terms of the GNU General Public License as published by
Packit 8ea169
    the Free Software Foundation; either version 2 of the License, or
Packit 8ea169
    (at your option) any later version.
Packit 8ea169
Packit 8ea169
    This program is distributed in the hope that it will be useful,
Packit 8ea169
    but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 8ea169
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit 8ea169
    GNU General Public License for more details.
Packit 8ea169
Packit 8ea169
    You should have received a copy of the GNU General Public License along
Packit 8ea169
    with this program; if not, write to the Free Software Foundation, Inc.,
Packit 8ea169
    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Packit 8ea169
*/
Packit 8ea169
Packit 8ea169
#ifndef ABRT_HTTPS_UTILS_H_
Packit 8ea169
#define ABRT_HTTPS_UTILS_H_
Packit 8ea169
Packit 8ea169
#include <libreport/client.h>
Packit 8ea169
#include <nspr.h>
Packit 8ea169
#include <nss.h>
Packit 8ea169
#include <pk11pub.h>
Packit 8ea169
#include <ssl.h>
Packit 8ea169
#include <sslproto.h>
Packit 8ea169
#include <sslerr.h>
Packit 8ea169
#include <secerr.h>
Packit 8ea169
#include <secmod.h>
Packit 8ea169
#include "libabrt.h"
Packit 8ea169
Packit 8ea169
#if HAVE_LOCALE_H
Packit 8ea169
#include <locale.h>
Packit 8ea169
#endif
Packit 8ea169
Packit 8ea169
struct language
Packit 8ea169
{
Packit 8ea169
    char *locale;
Packit 8ea169
    char *encoding;
Packit 8ea169
    char *accept_charset;
Packit 8ea169
    char *accept_language;
Packit 8ea169
};
Packit 8ea169
void get_language(struct language *lang);
Packit 8ea169
Packit 8ea169
struct https_cfg
Packit 8ea169
{
Packit 8ea169
    const char *url;
Packit 8ea169
    unsigned port;
Packit 8ea169
    bool ssl_allow_insecure;
Packit 8ea169
};
Packit 8ea169
Packit 8ea169
void alert_server_error(const char *peer_name);
Packit 8ea169
void alert_connection_error(const char *peer_name);
Packit 8ea169
void ssl_connect(struct https_cfg *cfg, PRFileDesc **tcp_sock, PRFileDesc **ssl_sock);
Packit 8ea169
void ssl_disconnect(PRFileDesc *ssl_sock);
Packit 8ea169
char *http_get_header_value(const char *message, const char *header_name);
Packit 8ea169
char *http_get_body(const char *message);
Packit 8ea169
int http_get_response_code(const char *message);
Packit 8ea169
void http_print_headers(FILE *file, const char *message);
Packit 8ea169
char *tcp_read_response(PRFileDesc *tcp_sock);
Packit 8ea169
char *http_join_chunked(char *body, int bodylen);
Packit 8ea169
void nss_init(SECMODModule **mod);
Packit 8ea169
void nss_close(SECMODModule *mod);
Packit 8ea169
Packit 8ea169
#endif