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