blob: 617df1af1421865e489690413aa76813914c50d1 [file] [log] [blame]
Baptiste Assmann5d4e4f72015-04-13 23:08:16 +02001/*
2 * UDP protocol related functions
3 *
4 * Copyright 2014 Baptiste Assmann <bedis9@gmail.com>
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 *
11 */
12
Willy Tarreau0f6ffd62020-06-03 19:33:00 +020013#include <haproxy/fd-t.h>
Willy Tarreau832ce652020-06-04 08:36:05 +020014#include <haproxy/proto_udp-t.h>
Baptiste Assmann5d4e4f72015-04-13 23:08:16 +020015
Willy Tarreau0f6ffd62020-06-03 19:33:00 +020016#include <haproxy/fd.h>
Baptiste Assmann5d4e4f72015-04-13 23:08:16 +020017
18/* datagram handler callback */
Willy Tarreau7a798e52016-04-14 11:13:20 +020019void dgram_fd_handler(int fd)
Baptiste Assmann5d4e4f72015-04-13 23:08:16 +020020{
21 struct dgram_conn *dgram = fdtab[fd].owner;
22
23 if (unlikely(!dgram))
Willy Tarreau7a798e52016-04-14 11:13:20 +020024 return;
Baptiste Assmann5d4e4f72015-04-13 23:08:16 +020025
26 if (fd_recv_ready(fd))
27 dgram->data->recv(dgram);
Willy Tarreaud7f76a02019-12-10 18:12:04 +010028 if (fd_send_ready(fd))
Baptiste Assmann5d4e4f72015-04-13 23:08:16 +020029 dgram->data->send(dgram);
30
Willy Tarreau7a798e52016-04-14 11:13:20 +020031 return;
Baptiste Assmann5d4e4f72015-04-13 23:08:16 +020032}