From 2be0f7a6f0b66e25b0d7e0e6cfee93f0c41b562b Mon Sep 17 00:00:00 2001 From: Jeff Ames Date: Tue, 30 Dec 2008 01:08:07 +0000 Subject: Update svn properties, minor formatting cleanup. --- OpenSim/Data/SQLite/Resources/016_RegionStore.sql | 10 +- OpenSim/Framework/OpenJpeg/bio.cs | 300 +++++---- OpenSim/Framework/OpenJpeg/fix.cs | 59 +- OpenSim/Framework/OpenJpeg/int_.cs | 142 ++-- OpenSim/Framework/OpenJpeg/j2k.cs | 318 ++++----- OpenSim/Framework/OpenJpeg/openjpeg.cs | 733 +++++++++++---------- OpenSim/Framework/OpenJpeg/pi.cs | 119 ++-- OpenSim/Grid/UserServer/OpenIdService.cs | 678 +++++++++---------- .../Region/ClientStack/LindenUDP/LLClientView.cs | 4 +- .../Environment/Interfaces/IInterregionComms.cs | 94 +-- .../Communications/Local/LocalInterregionComms.cs | 280 ++++---- .../Communications/REST/HGInterregionComms.cs | 172 ++--- .../Communications/REST/RESTInterregionComms.cs | 592 ++++++++--------- .../Scripting/VectorRender/VectorRenderModule.cs | 2 +- .../Modules/World/Permissions/PermissionsModule.cs | 2 +- OpenSim/Region/Environment/Scenes/Scene.cs | 8 +- .../Region/Environment/Scenes/SceneObjectPart.cs | 2 +- OpenSim/Region/Physics/Manager/PhysicsJoint.cs | 110 ++-- .../Region/Physics/OdePlugin/OdePhysicsJoint.cs | 98 +-- OpenSim/Region/Physics/OdePlugin/OdePlugin.cs | 16 +- .../Shared/Api/Implementation/LSL_Api.cs | 2 +- 21 files changed, 1941 insertions(+), 1800 deletions(-) (limited to 'OpenSim') 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 @@ -BEGIN; - -ALTER TABLE prims ADD COLUMN VolumeDetect INTEGER NOT NULL DEFAULT 0; - -COMMIT; +BEGIN; + +ALTER TABLE prims ADD COLUMN VolumeDetect INTEGER NOT NULL DEFAULT 0; + +COMMIT; 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 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace OpenSim.Framework.OpenJpeg -{ - public static class bio - { - - public static opj_bio bio_create() - { - opj_bio bio = new opj_bio(); - return bio; - } - - public static void bio_destroy(opj_bio bio) - { - // not needed on C# - } - - public static int bio_numbytes(opj_bio bio) - { - return (bio.bp - bio.start); - } - - public static void bio_init_enc(opj_bio bio, sbyte bp, int len) - { - bio.start = (byte)bp; - bio.end = (byte)(bp + (byte)len); - bio.bp = (byte)bp; - bio.buf = 0; - bio.ct = 8; - } - - public static void bio_init_dec(opj_bio bio, sbyte bp, int len) - { - bio.start = (byte)bp; - bio.end = (byte)(bp + len); - bio.bp = (byte)bp; - bio.buf = 0; - bio.ct = 0; - } - - public static void bio_write(opj_bio bio, int v, int n) - { - for (int i = n - 1; i >= 0; i--) - bio_putbit(bio, (v >> i) & 1); - } - - public static int bio_read(opj_bio bio, int n) - { - int v = 0; - for (int i = n - 1; i >= 0; i--) - v += bio_getbit(bio) << i; - - return v; - } - - public static int bio_flush(opj_bio bio) - { - bio.ct = 0; - if (bio_byteout(bio) != 0) - return 1; - - if (bio.ct == 7) - { - bio.ct = 0; - if (bio_byteout(bio) != 0) - return 1; - } - return 0; - } - - public static int bio_inalign(opj_bio bio) - { - bio.ct = 0; - if ((bio.buf & 0xff) == 0xff) - { - if (bio_bytein(bio) != 0) - return 1; - bio.ct = 0; - } - return 0; - } - - private static int bio_bytein(opj_bio bio) - { - bio.buf = (bio.buf << 8) & 0xffff; - bio.ct = bio.buf == 0xff00 ? 7 : 8; - if (bio.bp >= bio.end) - return 1; - bio.buf |= bio.bp++; - - return 0; - } - - private static int bio_byteout(opj_bio bio) - { - bio.buf = (bio.buf << 8) & 0xffff; - bio.ct = bio.buf == 0xff00 ? 7 : 8; - if (bio.bp >= bio.end) - return 1; - - bio.bp = (byte)(bio.buf >> 8); - bio.bp++; - return 0; - } - - private static void bio_putbit(opj_bio bio, int b) - { - if (bio.ct == 0) - bio_byteout(bio); - - bio.ct--; - bio.buf |= (byte)(b << bio.ct); - - } - - private static int bio_getbit(opj_bio bio) - { - if (bio.ct == 0) - bio_bytein(bio); - bio.ct--; - - return (int)((bio.buf >> bio.ct) & 1); - } - - } - - public struct opj_bio - { - public byte start; - public byte end; - public byte bp; - public uint buf; - public int ct; - } -} +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System; +using System.Collections.Generic; +using System.Text; + +namespace OpenSim.Framework.OpenJpeg +{ + public static class bio + { + public static opj_bio bio_create() + { + opj_bio bio = new opj_bio(); + return bio; + } + + public static void bio_destroy(opj_bio bio) + { + // not needed on C# + } + + public static int bio_numbytes(opj_bio bio) + { + return (bio.bp - bio.start); + } + + public static void bio_init_enc(opj_bio bio, sbyte bp, int len) + { + bio.start = (byte)bp; + bio.end = (byte)(bp + (byte)len); + bio.bp = (byte)bp; + bio.buf = 0; + bio.ct = 8; + } + + public static void bio_init_dec(opj_bio bio, sbyte bp, int len) + { + bio.start = (byte)bp; + bio.end = (byte)(bp + len); + bio.bp = (byte)bp; + bio.buf = 0; + bio.ct = 0; + } + + public static void bio_write(opj_bio bio, int v, int n) + { + for (int i = n - 1; i >= 0; i--) + bio_putbit(bio, (v >> i) & 1); + } + + public static int bio_read(opj_bio bio, int n) + { + int v = 0; + for (int i = n - 1; i >= 0; i--) + v += bio_getbit(bio) << i; + + return v; + } + + public static int bio_flush(opj_bio bio) + { + bio.ct = 0; + if (bio_byteout(bio) != 0) + return 1; + + if (bio.ct == 7) + { + bio.ct = 0; + if (bio_byteout(bio) != 0) + return 1; + } + return 0; + } + + public static int bio_inalign(opj_bio bio) + { + bio.ct = 0; + if ((bio.buf & 0xff) == 0xff) + { + if (bio_bytein(bio) != 0) + return 1; + bio.ct = 0; + } + return 0; + } + + private static int bio_bytein(opj_bio bio) + { + bio.buf = (bio.buf << 8) & 0xffff; + bio.ct = bio.buf == 0xff00 ? 7 : 8; + if (bio.bp >= bio.end) + return 1; + bio.buf |= bio.bp++; + + return 0; + } + + private static int bio_byteout(opj_bio bio) + { + bio.buf = (bio.buf << 8) & 0xffff; + bio.ct = bio.buf == 0xff00 ? 7 : 8; + if (bio.bp >= bio.end) + return 1; + + bio.bp = (byte)(bio.buf >> 8); + bio.bp++; + return 0; + } + + private static void bio_putbit(opj_bio bio, int b) + { + if (bio.ct == 0) + bio_byteout(bio); + + bio.ct--; + bio.buf |= (byte)(b << bio.ct); + } + + private static int bio_getbit(opj_bio bio) + { + if (bio.ct == 0) + bio_bytein(bio); + bio.ct--; + + return (int)((bio.buf >> bio.ct) & 1); + } + } + + public struct opj_bio + { + public byte start; + public byte end; + public byte bp; + public uint buf; + public int ct; + } +} 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 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace OpenSim.Framework.OpenJpeg -{ - public static class fix - { - public static int fix_mul(int a, int b) - { - long temp = (long)a * (long)b; - temp += temp & 4096; - return (int)(temp >> 13); - } - } -} +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System; +using System.Collections.Generic; +using System.Text; + +namespace OpenSim.Framework.OpenJpeg +{ + public static class fix + { + public static int fix_mul(int a, int b) + { + long temp = (long)a * (long)b; + temp += temp & 4096; + return (int)(temp >> 13); + } + } +} 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 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace OpenSim.Framework.OpenJpeg -{ - public static class int_ - { - public static int int_min(int a, int b) - { - return a < b ? a : b; - } - - public static int int_max(int a, int b) - { - return (a > b) ? a : b; - } - - public static int int_clamp(int a, int min, int max) - { - if (a < min) - return min; - if (a > max) - return max; - - return a; - } - - public static int int_abs(int a) - { - return a < 0 ? -a : a; - } - - public static int int_ceildiv(int a, int b) - { - return (a + b - 1) / b; - } - - public static int int_ceildivpow2(int a, int b) - { - return (a + (1 << b) - 1) >> b; - } - - public static int int_floordivpow2(int a, int b) - { - return a >> b; - } - - public static int int_floorlog2(int a) - { - for (int l=0; a > 1; l++) - a >>= 1; - - return 1; - } - - } -} +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System; +using System.Collections.Generic; +using System.Text; + +namespace OpenSim.Framework.OpenJpeg +{ + public static class int_ + { + public static int int_min(int a, int b) + { + return a < b ? a : b; + } + + public static int int_max(int a, int b) + { + return (a > b) ? a : b; + } + + public static int int_clamp(int a, int min, int max) + { + if (a < min) + return min; + if (a > max) + return max; + + return a; + } + + public static int int_abs(int a) + { + return a < 0 ? -a : a; + } + + public static int int_ceildiv(int a, int b) + { + return (a + b - 1) / b; + } + + public static int int_ceildivpow2(int a, int b) + { + return (a + (1 << b) - 1) >> b; + } + + public static int int_floordivpow2(int a, int b) + { + return a >> b; + } + + public static int int_floorlog2(int a) + { + for (int l=0; a > 1; l++) + a >>= 1; + + return 1; + } + } +} 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 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace OpenSim.Framework.OpenJpeg -{ - - public static class j2k - { - } - - public enum J2K_STATUS - { - J2K_STATE_MHSOC = 0x0001, /**< a SOC marker is expected */ - J2K_STATE_MHSIZ = 0x0002, /**< a SIZ marker is expected */ - J2K_STATE_MH = 0x0004, /**< the decoding process is in the main header */ - J2K_STATE_TPHSOT = 0x0008, /**< the decoding process is in a tile part header and expects a SOT marker */ - J2K_STATE_TPH = 0x0010, /**< the decoding process is in a tile part header */ - J2K_STATE_MT = 0x0020, /**< the EOC marker has just been read */ - J2K_STATE_NEOC = 0x0040, /**< the decoding process must not expect a EOC marker because the codestream is truncated */ - J2K_STATE_ERR = 0x0080 /**< the decoding process has encountered an error */ - } - - public enum J2K_T2_MODE - { - THRESH_CALC = 0, /** Function called in Rate allocation process*/ - FINAL_PASS = 1 /** Function called in Tier 2 process*/ - } - - public struct opj_stepsize - { - public int expn; - public int mant; - } - - public struct opj_tccp - { - public int csty; - public int numresolutions; - public int cblkw; - public int cblkh; - public int cblksty; - public int qmfbid; - public int qntsty; - /// - /// don't forget to initialize 97 elements - /// - public opj_stepsize[] stepsizes; - public int numgbits; - public int roishift; - /// - /// Don't forget to initialize 33 elements - /// - public int[] prcw; - - } - - public struct opj_tcp - { - public int first; - public int csty; - public PROG_ORDER prg; - public int numlayers; - public int mct; - /// - /// don't forget to initialize to 100 - /// - public float[] rates; - public int numpocs; - public int POC; - /// - /// Don't forget to initialize to 32 - /// - public opj_poc[] pocs; - public byte ppt_data; - public byte ppt_data_first; - public int ppt; - public int ppt_store; - public int ppt_len; - /// - /// Don't forget to initialize 100 elements - /// - public float[] distoratio; - public opj_tccp tccps; - - } - - public struct opj_cp - { - public CINEMA_MODE cinema; - public int max_comp_size; - public int img_size; - public RSIZ_CAPABILITIES rsiz; - public sbyte tp_on; - public sbyte tp_flag; - public int tp_pos; - public int distro_alloc; - public int fixed_alloc; - public int fixed_quality; - public int reduce; - public int layer; - public LIMIT_DECODING limit_decoding; - public int tx0; - public int ty0; - public int tdx; - public int tdy; - public sbyte? comment; - public int tw; - public int th; - public int? tileno; - public byte ppm_data; - public byte ppm_data_first; - public int ppm; - public int ppm_store; - public int ppm_previous; - public int ppm_len; - public opj_tcp tcps; - public int matrice; - } - - public static class j2kdefines - { +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System; +using System.Collections.Generic; +using System.Text; + +namespace OpenSim.Framework.OpenJpeg +{ + public static class j2k + { + } + + public enum J2K_STATUS + { + J2K_STATE_MHSOC = 0x0001, /**< a SOC marker is expected */ + J2K_STATE_MHSIZ = 0x0002, /**< a SIZ marker is expected */ + J2K_STATE_MH = 0x0004, /**< the decoding process is in the main header */ + J2K_STATE_TPHSOT = 0x0008, /**< the decoding process is in a tile part header and expects a SOT marker */ + J2K_STATE_TPH = 0x0010, /**< the decoding process is in a tile part header */ + J2K_STATE_MT = 0x0020, /**< the EOC marker has just been read */ + J2K_STATE_NEOC = 0x0040, /**< the decoding process must not expect a EOC marker because the codestream is truncated */ + J2K_STATE_ERR = 0x0080 /**< the decoding process has encountered an error */ + } + + public enum J2K_T2_MODE + { + THRESH_CALC = 0, /** Function called in Rate allocation process*/ + FINAL_PASS = 1 /** Function called in Tier 2 process*/ + } + + public struct opj_stepsize + { + public int expn; + public int mant; + } + + public struct opj_tccp + { + public int csty; + public int numresolutions; + public int cblkw; + public int cblkh; + public int cblksty; + public int qmfbid; + public int qntsty; + /// + /// don't forget to initialize 97 elements + /// + public opj_stepsize[] stepsizes; + public int numgbits; + public int roishift; + /// + /// Don't forget to initialize 33 elements + /// + public int[] prcw; + } + + public struct opj_tcp + { + public int first; + public int csty; + public PROG_ORDER prg; + public int numlayers; + public int mct; + /// + /// don't forget to initialize to 100 + /// + public float[] rates; + public int numpocs; + public int POC; + /// + /// Don't forget to initialize to 32 + /// + public opj_poc[] pocs; + public byte ppt_data; + public byte ppt_data_first; + public int ppt; + public int ppt_store; + public int ppt_len; + /// + /// Don't forget to initialize 100 elements + /// + public float[] distoratio; + public opj_tccp tccps; + } + + public struct opj_cp + { + public CINEMA_MODE cinema; + public int max_comp_size; + public int img_size; + public RSIZ_CAPABILITIES rsiz; + public sbyte tp_on; + public sbyte tp_flag; + public int tp_pos; + public int distro_alloc; + public int fixed_alloc; + public int fixed_quality; + public int reduce; + public int layer; + public LIMIT_DECODING limit_decoding; + public int tx0; + public int ty0; + public int tdx; + public int tdy; + public sbyte? comment; + public int tw; + public int th; + public int? tileno; + public byte ppm_data; + public byte ppm_data_first; + public int ppm; + public int ppm_store; + public int ppm_previous; + public int ppm_len; + public opj_tcp tcps; + public int matrice; + } + + public static class j2kdefines + { public const uint J2K_CP_CSTY_PRT = 0x01; public const uint J2K_CP_CSTY_SOP = 0x02; public const uint J2K_CP_CSTY_EPH = 0x04; @@ -131,28 +155,28 @@ namespace OpenSim.Framework.OpenJpeg public const uint J2K_CCP_CBLKSTY_PTERM =0x10; public const uint J2K_CCP_CBLKSTY_SEGSYM = 0x20; public const uint J2K_CCP_QNTSTY_NOQNT = 0; - public const uint J2K_CCP_QNTSTY_SIQNT = 1; - public const uint J2K_CCP_QNTSTY_SEQNT = 2; - - public const uint J2K_MS_SOC = 0xff4f; /**< SOC marker value */ - public const uint J2K_MS_SOT = 0xff90; /**< SOT marker value */ - public const uint J2K_MS_SOD = 0xff93; /**< SOD marker value */ - public const uint J2K_MS_EOC = 0xffd9; /**< EOC marker value */ - public const uint J2K_MS_SIZ = 0xff51; /**< SIZ marker value */ - public const uint J2K_MS_COD = 0xff52; /**< COD marker value */ - public const uint J2K_MS_COC = 0xff53; /**< COC marker value */ - public const uint J2K_MS_RGN = 0xff5e; /**< RGN marker value */ - public const uint J2K_MS_QCD = 0xff5c; /**< QCD marker value */ - public const uint J2K_MS_QCC = 0xff5d; /**< QCC marker value */ - public const uint J2K_MS_POC = 0xff5f; /**< POC marker value */ - public const uint J2K_MS_TLM = 0xff55; /**< TLM marker value */ - public const uint J2K_MS_PLM = 0xff57; /**< PLM marker value */ - public const uint J2K_MS_PLT = 0xff58; /**< PLT marker value */ - public const uint J2K_MS_PPM = 0xff60; /**< PPM marker value */ - public const uint J2K_MS_PPT = 0xff61; /**< PPT marker value */ - public const uint J2K_MS_SOP = 0xff91; /**< SOP marker value */ - public const uint J2K_MS_EPH = 0xff92; /**< EPH marker value */ - public const uint J2K_MS_CRG = 0xff63; /**< CRG marker value */ - public const uint J2K_MS_COM = 0xff64; /**< COM marker value */ - } -} + public const uint J2K_CCP_QNTSTY_SIQNT = 1; + public const uint J2K_CCP_QNTSTY_SEQNT = 2; + + public const uint J2K_MS_SOC = 0xff4f; /**< SOC marker value */ + public const uint J2K_MS_SOT = 0xff90; /**< SOT marker value */ + public const uint J2K_MS_SOD = 0xff93; /**< SOD marker value */ + public const uint J2K_MS_EOC = 0xffd9; /**< EOC marker value */ + public const uint J2K_MS_SIZ = 0xff51; /**< SIZ marker value */ + public const uint J2K_MS_COD = 0xff52; /**< COD marker value */ + public const uint J2K_MS_COC = 0xff53; /**< COC marker value */ + public const uint J2K_MS_RGN = 0xff5e; /**< RGN marker value */ + public const uint J2K_MS_QCD = 0xff5c; /**< QCD marker value */ + public const uint J2K_MS_QCC = 0xff5d; /**< QCC marker value */ + public const uint J2K_MS_POC = 0xff5f; /**< POC marker value */ + public const uint J2K_MS_TLM = 0xff55; /**< TLM marker value */ + public const uint J2K_MS_PLM = 0xff57; /**< PLM marker value */ + public const uint J2K_MS_PLT = 0xff58; /**< PLT marker value */ + public const uint J2K_MS_PPM = 0xff60; /**< PPM marker value */ + public const uint J2K_MS_PPT = 0xff61; /**< PPT marker value */ + public const uint J2K_MS_SOP = 0xff91; /**< SOP marker value */ + public const uint J2K_MS_EPH = 0xff92; /**< EPH marker value */ + public const uint J2K_MS_CRG = 0xff63; /**< CRG marker value */ + public const uint J2K_MS_COM = 0xff64; /**< COM marker value */ + } +} 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 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace OpenSim.Framework.OpenJpeg -{ - public class openjpeg - { - public openjpeg() - { - - - } - } - - public enum PROG_ORDER - { - PROG_UNKNOWN = -1, - LRCP = 0, - RLCP = 1, - RPCL = 2, - PCRL = 3, - CPRL = 4 - } - - public enum RSIZ_CAPABILITIES - { - STD_RSIZ = 0, - CINEMA2K = 3, - CINEMA4K = 4 - } - - public enum CINEMA_MODE - { - OFF = 0, - CINEMA2K_24 = 1, - CINEMA2K_48 = 2, - CINEMA4K_24 = 3 - } - - public enum COLOR_SPACE - { - CLRSPC_UNKNOWN = -1, - CLRSPC_SRGB = 1, - CLRSPC_GRAY = 2, - CLRSPC_SYCC = 3 - } - - public enum CODEC_FORMAT - { - CODEC_UNKNOWN = -1, - CODEC_J2K = 0, - CODEC_JPT = 1, - CODEC_JP2 = 2 - } - - public enum LIMIT_DECODING - { - NO_LIMITATION = 0, - LIMIT_TO_MAIN_HEADER=1, - DECODE_ALL_BUT_PACKETS = 2 - } - - public struct opj_poc - { - public int resno0, compno0; - public int layno1, resno1, compno1; - public int layno0, precno0, precno1; - public PROG_ORDER prg1, prg; - /// - /// Don't forget to initialize with 5 elements - /// - public sbyte[] progorder; - public int tile; - public int tx0, tx1, ty0, ty1; - public int layS, resS, copmS, prcS; - public int layE, resE, compE, prcE; - public int txS, txE, tyS, tyE, dx, dy; - public int lay_t, res_t, comp_t, prc_t, tx0_t, ty0_t; - } - - public struct opj_cparameters - { - public bool tile_size_on; - public int cp_tx0; - public int cp_ty0; - public int cp_tdx; - public int cp_tdy; - public int cp_disto_alloc; - public int cp_fixed_alloc; - public int cp_fixed_wuality; - public int cp_matrice; - public sbyte cp_comment; - public int csty; - public PROG_ORDER prog_order; - - /// - /// Don't forget to initialize 32 elements - /// - public opj_poc[] POC; - public int numpocs; - public int tcp_numlayers; - /// - /// Don't forget to intitialize 100 elements - /// - public float[] tcp_rates; - /// - /// Don't forget to initialize 100 elements - /// - public float[] tcp_distoratio; - public int numresolution; - public int cblockw_init; - public int cblockh_init; - public int mode; - public int irreversible; - public int roi_compno; - public int roi_shift; - public int res_spec; - - /// - /// Don't forget to initialize 33 elements - /// - public int[] prc_init; - /// - /// Don't forget to initialize 33 elements - /// - public int[] prch_init; - - public string infile; - public string outfile; - public int index_on; - public string index; - public int image_offset_x0; - public int image_offset_y0; - public int subsampling_dx; - public int subsampling_dy; - public int decod_format; - public int cod_format; - public bool jpwl_epc_on; - public int jpwl_hprot_MH; - /// - /// Don't forget to initialize 16 elements - /// - public int[] jpwl_hprot_TPH_tileno; - /// - /// Don't forget to initialize 16 elements - /// - public int[] jpwl_hprot_TPH; - - /// - /// Don't forget to initialize 16 elements - /// - public int[] jpwl_pprot_tileno; - public int[] jpwl_pprot_packno; - public int[] jpwl_pprot; - public int jpwl_sens_size; - public int jpwl_sense_addr; - public int jpwl_sens_range; - public int jpwl_sens_MH; - - /// - /// Don't forget to initialize 16 elements - /// - public int[] jpwl_sens_TPH_tileno; - - /// - /// Don't forget to initialize 16 elements - /// - public int[] jpwl_sens_TPH; - public CINEMA_MODE cp_cinema; - public int max_comp_size; - public sbyte tp_on; - public sbyte tp_flag; - public sbyte tcp_mct; - } - - public struct opj_dparameters - { - public int cp_reduce; - public int cp_layer; - public string infile; - public string outfile; - public int decod_format; - public int cod_format; - public bool jpwl_correct; - public int jpwl_exp_comps; - public int jpwl_max_tiles; - public LIMIT_DECODING cp_limit_decoding; - - } - - public struct opj_common_fields - { - public bool is_decompressor; - public CODEC_FORMAT codec_format; - } - - public struct opj_common_struct - { - public opj_common_fields flds; - } - - public struct opj_cinfo - { - public opj_common_fields flds; - } - public struct opj_dinfo - { - public opj_common_fields flds; - } - - public struct opj_cio - { - public opj_common_struct cinfo; - public int openmode; - public byte buffer; - public int length; - public byte start; - public byte end; - public byte bp; - } - - public struct opj_image_comp - { - public int dx; - public int dy; - public int w; - public int h; - public int x0; - public int y0; - public int prec; - public int bpp; - public int sgnd; - public int resno_decoded; - public int factor; - public int data; - } - - public struct opj_image - { - public int x0; - public int y0; - public int x1; - public int y1; - public int numcomps; - public COLOR_SPACE color_space; - public opj_image_comp comps; - } - - public struct opj_image_comptparm - { - public int dx; - public int dy; - public int w; - public int h; - public int x0; - public int y0; - public int prec; - public int bpp; - public int sgnd; - } - - public struct opj_packet_info - { - public int start_pos; - public int end_ph_pos; - public int end_pos; - public double disto; - } - - public struct opj_tp_info - { - public int tp_start_pos; - public int tp_end_header; - public int tp_end_pos; - public int tp_start_pack; - public int tp_numpacks; - } - - public struct opj_tile_info - { - public double thresh; - public int tileno; - public int start_pos; - public int end_header; - public int end_pos; - /// - /// Don't forget to initialize 33 elements - /// - public int[] pw; - /// - /// Don't forget to initialize 33 elements - /// - public int[] ph; - /// - /// Don't forget to initialize 33 elements - /// - public int[] pdx; - /// - /// Don't forget to initialize 33 elements - /// - public int[] pdy; - - public opj_packet_info packet; - public int numpix; - public double distotile; - public int num_tps; - public opj_tp_info tp; - } - - public struct opj_marker_info_t - { - public ushort type; - public int pos; - public int len; - } - - public struct opj_codestream_info - { - public double D_max; - public int packno; - public int index_write; - public int image_w; - public int image_h; - - public PROG_ORDER prog; - - public int tile_x; - public int tile_y; - public int tile_Ox; - public int tile_Oy; - public int tw; - public int numcomps; - public int numlayers; - public int numdecompos; - public int marknum; - public opj_marker_info_t marker; - public int maxmarknum; - public int main_head_start; - public int main_head_end; - public int codestream_size; - public opj_tile_info tile; - - } - - - - - - - public static class opj_defines - { - public const int OPJ_STREAM_READ = 0x0001; - public const int OPJ_STREAM_WRITE = 0x0002; - - } - -} +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System; +using System.Collections.Generic; +using System.Text; + +namespace OpenSim.Framework.OpenJpeg +{ + public class openjpeg + { + public openjpeg() + { + } + } + + public enum PROG_ORDER + { + PROG_UNKNOWN = -1, + LRCP = 0, + RLCP = 1, + RPCL = 2, + PCRL = 3, + CPRL = 4 + } + + public enum RSIZ_CAPABILITIES + { + STD_RSIZ = 0, + CINEMA2K = 3, + CINEMA4K = 4 + } + + public enum CINEMA_MODE + { + OFF = 0, + CINEMA2K_24 = 1, + CINEMA2K_48 = 2, + CINEMA4K_24 = 3 + } + + public enum COLOR_SPACE + { + CLRSPC_UNKNOWN = -1, + CLRSPC_SRGB = 1, + CLRSPC_GRAY = 2, + CLRSPC_SYCC = 3 + } + + public enum CODEC_FORMAT + { + CODEC_UNKNOWN = -1, + CODEC_J2K = 0, + CODEC_JPT = 1, + CODEC_JP2 = 2 + } + + public enum LIMIT_DECODING + { + NO_LIMITATION = 0, + LIMIT_TO_MAIN_HEADER=1, + DECODE_ALL_BUT_PACKETS = 2 + } + + public struct opj_poc + { + public int resno0, compno0; + public int layno1, resno1, compno1; + public int layno0, precno0, precno1; + public PROG_ORDER prg1, prg; + /// + /// Don't forget to initialize with 5 elements + /// + public sbyte[] progorder; + public int tile; + public int tx0, tx1, ty0, ty1; + public int layS, resS, copmS, prcS; + public int layE, resE, compE, prcE; + public int txS, txE, tyS, tyE, dx, dy; + public int lay_t, res_t, comp_t, prc_t, tx0_t, ty0_t; + } + + public struct opj_cparameters + { + public bool tile_size_on; + public int cp_tx0; + public int cp_ty0; + public int cp_tdx; + public int cp_tdy; + public int cp_disto_alloc; + public int cp_fixed_alloc; + public int cp_fixed_wuality; + public int cp_matrice; + public sbyte cp_comment; + public int csty; + public PROG_ORDER prog_order; + + /// + /// Don't forget to initialize 32 elements + /// + public opj_poc[] POC; + public int numpocs; + public int tcp_numlayers; + /// + /// Don't forget to intitialize 100 elements + /// + public float[] tcp_rates; + /// + /// Don't forget to initialize 100 elements + /// + public float[] tcp_distoratio; + public int numresolution; + public int cblockw_init; + public int cblockh_init; + public int mode; + public int irreversible; + public int roi_compno; + public int roi_shift; + public int res_spec; + + /// + /// Don't forget to initialize 33 elements + /// + public int[] prc_init; + /// + /// Don't forget to initialize 33 elements + /// + public int[] prch_init; + + public string infile; + public string outfile; + public int index_on; + public string index; + public int image_offset_x0; + public int image_offset_y0; + public int subsampling_dx; + public int subsampling_dy; + public int decod_format; + public int cod_format; + public bool jpwl_epc_on; + public int jpwl_hprot_MH; + /// + /// Don't forget to initialize 16 elements + /// + public int[] jpwl_hprot_TPH_tileno; + /// + /// Don't forget to initialize 16 elements + /// + public int[] jpwl_hprot_TPH; + + /// + /// Don't forget to initialize 16 elements + /// + public int[] jpwl_pprot_tileno; + public int[] jpwl_pprot_packno; + public int[] jpwl_pprot; + public int jpwl_sens_size; + public int jpwl_sense_addr; + public int jpwl_sens_range; + public int jpwl_sens_MH; + + /// + /// Don't forget to initialize 16 elements + /// + public int[] jpwl_sens_TPH_tileno; + + /// + /// Don't forget to initialize 16 elements + /// + public int[] jpwl_sens_TPH; + public CINEMA_MODE cp_cinema; + public int max_comp_size; + public sbyte tp_on; + public sbyte tp_flag; + public sbyte tcp_mct; + } + + public struct opj_dparameters + { + public int cp_reduce; + public int cp_layer; + public string infile; + public string outfile; + public int decod_format; + public int cod_format; + public bool jpwl_correct; + public int jpwl_exp_comps; + public int jpwl_max_tiles; + public LIMIT_DECODING cp_limit_decoding; + } + + public struct opj_common_fields + { + public bool is_decompressor; + public CODEC_FORMAT codec_format; + } + + public struct opj_common_struct + { + public opj_common_fields flds; + } + + public struct opj_cinfo + { + public opj_common_fields flds; + } + + public struct opj_dinfo + { + public opj_common_fields flds; + } + + public struct opj_cio + { + public opj_common_struct cinfo; + public int openmode; + public byte buffer; + public int length; + public byte start; + public byte end; + public byte bp; + } + + public struct opj_image_comp + { + public int dx; + public int dy; + public int w; + public int h; + public int x0; + public int y0; + public int prec; + public int bpp; + public int sgnd; + public int resno_decoded; + public int factor; + public int data; + } + + public struct opj_image + { + public int x0; + public int y0; + public int x1; + public int y1; + public int numcomps; + public COLOR_SPACE color_space; + public opj_image_comp comps; + } + + public struct opj_image_comptparm + { + public int dx; + public int dy; + public int w; + public int h; + public int x0; + public int y0; + public int prec; + public int bpp; + public int sgnd; + } + + public struct opj_packet_info + { + public int start_pos; + public int end_ph_pos; + public int end_pos; + public double disto; + } + + public struct opj_tp_info + { + public int tp_start_pos; + public int tp_end_header; + public int tp_end_pos; + public int tp_start_pack; + public int tp_numpacks; + } + + public struct opj_tile_info + { + public double thresh; + public int tileno; + public int start_pos; + public int end_header; + public int end_pos; + /// + /// Don't forget to initialize 33 elements + /// + public int[] pw; + /// + /// Don't forget to initialize 33 elements + /// + public int[] ph; + /// + /// Don't forget to initialize 33 elements + /// + public int[] pdx; + /// + /// Don't forget to initialize 33 elements + /// + public int[] pdy; + + public opj_packet_info packet; + public int numpix; + public double distotile; + public int num_tps; + public opj_tp_info tp; + } + + public struct opj_marker_info_t + { + public ushort type; + public int pos; + public int len; + } + + public struct opj_codestream_info + { + public double D_max; + public int packno; + public int index_write; + public int image_w; + public int image_h; + + public PROG_ORDER prog; + + public int tile_x; + public int tile_y; + public int tile_Ox; + public int tile_Oy; + public int tw; + public int numcomps; + public int numlayers; + public int numdecompos; + public int marknum; + public opj_marker_info_t marker; + public int maxmarknum; + public int main_head_start; + public int main_head_end; + public int codestream_size; + public opj_tile_info tile; + } + + public static class opj_defines + { + public const int OPJ_STREAM_READ = 0x0001; + public const int OPJ_STREAM_WRITE = 0x0002; + } +} 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 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace OpenSim.Framework.OpenJpeg -{ - public static class pi - { - } - - public struct opj_pi_resolution - { - public int pdx, pdy; - public int pw, ph; - } - - public struct opj_pi_comp - { - public int dx, dy; - public int numresolutions; - public opj_pi_resolution resolutions; - } - - public struct obj_pi_iterator - { - public sbyte tp_on; - public short include; - public int step_l; - public int step_r; - public int step_c; - public int step_p; - public int compno; - public int resno; - public int precno; - public int layno; - public int first; - public opj_poc poc; - public int numcomps; - public opj_pi_comp comps; - - public int tx0, ty0, tx1, ty1; - public int x, y, dx, dy; - } - - - - -} +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System; +using System.Collections.Generic; +using System.Text; + +namespace OpenSim.Framework.OpenJpeg +{ + public static class pi + { + } + + public struct opj_pi_resolution + { + public int pdx, pdy; + public int pw, ph; + } + + public struct opj_pi_comp + { + public int dx, dy; + public int numresolutions; + public opj_pi_resolution resolutions; + } + + public struct obj_pi_iterator + { + public sbyte tp_on; + public short include; + public int step_l; + public int step_r; + public int step_c; + public int step_p; + public int compno; + public int resno; + public int precno; + public int layno; + public int first; + public opj_poc poc; + public int numcomps; + public opj_pi_comp comps; + + public int tx0, ty0, tx1, ty1; + public int x, y, dx, dy; + } +} 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 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSim Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System; -using System.Collections.Generic; -using System.Collections.Specialized; -using System.IO; -using System.Net; -using System.Web; -using System.Text; -using DotNetOpenId; -using DotNetOpenId.Provider; -using log4net; -using OpenSim.Framework; -using OpenSim.Framework.Servers; - -namespace OpenSim.Grid.UserServer -{ - /// - /// Temporary, in-memory store for OpenID associations - /// - public class ProviderMemoryStore : IAssociationStore - { - private class AssociationItem - { - public AssociationRelyingPartyType DistinguishingFactor; - public string Handle; - public DateTime Expires; - public byte[] PrivateData; - } - - Dictionary m_store = new Dictionary(); - SortedList m_sortedStore = new SortedList(); - object m_syncRoot = new object(); - - #region IAssociationStore Members - - public void StoreAssociation(AssociationRelyingPartyType distinguishingFactor, Association assoc) - { - AssociationItem item = new AssociationItem(); - item.DistinguishingFactor = distinguishingFactor; - item.Handle = assoc.Handle; - item.Expires = assoc.Expires.ToLocalTime(); - item.PrivateData = assoc.SerializePrivateData(); - - lock (m_syncRoot) - { - m_store[item.Handle] = item; - m_sortedStore[item.Expires] = item; - } - } - - public Association GetAssociation(AssociationRelyingPartyType distinguishingFactor) - { - lock (m_syncRoot) - { - if (m_sortedStore.Count > 0) - { - AssociationItem item = m_sortedStore.Values[m_sortedStore.Count - 1]; - return Association.Deserialize(item.Handle, item.Expires.ToUniversalTime(), item.PrivateData); - } - else - { - return null; - } - } - } - - public Association GetAssociation(AssociationRelyingPartyType distinguishingFactor, string handle) - { - AssociationItem item; - bool success = false; - lock (m_syncRoot) - success = m_store.TryGetValue(handle, out item); - - if (success) - return Association.Deserialize(item.Handle, item.Expires.ToUniversalTime(), item.PrivateData); - else - return null; - } - - public bool RemoveAssociation(AssociationRelyingPartyType distinguishingFactor, string handle) - { - lock (m_syncRoot) - { - for (int i = 0; i < m_sortedStore.Values.Count; i++) - { - AssociationItem item = m_sortedStore.Values[i]; - if (item.Handle == handle) - { - m_sortedStore.RemoveAt(i); - break; - } - } - - return m_store.Remove(handle); - } - } - - public void ClearExpiredAssociations() - { - lock (m_syncRoot) - { - List itemsCopy = new List(m_sortedStore.Values); - DateTime now = DateTime.Now; - - for (int i = 0; i < itemsCopy.Count; i++) - { - AssociationItem item = itemsCopy[i]; - - if (item.Expires <= now) - { - m_sortedStore.RemoveAt(i); - m_store.Remove(item.Handle); - } - } - } - } - - #endregion - } - - public class OpenIdStreamHandler : IStreamHandler - { - #region HTML - - /// Login form used to authenticate OpenID requests - const string LOGIN_PAGE = -@" -OpenSim OpenID Login - -

OpenSim Login

-
- - - - -
- -"; - - /// Page shown for a valid OpenID identity - const string OPENID_PAGE = -@" - -{2} {3} - - -OpenID identifier for {2} {3} - -"; - - /// Page shown for an invalid OpenID identity - const string INVALID_OPENID_PAGE = -@"Identity not found -Invalid OpenID identity"; - - /// Page shown if the OpenID endpoint is requested directly - const string ENDPOINT_PAGE = -@"OpenID Endpoint -This is an OpenID server endpoint, not a human-readable resource. -For more information, see http://openid.net/. -"; - - #endregion HTML - - public string ContentType { get { return m_contentType; } } - public string HttpMethod { get { return m_httpMethod; } } - public string Path { get { return m_path; } } - - string m_contentType; - string m_httpMethod; - string m_path; - UserLoginService m_loginService; - ProviderMemoryStore m_openidStore = new ProviderMemoryStore(); - - /// - /// Constructor - /// - public OpenIdStreamHandler(string httpMethod, string path, UserLoginService loginService) - { - m_loginService = loginService; - m_httpMethod = httpMethod; - m_path = path; - - m_contentType = "text/html"; - } - - /// - /// Handles all GET and POST requests for OpenID identifier pages and endpoint - /// server communication - /// - public void Handle(string path, Stream request, Stream response, OSHttpRequest httpRequest, OSHttpResponse httpResponse) - { - Uri providerEndpoint = new Uri(String.Format("{0}://{1}{2}", httpRequest.Url.Scheme, httpRequest.Url.Authority, httpRequest.Url.AbsolutePath)); - - // Defult to returning HTML content - m_contentType = "text/html"; - - try - { - NameValueCollection postQuery = HttpUtility.ParseQueryString(new StreamReader(httpRequest.InputStream).ReadToEnd()); - NameValueCollection getQuery = HttpUtility.ParseQueryString(httpRequest.Url.Query); - NameValueCollection openIdQuery = (postQuery.GetValues("openid.mode") != null ? postQuery : getQuery); - - OpenIdProvider provider = new OpenIdProvider(m_openidStore, providerEndpoint, httpRequest.Url, openIdQuery); - - if (provider.Request != null) - { - if (!provider.Request.IsResponseReady && provider.Request is IAuthenticationRequest) - { - IAuthenticationRequest authRequest = (IAuthenticationRequest)provider.Request; - string[] passwordValues = postQuery.GetValues("pass"); - - UserProfileData profile; - if (TryGetProfile(new Uri(authRequest.ClaimedIdentifier.ToString()), out profile)) - { - // Check for form POST data - if (passwordValues != null && passwordValues.Length == 1) - { - if (profile != null && m_loginService.AuthenticateUser(profile, passwordValues[0])) - authRequest.IsAuthenticated = true; - else - authRequest.IsAuthenticated = false; - } - else - { - // Authentication was requested, send the client a login form - using (StreamWriter writer = new StreamWriter(response)) - writer.Write(String.Format(LOGIN_PAGE, profile.FirstName, profile.SurName)); - return; - } - } - else - { - // Cannot find an avatar matching the claimed identifier - authRequest.IsAuthenticated = false; - } - } - - // Add OpenID headers to the response - foreach (string key in provider.Request.Response.Headers.Keys) - httpResponse.AddHeader(key, provider.Request.Response.Headers[key]); - - string[] contentTypeValues = provider.Request.Response.Headers.GetValues("Content-Type"); - if (contentTypeValues != null && contentTypeValues.Length == 1) - m_contentType = contentTypeValues[0]; - - // Set the response code and document body based on the OpenID result - httpResponse.StatusCode = (int)provider.Request.Response.Code; - response.Write(provider.Request.Response.Body, 0, provider.Request.Response.Body.Length); - response.Close(); - } - else if (httpRequest.Url.AbsolutePath.Contains("/openid/server")) - { - // Standard HTTP GET was made on the OpenID endpoint, send the client the default error page - using (StreamWriter writer = new StreamWriter(response)) - writer.Write(ENDPOINT_PAGE); - } - else - { - // Try and lookup this avatar - UserProfileData profile; - if (TryGetProfile(httpRequest.Url, out profile)) - { - using (StreamWriter writer = new StreamWriter(response)) - { - // TODO: Print out a full profile page for this avatar - writer.Write(String.Format(OPENID_PAGE, httpRequest.Url.Scheme, - httpRequest.Url.Authority, profile.FirstName, profile.SurName)); - } - } - else - { - // Couldn't parse an avatar name, or couldn't find the avatar in the user server - using (StreamWriter writer = new StreamWriter(response)) - writer.Write(INVALID_OPENID_PAGE); - } - } - } - catch (Exception ex) - { - httpResponse.StatusCode = (int)HttpStatusCode.InternalServerError; - using (StreamWriter writer = new StreamWriter(response)) - writer.Write(ex.Message); - } - } - - /// - /// Parse a URL with a relative path of the form /users/First_Last and try to - /// retrieve the profile matching that avatar name - /// - /// URL to parse for an avatar name - /// Profile data for the avatar - /// True if the parse and lookup were successful, otherwise false - bool TryGetProfile(Uri requestUrl, out UserProfileData profile) - { - if (requestUrl.Segments.Length == 3 && requestUrl.Segments[1] == "users/") - { - // Parse the avatar name from the path - string username = requestUrl.Segments[requestUrl.Segments.Length - 1]; - string[] name = username.Split('_'); - - if (name.Length == 2) - { - profile = m_loginService.GetTheUser(name[0], name[1]); - return (profile != null); - } - } - - profile = null; - return false; - } - } -} +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSim Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System; +using System.Collections.Generic; +using System.Collections.Specialized; +using System.IO; +using System.Net; +using System.Web; +using System.Text; +using DotNetOpenId; +using DotNetOpenId.Provider; +using log4net; +using OpenSim.Framework; +using OpenSim.Framework.Servers; + +namespace OpenSim.Grid.UserServer +{ + /// + /// Temporary, in-memory store for OpenID associations + /// + public class ProviderMemoryStore : IAssociationStore + { + private class AssociationItem + { + public AssociationRelyingPartyType DistinguishingFactor; + public string Handle; + public DateTime Expires; + public byte[] PrivateData; + } + + Dictionary m_store = new Dictionary(); + SortedList m_sortedStore = new SortedList(); + object m_syncRoot = new object(); + + #region IAssociationStore Members + + public void StoreAssociation(AssociationRelyingPartyType distinguishingFactor, Association assoc) + { + AssociationItem item = new AssociationItem(); + item.DistinguishingFactor = distinguishingFactor; + item.Handle = assoc.Handle; + item.Expires = assoc.Expires.ToLocalTime(); + item.PrivateData = assoc.SerializePrivateData(); + + lock (m_syncRoot) + { + m_store[item.Handle] = item; + m_sortedStore[item.Expires] = item; + } + } + + public Association GetAssociation(AssociationRelyingPartyType distinguishingFactor) + { + lock (m_syncRoot) + { + if (m_sortedStore.Count > 0) + { + AssociationItem item = m_sortedStore.Values[m_sortedStore.Count - 1]; + return Association.Deserialize(item.Handle, item.Expires.ToUniversalTime(), item.PrivateData); + } + else + { + return null; + } + } + } + + public Association GetAssociation(AssociationRelyingPartyType distinguishingFactor, string handle) + { + AssociationItem item; + bool success = false; + lock (m_syncRoot) + success = m_store.TryGetValue(handle, out item); + + if (success) + return Association.Deserialize(item.Handle, item.Expires.ToUniversalTime(), item.PrivateData); + else + return null; + } + + public bool RemoveAssociation(AssociationRelyingPartyType distinguishingFactor, string handle) + { + lock (m_syncRoot) + { + for (int i = 0; i < m_sortedStore.Values.Count; i++) + { + AssociationItem item = m_sortedStore.Values[i]; + if (item.Handle == handle) + { + m_sortedStore.RemoveAt(i); + break; + } + } + + return m_store.Remove(handle); + } + } + + public void ClearExpiredAssociations() + { + lock (m_syncRoot) + { + List itemsCopy = new List(m_sortedStore.Values); + DateTime now = DateTime.Now; + + for (int i = 0; i < itemsCopy.Count; i++) + { + AssociationItem item = itemsCopy[i]; + + if (item.Expires <= now) + { + m_sortedStore.RemoveAt(i); + m_store.Remove(item.Handle); + } + } + } + } + + #endregion + } + + public class OpenIdStreamHandler : IStreamHandler + { + #region HTML + + /// Login form used to authenticate OpenID requests + const string LOGIN_PAGE = +@" +OpenSim OpenID Login + +

OpenSim Login

+
+ + + + +
+ +"; + + /// Page shown for a valid OpenID identity + const string OPENID_PAGE = +@" + +{2} {3} + + +OpenID identifier for {2} {3} + +"; + + /// Page shown for an invalid OpenID identity + const string INVALID_OPENID_PAGE = +@"Identity not found +Invalid OpenID identity"; + + /// Page shown if the OpenID endpoint is requested directly + const string ENDPOINT_PAGE = +@"OpenID Endpoint +This is an OpenID server endpoint, not a human-readable resource. +For more information, see http://openid.net/. +"; + + #endregion HTML + + public string ContentType { get { return m_contentType; } } + public string HttpMethod { get { return m_httpMethod; } } + public string Path { get { return m_path; } } + + string m_contentType; + string m_httpMethod; + string m_path; + UserLoginService m_loginService; + ProviderMemoryStore m_openidStore = new ProviderMemoryStore(); + + /// + /// Constructor + /// + public OpenIdStreamHandler(string httpMethod, string path, UserLoginService loginService) + { + m_loginService = loginService; + m_httpMethod = httpMethod; + m_path = path; + + m_contentType = "text/html"; + } + + /// + /// Handles all GET and POST requests for OpenID identifier pages and endpoint + /// server communication + /// + public void Handle(string path, Stream request, Stream response, OSHttpRequest httpRequest, OSHttpResponse httpResponse) + { + Uri providerEndpoint = new Uri(String.Format("{0}://{1}{2}", httpRequest.Url.Scheme, httpRequest.Url.Authority, httpRequest.Url.AbsolutePath)); + + // Defult to returning HTML content + m_contentType = "text/html"; + + try + { + NameValueCollection postQuery = HttpUtility.ParseQueryString(new StreamReader(httpRequest.InputStream).ReadToEnd()); + NameValueCollection getQuery = HttpUtility.ParseQueryString(httpRequest.Url.Query); + NameValueCollection openIdQuery = (postQuery.GetValues("openid.mode") != null ? postQuery : getQuery); + + OpenIdProvider provider = new OpenIdProvider(m_openidStore, providerEndpoint, httpRequest.Url, openIdQuery); + + if (provider.Request != null) + { + if (!provider.Request.IsResponseReady && provider.Request is IAuthenticationRequest) + { + IAuthenticationRequest authRequest = (IAuthenticationRequest)provider.Request; + string[] passwordValues = postQuery.GetValues("pass"); + + UserProfileData profile; + if (TryGetProfile(new Uri(authRequest.ClaimedIdentifier.ToString()), out profile)) + { + // Check for form POST data + if (passwordValues != null && passwordValues.Length == 1) + { + if (profile != null && m_loginService.AuthenticateUser(profile, passwordValues[0])) + authRequest.IsAuthenticated = true; + else + authRequest.IsAuthenticated = false; + } + else + { + // Authentication was requested, send the client a login form + using (StreamWriter writer = new StreamWriter(response)) + writer.Write(String.Format(LOGIN_PAGE, profile.FirstName, profile.SurName)); + return; + } + } + else + { + // Cannot find an avatar matching the claimed identifier + authRequest.IsAuthenticated = false; + } + } + + // Add OpenID headers to the response + foreach (string key in provider.Request.Response.Headers.Keys) + httpResponse.AddHeader(key, provider.Request.Response.Headers[key]); + + string[] contentTypeValues = provider.Request.Response.Headers.GetValues("Content-Type"); + if (contentTypeValues != null && contentTypeValues.Length == 1) + m_contentType = contentTypeValues[0]; + + // Set the response code and document body based on the OpenID result + httpResponse.StatusCode = (int)provider.Request.Response.Code; + response.Write(provider.Request.Response.Body, 0, provider.Request.Response.Body.Length); + response.Close(); + } + else if (httpRequest.Url.AbsolutePath.Contains("/openid/server")) + { + // Standard HTTP GET was made on the OpenID endpoint, send the client the default error page + using (StreamWriter writer = new StreamWriter(response)) + writer.Write(ENDPOINT_PAGE); + } + else + { + // Try and lookup this avatar + UserProfileData profile; + if (TryGetProfile(httpRequest.Url, out profile)) + { + using (StreamWriter writer = new StreamWriter(response)) + { + // TODO: Print out a full profile page for this avatar + writer.Write(String.Format(OPENID_PAGE, httpRequest.Url.Scheme, + httpRequest.Url.Authority, profile.FirstName, profile.SurName)); + } + } + else + { + // Couldn't parse an avatar name, or couldn't find the avatar in the user server + using (StreamWriter writer = new StreamWriter(response)) + writer.Write(INVALID_OPENID_PAGE); + } + } + } + catch (Exception ex) + { + httpResponse.StatusCode = (int)HttpStatusCode.InternalServerError; + using (StreamWriter writer = new StreamWriter(response)) + writer.Write(ex.Message); + } + } + + /// + /// Parse a URL with a relative path of the form /users/First_Last and try to + /// retrieve the profile matching that avatar name + /// + /// URL to parse for an avatar name + /// Profile data for the avatar + /// True if the parse and lookup were successful, otherwise false + bool TryGetProfile(Uri requestUrl, out UserProfileData profile) + { + if (requestUrl.Segments.Length == 3 && requestUrl.Segments[1] == "users/") + { + // Parse the avatar name from the path + string username = requestUrl.Segments[requestUrl.Segments.Length - 1]; + string[] name = username.Split('_'); + + if (name.Length == 2) + { + profile = m_loginService.GetTheUser(name[0], name[1]); + return (profile != null); + } + } + + profile = null; + return false; + } + } +} 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 ap.Data = new AvatarPicksReplyPacket.DataBlock[picks.Count]; int i = 0; - foreach(KeyValuePair pick in picks) + foreach (KeyValuePair pick in picks) { ap.Data[i] = new AvatarPicksReplyPacket.DataBlock(); ap.Data[i].PickID = pick.Key; @@ -8272,7 +8272,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP ac.Data = new AvatarClassifiedReplyPacket.DataBlock[classifieds.Count]; int i = 0; - foreach(KeyValuePair classified in classifieds) + foreach (KeyValuePair classified in classifieds) { ac.Data[i] = new AvatarClassifiedReplyPacket.DataBlock(); 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 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSim Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System; -using OpenSim.Framework; -using OpenMetaverse; - -namespace OpenSim.Region.Environment.Interfaces -{ - public delegate bool ChildAgentUpdateReceived(AgentData data); - - public interface IInterregionCommsOut - { - bool SendChildAgentUpdate(ulong regionHandle, AgentData data); - } - - // This may not be needed, but having it here for now. - public interface IInterregionCommsIn - { - event ChildAgentUpdateReceived OnChildAgentUpdate; - } - -} +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSim Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System; +using OpenSim.Framework; +using OpenMetaverse; + +namespace OpenSim.Region.Environment.Interfaces +{ + public delegate bool ChildAgentUpdateReceived(AgentData data); + + public interface IInterregionCommsOut + { + bool SendChildAgentUpdate(ulong regionHandle, AgentData data); + } + + // This may not be needed, but having it here for now. + public interface IInterregionCommsIn + { + event ChildAgentUpdateReceived OnChildAgentUpdate; + } + +} 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 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSim Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Net; -using System.Net.Sockets; -using System.Reflection; -using System.Threading; -using System.Xml; -using OpenMetaverse; -using log4net; -using Nini.Config; -using Nwc.XmlRpc; -using OpenSim.Framework; -using OpenSim.Framework.Communications.Cache; -using OpenSim.Region.Environment.Interfaces; -using OpenSim.Region.Interfaces; -using OpenSim.Region.Environment.Scenes; - -namespace OpenSim.Region.Environment.Modules.Communications.Local -{ - public class LocalInterregionComms : IRegionModule, IInterregionCommsOut, IInterregionCommsIn - { - private bool m_enabled = false; - - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - private List m_sceneList = new List(); - - #region Events - public event ChildAgentUpdateReceived OnChildAgentUpdate; - - #endregion /* Events */ - - #region IRegionModule - - public void Initialise(Scene scene, IConfigSource config) - { - if (m_sceneList.Count == 0) - { - IConfig startupConfig = config.Configs["Communications"]; - - if ((startupConfig == null) || - (startupConfig != null) && (startupConfig.GetString("InterregionComms", "RESTCommms") == "LocalComms")) - m_enabled = true; - } - - if (!m_enabled) - return; - - Init(scene); - - } - - public void PostInitialise() - { - } - - public void Close() - { - } - - public string Name - { - get { return "LocalInterregionCommsModule"; } - } - - public bool IsSharedModule - { - get { return true; } - } - /// - /// Can be called from other modules. - /// - /// - public void Init(Scene scene) - { - if (!m_sceneList.Contains(scene)) - { - lock (m_sceneList) - { - m_sceneList.Add(scene); - if (m_enabled) - scene.RegisterModuleInterface(this); - scene.RegisterModuleInterface(this); - } - - } - } - - #endregion /* IRegionModule */ - - #region IInterregionComms - - public bool SendChildAgentUpdate(ulong regionHandle, AgentData cAgentData) - { - lock (m_sceneList) - { - foreach (Scene s in m_sceneList) - { - if (s.RegionInfo.RegionHandle == regionHandle) - { - //m_log.Debug("[LOCAL COMMS]: Found region to send ChildAgentUpdate"); - return s.IncomingChildAgentDataUpdate(cAgentData); - //if (OnChildAgentUpdate != null) - // return OnChildAgentUpdate(cAgentData); - } - } - } - m_log.Debug("[LOCAL COMMS]: region not found for ChildAgentUpdate"); - return false; - } - - #endregion /* IInterregionComms */ - } -} +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSim Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Net; +using System.Net.Sockets; +using System.Reflection; +using System.Threading; +using System.Xml; +using OpenMetaverse; +using log4net; +using Nini.Config; +using Nwc.XmlRpc; +using OpenSim.Framework; +using OpenSim.Framework.Communications.Cache; +using OpenSim.Region.Environment.Interfaces; +using OpenSim.Region.Interfaces; +using OpenSim.Region.Environment.Scenes; + +namespace OpenSim.Region.Environment.Modules.Communications.Local +{ + public class LocalInterregionComms : IRegionModule, IInterregionCommsOut, IInterregionCommsIn + { + private bool m_enabled = false; + + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + private List m_sceneList = new List(); + + #region Events + public event ChildAgentUpdateReceived OnChildAgentUpdate; + + #endregion /* Events */ + + #region IRegionModule + + public void Initialise(Scene scene, IConfigSource config) + { + if (m_sceneList.Count == 0) + { + IConfig startupConfig = config.Configs["Communications"]; + + if ((startupConfig == null) || + (startupConfig != null) && (startupConfig.GetString("InterregionComms", "RESTCommms") == "LocalComms")) + m_enabled = true; + } + + if (!m_enabled) + return; + + Init(scene); + + } + + public void PostInitialise() + { + } + + public void Close() + { + } + + public string Name + { + get { return "LocalInterregionCommsModule"; } + } + + public bool IsSharedModule + { + get { return true; } + } + /// + /// Can be called from other modules. + /// + /// + public void Init(Scene scene) + { + if (!m_sceneList.Contains(scene)) + { + lock (m_sceneList) + { + m_sceneList.Add(scene); + if (m_enabled) + scene.RegisterModuleInterface(this); + scene.RegisterModuleInterface(this); + } + + } + } + + #endregion /* IRegionModule */ + + #region IInterregionComms + + public bool SendChildAgentUpdate(ulong regionHandle, AgentData cAgentData) + { + lock (m_sceneList) + { + foreach (Scene s in m_sceneList) + { + if (s.RegionInfo.RegionHandle == regionHandle) + { + //m_log.Debug("[LOCAL COMMS]: Found region to send ChildAgentUpdate"); + return s.IncomingChildAgentDataUpdate(cAgentData); + //if (OnChildAgentUpdate != null) + // return OnChildAgentUpdate(cAgentData); + } + } + } + m_log.Debug("[LOCAL COMMS]: region not found for ChildAgentUpdate"); + return false; + } + + #endregion /* IInterregionComms */ + } +} 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 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSim Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Reflection; -using log4net; -using Nini.Config; -using OpenSim.Framework; -using OpenSim.Framework.Communications; -using OpenSim.Framework.Communications.Cache; -using OpenSim.Region.Environment.Interfaces; -using OpenSim.Region.Interfaces; -using OpenSim.Region.Environment.Scenes; -using OpenSim.Region.Environment.Scenes.Hypergrid; - -namespace OpenSim.Region.Environment.Modules.Communications.REST -{ - public class HGInterregionComms : RESTInterregionComms - { - private static bool initialized = false; - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - - #region IRegionModule - - public override void Initialise(Scene scene, IConfigSource config) - { - if (!initialized) - { - initialized = true; - IConfig startupConfig = config.Configs["Communications"]; - if ((startupConfig != null) && (startupConfig.GetString("InterregionComms", "RESTCommms") == "HGRESTComms")) - { - m_enabled = true; - InitOnce(scene); - } - } - - if (!m_enabled) - return; - - InitEach(scene); - } - - public override string Name - { - get { return "HGInterregionCommsModule"; } - } - - #endregion /* IRegionModule */ - - #region Misc - - protected override ulong GetRegionHandle(RegionInfo region) - { - return ((HGSceneCommunicationService)(m_aScene.SceneGridService)).m_hg.FindRegionHandle(region.RegionHandle); - } - - #endregion /* Misc */ - - } -} +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSim Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Reflection; +using log4net; +using Nini.Config; +using OpenSim.Framework; +using OpenSim.Framework.Communications; +using OpenSim.Framework.Communications.Cache; +using OpenSim.Region.Environment.Interfaces; +using OpenSim.Region.Interfaces; +using OpenSim.Region.Environment.Scenes; +using OpenSim.Region.Environment.Scenes.Hypergrid; + +namespace OpenSim.Region.Environment.Modules.Communications.REST +{ + public class HGInterregionComms : RESTInterregionComms + { + private static bool initialized = false; + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + + #region IRegionModule + + public override void Initialise(Scene scene, IConfigSource config) + { + if (!initialized) + { + initialized = true; + IConfig startupConfig = config.Configs["Communications"]; + if ((startupConfig != null) && (startupConfig.GetString("InterregionComms", "RESTCommms") == "HGRESTComms")) + { + m_enabled = true; + InitOnce(scene); + } + } + + if (!m_enabled) + return; + + InitEach(scene); + } + + public override string Name + { + get { return "HGInterregionCommsModule"; } + } + + #endregion /* IRegionModule */ + + #region Misc + + protected override ulong GetRegionHandle(RegionInfo region) + { + return ((HGSceneCommunicationService)(m_aScene.SceneGridService)).m_hg.FindRegionHandle(region.RegionHandle); + } + + #endregion /* Misc */ + + } +} 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 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSim Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -using System; -using System.Collections; -using System.Collections.Generic; -using System.IO; -using System.Net; -using System.Net.Sockets; -using System.Reflection; -using System.Threading; -using System.Xml; -using OpenMetaverse; -using OpenMetaverse.StructuredData; -using log4net; -using Nini.Config; -using Nwc.XmlRpc; -using OpenSim.Framework; -using OpenSim.Framework.Communications; -using OpenSim.Framework.Communications.Cache; -using OpenSim.Region.Environment.Interfaces; -using OpenSim.Region.Interfaces; -using OpenSim.Region.Environment.Scenes; -using OpenSim.Region.Environment.Modules.Communications.Local; - -namespace OpenSim.Region.Environment.Modules.Communications.REST -{ - public class RESTInterregionComms : IRegionModule, IInterregionCommsOut - { - private static bool initialized = false; - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - - protected bool m_enabled = false; - protected Scene m_aScene; - // RESTInterregionComms does not care about local regions; it delegates that to the Local module - protected LocalInterregionComms m_localBackend; - - protected CommunicationsManager m_commsManager; - - #region IRegionModule - - public virtual void Initialise(Scene scene, IConfigSource config) - { - if (!initialized) - { - initialized = true; - IConfig startupConfig = config.Configs["Communications"]; - if ((startupConfig != null) && (startupConfig.GetString("InterregionComms", "RESTCommms") == "RESTComms")) - { - m_enabled = true; - InitOnce(scene); - } - } - - if (!m_enabled) - return; - - InitEach(scene); - - } - - public virtual void PostInitialise() - { - if (m_enabled) - AddHTTPHandlers(); - } - - public virtual void Close() - { - } - - public virtual string Name - { - get { return "RESTInterregionCommsModule"; } - } - - public virtual bool IsSharedModule - { - get { return true; } - } - - protected virtual void InitEach(Scene scene) - { - m_localBackend.Init(scene); - scene.RegisterModuleInterface(this); - } - - protected virtual void InitOnce(Scene scene) - { - m_localBackend = new LocalInterregionComms(); - m_commsManager = scene.CommsManager; - m_aScene = scene; - } - - protected virtual void AddHTTPHandlers() - { - m_aScene.AddHTTPHandler("/ChildAgentUpdate/", ChildAgentUpdateHandler); - } - - #endregion /* IRegionModule */ - - #region IInterregionComms - - public bool SendChildAgentUpdate(ulong regionHandle, AgentData cAgentData) - { - // Try local first - if (m_localBackend.SendChildAgentUpdate(regionHandle, cAgentData)) - return true; - - // else do the remote thing - RegionInfo regInfo = m_commsManager.GridService.RequestNeighbourInfo(regionHandle); - if (regInfo != null) - { - return DoChildAgentUpdateCall(regInfo, cAgentData); - } - - return false; - - } - - protected bool DoChildAgentUpdateCall(RegionInfo region, AgentData cAgentData) - { - string uri = "http://" + region.ExternalEndPoint.Address + ":" + region.HttpPort + "/ChildAgentUpdate/"; - //Console.WriteLine(" >>> DoChildAgentUpdateCall <<< " + uri); - - WebRequest ChildUpdateRequest = WebRequest.Create(uri); - ChildUpdateRequest.Method = "PUT"; - ChildUpdateRequest.ContentType = "application/json"; - ChildUpdateRequest.Timeout = 10000; - - // Fill it in - OSDMap args = null; - try - { - args = cAgentData.PackUpdateMessage(); - } - catch (Exception e) - { - m_log.Debug("[REST COMMS]: PackUpdateMessage failed with exception: " + e.Message); - } - // Add the regionhandle of the destination region - ulong regionHandle = GetRegionHandle(region); - args["destination_handle"] = OSD.FromString(regionHandle.ToString()); - - string strBuffer = ""; - byte[] buffer = new byte[1]; - try - { - strBuffer = OSDParser.SerializeJsonString(args); - System.Text.UTF8Encoding str = new System.Text.UTF8Encoding(); - buffer = str.GetBytes(strBuffer); - - } - catch (Exception e) - { - m_log.WarnFormat("[OSG2]: Exception thrown on serialization of ChildUpdate: {0}", e.Message); - // ignore. buffer will be empty, caller should check. - } - - Stream os = null; - try - { // send the Post - ChildUpdateRequest.ContentLength = buffer.Length; //Count bytes to send - os = ChildUpdateRequest.GetRequestStream(); - os.Write(buffer, 0, strBuffer.Length); //Send it - os.Close(); - //m_log.InfoFormat("[REST COMMS]: Posted ChildAgentUpdate request to remote sim {0}", uri); - } - catch (WebException ex) - { - //m_log.InfoFormat("[REST COMMS]: Bad send on ChildAgentUpdate {0}", ex.Message); - - return false; - } - - // Let's wait for the response - //m_log.Info("[REST COMMS]: Waiting for a reply after ChildAgentUpdate"); - string reply = null; - try - { - WebResponse webResponse = ChildUpdateRequest.GetResponse(); - if (webResponse == null) - { - m_log.Info("[REST COMMS]: Null reply on ChilAgentUpdate post"); - } - - StreamReader sr = new StreamReader(webResponse.GetResponseStream()); - reply = sr.ReadToEnd().Trim(); - sr.Close(); - //m_log.InfoFormat("[REST COMMS]: ChilAgentUpdate reply was {0} ", reply); - - } - catch (WebException ex) - { - m_log.InfoFormat("[REST COMMS]: exception on reply of ChilAgentUpdate {0}", ex.Message); - // ignore, really - } - - return true; - - } - - #endregion /* IInterregionComms */ - - #region Called from remote instances on this instance - - public Hashtable ChildAgentUpdateHandler(Hashtable request) - { - //m_log.Debug("[CONNECTION DEBUGGING]: ChildDataUpdateHandler Called"); - - Hashtable responsedata = new Hashtable(); - responsedata["content_type"] = "text/html"; - - OSDMap args = null; - try - { - OSD buffer; - // We should pay attention to the content-type, but let's assume we know it's Json - buffer = OSDParser.DeserializeJson((string)request["body"]); - if (buffer.Type == OSDType.Map) - args = (OSDMap)buffer; - else - { - // uh? - m_log.Debug("[REST COMMS]: Got OSD of type " + buffer.Type.ToString()); - } - } - catch (Exception ex) - { - m_log.InfoFormat("[REST COMMS]: exception on parse of ChildAgentUpdate message {0}", ex.Message); - responsedata["int_response_code"] = 400; - responsedata["str_response_string"] = "false"; - - return responsedata; - } - - // retrieve the regionhandle - ulong regionhandle = 0; - if (args["destination_handle"] != null) - UInt64.TryParse(args["destination_handle"].AsString(), out regionhandle); - - AgentData agent = new AgentData(); - try - { - agent.UnpackUpdateMessage(args); - } - catch (Exception ex) - { - m_log.InfoFormat("[REST COMMS]: exception on unpacking ChildAgentUpdate message {0}", ex.Message); - } - //agent.Dump(); - - bool result = m_localBackend.SendChildAgentUpdate(regionhandle, agent); - - - responsedata["int_response_code"] = 200; - responsedata["str_response_string"] = result.ToString(); - return responsedata; - } - - #endregion - - #region Misc - - protected virtual ulong GetRegionHandle(RegionInfo region) - { - return region.RegionHandle; - } - - #endregion /* Misc */ - - } -} +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSim Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +using System; +using System.Collections; +using System.Collections.Generic; +using System.IO; +using System.Net; +using System.Net.Sockets; +using System.Reflection; +using System.Threading; +using System.Xml; +using OpenMetaverse; +using OpenMetaverse.StructuredData; +using log4net; +using Nini.Config; +using Nwc.XmlRpc; +using OpenSim.Framework; +using OpenSim.Framework.Communications; +using OpenSim.Framework.Communications.Cache; +using OpenSim.Region.Environment.Interfaces; +using OpenSim.Region.Interfaces; +using OpenSim.Region.Environment.Scenes; +using OpenSim.Region.Environment.Modules.Communications.Local; + +namespace OpenSim.Region.Environment.Modules.Communications.REST +{ + public class RESTInterregionComms : IRegionModule, IInterregionCommsOut + { + private static bool initialized = false; + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + + protected bool m_enabled = false; + protected Scene m_aScene; + // RESTInterregionComms does not care about local regions; it delegates that to the Local module + protected LocalInterregionComms m_localBackend; + + protected CommunicationsManager m_commsManager; + + #region IRegionModule + + public virtual void Initialise(Scene scene, IConfigSource config) + { + if (!initialized) + { + initialized = true; + IConfig startupConfig = config.Configs["Communications"]; + if ((startupConfig != null) && (startupConfig.GetString("InterregionComms", "RESTCommms") == "RESTComms")) + { + m_enabled = true; + InitOnce(scene); + } + } + + if (!m_enabled) + return; + + InitEach(scene); + + } + + public virtual void PostInitialise() + { + if (m_enabled) + AddHTTPHandlers(); + } + + public virtual void Close() + { + } + + public virtual string Name + { + get { return "RESTInterregionCommsModule"; } + } + + public virtual bool IsSharedModule + { + get { return true; } + } + + protected virtual void InitEach(Scene scene) + { + m_localBackend.Init(scene); + scene.RegisterModuleInterface(this); + } + + protected virtual void InitOnce(Scene scene) + { + m_localBackend = new LocalInterregionComms(); + m_commsManager = scene.CommsManager; + m_aScene = scene; + } + + protected virtual void AddHTTPHandlers() + { + m_aScene.AddHTTPHandler("/ChildAgentUpdate/", ChildAgentUpdateHandler); + } + + #endregion /* IRegionModule */ + + #region IInterregionComms + + public bool SendChildAgentUpdate(ulong regionHandle, AgentData cAgentData) + { + // Try local first + if (m_localBackend.SendChildAgentUpdate(regionHandle, cAgentData)) + return true; + + // else do the remote thing + RegionInfo regInfo = m_commsManager.GridService.RequestNeighbourInfo(regionHandle); + if (regInfo != null) + { + return DoChildAgentUpdateCall(regInfo, cAgentData); + } + + return false; + + } + + protected bool DoChildAgentUpdateCall(RegionInfo region, AgentData cAgentData) + { + string uri = "http://" + region.ExternalEndPoint.Address + ":" + region.HttpPort + "/ChildAgentUpdate/"; + //Console.WriteLine(" >>> DoChildAgentUpdateCall <<< " + uri); + + WebRequest ChildUpdateRequest = WebRequest.Create(uri); + ChildUpdateRequest.Method = "PUT"; + ChildUpdateRequest.ContentType = "application/json"; + ChildUpdateRequest.Timeout = 10000; + + // Fill it in + OSDMap args = null; + try + { + args = cAgentData.PackUpdateMessage(); + } + catch (Exception e) + { + m_log.Debug("[REST COMMS]: PackUpdateMessage failed with exception: " + e.Message); + } + // Add the regionhandle of the destination region + ulong regionHandle = GetRegionHandle(region); + args["destination_handle"] = OSD.FromString(regionHandle.ToString()); + + string strBuffer = ""; + byte[] buffer = new byte[1]; + try + { + strBuffer = OSDParser.SerializeJsonString(args); + System.Text.UTF8Encoding str = new System.Text.UTF8Encoding(); + buffer = str.GetBytes(strBuffer); + + } + catch (Exception e) + { + m_log.WarnFormat("[OSG2]: Exception thrown on serialization of ChildUpdate: {0}", e.Message); + // ignore. buffer will be empty, caller should check. + } + + Stream os = null; + try + { // send the Post + ChildUpdateRequest.ContentLength = buffer.Length; //Count bytes to send + os = ChildUpdateRequest.GetRequestStream(); + os.Write(buffer, 0, strBuffer.Length); //Send it + os.Close(); + //m_log.InfoFormat("[REST COMMS]: Posted ChildAgentUpdate request to remote sim {0}", uri); + } + catch (WebException ex) + { + //m_log.InfoFormat("[REST COMMS]: Bad send on ChildAgentUpdate {0}", ex.Message); + + return false; + } + + // Let's wait for the response + //m_log.Info("[REST COMMS]: Waiting for a reply after ChildAgentUpdate"); + string reply = null; + try + { + WebResponse webResponse = ChildUpdateRequest.GetResponse(); + if (webResponse == null) + { + m_log.Info("[REST COMMS]: Null reply on ChilAgentUpdate post"); + } + + StreamReader sr = new StreamReader(webResponse.GetResponseStream()); + reply = sr.ReadToEnd().Trim(); + sr.Close(); + //m_log.InfoFormat("[REST COMMS]: ChilAgentUpdate reply was {0} ", reply); + + } + catch (WebException ex) + { + m_log.InfoFormat("[REST COMMS]: exception on reply of ChilAgentUpdate {0}", ex.Message); + // ignore, really + } + + return true; + + } + + #endregion /* IInterregionComms */ + + #region Called from remote instances on this instance + + public Hashtable ChildAgentUpdateHandler(Hashtable request) + { + //m_log.Debug("[CONNECTION DEBUGGING]: ChildDataUpdateHandler Called"); + + Hashtable responsedata = new Hashtable(); + responsedata["content_type"] = "text/html"; + + OSDMap args = null; + try + { + OSD buffer; + // We should pay attention to the content-type, but let's assume we know it's Json + buffer = OSDParser.DeserializeJson((string)request["body"]); + if (buffer.Type == OSDType.Map) + args = (OSDMap)buffer; + else + { + // uh? + m_log.Debug("[REST COMMS]: Got OSD of type " + buffer.Type.ToString()); + } + } + catch (Exception ex) + { + m_log.InfoFormat("[REST COMMS]: exception on parse of ChildAgentUpdate message {0}", ex.Message); + responsedata["int_response_code"] = 400; + responsedata["str_response_string"] = "false"; + + return responsedata; + } + + // retrieve the regionhandle + ulong regionhandle = 0; + if (args["destination_handle"] != null) + UInt64.TryParse(args["destination_handle"].AsString(), out regionhandle); + + AgentData agent = new AgentData(); + try + { + agent.UnpackUpdateMessage(args); + } + catch (Exception ex) + { + m_log.InfoFormat("[REST COMMS]: exception on unpacking ChildAgentUpdate message {0}", ex.Message); + } + //agent.Dump(); + + bool result = m_localBackend.SendChildAgentUpdate(regionhandle, agent); + + + responsedata["int_response_code"] = 200; + responsedata["str_response_string"] = result.ToString(); + return responsedata; + } + + #endregion + + #region Misc + + protected virtual ulong GetRegionHandle(RegionInfo region) + { + return region.RegionHandle; + } + + #endregion /* Misc */ + + } +} 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 int hex = 0; Color newColour; - if(Int32.TryParse(nextLine, NumberStyles.HexNumber, CultureInfo.InvariantCulture, out hex)) + if (Int32.TryParse(nextLine, NumberStyles.HexNumber, CultureInfo.InvariantCulture, out hex)) { newColour = Color.FromArgb(hex); } 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 { permission = true; } - else if(group.IsAttachment) + else if (group.IsAttachment) { permission = false; } 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 // update non-physical objects like the joint proxy objects that represent the position // of the joints in the scene. - // This routine is normally called from within a lock(OdeLock) from within the OdePhysicsScene + // This routine is normally called from within a lock (OdeLock) from within the OdePhysicsScene // WARNING: be careful of deadlocks here if you manipulate the scene. Remember you are being called // from within the OdePhysicsScene. protected internal void jointMoved(PhysicsJoint joint) { - // m_parentScene.PhysicsScene.DumpJointInfo(); // non-thread-locked version; we should already be in a lock(OdeLock) when this callback is invoked + // m_parentScene.PhysicsScene.DumpJointInfo(); // non-thread-locked version; we should already be in a lock (OdeLock) when this callback is invoked // FIXME: this causes a sequential lookup of all objects in the scene; use a dictionary SceneObjectPart jointProxyObject = GetSceneObjectPart(joint.ObjectNameInScene); if (jointProxyObject == null) @@ -4521,7 +4521,7 @@ namespace OpenSim.Region.Environment.Scenes // update non-physical objects like the joint proxy objects that represent the position // of the joints in the scene. - // This routine is normally called from within a lock(OdeLock) from within the OdePhysicsScene + // This routine is normally called from within a lock (OdeLock) from within the OdePhysicsScene // WARNING: be careful of deadlocks here if you manipulate the scene. Remember you are being called // from within the OdePhysicsScene. protected internal void jointDeactivated(PhysicsJoint joint) @@ -4547,7 +4547,7 @@ namespace OpenSim.Region.Environment.Scenes // alert the user of errors by using the debug channel in the same way that scripts alert // the user of compile errors. - // This routine is normally called from within a lock(OdeLock) from within the OdePhysicsScene + // This routine is normally called from within a lock (OdeLock) from within the OdePhysicsScene // WARNING: be careful of deadlocks here if you manipulate the scene. Remember you are being called // from within the OdePhysicsScene. 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) { part.m_fromUserInventoryItemID = fromUserInventoryItemId; // for tempOnRez objects, we have to fix the Expire date. - if((part.Flags & PrimFlags.TemporaryOnRez) != 0) part.ResetExpire(); + if ((part.Flags & PrimFlags.TemporaryOnRez) != 0) part.ResetExpire(); return part; } 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 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSim Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System; -using System.Collections.Generic; -using OpenSim.Framework; -using OpenMetaverse; - -namespace OpenSim.Region.Physics.Manager -{ - public enum PhysicsJointType : int - { - Ball = 0, - Hinge = 1 - } - - public class PhysicsJoint - { - 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 - public PhysicsJointType Type; - public string RawParams; - public List BodyNames = new List(); - public PhysicsVector Position; // global coords - public Quaternion Rotation; // global coords - public string ObjectNameInScene; // proxy object in scene that represents the joint position/orientation - public string TrackedBodyName; // body name that this joint is attached to (ObjectNameInScene will follow TrackedBodyName) - public Quaternion LocalRotation; // joint orientation relative to one of the involved bodies, the tracked body - 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. - public const int maxErrorMessages = 100; // no more than this # of error messages will be printed for each joint - } -} +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSim Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System; +using System.Collections.Generic; +using OpenSim.Framework; +using OpenMetaverse; + +namespace OpenSim.Region.Physics.Manager +{ + public enum PhysicsJointType : int + { + Ball = 0, + Hinge = 1 + } + + public class PhysicsJoint + { + 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 + public PhysicsJointType Type; + public string RawParams; + public List BodyNames = new List(); + public PhysicsVector Position; // global coords + public Quaternion Rotation; // global coords + public string ObjectNameInScene; // proxy object in scene that represents the joint position/orientation + public string TrackedBodyName; // body name that this joint is attached to (ObjectNameInScene will follow TrackedBodyName) + public Quaternion LocalRotation; // joint orientation relative to one of the involved bodies, the tracked body + 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. + public const int maxErrorMessages = 100; // no more than this # of error messages will be printed for each joint + } +} 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 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSim Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System; -using OpenMetaverse; -using Ode.NET; -using OpenSim.Framework; -using OpenSim.Region.Physics.Manager; -using OpenSim.Region.Physics.Manager; -using OpenSim.Region.Physics.OdePlugin; - -namespace OpenSim.Region.Physics.OdePlugin -{ - class OdePhysicsJoint : PhysicsJoint - { - public override bool IsInPhysicsEngine - { - get - { - return (jointID != IntPtr.Zero); - } - } - public IntPtr jointID; - } -} +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSim Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System; +using OpenMetaverse; +using Ode.NET; +using OpenSim.Framework; +using OpenSim.Region.Physics.Manager; +using OpenSim.Region.Physics.Manager; +using OpenSim.Region.Physics.OdePlugin; + +namespace OpenSim.Region.Physics.OdePlugin +{ + class OdePhysicsJoint : PhysicsJoint + { + public override bool IsInPhysicsEngine + { + get + { + return (jointID != IntPtr.Zero); + } + } + public IntPtr jointID; + } +} 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 get { return m_NINJA_physics_joints_enabled; } } - // internal utility function: must be called within a lock(OdeLock) + // internal utility function: must be called within a lock (OdeLock) private void InternalAddActiveJoint(PhysicsJoint joint) { activeJoints.Add(joint); SOPName_to_activeJoint.Add(joint.ObjectNameInScene, joint); } - // internal utility function: must be called within a lock(OdeLock) + // internal utility function: must be called within a lock (OdeLock) private void InternalAddPendingJoint(OdePhysicsJoint joint) { pendingJoints.Add(joint); SOPName_to_pendingJoint.Add(joint.ObjectNameInScene, joint); } - // internal utility function: must be called within a lock(OdeLock) + // internal utility function: must be called within a lock (OdeLock) private void InternalRemovePendingJoint(PhysicsJoint joint) { pendingJoints.Remove(joint); SOPName_to_pendingJoint.Remove(joint.ObjectNameInScene); } - // internal utility function: must be called within a lock(OdeLock) + // internal utility function: must be called within a lock (OdeLock) private void InternalRemoveActiveJoint(PhysicsJoint joint) { activeJoints.Remove(joint); @@ -1640,7 +1640,7 @@ namespace OpenSim.Region.Physics.OdePlugin } } - // normally called from within OnJointMoved, which is called from within a lock(OdeLock) + // normally called from within OnJointMoved, which is called from within a lock (OdeLock) public override PhysicsVector GetJointAnchor(PhysicsJoint joint) { Debug.Assert(joint.IsInPhysicsEngine); @@ -1666,7 +1666,7 @@ namespace OpenSim.Region.Physics.OdePlugin return new PhysicsVector(pos.X, pos.Y, pos.Z); } - // normally called from within OnJointMoved, which is called from within a lock(OdeLock) + // normally called from within OnJointMoved, which is called from within a lock (OdeLock) // WARNING: ODE sometimes returns <0,0,0> as the joint axis! Therefore this function // appears to be unreliable. Fortunately we can compute the joint axis ourselves by // keeping track of the joint's original orientation relative to one of the involved bodies. @@ -2230,8 +2230,8 @@ namespace OpenSim.Region.Physics.OdePlugin if (SupportsNINJAJoints) { - DeleteRequestedJoints(); // this must be outside of the lock(OdeLock) to avoid deadlocks - CreateRequestedJoints(); // this must be outside of the lock(OdeLock) to avoid deadlocks + DeleteRequestedJoints(); // this must be outside of the lock (OdeLock) to avoid deadlocks + CreateRequestedJoints(); // this must be outside of the lock (OdeLock) to avoid deadlocks } 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 partItemID = item.ItemID; int linkNumber = m_host.LinkNum; - if(m_host.ParentGroup.Children.Count == 1) + if (m_host.ParentGroup.Children.Count == 1) linkNumber = 0; -- cgit v1.1