1*408a4873SAndrew Rist/************************************************************** 2cdf0e10cSrcweir * 3*408a4873SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*408a4873SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*408a4873SAndrew Rist * distributed with this work for additional information 6*408a4873SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*408a4873SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*408a4873SAndrew Rist * "License"); you may not use this file except in compliance 9*408a4873SAndrew Rist * with the License. You may obtain a copy of the License at 10*408a4873SAndrew Rist * 11*408a4873SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*408a4873SAndrew Rist * 13*408a4873SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*408a4873SAndrew Rist * software distributed under the License is distributed on an 15*408a4873SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*408a4873SAndrew Rist * KIND, either express or implied. See the License for the 17*408a4873SAndrew Rist * specific language governing permissions and limitations 18*408a4873SAndrew Rist * under the License. 19*408a4873SAndrew Rist * 20*408a4873SAndrew Rist *************************************************************/ 21*408a4873SAndrew Rist 22*408a4873SAndrew Rist 23cdf0e10cSrcweir#ifndef __com_sun_star_connection_SocketPermission_idl__ 24cdf0e10cSrcweir#define __com_sun_star_connection_SocketPermission_idl__ 25cdf0e10cSrcweir 26cdf0e10cSrcweir//============================================================================= 27cdf0e10cSrcweir 28cdf0e10cSrcweirmodule com { module sun { module star { module connection { 29cdf0e10cSrcweir 30cdf0e10cSrcweir//============================================================================= 31cdf0e10cSrcweir 32cdf0e10cSrcweir/** This permission represents access to a network via sockets. 33cdf0e10cSrcweir A SocketPermission consists of a host specification and a set of actions 34cdf0e10cSrcweir specifying ways to connect to that host. The host is specified as 35cdf0e10cSrcweir <pre> 36cdf0e10cSrcweir host = (hostname | IPaddress)[:portrange] 37cdf0e10cSrcweir portrange = portnumber | -portnumber | portnumber-[portnumber] 38cdf0e10cSrcweir </pre> 39cdf0e10cSrcweir The host is expressed as a DNS name, as a numerical IP address, or as 40cdf0e10cSrcweir <code>"localhost"</code> (for the local machine). The wildcard <code>"*"</code> 41cdf0e10cSrcweir may be included once 42cdf0e10cSrcweir in a DNS name host specification. If it is included, it must be in the 43cdf0e10cSrcweir leftmost position, as in <code>"*.sun.com"</code>. 44cdf0e10cSrcweir <br> 45cdf0e10cSrcweir The port or portrange is optional. A port specification of the form <code>"N-"</code>, 46cdf0e10cSrcweir where <code>N</code> is a port number, signifies all ports numbered <code>N</code> and above, 47cdf0e10cSrcweir while a specification of the form <code>"-N"</code> indicates all ports numbered 48cdf0e10cSrcweir <code>N</code> and below. 49cdf0e10cSrcweir 50cdf0e10cSrcweir <p> 51cdf0e10cSrcweir The possible ways to connect to the host are 52cdf0e10cSrcweir <ul> 53cdf0e10cSrcweir <li><code>accept</code></li> 54cdf0e10cSrcweir <li><code>connect</code></li> 55cdf0e10cSrcweir <li><code>listen</code></li> 56cdf0e10cSrcweir <li><code>resolve</code></li> 57cdf0e10cSrcweir </ul><br> 58cdf0e10cSrcweir The <code>"listen"</code> action is only meaningful when used with <code>"localhost"</code>. 59cdf0e10cSrcweir The <code>"resolve"</code> (resolve host/ip name service lookups) action is implied when 60cdf0e10cSrcweir any of the other actions are present. 61cdf0e10cSrcweir <br> 62cdf0e10cSrcweir As an example of the creation and meaning of SocketPermissions, note that if 63cdf0e10cSrcweir the following permission 64cdf0e10cSrcweir<pre> 65cdf0e10cSrcweirSocketPermission("foo.bar.com:7777", "connect,accept"); 66cdf0e10cSrcweir</pre> 67cdf0e10cSrcweir is granted, it allows to connect to port 7777 on foo.bar.com, and to 68cdf0e10cSrcweir accept connections on that port. 69cdf0e10cSrcweir <br> 70cdf0e10cSrcweir Similarly, if the following permission 71cdf0e10cSrcweir<pre> 72cdf0e10cSrcweirSocketPermission("localhost:1024-", "accept,connect,listen"); 73cdf0e10cSrcweir</pre> 74cdf0e10cSrcweir is granted, it allows that code to accept connections on, connect to, or listen 75cdf0e10cSrcweir on any port between 1024 and 65535 on the local host. 76cdf0e10cSrcweir </p> 77cdf0e10cSrcweir 78cdf0e10cSrcweir @attention 79cdf0e10cSrcweir Granting code permission to accept or make connections to remote hosts may be 80cdf0e10cSrcweir dangerous because malevolent code can then more easily transfer and share 81cdf0e10cSrcweir confidential data among parties who may not otherwise have access to the data. 82cdf0e10cSrcweir </p> 83cdf0e10cSrcweir 84cdf0e10cSrcweir @since OOo 1.1.2 85cdf0e10cSrcweir*/ 86cdf0e10cSrcweirpublished struct SocketPermission 87cdf0e10cSrcweir{ 88cdf0e10cSrcweir /** target host with optional portrange 89cdf0e10cSrcweir */ 90cdf0e10cSrcweir string Host; 91cdf0e10cSrcweir /** comma separated actions list 92cdf0e10cSrcweir */ 93cdf0e10cSrcweir string Actions; 94cdf0e10cSrcweir}; 95cdf0e10cSrcweir 96cdf0e10cSrcweir//============================================================================= 97cdf0e10cSrcweir 98cdf0e10cSrcweir}; }; }; }; 99cdf0e10cSrcweir 100cdf0e10cSrcweir#endif 101