0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-10-18 18:08:45 +00:00
bird/proto/rpki/tcp_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

56 lines
1.5 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_tcp_transport_h TCP transport socket
* @ingroup mod_transport_h
* @brief An implementation of the TCP protocol for the RTR transport.
* See @ref mod_transport_h "transport interface" for a list of supported operations.
*
* @{
*/
#ifndef RTR_TCP_TRANSPORT_H
#define RTR_TCP_TRANSPORT_H
#include "transport.h"
#include "nest/bird.h"
#include "lib/ip.h"
/**
* @brief A tr_tcp_config struct holds configuration for a TCP connection.
* @param host Hostname or IP address to connect to.
* @param port Port to connect to.
* @param bindaddr Hostname or IP address to connect from. NULL for
* determination by OS.
* to use the source address of the system's default route to the server
*/
struct tr_tcp_config {
ip_addr ip; char *host; /* at least one of @ip or @host must be defined */
uint port;
char *bindaddr; /* TODO: NEED THIS? */
};
struct tr_tcp_socket {
struct rpki_cache *cache;
struct tr_tcp_config config;
char *ident;
};
/**
* @brief Initializes the tr_socket struct for a TCP connection.
* @param[in] config TCP configuration for the connection.
* @param[out] socket Initialized transport socket.
* @returns TR_SUCCESS On success.
* @returns TR_ERROR On error.
*/
int tr_tcp_init(struct rpki_cache *cache);
#endif
/* @} */