Skip to content
Snippets Groups Projects
Commit db1ff729 authored by Daniel Salzman's avatar Daniel Salzman
Browse files

net: tiny code unification

parent d05d6abe
No related branches found
No related tags found
No related merge requests found
/* Copyright (C) 2019 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
/* Copyright (C) 2021 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
......@@ -164,7 +164,7 @@ static void unlink_unix_socket(const struct sockaddr_storage *addr)
unlink(path);
}
int net_bound_socket(int type, const struct sockaddr_storage *addr, enum net_flags flags)
int net_bound_socket(int type, const struct sockaddr_storage *addr, net_bind_flag_t flags)
{
/* Create socket. */
int sock = net_unbound_socket(type, addr);
......
/* Copyright (C) 2019 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
/* Copyright (C) 2021 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
......@@ -23,10 +23,10 @@
/*!
* \brief Network interface flags.
*/
enum net_flags {
typedef enum {
NET_BIND_NONLOCAL = (1 << 0), //!< Allow to bind unavailable address.
NET_BIND_MULTIPLE = (1 << 1), //!< Allow to bind address multiple times.
};
} net_bind_flag_t;
/*!
* \brief Create unbound socket of given family and type.
......@@ -51,7 +51,7 @@ int net_unbound_socket(int type, const struct sockaddr_storage *addr);
*
* \return socket or error code
*/
int net_bound_socket(int type, const struct sockaddr_storage *addr, enum net_flags flags);
int net_bound_socket(int type, const struct sockaddr_storage *addr, net_bind_flag_t flags);
/*!
* \brief Create socket connected (asynchronously) to destination address.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment