Blame include/git2/sys/stream.h

Packit Service 20376f
/*
Packit Service 20376f
 * Copyright (C) the libgit2 contributors. All rights reserved.
Packit Service 20376f
 *
Packit Service 20376f
 * This file is part of libgit2, distributed under the GNU GPL v2 with
Packit Service 20376f
 * a Linking Exception. For full terms see the included COPYING file.
Packit Service 20376f
 */
Packit Service 20376f
#ifndef INCLUDE_sys_git_stream_h__
Packit Service 20376f
#define INCLUDE_sys_git_stream_h__
Packit Service 20376f
Packit Service 20376f
#include "git2/common.h"
Packit Service 20376f
#include "git2/types.h"
Packit Service 20376f
#include "git2/proxy.h"
Packit Service 20376f
Packit Service 20376f
GIT_BEGIN_DECL
Packit Service 20376f
Packit Service 20376f
#define GIT_STREAM_VERSION 1
Packit Service 20376f
Packit Service 20376f
/**
Packit Service 20376f
 * Every stream must have this struct as its first element, so the
Packit Service 20376f
 * API can talk to it. You'd define your stream as
Packit Service 20376f
 *
Packit Service 20376f
 *     struct my_stream {
Packit Service 20376f
 *             git_stream parent;
Packit Service 20376f
 *             ...
Packit Service 20376f
 *     }
Packit Service 20376f
 *
Packit Service 20376f
 * and fill the functions
Packit Service 20376f
 */
Packit Service 20376f
typedef struct git_stream {
Packit Service 20376f
	int version;
Packit Service 20376f
Packit Service 20376f
	int encrypted;
Packit Service 20376f
	int proxy_support;
Packit Service 20376f
	int (*connect)(struct git_stream *);
Packit Service 20376f
	int (*certificate)(git_cert **, struct git_stream *);
Packit Service 20376f
	int (*set_proxy)(struct git_stream *, const git_proxy_options *proxy_opts);
Packit Service 20376f
	ssize_t (*read)(struct git_stream *, void *, size_t);
Packit Service 20376f
	ssize_t (*write)(struct git_stream *, const char *, size_t, int);
Packit Service 20376f
	int (*close)(struct git_stream *);
Packit Service 20376f
	void (*free)(struct git_stream *);
Packit Service 20376f
} git_stream;
Packit Service 20376f
Packit Service 20376f
typedef int (*git_stream_cb)(git_stream **out, const char *host, const char *port);
Packit Service 20376f
Packit Service 20376f
/**
Packit Service 20376f
 * Register a TLS stream constructor for the library to use
Packit Service 20376f
 *
Packit Service 20376f
 * If a constructor is already set, it will be overwritten. Pass
Packit Service 20376f
 * `NULL` in order to deregister the current constructor.
Packit Service 20376f
 *
Packit Service 20376f
 * @param ctor the constructor to use
Packit Service 20376f
 * @return 0 or an error code
Packit Service 20376f
 */
Packit Service 20376f
GIT_EXTERN(int) git_stream_register_tls(git_stream_cb ctor);
Packit Service 20376f
Packit Service 20376f
GIT_END_DECL
Packit Service 20376f
Packit Service 20376f
#endif