Commit 9c0cfdfe authored by Alessandro Rubini's avatar Alessandro Rubini

trivial: net: remove another typedef

Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
parent 4c33f90b
...@@ -27,9 +27,6 @@ ...@@ -27,9 +27,6 @@
// Some system-independent definitions // Some system-independent definitions
typedef uint8_t mac_addr_t[6]; typedef uint8_t mac_addr_t[6];
// WhiteRabbit socket - it's void pointer as the real socket structure is private and probably platform-specific.
typedef void *wr_socket_t;
// Socket address for ptp_netif_ functions // Socket address for ptp_netif_ functions
struct wr_sockaddr { struct wr_sockaddr {
// MAC address // MAC address
...@@ -81,7 +78,7 @@ PACKED struct wr_timestamp { ...@@ -81,7 +78,7 @@ PACKED struct wr_timestamp {
// to bind_addr. If PTPD_FLAG_MULTICAST is set, the socket is // to bind_addr. If PTPD_FLAG_MULTICAST is set, the socket is
// automatically added to multicast group. User can specify // automatically added to multicast group. User can specify
// physical_port field to bind the socket to specific switch port only. // physical_port field to bind the socket to specific switch port only.
wr_socket_t *ptpd_netif_create_socket(int unused, int unused2, struct wrpc_socket *ptpd_netif_create_socket(int unused, int unused2,
struct wr_sockaddr * bind_addr); struct wr_sockaddr * bind_addr);
// Sends a UDP/RAW packet (data, data_length) to addr in wr_sockaddr. // Sends a UDP/RAW packet (data, data_length) to addr in wr_sockaddr.
...@@ -89,7 +86,7 @@ wr_socket_t *ptpd_netif_create_socket(int unused, int unused2, ...@@ -89,7 +86,7 @@ wr_socket_t *ptpd_netif_create_socket(int unused, int unused2,
// Every transmitted frame has assigned a tag value, stored at tag parameter. // Every transmitted frame has assigned a tag value, stored at tag parameter.
// This value is later used for recovering the precise transmit timestamp. // This value is later used for recovering the precise transmit timestamp.
// If user doesn't need it, tag parameter can be left NULL. // If user doesn't need it, tag parameter can be left NULL.
int ptpd_netif_sendto(wr_socket_t *sock, struct wr_sockaddr *to, void *data, int ptpd_netif_sendto(struct wrpc_socket *sock, struct wr_sockaddr *to, void *data,
size_t data_length, struct wr_timestamp *tx_ts); size_t data_length, struct wr_timestamp *tx_ts);
// Receives an UDP/RAW packet. Data is written to (data) and len is returned. // Receives an UDP/RAW packet. Data is written to (data) and len is returned.
...@@ -97,13 +94,13 @@ int ptpd_netif_sendto(wr_socket_t *sock, struct wr_sockaddr *to, void *data, ...@@ -97,13 +94,13 @@ int ptpd_netif_sendto(wr_socket_t *sock, struct wr_sockaddr *to, void *data,
// Sender information is stored in structure specified in 'from'. // Sender information is stored in structure specified in 'from'.
// All RXed packets are timestamped and the timestamp // All RXed packets are timestamped and the timestamp
// is stored in rx_timestamp (unless it's NULL). // is stored in rx_timestamp (unless it's NULL).
int ptpd_netif_recvfrom(wr_socket_t *sock, struct wr_sockaddr *from, void *data, int ptpd_netif_recvfrom(struct wrpc_socket *sock, struct wr_sockaddr *from, void *data,
size_t data_length, struct wr_timestamp *rx_timestamp); size_t data_length, struct wr_timestamp *rx_timestamp);
// Closes the socket. // Closes the socket.
int ptpd_netif_close_socket(wr_socket_t * sock); int ptpd_netif_close_socket(struct wrpc_socket * sock);
int ptpd_netif_get_hw_addr(wr_socket_t * sock, mac_addr_t * mac); int ptpd_netif_get_hw_addr(struct wrpc_socket * sock, mac_addr_t * mac);
void ptpd_netif_linearize_rx_timestamp(struct wr_timestamp *ts, void ptpd_netif_linearize_rx_timestamp(struct wr_timestamp *ts,
int32_t dmtd_phase, int32_t dmtd_phase,
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
#define htons(x) x #define htons(x) x
#endif #endif
static wr_socket_t *arp_socket; static struct wrpc_socket *arp_socket;
#define ARP_HTYPE 0 #define ARP_HTYPE 0
#define ARP_PTYPE (ARP_HTYPE+2) #define ARP_PTYPE (ARP_HTYPE+2)
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
int needIP = 1; int needIP = 1;
static uint8_t myIP[4]; static uint8_t myIP[4];
static wr_socket_t *ipv4_socket; static struct wrpc_socket *ipv4_socket;
unsigned int ipv4_checksum(unsigned short *buf, int shorts) unsigned int ipv4_checksum(unsigned short *buf, int shorts)
{ {
......
...@@ -34,7 +34,7 @@ struct ethhdr { ...@@ -34,7 +34,7 @@ struct ethhdr {
static struct wrpc_socket socks[NET_MAX_SOCKETS]; static struct wrpc_socket socks[NET_MAX_SOCKETS];
//#define net_verbose pp_printf //#define net_verbose pp_printf
int ptpd_netif_get_hw_addr(wr_socket_t * sock, mac_addr_t * mac) int ptpd_netif_get_hw_addr(struct wrpc_socket *sock, mac_addr_t *mac)
{ {
get_mac_addr((uint8_t *) mac); get_mac_addr((uint8_t *) mac);
...@@ -51,7 +51,7 @@ void ptpd_netif_set_phase_transition(uint32_t phase) ...@@ -51,7 +51,7 @@ void ptpd_netif_set_phase_transition(uint32_t phase)
} }
wr_socket_t *ptpd_netif_create_socket(int unused, int unusd2, struct wrpc_socket *ptpd_netif_create_socket(int unused, int unusd2,
struct wr_sockaddr * bind_addr) struct wr_sockaddr * bind_addr)
{ {
int i; int i;
...@@ -87,13 +87,11 @@ wr_socket_t *ptpd_netif_create_socket(int unused, int unusd2, ...@@ -87,13 +87,11 @@ wr_socket_t *ptpd_netif_create_socket(int unused, int unusd2,
sock->queue.n = 0; sock->queue.n = 0;
sock->in_use = 1; sock->in_use = 1;
return (wr_socket_t *) (sock); return sock;
} }
int ptpd_netif_close_socket(wr_socket_t * sock) int ptpd_netif_close_socket(struct wrpc_socket *s)
{ {
struct wrpc_socket *s = (struct wrpc_socket *)sock;
if (s) if (s)
s->in_use = 0; s->in_use = 0;
return 0; return 0;
...@@ -208,10 +206,9 @@ static int wrap_copy_out(struct sockq *q, void *src, size_t len) ...@@ -208,10 +206,9 @@ static int wrap_copy_out(struct sockq *q, void *src, size_t len)
return len; return len;
} }
int ptpd_netif_recvfrom(wr_socket_t *sock, struct wr_sockaddr *from, void *data, int ptpd_netif_recvfrom(struct wrpc_socket *s, struct wr_sockaddr *from, void *data,
size_t data_length, struct wr_timestamp *rx_timestamp) size_t data_length, struct wr_timestamp *rx_timestamp)
{ {
struct wrpc_socket *s = (struct wrpc_socket *)sock;
struct sockq *q = &s->queue; struct sockq *q = &s->queue;
uint16_t size; uint16_t size;
...@@ -259,7 +256,7 @@ int ptpd_netif_recvfrom(wr_socket_t *sock, struct wr_sockaddr *from, void *data, ...@@ -259,7 +256,7 @@ int ptpd_netif_recvfrom(wr_socket_t *sock, struct wr_sockaddr *from, void *data,
return min(size - sizeof(struct ethhdr), data_length); return min(size - sizeof(struct ethhdr), data_length);
} }
int ptpd_netif_sendto(wr_socket_t * sock, struct wr_sockaddr *to, void *data, int ptpd_netif_sendto(struct wrpc_socket * sock, struct wr_sockaddr *to, void *data,
size_t data_length, struct wr_timestamp *tx_timestamp) size_t data_length, struct wr_timestamp *tx_timestamp)
{ {
struct wrpc_socket *s = (struct wrpc_socket *)sock; struct wrpc_socket *s = (struct wrpc_socket *)sock;
......
ppsi @ b20f86cd
Subproject commit 0208eb8fc6f1dc03aea051651f6b28e432b42b56 Subproject commit b20f86cdf1d97bcf1ecd46411e25bdd02db3fc33
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment