mirror of
https://github.com/neocturne/fastd.git
synced 2025-05-15 12:45:09 +02:00
Move socket structure to socket header.
This commit is contained in:
parent
7e66b36d3c
commit
6810eacc9f
3 changed files with 47 additions and 8 deletions
|
@ -41,6 +41,7 @@
|
||||||
#include "poll.h"
|
#include "poll.h"
|
||||||
#include "sem.h"
|
#include "sem.h"
|
||||||
#include "shell.h"
|
#include "shell.h"
|
||||||
|
#include "socket.h"
|
||||||
#include "task.h"
|
#include "task.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "vector.h"
|
#include "vector.h"
|
||||||
|
@ -153,14 +154,6 @@ struct fastd_bind_address {
|
||||||
char *bindtodev; /**< May contain an interface name to limit the bind to */
|
char *bindtodev; /**< May contain an interface name to limit the bind to */
|
||||||
};
|
};
|
||||||
|
|
||||||
/** A socket descriptor */
|
|
||||||
struct fastd_socket {
|
|
||||||
fastd_poll_fd_t fd; /**< The file descriptor for the socket */
|
|
||||||
const fastd_bind_address_t *addr; /**< The address this socket is supposed to be bound to (or NULL) */
|
|
||||||
fastd_peer_address_t *bound_addr; /**< The actual address that was bound to (may differ from addr when addr has a random port) */
|
|
||||||
fastd_peer_t *peer; /**< If the socket belongs to a single peer (as it was create dynamically when sending a handshake), contains that peer */
|
|
||||||
};
|
|
||||||
|
|
||||||
/** A TUN/TAP interface */
|
/** A TUN/TAP interface */
|
||||||
struct fastd_iface {
|
struct fastd_iface {
|
||||||
fastd_poll_fd_t fd; /**< The file descriptor of the tunnel interface */
|
fastd_poll_fd_t fd; /**< The file descriptor of the tunnel interface */
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
|
|
||||||
#include "fastd.h"
|
#include "fastd.h"
|
||||||
#include "poll.h"
|
#include "poll.h"
|
||||||
|
#include "socket.h"
|
||||||
|
|
||||||
#include <net/if.h>
|
#include <net/if.h>
|
||||||
|
|
||||||
|
|
45
src/socket.h
Normal file
45
src/socket.h
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
/*
|
||||||
|
Copyright (c) 2020, Heiko Wundram <heiko.wundram@gehrkens.it>.
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
|
1. Redistributions of source code must retain the above copyright notice,
|
||||||
|
this list of conditions and the following disclaimer.
|
||||||
|
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
this list of conditions and the following disclaimer in the documentation
|
||||||
|
and/or other materials provided with the distribution.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||||
|
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||||
|
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||||
|
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||||
|
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
\file
|
||||||
|
|
||||||
|
\em Socket configuration.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
|
||||||
|
#include "types.h"
|
||||||
|
|
||||||
|
|
||||||
|
/** A socket descriptor */
|
||||||
|
struct fastd_socket {
|
||||||
|
fastd_poll_fd_t fd; /**< The file descriptor for the socket */
|
||||||
|
const fastd_bind_address_t *addr; /**< The address this socket is supposed to be bound to (or NULL) */
|
||||||
|
fastd_peer_address_t *bound_addr; /**< The actual address that was bound to (may differ from addr when addr has a random port) */
|
||||||
|
fastd_peer_t *peer; /**< If the socket belongs to a single peer (as it was create dynamically when sending a handshake), contains that peer */
|
||||||
|
};
|
Loading…
Add table
Reference in a new issue