/usr/share/zorp/pylib/Zorp/SockAddr.py is in zorp 3.9.5-4.
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 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 | ############################################################################
##
## Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
## 2010, 2011 BalaBit IT Ltd, Budapest, Hungary
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 2 of the License, or
## (at your option) any later version.
##
## This program 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 General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program; if not, write to the Free Software
## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
##
##
############################################################################
"""
<module maturity="stable">
<summary>
Module defining interface to the SockAddr.
</summary>
<description>
<para>
This module implements <parameter>inet_ntoa</parameter> and <parameter>inet_aton</parameter>. The module also provides an interface
to the SockAddr services of the Zorp core. SockAddr is used for example to define the bind address of
<link linkend="python.Dispatch.Dispatcher">Dispatchers</link>, or the address of the ZAS server in
<link linkend="python.AuthDB.AuthenticationProvider">AuthenticationProvider</link> policies.
</para>
</description>
</module>
"""
class SockAddrInet(object):
"""
<class maturity="stable">
<summary>
Class encapsulating an IPv4 address:port pair.
</summary>
<description>
<para>
This class encapsulates an IPv4 address:port pair, similarly to
the <parameter>sockaddr_in</parameter> struct in C. The class is implemented and exported by
the Zorp core. The <parameter>SockAddrInet</parameter> Python class serves only
documentation purposes, and has no real connection to the
behavior implemented in C.
</para>
<example>
<title>SockAddrInet example</title>
<para>
The following example defines an IPv4 address:port pair.</para>
<synopsis>
SockAddrInet('192.168.10.10', 80)
</synopsis>
<para>
The following example uses SockAddrInet in a dispatcher. See <xref linkend="python.Dispatch.Dispatcher"/> for details on Dispatchers.
</para>
<synopsis>
Dispatcher(transparent=TRUE, bindto=DBSockAddr(protocol=ZD_PROTO_TCP, sa=SockAddrInet('192.168.11.11', 50080)), service="intra_HTTP_inter", backlog=255, rule_port="50080")
</synopsis>
</example>
</description>
<metainfo>
<attributes>
<attribute maturity="stable">
<name>type</name>
<type><string/></type>
<description>The <parameter>inet</parameter> value that indicates an address in the AF_INET domain.</description>
</attribute>
<attribute maturity="stable">
<name>ip</name>
<type></type>
<description>IP address (network byte order).</description>
</attribute>
<attribute maturity="stable">
<name>ip_s</name>
<type></type>
<description>IP address in string representation.</description>
</attribute>
<attribute maturity="stable">
<name>port</name>
<type></type>
<description>Port number (network byte order).</description>
</attribute>
</attributes>
</metainfo>
</class>
"""
pass
class SockAddrInet6(object):
"""
<class maturity="stable">
<summary>
Class encapsulating an IPv6 address:port pair.
</summary>
<description>
<para>
This class encapsulates an IPv6 address:port pair, similarly to
the <parameter>sockaddr_in</parameter> struct in C. The class is implemented and exported by
the Zorp core. The <parameter>SockAddrInet</parameter> Python class serves only
documentation purposes, and has no real connection to the
behavior implemented in C.
</para>
<example>
<title>SockAddrInet example</title>
<para>
The following example defines an IPv6 address:port pair.</para>
<synopsis>
SockAddrInet('fec0::1', 80)
</synopsis>
<para>
The following example uses SockAddrInet in a dispatcher. See <xref linkend="python.Dispatch.Dispatcher"/> for details on Dispatchers.
</para>
<synopsis>
Dispatcher(transparent=TRUE, bindto=DBSockAddr(protocol=ZD_PROTO_TCP, sa=SockAddrInet('fec0::1', 50080)), service="intra_HTTP_inter", backlog=255, rule_port="50080")
</synopsis>
</example>
</description>
<metainfo>
<attributes>
<attribute maturity="stable">
<name>type</name>
<type><string/></type>
<description>The <parameter>inet</parameter> value that indicates an address in the AF_INET domain.</description>
</attribute>
<attribute maturity="stable">
<name>ip</name>
<type></type>
<description>IP address (network byte order).</description>
</attribute>
<attribute maturity="stable">
<name>ip_s</name>
<type></type>
<description>IP address in string representation.</description>
</attribute>
<attribute maturity="stable">
<name>port</name>
<type></type>
<description>Port number (network byte order).</description>
</attribute>
</attributes>
</metainfo>
</class>
"""
pass
class SockAddrInetRange(object):
"""
<class maturity="stable">
<summary>
Class encapsulating an IPv4 address and a port range.
</summary>
<description>
<para>
A specialized SockAddrInet class which allocates a new port
within the given range of ports when a dispatcher bounds to it.
The class is implemented and exported by
the Zorp core. The <parameter>SockAddrInetRange</parameter> Python class serves only
documentation purposes, and has no real connection to the
behavior implemented in C.
</para>
</description>
<metainfo>
<attributes>
<attribute maturity="stable">
<name>type</name>
<type><string/></type>
<description>The <parameter>inet</parameter> value that indicates an address in the AF_INET domain.</description>
</attribute>
<attribute maturity="stable">
<name>ip</name>
<type></type>
<description>IP address (network byte order).</description>
</attribute>
<attribute maturity="stable">
<name>ip_s</name>
<type></type>
<description>IP address in string representation.</description>
</attribute>
<attribute maturity="stable">
<name>port</name>
<type></type>
<description>Port number (network byte order).</description>
</attribute>
</attributes>
</metainfo>
</class>
"""
pass
class SockAddrUnix(object):
"""
<class maturity="stable">
<summary>
Class encapsulating a UNIX domain socket.
</summary>
<description>
<para>
This class encapsulates a UNIX domain socket endpoint.
The socket is represented by a filename. The <parameter>SockAddrUnix</parameter>
Python class serves only
documentation purposes, and has no real connection to the
behavior implemented in C.
</para>
<example>
<title>SockAddrUnix example</title>
<para>
The following example defines a Unix domain socket.</para>
<synopsis>
SockAddrUnix('/var/sample.socket')
</synopsis>
<para>
The following example uses SockAddrUnix in a DirectedRouter.
</para>
<synopsis>
Service(name="demo_service", proxy_class=HttpProxy, router=DirectedRouter(dest_addr=SockAddrUnix('/var/sample.socket'), overrideable=FALSE, forge_addr=FALSE))
</synopsis>
</example>
</description>
<metainfo>
<attributes>
<attribute maturity="stable">
<name>type</name>
<type><string/></type>
<description>The <parameter>unix</parameter> value that indicates an address in the UNIX domain.</description>
</attribute>
</attributes>
</metainfo>
</class>
"""
|