/usr/include/syslog-ng/gsockaddr.h is in syslog-ng-dev 3.5.3-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 | /*
* Copyright (c) 2002-2010 BalaBit IT Ltd, Budapest, Hungary
* Copyright (c) 1998-2010 Balázs Scheidler
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
* As an additional exemption you are allowed to compile & link against the
* OpenSSL libraries as published by the OpenSSL project. See the file
* COPYING for details.
*
*/
#ifndef G_SOCKADDR_H_INCLUDED
#define G_SOCKADDR_H_INCLUDED
#include "syslog-ng.h"
#include "atomic.h"
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <unistd.h>
#include <errno.h>
#include <sys/types.h>
#include <netinet/in.h>
/* sockaddr public interface */
#define MAX_SOCKADDR_STRING 64
#define GSA_FULL 0
#define GSA_ADDRESS_ONLY 1
typedef struct _GSockAddrFuncs GSockAddrFuncs;
typedef struct _GSockAddr
{
GAtomicCounter refcnt;
guint32 flags;
GSockAddrFuncs *sa_funcs;
int salen;
struct sockaddr sa;
} GSockAddr;
struct _GSockAddrFuncs
{
GIOStatus (*bind_prepare)(gint sock, GSockAddr *addr);
GIOStatus (*bind)(int sock, GSockAddr *addr);
gchar *(*format)(GSockAddr *addr, gchar *text, gulong n, gint format);
guint16 (*get_port) (GSockAddr *addr);
void (*set_port) (GSockAddr *addr, guint16 port);
};
gchar *g_sockaddr_format(GSockAddr *a, gchar *text, gulong n, gint format);
guint16 g_sockaddr_get_port(GSockAddr *a);
void g_sockaddr_set_port(GSockAddr *a, guint16 port);
GSockAddr *g_sockaddr_new(struct sockaddr *sa, int salen);
GSockAddr *g_sockaddr_ref(GSockAddr *a);
void g_sockaddr_unref(GSockAddr *a);
static inline struct sockaddr *
g_sockaddr_get_sa(GSockAddr *self)
{
return &self->sa;
}
gboolean g_sockaddr_inet_check(GSockAddr *a);
GSockAddr *g_sockaddr_inet_new(gchar *ip, guint16 port);
GSockAddr *g_sockaddr_inet_new2(struct sockaddr_in *sin);
static inline struct sockaddr_in *
g_sockaddr_inet_get_sa(GSockAddr *s)
{
g_assert(g_sockaddr_inet_check(s));
return (struct sockaddr_in *) g_sockaddr_get_sa(s);
}
/**
* g_sockaddr_inet_get_address:
* @s: GSockAddrInet instance
*
* This GSockAddrInet specific function returns the address part of the
* address.
**/
static inline struct in_addr
g_sockaddr_inet_get_address(GSockAddr *s)
{
return g_sockaddr_inet_get_sa(s)->sin_addr;
}
/**
* g_sockaddr_inet_set_address:
* @s: GSockAddrInet instance
* @addr: new address
*
* This GSockAddrInet specific function returns the address part of the
* address.
**/
static inline void
g_sockaddr_inet_set_address(GSockAddr *s, struct in_addr addr)
{
g_sockaddr_inet_get_sa(s)->sin_addr = addr;
}
#if ENABLE_IPV6
gboolean g_sockaddr_inet6_check(GSockAddr *a);
GSockAddr *g_sockaddr_inet6_new(gchar *ip, guint16 port);
GSockAddr *g_sockaddr_inet6_new2(struct sockaddr_in6 *sin6);
static inline struct sockaddr_in6 *
g_sockaddr_inet6_get_sa(GSockAddr *s)
{
g_assert(g_sockaddr_inet6_check(s));
return (struct sockaddr_in6 *) g_sockaddr_get_sa(s);
}
/**
* g_sockaddr_inet6_get_address:
* @s: GSockAddrInet instance
*
* This GSockAddrInet specific function returns the address part of the
* address.
**/
static inline struct in6_addr *
g_sockaddr_inet6_get_address(GSockAddr *s)
{
return &g_sockaddr_inet6_get_sa(s)->sin6_addr;
}
/**
* g_sockaddr_inet6_set_address:
* @s: GSockAddrInet6 instance
* @addr: new address
*
* This GSockAddrInet specific function sets the address part of the
* address.
**/
static inline void
g_sockaddr_inet6_set_address(GSockAddr *s, struct in6_addr *addr)
{
g_sockaddr_inet6_get_sa(s)->sin6_addr = *addr;
}
#endif
GSockAddr *g_sockaddr_unix_new(const gchar *name);
GSockAddr *g_sockaddr_unix_new2(struct sockaddr_un *s_un, int sunlen);
#endif
|