mirror of
https://gitlab.nic.cz/labs/bird.git
synced 2025-01-23 09:21:53 +00:00
4cf229a0b5
Add the RPKI protocol (RFC 6810) using the RTRLib (http://rpki.realmv6.org/) that is integrated inside the BIRD's code. Implemeted transports are: - unprotected transport over TCP - secure transport over SSHv2 The code should work properly with one cache server per protocol. A compilation has to be hacked with: $ ./configure LIBS='-lssh' ... Example configuration of bird.conf: ... roa table roatable; protocol rpki { roa table roatable; cache "rpki-validator.realmv6.org"; } protocol rpki { roa table roatable; cache "localhost" { port 2222; ssh encryption { bird private key "/home/birdgeek/.ssh/id_rsa"; cache public key "/home/birdgeek/.ssh/known_hosts"; user "birdgeek"; }; }; } ... TODO list: - load libssh2 using dlopen - support more cache servers per protocol
97 lines
2.4 KiB
C
97 lines
2.4 KiB
C
/*
|
|
* BIRD -- The Resource Public Key Infrastructure (RPKI) to Router Protocol
|
|
*
|
|
* (c) 2015 CZ.NIC
|
|
*
|
|
* This file was part of RTRlib: http://rpki.realmv6.org/
|
|
*
|
|
* Can be freely distributed and used under the terms of the GNU GPL.
|
|
*/
|
|
|
|
/**
|
|
* @defgroup mod_transport_h Transport sockets
|
|
* @brief The RTR transport sockets implement the communication channel
|
|
* (e.g., SSH, TCP, TCP-AO) between an RTR server and client.
|
|
* @details Before using the transport socket, a tr_socket must be
|
|
* initialized based on a protocol-dependent init function (e.g.,
|
|
* tr_tcp_init()).\n
|
|
* The tr_* functions call the corresponding function pointers, which are
|
|
* passed in the tr_socket struct, and forward the remaining arguments.
|
|
*
|
|
* @{
|
|
*/
|
|
|
|
#ifndef RTR_TRANSPORT_H
|
|
#define RTR_TRANSPORT_H
|
|
#include <time.h>
|
|
|
|
/**
|
|
* @brief The return values for tr_ functions.
|
|
*/
|
|
enum tr_rtvals {
|
|
/** @brief Operation was successfull. */
|
|
TR_SUCCESS = 0,
|
|
|
|
/** Error occured. */
|
|
TR_ERROR = -1,
|
|
|
|
/** No data is available on the socket. */
|
|
TR_WOULDBLOCK = -2,
|
|
|
|
/** Call was interrupted from a signal */
|
|
TR_INTR = -3,
|
|
|
|
/** Connection closed */
|
|
TR_CLOSED = -4
|
|
};
|
|
|
|
struct tr_socket;
|
|
|
|
/**
|
|
* @brief A transport socket datastructure.
|
|
*
|
|
* @param socket A pointer to a technology specific socket.
|
|
* @param open_fp Pointer to a function that establishes the socket connection.
|
|
* @param close_fp Pointer to a function that closes the socket.
|
|
* @param free_fp Pointer to a function that frees all memory allocated with this socket.
|
|
*/
|
|
struct tr_socket {
|
|
void *socket;
|
|
int (*open_fp)(void *socket) ;
|
|
void (*close_fp)(void *socket) ;
|
|
void (*free_fp)(struct tr_socket *tr_sock);
|
|
const char *(*ident_fp)(void *socket);
|
|
};
|
|
|
|
/**
|
|
* @brief Establish the connection.
|
|
* @param[in] socket Socket that will be used.
|
|
* @return TR_SUCCESS On success.
|
|
* @return TR_ERROR On error.
|
|
*/
|
|
int tr_open(struct tr_socket *socket);
|
|
|
|
/**
|
|
* @brief Close the socket connection.
|
|
* @param[in] socket Socket that will be closed.
|
|
*/
|
|
void tr_close(struct tr_socket *socket);
|
|
|
|
/**
|
|
* @brief Deallocates all memory that the passed socket uses.
|
|
* Socket have to be closed before.
|
|
* @param[in] socket which will be freed.
|
|
*/
|
|
void tr_free(struct tr_socket *socket);
|
|
|
|
/**
|
|
* Returns an identifier for the socket endpoint, eg host:port.
|
|
* @param[in] socket
|
|
* return Pointer to a \0 terminated String
|
|
* return NULL on error
|
|
*/
|
|
const char *tr_ident(struct tr_socket *socket);
|
|
|
|
#endif
|
|
/* @} */
|