14 #include <QNetworkDatagram>
17 #define SERVER_LAN_PORT 4555
18 #define SERVER_LAN_TTL 1
19 #define SERVER_LAN_VERSION 2
40 void sockError(QAbstractSocket::SocketError socketError);
69 #define SPECLIST_TAG server
70 #define SPECLIST_TYPE struct server
73 #define server_list_iterate(serverlist, pserver) \
74 TYPED_LIST_ITERATE(struct server, serverlist, pserver)
75 #define server_list_iterate_end LIST_ITERATE_END
QList< QNetworkDatagram > datagram_list
fcUdpScan(QObject *parent=0)
static fcUdpScan * i()
returns fcUdpScan instance, use it to initizalize fcUdpScan or for calling methods
~fcUdpScan() override=default
static void drop()
deletes fcUdpScan
bool begin_scan(struct server_scan *scan)
Broadcast an UDP package to all servers on LAN, requesting information about the server.
void readPendingDatagrams()
enum server_scan_status get_server_list(struct server_scan *scan)
Listens for UDP packets broadcasted from a server that responded to the request-packet sent from the ...
struct server_scan * fcudp_scan
static fcUdpScan * m_instance
void sockError(QAbstractSocket::SocketError socketError)
Pass errors to main scan.
struct server_list * server_scan_get_list(struct server_scan *scan)
Returns the srv_list currently held by the scan (may be nullptr).
struct server_scan * server_scan_begin(enum server_scan_type type, ServerScanErrorFunc error_func)
Creates a new server scan and returns it, or nullptr if impossible.
void server_scan_finish(struct server_scan *scan)
Closes the socket listening on the scan, frees the list of servers, and frees the memory allocated fo...
enum server_scan_type server_scan_get_type(const struct server_scan *scan)
A simple query function to determine the type of a server scan (previously allocated in server_scan_b...
void(* ServerScanErrorFunc)(struct server_scan *scan, const char *message)
enum server_scan_status server_scan_poll(struct server_scan *scan)
A function to query servers of the server scan.
ServerScanErrorFunc error_func
enum server_scan_type type