"Fossies" - the Fresh Open Source Software Archive

Member "haproxy-2.0.0/include/types/proto_udp.h" (16 Jun 2019, 1825 Bytes) of package /linux/misc/haproxy-2.0.0.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "proto_udp.h" see the Fossies "Dox" file reference documentation.

    1 /*
    2  * include/types/proto_udp.h
    3  * This file provides structures and types for UDP protocol.
    4  *
    5  * Copyright (C) 2014 Baptiste Assmann <bedis9@gmail.com>
    6  *
    7  * This library is free software; you can redistribute it and/or
    8  * modify it under the terms of the GNU Lesser General Public
    9  * License as published by the Free Software Foundation, version 2.1
   10  * exclusively.
   11  *
   12  * This library is distributed in the hope that it will be useful,
   13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
   14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   15  * Lesser General Public License for more details.
   16  *
   17  * You should have received a copy of the GNU Lesser General Public
   18  * License along with this library; if not, write to the Free Software
   19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
   20  */
   21 
   22 #ifndef _TYPES_PROTO_UDP_H
   23 #define _TYPES_PROTO_UDP_H
   24 
   25 #include <arpa/inet.h>
   26 
   27 /*
   28  * datagram related structure
   29  */
   30 struct dgram_conn {
   31     const struct dgram_data_cb *data;   /* data layer callbacks. Must be set before */
   32     void *owner;                /* pointer to upper layer's entity */
   33     union {                 /* definitions which depend on connection type */
   34         struct {            /*** information used by socket-based dgram ***/
   35             int fd;         /* file descriptor */
   36         } sock;
   37     } t;
   38     struct {
   39         struct sockaddr_storage from;   /* client address, or address to spoof when connecting to the server */
   40         struct sockaddr_storage to; /* address reached by the client, or address to connect to */
   41     } addr;                 /* addresses of the remote side, client for producer and server for consumer */
   42 };
   43 
   44 /*
   45  * datagram callback structure
   46  */
   47 struct dgram_data_cb {
   48     void (*recv)(struct dgram_conn *dgram); /* recv callback */
   49     void (*send)(struct dgram_conn *dgram); /* send callback */
   50 };
   51 
   52 #endif /* _TYPES_PROTO_UDP_H */