/****************************************************************************
 * This file is part of the project AqHome.
 * AqHome (c) by 2025 Martin Preuss, all rights reserved.
 *
 * The license for this file can be found in the file COPYING which you
 * should have received along with this file.
 ****************************************************************************/

#ifndef AQH_TCPD_OBJECT_H
#define AQH_TCPD_OBJECT_H

#include <aqhome/events2/object.h>

enum {
  /** new client connected (param1 is fd for the new clients non-blocking socket) */
  AQH_TCPD_OBJECT_SIGNAL_NEWCONN=AQH_OBJECT_SIGNAL_LAST
};


/**
 * Start listening on the given socket which represents a tcp network socket.
 * The socket can be created by @ref AQH_TcpdObject_CreateListeningSocket().
 *
 */
AQHOME_API AQH_OBJECT *AQH_TcpdObject_new(AQH_EVENT_LOOP *eventLoop, int fd);


/**
 * Helper function to create a listening TCP socket.
 */
AQHOME_API int AQH_TcpdObject_CreateListeningSocket(const char *addr, int port);





#endif

