|
|
IoTcpUdpManager (FeaNode& fea_node, const IfTree& iftree)
| IoTcpUdpManager |
Constructor for IoTcpUdpManager.
~IoTcpUdpManager ()
| ~IoTcpUdpManager |
[virtual]
int tcp_open (int family, const string& creator, string& sockid,
string& error_msg)
| tcp_open |
Open a TCP socket.
Parameters:
family | the address family (AF_INET or AF_INET6 for IPv4 and IPv6 respectively). |
creator | the name of the socket creator. |
sockid | return parameter that contains unique socket ID when socket instantiation is successful. |
error_msg | the error message (if error). |
Returns: XORP_OK on success, otherwise XORP_ERROR.
int udp_open (int family, const string& creator, string& sockid,
string& error_msg)
| udp_open |
Open an UDP socket.
Parameters:
family | the address family (AF_INET or AF_INET6 for IPv4 and IPv6 respectively). |
creator | the name of the socket creator. |
sockid | return parameter that contains unique socket ID when socket instantiation is successful. |
error_msg | the error message (if error). |
Returns: XORP_OK on success, otherwise XORP_ERROR.
int tcp_open_and_bind (int family, const string& creator,
const IPvX& local_addr, uint16_t local_port,
string& sockid, string& error_msg)
| tcp_open_and_bind |
Create a bound TCP socket.
Parameters:
family | the address family (AF_INET or AF_INET6 for IPv4 and IPv6 respectively). |
creator | the name of the socket creator. |
local_addr | the interface address to bind socket to. |
local_port | the port to bind socket to. |
sockid | return parameter that contains unique socket ID when socket instantiation is successful. |
error_msg | the error message (if error). |
Returns: XORP_OK on success, otherwise XORP_ERROR.
int udp_open_and_bind (int family, const string& creator,
const IPvX& local_addr, uint16_t local_port,
string& sockid, string& error_msg)
| udp_open_and_bind |
Create a bound UDP socket.
Parameters:
family | the address family (AF_INET or AF_INET6 for IPv4 and IPv6 respectively). |
creator | the name of the socket creator. |
local_addr | the interface address to bind socket to. |
local_port | the port to bind socket to. |
sockid | return parameter that contains unique socket ID when socket instantiation is successful. |
error_msg | the error message (if error). |
Returns: XORP_OK on success, otherwise XORP_ERROR.
int udp_open_bind_join (int family, const string& creator,
const IPvX& local_addr, uint16_t local_port,
const IPvX& mcast_addr, uint8_t ttl, bool reuse,
string& sockid, string& error_msg)
| udp_open_bind_join |
Create a bound UDP multicast socket.
Parameters:
family | the address family (AF_INET or AF_INET6 for IPv4 and IPv6 respectively). |
creator | the name of the socket creator. |
local_addr | the interface address to bind socket to. |
local_port | the port to bind socket to. |
mcast_addr | the multicast group address to join. |
ttl | the TTL to use for this multicast socket. |
reuse | allow other sockets to bind to same multicast group. |
sockid | return parameter that contains unique socket ID when socket instantiation is successful. |
error_msg | the error message (if error). |
Returns: XORP_OK on success, otherwise XORP_ERROR.
int tcp_open_bind_connect (int family, const string& creator,
const IPvX& local_addr, uint16_t local_port,
const IPvX& remote_addr, uint16_t remote_port,
string& sockid, string& error_msg)
| tcp_open_bind_connect |
Create a bound and connected TCP socket.
Parameters:
family | the address family (AF_INET or AF_INET6 for IPv4 and IPv6 respectively). |
creator | the name of the socket creator. |
local_addr | the interface address to bind socket to. |
local_port | the port to bind socket to. |
remote_addr | the address to connect to. |
remote_port | the remote port to connect to. |
sockid | return parameter that contains unique socket ID when socket instantiation is successful. |
error_msg | the error message (if error). |
Returns: XORP_OK on success, otherwise XORP_ERROR.
int udp_open_bind_connect (int family, const string& creator,
const IPvX& local_addr, uint16_t local_port,
const IPvX& remote_addr, uint16_t remote_port,
string& sockid, string& error_msg)
| udp_open_bind_connect |
Create a bound and connected UDP socket.
Parameters:
family | the address family (AF_INET or AF_INET6 for IPv4 and IPv6 respectively). |
creator | the name of the socket creator. |
local_addr | the interface address to bind socket to. |
local_port | the port to bind socket to. |
remote_addr | the address to connect to. |
remote_port | the remote port to connect to. |
sockid | return parameter that contains unique socket ID when socket instantiation is successful. |
error_msg | the error message (if error). |
Returns: XORP_OK on success, otherwise XORP_ERROR.
int udp_open_bind_broadcast (int family, const string& creator,
const string& ifname, const string& vifname,
uint16_t local_port, uint16_t remote_port,
bool reuse, bool limited, bool connected,
string& sockid, string& error_msg)
| udp_open_bind_broadcast |
Create a bound and connected UDP broadcast socket.
Parameters:
family | the address family (AF_INET or AF_INET6 for IPv4 and IPv6 respectively). |
creator | the name of the socket creator. |
ifname | the interface name to bind socket to. |
vifname | the vif to bind socket to. |
local_port | the port to bind socket to. |
remote_port | the remote port to connect to. |
reuse | allow other sockets to bind to same port. |
limited | set the socket up for transmission to the limited broadcast address 255.255.255.255. |
connected | connect the socket for use with send() not sendto(). |
sockid | return parameter that contains unique socket ID when socket instantiation is successful. |
error_msg | the error message (if error). |
Returns: XORP_OK on success, otherwise XORP_ERROR.
int bind (int family, const string& sockid, const IPvX& local_addr,
uint16_t local_port, string& error_msg)
| bind |
Bind a socket.
Parameters:
family | the address family (AF_INET or AF_INET6 for IPv4 and IPv6 respectively). |
sockid | the socket ID of the socket to bind. |
local_addr | the interface address to bind socket to. |
local_port | the port to bind socket to. |
error_msg | the error message (if error). |
Returns: XORP_OK on success, otherwise XORP_ERROR.
int udp_join_group (int family, const string& sockid,
const IPvX& mcast_addr, const IPvX& join_if_addr,
string& error_msg)
| udp_join_group |
Join multicast group on already bound socket.
Parameters:
family | the address family (AF_INET or AF_INET6 for IPv4 and IPv6 respectively). |
sockid | unique socket ID. |
mcast_addr | group to join. |
join_if_addr | interface address to perform join on. |
error_msg | the error message (if error). |
Returns: XORP_OK on success, otherwise XORP_ERROR.
int udp_leave_group (int family, const string& sockid,
const IPvX& mcast_addr, const IPvX& leave_if_addr,
string& error_msg)
| udp_leave_group |
Leave multicast group on already bound socket.
Parameters:
family | the address family (AF_INET or AF_INET6 for IPv4 and IPv6 respectively). |
sockid | unique socket ID. |
mcast_addr | group to leave. |
leave_if_addr | interface address to perform leave on. |
error_msg | the error message (if error). |
Returns: XORP_OK on success, otherwise XORP_ERROR.
int close (int family, const string& sockid, string& error_msg)
| close |
Close socket.
Parameters:
family | the address family (AF_INET or AF_INET6 for IPv4 and IPv6 respectively). |
sockid | unique socket ID of socket to be closed. |
error_msg | the error message (if error). |
Returns: XORP_OK on success, otherwise XORP_ERROR.
int tcp_listen (int family, const string& sockid, uint32_t backlog,
string& error_msg)
| tcp_listen |
Listen for inbound connections on socket.
When a connection request is received the socket creator will receive notification.
Parameters:
family | the address family (AF_INET or AF_INET6 for IPv4 and IPv6 respectively). |
sockid | the unique socket ID of the socket to perform listen. |
backlog | the maximum number of pending connections. |
error_msg | the error message (if error). |
Returns: XORP_OK on success, otherwise XORP_ERROR.
int udp_enable_recv (int family, const string& sockid, string& error_msg)
| udp_enable_recv |
Enable a UDP socket for datagram reception.
Parameters:
family | the address family (AF_INET or AF_INET6 for IPv4 and IPv6 respectively). |
sockid | the unique socket ID of the socket to enable datagram reception for. |
error_msg | the error message (if error). |
Returns: XORP_OK on success, otherwise XORP_ERROR.
int send (int family, const string& sockid, const vector<uint8_t>& data,
string& error_msg)
| send |
Send data on socket.
Parameters:
family | the address family (AF_INET or AF_INET6 for IPv4 and IPv6 respectively). |
sockid | unique socket ID. |
data | block of data to be sent. |
error_msg | the error message (if error). |
Returns: XORP_OK on success, otherwise XORP_ERROR.
int send_to (int family, const string& sockid, const IPvX& remote_addr,
uint16_t remote_port, const vector<uint8_t>& data,
string& error_msg)
| send_to |
Send data on socket to a given destination.
The packet is not routed as the forwarding engine sending the packet may not have access to the full routing table.
Parameters:
family | the address family (AF_INET or AF_INET6 for IPv4 and IPv6 respectively). |
sockid | unique socket ID. |
remote_addr | destination address for data. |
remote_port | destination port for data. |
data | block of data to be sent. |
error_msg | the error message (if error). |
Returns: XORP_OK on success, otherwise XORP_ERROR.
int send_from_multicast_if (int family, const string& sockid,
const IPvX& group_addr, uint16_t group_port,
const IPvX& ifaddr, const vector<uint8_t>& data,
string& error_msg)
| send_from_multicast_if |
Send data on socket to a given multicast group from a given interface.
Parameters:
family | the address family (AF_INET or AF_INET6 for IPv4 and IPv6 respectively). |
sockid | unique socket ID. |
group_addr | destination address for data. |
group_port | destination port for data. |
ifaddr | interface address. |
error_msg | the error message (if error). |
Returns: XORP_OK on success, otherwise XORP_ERROR.
int set_socket_option (int family, const string& sockid,
const string& optname, uint32_t optval,
string& error_msg)
| set_socket_option |
Set a named socket option with an integer value.
Parameters:
family | the address family (AF_INET or AF_INET6 for IPv4 and IPv6 respectively). |
sockid | unique socket ID. |
optname | name of option to be set. Valid values are: "onesbcast" "receive_broadcast" "reuseport" "send_broadcast" "tos" "ttl" "multicast_loopback" "multicast_ttl" |
optval | value of option to be set. If value is logically boolean then zero represents false and any non-zero value true. |
error_msg | the error message (if error). |
Returns: XORP_OK on success, otherwise XORP_ERROR.
int set_socket_option (int family, const string& sockid,
const string& optname, const string& optval,
string& error_msg)
| set_socket_option |
Set a named socket option with a string value.
Parameters:
family | the address family (AF_INET or AF_INET6 for IPv4 and IPv6 respectively). |
sockid | unique socket ID. |
optname | name of option to be set. Valid values are: "bindtodevice" |
optval | value of option to be set. |
error_msg | the error message (if error). |
Returns: XORP_OK on success, otherwise XORP_ERROR.
int accept_connection (int family, const string& sockid, bool is_accepted,
string& error_msg)
| accept_connection |
Accept or reject a pending connection.
Parameters:
family | the address family (AF_INET or AF_INET6 for IPv4 and IPv6 respectively). |
sockid | unique socket ID. |
is_accepted | if true, the connection is accepted, otherwise is rejected. |
error_msg | the error message (if error). |
Returns: XORP_OK on success, otherwise XORP_ERROR.
void recv_event (const string& receiver_name,
const string& sockid,
const string& if_name,
const string& vif_name,
const IPvX& src_host,
uint16_t src_port,
const vector<uint8_t>& data)
| recv_event |
Data received event.
Parameters:
receiver_name | the name of the receiver to send the data to. |
sockid | unique socket ID. |
if_name | the interface name the packet arrived on, if known. If unknown, then it is an empty string. |
vif_name | the vif name the packet arrived on, if known. If unknown, then it is an empty string. |
src_host | the originating host IP address. |
src_port | the originating host port number. |
data | the data received. |
Reimplemented from IoTcpUdpManagerReceiver.
void inbound_connect_event (const string& receiver_name,
const string& sockid,
const IPvX& src_host,
uint16_t src_port,
const string& new_sockid)
| inbound_connect_event |
Inbound connection request received event.
It applies only to TCP sockets.
Parameters:
receiver_name | the name of the receiver to send the event to. |
sockid | unique socket ID. |
src_host | the originating host IP address. |
src_port | the originating host port number. |
new_sockid | the new socket ID. |
Reimplemented from IoTcpUdpManagerReceiver.
void outgoing_connect_event (int family,
const string& receiver_name,
const string& sockid)
| outgoing_connect_event |
Outgoing connection request completed event.
It applies only to TCP sockets.
Parameters:
family | the address family (AF_INET or AF_INET6 for IPv4 and IPv6 respectively). |
receiver_name | the name of the receiver to send the event to. |
sockid | unique socket ID. |
Reimplemented from IoTcpUdpManagerReceiver.
void error_event (int family,
const string& receiver_name,
const string& sockid,
const string& error,
bool fatal)
| error_event |
Error occured event.
Parameters:
family | the address family (AF_INET or AF_INET6 for IPv4 and IPv6 respectively). |
receiver_name | the name of the receiver to send the event to. |
sockid | unique socket ID. |
error | a textual description of the error. |
fatal | indication of whether socket is shutdown because of error. |
Reimplemented from IoTcpUdpManagerReceiver.
void disconnect_event (int family,
const string& receiver_name,
const string& sockid)
| disconnect_event |
Connection closed by peer event.
It applies only to TCP sockets. This method is not called if the socket is gracefully closed through close().
Parameters:
family | the address family (AF_INET or AF_INET6 for IPv4 and IPv6 respectively). |
receiver_name | the name of the receiver to send the event to. |
sockid | unique socket ID. |
Reimplemented from IoTcpUdpManagerReceiver.
void instance_birth (const string& instance_name)
| instance_birth |
Inform the watcher that a component instance is alive.
Parameters:
instance_name | the name of the instance that is alive. |
Reimplemented from InstanceWatcher.
void instance_death (const string& instance_name)
| instance_death |
Inform the watcher that a component instance is dead.
Parameters:
instance_name | the name of the instance that is dead. |
Reimplemented from InstanceWatcher.
void set_io_tcpudp_manager_receiver (IoTcpUdpManagerReceiver* v)
| set_io_tcpudp_manager_receiver |
Set the instance that is responsible for sending IP packets to a receiver.
const IfTree& iftree ()
| iftree |
[const]
Get a reference to the interface tree.
Returns: a reference to the interface tree (IfTree).
int register_data_plane_manager (FeaDataPlaneManager* fea_data_plane_manager,
bool is_exclusive)
| register_data_plane_manager |
Register FeaDataPlaneManager data plane manager.
Parameters:
fea_data_plane_manager | the data plane manager to register. |
is_exclusive | if true, the manager is registered as the exclusive manager, otherwise is added to the list of managers. |
Returns: XORP_OK on success, otherwise XORP_ERROR.
int unregister_data_plane_manager (FeaDataPlaneManager* fea_data_plane_manager)
| unregister_data_plane_manager |
Unregister FeaDataPlaneManager data plane manager.
Parameters:
fea_data_plane_manager | the data plane manager to unregister. |
Returns: XORP_OK on success, otherwise XORP_ERROR.
list<FeaDataPlaneManager*>& fea_data_plane_managers ()
| fea_data_plane_managers |
Get the list of registered data plane managers.
Returns: the list of registered data plane managers.
IoTcpUdpComm* connect_io_tcpudp_comm (int family,
bool is_tcp,
const string& creator,
const string& listener_sockid,
const IPvX& peer_host,
uint16_t peer_port,
IoTcpUdp* new_io_tcpudp)
| connect_io_tcpudp_comm |
Connect IoTcpUdpComm entry to a new plugin.
Parameters:
family | the address family. |
is_tcp | if true this is TCP entry, otherwise UDP. |
creator | the name of the creator. |
listener_sockid | the socket ID of the listener socket. |
peer_host | the peer host IP address. |
peer_port | the peer host port number. |
new_io_tcpudp | the handler for the new connection. |
Returns: an entry (IoTcpUdpComm) to handle the connection from the new plugin.