#include <errno.h>
#include <stddef.h>
#include <stdint.h>
#include <string.h>
#include <unistd.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <sys/time.h>
#include "bounded_queue.h"
Go to the source code of this file.
◆ listener_create()
Allocate a listener bound to the given UDP port.
- Parameters
-
| port | UDP port to bind on. |
| bounded_q | Queue raw lines are pushed onto. Listener does NOT take ownership — caller manages lifetime. |
| max_line | The max buffer length per line. |
- Returns
- Listener handle on success, NULL on socket/bind/alloc failure.
◆ listener_destroy()
Free the listener and close its socket.
- Parameters
-
| listener | Listener to destroy. |
◆ listener_start()
Spawn the receive thread.
- Parameters
-
| listener | Listener to start. |
- Returns
- 0 on success, -1 if pthread_create failed, -2 already started.
◆ listener_stop()
Signal the receive thread to exit and join it. Does NOT shut down the queue — caller decides when to call bq_shutdown.
- Parameters
-
| listener | Listener to stop. |