1/*************************************************************************
2 *
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
6 *
7 * OpenOffice.org - a multi-platform office productivity suite
8 *
9 * This file is part of OpenOffice.org.
10 *
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
14 *
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
20 *
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org.  If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
25 *
26 ************************************************************************/
27#ifndef __com_sun_star_connection_SocketPermission_idl__
28#define __com_sun_star_connection_SocketPermission_idl__
29
30//=============================================================================
31
32module com {  module sun {  module star {  module connection {
33
34//=============================================================================
35
36/** This permission represents access to a network via sockets.
37    A SocketPermission consists of a host specification and a set of actions
38    specifying ways to connect to that host.  The host is specified as
39    <pre>
40    host = (hostname | IPaddress)[:portrange]
41    portrange = portnumber | -portnumber | portnumber-[portnumber]
42    </pre>
43    The host is expressed as a DNS name, as a numerical IP address, or as
44    <code>"localhost"</code> (for the local machine).  The wildcard <code>"*"</code>
45     may be included once
46    in a DNS name host specification.  If it is included, it must be in the
47    leftmost position, as in <code>"*.sun.com"</code>.
48    <br>
49    The port or portrange is optional.  A port specification of the form <code>"N-"</code>,
50    where <code>N</code> is a port number, signifies all ports numbered <code>N</code> and above,
51    while a specification of the form <code>"-N"</code> indicates all ports numbered
52    <code>N</code> and below.
53
54    <p>
55    The possible ways to connect to the host are
56    <ul>
57    <li><code>accept</code></li>
58    <li><code>connect</code></li>
59    <li><code>listen</code></li>
60    <li><code>resolve</code></li>
61    </ul><br>
62    The <code>"listen"</code> action is only meaningful when used with <code>"localhost"</code>.
63    The <code>"resolve"</code> (resolve host/ip name service lookups) action is implied when
64    any of the other actions are present.
65    <br>
66    As an example of the creation and meaning of SocketPermissions, note that if
67    the following permission
68<pre>
69SocketPermission("foo.bar.com:7777", "connect,accept");
70</pre>
71    is granted, it allows to connect to port 7777 on foo.bar.com, and to
72    accept connections on that port.
73    <br>
74    Similarly, if the following permission
75<pre>
76SocketPermission("localhost:1024-", "accept,connect,listen");
77</pre>
78    is granted, it allows that code to accept connections on, connect to, or listen
79    on any port between 1024 and 65535 on the local host.
80    </p>
81
82    @attention
83    Granting code permission to accept or make connections to remote hosts may be
84    dangerous because malevolent code can then more easily transfer and share
85    confidential data among parties who may not otherwise have access to the data.
86    </p>
87
88    @since OOo 1.1.2
89*/
90published struct SocketPermission
91{
92	/** target host with optional portrange
93	*/
94	string Host;
95	/** comma separated actions list
96	*/
97	string Actions;
98};
99
100//=============================================================================
101
102}; }; }; };
103
104#endif
105