aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorJeff Ames2008-12-30 01:08:07 +0000
committerJeff Ames2008-12-30 01:08:07 +0000
commit2be0f7a6f0b66e25b0d7e0e6cfee93f0c41b562b (patch)
treec39317267e7f1d634fc1a922ded51c6e48e329d1 /OpenSim
parentChanging the default Comms module to be RESTComms, in case none is specified ... (diff)
downloadopensim-SC_OLD-2be0f7a6f0b66e25b0d7e0e6cfee93f0c41b562b.zip
opensim-SC_OLD-2be0f7a6f0b66e25b0d7e0e6cfee93f0c41b562b.tar.gz
opensim-SC_OLD-2be0f7a6f0b66e25b0d7e0e6cfee93f0c41b562b.tar.bz2
opensim-SC_OLD-2be0f7a6f0b66e25b0d7e0e6cfee93f0c41b562b.tar.xz
Update svn properties, minor formatting cleanup.
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Data/SQLite/Resources/016_RegionStore.sql10
-rw-r--r--OpenSim/Framework/OpenJpeg/bio.cs300
-rw-r--r--OpenSim/Framework/OpenJpeg/fix.cs59
-rw-r--r--OpenSim/Framework/OpenJpeg/int_.cs142
-rw-r--r--OpenSim/Framework/OpenJpeg/j2k.cs318
-rw-r--r--OpenSim/Framework/OpenJpeg/openjpeg.cs733
-rw-r--r--OpenSim/Framework/OpenJpeg/pi.cs119
-rw-r--r--OpenSim/Grid/UserServer/OpenIdService.cs678
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs4
-rw-r--r--OpenSim/Region/Environment/Interfaces/IInterregionComms.cs94
-rw-r--r--OpenSim/Region/Environment/Modules/Communications/Local/LocalInterregionComms.cs280
-rw-r--r--OpenSim/Region/Environment/Modules/Communications/REST/HGInterregionComms.cs172
-rw-r--r--OpenSim/Region/Environment/Modules/Communications/REST/RESTInterregionComms.cs592
-rw-r--r--OpenSim/Region/Environment/Modules/Scripting/VectorRender/VectorRenderModule.cs2
-rw-r--r--OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs2
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs8
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectPart.cs2
-rw-r--r--OpenSim/Region/Physics/Manager/PhysicsJoint.cs110
-rw-r--r--OpenSim/Region/Physics/OdePlugin/OdePhysicsJoint.cs98
-rw-r--r--OpenSim/Region/Physics/OdePlugin/OdePlugin.cs16
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs2
21 files changed, 1941 insertions, 1800 deletions
diff --git a/OpenSim/Data/SQLite/Resources/016_RegionStore.sql b/OpenSim/Data/SQLite/Resources/016_RegionStore.sql
index 71be55b..52f160c 100644
--- a/OpenSim/Data/SQLite/Resources/016_RegionStore.sql
+++ b/OpenSim/Data/SQLite/Resources/016_RegionStore.sql
@@ -1,5 +1,5 @@
1BEGIN; 1BEGIN;
2 2
3ALTER TABLE prims ADD COLUMN VolumeDetect INTEGER NOT NULL DEFAULT 0; 3ALTER TABLE prims ADD COLUMN VolumeDetect INTEGER NOT NULL DEFAULT 0;
4 4
5COMMIT; 5COMMIT;
diff --git a/OpenSim/Framework/OpenJpeg/bio.cs b/OpenSim/Framework/OpenJpeg/bio.cs
index 4f095ad..4a5b321 100644
--- a/OpenSim/Framework/OpenJpeg/bio.cs
+++ b/OpenSim/Framework/OpenJpeg/bio.cs
@@ -1,138 +1,162 @@
1using System; 1/*
2using System.Collections.Generic; 2 * Copyright (c) Contributors, http://opensimulator.org/
3using System.Text; 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 4 *
5namespace OpenSim.Framework.OpenJpeg 5 * Redistribution and use in source and binary forms, with or without
6{ 6 * modification, are permitted provided that the following conditions are met:
7 public static class bio 7 * * Redistributions of source code must retain the above copyright
8 { 8 * notice, this list of conditions and the following disclaimer.
9 9 * * Redistributions in binary form must reproduce the above copyright
10 public static opj_bio bio_create() 10 * notice, this list of conditions and the following disclaimer in the
11 { 11 * documentation and/or other materials provided with the distribution.
12 opj_bio bio = new opj_bio(); 12 * * Neither the name of the OpenSimulator Project nor the
13 return bio; 13 * names of its contributors may be used to endorse or promote products
14 } 14 * derived from this software without specific prior written permission.
15 15 *
16 public static void bio_destroy(opj_bio bio) 16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 { 17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 // not needed on C# 18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 } 19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 public static int bio_numbytes(opj_bio bio) 21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 { 22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 return (bio.bp - bio.start); 23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 } 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 public static void bio_init_enc(opj_bio bio, sbyte bp, int len) 26 */
27 { 27
28 bio.start = (byte)bp; 28using System;
29 bio.end = (byte)(bp + (byte)len); 29using System.Collections.Generic;
30 bio.bp = (byte)bp; 30using System.Text;
31 bio.buf = 0; 31
32 bio.ct = 8; 32namespace OpenSim.Framework.OpenJpeg
33 } 33{
34 34 public static class bio
35 public static void bio_init_dec(opj_bio bio, sbyte bp, int len) 35 {
36 { 36 public static opj_bio bio_create()
37 bio.start = (byte)bp; 37 {
38 bio.end = (byte)(bp + len); 38 opj_bio bio = new opj_bio();
39 bio.bp = (byte)bp; 39 return bio;
40 bio.buf = 0; 40 }
41 bio.ct = 0; 41
42 } 42 public static void bio_destroy(opj_bio bio)
43 43 {
44 public static void bio_write(opj_bio bio, int v, int n) 44 // not needed on C#
45 { 45 }
46 for (int i = n - 1; i >= 0; i--) 46
47 bio_putbit(bio, (v >> i) & 1); 47 public static int bio_numbytes(opj_bio bio)
48 } 48 {
49 49 return (bio.bp - bio.start);
50 public static int bio_read(opj_bio bio, int n) 50 }
51 { 51
52 int v = 0; 52 public static void bio_init_enc(opj_bio bio, sbyte bp, int len)
53 for (int i = n - 1; i >= 0; i--) 53 {
54 v += bio_getbit(bio) << i; 54 bio.start = (byte)bp;
55 55 bio.end = (byte)(bp + (byte)len);
56 return v; 56 bio.bp = (byte)bp;
57 } 57 bio.buf = 0;
58 58 bio.ct = 8;
59 public static int bio_flush(opj_bio bio) 59 }
60 { 60
61 bio.ct = 0; 61 public static void bio_init_dec(opj_bio bio, sbyte bp, int len)
62 if (bio_byteout(bio) != 0) 62 {
63 return 1; 63 bio.start = (byte)bp;
64 64 bio.end = (byte)(bp + len);
65 if (bio.ct == 7) 65 bio.bp = (byte)bp;
66 { 66 bio.buf = 0;
67 bio.ct = 0; 67 bio.ct = 0;
68 if (bio_byteout(bio) != 0) 68 }
69 return 1; 69
70 } 70 public static void bio_write(opj_bio bio, int v, int n)
71 return 0; 71 {
72 } 72 for (int i = n - 1; i >= 0; i--)
73 73 bio_putbit(bio, (v >> i) & 1);
74 public static int bio_inalign(opj_bio bio) 74 }
75 { 75
76 bio.ct = 0; 76 public static int bio_read(opj_bio bio, int n)
77 if ((bio.buf & 0xff) == 0xff) 77 {
78 { 78 int v = 0;
79 if (bio_bytein(bio) != 0) 79 for (int i = n - 1; i >= 0; i--)
80 return 1; 80 v += bio_getbit(bio) << i;
81 bio.ct = 0; 81
82 } 82 return v;
83 return 0; 83 }
84 } 84
85 85 public static int bio_flush(opj_bio bio)
86 private static int bio_bytein(opj_bio bio) 86 {
87 { 87 bio.ct = 0;
88 bio.buf = (bio.buf << 8) & 0xffff; 88 if (bio_byteout(bio) != 0)
89 bio.ct = bio.buf == 0xff00 ? 7 : 8; 89 return 1;
90 if (bio.bp >= bio.end) 90
91 return 1; 91 if (bio.ct == 7)
92 bio.buf |= bio.bp++; 92 {
93 93 bio.ct = 0;
94 return 0; 94 if (bio_byteout(bio) != 0)
95 } 95 return 1;
96 96 }
97 private static int bio_byteout(opj_bio bio) 97 return 0;
98 { 98 }
99 bio.buf = (bio.buf << 8) & 0xffff; 99
100 bio.ct = bio.buf == 0xff00 ? 7 : 8; 100 public static int bio_inalign(opj_bio bio)
101 if (bio.bp >= bio.end) 101 {
102 return 1; 102 bio.ct = 0;
103 103 if ((bio.buf & 0xff) == 0xff)
104 bio.bp = (byte)(bio.buf >> 8); 104 {
105 bio.bp++; 105 if (bio_bytein(bio) != 0)
106 return 0; 106 return 1;
107 } 107 bio.ct = 0;
108 108 }
109 private static void bio_putbit(opj_bio bio, int b) 109 return 0;
110 { 110 }
111 if (bio.ct == 0) 111
112 bio_byteout(bio); 112 private static int bio_bytein(opj_bio bio)
113 113 {
114 bio.ct--; 114 bio.buf = (bio.buf << 8) & 0xffff;
115 bio.buf |= (byte)(b << bio.ct); 115 bio.ct = bio.buf == 0xff00 ? 7 : 8;
116 116 if (bio.bp >= bio.end)
117 } 117 return 1;
118 118 bio.buf |= bio.bp++;
119 private static int bio_getbit(opj_bio bio) 119
120 { 120 return 0;
121 if (bio.ct == 0) 121 }
122 bio_bytein(bio); 122
123 bio.ct--; 123 private static int bio_byteout(opj_bio bio)
124 124 {
125 return (int)((bio.buf >> bio.ct) & 1); 125 bio.buf = (bio.buf << 8) & 0xffff;
126 } 126 bio.ct = bio.buf == 0xff00 ? 7 : 8;
127 127 if (bio.bp >= bio.end)
128 } 128 return 1;
129 129
130 public struct opj_bio 130 bio.bp = (byte)(bio.buf >> 8);
131 { 131 bio.bp++;
132 public byte start; 132 return 0;
133 public byte end; 133 }
134 public byte bp; 134
135 public uint buf; 135 private static void bio_putbit(opj_bio bio, int b)
136 public int ct; 136 {
137 } 137 if (bio.ct == 0)
138} 138 bio_byteout(bio);
139
140 bio.ct--;
141 bio.buf |= (byte)(b << bio.ct);
142 }
143
144 private static int bio_getbit(opj_bio bio)
145 {
146 if (bio.ct == 0)
147 bio_bytein(bio);
148 bio.ct--;
149
150 return (int)((bio.buf >> bio.ct) & 1);
151 }
152 }
153
154 public struct opj_bio
155 {
156 public byte start;
157 public byte end;
158 public byte bp;
159 public uint buf;
160 public int ct;
161 }
162}
diff --git a/OpenSim/Framework/OpenJpeg/fix.cs b/OpenSim/Framework/OpenJpeg/fix.cs
index 76d3159..9de0041 100644
--- a/OpenSim/Framework/OpenJpeg/fix.cs
+++ b/OpenSim/Framework/OpenJpeg/fix.cs
@@ -1,16 +1,43 @@
1using System; 1/*
2using System.Collections.Generic; 2 * Copyright (c) Contributors, http://opensimulator.org/
3using System.Text; 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 4 *
5namespace OpenSim.Framework.OpenJpeg 5 * Redistribution and use in source and binary forms, with or without
6{ 6 * modification, are permitted provided that the following conditions are met:
7 public static class fix 7 * * Redistributions of source code must retain the above copyright
8 { 8 * notice, this list of conditions and the following disclaimer.
9 public static int fix_mul(int a, int b) 9 * * Redistributions in binary form must reproduce the above copyright
10 { 10 * notice, this list of conditions and the following disclaimer in the
11 long temp = (long)a * (long)b; 11 * documentation and/or other materials provided with the distribution.
12 temp += temp & 4096; 12 * * Neither the name of the OpenSimulator Project nor the
13 return (int)(temp >> 13); 13 * names of its contributors may be used to endorse or promote products
14 } 14 * derived from this software without specific prior written permission.
15 } 15 *
16} 16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using System.Text;
31
32namespace OpenSim.Framework.OpenJpeg
33{
34 public static class fix
35 {
36 public static int fix_mul(int a, int b)
37 {
38 long temp = (long)a * (long)b;
39 temp += temp & 4096;
40 return (int)(temp >> 13);
41 }
42 }
43}
diff --git a/OpenSim/Framework/OpenJpeg/int_.cs b/OpenSim/Framework/OpenJpeg/int_.cs
index dc71728..07321b5 100644
--- a/OpenSim/Framework/OpenJpeg/int_.cs
+++ b/OpenSim/Framework/OpenJpeg/int_.cs
@@ -1,58 +1,84 @@
1using System; 1/*
2using System.Collections.Generic; 2 * Copyright (c) Contributors, http://opensimulator.org/
3using System.Text; 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 4 *
5namespace OpenSim.Framework.OpenJpeg 5 * Redistribution and use in source and binary forms, with or without
6{ 6 * modification, are permitted provided that the following conditions are met:
7 public static class int_ 7 * * Redistributions of source code must retain the above copyright
8 { 8 * notice, this list of conditions and the following disclaimer.
9 public static int int_min(int a, int b) 9 * * Redistributions in binary form must reproduce the above copyright
10 { 10 * notice, this list of conditions and the following disclaimer in the
11 return a < b ? a : b; 11 * documentation and/or other materials provided with the distribution.
12 } 12 * * Neither the name of the OpenSimulator Project nor the
13 13 * names of its contributors may be used to endorse or promote products
14 public static int int_max(int a, int b) 14 * derived from this software without specific prior written permission.
15 { 15 *
16 return (a > b) ? a : b; 16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 } 17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 public static int int_clamp(int a, int min, int max) 19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 { 20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 if (a < min) 21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 return min; 22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 if (a > max) 23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 return max; 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 return a; 26 */
27 } 27
28 28using System;
29 public static int int_abs(int a) 29using System.Collections.Generic;
30 { 30using System.Text;
31 return a < 0 ? -a : a; 31
32 } 32namespace OpenSim.Framework.OpenJpeg
33 33{
34 public static int int_ceildiv(int a, int b) 34 public static class int_
35 { 35 {
36 return (a + b - 1) / b; 36 public static int int_min(int a, int b)
37 } 37 {
38 38 return a < b ? a : b;
39 public static int int_ceildivpow2(int a, int b) 39 }
40 { 40
41 return (a + (1 << b) - 1) >> b; 41 public static int int_max(int a, int b)
42 } 42 {
43 43 return (a > b) ? a : b;
44 public static int int_floordivpow2(int a, int b) 44 }
45 { 45
46 return a >> b; 46 public static int int_clamp(int a, int min, int max)
47 } 47 {
48 48 if (a < min)
49 public static int int_floorlog2(int a) 49 return min;
50 { 50 if (a > max)
51 for (int l=0; a > 1; l++) 51 return max;
52 a >>= 1; 52
53 53 return a;
54 return 1; 54 }
55 } 55
56 56 public static int int_abs(int a)
57 } 57 {
58} 58 return a < 0 ? -a : a;
59 }
60
61 public static int int_ceildiv(int a, int b)
62 {
63 return (a + b - 1) / b;
64 }
65
66 public static int int_ceildivpow2(int a, int b)
67 {
68 return (a + (1 << b) - 1) >> b;
69 }
70
71 public static int int_floordivpow2(int a, int b)
72 {
73 return a >> b;
74 }
75
76 public static int int_floorlog2(int a)
77 {
78 for (int l=0; a > 1; l++)
79 a >>= 1;
80
81 return 1;
82 }
83 }
84}
diff --git a/OpenSim/Framework/OpenJpeg/j2k.cs b/OpenSim/Framework/OpenJpeg/j2k.cs
index f655364..8751792 100644
--- a/OpenSim/Framework/OpenJpeg/j2k.cs
+++ b/OpenSim/Framework/OpenJpeg/j2k.cs
@@ -1,125 +1,149 @@
1using System; 1/*
2using System.Collections.Generic; 2 * Copyright (c) Contributors, http://opensimulator.org/
3using System.Text; 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 4 *
5namespace OpenSim.Framework.OpenJpeg 5 * Redistribution and use in source and binary forms, with or without
6{ 6 * modification, are permitted provided that the following conditions are met:
7 7 * * Redistributions of source code must retain the above copyright
8 public static class j2k 8 * notice, this list of conditions and the following disclaimer.
9 { 9 * * Redistributions in binary form must reproduce the above copyright
10 } 10 * notice, this list of conditions and the following disclaimer in the
11 11 * documentation and/or other materials provided with the distribution.
12 public enum J2K_STATUS 12 * * Neither the name of the OpenSimulator Project nor the
13 { 13 * names of its contributors may be used to endorse or promote products
14 J2K_STATE_MHSOC = 0x0001, /**< a SOC marker is expected */ 14 * derived from this software without specific prior written permission.
15 J2K_STATE_MHSIZ = 0x0002, /**< a SIZ marker is expected */ 15 *
16 J2K_STATE_MH = 0x0004, /**< the decoding process is in the main header */ 16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 J2K_STATE_TPHSOT = 0x0008, /**< the decoding process is in a tile part header and expects a SOT marker */ 17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 J2K_STATE_TPH = 0x0010, /**< the decoding process is in a tile part header */ 18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 J2K_STATE_MT = 0x0020, /**< the EOC marker has just been read */ 19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 J2K_STATE_NEOC = 0x0040, /**< the decoding process must not expect a EOC marker because the codestream is truncated */ 20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 J2K_STATE_ERR = 0x0080 /**< the decoding process has encountered an error */ 21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 } 22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 public enum J2K_T2_MODE 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 { 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 THRESH_CALC = 0, /** Function called in Rate allocation process*/ 26 */
27 FINAL_PASS = 1 /** Function called in Tier 2 process*/ 27
28 } 28using System;
29 29using System.Collections.Generic;
30 public struct opj_stepsize 30using System.Text;
31 { 31
32 public int expn; 32namespace OpenSim.Framework.OpenJpeg
33 public int mant; 33{
34 } 34 public static class j2k
35 35 {
36 public struct opj_tccp 36 }
37 { 37
38 public int csty; 38 public enum J2K_STATUS
39 public int numresolutions; 39 {
40 public int cblkw; 40 J2K_STATE_MHSOC = 0x0001, /**< a SOC marker is expected */
41 public int cblkh; 41 J2K_STATE_MHSIZ = 0x0002, /**< a SIZ marker is expected */
42 public int cblksty; 42 J2K_STATE_MH = 0x0004, /**< the decoding process is in the main header */
43 public int qmfbid; 43 J2K_STATE_TPHSOT = 0x0008, /**< the decoding process is in a tile part header and expects a SOT marker */
44 public int qntsty; 44 J2K_STATE_TPH = 0x0010, /**< the decoding process is in a tile part header */
45 /// <summary> 45 J2K_STATE_MT = 0x0020, /**< the EOC marker has just been read */
46 /// don't forget to initialize 97 elements 46 J2K_STATE_NEOC = 0x0040, /**< the decoding process must not expect a EOC marker because the codestream is truncated */
47 /// </summary> 47 J2K_STATE_ERR = 0x0080 /**< the decoding process has encountered an error */
48 public opj_stepsize[] stepsizes; 48 }
49 public int numgbits; 49
50 public int roishift; 50 public enum J2K_T2_MODE
51 /// <summary> 51 {
52 /// Don't forget to initialize 33 elements 52 THRESH_CALC = 0, /** Function called in Rate allocation process*/
53 /// </summary> 53 FINAL_PASS = 1 /** Function called in Tier 2 process*/
54 public int[] prcw; 54 }
55 55
56 } 56 public struct opj_stepsize
57 57 {
58 public struct opj_tcp 58 public int expn;
59 { 59 public int mant;
60 public int first; 60 }
61 public int csty; 61
62 public PROG_ORDER prg; 62 public struct opj_tccp
63 public int numlayers; 63 {
64 public int mct; 64 public int csty;
65 /// <summary> 65 public int numresolutions;
66 /// don't forget to initialize to 100 66 public int cblkw;
67 /// </summary> 67 public int cblkh;
68 public float[] rates; 68 public int cblksty;
69 public int numpocs; 69 public int qmfbid;
70 public int POC; 70 public int qntsty;
71 /// <summary> 71 /// <summary>
72 /// Don't forget to initialize to 32 72 /// don't forget to initialize 97 elements
73 /// </summary> 73 /// </summary>
74 public opj_poc[] pocs; 74 public opj_stepsize[] stepsizes;
75 public byte ppt_data; 75 public int numgbits;
76 public byte ppt_data_first; 76 public int roishift;
77 public int ppt; 77 /// <summary>
78 public int ppt_store; 78 /// Don't forget to initialize 33 elements
79 public int ppt_len; 79 /// </summary>
80 /// <summary> 80 public int[] prcw;
81 /// Don't forget to initialize 100 elements 81 }
82 /// </summary> 82
83 public float[] distoratio; 83 public struct opj_tcp
84 public opj_tccp tccps; 84 {
85 85 public int first;
86 } 86 public int csty;
87 87 public PROG_ORDER prg;
88 public struct opj_cp 88 public int numlayers;
89 { 89 public int mct;
90 public CINEMA_MODE cinema; 90 /// <summary>
91 public int max_comp_size; 91 /// don't forget to initialize to 100
92 public int img_size; 92 /// </summary>
93 public RSIZ_CAPABILITIES rsiz; 93 public float[] rates;
94 public sbyte tp_on; 94 public int numpocs;
95 public sbyte tp_flag; 95 public int POC;
96 public int tp_pos; 96 /// <summary>
97 public int distro_alloc; 97 /// Don't forget to initialize to 32
98 public int fixed_alloc; 98 /// </summary>
99 public int fixed_quality; 99 public opj_poc[] pocs;
100 public int reduce; 100 public byte ppt_data;
101 public int layer; 101 public byte ppt_data_first;
102 public LIMIT_DECODING limit_decoding; 102 public int ppt;
103 public int tx0; 103 public int ppt_store;
104 public int ty0; 104 public int ppt_len;
105 public int tdx; 105 /// <summary>
106 public int tdy; 106 /// Don't forget to initialize 100 elements
107 public sbyte? comment; 107 /// </summary>
108 public int tw; 108 public float[] distoratio;
109 public int th; 109 public opj_tccp tccps;
110 public int? tileno; 110 }
111 public byte ppm_data; 111
112 public byte ppm_data_first; 112 public struct opj_cp
113 public int ppm; 113 {
114 public int ppm_store; 114 public CINEMA_MODE cinema;
115 public int ppm_previous; 115 public int max_comp_size;
116 public int ppm_len; 116 public int img_size;
117 public opj_tcp tcps; 117 public RSIZ_CAPABILITIES rsiz;
118 public int matrice; 118 public sbyte tp_on;
119 } 119 public sbyte tp_flag;
120 120 public int tp_pos;
121 public static class j2kdefines 121 public int distro_alloc;
122 { 122 public int fixed_alloc;
123 public int fixed_quality;
124 public int reduce;
125 public int layer;
126 public LIMIT_DECODING limit_decoding;
127 public int tx0;
128 public int ty0;
129 public int tdx;
130 public int tdy;
131 public sbyte? comment;
132 public int tw;
133 public int th;
134 public int? tileno;
135 public byte ppm_data;
136 public byte ppm_data_first;
137 public int ppm;
138 public int ppm_store;
139 public int ppm_previous;
140 public int ppm_len;
141 public opj_tcp tcps;
142 public int matrice;
143 }
144
145 public static class j2kdefines
146 {
123 public const uint J2K_CP_CSTY_PRT = 0x01; 147 public const uint J2K_CP_CSTY_PRT = 0x01;
124 public const uint J2K_CP_CSTY_SOP = 0x02; 148 public const uint J2K_CP_CSTY_SOP = 0x02;
125 public const uint J2K_CP_CSTY_EPH = 0x04; 149 public const uint J2K_CP_CSTY_EPH = 0x04;
@@ -131,28 +155,28 @@ namespace OpenSim.Framework.OpenJpeg
131 public const uint J2K_CCP_CBLKSTY_PTERM =0x10; 155 public const uint J2K_CCP_CBLKSTY_PTERM =0x10;
132 public const uint J2K_CCP_CBLKSTY_SEGSYM = 0x20; 156 public const uint J2K_CCP_CBLKSTY_SEGSYM = 0x20;
133 public const uint J2K_CCP_QNTSTY_NOQNT = 0; 157 public const uint J2K_CCP_QNTSTY_NOQNT = 0;
134 public const uint J2K_CCP_QNTSTY_SIQNT = 1; 158 public const uint J2K_CCP_QNTSTY_SIQNT = 1;
135 public const uint J2K_CCP_QNTSTY_SEQNT = 2; 159 public const uint J2K_CCP_QNTSTY_SEQNT = 2;
136 160
137 public const uint J2K_MS_SOC = 0xff4f; /**< SOC marker value */ 161 public const uint J2K_MS_SOC = 0xff4f; /**< SOC marker value */
138 public const uint J2K_MS_SOT = 0xff90; /**< SOT marker value */ 162 public const uint J2K_MS_SOT = 0xff90; /**< SOT marker value */
139 public const uint J2K_MS_SOD = 0xff93; /**< SOD marker value */ 163 public const uint J2K_MS_SOD = 0xff93; /**< SOD marker value */
140 public const uint J2K_MS_EOC = 0xffd9; /**< EOC marker value */ 164 public const uint J2K_MS_EOC = 0xffd9; /**< EOC marker value */
141 public const uint J2K_MS_SIZ = 0xff51; /**< SIZ marker value */ 165 public const uint J2K_MS_SIZ = 0xff51; /**< SIZ marker value */
142 public const uint J2K_MS_COD = 0xff52; /**< COD marker value */ 166 public const uint J2K_MS_COD = 0xff52; /**< COD marker value */
143 public const uint J2K_MS_COC = 0xff53; /**< COC marker value */ 167 public const uint J2K_MS_COC = 0xff53; /**< COC marker value */
144 public const uint J2K_MS_RGN = 0xff5e; /**< RGN marker value */ 168 public const uint J2K_MS_RGN = 0xff5e; /**< RGN marker value */
145 public const uint J2K_MS_QCD = 0xff5c; /**< QCD marker value */ 169 public const uint J2K_MS_QCD = 0xff5c; /**< QCD marker value */
146 public const uint J2K_MS_QCC = 0xff5d; /**< QCC marker value */ 170 public const uint J2K_MS_QCC = 0xff5d; /**< QCC marker value */
147 public const uint J2K_MS_POC = 0xff5f; /**< POC marker value */ 171 public const uint J2K_MS_POC = 0xff5f; /**< POC marker value */
148 public const uint J2K_MS_TLM = 0xff55; /**< TLM marker value */ 172 public const uint J2K_MS_TLM = 0xff55; /**< TLM marker value */
149 public const uint J2K_MS_PLM = 0xff57; /**< PLM marker value */ 173 public const uint J2K_MS_PLM = 0xff57; /**< PLM marker value */
150 public const uint J2K_MS_PLT = 0xff58; /**< PLT marker value */ 174 public const uint J2K_MS_PLT = 0xff58; /**< PLT marker value */
151 public const uint J2K_MS_PPM = 0xff60; /**< PPM marker value */ 175 public const uint J2K_MS_PPM = 0xff60; /**< PPM marker value */
152 public const uint J2K_MS_PPT = 0xff61; /**< PPT marker value */ 176 public const uint J2K_MS_PPT = 0xff61; /**< PPT marker value */
153 public const uint J2K_MS_SOP = 0xff91; /**< SOP marker value */ 177 public const uint J2K_MS_SOP = 0xff91; /**< SOP marker value */
154 public const uint J2K_MS_EPH = 0xff92; /**< EPH marker value */ 178 public const uint J2K_MS_EPH = 0xff92; /**< EPH marker value */
155 public const uint J2K_MS_CRG = 0xff63; /**< CRG marker value */ 179 public const uint J2K_MS_CRG = 0xff63; /**< CRG marker value */
156 public const uint J2K_MS_COM = 0xff64; /**< COM marker value */ 180 public const uint J2K_MS_COM = 0xff64; /**< COM marker value */
157 } 181 }
158} 182}
diff --git a/OpenSim/Framework/OpenJpeg/openjpeg.cs b/OpenSim/Framework/OpenJpeg/openjpeg.cs
index 2d5e4b5..f0b2518 100644
--- a/OpenSim/Framework/OpenJpeg/openjpeg.cs
+++ b/OpenSim/Framework/OpenJpeg/openjpeg.cs
@@ -1,358 +1,375 @@
1using System; 1/*
2using System.Collections.Generic; 2 * Copyright (c) Contributors, http://opensimulator.org/
3using System.Text; 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 4 *
5namespace OpenSim.Framework.OpenJpeg 5 * Redistribution and use in source and binary forms, with or without
6{ 6 * modification, are permitted provided that the following conditions are met:
7 public class openjpeg 7 * * Redistributions of source code must retain the above copyright
8 { 8 * notice, this list of conditions and the following disclaimer.
9 public openjpeg() 9 * * Redistributions in binary form must reproduce the above copyright
10 { 10 * notice, this list of conditions and the following disclaimer in the
11 11 * documentation and/or other materials provided with the distribution.
12 12 * * Neither the name of the OpenSimulator Project nor the
13 } 13 * names of its contributors may be used to endorse or promote products
14 } 14 * derived from this software without specific prior written permission.
15 15 *
16 public enum PROG_ORDER 16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 { 17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 PROG_UNKNOWN = -1, 18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 LRCP = 0, 19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 RLCP = 1, 20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 RPCL = 2, 21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 PCRL = 3, 22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 CPRL = 4 23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 } 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 public enum RSIZ_CAPABILITIES 26 */
27 { 27
28 STD_RSIZ = 0, 28using System;
29 CINEMA2K = 3, 29using System.Collections.Generic;
30 CINEMA4K = 4 30using System.Text;
31 } 31
32 32namespace OpenSim.Framework.OpenJpeg
33 public enum CINEMA_MODE 33{
34 { 34 public class openjpeg
35 OFF = 0, 35 {
36 CINEMA2K_24 = 1, 36 public openjpeg()
37 CINEMA2K_48 = 2, 37 {
38 CINEMA4K_24 = 3 38 }
39 } 39 }
40 40
41 public enum COLOR_SPACE 41 public enum PROG_ORDER
42 { 42 {
43 CLRSPC_UNKNOWN = -1, 43 PROG_UNKNOWN = -1,
44 CLRSPC_SRGB = 1, 44 LRCP = 0,
45 CLRSPC_GRAY = 2, 45 RLCP = 1,
46 CLRSPC_SYCC = 3 46 RPCL = 2,
47 } 47 PCRL = 3,
48 48 CPRL = 4
49 public enum CODEC_FORMAT 49 }
50 { 50
51 CODEC_UNKNOWN = -1, 51 public enum RSIZ_CAPABILITIES
52 CODEC_J2K = 0, 52 {
53 CODEC_JPT = 1, 53 STD_RSIZ = 0,
54 CODEC_JP2 = 2 54 CINEMA2K = 3,
55 } 55 CINEMA4K = 4
56 56 }
57 public enum LIMIT_DECODING 57
58 { 58 public enum CINEMA_MODE
59 NO_LIMITATION = 0, 59 {
60 LIMIT_TO_MAIN_HEADER=1, 60 OFF = 0,
61 DECODE_ALL_BUT_PACKETS = 2 61 CINEMA2K_24 = 1,
62 } 62 CINEMA2K_48 = 2,
63 63 CINEMA4K_24 = 3
64 public struct opj_poc 64 }
65 { 65
66 public int resno0, compno0; 66 public enum COLOR_SPACE
67 public int layno1, resno1, compno1; 67 {
68 public int layno0, precno0, precno1; 68 CLRSPC_UNKNOWN = -1,
69 public PROG_ORDER prg1, prg; 69 CLRSPC_SRGB = 1,
70 /// <summary> 70 CLRSPC_GRAY = 2,
71 /// Don't forget to initialize with 5 elements 71 CLRSPC_SYCC = 3
72 /// </summary> 72 }
73 public sbyte[] progorder; 73
74 public int tile; 74 public enum CODEC_FORMAT
75 public int tx0, tx1, ty0, ty1; 75 {
76 public int layS, resS, copmS, prcS; 76 CODEC_UNKNOWN = -1,
77 public int layE, resE, compE, prcE; 77 CODEC_J2K = 0,
78 public int txS, txE, tyS, tyE, dx, dy; 78 CODEC_JPT = 1,
79 public int lay_t, res_t, comp_t, prc_t, tx0_t, ty0_t; 79 CODEC_JP2 = 2
80 } 80 }
81 81
82 public struct opj_cparameters 82 public enum LIMIT_DECODING
83 { 83 {
84 public bool tile_size_on; 84 NO_LIMITATION = 0,
85 public int cp_tx0; 85 LIMIT_TO_MAIN_HEADER=1,
86 public int cp_ty0; 86 DECODE_ALL_BUT_PACKETS = 2
87 public int cp_tdx; 87 }
88 public int cp_tdy; 88
89 public int cp_disto_alloc; 89 public struct opj_poc
90 public int cp_fixed_alloc; 90 {
91 public int cp_fixed_wuality; 91 public int resno0, compno0;
92 public int cp_matrice; 92 public int layno1, resno1, compno1;
93 public sbyte cp_comment; 93 public int layno0, precno0, precno1;
94 public int csty; 94 public PROG_ORDER prg1, prg;
95 public PROG_ORDER prog_order; 95 /// <summary>
96 96 /// Don't forget to initialize with 5 elements
97 /// <summary> 97 /// </summary>
98 /// Don't forget to initialize 32 elements 98 public sbyte[] progorder;
99 /// </summary> 99 public int tile;
100 public opj_poc[] POC; 100 public int tx0, tx1, ty0, ty1;
101 public int numpocs; 101 public int layS, resS, copmS, prcS;
102 public int tcp_numlayers; 102 public int layE, resE, compE, prcE;
103 /// <summary> 103 public int txS, txE, tyS, tyE, dx, dy;
104 /// Don't forget to intitialize 100 elements 104 public int lay_t, res_t, comp_t, prc_t, tx0_t, ty0_t;
105 /// </summary> 105 }
106 public float[] tcp_rates; 106
107 /// <summary> 107 public struct opj_cparameters
108 /// Don't forget to initialize 100 elements 108 {
109 /// </summary> 109 public bool tile_size_on;
110 public float[] tcp_distoratio; 110 public int cp_tx0;
111 public int numresolution; 111 public int cp_ty0;
112 public int cblockw_init; 112 public int cp_tdx;
113 public int cblockh_init; 113 public int cp_tdy;
114 public int mode; 114 public int cp_disto_alloc;
115 public int irreversible; 115 public int cp_fixed_alloc;
116 public int roi_compno; 116 public int cp_fixed_wuality;
117 public int roi_shift; 117 public int cp_matrice;
118 public int res_spec; 118 public sbyte cp_comment;
119 119 public int csty;
120 /// <summary> 120 public PROG_ORDER prog_order;
121 /// Don't forget to initialize 33 elements 121
122 /// </summary> 122 /// <summary>
123 public int[] prc_init; 123 /// Don't forget to initialize 32 elements
124 /// <summary> 124 /// </summary>
125 /// Don't forget to initialize 33 elements 125 public opj_poc[] POC;
126 /// </summary> 126 public int numpocs;
127 public int[] prch_init; 127 public int tcp_numlayers;
128 128 /// <summary>
129 public string infile; 129 /// Don't forget to intitialize 100 elements
130 public string outfile; 130 /// </summary>
131 public int index_on; 131 public float[] tcp_rates;
132 public string index; 132 /// <summary>
133 public int image_offset_x0; 133 /// Don't forget to initialize 100 elements
134 public int image_offset_y0; 134 /// </summary>
135 public int subsampling_dx; 135 public float[] tcp_distoratio;
136 public int subsampling_dy; 136 public int numresolution;
137 public int decod_format; 137 public int cblockw_init;
138 public int cod_format; 138 public int cblockh_init;
139 public bool jpwl_epc_on; 139 public int mode;
140 public int jpwl_hprot_MH; 140 public int irreversible;
141 /// <summary> 141 public int roi_compno;
142 /// Don't forget to initialize 16 elements 142 public int roi_shift;
143 /// </summary> 143 public int res_spec;
144 public int[] jpwl_hprot_TPH_tileno; 144
145 /// <summary> 145 /// <summary>
146 /// Don't forget to initialize 16 elements 146 /// Don't forget to initialize 33 elements
147 /// </summary> 147 /// </summary>
148 public int[] jpwl_hprot_TPH; 148 public int[] prc_init;
149 149 /// <summary>
150 /// <summary> 150 /// Don't forget to initialize 33 elements
151 /// Don't forget to initialize 16 elements 151 /// </summary>
152 /// </summary> 152 public int[] prch_init;
153 public int[] jpwl_pprot_tileno; 153
154 public int[] jpwl_pprot_packno; 154 public string infile;
155 public int[] jpwl_pprot; 155 public string outfile;
156 public int jpwl_sens_size; 156 public int index_on;
157 public int jpwl_sense_addr; 157 public string index;
158 public int jpwl_sens_range; 158 public int image_offset_x0;
159 public int jpwl_sens_MH; 159 public int image_offset_y0;
160 160 public int subsampling_dx;
161 /// <summary> 161 public int subsampling_dy;
162 /// Don't forget to initialize 16 elements 162 public int decod_format;
163 /// </summary> 163 public int cod_format;
164 public int[] jpwl_sens_TPH_tileno; 164 public bool jpwl_epc_on;
165 165 public int jpwl_hprot_MH;
166 /// <summary> 166 /// <summary>
167 /// Don't forget to initialize 16 elements 167 /// Don't forget to initialize 16 elements
168 /// </summary> 168 /// </summary>
169 public int[] jpwl_sens_TPH; 169 public int[] jpwl_hprot_TPH_tileno;
170 public CINEMA_MODE cp_cinema; 170 /// <summary>
171 public int max_comp_size; 171 /// Don't forget to initialize 16 elements
172 public sbyte tp_on; 172 /// </summary>
173 public sbyte tp_flag; 173 public int[] jpwl_hprot_TPH;
174 public sbyte tcp_mct; 174
175 } 175 /// <summary>
176 176 /// Don't forget to initialize 16 elements
177 public struct opj_dparameters 177 /// </summary>
178 { 178 public int[] jpwl_pprot_tileno;
179 public int cp_reduce; 179 public int[] jpwl_pprot_packno;
180 public int cp_layer; 180 public int[] jpwl_pprot;
181 public string infile; 181 public int jpwl_sens_size;
182 public string outfile; 182 public int jpwl_sense_addr;
183 public int decod_format; 183 public int jpwl_sens_range;
184 public int cod_format; 184 public int jpwl_sens_MH;
185 public bool jpwl_correct; 185
186 public int jpwl_exp_comps; 186 /// <summary>
187 public int jpwl_max_tiles; 187 /// Don't forget to initialize 16 elements
188 public LIMIT_DECODING cp_limit_decoding; 188 /// </summary>
189 189 public int[] jpwl_sens_TPH_tileno;
190 } 190
191 191 /// <summary>
192 public struct opj_common_fields 192 /// Don't forget to initialize 16 elements
193 { 193 /// </summary>
194 public bool is_decompressor; 194 public int[] jpwl_sens_TPH;
195 public CODEC_FORMAT codec_format; 195 public CINEMA_MODE cp_cinema;
196 } 196 public int max_comp_size;
197 197 public sbyte tp_on;
198 public struct opj_common_struct 198 public sbyte tp_flag;
199 { 199 public sbyte tcp_mct;
200 public opj_common_fields flds; 200 }
201 } 201
202 202 public struct opj_dparameters
203 public struct opj_cinfo 203 {
204 { 204 public int cp_reduce;
205 public opj_common_fields flds; 205 public int cp_layer;
206 } 206 public string infile;
207 public struct opj_dinfo 207 public string outfile;
208 { 208 public int decod_format;
209 public opj_common_fields flds; 209 public int cod_format;
210 } 210 public bool jpwl_correct;
211 211 public int jpwl_exp_comps;
212 public struct opj_cio 212 public int jpwl_max_tiles;
213 { 213 public LIMIT_DECODING cp_limit_decoding;
214 public opj_common_struct cinfo; 214 }
215 public int openmode; 215
216 public byte buffer; 216 public struct opj_common_fields
217 public int length; 217 {
218 public byte start; 218 public bool is_decompressor;
219 public byte end; 219 public CODEC_FORMAT codec_format;
220 public byte bp; 220 }
221 } 221
222 222 public struct opj_common_struct
223 public struct opj_image_comp 223 {
224 { 224 public opj_common_fields flds;
225 public int dx; 225 }
226 public int dy; 226
227 public int w; 227 public struct opj_cinfo
228 public int h; 228 {
229 public int x0; 229 public opj_common_fields flds;
230 public int y0; 230 }
231 public int prec; 231
232 public int bpp; 232 public struct opj_dinfo
233 public int sgnd; 233 {
234 public int resno_decoded; 234 public opj_common_fields flds;
235 public int factor; 235 }
236 public int data; 236
237 } 237 public struct opj_cio
238 238 {
239 public struct opj_image 239 public opj_common_struct cinfo;
240 { 240 public int openmode;
241 public int x0; 241 public byte buffer;
242 public int y0; 242 public int length;
243 public int x1; 243 public byte start;
244 public int y1; 244 public byte end;
245 public int numcomps; 245 public byte bp;
246 public COLOR_SPACE color_space; 246 }
247 public opj_image_comp comps; 247
248 } 248 public struct opj_image_comp
249 249 {
250 public struct opj_image_comptparm 250 public int dx;
251 { 251 public int dy;
252 public int dx; 252 public int w;
253 public int dy; 253 public int h;
254 public int w; 254 public int x0;
255 public int h; 255 public int y0;
256 public int x0; 256 public int prec;
257 public int y0; 257 public int bpp;
258 public int prec; 258 public int sgnd;
259 public int bpp; 259 public int resno_decoded;
260 public int sgnd; 260 public int factor;
261 } 261 public int data;
262 262 }
263 public struct opj_packet_info 263
264 { 264 public struct opj_image
265 public int start_pos; 265 {
266 public int end_ph_pos; 266 public int x0;
267 public int end_pos; 267 public int y0;
268 public double disto; 268 public int x1;
269 } 269 public int y1;
270 270 public int numcomps;
271 public struct opj_tp_info 271 public COLOR_SPACE color_space;
272 { 272 public opj_image_comp comps;
273 public int tp_start_pos; 273 }
274 public int tp_end_header; 274
275 public int tp_end_pos; 275 public struct opj_image_comptparm
276 public int tp_start_pack; 276 {
277 public int tp_numpacks; 277 public int dx;
278 } 278 public int dy;
279 279 public int w;
280 public struct opj_tile_info 280 public int h;
281 { 281 public int x0;
282 public double thresh; 282 public int y0;
283 public int tileno; 283 public int prec;
284 public int start_pos; 284 public int bpp;
285 public int end_header; 285 public int sgnd;
286 public int end_pos; 286 }
287 /// <summary> 287
288 /// Don't forget to initialize 33 elements 288 public struct opj_packet_info
289 /// </summary> 289 {
290 public int[] pw; 290 public int start_pos;
291 /// <summary> 291 public int end_ph_pos;
292 /// Don't forget to initialize 33 elements 292 public int end_pos;
293 /// </summary> 293 public double disto;
294 public int[] ph; 294 }
295 /// <summary> 295
296 /// Don't forget to initialize 33 elements 296 public struct opj_tp_info
297 /// </summary> 297 {
298 public int[] pdx; 298 public int tp_start_pos;
299 /// <summary> 299 public int tp_end_header;
300 /// Don't forget to initialize 33 elements 300 public int tp_end_pos;
301 /// </summary> 301 public int tp_start_pack;
302 public int[] pdy; 302 public int tp_numpacks;
303 303 }
304 public opj_packet_info packet; 304
305 public int numpix; 305 public struct opj_tile_info
306 public double distotile; 306 {
307 public int num_tps; 307 public double thresh;
308 public opj_tp_info tp; 308 public int tileno;
309 } 309 public int start_pos;
310 310 public int end_header;
311 public struct opj_marker_info_t 311 public int end_pos;
312 { 312 /// <summary>
313 public ushort type; 313 /// Don't forget to initialize 33 elements
314 public int pos; 314 /// </summary>
315 public int len; 315 public int[] pw;
316 } 316 /// <summary>
317 317 /// Don't forget to initialize 33 elements
318 public struct opj_codestream_info 318 /// </summary>
319 { 319 public int[] ph;
320 public double D_max; 320 /// <summary>
321 public int packno; 321 /// Don't forget to initialize 33 elements
322 public int index_write; 322 /// </summary>
323 public int image_w; 323 public int[] pdx;
324 public int image_h; 324 /// <summary>
325 325 /// Don't forget to initialize 33 elements
326 public PROG_ORDER prog; 326 /// </summary>
327 327 public int[] pdy;
328 public int tile_x; 328
329 public int tile_y; 329 public opj_packet_info packet;
330 public int tile_Ox; 330 public int numpix;
331 public int tile_Oy; 331 public double distotile;
332 public int tw; 332 public int num_tps;
333 public int numcomps; 333 public opj_tp_info tp;
334 public int numlayers; 334 }
335 public int numdecompos; 335
336 public int marknum; 336 public struct opj_marker_info_t
337 public opj_marker_info_t marker; 337 {
338 public int maxmarknum; 338 public ushort type;
339 public int main_head_start; 339 public int pos;
340 public int main_head_end; 340 public int len;
341 public int codestream_size; 341 }
342 public opj_tile_info tile; 342
343 343 public struct opj_codestream_info
344 } 344 {
345 345 public double D_max;
346 346 public int packno;
347 347 public int index_write;
348 348 public int image_w;
349 349 public int image_h;
350 350
351 public static class opj_defines 351 public PROG_ORDER prog;
352 { 352
353 public const int OPJ_STREAM_READ = 0x0001; 353 public int tile_x;
354 public const int OPJ_STREAM_WRITE = 0x0002; 354 public int tile_y;
355 355 public int tile_Ox;
356 } 356 public int tile_Oy;
357 357 public int tw;
358} 358 public int numcomps;
359 public int numlayers;
360 public int numdecompos;
361 public int marknum;
362 public opj_marker_info_t marker;
363 public int maxmarknum;
364 public int main_head_start;
365 public int main_head_end;
366 public int codestream_size;
367 public opj_tile_info tile;
368 }
369
370 public static class opj_defines
371 {
372 public const int OPJ_STREAM_READ = 0x0001;
373 public const int OPJ_STREAM_WRITE = 0x0002;
374 }
375}
diff --git a/OpenSim/Framework/OpenJpeg/pi.cs b/OpenSim/Framework/OpenJpeg/pi.cs
index f7e211f..7da7d71 100644
--- a/OpenSim/Framework/OpenJpeg/pi.cs
+++ b/OpenSim/Framework/OpenJpeg/pi.cs
@@ -1,48 +1,71 @@
1using System; 1/*
2using System.Collections.Generic; 2 * Copyright (c) Contributors, http://opensimulator.org/
3using System.Text; 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 4 *
5namespace OpenSim.Framework.OpenJpeg 5 * Redistribution and use in source and binary forms, with or without
6{ 6 * modification, are permitted provided that the following conditions are met:
7 public static class pi 7 * * Redistributions of source code must retain the above copyright
8 { 8 * notice, this list of conditions and the following disclaimer.
9 } 9 * * Redistributions in binary form must reproduce the above copyright
10 10 * notice, this list of conditions and the following disclaimer in the
11 public struct opj_pi_resolution 11 * documentation and/or other materials provided with the distribution.
12 { 12 * * Neither the name of the OpenSimulator Project nor the
13 public int pdx, pdy; 13 * names of its contributors may be used to endorse or promote products
14 public int pw, ph; 14 * derived from this software without specific prior written permission.
15 } 15 *
16 16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 public struct opj_pi_comp 17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 { 18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 public int dx, dy; 19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 public int numresolutions; 20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 public opj_pi_resolution resolutions; 21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 } 22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 public struct obj_pi_iterator 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 { 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 public sbyte tp_on; 26 */
27 public short include; 27
28 public int step_l; 28using System;
29 public int step_r; 29using System.Collections.Generic;
30 public int step_c; 30using System.Text;
31 public int step_p; 31
32 public int compno; 32namespace OpenSim.Framework.OpenJpeg
33 public int resno; 33{
34 public int precno; 34 public static class pi
35 public int layno; 35 {
36 public int first; 36 }
37 public opj_poc poc; 37
38 public int numcomps; 38 public struct opj_pi_resolution
39 public opj_pi_comp comps; 39 {
40 40 public int pdx, pdy;
41 public int tx0, ty0, tx1, ty1; 41 public int pw, ph;
42 public int x, y, dx, dy; 42 }
43 } 43
44 44 public struct opj_pi_comp
45 45 {
46 46 public int dx, dy;
47 47 public int numresolutions;
48} 48 public opj_pi_resolution resolutions;
49 }
50
51 public struct obj_pi_iterator
52 {
53 public sbyte tp_on;
54 public short include;
55 public int step_l;
56 public int step_r;
57 public int step_c;
58 public int step_p;
59 public int compno;
60 public int resno;
61 public int precno;
62 public int layno;
63 public int first;
64 public opj_poc poc;
65 public int numcomps;
66 public opj_pi_comp comps;
67
68 public int tx0, ty0, tx1, ty1;
69 public int x, y, dx, dy;
70 }
71}
diff --git a/OpenSim/Grid/UserServer/OpenIdService.cs b/OpenSim/Grid/UserServer/OpenIdService.cs
index 695968f..78e820e 100644
--- a/OpenSim/Grid/UserServer/OpenIdService.cs
+++ b/OpenSim/Grid/UserServer/OpenIdService.cs
@@ -1,339 +1,339 @@
1/* 1/*
2 * Copyright (c) Contributors, http://opensimulator.org/ 2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders. 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright 7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright 9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution. 11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSim Project nor the 12 * * Neither the name of the OpenSim Project nor the
13 * names of its contributors may be used to endorse or promote products 13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission. 14 * derived from this software without specific prior written permission.
15 * 15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY 16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Collections.Specialized; 30using System.Collections.Specialized;
31using System.IO; 31using System.IO;
32using System.Net; 32using System.Net;
33using System.Web; 33using System.Web;
34using System.Text; 34using System.Text;
35using DotNetOpenId; 35using DotNetOpenId;
36using DotNetOpenId.Provider; 36using DotNetOpenId.Provider;
37using log4net; 37using log4net;
38using OpenSim.Framework; 38using OpenSim.Framework;
39using OpenSim.Framework.Servers; 39using OpenSim.Framework.Servers;
40 40
41namespace OpenSim.Grid.UserServer 41namespace OpenSim.Grid.UserServer
42{ 42{
43 /// <summary> 43 /// <summary>
44 /// Temporary, in-memory store for OpenID associations 44 /// Temporary, in-memory store for OpenID associations
45 /// </summary> 45 /// </summary>
46 public class ProviderMemoryStore : IAssociationStore<AssociationRelyingPartyType> 46 public class ProviderMemoryStore : IAssociationStore<AssociationRelyingPartyType>
47 { 47 {
48 private class AssociationItem 48 private class AssociationItem
49 { 49 {
50 public AssociationRelyingPartyType DistinguishingFactor; 50 public AssociationRelyingPartyType DistinguishingFactor;
51 public string Handle; 51 public string Handle;
52 public DateTime Expires; 52 public DateTime Expires;
53 public byte[] PrivateData; 53 public byte[] PrivateData;
54 } 54 }
55 55
56 Dictionary<string, AssociationItem> m_store = new Dictionary<string, AssociationItem>(); 56 Dictionary<string, AssociationItem> m_store = new Dictionary<string, AssociationItem>();
57 SortedList<DateTime, AssociationItem> m_sortedStore = new SortedList<DateTime, AssociationItem>(); 57 SortedList<DateTime, AssociationItem> m_sortedStore = new SortedList<DateTime, AssociationItem>();
58 object m_syncRoot = new object(); 58 object m_syncRoot = new object();
59 59
60 #region IAssociationStore<AssociationRelyingPartyType> Members 60 #region IAssociationStore<AssociationRelyingPartyType> Members
61 61
62 public void StoreAssociation(AssociationRelyingPartyType distinguishingFactor, Association assoc) 62 public void StoreAssociation(AssociationRelyingPartyType distinguishingFactor, Association assoc)
63 { 63 {
64 AssociationItem item = new AssociationItem(); 64 AssociationItem item = new AssociationItem();
65 item.DistinguishingFactor = distinguishingFactor; 65 item.DistinguishingFactor = distinguishingFactor;
66 item.Handle = assoc.Handle; 66 item.Handle = assoc.Handle;
67 item.Expires = assoc.Expires.ToLocalTime(); 67 item.Expires = assoc.Expires.ToLocalTime();
68 item.PrivateData = assoc.SerializePrivateData(); 68 item.PrivateData = assoc.SerializePrivateData();
69 69
70 lock (m_syncRoot) 70 lock (m_syncRoot)
71 { 71 {
72 m_store[item.Handle] = item; 72 m_store[item.Handle] = item;
73 m_sortedStore[item.Expires] = item; 73 m_sortedStore[item.Expires] = item;
74 } 74 }
75 } 75 }
76 76
77 public Association GetAssociation(AssociationRelyingPartyType distinguishingFactor) 77 public Association GetAssociation(AssociationRelyingPartyType distinguishingFactor)
78 { 78 {
79 lock (m_syncRoot) 79 lock (m_syncRoot)
80 { 80 {
81 if (m_sortedStore.Count > 0) 81 if (m_sortedStore.Count > 0)
82 { 82 {
83 AssociationItem item = m_sortedStore.Values[m_sortedStore.Count - 1]; 83 AssociationItem item = m_sortedStore.Values[m_sortedStore.Count - 1];
84 return Association.Deserialize(item.Handle, item.Expires.ToUniversalTime(), item.PrivateData); 84 return Association.Deserialize(item.Handle, item.Expires.ToUniversalTime(), item.PrivateData);
85 } 85 }
86 else 86 else
87 { 87 {
88 return null; 88 return null;
89 } 89 }
90 } 90 }
91 } 91 }
92 92
93 public Association GetAssociation(AssociationRelyingPartyType distinguishingFactor, string handle) 93 public Association GetAssociation(AssociationRelyingPartyType distinguishingFactor, string handle)
94 { 94 {
95 AssociationItem item; 95 AssociationItem item;
96 bool success = false; 96 bool success = false;
97 lock (m_syncRoot) 97 lock (m_syncRoot)
98 success = m_store.TryGetValue(handle, out item); 98 success = m_store.TryGetValue(handle, out item);
99 99
100 if (success) 100 if (success)
101 return Association.Deserialize(item.Handle, item.Expires.ToUniversalTime(), item.PrivateData); 101 return Association.Deserialize(item.Handle, item.Expires.ToUniversalTime(), item.PrivateData);
102 else 102 else
103 return null; 103 return null;
104 } 104 }
105 105
106 public bool RemoveAssociation(AssociationRelyingPartyType distinguishingFactor, string handle) 106 public bool RemoveAssociation(AssociationRelyingPartyType distinguishingFactor, string handle)
107 { 107 {
108 lock (m_syncRoot) 108 lock (m_syncRoot)
109 { 109 {
110 for (int i = 0; i < m_sortedStore.Values.Count; i++) 110 for (int i = 0; i < m_sortedStore.Values.Count; i++)
111 { 111 {
112 AssociationItem item = m_sortedStore.Values[i]; 112 AssociationItem item = m_sortedStore.Values[i];
113 if (item.Handle == handle) 113 if (item.Handle == handle)
114 { 114 {
115 m_sortedStore.RemoveAt(i); 115 m_sortedStore.RemoveAt(i);
116 break; 116 break;
117 } 117 }
118 } 118 }
119 119
120 return m_store.Remove(handle); 120 return m_store.Remove(handle);
121 } 121 }
122 } 122 }
123 123
124 public void ClearExpiredAssociations() 124 public void ClearExpiredAssociations()
125 { 125 {
126 lock (m_syncRoot) 126 lock (m_syncRoot)
127 { 127 {
128 List<AssociationItem> itemsCopy = new List<AssociationItem>(m_sortedStore.Values); 128 List<AssociationItem> itemsCopy = new List<AssociationItem>(m_sortedStore.Values);
129 DateTime now = DateTime.Now; 129 DateTime now = DateTime.Now;
130 130
131 for (int i = 0; i < itemsCopy.Count; i++) 131 for (int i = 0; i < itemsCopy.Count; i++)
132 { 132 {
133 AssociationItem item = itemsCopy[i]; 133 AssociationItem item = itemsCopy[i];
134 134
135 if (item.Expires <= now) 135 if (item.Expires <= now)
136 { 136 {
137 m_sortedStore.RemoveAt(i); 137 m_sortedStore.RemoveAt(i);
138 m_store.Remove(item.Handle); 138 m_store.Remove(item.Handle);
139 } 139 }
140 } 140 }
141 } 141 }
142 } 142 }
143 143
144 #endregion 144 #endregion
145 } 145 }
146 146
147 public class OpenIdStreamHandler : IStreamHandler 147 public class OpenIdStreamHandler : IStreamHandler
148 { 148 {
149 #region HTML 149 #region HTML
150 150
151 /// <summary>Login form used to authenticate OpenID requests</summary> 151 /// <summary>Login form used to authenticate OpenID requests</summary>
152 const string LOGIN_PAGE = 152 const string LOGIN_PAGE =
153@"<html> 153@"<html>
154<head><title>OpenSim OpenID Login</title></head> 154<head><title>OpenSim OpenID Login</title></head>
155<body> 155<body>
156<h3>OpenSim Login</h3> 156<h3>OpenSim Login</h3>
157<form method=""post""> 157<form method=""post"">
158<label for=""first"">First Name:</label> <input readonly type=""text"" name=""first"" id=""first"" value=""{0}""/> 158<label for=""first"">First Name:</label> <input readonly type=""text"" name=""first"" id=""first"" value=""{0}""/>
159<label for=""last"">Last Name:</label> <input readonly type=""text"" name=""last"" id=""last"" value=""{1}""/> 159<label for=""last"">Last Name:</label> <input readonly type=""text"" name=""last"" id=""last"" value=""{1}""/>
160<label for=""pass"">Password:</label> <input type=""password"" name=""pass"" id=""pass""/> 160<label for=""pass"">Password:</label> <input type=""password"" name=""pass"" id=""pass""/>
161<input type=""submit"" value=""Login""> 161<input type=""submit"" value=""Login"">
162</form> 162</form>
163</body> 163</body>
164</html>"; 164</html>";
165 165
166 /// <summary>Page shown for a valid OpenID identity</summary> 166 /// <summary>Page shown for a valid OpenID identity</summary>
167 const string OPENID_PAGE = 167 const string OPENID_PAGE =
168@"<html> 168@"<html>
169<head> 169<head>
170<title>{2} {3}</title> 170<title>{2} {3}</title>
171<link rel=""openid2.provider openid.server"" href=""{0}://{1}/openid/server/""/> 171<link rel=""openid2.provider openid.server"" href=""{0}://{1}/openid/server/""/>
172</head> 172</head>
173<body>OpenID identifier for {2} {3}</body> 173<body>OpenID identifier for {2} {3}</body>
174</html> 174</html>
175"; 175";
176 176
177 /// <summary>Page shown for an invalid OpenID identity</summary> 177 /// <summary>Page shown for an invalid OpenID identity</summary>
178 const string INVALID_OPENID_PAGE = 178 const string INVALID_OPENID_PAGE =
179@"<html><head><title>Identity not found</title></head> 179@"<html><head><title>Identity not found</title></head>
180<body>Invalid OpenID identity</body></html>"; 180<body>Invalid OpenID identity</body></html>";
181 181
182 /// <summary>Page shown if the OpenID endpoint is requested directly</summary> 182 /// <summary>Page shown if the OpenID endpoint is requested directly</summary>
183 const string ENDPOINT_PAGE = 183 const string ENDPOINT_PAGE =
184@"<html><head><title>OpenID Endpoint</title></head><body> 184@"<html><head><title>OpenID Endpoint</title></head><body>
185This is an OpenID server endpoint, not a human-readable resource. 185This is an OpenID server endpoint, not a human-readable resource.
186For more information, see <a href='http://openid.net/'>http://openid.net/</a>. 186For more information, see <a href='http://openid.net/'>http://openid.net/</a>.
187</body></html>"; 187</body></html>";
188 188
189 #endregion HTML 189 #endregion HTML
190 190
191 public string ContentType { get { return m_contentType; } } 191 public string ContentType { get { return m_contentType; } }
192 public string HttpMethod { get { return m_httpMethod; } } 192 public string HttpMethod { get { return m_httpMethod; } }
193 public string Path { get { return m_path; } } 193 public string Path { get { return m_path; } }
194 194
195 string m_contentType; 195 string m_contentType;
196 string m_httpMethod; 196 string m_httpMethod;
197 string m_path; 197 string m_path;
198 UserLoginService m_loginService; 198 UserLoginService m_loginService;
199 ProviderMemoryStore m_openidStore = new ProviderMemoryStore(); 199 ProviderMemoryStore m_openidStore = new ProviderMemoryStore();
200 200
201 /// <summary> 201 /// <summary>
202 /// Constructor 202 /// Constructor
203 /// </summary> 203 /// </summary>
204 public OpenIdStreamHandler(string httpMethod, string path, UserLoginService loginService) 204 public OpenIdStreamHandler(string httpMethod, string path, UserLoginService loginService)
205 { 205 {
206 m_loginService = loginService; 206 m_loginService = loginService;
207 m_httpMethod = httpMethod; 207 m_httpMethod = httpMethod;
208 m_path = path; 208 m_path = path;
209 209
210 m_contentType = "text/html"; 210 m_contentType = "text/html";
211 } 211 }
212 212
213 /// <summary> 213 /// <summary>
214 /// Handles all GET and POST requests for OpenID identifier pages and endpoint 214 /// Handles all GET and POST requests for OpenID identifier pages and endpoint
215 /// server communication 215 /// server communication
216 /// </summary> 216 /// </summary>
217 public void Handle(string path, Stream request, Stream response, OSHttpRequest httpRequest, OSHttpResponse httpResponse) 217 public void Handle(string path, Stream request, Stream response, OSHttpRequest httpRequest, OSHttpResponse httpResponse)
218 { 218 {
219 Uri providerEndpoint = new Uri(String.Format("{0}://{1}{2}", httpRequest.Url.Scheme, httpRequest.Url.Authority, httpRequest.Url.AbsolutePath)); 219 Uri providerEndpoint = new Uri(String.Format("{0}://{1}{2}", httpRequest.Url.Scheme, httpRequest.Url.Authority, httpRequest.Url.AbsolutePath));
220 220
221 // Defult to returning HTML content 221 // Defult to returning HTML content
222 m_contentType = "text/html"; 222 m_contentType = "text/html";
223 223
224 try 224 try
225 { 225 {
226 NameValueCollection postQuery = HttpUtility.ParseQueryString(new StreamReader(httpRequest.InputStream).ReadToEnd()); 226 NameValueCollection postQuery = HttpUtility.ParseQueryString(new StreamReader(httpRequest.InputStream).ReadToEnd());
227 NameValueCollection getQuery = HttpUtility.ParseQueryString(httpRequest.Url.Query); 227 NameValueCollection getQuery = HttpUtility.ParseQueryString(httpRequest.Url.Query);
228 NameValueCollection openIdQuery = (postQuery.GetValues("openid.mode") != null ? postQuery : getQuery); 228 NameValueCollection openIdQuery = (postQuery.GetValues("openid.mode") != null ? postQuery : getQuery);
229 229
230 OpenIdProvider provider = new OpenIdProvider(m_openidStore, providerEndpoint, httpRequest.Url, openIdQuery); 230 OpenIdProvider provider = new OpenIdProvider(m_openidStore, providerEndpoint, httpRequest.Url, openIdQuery);
231 231
232 if (provider.Request != null) 232 if (provider.Request != null)
233 { 233 {
234 if (!provider.Request.IsResponseReady && provider.Request is IAuthenticationRequest) 234 if (!provider.Request.IsResponseReady && provider.Request is IAuthenticationRequest)
235 { 235 {
236 IAuthenticationRequest authRequest = (IAuthenticationRequest)provider.Request; 236 IAuthenticationRequest authRequest = (IAuthenticationRequest)provider.Request;
237 string[] passwordValues = postQuery.GetValues("pass"); 237 string[] passwordValues = postQuery.GetValues("pass");
238 238
239 UserProfileData profile; 239 UserProfileData profile;
240 if (TryGetProfile(new Uri(authRequest.ClaimedIdentifier.ToString()), out profile)) 240 if (TryGetProfile(new Uri(authRequest.ClaimedIdentifier.ToString()), out profile))
241 { 241 {
242 // Check for form POST data 242 // Check for form POST data
243 if (passwordValues != null && passwordValues.Length == 1) 243 if (passwordValues != null && passwordValues.Length == 1)
244 { 244 {
245 if (profile != null && m_loginService.AuthenticateUser(profile, passwordValues[0])) 245 if (profile != null && m_loginService.AuthenticateUser(profile, passwordValues[0]))
246 authRequest.IsAuthenticated = true; 246 authRequest.IsAuthenticated = true;
247 else 247 else
248 authRequest.IsAuthenticated = false; 248 authRequest.IsAuthenticated = false;
249 } 249 }
250 else 250 else
251 { 251 {
252 // Authentication was requested, send the client a login form 252 // Authentication was requested, send the client a login form
253 using (StreamWriter writer = new StreamWriter(response)) 253 using (StreamWriter writer = new StreamWriter(response))
254 writer.Write(String.Format(LOGIN_PAGE, profile.FirstName, profile.SurName)); 254 writer.Write(String.Format(LOGIN_PAGE, profile.FirstName, profile.SurName));
255 return; 255 return;
256 } 256 }
257 } 257 }
258 else 258 else
259 { 259 {
260 // Cannot find an avatar matching the claimed identifier 260 // Cannot find an avatar matching the claimed identifier
261 authRequest.IsAuthenticated = false; 261 authRequest.IsAuthenticated = false;
262 } 262 }
263 } 263 }
264 264
265 // Add OpenID headers to the response 265 // Add OpenID headers to the response
266 foreach (string key in provider.Request.Response.Headers.Keys) 266 foreach (string key in provider.Request.Response.Headers.Keys)
267 httpResponse.AddHeader(key, provider.Request.Response.Headers[key]); 267 httpResponse.AddHeader(key, provider.Request.Response.Headers[key]);
268 268
269 string[] contentTypeValues = provider.Request.Response.Headers.GetValues("Content-Type"); 269 string[] contentTypeValues = provider.Request.Response.Headers.GetValues("Content-Type");
270 if (contentTypeValues != null && contentTypeValues.Length == 1) 270 if (contentTypeValues != null && contentTypeValues.Length == 1)
271 m_contentType = contentTypeValues[0]; 271 m_contentType = contentTypeValues[0];
272 272
273 // Set the response code and document body based on the OpenID result 273 // Set the response code and document body based on the OpenID result
274 httpResponse.StatusCode = (int)provider.Request.Response.Code; 274 httpResponse.StatusCode = (int)provider.Request.Response.Code;
275 response.Write(provider.Request.Response.Body, 0, provider.Request.Response.Body.Length); 275 response.Write(provider.Request.Response.Body, 0, provider.Request.Response.Body.Length);
276 response.Close(); 276 response.Close();
277 } 277 }
278 else if (httpRequest.Url.AbsolutePath.Contains("/openid/server")) 278 else if (httpRequest.Url.AbsolutePath.Contains("/openid/server"))
279 { 279 {
280 // Standard HTTP GET was made on the OpenID endpoint, send the client the default error page 280 // Standard HTTP GET was made on the OpenID endpoint, send the client the default error page
281 using (StreamWriter writer = new StreamWriter(response)) 281 using (StreamWriter writer = new StreamWriter(response))
282 writer.Write(ENDPOINT_PAGE); 282 writer.Write(ENDPOINT_PAGE);
283 } 283 }
284 else 284 else
285 { 285 {
286 // Try and lookup this avatar 286 // Try and lookup this avatar
287 UserProfileData profile; 287 UserProfileData profile;
288 if (TryGetProfile(httpRequest.Url, out profile)) 288 if (TryGetProfile(httpRequest.Url, out profile))
289 { 289 {
290 using (StreamWriter writer = new StreamWriter(response)) 290 using (StreamWriter writer = new StreamWriter(response))
291 { 291 {
292 // TODO: Print out a full profile page for this avatar 292 // TODO: Print out a full profile page for this avatar
293 writer.Write(String.Format(OPENID_PAGE, httpRequest.Url.Scheme, 293 writer.Write(String.Format(OPENID_PAGE, httpRequest.Url.Scheme,
294 httpRequest.Url.Authority, profile.FirstName, profile.SurName)); 294 httpRequest.Url.Authority, profile.FirstName, profile.SurName));
295 } 295 }
296 } 296 }
297 else 297 else
298 { 298 {
299 // Couldn't parse an avatar name, or couldn't find the avatar in the user server 299 // Couldn't parse an avatar name, or couldn't find the avatar in the user server
300 using (StreamWriter writer = new StreamWriter(response)) 300 using (StreamWriter writer = new StreamWriter(response))
301 writer.Write(INVALID_OPENID_PAGE); 301 writer.Write(INVALID_OPENID_PAGE);
302 } 302 }
303 } 303 }
304 } 304 }
305 catch (Exception ex) 305 catch (Exception ex)
306 { 306 {
307 httpResponse.StatusCode = (int)HttpStatusCode.InternalServerError; 307 httpResponse.StatusCode = (int)HttpStatusCode.InternalServerError;
308 using (StreamWriter writer = new StreamWriter(response)) 308 using (StreamWriter writer = new StreamWriter(response))
309 writer.Write(ex.Message); 309 writer.Write(ex.Message);
310 } 310 }
311 } 311 }
312 312
313 /// <summary> 313 /// <summary>
314 /// Parse a URL with a relative path of the form /users/First_Last and try to 314 /// Parse a URL with a relative path of the form /users/First_Last and try to
315 /// retrieve the profile matching that avatar name 315 /// retrieve the profile matching that avatar name
316 /// </summary> 316 /// </summary>
317 /// <param name="requestUrl">URL to parse for an avatar name</param> 317 /// <param name="requestUrl">URL to parse for an avatar name</param>
318 /// <param name="profile">Profile data for the avatar</param> 318 /// <param name="profile">Profile data for the avatar</param>
319 /// <returns>True if the parse and lookup were successful, otherwise false</returns> 319 /// <returns>True if the parse and lookup were successful, otherwise false</returns>
320 bool TryGetProfile(Uri requestUrl, out UserProfileData profile) 320 bool TryGetProfile(Uri requestUrl, out UserProfileData profile)
321 { 321 {
322 if (requestUrl.Segments.Length == 3 && requestUrl.Segments[1] == "users/") 322 if (requestUrl.Segments.Length == 3 && requestUrl.Segments[1] == "users/")
323 { 323 {
324 // Parse the avatar name from the path 324 // Parse the avatar name from the path
325 string username = requestUrl.Segments[requestUrl.Segments.Length - 1]; 325 string username = requestUrl.Segments[requestUrl.Segments.Length - 1];
326 string[] name = username.Split('_'); 326 string[] name = username.Split('_');
327 327
328 if (name.Length == 2) 328 if (name.Length == 2)
329 { 329 {
330 profile = m_loginService.GetTheUser(name[0], name[1]); 330 profile = m_loginService.GetTheUser(name[0], name[1]);
331 return (profile != null); 331 return (profile != null);
332 } 332 }
333 } 333 }
334 334
335 profile = null; 335 profile = null;
336 return false; 336 return false;
337 } 337 }
338 } 338 }
339} 339}
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index 962071b..36eaf95 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -8248,7 +8248,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
8248 ap.Data = new AvatarPicksReplyPacket.DataBlock[picks.Count]; 8248 ap.Data = new AvatarPicksReplyPacket.DataBlock[picks.Count];
8249 8249
8250 int i = 0; 8250 int i = 0;
8251 foreach(KeyValuePair<UUID, string> pick in picks) 8251 foreach (KeyValuePair<UUID, string> pick in picks)
8252 { 8252 {
8253 ap.Data[i] = new AvatarPicksReplyPacket.DataBlock(); 8253 ap.Data[i] = new AvatarPicksReplyPacket.DataBlock();
8254 ap.Data[i].PickID = pick.Key; 8254 ap.Data[i].PickID = pick.Key;
@@ -8272,7 +8272,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
8272 ac.Data = new AvatarClassifiedReplyPacket.DataBlock[classifieds.Count]; 8272 ac.Data = new AvatarClassifiedReplyPacket.DataBlock[classifieds.Count];
8273 8273
8274 int i = 0; 8274 int i = 0;
8275 foreach(KeyValuePair<UUID, string> classified in classifieds) 8275 foreach (KeyValuePair<UUID, string> classified in classifieds)
8276 { 8276 {
8277 ac.Data[i] = new AvatarClassifiedReplyPacket.DataBlock(); 8277 ac.Data[i] = new AvatarClassifiedReplyPacket.DataBlock();
8278 ac.Data[i].ClassifiedID = classified.Key; 8278 ac.Data[i].ClassifiedID = classified.Key;
diff --git a/OpenSim/Region/Environment/Interfaces/IInterregionComms.cs b/OpenSim/Region/Environment/Interfaces/IInterregionComms.cs
index 7964d98..b70e885 100644
--- a/OpenSim/Region/Environment/Interfaces/IInterregionComms.cs
+++ b/OpenSim/Region/Environment/Interfaces/IInterregionComms.cs
@@ -1,47 +1,47 @@
1/* 1/*
2 * Copyright (c) Contributors, http://opensimulator.org/ 2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders. 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright 7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright 9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution. 11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSim Project nor the 12 * * Neither the name of the OpenSim Project nor the
13 * names of its contributors may be used to endorse or promote products 13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission. 14 * derived from this software without specific prior written permission.
15 * 15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY 16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28using System; 28using System;
29using OpenSim.Framework; 29using OpenSim.Framework;
30using OpenMetaverse; 30using OpenMetaverse;
31 31
32namespace OpenSim.Region.Environment.Interfaces 32namespace OpenSim.Region.Environment.Interfaces
33{ 33{
34 public delegate bool ChildAgentUpdateReceived(AgentData data); 34 public delegate bool ChildAgentUpdateReceived(AgentData data);
35 35
36 public interface IInterregionCommsOut 36 public interface IInterregionCommsOut
37 { 37 {
38 bool SendChildAgentUpdate(ulong regionHandle, AgentData data); 38 bool SendChildAgentUpdate(ulong regionHandle, AgentData data);
39 } 39 }
40 40
41 // This may not be needed, but having it here for now. 41 // This may not be needed, but having it here for now.
42 public interface IInterregionCommsIn 42 public interface IInterregionCommsIn
43 { 43 {
44 event ChildAgentUpdateReceived OnChildAgentUpdate; 44 event ChildAgentUpdateReceived OnChildAgentUpdate;
45 } 45 }
46 46
47} 47}
diff --git a/OpenSim/Region/Environment/Modules/Communications/Local/LocalInterregionComms.cs b/OpenSim/Region/Environment/Modules/Communications/Local/LocalInterregionComms.cs
index 6812e6d..dc2e3de 100644
--- a/OpenSim/Region/Environment/Modules/Communications/Local/LocalInterregionComms.cs
+++ b/OpenSim/Region/Environment/Modules/Communications/Local/LocalInterregionComms.cs
@@ -1,140 +1,140 @@
1/* 1/*
2 * Copyright (c) Contributors, http://opensimulator.org/ 2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders. 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright 7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright 9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution. 11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSim Project nor the 12 * * Neither the name of the OpenSim Project nor the
13 * names of its contributors may be used to endorse or promote products 13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission. 14 * derived from this software without specific prior written permission.
15 * 15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY 16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27using System; 27using System;
28using System.Collections; 28using System.Collections;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Net; 30using System.Net;
31using System.Net.Sockets; 31using System.Net.Sockets;
32using System.Reflection; 32using System.Reflection;
33using System.Threading; 33using System.Threading;
34using System.Xml; 34using System.Xml;
35using OpenMetaverse; 35using OpenMetaverse;
36using log4net; 36using log4net;
37using Nini.Config; 37using Nini.Config;
38using Nwc.XmlRpc; 38using Nwc.XmlRpc;
39using OpenSim.Framework; 39using OpenSim.Framework;
40using OpenSim.Framework.Communications.Cache; 40using OpenSim.Framework.Communications.Cache;
41using OpenSim.Region.Environment.Interfaces; 41using OpenSim.Region.Environment.Interfaces;
42using OpenSim.Region.Interfaces; 42using OpenSim.Region.Interfaces;
43using OpenSim.Region.Environment.Scenes; 43using OpenSim.Region.Environment.Scenes;
44 44
45namespace OpenSim.Region.Environment.Modules.Communications.Local 45namespace OpenSim.Region.Environment.Modules.Communications.Local
46{ 46{
47 public class LocalInterregionComms : IRegionModule, IInterregionCommsOut, IInterregionCommsIn 47 public class LocalInterregionComms : IRegionModule, IInterregionCommsOut, IInterregionCommsIn
48 { 48 {
49 private bool m_enabled = false; 49 private bool m_enabled = false;
50 50
51 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 51 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
52 private List<Scene> m_sceneList = new List<Scene>(); 52 private List<Scene> m_sceneList = new List<Scene>();
53 53
54 #region Events 54 #region Events
55 public event ChildAgentUpdateReceived OnChildAgentUpdate; 55 public event ChildAgentUpdateReceived OnChildAgentUpdate;
56 56
57 #endregion /* Events */ 57 #endregion /* Events */
58 58
59 #region IRegionModule 59 #region IRegionModule
60 60
61 public void Initialise(Scene scene, IConfigSource config) 61 public void Initialise(Scene scene, IConfigSource config)
62 { 62 {
63 if (m_sceneList.Count == 0) 63 if (m_sceneList.Count == 0)
64 { 64 {
65 IConfig startupConfig = config.Configs["Communications"]; 65 IConfig startupConfig = config.Configs["Communications"];
66 66
67 if ((startupConfig == null) || 67 if ((startupConfig == null) ||
68 (startupConfig != null) && (startupConfig.GetString("InterregionComms", "RESTCommms") == "LocalComms")) 68 (startupConfig != null) && (startupConfig.GetString("InterregionComms", "RESTCommms") == "LocalComms"))
69 m_enabled = true; 69 m_enabled = true;
70 } 70 }
71 71
72 if (!m_enabled) 72 if (!m_enabled)
73 return; 73 return;
74 74
75 Init(scene); 75 Init(scene);
76 76
77 } 77 }
78 78
79 public void PostInitialise() 79 public void PostInitialise()
80 { 80 {
81 } 81 }
82 82
83 public void Close() 83 public void Close()
84 { 84 {
85 } 85 }
86 86
87 public string Name 87 public string Name
88 { 88 {
89 get { return "LocalInterregionCommsModule"; } 89 get { return "LocalInterregionCommsModule"; }
90 } 90 }
91 91
92 public bool IsSharedModule 92 public bool IsSharedModule
93 { 93 {
94 get { return true; } 94 get { return true; }
95 } 95 }
96 /// <summary> 96 /// <summary>
97 /// Can be called from other modules. 97 /// Can be called from other modules.
98 /// </summary> 98 /// </summary>
99 /// <param name="scene"></param> 99 /// <param name="scene"></param>
100 public void Init(Scene scene) 100 public void Init(Scene scene)
101 { 101 {
102 if (!m_sceneList.Contains(scene)) 102 if (!m_sceneList.Contains(scene))
103 { 103 {
104 lock (m_sceneList) 104 lock (m_sceneList)
105 { 105 {
106 m_sceneList.Add(scene); 106 m_sceneList.Add(scene);
107 if (m_enabled) 107 if (m_enabled)
108 scene.RegisterModuleInterface<IInterregionCommsOut>(this); 108 scene.RegisterModuleInterface<IInterregionCommsOut>(this);
109 scene.RegisterModuleInterface<IInterregionCommsIn>(this); 109 scene.RegisterModuleInterface<IInterregionCommsIn>(this);
110 } 110 }
111 111
112 } 112 }
113 } 113 }
114 114
115 #endregion /* IRegionModule */ 115 #endregion /* IRegionModule */
116 116
117 #region IInterregionComms 117 #region IInterregionComms
118 118
119 public bool SendChildAgentUpdate(ulong regionHandle, AgentData cAgentData) 119 public bool SendChildAgentUpdate(ulong regionHandle, AgentData cAgentData)
120 { 120 {
121 lock (m_sceneList) 121 lock (m_sceneList)
122 { 122 {
123 foreach (Scene s in m_sceneList) 123 foreach (Scene s in m_sceneList)
124 { 124 {
125 if (s.RegionInfo.RegionHandle == regionHandle) 125 if (s.RegionInfo.RegionHandle == regionHandle)
126 { 126 {
127 //m_log.Debug("[LOCAL COMMS]: Found region to send ChildAgentUpdate"); 127 //m_log.Debug("[LOCAL COMMS]: Found region to send ChildAgentUpdate");
128 return s.IncomingChildAgentDataUpdate(cAgentData); 128 return s.IncomingChildAgentDataUpdate(cAgentData);
129 //if (OnChildAgentUpdate != null) 129 //if (OnChildAgentUpdate != null)
130 // return OnChildAgentUpdate(cAgentData); 130 // return OnChildAgentUpdate(cAgentData);
131 } 131 }
132 } 132 }
133 } 133 }
134 m_log.Debug("[LOCAL COMMS]: region not found for ChildAgentUpdate"); 134 m_log.Debug("[LOCAL COMMS]: region not found for ChildAgentUpdate");
135 return false; 135 return false;
136 } 136 }
137 137
138 #endregion /* IInterregionComms */ 138 #endregion /* IInterregionComms */
139 } 139 }
140} 140}
diff --git a/OpenSim/Region/Environment/Modules/Communications/REST/HGInterregionComms.cs b/OpenSim/Region/Environment/Modules/Communications/REST/HGInterregionComms.cs
index a553136..a94ca8b 100644
--- a/OpenSim/Region/Environment/Modules/Communications/REST/HGInterregionComms.cs
+++ b/OpenSim/Region/Environment/Modules/Communications/REST/HGInterregionComms.cs
@@ -1,86 +1,86 @@
1/* 1/*
2 * Copyright (c) Contributors, http://opensimulator.org/ 2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders. 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright 7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright 9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution. 11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSim Project nor the 12 * * Neither the name of the OpenSim Project nor the
13 * names of its contributors may be used to endorse or promote products 13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission. 14 * derived from this software without specific prior written permission.
15 * 15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY 16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27using System; 27using System;
28using System.Collections; 28using System.Collections;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Reflection; 30using System.Reflection;
31using log4net; 31using log4net;
32using Nini.Config; 32using Nini.Config;
33using OpenSim.Framework; 33using OpenSim.Framework;
34using OpenSim.Framework.Communications; 34using OpenSim.Framework.Communications;
35using OpenSim.Framework.Communications.Cache; 35using OpenSim.Framework.Communications.Cache;
36using OpenSim.Region.Environment.Interfaces; 36using OpenSim.Region.Environment.Interfaces;
37using OpenSim.Region.Interfaces; 37using OpenSim.Region.Interfaces;
38using OpenSim.Region.Environment.Scenes; 38using OpenSim.Region.Environment.Scenes;
39using OpenSim.Region.Environment.Scenes.Hypergrid; 39using OpenSim.Region.Environment.Scenes.Hypergrid;
40 40
41namespace OpenSim.Region.Environment.Modules.Communications.REST 41namespace OpenSim.Region.Environment.Modules.Communications.REST
42{ 42{
43 public class HGInterregionComms : RESTInterregionComms 43 public class HGInterregionComms : RESTInterregionComms
44 { 44 {
45 private static bool initialized = false; 45 private static bool initialized = false;
46 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 46 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
47 47
48 #region IRegionModule 48 #region IRegionModule
49 49
50 public override void Initialise(Scene scene, IConfigSource config) 50 public override void Initialise(Scene scene, IConfigSource config)
51 { 51 {
52 if (!initialized) 52 if (!initialized)
53 { 53 {
54 initialized = true; 54 initialized = true;
55 IConfig startupConfig = config.Configs["Communications"]; 55 IConfig startupConfig = config.Configs["Communications"];
56 if ((startupConfig != null) && (startupConfig.GetString("InterregionComms", "RESTCommms") == "HGRESTComms")) 56 if ((startupConfig != null) && (startupConfig.GetString("InterregionComms", "RESTCommms") == "HGRESTComms"))
57 { 57 {
58 m_enabled = true; 58 m_enabled = true;
59 InitOnce(scene); 59 InitOnce(scene);
60 } 60 }
61 } 61 }
62 62
63 if (!m_enabled) 63 if (!m_enabled)
64 return; 64 return;
65 65
66 InitEach(scene); 66 InitEach(scene);
67 } 67 }
68 68
69 public override string Name 69 public override string Name
70 { 70 {
71 get { return "HGInterregionCommsModule"; } 71 get { return "HGInterregionCommsModule"; }
72 } 72 }
73 73
74 #endregion /* IRegionModule */ 74 #endregion /* IRegionModule */
75 75
76 #region Misc 76 #region Misc
77 77
78 protected override ulong GetRegionHandle(RegionInfo region) 78 protected override ulong GetRegionHandle(RegionInfo region)
79 { 79 {
80 return ((HGSceneCommunicationService)(m_aScene.SceneGridService)).m_hg.FindRegionHandle(region.RegionHandle); 80 return ((HGSceneCommunicationService)(m_aScene.SceneGridService)).m_hg.FindRegionHandle(region.RegionHandle);
81 } 81 }
82 82
83 #endregion /* Misc */ 83 #endregion /* Misc */
84 84
85 } 85 }
86} 86}
diff --git a/OpenSim/Region/Environment/Modules/Communications/REST/RESTInterregionComms.cs b/OpenSim/Region/Environment/Modules/Communications/REST/RESTInterregionComms.cs
index 4c2308e..022f635 100644
--- a/OpenSim/Region/Environment/Modules/Communications/REST/RESTInterregionComms.cs
+++ b/OpenSim/Region/Environment/Modules/Communications/REST/RESTInterregionComms.cs
@@ -1,296 +1,296 @@
1/* 1/*
2 * Copyright (c) Contributors, http://opensimulator.org/ 2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders. 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright 7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright 9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution. 11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSim Project nor the 12 * * Neither the name of the OpenSim Project nor the
13 * names of its contributors may be used to endorse or promote products 13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission. 14 * derived from this software without specific prior written permission.
15 * 15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY 16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27using System; 27using System;
28using System.Collections; 28using System.Collections;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.IO; 30using System.IO;
31using System.Net; 31using System.Net;
32using System.Net.Sockets; 32using System.Net.Sockets;
33using System.Reflection; 33using System.Reflection;
34using System.Threading; 34using System.Threading;
35using System.Xml; 35using System.Xml;
36using OpenMetaverse; 36using OpenMetaverse;
37using OpenMetaverse.StructuredData; 37using OpenMetaverse.StructuredData;
38using log4net; 38using log4net;
39using Nini.Config; 39using Nini.Config;
40using Nwc.XmlRpc; 40using Nwc.XmlRpc;
41using OpenSim.Framework; 41using OpenSim.Framework;
42using OpenSim.Framework.Communications; 42using OpenSim.Framework.Communications;
43using OpenSim.Framework.Communications.Cache; 43using OpenSim.Framework.Communications.Cache;
44using OpenSim.Region.Environment.Interfaces; 44using OpenSim.Region.Environment.Interfaces;
45using OpenSim.Region.Interfaces; 45using OpenSim.Region.Interfaces;
46using OpenSim.Region.Environment.Scenes; 46using OpenSim.Region.Environment.Scenes;
47using OpenSim.Region.Environment.Modules.Communications.Local; 47using OpenSim.Region.Environment.Modules.Communications.Local;
48 48
49namespace OpenSim.Region.Environment.Modules.Communications.REST 49namespace OpenSim.Region.Environment.Modules.Communications.REST
50{ 50{
51 public class RESTInterregionComms : IRegionModule, IInterregionCommsOut 51 public class RESTInterregionComms : IRegionModule, IInterregionCommsOut
52 { 52 {
53 private static bool initialized = false; 53 private static bool initialized = false;
54 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 54 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
55 55
56 protected bool m_enabled = false; 56 protected bool m_enabled = false;
57 protected Scene m_aScene; 57 protected Scene m_aScene;
58 // RESTInterregionComms does not care about local regions; it delegates that to the Local module 58 // RESTInterregionComms does not care about local regions; it delegates that to the Local module
59 protected LocalInterregionComms m_localBackend; 59 protected LocalInterregionComms m_localBackend;
60 60
61 protected CommunicationsManager m_commsManager; 61 protected CommunicationsManager m_commsManager;
62 62
63 #region IRegionModule 63 #region IRegionModule
64 64
65 public virtual void Initialise(Scene scene, IConfigSource config) 65 public virtual void Initialise(Scene scene, IConfigSource config)
66 { 66 {
67 if (!initialized) 67 if (!initialized)
68 { 68 {
69 initialized = true; 69 initialized = true;
70 IConfig startupConfig = config.Configs["Communications"]; 70 IConfig startupConfig = config.Configs["Communications"];
71 if ((startupConfig != null) && (startupConfig.GetString("InterregionComms", "RESTCommms") == "RESTComms")) 71 if ((startupConfig != null) && (startupConfig.GetString("InterregionComms", "RESTCommms") == "RESTComms"))
72 { 72 {
73 m_enabled = true; 73 m_enabled = true;
74 InitOnce(scene); 74 InitOnce(scene);
75 } 75 }
76 } 76 }
77 77
78 if (!m_enabled) 78 if (!m_enabled)
79 return; 79 return;
80 80
81 InitEach(scene); 81 InitEach(scene);
82 82
83 } 83 }
84 84
85 public virtual void PostInitialise() 85 public virtual void PostInitialise()
86 { 86 {
87 if (m_enabled) 87 if (m_enabled)
88 AddHTTPHandlers(); 88 AddHTTPHandlers();
89 } 89 }
90 90
91 public virtual void Close() 91 public virtual void Close()
92 { 92 {
93 } 93 }
94 94
95 public virtual string Name 95 public virtual string Name
96 { 96 {
97 get { return "RESTInterregionCommsModule"; } 97 get { return "RESTInterregionCommsModule"; }
98 } 98 }
99 99
100 public virtual bool IsSharedModule 100 public virtual bool IsSharedModule
101 { 101 {
102 get { return true; } 102 get { return true; }
103 } 103 }
104 104
105 protected virtual void InitEach(Scene scene) 105 protected virtual void InitEach(Scene scene)
106 { 106 {
107 m_localBackend.Init(scene); 107 m_localBackend.Init(scene);
108 scene.RegisterModuleInterface<IInterregionCommsOut>(this); 108 scene.RegisterModuleInterface<IInterregionCommsOut>(this);
109 } 109 }
110 110
111 protected virtual void InitOnce(Scene scene) 111 protected virtual void InitOnce(Scene scene)
112 { 112 {
113 m_localBackend = new LocalInterregionComms(); 113 m_localBackend = new LocalInterregionComms();
114 m_commsManager = scene.CommsManager; 114 m_commsManager = scene.CommsManager;
115 m_aScene = scene; 115 m_aScene = scene;
116 } 116 }
117 117
118 protected virtual void AddHTTPHandlers() 118 protected virtual void AddHTTPHandlers()
119 { 119 {
120 m_aScene.AddHTTPHandler("/ChildAgentUpdate/", ChildAgentUpdateHandler); 120 m_aScene.AddHTTPHandler("/ChildAgentUpdate/", ChildAgentUpdateHandler);
121 } 121 }
122 122
123 #endregion /* IRegionModule */ 123 #endregion /* IRegionModule */
124 124
125 #region IInterregionComms 125 #region IInterregionComms
126 126
127 public bool SendChildAgentUpdate(ulong regionHandle, AgentData cAgentData) 127 public bool SendChildAgentUpdate(ulong regionHandle, AgentData cAgentData)
128 { 128 {
129 // Try local first 129 // Try local first
130 if (m_localBackend.SendChildAgentUpdate(regionHandle, cAgentData)) 130 if (m_localBackend.SendChildAgentUpdate(regionHandle, cAgentData))
131 return true; 131 return true;
132 132
133 // else do the remote thing 133 // else do the remote thing
134 RegionInfo regInfo = m_commsManager.GridService.RequestNeighbourInfo(regionHandle); 134 RegionInfo regInfo = m_commsManager.GridService.RequestNeighbourInfo(regionHandle);
135 if (regInfo != null) 135 if (regInfo != null)
136 { 136 {
137 return DoChildAgentUpdateCall(regInfo, cAgentData); 137 return DoChildAgentUpdateCall(regInfo, cAgentData);
138 } 138 }
139 139
140 return false; 140 return false;
141 141
142 } 142 }
143 143
144 protected bool DoChildAgentUpdateCall(RegionInfo region, AgentData cAgentData) 144 protected bool DoChildAgentUpdateCall(RegionInfo region, AgentData cAgentData)
145 { 145 {
146 string uri = "http://" + region.ExternalEndPoint.Address + ":" + region.HttpPort + "/ChildAgentUpdate/"; 146 string uri = "http://" + region.ExternalEndPoint.Address + ":" + region.HttpPort + "/ChildAgentUpdate/";
147 //Console.WriteLine(" >>> DoChildAgentUpdateCall <<< " + uri); 147 //Console.WriteLine(" >>> DoChildAgentUpdateCall <<< " + uri);
148 148
149 WebRequest ChildUpdateRequest = WebRequest.Create(uri); 149 WebRequest ChildUpdateRequest = WebRequest.Create(uri);
150 ChildUpdateRequest.Method = "PUT"; 150 ChildUpdateRequest.Method = "PUT";
151 ChildUpdateRequest.ContentType = "application/json"; 151 ChildUpdateRequest.ContentType = "application/json";
152 ChildUpdateRequest.Timeout = 10000; 152 ChildUpdateRequest.Timeout = 10000;
153 153
154 // Fill it in 154 // Fill it in
155 OSDMap args = null; 155 OSDMap args = null;
156 try 156 try
157 { 157 {
158 args = cAgentData.PackUpdateMessage(); 158 args = cAgentData.PackUpdateMessage();
159 } 159 }
160 catch (Exception e) 160 catch (Exception e)
161 { 161 {
162 m_log.Debug("[REST COMMS]: PackUpdateMessage failed with exception: " + e.Message); 162 m_log.Debug("[REST COMMS]: PackUpdateMessage failed with exception: " + e.Message);
163 } 163 }
164 // Add the regionhandle of the destination region 164 // Add the regionhandle of the destination region
165 ulong regionHandle = GetRegionHandle(region); 165 ulong regionHandle = GetRegionHandle(region);
166 args["destination_handle"] = OSD.FromString(regionHandle.ToString()); 166 args["destination_handle"] = OSD.FromString(regionHandle.ToString());
167 167
168 string strBuffer = ""; 168 string strBuffer = "";
169 byte[] buffer = new byte[1]; 169 byte[] buffer = new byte[1];
170 try 170 try
171 { 171 {
172 strBuffer = OSDParser.SerializeJsonString(args); 172 strBuffer = OSDParser.SerializeJsonString(args);
173 System.Text.UTF8Encoding str = new System.Text.UTF8Encoding(); 173 System.Text.UTF8Encoding str = new System.Text.UTF8Encoding();
174 buffer = str.GetBytes(strBuffer); 174 buffer = str.GetBytes(strBuffer);
175 175
176 } 176 }
177 catch (Exception e) 177 catch (Exception e)
178 { 178 {
179 m_log.WarnFormat("[OSG2]: Exception thrown on serialization of ChildUpdate: {0}", e.Message); 179 m_log.WarnFormat("[OSG2]: Exception thrown on serialization of ChildUpdate: {0}", e.Message);
180 // ignore. buffer will be empty, caller should check. 180 // ignore. buffer will be empty, caller should check.
181 } 181 }
182 182
183 Stream os = null; 183 Stream os = null;
184 try 184 try
185 { // send the Post 185 { // send the Post
186 ChildUpdateRequest.ContentLength = buffer.Length; //Count bytes to send 186 ChildUpdateRequest.ContentLength = buffer.Length; //Count bytes to send
187 os = ChildUpdateRequest.GetRequestStream(); 187 os = ChildUpdateRequest.GetRequestStream();
188 os.Write(buffer, 0, strBuffer.Length); //Send it 188 os.Write(buffer, 0, strBuffer.Length); //Send it
189 os.Close(); 189 os.Close();
190 //m_log.InfoFormat("[REST COMMS]: Posted ChildAgentUpdate request to remote sim {0}", uri); 190 //m_log.InfoFormat("[REST COMMS]: Posted ChildAgentUpdate request to remote sim {0}", uri);
191 } 191 }
192 catch (WebException ex) 192 catch (WebException ex)
193 { 193 {
194 //m_log.InfoFormat("[REST COMMS]: Bad send on ChildAgentUpdate {0}", ex.Message); 194 //m_log.InfoFormat("[REST COMMS]: Bad send on ChildAgentUpdate {0}", ex.Message);
195 195
196 return false; 196 return false;
197 } 197 }
198 198
199 // Let's wait for the response 199 // Let's wait for the response
200 //m_log.Info("[REST COMMS]: Waiting for a reply after ChildAgentUpdate"); 200 //m_log.Info("[REST COMMS]: Waiting for a reply after ChildAgentUpdate");
201 string reply = null; 201 string reply = null;
202 try 202 try
203 { 203 {
204 WebResponse webResponse = ChildUpdateRequest.GetResponse(); 204 WebResponse webResponse = ChildUpdateRequest.GetResponse();
205 if (webResponse == null) 205 if (webResponse == null)
206 { 206 {
207 m_log.Info("[REST COMMS]: Null reply on ChilAgentUpdate post"); 207 m_log.Info("[REST COMMS]: Null reply on ChilAgentUpdate post");
208 } 208 }
209 209
210 StreamReader sr = new StreamReader(webResponse.GetResponseStream()); 210 StreamReader sr = new StreamReader(webResponse.GetResponseStream());
211 reply = sr.ReadToEnd().Trim(); 211 reply = sr.ReadToEnd().Trim();
212 sr.Close(); 212 sr.Close();
213 //m_log.InfoFormat("[REST COMMS]: ChilAgentUpdate reply was {0} ", reply); 213 //m_log.InfoFormat("[REST COMMS]: ChilAgentUpdate reply was {0} ", reply);
214 214
215 } 215 }
216 catch (WebException ex) 216 catch (WebException ex)
217 { 217 {
218 m_log.InfoFormat("[REST COMMS]: exception on reply of ChilAgentUpdate {0}", ex.Message); 218 m_log.InfoFormat("[REST COMMS]: exception on reply of ChilAgentUpdate {0}", ex.Message);
219 // ignore, really 219 // ignore, really
220 } 220 }
221 221
222 return true; 222 return true;
223 223
224 } 224 }
225 225
226 #endregion /* IInterregionComms */ 226 #endregion /* IInterregionComms */
227 227
228 #region Called from remote instances on this instance 228 #region Called from remote instances on this instance
229 229
230 public Hashtable ChildAgentUpdateHandler(Hashtable request) 230 public Hashtable ChildAgentUpdateHandler(Hashtable request)
231 { 231 {
232 //m_log.Debug("[CONNECTION DEBUGGING]: ChildDataUpdateHandler Called"); 232 //m_log.Debug("[CONNECTION DEBUGGING]: ChildDataUpdateHandler Called");
233 233
234 Hashtable responsedata = new Hashtable(); 234 Hashtable responsedata = new Hashtable();
235 responsedata["content_type"] = "text/html"; 235 responsedata["content_type"] = "text/html";
236 236
237 OSDMap args = null; 237 OSDMap args = null;
238 try 238 try
239 { 239 {
240 OSD buffer; 240 OSD buffer;
241 // We should pay attention to the content-type, but let's assume we know it's Json 241 // We should pay attention to the content-type, but let's assume we know it's Json
242 buffer = OSDParser.DeserializeJson((string)request["body"]); 242 buffer = OSDParser.DeserializeJson((string)request["body"]);
243 if (buffer.Type == OSDType.Map) 243 if (buffer.Type == OSDType.Map)
244 args = (OSDMap)buffer; 244 args = (OSDMap)buffer;
245 else 245 else
246 { 246 {
247 // uh? 247 // uh?
248 m_log.Debug("[REST COMMS]: Got OSD of type " + buffer.Type.ToString()); 248 m_log.Debug("[REST COMMS]: Got OSD of type " + buffer.Type.ToString());
249 } 249 }
250 } 250 }
251 catch (Exception ex) 251 catch (Exception ex)
252 { 252 {
253 m_log.InfoFormat("[REST COMMS]: exception on parse of ChildAgentUpdate message {0}", ex.Message); 253 m_log.InfoFormat("[REST COMMS]: exception on parse of ChildAgentUpdate message {0}", ex.Message);
254 responsedata["int_response_code"] = 400; 254 responsedata["int_response_code"] = 400;
255 responsedata["str_response_string"] = "false"; 255 responsedata["str_response_string"] = "false";
256 256
257 return responsedata; 257 return responsedata;
258 } 258 }
259 259
260 // retrieve the regionhandle 260 // retrieve the regionhandle
261 ulong regionhandle = 0; 261 ulong regionhandle = 0;
262 if (args["destination_handle"] != null) 262 if (args["destination_handle"] != null)
263 UInt64.TryParse(args["destination_handle"].AsString(), out regionhandle); 263 UInt64.TryParse(args["destination_handle"].AsString(), out regionhandle);
264 264
265 AgentData agent = new AgentData(); 265 AgentData agent = new AgentData();
266 try 266 try
267 { 267 {
268 agent.UnpackUpdateMessage(args); 268 agent.UnpackUpdateMessage(args);
269 } 269 }
270 catch (Exception ex) 270 catch (Exception ex)
271 { 271 {
272 m_log.InfoFormat("[REST COMMS]: exception on unpacking ChildAgentUpdate message {0}", ex.Message); 272 m_log.InfoFormat("[REST COMMS]: exception on unpacking ChildAgentUpdate message {0}", ex.Message);
273 } 273 }
274 //agent.Dump(); 274 //agent.Dump();
275 275
276 bool result = m_localBackend.SendChildAgentUpdate(regionhandle, agent); 276 bool result = m_localBackend.SendChildAgentUpdate(regionhandle, agent);
277 277
278 278
279 responsedata["int_response_code"] = 200; 279 responsedata["int_response_code"] = 200;
280 responsedata["str_response_string"] = result.ToString(); 280 responsedata["str_response_string"] = result.ToString();
281 return responsedata; 281 return responsedata;
282 } 282 }
283 283
284 #endregion 284 #endregion
285 285
286 #region Misc 286 #region Misc
287 287
288 protected virtual ulong GetRegionHandle(RegionInfo region) 288 protected virtual ulong GetRegionHandle(RegionInfo region)
289 { 289 {
290 return region.RegionHandle; 290 return region.RegionHandle;
291 } 291 }
292 292
293 #endregion /* Misc */ 293 #endregion /* Misc */
294 294
295 } 295 }
296} 296}
diff --git a/OpenSim/Region/Environment/Modules/Scripting/VectorRender/VectorRenderModule.cs b/OpenSim/Region/Environment/Modules/Scripting/VectorRender/VectorRenderModule.cs
index 6b9fde4..f8a9879 100644
--- a/OpenSim/Region/Environment/Modules/Scripting/VectorRender/VectorRenderModule.cs
+++ b/OpenSim/Region/Environment/Modules/Scripting/VectorRender/VectorRenderModule.cs
@@ -325,7 +325,7 @@ namespace OpenSim.Region.Environment.Modules.Scripting.VectorRender
325 int hex = 0; 325 int hex = 0;
326 326
327 Color newColour; 327 Color newColour;
328 if(Int32.TryParse(nextLine, NumberStyles.HexNumber, CultureInfo.InvariantCulture, out hex)) 328 if (Int32.TryParse(nextLine, NumberStyles.HexNumber, CultureInfo.InvariantCulture, out hex))
329 { 329 {
330 newColour = Color.FromArgb(hex); 330 newColour = Color.FromArgb(hex);
331 } 331 }
diff --git a/OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs
index 1117c7b..96e7919 100644
--- a/OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs
+++ b/OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs
@@ -533,7 +533,7 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions
533 { 533 {
534 permission = true; 534 permission = true;
535 } 535 }
536 else if(group.IsAttachment) 536 else if (group.IsAttachment)
537 { 537 {
538 permission = false; 538 permission = false;
539 } 539 }
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index 6aa34e4..56b5df6 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -4456,14 +4456,14 @@ namespace OpenSim.Region.Environment.Scenes
4456 // update non-physical objects like the joint proxy objects that represent the position 4456 // update non-physical objects like the joint proxy objects that represent the position
4457 // of the joints in the scene. 4457 // of the joints in the scene.
4458 4458
4459 // This routine is normally called from within a lock(OdeLock) from within the OdePhysicsScene 4459 // This routine is normally called from within a lock (OdeLock) from within the OdePhysicsScene
4460 // WARNING: be careful of deadlocks here if you manipulate the scene. Remember you are being called 4460 // WARNING: be careful of deadlocks here if you manipulate the scene. Remember you are being called
4461 // from within the OdePhysicsScene. 4461 // from within the OdePhysicsScene.
4462 4462
4463 protected internal void jointMoved(PhysicsJoint joint) 4463 protected internal void jointMoved(PhysicsJoint joint)
4464 { 4464 {
4465 4465
4466 // m_parentScene.PhysicsScene.DumpJointInfo(); // non-thread-locked version; we should already be in a lock(OdeLock) when this callback is invoked 4466 // m_parentScene.PhysicsScene.DumpJointInfo(); // non-thread-locked version; we should already be in a lock (OdeLock) when this callback is invoked
4467 // FIXME: this causes a sequential lookup of all objects in the scene; use a dictionary 4467 // FIXME: this causes a sequential lookup of all objects in the scene; use a dictionary
4468 SceneObjectPart jointProxyObject = GetSceneObjectPart(joint.ObjectNameInScene); 4468 SceneObjectPart jointProxyObject = GetSceneObjectPart(joint.ObjectNameInScene);
4469 if (jointProxyObject == null) 4469 if (jointProxyObject == null)
@@ -4521,7 +4521,7 @@ namespace OpenSim.Region.Environment.Scenes
4521 // update non-physical objects like the joint proxy objects that represent the position 4521 // update non-physical objects like the joint proxy objects that represent the position
4522 // of the joints in the scene. 4522 // of the joints in the scene.
4523 4523
4524 // This routine is normally called from within a lock(OdeLock) from within the OdePhysicsScene 4524 // This routine is normally called from within a lock (OdeLock) from within the OdePhysicsScene
4525 // WARNING: be careful of deadlocks here if you manipulate the scene. Remember you are being called 4525 // WARNING: be careful of deadlocks here if you manipulate the scene. Remember you are being called
4526 // from within the OdePhysicsScene. 4526 // from within the OdePhysicsScene.
4527 protected internal void jointDeactivated(PhysicsJoint joint) 4527 protected internal void jointDeactivated(PhysicsJoint joint)
@@ -4547,7 +4547,7 @@ namespace OpenSim.Region.Environment.Scenes
4547 // alert the user of errors by using the debug channel in the same way that scripts alert 4547 // alert the user of errors by using the debug channel in the same way that scripts alert
4548 // the user of compile errors. 4548 // the user of compile errors.
4549 4549
4550 // This routine is normally called from within a lock(OdeLock) from within the OdePhysicsScene 4550 // This routine is normally called from within a lock (OdeLock) from within the OdePhysicsScene
4551 // WARNING: be careful of deadlocks here if you manipulate the scene. Remember you are being called 4551 // WARNING: be careful of deadlocks here if you manipulate the scene. Remember you are being called
4552 // from within the OdePhysicsScene. 4552 // from within the OdePhysicsScene.
4553 public void jointErrorMessage(PhysicsJoint joint, string message) 4553 public void jointErrorMessage(PhysicsJoint joint, string message)
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
index 0f3e065..8b45484 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
@@ -1624,7 +1624,7 @@ if (m_shape != null) {
1624 part.m_fromUserInventoryItemID = fromUserInventoryItemId; 1624 part.m_fromUserInventoryItemID = fromUserInventoryItemId;
1625 1625
1626 // for tempOnRez objects, we have to fix the Expire date. 1626 // for tempOnRez objects, we have to fix the Expire date.
1627 if((part.Flags & PrimFlags.TemporaryOnRez) != 0) part.ResetExpire(); 1627 if ((part.Flags & PrimFlags.TemporaryOnRez) != 0) part.ResetExpire();
1628 1628
1629 return part; 1629 return part;
1630 } 1630 }
diff --git a/OpenSim/Region/Physics/Manager/PhysicsJoint.cs b/OpenSim/Region/Physics/Manager/PhysicsJoint.cs
index 9ef1c84..9474ee4 100644
--- a/OpenSim/Region/Physics/Manager/PhysicsJoint.cs
+++ b/OpenSim/Region/Physics/Manager/PhysicsJoint.cs
@@ -1,55 +1,55 @@
1/* 1/*
2 * Copyright (c) Contributors, http://opensimulator.org/ 2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders. 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright 7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright 9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution. 11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSim Project nor the 12 * * Neither the name of the OpenSim Project nor the
13 * names of its contributors may be used to endorse or promote products 13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission. 14 * derived from this software without specific prior written permission.
15 * 15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY 16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using OpenSim.Framework; 30using OpenSim.Framework;
31using OpenMetaverse; 31using OpenMetaverse;
32 32
33namespace OpenSim.Region.Physics.Manager 33namespace OpenSim.Region.Physics.Manager
34{ 34{
35 public enum PhysicsJointType : int 35 public enum PhysicsJointType : int
36 { 36 {
37 Ball = 0, 37 Ball = 0,
38 Hinge = 1 38 Hinge = 1
39 } 39 }
40 40
41 public class PhysicsJoint 41 public class PhysicsJoint
42 { 42 {
43 public virtual bool IsInPhysicsEngine { get { return false; } } // set internally to indicate if this joint has already been passed to the physics engine or is still pending 43 public virtual bool IsInPhysicsEngine { get { return false; } } // set internally to indicate if this joint has already been passed to the physics engine or is still pending
44 public PhysicsJointType Type; 44 public PhysicsJointType Type;
45 public string RawParams; 45 public string RawParams;
46 public List<string> BodyNames = new List<string>(); 46 public List<string> BodyNames = new List<string>();
47 public PhysicsVector Position; // global coords 47 public PhysicsVector Position; // global coords
48 public Quaternion Rotation; // global coords 48 public Quaternion Rotation; // global coords
49 public string ObjectNameInScene; // proxy object in scene that represents the joint position/orientation 49 public string ObjectNameInScene; // proxy object in scene that represents the joint position/orientation
50 public string TrackedBodyName; // body name that this joint is attached to (ObjectNameInScene will follow TrackedBodyName) 50 public string TrackedBodyName; // body name that this joint is attached to (ObjectNameInScene will follow TrackedBodyName)
51 public Quaternion LocalRotation; // joint orientation relative to one of the involved bodies, the tracked body 51 public Quaternion LocalRotation; // joint orientation relative to one of the involved bodies, the tracked body
52 public int ErrorMessageCount; // total # of error messages printed for this joint since its creation. if too many, further error messages are suppressed to prevent flooding. 52 public int ErrorMessageCount; // total # of error messages printed for this joint since its creation. if too many, further error messages are suppressed to prevent flooding.
53 public const int maxErrorMessages = 100; // no more than this # of error messages will be printed for each joint 53 public const int maxErrorMessages = 100; // no more than this # of error messages will be printed for each joint
54 } 54 }
55} 55}
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePhysicsJoint.cs b/OpenSim/Region/Physics/OdePlugin/OdePhysicsJoint.cs
index d080e9b..9858d6a 100644
--- a/OpenSim/Region/Physics/OdePlugin/OdePhysicsJoint.cs
+++ b/OpenSim/Region/Physics/OdePlugin/OdePhysicsJoint.cs
@@ -1,49 +1,49 @@
1/* 1/*
2 * Copyright (c) Contributors, http://opensimulator.org/ 2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders. 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright 7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright 9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution. 11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSim Project nor the 12 * * Neither the name of the OpenSim Project nor the
13 * names of its contributors may be used to endorse or promote products 13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission. 14 * derived from this software without specific prior written permission.
15 * 15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY 16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28using System; 28using System;
29using OpenMetaverse; 29using OpenMetaverse;
30using Ode.NET; 30using Ode.NET;
31using OpenSim.Framework; 31using OpenSim.Framework;
32using OpenSim.Region.Physics.Manager; 32using OpenSim.Region.Physics.Manager;
33using OpenSim.Region.Physics.Manager; 33using OpenSim.Region.Physics.Manager;
34using OpenSim.Region.Physics.OdePlugin; 34using OpenSim.Region.Physics.OdePlugin;
35 35
36namespace OpenSim.Region.Physics.OdePlugin 36namespace OpenSim.Region.Physics.OdePlugin
37{ 37{
38 class OdePhysicsJoint : PhysicsJoint 38 class OdePhysicsJoint : PhysicsJoint
39 { 39 {
40 public override bool IsInPhysicsEngine 40 public override bool IsInPhysicsEngine
41 { 41 {
42 get 42 get
43 { 43 {
44 return (jointID != IntPtr.Zero); 44 return (jointID != IntPtr.Zero);
45 } 45 }
46 } 46 }
47 public IntPtr jointID; 47 public IntPtr jointID;
48 } 48 }
49} 49}
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
index acd2569..a250a6a 100644
--- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
+++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
@@ -1366,28 +1366,28 @@ namespace OpenSim.Region.Physics.OdePlugin
1366 get { return m_NINJA_physics_joints_enabled; } 1366 get { return m_NINJA_physics_joints_enabled; }
1367 } 1367 }
1368 1368
1369 // internal utility function: must be called within a lock(OdeLock) 1369 // internal utility function: must be called within a lock (OdeLock)
1370 private void InternalAddActiveJoint(PhysicsJoint joint) 1370 private void InternalAddActiveJoint(PhysicsJoint joint)
1371 { 1371 {
1372 activeJoints.Add(joint); 1372 activeJoints.Add(joint);
1373 SOPName_to_activeJoint.Add(joint.ObjectNameInScene, joint); 1373 SOPName_to_activeJoint.Add(joint.ObjectNameInScene, joint);
1374 } 1374 }
1375 1375
1376 // internal utility function: must be called within a lock(OdeLock) 1376 // internal utility function: must be called within a lock (OdeLock)
1377 private void InternalAddPendingJoint(OdePhysicsJoint joint) 1377 private void InternalAddPendingJoint(OdePhysicsJoint joint)
1378 { 1378 {
1379 pendingJoints.Add(joint); 1379 pendingJoints.Add(joint);
1380 SOPName_to_pendingJoint.Add(joint.ObjectNameInScene, joint); 1380 SOPName_to_pendingJoint.Add(joint.ObjectNameInScene, joint);
1381 } 1381 }
1382 1382
1383 // internal utility function: must be called within a lock(OdeLock) 1383 // internal utility function: must be called within a lock (OdeLock)
1384 private void InternalRemovePendingJoint(PhysicsJoint joint) 1384 private void InternalRemovePendingJoint(PhysicsJoint joint)
1385 { 1385 {
1386 pendingJoints.Remove(joint); 1386 pendingJoints.Remove(joint);
1387 SOPName_to_pendingJoint.Remove(joint.ObjectNameInScene); 1387 SOPName_to_pendingJoint.Remove(joint.ObjectNameInScene);
1388 } 1388 }
1389 1389
1390 // internal utility function: must be called within a lock(OdeLock) 1390 // internal utility function: must be called within a lock (OdeLock)
1391 private void InternalRemoveActiveJoint(PhysicsJoint joint) 1391 private void InternalRemoveActiveJoint(PhysicsJoint joint)
1392 { 1392 {
1393 activeJoints.Remove(joint); 1393 activeJoints.Remove(joint);
@@ -1640,7 +1640,7 @@ namespace OpenSim.Region.Physics.OdePlugin
1640 } 1640 }
1641 } 1641 }
1642 1642
1643 // normally called from within OnJointMoved, which is called from within a lock(OdeLock) 1643 // normally called from within OnJointMoved, which is called from within a lock (OdeLock)
1644 public override PhysicsVector GetJointAnchor(PhysicsJoint joint) 1644 public override PhysicsVector GetJointAnchor(PhysicsJoint joint)
1645 { 1645 {
1646 Debug.Assert(joint.IsInPhysicsEngine); 1646 Debug.Assert(joint.IsInPhysicsEngine);
@@ -1666,7 +1666,7 @@ namespace OpenSim.Region.Physics.OdePlugin
1666 return new PhysicsVector(pos.X, pos.Y, pos.Z); 1666 return new PhysicsVector(pos.X, pos.Y, pos.Z);
1667 } 1667 }
1668 1668
1669 // normally called from within OnJointMoved, which is called from within a lock(OdeLock) 1669 // normally called from within OnJointMoved, which is called from within a lock (OdeLock)
1670 // WARNING: ODE sometimes returns <0,0,0> as the joint axis! Therefore this function 1670 // WARNING: ODE sometimes returns <0,0,0> as the joint axis! Therefore this function
1671 // appears to be unreliable. Fortunately we can compute the joint axis ourselves by 1671 // appears to be unreliable. Fortunately we can compute the joint axis ourselves by
1672 // keeping track of the joint's original orientation relative to one of the involved bodies. 1672 // keeping track of the joint's original orientation relative to one of the involved bodies.
@@ -2230,8 +2230,8 @@ namespace OpenSim.Region.Physics.OdePlugin
2230 2230
2231 if (SupportsNINJAJoints) 2231 if (SupportsNINJAJoints)
2232 { 2232 {
2233 DeleteRequestedJoints(); // this must be outside of the lock(OdeLock) to avoid deadlocks 2233 DeleteRequestedJoints(); // this must be outside of the lock (OdeLock) to avoid deadlocks
2234 CreateRequestedJoints(); // this must be outside of the lock(OdeLock) to avoid deadlocks 2234 CreateRequestedJoints(); // this must be outside of the lock (OdeLock) to avoid deadlocks
2235 } 2235 }
2236 2236
2237 lock (OdeLock) 2237 lock (OdeLock)
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 89911ec..bb77c1e 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -3644,7 +3644,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3644 3644
3645 partItemID = item.ItemID; 3645 partItemID = item.ItemID;
3646 int linkNumber = m_host.LinkNum; 3646 int linkNumber = m_host.LinkNum;
3647 if(m_host.ParentGroup.Children.Count == 1) 3647 if (m_host.ParentGroup.Children.Count == 1)
3648 linkNumber = 0; 3648 linkNumber = 0;
3649 3649
3650 3650