"Fossies" - the Fresh Open Source Software Archive

Member "hydra-3.3.2/mpl/include/mpl_sockaddr.h" (12 Nov 2019, 1420 Bytes) of package /linux/misc/hydra-3.3.2.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 "mpl_sockaddr.h" see the Fossies "Dox" file reference documentation.

    1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
    2 /*
    3  *  (C) 2018 by Argonne National Laboratory.
    4  *      See COPYRIGHT in top-level directory.
    5  */
    6 
    7 #ifndef MPL_SOCKADDR_H_INCLUDED
    8 #define MPL_SOCKADDR_H_INCLUDED
    9 
   10 #include <sys/socket.h>
   11 
   12 #define MPL_SOCKADDR_ANY 0
   13 #define MPL_SOCKADDR_LOOPBACK 1
   14 
   15 /* modifies the default behavior of MPL_Listen
   16  * a - whether listen on loopback (default: listen on all interfaces)
   17  * b - maximum simultaneous connection (default: SOMAXCONN)
   18  */
   19 #define MPL_LISTEN_PUSH(a,b) MPL_set_listen_attr(a, b)
   20 #define MPL_LISTEN_POP MPL_set_listen_attr(0, SOMAXCONN)
   21 
   22 typedef struct sockaddr_storage MPL_sockaddr_t;
   23 
   24 void MPL_sockaddr_set_aftype(int type);
   25 int MPL_get_sockaddr(const char *s_hostname, MPL_sockaddr_t * p_addr);
   26 int MPL_get_sockaddr_direct(int type, MPL_sockaddr_t * p_addr);
   27 int MPL_get_sockaddr_iface(const char *s_iface, MPL_sockaddr_t * p_addr);
   28 int MPL_socket(void);
   29 int MPL_connect(int socket, MPL_sockaddr_t * p_addr, unsigned short port);
   30 void MPL_set_listen_attr(int use_loopback, int max_conn);
   31 int MPL_listen(int socket, unsigned short port);
   32 int MPL_listen_anyport(int socket, unsigned short *p_port);
   33 int MPL_listen_portrange(int socket, unsigned short *p_port, int low_port, int high_port);
   34 int MPL_sockaddr_to_str(MPL_sockaddr_t * p_addr, char *str, int maxlen);
   35 int MPL_sockaddr_port(MPL_sockaddr_t * p_addr);
   36 
   37 #endif /* MPL_SOCKADDR_H_INCLUDED */