0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-10-18 09:58:43 +00:00
bird/proto/rpki/transport.h
Pavel Tvrdík 41f4b5940f RPKI protocol with integrated RTRLib inside
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 or more cache servers per protocol.

Example configuration of bird.conf:
  ...
  roa4 table roatable;

  protocol rpki {
    table roatable;

    cache 127.0.0.1; # defaults: port 8282, preference 1, no encryption

    cache 127.0.0.1 {
      preference 1;
      port 2222;
      ssh encryption {
        bird private key "/home/birdgeek/.ssh/id_rsa";
        cache public key "/home/birdgeek/.ssh/known_hosts";
        user "birdgeek";
      };
    };

    cache "rpki-validator.realmv6.org" {
      preference 2;
    };
  }
  ...
2016-01-25 15:39:38 +01:00

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
/* @} */