vttp
An HTTP backed Virtual Table extension for SQLite
Loading...
Searching...
No Matches
tcp.h
Go to the documentation of this file.
1
5#pragma once
6#include <netdb.h>
7#include <openssl/ssl.h>
8#include <openssl/types.h>
9#include <stdbool.h>
10
11#define MAX_HOSTNAME_LENGTH 255
12
20int tcp_getaddrinfo(const char *hostname, const char *port, struct addrinfo **addr);
21
28int tcp_socket(struct addrinfo *addrinfo);
29
38int tcp_connect(int fd, struct sockaddr * addr, socklen_t len,
39 SSL **ssl, SSL_CTX **ctx, const char *hostname);
40
50ssize_t tcp_send(int fd, const char *bytes, size_t len, SSL *ssl);
51
60ssize_t tcp_recv(int fd, char *bytes, size_t len, SSL *ssl);
61
67void tcp_tls_free(SSL *ssl, SSL_CTX *ctx);
68
69#undef MAX_HOSTNAME_LENGTH
#define len(iter)
Read length of ITER.
Definition pyc.h:198
ssize_t tcp_send(int fd, const char *bytes, size_t len, SSL *ssl)
Send LEN BYTES over tcp connection at FD, potentially writing over the TLS connection at SSL,...
Definition tcp.c:38
void tcp_tls_free(SSL *ssl, SSL_CTX *ctx)
Shutdown and free SSL and CTX.
Definition tcp.c:69
int tcp_connect(int fd, struct sockaddr *addr, socklen_t len, SSL **ssl, SSL_CTX **ctx, const char *hostname)
connect() to socket FD using ADDR, optionally using TLS if TLS is not NULL.
Definition tcp.c:22
int tcp_socket(struct addrinfo *addrinfo)
Open socket fd from ADDRINFO and return it.
Definition tcp.c:98
ssize_t tcp_recv(int fd, char *bytes, size_t len, SSL *ssl)
Maybe recv LEN BYTES over the TCP connection at SSL, if it exists.
Definition tcp.c:53
int tcp_getaddrinfo(const char *hostname, const char *port, struct addrinfo **addr)
Write address info from HOSTNAME and PORT into ADDR.
Definition tcp.c:79