Update svn properties, minor formatting cleanup.
parent
3a6b27befb
commit
2be0f7a6f0
|
@ -1,5 +1,5 @@
|
||||||
BEGIN;
|
BEGIN;
|
||||||
|
|
||||||
ALTER TABLE prims ADD COLUMN VolumeDetect INTEGER NOT NULL DEFAULT 0;
|
ALTER TABLE prims ADD COLUMN VolumeDetect INTEGER NOT NULL DEFAULT 0;
|
||||||
|
|
||||||
COMMIT;
|
COMMIT;
|
||||||
|
|
|
@ -1,138 +1,162 @@
|
||||||
using System;
|
/*
|
||||||
using System.Collections.Generic;
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
using System.Text;
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
|
*
|
||||||
namespace OpenSim.Framework.OpenJpeg
|
* Redistribution and use in source and binary forms, with or without
|
||||||
{
|
* modification, are permitted provided that the following conditions are met:
|
||||||
public static class bio
|
* * 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
|
||||||
public static opj_bio bio_create()
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
{
|
* documentation and/or other materials provided with the distribution.
|
||||||
opj_bio bio = new opj_bio();
|
* * Neither the name of the OpenSimulator Project nor the
|
||||||
return bio;
|
* names of its contributors may be used to endorse or promote products
|
||||||
}
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
public static void bio_destroy(opj_bio bio)
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||||
{
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
// not needed on C#
|
* 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
|
||||||
public static int bio_numbytes(opj_bio bio)
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
{
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
return (bio.bp - bio.start);
|
* 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.
|
||||||
public static void bio_init_enc(opj_bio bio, sbyte bp, int len)
|
*/
|
||||||
{
|
|
||||||
bio.start = (byte)bp;
|
using System;
|
||||||
bio.end = (byte)(bp + (byte)len);
|
using System.Collections.Generic;
|
||||||
bio.bp = (byte)bp;
|
using System.Text;
|
||||||
bio.buf = 0;
|
|
||||||
bio.ct = 8;
|
namespace OpenSim.Framework.OpenJpeg
|
||||||
}
|
{
|
||||||
|
public static class bio
|
||||||
public static void bio_init_dec(opj_bio bio, sbyte bp, int len)
|
{
|
||||||
{
|
public static opj_bio bio_create()
|
||||||
bio.start = (byte)bp;
|
{
|
||||||
bio.end = (byte)(bp + len);
|
opj_bio bio = new opj_bio();
|
||||||
bio.bp = (byte)bp;
|
return bio;
|
||||||
bio.buf = 0;
|
}
|
||||||
bio.ct = 0;
|
|
||||||
}
|
public static void bio_destroy(opj_bio bio)
|
||||||
|
{
|
||||||
public static void bio_write(opj_bio bio, int v, int n)
|
// not needed on C#
|
||||||
{
|
}
|
||||||
for (int i = n - 1; i >= 0; i--)
|
|
||||||
bio_putbit(bio, (v >> i) & 1);
|
public static int bio_numbytes(opj_bio bio)
|
||||||
}
|
{
|
||||||
|
return (bio.bp - bio.start);
|
||||||
public static int bio_read(opj_bio bio, int n)
|
}
|
||||||
{
|
|
||||||
int v = 0;
|
public static void bio_init_enc(opj_bio bio, sbyte bp, int len)
|
||||||
for (int i = n - 1; i >= 0; i--)
|
{
|
||||||
v += bio_getbit(bio) << i;
|
bio.start = (byte)bp;
|
||||||
|
bio.end = (byte)(bp + (byte)len);
|
||||||
return v;
|
bio.bp = (byte)bp;
|
||||||
}
|
bio.buf = 0;
|
||||||
|
bio.ct = 8;
|
||||||
public static int bio_flush(opj_bio bio)
|
}
|
||||||
{
|
|
||||||
bio.ct = 0;
|
public static void bio_init_dec(opj_bio bio, sbyte bp, int len)
|
||||||
if (bio_byteout(bio) != 0)
|
{
|
||||||
return 1;
|
bio.start = (byte)bp;
|
||||||
|
bio.end = (byte)(bp + len);
|
||||||
if (bio.ct == 7)
|
bio.bp = (byte)bp;
|
||||||
{
|
bio.buf = 0;
|
||||||
bio.ct = 0;
|
bio.ct = 0;
|
||||||
if (bio_byteout(bio) != 0)
|
}
|
||||||
return 1;
|
|
||||||
}
|
public static void bio_write(opj_bio bio, int v, int n)
|
||||||
return 0;
|
{
|
||||||
}
|
for (int i = n - 1; i >= 0; i--)
|
||||||
|
bio_putbit(bio, (v >> i) & 1);
|
||||||
public static int bio_inalign(opj_bio bio)
|
}
|
||||||
{
|
|
||||||
bio.ct = 0;
|
public static int bio_read(opj_bio bio, int n)
|
||||||
if ((bio.buf & 0xff) == 0xff)
|
{
|
||||||
{
|
int v = 0;
|
||||||
if (bio_bytein(bio) != 0)
|
for (int i = n - 1; i >= 0; i--)
|
||||||
return 1;
|
v += bio_getbit(bio) << i;
|
||||||
bio.ct = 0;
|
|
||||||
}
|
return v;
|
||||||
return 0;
|
}
|
||||||
}
|
|
||||||
|
public static int bio_flush(opj_bio bio)
|
||||||
private static int bio_bytein(opj_bio bio)
|
{
|
||||||
{
|
bio.ct = 0;
|
||||||
bio.buf = (bio.buf << 8) & 0xffff;
|
if (bio_byteout(bio) != 0)
|
||||||
bio.ct = bio.buf == 0xff00 ? 7 : 8;
|
return 1;
|
||||||
if (bio.bp >= bio.end)
|
|
||||||
return 1;
|
if (bio.ct == 7)
|
||||||
bio.buf |= bio.bp++;
|
{
|
||||||
|
bio.ct = 0;
|
||||||
return 0;
|
if (bio_byteout(bio) != 0)
|
||||||
}
|
return 1;
|
||||||
|
}
|
||||||
private static int bio_byteout(opj_bio bio)
|
return 0;
|
||||||
{
|
}
|
||||||
bio.buf = (bio.buf << 8) & 0xffff;
|
|
||||||
bio.ct = bio.buf == 0xff00 ? 7 : 8;
|
public static int bio_inalign(opj_bio bio)
|
||||||
if (bio.bp >= bio.end)
|
{
|
||||||
return 1;
|
bio.ct = 0;
|
||||||
|
if ((bio.buf & 0xff) == 0xff)
|
||||||
bio.bp = (byte)(bio.buf >> 8);
|
{
|
||||||
bio.bp++;
|
if (bio_bytein(bio) != 0)
|
||||||
return 0;
|
return 1;
|
||||||
}
|
bio.ct = 0;
|
||||||
|
}
|
||||||
private static void bio_putbit(opj_bio bio, int b)
|
return 0;
|
||||||
{
|
}
|
||||||
if (bio.ct == 0)
|
|
||||||
bio_byteout(bio);
|
private static int bio_bytein(opj_bio bio)
|
||||||
|
{
|
||||||
bio.ct--;
|
bio.buf = (bio.buf << 8) & 0xffff;
|
||||||
bio.buf |= (byte)(b << bio.ct);
|
bio.ct = bio.buf == 0xff00 ? 7 : 8;
|
||||||
|
if (bio.bp >= bio.end)
|
||||||
}
|
return 1;
|
||||||
|
bio.buf |= bio.bp++;
|
||||||
private static int bio_getbit(opj_bio bio)
|
|
||||||
{
|
return 0;
|
||||||
if (bio.ct == 0)
|
}
|
||||||
bio_bytein(bio);
|
|
||||||
bio.ct--;
|
private static int bio_byteout(opj_bio bio)
|
||||||
|
{
|
||||||
return (int)((bio.buf >> bio.ct) & 1);
|
bio.buf = (bio.buf << 8) & 0xffff;
|
||||||
}
|
bio.ct = bio.buf == 0xff00 ? 7 : 8;
|
||||||
|
if (bio.bp >= bio.end)
|
||||||
}
|
return 1;
|
||||||
|
|
||||||
public struct opj_bio
|
bio.bp = (byte)(bio.buf >> 8);
|
||||||
{
|
bio.bp++;
|
||||||
public byte start;
|
return 0;
|
||||||
public byte end;
|
}
|
||||||
public byte bp;
|
|
||||||
public uint buf;
|
private static void bio_putbit(opj_bio bio, int b)
|
||||||
public int ct;
|
{
|
||||||
}
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -1,16 +1,43 @@
|
||||||
using System;
|
/*
|
||||||
using System.Collections.Generic;
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
using System.Text;
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
|
*
|
||||||
namespace OpenSim.Framework.OpenJpeg
|
* Redistribution and use in source and binary forms, with or without
|
||||||
{
|
* modification, are permitted provided that the following conditions are met:
|
||||||
public static class fix
|
* * Redistributions of source code must retain the above copyright
|
||||||
{
|
* notice, this list of conditions and the following disclaimer.
|
||||||
public static int fix_mul(int a, int b)
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
{
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
long temp = (long)a * (long)b;
|
* documentation and/or other materials provided with the distribution.
|
||||||
temp += temp & 4096;
|
* * Neither the name of the OpenSimulator Project nor the
|
||||||
return (int)(temp >> 13);
|
* 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -1,58 +1,84 @@
|
||||||
using System;
|
/*
|
||||||
using System.Collections.Generic;
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
using System.Text;
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
|
*
|
||||||
namespace OpenSim.Framework.OpenJpeg
|
* Redistribution and use in source and binary forms, with or without
|
||||||
{
|
* modification, are permitted provided that the following conditions are met:
|
||||||
public static class int_
|
* * Redistributions of source code must retain the above copyright
|
||||||
{
|
* notice, this list of conditions and the following disclaimer.
|
||||||
public static int int_min(int a, int b)
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
{
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
return a < b ? a : b;
|
* 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
|
||||||
public static int int_max(int a, int b)
|
* derived from this software without specific prior written permission.
|
||||||
{
|
*
|
||||||
return (a > b) ? a : b;
|
* 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
|
||||||
public static int int_clamp(int a, int min, int max)
|
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
{
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
if (a < min)
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
return min;
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
if (a > max)
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
return max;
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
return a;
|
*/
|
||||||
}
|
|
||||||
|
using System;
|
||||||
public static int int_abs(int a)
|
using System.Collections.Generic;
|
||||||
{
|
using System.Text;
|
||||||
return a < 0 ? -a : a;
|
|
||||||
}
|
namespace OpenSim.Framework.OpenJpeg
|
||||||
|
{
|
||||||
public static int int_ceildiv(int a, int b)
|
public static class int_
|
||||||
{
|
{
|
||||||
return (a + b - 1) / b;
|
public static int int_min(int a, int b)
|
||||||
}
|
{
|
||||||
|
return a < b ? a : b;
|
||||||
public static int int_ceildivpow2(int a, int b)
|
}
|
||||||
{
|
|
||||||
return (a + (1 << b) - 1) >> b;
|
public static int int_max(int a, int b)
|
||||||
}
|
{
|
||||||
|
return (a > b) ? a : b;
|
||||||
public static int int_floordivpow2(int a, int b)
|
}
|
||||||
{
|
|
||||||
return a >> b;
|
public static int int_clamp(int a, int min, int max)
|
||||||
}
|
{
|
||||||
|
if (a < min)
|
||||||
public static int int_floorlog2(int a)
|
return min;
|
||||||
{
|
if (a > max)
|
||||||
for (int l=0; a > 1; l++)
|
return max;
|
||||||
a >>= 1;
|
|
||||||
|
return a;
|
||||||
return 1;
|
}
|
||||||
}
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -1,125 +1,149 @@
|
||||||
using System;
|
/*
|
||||||
using System.Collections.Generic;
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
using System.Text;
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
|
*
|
||||||
namespace OpenSim.Framework.OpenJpeg
|
* 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
|
||||||
public static class j2k
|
* 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.
|
||||||
public enum J2K_STATUS
|
* * Neither the name of the OpenSimulator Project nor the
|
||||||
{
|
* names of its contributors may be used to endorse or promote products
|
||||||
J2K_STATE_MHSOC = 0x0001, /**< a SOC marker is expected */
|
* derived from this software without specific prior written permission.
|
||||||
J2K_STATE_MHSIZ = 0x0002, /**< a SIZ marker is expected */
|
*
|
||||||
J2K_STATE_MH = 0x0004, /**< the decoding process is in the main header */
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||||
J2K_STATE_TPHSOT = 0x0008, /**< the decoding process is in a tile part header and expects a SOT marker */
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
J2K_STATE_TPH = 0x0010, /**< the decoding process is in a tile part header */
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
J2K_STATE_MT = 0x0020, /**< the EOC marker has just been read */
|
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
J2K_STATE_NEOC = 0x0040, /**< the decoding process must not expect a EOC marker because the codestream is truncated */
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
J2K_STATE_ERR = 0x0080 /**< the decoding process has encountered an error */
|
* (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
|
||||||
public enum J2K_T2_MODE
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
{
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
THRESH_CALC = 0, /** Function called in Rate allocation process*/
|
*/
|
||||||
FINAL_PASS = 1 /** Function called in Tier 2 process*/
|
|
||||||
}
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
public struct opj_stepsize
|
using System.Text;
|
||||||
{
|
|
||||||
public int expn;
|
namespace OpenSim.Framework.OpenJpeg
|
||||||
public int mant;
|
{
|
||||||
}
|
public static class j2k
|
||||||
|
{
|
||||||
public struct opj_tccp
|
}
|
||||||
{
|
|
||||||
public int csty;
|
public enum J2K_STATUS
|
||||||
public int numresolutions;
|
{
|
||||||
public int cblkw;
|
J2K_STATE_MHSOC = 0x0001, /**< a SOC marker is expected */
|
||||||
public int cblkh;
|
J2K_STATE_MHSIZ = 0x0002, /**< a SIZ marker is expected */
|
||||||
public int cblksty;
|
J2K_STATE_MH = 0x0004, /**< the decoding process is in the main header */
|
||||||
public int qmfbid;
|
J2K_STATE_TPHSOT = 0x0008, /**< the decoding process is in a tile part header and expects a SOT marker */
|
||||||
public int qntsty;
|
J2K_STATE_TPH = 0x0010, /**< the decoding process is in a tile part header */
|
||||||
/// <summary>
|
J2K_STATE_MT = 0x0020, /**< the EOC marker has just been read */
|
||||||
/// don't forget to initialize 97 elements
|
J2K_STATE_NEOC = 0x0040, /**< the decoding process must not expect a EOC marker because the codestream is truncated */
|
||||||
/// </summary>
|
J2K_STATE_ERR = 0x0080 /**< the decoding process has encountered an error */
|
||||||
public opj_stepsize[] stepsizes;
|
}
|
||||||
public int numgbits;
|
|
||||||
public int roishift;
|
public enum J2K_T2_MODE
|
||||||
/// <summary>
|
{
|
||||||
/// Don't forget to initialize 33 elements
|
THRESH_CALC = 0, /** Function called in Rate allocation process*/
|
||||||
/// </summary>
|
FINAL_PASS = 1 /** Function called in Tier 2 process*/
|
||||||
public int[] prcw;
|
}
|
||||||
|
|
||||||
}
|
public struct opj_stepsize
|
||||||
|
{
|
||||||
public struct opj_tcp
|
public int expn;
|
||||||
{
|
public int mant;
|
||||||
public int first;
|
}
|
||||||
public int csty;
|
|
||||||
public PROG_ORDER prg;
|
public struct opj_tccp
|
||||||
public int numlayers;
|
{
|
||||||
public int mct;
|
public int csty;
|
||||||
/// <summary>
|
public int numresolutions;
|
||||||
/// don't forget to initialize to 100
|
public int cblkw;
|
||||||
/// </summary>
|
public int cblkh;
|
||||||
public float[] rates;
|
public int cblksty;
|
||||||
public int numpocs;
|
public int qmfbid;
|
||||||
public int POC;
|
public int qntsty;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Don't forget to initialize to 32
|
/// don't forget to initialize 97 elements
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public opj_poc[] pocs;
|
public opj_stepsize[] stepsizes;
|
||||||
public byte ppt_data;
|
public int numgbits;
|
||||||
public byte ppt_data_first;
|
public int roishift;
|
||||||
public int ppt;
|
/// <summary>
|
||||||
public int ppt_store;
|
/// Don't forget to initialize 33 elements
|
||||||
public int ppt_len;
|
/// </summary>
|
||||||
/// <summary>
|
public int[] prcw;
|
||||||
/// Don't forget to initialize 100 elements
|
}
|
||||||
/// </summary>
|
|
||||||
public float[] distoratio;
|
public struct opj_tcp
|
||||||
public opj_tccp tccps;
|
{
|
||||||
|
public int first;
|
||||||
}
|
public int csty;
|
||||||
|
public PROG_ORDER prg;
|
||||||
public struct opj_cp
|
public int numlayers;
|
||||||
{
|
public int mct;
|
||||||
public CINEMA_MODE cinema;
|
/// <summary>
|
||||||
public int max_comp_size;
|
/// don't forget to initialize to 100
|
||||||
public int img_size;
|
/// </summary>
|
||||||
public RSIZ_CAPABILITIES rsiz;
|
public float[] rates;
|
||||||
public sbyte tp_on;
|
public int numpocs;
|
||||||
public sbyte tp_flag;
|
public int POC;
|
||||||
public int tp_pos;
|
/// <summary>
|
||||||
public int distro_alloc;
|
/// Don't forget to initialize to 32
|
||||||
public int fixed_alloc;
|
/// </summary>
|
||||||
public int fixed_quality;
|
public opj_poc[] pocs;
|
||||||
public int reduce;
|
public byte ppt_data;
|
||||||
public int layer;
|
public byte ppt_data_first;
|
||||||
public LIMIT_DECODING limit_decoding;
|
public int ppt;
|
||||||
public int tx0;
|
public int ppt_store;
|
||||||
public int ty0;
|
public int ppt_len;
|
||||||
public int tdx;
|
/// <summary>
|
||||||
public int tdy;
|
/// Don't forget to initialize 100 elements
|
||||||
public sbyte? comment;
|
/// </summary>
|
||||||
public int tw;
|
public float[] distoratio;
|
||||||
public int th;
|
public opj_tccp tccps;
|
||||||
public int? tileno;
|
}
|
||||||
public byte ppm_data;
|
|
||||||
public byte ppm_data_first;
|
public struct opj_cp
|
||||||
public int ppm;
|
{
|
||||||
public int ppm_store;
|
public CINEMA_MODE cinema;
|
||||||
public int ppm_previous;
|
public int max_comp_size;
|
||||||
public int ppm_len;
|
public int img_size;
|
||||||
public opj_tcp tcps;
|
public RSIZ_CAPABILITIES rsiz;
|
||||||
public int matrice;
|
public sbyte tp_on;
|
||||||
}
|
public sbyte tp_flag;
|
||||||
|
public int tp_pos;
|
||||||
public static class j2kdefines
|
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_PRT = 0x01;
|
||||||
public const uint J2K_CP_CSTY_SOP = 0x02;
|
public const uint J2K_CP_CSTY_SOP = 0x02;
|
||||||
public const uint J2K_CP_CSTY_EPH = 0x04;
|
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_PTERM =0x10;
|
||||||
public const uint J2K_CCP_CBLKSTY_SEGSYM = 0x20;
|
public const uint J2K_CCP_CBLKSTY_SEGSYM = 0x20;
|
||||||
public const uint J2K_CCP_QNTSTY_NOQNT = 0;
|
public const uint J2K_CCP_QNTSTY_NOQNT = 0;
|
||||||
public const uint J2K_CCP_QNTSTY_SIQNT = 1;
|
public const uint J2K_CCP_QNTSTY_SIQNT = 1;
|
||||||
public const uint J2K_CCP_QNTSTY_SEQNT = 2;
|
public const uint J2K_CCP_QNTSTY_SEQNT = 2;
|
||||||
|
|
||||||
public const uint J2K_MS_SOC = 0xff4f; /**< SOC marker value */
|
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_SOT = 0xff90; /**< SOT marker value */
|
||||||
public const uint J2K_MS_SOD = 0xff93; /**< SOD 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_EOC = 0xffd9; /**< EOC marker value */
|
||||||
public const uint J2K_MS_SIZ = 0xff51; /**< SIZ 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_COD = 0xff52; /**< COD marker value */
|
||||||
public const uint J2K_MS_COC = 0xff53; /**< COC 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_RGN = 0xff5e; /**< RGN marker value */
|
||||||
public const uint J2K_MS_QCD = 0xff5c; /**< QCD 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_QCC = 0xff5d; /**< QCC marker value */
|
||||||
public const uint J2K_MS_POC = 0xff5f; /**< POC 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_TLM = 0xff55; /**< TLM marker value */
|
||||||
public const uint J2K_MS_PLM = 0xff57; /**< PLM 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_PLT = 0xff58; /**< PLT marker value */
|
||||||
public const uint J2K_MS_PPM = 0xff60; /**< PPM 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_PPT = 0xff61; /**< PPT marker value */
|
||||||
public const uint J2K_MS_SOP = 0xff91; /**< SOP 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_EPH = 0xff92; /**< EPH marker value */
|
||||||
public const uint J2K_MS_CRG = 0xff63; /**< CRG 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_MS_COM = 0xff64; /**< COM marker value */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,358 +1,375 @@
|
||||||
using System;
|
/*
|
||||||
using System.Collections.Generic;
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
using System.Text;
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
|
*
|
||||||
namespace OpenSim.Framework.OpenJpeg
|
* Redistribution and use in source and binary forms, with or without
|
||||||
{
|
* modification, are permitted provided that the following conditions are met:
|
||||||
public class openjpeg
|
* * Redistributions of source code must retain the above copyright
|
||||||
{
|
* notice, this list of conditions and the following disclaimer.
|
||||||
public openjpeg()
|
* * 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.
|
||||||
|
*
|
||||||
public enum PROG_ORDER
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||||
{
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
PROG_UNKNOWN = -1,
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
LRCP = 0,
|
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
RLCP = 1,
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
RPCL = 2,
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
PCRL = 3,
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
CPRL = 4
|
* 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.
|
||||||
public enum RSIZ_CAPABILITIES
|
*/
|
||||||
{
|
|
||||||
STD_RSIZ = 0,
|
using System;
|
||||||
CINEMA2K = 3,
|
using System.Collections.Generic;
|
||||||
CINEMA4K = 4
|
using System.Text;
|
||||||
}
|
|
||||||
|
namespace OpenSim.Framework.OpenJpeg
|
||||||
public enum CINEMA_MODE
|
{
|
||||||
{
|
public class openjpeg
|
||||||
OFF = 0,
|
{
|
||||||
CINEMA2K_24 = 1,
|
public openjpeg()
|
||||||
CINEMA2K_48 = 2,
|
{
|
||||||
CINEMA4K_24 = 3
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum COLOR_SPACE
|
public enum PROG_ORDER
|
||||||
{
|
{
|
||||||
CLRSPC_UNKNOWN = -1,
|
PROG_UNKNOWN = -1,
|
||||||
CLRSPC_SRGB = 1,
|
LRCP = 0,
|
||||||
CLRSPC_GRAY = 2,
|
RLCP = 1,
|
||||||
CLRSPC_SYCC = 3
|
RPCL = 2,
|
||||||
}
|
PCRL = 3,
|
||||||
|
CPRL = 4
|
||||||
public enum CODEC_FORMAT
|
}
|
||||||
{
|
|
||||||
CODEC_UNKNOWN = -1,
|
public enum RSIZ_CAPABILITIES
|
||||||
CODEC_J2K = 0,
|
{
|
||||||
CODEC_JPT = 1,
|
STD_RSIZ = 0,
|
||||||
CODEC_JP2 = 2
|
CINEMA2K = 3,
|
||||||
}
|
CINEMA4K = 4
|
||||||
|
}
|
||||||
public enum LIMIT_DECODING
|
|
||||||
{
|
public enum CINEMA_MODE
|
||||||
NO_LIMITATION = 0,
|
{
|
||||||
LIMIT_TO_MAIN_HEADER=1,
|
OFF = 0,
|
||||||
DECODE_ALL_BUT_PACKETS = 2
|
CINEMA2K_24 = 1,
|
||||||
}
|
CINEMA2K_48 = 2,
|
||||||
|
CINEMA4K_24 = 3
|
||||||
public struct opj_poc
|
}
|
||||||
{
|
|
||||||
public int resno0, compno0;
|
public enum COLOR_SPACE
|
||||||
public int layno1, resno1, compno1;
|
{
|
||||||
public int layno0, precno0, precno1;
|
CLRSPC_UNKNOWN = -1,
|
||||||
public PROG_ORDER prg1, prg;
|
CLRSPC_SRGB = 1,
|
||||||
/// <summary>
|
CLRSPC_GRAY = 2,
|
||||||
/// Don't forget to initialize with 5 elements
|
CLRSPC_SYCC = 3
|
||||||
/// </summary>
|
}
|
||||||
public sbyte[] progorder;
|
|
||||||
public int tile;
|
public enum CODEC_FORMAT
|
||||||
public int tx0, tx1, ty0, ty1;
|
{
|
||||||
public int layS, resS, copmS, prcS;
|
CODEC_UNKNOWN = -1,
|
||||||
public int layE, resE, compE, prcE;
|
CODEC_J2K = 0,
|
||||||
public int txS, txE, tyS, tyE, dx, dy;
|
CODEC_JPT = 1,
|
||||||
public int lay_t, res_t, comp_t, prc_t, tx0_t, ty0_t;
|
CODEC_JP2 = 2
|
||||||
}
|
}
|
||||||
|
|
||||||
public struct opj_cparameters
|
public enum LIMIT_DECODING
|
||||||
{
|
{
|
||||||
public bool tile_size_on;
|
NO_LIMITATION = 0,
|
||||||
public int cp_tx0;
|
LIMIT_TO_MAIN_HEADER=1,
|
||||||
public int cp_ty0;
|
DECODE_ALL_BUT_PACKETS = 2
|
||||||
public int cp_tdx;
|
}
|
||||||
public int cp_tdy;
|
|
||||||
public int cp_disto_alloc;
|
public struct opj_poc
|
||||||
public int cp_fixed_alloc;
|
{
|
||||||
public int cp_fixed_wuality;
|
public int resno0, compno0;
|
||||||
public int cp_matrice;
|
public int layno1, resno1, compno1;
|
||||||
public sbyte cp_comment;
|
public int layno0, precno0, precno1;
|
||||||
public int csty;
|
public PROG_ORDER prg1, prg;
|
||||||
public PROG_ORDER prog_order;
|
/// <summary>
|
||||||
|
/// Don't forget to initialize with 5 elements
|
||||||
/// <summary>
|
/// </summary>
|
||||||
/// Don't forget to initialize 32 elements
|
public sbyte[] progorder;
|
||||||
/// </summary>
|
public int tile;
|
||||||
public opj_poc[] POC;
|
public int tx0, tx1, ty0, ty1;
|
||||||
public int numpocs;
|
public int layS, resS, copmS, prcS;
|
||||||
public int tcp_numlayers;
|
public int layE, resE, compE, prcE;
|
||||||
/// <summary>
|
public int txS, txE, tyS, tyE, dx, dy;
|
||||||
/// Don't forget to intitialize 100 elements
|
public int lay_t, res_t, comp_t, prc_t, tx0_t, ty0_t;
|
||||||
/// </summary>
|
}
|
||||||
public float[] tcp_rates;
|
|
||||||
/// <summary>
|
public struct opj_cparameters
|
||||||
/// Don't forget to initialize 100 elements
|
{
|
||||||
/// </summary>
|
public bool tile_size_on;
|
||||||
public float[] tcp_distoratio;
|
public int cp_tx0;
|
||||||
public int numresolution;
|
public int cp_ty0;
|
||||||
public int cblockw_init;
|
public int cp_tdx;
|
||||||
public int cblockh_init;
|
public int cp_tdy;
|
||||||
public int mode;
|
public int cp_disto_alloc;
|
||||||
public int irreversible;
|
public int cp_fixed_alloc;
|
||||||
public int roi_compno;
|
public int cp_fixed_wuality;
|
||||||
public int roi_shift;
|
public int cp_matrice;
|
||||||
public int res_spec;
|
public sbyte cp_comment;
|
||||||
|
public int csty;
|
||||||
/// <summary>
|
public PROG_ORDER prog_order;
|
||||||
/// Don't forget to initialize 33 elements
|
|
||||||
/// </summary>
|
/// <summary>
|
||||||
public int[] prc_init;
|
/// Don't forget to initialize 32 elements
|
||||||
/// <summary>
|
/// </summary>
|
||||||
/// Don't forget to initialize 33 elements
|
public opj_poc[] POC;
|
||||||
/// </summary>
|
public int numpocs;
|
||||||
public int[] prch_init;
|
public int tcp_numlayers;
|
||||||
|
/// <summary>
|
||||||
public string infile;
|
/// Don't forget to intitialize 100 elements
|
||||||
public string outfile;
|
/// </summary>
|
||||||
public int index_on;
|
public float[] tcp_rates;
|
||||||
public string index;
|
/// <summary>
|
||||||
public int image_offset_x0;
|
/// Don't forget to initialize 100 elements
|
||||||
public int image_offset_y0;
|
/// </summary>
|
||||||
public int subsampling_dx;
|
public float[] tcp_distoratio;
|
||||||
public int subsampling_dy;
|
public int numresolution;
|
||||||
public int decod_format;
|
public int cblockw_init;
|
||||||
public int cod_format;
|
public int cblockh_init;
|
||||||
public bool jpwl_epc_on;
|
public int mode;
|
||||||
public int jpwl_hprot_MH;
|
public int irreversible;
|
||||||
/// <summary>
|
public int roi_compno;
|
||||||
/// Don't forget to initialize 16 elements
|
public int roi_shift;
|
||||||
/// </summary>
|
public int res_spec;
|
||||||
public int[] jpwl_hprot_TPH_tileno;
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Don't forget to initialize 16 elements
|
/// Don't forget to initialize 33 elements
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int[] jpwl_hprot_TPH;
|
public int[] prc_init;
|
||||||
|
/// <summary>
|
||||||
/// <summary>
|
/// Don't forget to initialize 33 elements
|
||||||
/// Don't forget to initialize 16 elements
|
/// </summary>
|
||||||
/// </summary>
|
public int[] prch_init;
|
||||||
public int[] jpwl_pprot_tileno;
|
|
||||||
public int[] jpwl_pprot_packno;
|
public string infile;
|
||||||
public int[] jpwl_pprot;
|
public string outfile;
|
||||||
public int jpwl_sens_size;
|
public int index_on;
|
||||||
public int jpwl_sense_addr;
|
public string index;
|
||||||
public int jpwl_sens_range;
|
public int image_offset_x0;
|
||||||
public int jpwl_sens_MH;
|
public int image_offset_y0;
|
||||||
|
public int subsampling_dx;
|
||||||
/// <summary>
|
public int subsampling_dy;
|
||||||
/// Don't forget to initialize 16 elements
|
public int decod_format;
|
||||||
/// </summary>
|
public int cod_format;
|
||||||
public int[] jpwl_sens_TPH_tileno;
|
public bool jpwl_epc_on;
|
||||||
|
public int jpwl_hprot_MH;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Don't forget to initialize 16 elements
|
/// Don't forget to initialize 16 elements
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int[] jpwl_sens_TPH;
|
public int[] jpwl_hprot_TPH_tileno;
|
||||||
public CINEMA_MODE cp_cinema;
|
/// <summary>
|
||||||
public int max_comp_size;
|
/// Don't forget to initialize 16 elements
|
||||||
public sbyte tp_on;
|
/// </summary>
|
||||||
public sbyte tp_flag;
|
public int[] jpwl_hprot_TPH;
|
||||||
public sbyte tcp_mct;
|
|
||||||
}
|
/// <summary>
|
||||||
|
/// Don't forget to initialize 16 elements
|
||||||
public struct opj_dparameters
|
/// </summary>
|
||||||
{
|
public int[] jpwl_pprot_tileno;
|
||||||
public int cp_reduce;
|
public int[] jpwl_pprot_packno;
|
||||||
public int cp_layer;
|
public int[] jpwl_pprot;
|
||||||
public string infile;
|
public int jpwl_sens_size;
|
||||||
public string outfile;
|
public int jpwl_sense_addr;
|
||||||
public int decod_format;
|
public int jpwl_sens_range;
|
||||||
public int cod_format;
|
public int jpwl_sens_MH;
|
||||||
public bool jpwl_correct;
|
|
||||||
public int jpwl_exp_comps;
|
/// <summary>
|
||||||
public int jpwl_max_tiles;
|
/// Don't forget to initialize 16 elements
|
||||||
public LIMIT_DECODING cp_limit_decoding;
|
/// </summary>
|
||||||
|
public int[] jpwl_sens_TPH_tileno;
|
||||||
}
|
|
||||||
|
/// <summary>
|
||||||
public struct opj_common_fields
|
/// Don't forget to initialize 16 elements
|
||||||
{
|
/// </summary>
|
||||||
public bool is_decompressor;
|
public int[] jpwl_sens_TPH;
|
||||||
public CODEC_FORMAT codec_format;
|
public CINEMA_MODE cp_cinema;
|
||||||
}
|
public int max_comp_size;
|
||||||
|
public sbyte tp_on;
|
||||||
public struct opj_common_struct
|
public sbyte tp_flag;
|
||||||
{
|
public sbyte tcp_mct;
|
||||||
public opj_common_fields flds;
|
}
|
||||||
}
|
|
||||||
|
public struct opj_dparameters
|
||||||
public struct opj_cinfo
|
{
|
||||||
{
|
public int cp_reduce;
|
||||||
public opj_common_fields flds;
|
public int cp_layer;
|
||||||
}
|
public string infile;
|
||||||
public struct opj_dinfo
|
public string outfile;
|
||||||
{
|
public int decod_format;
|
||||||
public opj_common_fields flds;
|
public int cod_format;
|
||||||
}
|
public bool jpwl_correct;
|
||||||
|
public int jpwl_exp_comps;
|
||||||
public struct opj_cio
|
public int jpwl_max_tiles;
|
||||||
{
|
public LIMIT_DECODING cp_limit_decoding;
|
||||||
public opj_common_struct cinfo;
|
}
|
||||||
public int openmode;
|
|
||||||
public byte buffer;
|
public struct opj_common_fields
|
||||||
public int length;
|
{
|
||||||
public byte start;
|
public bool is_decompressor;
|
||||||
public byte end;
|
public CODEC_FORMAT codec_format;
|
||||||
public byte bp;
|
}
|
||||||
}
|
|
||||||
|
public struct opj_common_struct
|
||||||
public struct opj_image_comp
|
{
|
||||||
{
|
public opj_common_fields flds;
|
||||||
public int dx;
|
}
|
||||||
public int dy;
|
|
||||||
public int w;
|
public struct opj_cinfo
|
||||||
public int h;
|
{
|
||||||
public int x0;
|
public opj_common_fields flds;
|
||||||
public int y0;
|
}
|
||||||
public int prec;
|
|
||||||
public int bpp;
|
public struct opj_dinfo
|
||||||
public int sgnd;
|
{
|
||||||
public int resno_decoded;
|
public opj_common_fields flds;
|
||||||
public int factor;
|
}
|
||||||
public int data;
|
|
||||||
}
|
public struct opj_cio
|
||||||
|
{
|
||||||
public struct opj_image
|
public opj_common_struct cinfo;
|
||||||
{
|
public int openmode;
|
||||||
public int x0;
|
public byte buffer;
|
||||||
public int y0;
|
public int length;
|
||||||
public int x1;
|
public byte start;
|
||||||
public int y1;
|
public byte end;
|
||||||
public int numcomps;
|
public byte bp;
|
||||||
public COLOR_SPACE color_space;
|
}
|
||||||
public opj_image_comp comps;
|
|
||||||
}
|
public struct opj_image_comp
|
||||||
|
{
|
||||||
public struct opj_image_comptparm
|
public int dx;
|
||||||
{
|
public int dy;
|
||||||
public int dx;
|
public int w;
|
||||||
public int dy;
|
public int h;
|
||||||
public int w;
|
public int x0;
|
||||||
public int h;
|
public int y0;
|
||||||
public int x0;
|
public int prec;
|
||||||
public int y0;
|
public int bpp;
|
||||||
public int prec;
|
public int sgnd;
|
||||||
public int bpp;
|
public int resno_decoded;
|
||||||
public int sgnd;
|
public int factor;
|
||||||
}
|
public int data;
|
||||||
|
}
|
||||||
public struct opj_packet_info
|
|
||||||
{
|
public struct opj_image
|
||||||
public int start_pos;
|
{
|
||||||
public int end_ph_pos;
|
public int x0;
|
||||||
public int end_pos;
|
public int y0;
|
||||||
public double disto;
|
public int x1;
|
||||||
}
|
public int y1;
|
||||||
|
public int numcomps;
|
||||||
public struct opj_tp_info
|
public COLOR_SPACE color_space;
|
||||||
{
|
public opj_image_comp comps;
|
||||||
public int tp_start_pos;
|
}
|
||||||
public int tp_end_header;
|
|
||||||
public int tp_end_pos;
|
public struct opj_image_comptparm
|
||||||
public int tp_start_pack;
|
{
|
||||||
public int tp_numpacks;
|
public int dx;
|
||||||
}
|
public int dy;
|
||||||
|
public int w;
|
||||||
public struct opj_tile_info
|
public int h;
|
||||||
{
|
public int x0;
|
||||||
public double thresh;
|
public int y0;
|
||||||
public int tileno;
|
public int prec;
|
||||||
public int start_pos;
|
public int bpp;
|
||||||
public int end_header;
|
public int sgnd;
|
||||||
public int end_pos;
|
}
|
||||||
/// <summary>
|
|
||||||
/// Don't forget to initialize 33 elements
|
public struct opj_packet_info
|
||||||
/// </summary>
|
{
|
||||||
public int[] pw;
|
public int start_pos;
|
||||||
/// <summary>
|
public int end_ph_pos;
|
||||||
/// Don't forget to initialize 33 elements
|
public int end_pos;
|
||||||
/// </summary>
|
public double disto;
|
||||||
public int[] ph;
|
}
|
||||||
/// <summary>
|
|
||||||
/// Don't forget to initialize 33 elements
|
public struct opj_tp_info
|
||||||
/// </summary>
|
{
|
||||||
public int[] pdx;
|
public int tp_start_pos;
|
||||||
/// <summary>
|
public int tp_end_header;
|
||||||
/// Don't forget to initialize 33 elements
|
public int tp_end_pos;
|
||||||
/// </summary>
|
public int tp_start_pack;
|
||||||
public int[] pdy;
|
public int tp_numpacks;
|
||||||
|
}
|
||||||
public opj_packet_info packet;
|
|
||||||
public int numpix;
|
public struct opj_tile_info
|
||||||
public double distotile;
|
{
|
||||||
public int num_tps;
|
public double thresh;
|
||||||
public opj_tp_info tp;
|
public int tileno;
|
||||||
}
|
public int start_pos;
|
||||||
|
public int end_header;
|
||||||
public struct opj_marker_info_t
|
public int end_pos;
|
||||||
{
|
/// <summary>
|
||||||
public ushort type;
|
/// Don't forget to initialize 33 elements
|
||||||
public int pos;
|
/// </summary>
|
||||||
public int len;
|
public int[] pw;
|
||||||
}
|
/// <summary>
|
||||||
|
/// Don't forget to initialize 33 elements
|
||||||
public struct opj_codestream_info
|
/// </summary>
|
||||||
{
|
public int[] ph;
|
||||||
public double D_max;
|
/// <summary>
|
||||||
public int packno;
|
/// Don't forget to initialize 33 elements
|
||||||
public int index_write;
|
/// </summary>
|
||||||
public int image_w;
|
public int[] pdx;
|
||||||
public int image_h;
|
/// <summary>
|
||||||
|
/// Don't forget to initialize 33 elements
|
||||||
public PROG_ORDER prog;
|
/// </summary>
|
||||||
|
public int[] pdy;
|
||||||
public int tile_x;
|
|
||||||
public int tile_y;
|
public opj_packet_info packet;
|
||||||
public int tile_Ox;
|
public int numpix;
|
||||||
public int tile_Oy;
|
public double distotile;
|
||||||
public int tw;
|
public int num_tps;
|
||||||
public int numcomps;
|
public opj_tp_info tp;
|
||||||
public int numlayers;
|
}
|
||||||
public int numdecompos;
|
|
||||||
public int marknum;
|
public struct opj_marker_info_t
|
||||||
public opj_marker_info_t marker;
|
{
|
||||||
public int maxmarknum;
|
public ushort type;
|
||||||
public int main_head_start;
|
public int pos;
|
||||||
public int main_head_end;
|
public int len;
|
||||||
public int codestream_size;
|
}
|
||||||
public opj_tile_info tile;
|
|
||||||
|
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 static class opj_defines
|
public PROG_ORDER prog;
|
||||||
{
|
|
||||||
public const int OPJ_STREAM_READ = 0x0001;
|
public int tile_x;
|
||||||
public const int OPJ_STREAM_WRITE = 0x0002;
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -1,48 +1,71 @@
|
||||||
using System;
|
/*
|
||||||
using System.Collections.Generic;
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
using System.Text;
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
|
*
|
||||||
namespace OpenSim.Framework.OpenJpeg
|
* Redistribution and use in source and binary forms, with or without
|
||||||
{
|
* modification, are permitted provided that the following conditions are met:
|
||||||
public static class pi
|
* * 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
|
||||||
public struct opj_pi_resolution
|
* documentation and/or other materials provided with the distribution.
|
||||||
{
|
* * Neither the name of the OpenSimulator Project nor the
|
||||||
public int pdx, pdy;
|
* names of its contributors may be used to endorse or promote products
|
||||||
public int pw, ph;
|
* derived from this software without specific prior written permission.
|
||||||
}
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||||
public struct opj_pi_comp
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
{
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
public int dx, dy;
|
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
public int numresolutions;
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
public opj_pi_resolution resolutions;
|
* (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
|
||||||
public struct obj_pi_iterator
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
{
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
public sbyte tp_on;
|
*/
|
||||||
public short include;
|
|
||||||
public int step_l;
|
using System;
|
||||||
public int step_r;
|
using System.Collections.Generic;
|
||||||
public int step_c;
|
using System.Text;
|
||||||
public int step_p;
|
|
||||||
public int compno;
|
namespace OpenSim.Framework.OpenJpeg
|
||||||
public int resno;
|
{
|
||||||
public int precno;
|
public static class pi
|
||||||
public int layno;
|
{
|
||||||
public int first;
|
}
|
||||||
public opj_poc poc;
|
|
||||||
public int numcomps;
|
public struct opj_pi_resolution
|
||||||
public opj_pi_comp comps;
|
{
|
||||||
|
public int pdx, pdy;
|
||||||
public int tx0, ty0, tx1, ty1;
|
public int pw, ph;
|
||||||
public int x, y, dx, dy;
|
}
|
||||||
}
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -1,339 +1,339 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) Contributors, http://opensimulator.org/
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
* * Redistributions of source code must retain the above copyright
|
* * Redistributions of source code must retain the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* notice, this list of conditions and the following disclaimer.
|
||||||
* * Redistributions in binary form must reproduce the above copyright
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* documentation and/or other materials provided with the distribution.
|
* documentation and/or other materials provided with the distribution.
|
||||||
* * Neither the name of the OpenSim Project nor the
|
* * Neither the name of the OpenSim Project nor the
|
||||||
* names of its contributors may be used to endorse or promote products
|
* names of its contributors may be used to endorse or promote products
|
||||||
* derived from this software without specific prior written permission.
|
* derived from this software without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
* 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
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections.Specialized;
|
using System.Collections.Specialized;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Web;
|
using System.Web;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using DotNetOpenId;
|
using DotNetOpenId;
|
||||||
using DotNetOpenId.Provider;
|
using DotNetOpenId.Provider;
|
||||||
using log4net;
|
using log4net;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using OpenSim.Framework.Servers;
|
using OpenSim.Framework.Servers;
|
||||||
|
|
||||||
namespace OpenSim.Grid.UserServer
|
namespace OpenSim.Grid.UserServer
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Temporary, in-memory store for OpenID associations
|
/// Temporary, in-memory store for OpenID associations
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class ProviderMemoryStore : IAssociationStore<AssociationRelyingPartyType>
|
public class ProviderMemoryStore : IAssociationStore<AssociationRelyingPartyType>
|
||||||
{
|
{
|
||||||
private class AssociationItem
|
private class AssociationItem
|
||||||
{
|
{
|
||||||
public AssociationRelyingPartyType DistinguishingFactor;
|
public AssociationRelyingPartyType DistinguishingFactor;
|
||||||
public string Handle;
|
public string Handle;
|
||||||
public DateTime Expires;
|
public DateTime Expires;
|
||||||
public byte[] PrivateData;
|
public byte[] PrivateData;
|
||||||
}
|
}
|
||||||
|
|
||||||
Dictionary<string, AssociationItem> m_store = new Dictionary<string, AssociationItem>();
|
Dictionary<string, AssociationItem> m_store = new Dictionary<string, AssociationItem>();
|
||||||
SortedList<DateTime, AssociationItem> m_sortedStore = new SortedList<DateTime, AssociationItem>();
|
SortedList<DateTime, AssociationItem> m_sortedStore = new SortedList<DateTime, AssociationItem>();
|
||||||
object m_syncRoot = new object();
|
object m_syncRoot = new object();
|
||||||
|
|
||||||
#region IAssociationStore<AssociationRelyingPartyType> Members
|
#region IAssociationStore<AssociationRelyingPartyType> Members
|
||||||
|
|
||||||
public void StoreAssociation(AssociationRelyingPartyType distinguishingFactor, Association assoc)
|
public void StoreAssociation(AssociationRelyingPartyType distinguishingFactor, Association assoc)
|
||||||
{
|
{
|
||||||
AssociationItem item = new AssociationItem();
|
AssociationItem item = new AssociationItem();
|
||||||
item.DistinguishingFactor = distinguishingFactor;
|
item.DistinguishingFactor = distinguishingFactor;
|
||||||
item.Handle = assoc.Handle;
|
item.Handle = assoc.Handle;
|
||||||
item.Expires = assoc.Expires.ToLocalTime();
|
item.Expires = assoc.Expires.ToLocalTime();
|
||||||
item.PrivateData = assoc.SerializePrivateData();
|
item.PrivateData = assoc.SerializePrivateData();
|
||||||
|
|
||||||
lock (m_syncRoot)
|
lock (m_syncRoot)
|
||||||
{
|
{
|
||||||
m_store[item.Handle] = item;
|
m_store[item.Handle] = item;
|
||||||
m_sortedStore[item.Expires] = item;
|
m_sortedStore[item.Expires] = item;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Association GetAssociation(AssociationRelyingPartyType distinguishingFactor)
|
public Association GetAssociation(AssociationRelyingPartyType distinguishingFactor)
|
||||||
{
|
{
|
||||||
lock (m_syncRoot)
|
lock (m_syncRoot)
|
||||||
{
|
{
|
||||||
if (m_sortedStore.Count > 0)
|
if (m_sortedStore.Count > 0)
|
||||||
{
|
{
|
||||||
AssociationItem item = m_sortedStore.Values[m_sortedStore.Count - 1];
|
AssociationItem item = m_sortedStore.Values[m_sortedStore.Count - 1];
|
||||||
return Association.Deserialize(item.Handle, item.Expires.ToUniversalTime(), item.PrivateData);
|
return Association.Deserialize(item.Handle, item.Expires.ToUniversalTime(), item.PrivateData);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Association GetAssociation(AssociationRelyingPartyType distinguishingFactor, string handle)
|
public Association GetAssociation(AssociationRelyingPartyType distinguishingFactor, string handle)
|
||||||
{
|
{
|
||||||
AssociationItem item;
|
AssociationItem item;
|
||||||
bool success = false;
|
bool success = false;
|
||||||
lock (m_syncRoot)
|
lock (m_syncRoot)
|
||||||
success = m_store.TryGetValue(handle, out item);
|
success = m_store.TryGetValue(handle, out item);
|
||||||
|
|
||||||
if (success)
|
if (success)
|
||||||
return Association.Deserialize(item.Handle, item.Expires.ToUniversalTime(), item.PrivateData);
|
return Association.Deserialize(item.Handle, item.Expires.ToUniversalTime(), item.PrivateData);
|
||||||
else
|
else
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool RemoveAssociation(AssociationRelyingPartyType distinguishingFactor, string handle)
|
public bool RemoveAssociation(AssociationRelyingPartyType distinguishingFactor, string handle)
|
||||||
{
|
{
|
||||||
lock (m_syncRoot)
|
lock (m_syncRoot)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < m_sortedStore.Values.Count; i++)
|
for (int i = 0; i < m_sortedStore.Values.Count; i++)
|
||||||
{
|
{
|
||||||
AssociationItem item = m_sortedStore.Values[i];
|
AssociationItem item = m_sortedStore.Values[i];
|
||||||
if (item.Handle == handle)
|
if (item.Handle == handle)
|
||||||
{
|
{
|
||||||
m_sortedStore.RemoveAt(i);
|
m_sortedStore.RemoveAt(i);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return m_store.Remove(handle);
|
return m_store.Remove(handle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ClearExpiredAssociations()
|
public void ClearExpiredAssociations()
|
||||||
{
|
{
|
||||||
lock (m_syncRoot)
|
lock (m_syncRoot)
|
||||||
{
|
{
|
||||||
List<AssociationItem> itemsCopy = new List<AssociationItem>(m_sortedStore.Values);
|
List<AssociationItem> itemsCopy = new List<AssociationItem>(m_sortedStore.Values);
|
||||||
DateTime now = DateTime.Now;
|
DateTime now = DateTime.Now;
|
||||||
|
|
||||||
for (int i = 0; i < itemsCopy.Count; i++)
|
for (int i = 0; i < itemsCopy.Count; i++)
|
||||||
{
|
{
|
||||||
AssociationItem item = itemsCopy[i];
|
AssociationItem item = itemsCopy[i];
|
||||||
|
|
||||||
if (item.Expires <= now)
|
if (item.Expires <= now)
|
||||||
{
|
{
|
||||||
m_sortedStore.RemoveAt(i);
|
m_sortedStore.RemoveAt(i);
|
||||||
m_store.Remove(item.Handle);
|
m_store.Remove(item.Handle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
|
||||||
public class OpenIdStreamHandler : IStreamHandler
|
public class OpenIdStreamHandler : IStreamHandler
|
||||||
{
|
{
|
||||||
#region HTML
|
#region HTML
|
||||||
|
|
||||||
/// <summary>Login form used to authenticate OpenID requests</summary>
|
/// <summary>Login form used to authenticate OpenID requests</summary>
|
||||||
const string LOGIN_PAGE =
|
const string LOGIN_PAGE =
|
||||||
@"<html>
|
@"<html>
|
||||||
<head><title>OpenSim OpenID Login</title></head>
|
<head><title>OpenSim OpenID Login</title></head>
|
||||||
<body>
|
<body>
|
||||||
<h3>OpenSim Login</h3>
|
<h3>OpenSim Login</h3>
|
||||||
<form method=""post"">
|
<form method=""post"">
|
||||||
<label for=""first"">First Name:</label> <input readonly type=""text"" name=""first"" id=""first"" value=""{0}""/>
|
<label for=""first"">First Name:</label> <input readonly type=""text"" name=""first"" id=""first"" value=""{0}""/>
|
||||||
<label for=""last"">Last Name:</label> <input readonly type=""text"" name=""last"" id=""last"" value=""{1}""/>
|
<label for=""last"">Last Name:</label> <input readonly type=""text"" name=""last"" id=""last"" value=""{1}""/>
|
||||||
<label for=""pass"">Password:</label> <input type=""password"" name=""pass"" id=""pass""/>
|
<label for=""pass"">Password:</label> <input type=""password"" name=""pass"" id=""pass""/>
|
||||||
<input type=""submit"" value=""Login"">
|
<input type=""submit"" value=""Login"">
|
||||||
</form>
|
</form>
|
||||||
</body>
|
</body>
|
||||||
</html>";
|
</html>";
|
||||||
|
|
||||||
/// <summary>Page shown for a valid OpenID identity</summary>
|
/// <summary>Page shown for a valid OpenID identity</summary>
|
||||||
const string OPENID_PAGE =
|
const string OPENID_PAGE =
|
||||||
@"<html>
|
@"<html>
|
||||||
<head>
|
<head>
|
||||||
<title>{2} {3}</title>
|
<title>{2} {3}</title>
|
||||||
<link rel=""openid2.provider openid.server"" href=""{0}://{1}/openid/server/""/>
|
<link rel=""openid2.provider openid.server"" href=""{0}://{1}/openid/server/""/>
|
||||||
</head>
|
</head>
|
||||||
<body>OpenID identifier for {2} {3}</body>
|
<body>OpenID identifier for {2} {3}</body>
|
||||||
</html>
|
</html>
|
||||||
";
|
";
|
||||||
|
|
||||||
/// <summary>Page shown for an invalid OpenID identity</summary>
|
/// <summary>Page shown for an invalid OpenID identity</summary>
|
||||||
const string INVALID_OPENID_PAGE =
|
const string INVALID_OPENID_PAGE =
|
||||||
@"<html><head><title>Identity not found</title></head>
|
@"<html><head><title>Identity not found</title></head>
|
||||||
<body>Invalid OpenID identity</body></html>";
|
<body>Invalid OpenID identity</body></html>";
|
||||||
|
|
||||||
/// <summary>Page shown if the OpenID endpoint is requested directly</summary>
|
/// <summary>Page shown if the OpenID endpoint is requested directly</summary>
|
||||||
const string ENDPOINT_PAGE =
|
const string ENDPOINT_PAGE =
|
||||||
@"<html><head><title>OpenID Endpoint</title></head><body>
|
@"<html><head><title>OpenID Endpoint</title></head><body>
|
||||||
This is an OpenID server endpoint, not a human-readable resource.
|
This is an OpenID server endpoint, not a human-readable resource.
|
||||||
For more information, see <a href='http://openid.net/'>http://openid.net/</a>.
|
For more information, see <a href='http://openid.net/'>http://openid.net/</a>.
|
||||||
</body></html>";
|
</body></html>";
|
||||||
|
|
||||||
#endregion HTML
|
#endregion HTML
|
||||||
|
|
||||||
public string ContentType { get { return m_contentType; } }
|
public string ContentType { get { return m_contentType; } }
|
||||||
public string HttpMethod { get { return m_httpMethod; } }
|
public string HttpMethod { get { return m_httpMethod; } }
|
||||||
public string Path { get { return m_path; } }
|
public string Path { get { return m_path; } }
|
||||||
|
|
||||||
string m_contentType;
|
string m_contentType;
|
||||||
string m_httpMethod;
|
string m_httpMethod;
|
||||||
string m_path;
|
string m_path;
|
||||||
UserLoginService m_loginService;
|
UserLoginService m_loginService;
|
||||||
ProviderMemoryStore m_openidStore = new ProviderMemoryStore();
|
ProviderMemoryStore m_openidStore = new ProviderMemoryStore();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Constructor
|
/// Constructor
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public OpenIdStreamHandler(string httpMethod, string path, UserLoginService loginService)
|
public OpenIdStreamHandler(string httpMethod, string path, UserLoginService loginService)
|
||||||
{
|
{
|
||||||
m_loginService = loginService;
|
m_loginService = loginService;
|
||||||
m_httpMethod = httpMethod;
|
m_httpMethod = httpMethod;
|
||||||
m_path = path;
|
m_path = path;
|
||||||
|
|
||||||
m_contentType = "text/html";
|
m_contentType = "text/html";
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Handles all GET and POST requests for OpenID identifier pages and endpoint
|
/// Handles all GET and POST requests for OpenID identifier pages and endpoint
|
||||||
/// server communication
|
/// server communication
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void Handle(string path, Stream request, Stream response, OSHttpRequest httpRequest, OSHttpResponse httpResponse)
|
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));
|
Uri providerEndpoint = new Uri(String.Format("{0}://{1}{2}", httpRequest.Url.Scheme, httpRequest.Url.Authority, httpRequest.Url.AbsolutePath));
|
||||||
|
|
||||||
// Defult to returning HTML content
|
// Defult to returning HTML content
|
||||||
m_contentType = "text/html";
|
m_contentType = "text/html";
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
NameValueCollection postQuery = HttpUtility.ParseQueryString(new StreamReader(httpRequest.InputStream).ReadToEnd());
|
NameValueCollection postQuery = HttpUtility.ParseQueryString(new StreamReader(httpRequest.InputStream).ReadToEnd());
|
||||||
NameValueCollection getQuery = HttpUtility.ParseQueryString(httpRequest.Url.Query);
|
NameValueCollection getQuery = HttpUtility.ParseQueryString(httpRequest.Url.Query);
|
||||||
NameValueCollection openIdQuery = (postQuery.GetValues("openid.mode") != null ? postQuery : getQuery);
|
NameValueCollection openIdQuery = (postQuery.GetValues("openid.mode") != null ? postQuery : getQuery);
|
||||||
|
|
||||||
OpenIdProvider provider = new OpenIdProvider(m_openidStore, providerEndpoint, httpRequest.Url, openIdQuery);
|
OpenIdProvider provider = new OpenIdProvider(m_openidStore, providerEndpoint, httpRequest.Url, openIdQuery);
|
||||||
|
|
||||||
if (provider.Request != null)
|
if (provider.Request != null)
|
||||||
{
|
{
|
||||||
if (!provider.Request.IsResponseReady && provider.Request is IAuthenticationRequest)
|
if (!provider.Request.IsResponseReady && provider.Request is IAuthenticationRequest)
|
||||||
{
|
{
|
||||||
IAuthenticationRequest authRequest = (IAuthenticationRequest)provider.Request;
|
IAuthenticationRequest authRequest = (IAuthenticationRequest)provider.Request;
|
||||||
string[] passwordValues = postQuery.GetValues("pass");
|
string[] passwordValues = postQuery.GetValues("pass");
|
||||||
|
|
||||||
UserProfileData profile;
|
UserProfileData profile;
|
||||||
if (TryGetProfile(new Uri(authRequest.ClaimedIdentifier.ToString()), out profile))
|
if (TryGetProfile(new Uri(authRequest.ClaimedIdentifier.ToString()), out profile))
|
||||||
{
|
{
|
||||||
// Check for form POST data
|
// Check for form POST data
|
||||||
if (passwordValues != null && passwordValues.Length == 1)
|
if (passwordValues != null && passwordValues.Length == 1)
|
||||||
{
|
{
|
||||||
if (profile != null && m_loginService.AuthenticateUser(profile, passwordValues[0]))
|
if (profile != null && m_loginService.AuthenticateUser(profile, passwordValues[0]))
|
||||||
authRequest.IsAuthenticated = true;
|
authRequest.IsAuthenticated = true;
|
||||||
else
|
else
|
||||||
authRequest.IsAuthenticated = false;
|
authRequest.IsAuthenticated = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Authentication was requested, send the client a login form
|
// Authentication was requested, send the client a login form
|
||||||
using (StreamWriter writer = new StreamWriter(response))
|
using (StreamWriter writer = new StreamWriter(response))
|
||||||
writer.Write(String.Format(LOGIN_PAGE, profile.FirstName, profile.SurName));
|
writer.Write(String.Format(LOGIN_PAGE, profile.FirstName, profile.SurName));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Cannot find an avatar matching the claimed identifier
|
// Cannot find an avatar matching the claimed identifier
|
||||||
authRequest.IsAuthenticated = false;
|
authRequest.IsAuthenticated = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add OpenID headers to the response
|
// Add OpenID headers to the response
|
||||||
foreach (string key in provider.Request.Response.Headers.Keys)
|
foreach (string key in provider.Request.Response.Headers.Keys)
|
||||||
httpResponse.AddHeader(key, provider.Request.Response.Headers[key]);
|
httpResponse.AddHeader(key, provider.Request.Response.Headers[key]);
|
||||||
|
|
||||||
string[] contentTypeValues = provider.Request.Response.Headers.GetValues("Content-Type");
|
string[] contentTypeValues = provider.Request.Response.Headers.GetValues("Content-Type");
|
||||||
if (contentTypeValues != null && contentTypeValues.Length == 1)
|
if (contentTypeValues != null && contentTypeValues.Length == 1)
|
||||||
m_contentType = contentTypeValues[0];
|
m_contentType = contentTypeValues[0];
|
||||||
|
|
||||||
// Set the response code and document body based on the OpenID result
|
// Set the response code and document body based on the OpenID result
|
||||||
httpResponse.StatusCode = (int)provider.Request.Response.Code;
|
httpResponse.StatusCode = (int)provider.Request.Response.Code;
|
||||||
response.Write(provider.Request.Response.Body, 0, provider.Request.Response.Body.Length);
|
response.Write(provider.Request.Response.Body, 0, provider.Request.Response.Body.Length);
|
||||||
response.Close();
|
response.Close();
|
||||||
}
|
}
|
||||||
else if (httpRequest.Url.AbsolutePath.Contains("/openid/server"))
|
else if (httpRequest.Url.AbsolutePath.Contains("/openid/server"))
|
||||||
{
|
{
|
||||||
// Standard HTTP GET was made on the OpenID endpoint, send the client the default error page
|
// Standard HTTP GET was made on the OpenID endpoint, send the client the default error page
|
||||||
using (StreamWriter writer = new StreamWriter(response))
|
using (StreamWriter writer = new StreamWriter(response))
|
||||||
writer.Write(ENDPOINT_PAGE);
|
writer.Write(ENDPOINT_PAGE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Try and lookup this avatar
|
// Try and lookup this avatar
|
||||||
UserProfileData profile;
|
UserProfileData profile;
|
||||||
if (TryGetProfile(httpRequest.Url, out profile))
|
if (TryGetProfile(httpRequest.Url, out profile))
|
||||||
{
|
{
|
||||||
using (StreamWriter writer = new StreamWriter(response))
|
using (StreamWriter writer = new StreamWriter(response))
|
||||||
{
|
{
|
||||||
// TODO: Print out a full profile page for this avatar
|
// TODO: Print out a full profile page for this avatar
|
||||||
writer.Write(String.Format(OPENID_PAGE, httpRequest.Url.Scheme,
|
writer.Write(String.Format(OPENID_PAGE, httpRequest.Url.Scheme,
|
||||||
httpRequest.Url.Authority, profile.FirstName, profile.SurName));
|
httpRequest.Url.Authority, profile.FirstName, profile.SurName));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Couldn't parse an avatar name, or couldn't find the avatar in the user server
|
// Couldn't parse an avatar name, or couldn't find the avatar in the user server
|
||||||
using (StreamWriter writer = new StreamWriter(response))
|
using (StreamWriter writer = new StreamWriter(response))
|
||||||
writer.Write(INVALID_OPENID_PAGE);
|
writer.Write(INVALID_OPENID_PAGE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
httpResponse.StatusCode = (int)HttpStatusCode.InternalServerError;
|
httpResponse.StatusCode = (int)HttpStatusCode.InternalServerError;
|
||||||
using (StreamWriter writer = new StreamWriter(response))
|
using (StreamWriter writer = new StreamWriter(response))
|
||||||
writer.Write(ex.Message);
|
writer.Write(ex.Message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Parse a URL with a relative path of the form /users/First_Last and try to
|
/// Parse a URL with a relative path of the form /users/First_Last and try to
|
||||||
/// retrieve the profile matching that avatar name
|
/// retrieve the profile matching that avatar name
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="requestUrl">URL to parse for an avatar name</param>
|
/// <param name="requestUrl">URL to parse for an avatar name</param>
|
||||||
/// <param name="profile">Profile data for the avatar</param>
|
/// <param name="profile">Profile data for the avatar</param>
|
||||||
/// <returns>True if the parse and lookup were successful, otherwise false</returns>
|
/// <returns>True if the parse and lookup were successful, otherwise false</returns>
|
||||||
bool TryGetProfile(Uri requestUrl, out UserProfileData profile)
|
bool TryGetProfile(Uri requestUrl, out UserProfileData profile)
|
||||||
{
|
{
|
||||||
if (requestUrl.Segments.Length == 3 && requestUrl.Segments[1] == "users/")
|
if (requestUrl.Segments.Length == 3 && requestUrl.Segments[1] == "users/")
|
||||||
{
|
{
|
||||||
// Parse the avatar name from the path
|
// Parse the avatar name from the path
|
||||||
string username = requestUrl.Segments[requestUrl.Segments.Length - 1];
|
string username = requestUrl.Segments[requestUrl.Segments.Length - 1];
|
||||||
string[] name = username.Split('_');
|
string[] name = username.Split('_');
|
||||||
|
|
||||||
if (name.Length == 2)
|
if (name.Length == 2)
|
||||||
{
|
{
|
||||||
profile = m_loginService.GetTheUser(name[0], name[1]);
|
profile = m_loginService.GetTheUser(name[0], name[1]);
|
||||||
return (profile != null);
|
return (profile != null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
profile = null;
|
profile = null;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8248,7 +8248,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
ap.Data = new AvatarPicksReplyPacket.DataBlock[picks.Count];
|
ap.Data = new AvatarPicksReplyPacket.DataBlock[picks.Count];
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
foreach(KeyValuePair<UUID, string> pick in picks)
|
foreach (KeyValuePair<UUID, string> pick in picks)
|
||||||
{
|
{
|
||||||
ap.Data[i] = new AvatarPicksReplyPacket.DataBlock();
|
ap.Data[i] = new AvatarPicksReplyPacket.DataBlock();
|
||||||
ap.Data[i].PickID = pick.Key;
|
ap.Data[i].PickID = pick.Key;
|
||||||
|
@ -8272,7 +8272,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
ac.Data = new AvatarClassifiedReplyPacket.DataBlock[classifieds.Count];
|
ac.Data = new AvatarClassifiedReplyPacket.DataBlock[classifieds.Count];
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
foreach(KeyValuePair<UUID, string> classified in classifieds)
|
foreach (KeyValuePair<UUID, string> classified in classifieds)
|
||||||
{
|
{
|
||||||
ac.Data[i] = new AvatarClassifiedReplyPacket.DataBlock();
|
ac.Data[i] = new AvatarClassifiedReplyPacket.DataBlock();
|
||||||
ac.Data[i].ClassifiedID = classified.Key;
|
ac.Data[i].ClassifiedID = classified.Key;
|
||||||
|
|
|
@ -1,47 +1,47 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) Contributors, http://opensimulator.org/
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
* * Redistributions of source code must retain the above copyright
|
* * Redistributions of source code must retain the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* notice, this list of conditions and the following disclaimer.
|
||||||
* * Redistributions in binary form must reproduce the above copyright
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* documentation and/or other materials provided with the distribution.
|
* documentation and/or other materials provided with the distribution.
|
||||||
* * Neither the name of the OpenSim Project nor the
|
* * Neither the name of the OpenSim Project nor the
|
||||||
* names of its contributors may be used to endorse or promote products
|
* names of its contributors may be used to endorse or promote products
|
||||||
* derived from this software without specific prior written permission.
|
* derived from this software without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
* 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
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
|
|
||||||
namespace OpenSim.Region.Environment.Interfaces
|
namespace OpenSim.Region.Environment.Interfaces
|
||||||
{
|
{
|
||||||
public delegate bool ChildAgentUpdateReceived(AgentData data);
|
public delegate bool ChildAgentUpdateReceived(AgentData data);
|
||||||
|
|
||||||
public interface IInterregionCommsOut
|
public interface IInterregionCommsOut
|
||||||
{
|
{
|
||||||
bool SendChildAgentUpdate(ulong regionHandle, AgentData data);
|
bool SendChildAgentUpdate(ulong regionHandle, AgentData data);
|
||||||
}
|
}
|
||||||
|
|
||||||
// This may not be needed, but having it here for now.
|
// This may not be needed, but having it here for now.
|
||||||
public interface IInterregionCommsIn
|
public interface IInterregionCommsIn
|
||||||
{
|
{
|
||||||
event ChildAgentUpdateReceived OnChildAgentUpdate;
|
event ChildAgentUpdateReceived OnChildAgentUpdate;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,140 +1,140 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) Contributors, http://opensimulator.org/
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
* * Redistributions of source code must retain the above copyright
|
* * Redistributions of source code must retain the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* notice, this list of conditions and the following disclaimer.
|
||||||
* * Redistributions in binary form must reproduce the above copyright
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* documentation and/or other materials provided with the distribution.
|
* documentation and/or other materials provided with the distribution.
|
||||||
* * Neither the name of the OpenSim Project nor the
|
* * Neither the name of the OpenSim Project nor the
|
||||||
* names of its contributors may be used to endorse or promote products
|
* names of its contributors may be used to endorse or promote products
|
||||||
* derived from this software without specific prior written permission.
|
* derived from this software without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
* 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
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Net.Sockets;
|
using System.Net.Sockets;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Xml;
|
using System.Xml;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
using log4net;
|
using log4net;
|
||||||
using Nini.Config;
|
using Nini.Config;
|
||||||
using Nwc.XmlRpc;
|
using Nwc.XmlRpc;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using OpenSim.Framework.Communications.Cache;
|
using OpenSim.Framework.Communications.Cache;
|
||||||
using OpenSim.Region.Environment.Interfaces;
|
using OpenSim.Region.Environment.Interfaces;
|
||||||
using OpenSim.Region.Interfaces;
|
using OpenSim.Region.Interfaces;
|
||||||
using OpenSim.Region.Environment.Scenes;
|
using OpenSim.Region.Environment.Scenes;
|
||||||
|
|
||||||
namespace OpenSim.Region.Environment.Modules.Communications.Local
|
namespace OpenSim.Region.Environment.Modules.Communications.Local
|
||||||
{
|
{
|
||||||
public class LocalInterregionComms : IRegionModule, IInterregionCommsOut, IInterregionCommsIn
|
public class LocalInterregionComms : IRegionModule, IInterregionCommsOut, IInterregionCommsIn
|
||||||
{
|
{
|
||||||
private bool m_enabled = false;
|
private bool m_enabled = false;
|
||||||
|
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
private List<Scene> m_sceneList = new List<Scene>();
|
private List<Scene> m_sceneList = new List<Scene>();
|
||||||
|
|
||||||
#region Events
|
#region Events
|
||||||
public event ChildAgentUpdateReceived OnChildAgentUpdate;
|
public event ChildAgentUpdateReceived OnChildAgentUpdate;
|
||||||
|
|
||||||
#endregion /* Events */
|
#endregion /* Events */
|
||||||
|
|
||||||
#region IRegionModule
|
#region IRegionModule
|
||||||
|
|
||||||
public void Initialise(Scene scene, IConfigSource config)
|
public void Initialise(Scene scene, IConfigSource config)
|
||||||
{
|
{
|
||||||
if (m_sceneList.Count == 0)
|
if (m_sceneList.Count == 0)
|
||||||
{
|
{
|
||||||
IConfig startupConfig = config.Configs["Communications"];
|
IConfig startupConfig = config.Configs["Communications"];
|
||||||
|
|
||||||
if ((startupConfig == null) ||
|
if ((startupConfig == null) ||
|
||||||
(startupConfig != null) && (startupConfig.GetString("InterregionComms", "RESTCommms") == "LocalComms"))
|
(startupConfig != null) && (startupConfig.GetString("InterregionComms", "RESTCommms") == "LocalComms"))
|
||||||
m_enabled = true;
|
m_enabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!m_enabled)
|
if (!m_enabled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Init(scene);
|
Init(scene);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void PostInitialise()
|
public void PostInitialise()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Close()
|
public void Close()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Name
|
public string Name
|
||||||
{
|
{
|
||||||
get { return "LocalInterregionCommsModule"; }
|
get { return "LocalInterregionCommsModule"; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsSharedModule
|
public bool IsSharedModule
|
||||||
{
|
{
|
||||||
get { return true; }
|
get { return true; }
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Can be called from other modules.
|
/// Can be called from other modules.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="scene"></param>
|
/// <param name="scene"></param>
|
||||||
public void Init(Scene scene)
|
public void Init(Scene scene)
|
||||||
{
|
{
|
||||||
if (!m_sceneList.Contains(scene))
|
if (!m_sceneList.Contains(scene))
|
||||||
{
|
{
|
||||||
lock (m_sceneList)
|
lock (m_sceneList)
|
||||||
{
|
{
|
||||||
m_sceneList.Add(scene);
|
m_sceneList.Add(scene);
|
||||||
if (m_enabled)
|
if (m_enabled)
|
||||||
scene.RegisterModuleInterface<IInterregionCommsOut>(this);
|
scene.RegisterModuleInterface<IInterregionCommsOut>(this);
|
||||||
scene.RegisterModuleInterface<IInterregionCommsIn>(this);
|
scene.RegisterModuleInterface<IInterregionCommsIn>(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion /* IRegionModule */
|
#endregion /* IRegionModule */
|
||||||
|
|
||||||
#region IInterregionComms
|
#region IInterregionComms
|
||||||
|
|
||||||
public bool SendChildAgentUpdate(ulong regionHandle, AgentData cAgentData)
|
public bool SendChildAgentUpdate(ulong regionHandle, AgentData cAgentData)
|
||||||
{
|
{
|
||||||
lock (m_sceneList)
|
lock (m_sceneList)
|
||||||
{
|
{
|
||||||
foreach (Scene s in m_sceneList)
|
foreach (Scene s in m_sceneList)
|
||||||
{
|
{
|
||||||
if (s.RegionInfo.RegionHandle == regionHandle)
|
if (s.RegionInfo.RegionHandle == regionHandle)
|
||||||
{
|
{
|
||||||
//m_log.Debug("[LOCAL COMMS]: Found region to send ChildAgentUpdate");
|
//m_log.Debug("[LOCAL COMMS]: Found region to send ChildAgentUpdate");
|
||||||
return s.IncomingChildAgentDataUpdate(cAgentData);
|
return s.IncomingChildAgentDataUpdate(cAgentData);
|
||||||
//if (OnChildAgentUpdate != null)
|
//if (OnChildAgentUpdate != null)
|
||||||
// return OnChildAgentUpdate(cAgentData);
|
// return OnChildAgentUpdate(cAgentData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_log.Debug("[LOCAL COMMS]: region not found for ChildAgentUpdate");
|
m_log.Debug("[LOCAL COMMS]: region not found for ChildAgentUpdate");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion /* IInterregionComms */
|
#endregion /* IInterregionComms */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,86 +1,86 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) Contributors, http://opensimulator.org/
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
* * Redistributions of source code must retain the above copyright
|
* * Redistributions of source code must retain the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* notice, this list of conditions and the following disclaimer.
|
||||||
* * Redistributions in binary form must reproduce the above copyright
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* documentation and/or other materials provided with the distribution.
|
* documentation and/or other materials provided with the distribution.
|
||||||
* * Neither the name of the OpenSim Project nor the
|
* * Neither the name of the OpenSim Project nor the
|
||||||
* names of its contributors may be used to endorse or promote products
|
* names of its contributors may be used to endorse or promote products
|
||||||
* derived from this software without specific prior written permission.
|
* derived from this software without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
* 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
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using log4net;
|
using log4net;
|
||||||
using Nini.Config;
|
using Nini.Config;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using OpenSim.Framework.Communications;
|
using OpenSim.Framework.Communications;
|
||||||
using OpenSim.Framework.Communications.Cache;
|
using OpenSim.Framework.Communications.Cache;
|
||||||
using OpenSim.Region.Environment.Interfaces;
|
using OpenSim.Region.Environment.Interfaces;
|
||||||
using OpenSim.Region.Interfaces;
|
using OpenSim.Region.Interfaces;
|
||||||
using OpenSim.Region.Environment.Scenes;
|
using OpenSim.Region.Environment.Scenes;
|
||||||
using OpenSim.Region.Environment.Scenes.Hypergrid;
|
using OpenSim.Region.Environment.Scenes.Hypergrid;
|
||||||
|
|
||||||
namespace OpenSim.Region.Environment.Modules.Communications.REST
|
namespace OpenSim.Region.Environment.Modules.Communications.REST
|
||||||
{
|
{
|
||||||
public class HGInterregionComms : RESTInterregionComms
|
public class HGInterregionComms : RESTInterregionComms
|
||||||
{
|
{
|
||||||
private static bool initialized = false;
|
private static bool initialized = false;
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
#region IRegionModule
|
#region IRegionModule
|
||||||
|
|
||||||
public override void Initialise(Scene scene, IConfigSource config)
|
public override void Initialise(Scene scene, IConfigSource config)
|
||||||
{
|
{
|
||||||
if (!initialized)
|
if (!initialized)
|
||||||
{
|
{
|
||||||
initialized = true;
|
initialized = true;
|
||||||
IConfig startupConfig = config.Configs["Communications"];
|
IConfig startupConfig = config.Configs["Communications"];
|
||||||
if ((startupConfig != null) && (startupConfig.GetString("InterregionComms", "RESTCommms") == "HGRESTComms"))
|
if ((startupConfig != null) && (startupConfig.GetString("InterregionComms", "RESTCommms") == "HGRESTComms"))
|
||||||
{
|
{
|
||||||
m_enabled = true;
|
m_enabled = true;
|
||||||
InitOnce(scene);
|
InitOnce(scene);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!m_enabled)
|
if (!m_enabled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
InitEach(scene);
|
InitEach(scene);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override string Name
|
public override string Name
|
||||||
{
|
{
|
||||||
get { return "HGInterregionCommsModule"; }
|
get { return "HGInterregionCommsModule"; }
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion /* IRegionModule */
|
#endregion /* IRegionModule */
|
||||||
|
|
||||||
#region Misc
|
#region Misc
|
||||||
|
|
||||||
protected override ulong GetRegionHandle(RegionInfo region)
|
protected override ulong GetRegionHandle(RegionInfo region)
|
||||||
{
|
{
|
||||||
return ((HGSceneCommunicationService)(m_aScene.SceneGridService)).m_hg.FindRegionHandle(region.RegionHandle);
|
return ((HGSceneCommunicationService)(m_aScene.SceneGridService)).m_hg.FindRegionHandle(region.RegionHandle);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion /* Misc */
|
#endregion /* Misc */
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,296 +1,296 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) Contributors, http://opensimulator.org/
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
* * Redistributions of source code must retain the above copyright
|
* * Redistributions of source code must retain the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* notice, this list of conditions and the following disclaimer.
|
||||||
* * Redistributions in binary form must reproduce the above copyright
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* documentation and/or other materials provided with the distribution.
|
* documentation and/or other materials provided with the distribution.
|
||||||
* * Neither the name of the OpenSim Project nor the
|
* * Neither the name of the OpenSim Project nor the
|
||||||
* names of its contributors may be used to endorse or promote products
|
* names of its contributors may be used to endorse or promote products
|
||||||
* derived from this software without specific prior written permission.
|
* derived from this software without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
* 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
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Net.Sockets;
|
using System.Net.Sockets;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Xml;
|
using System.Xml;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
using OpenMetaverse.StructuredData;
|
using OpenMetaverse.StructuredData;
|
||||||
using log4net;
|
using log4net;
|
||||||
using Nini.Config;
|
using Nini.Config;
|
||||||
using Nwc.XmlRpc;
|
using Nwc.XmlRpc;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using OpenSim.Framework.Communications;
|
using OpenSim.Framework.Communications;
|
||||||
using OpenSim.Framework.Communications.Cache;
|
using OpenSim.Framework.Communications.Cache;
|
||||||
using OpenSim.Region.Environment.Interfaces;
|
using OpenSim.Region.Environment.Interfaces;
|
||||||
using OpenSim.Region.Interfaces;
|
using OpenSim.Region.Interfaces;
|
||||||
using OpenSim.Region.Environment.Scenes;
|
using OpenSim.Region.Environment.Scenes;
|
||||||
using OpenSim.Region.Environment.Modules.Communications.Local;
|
using OpenSim.Region.Environment.Modules.Communications.Local;
|
||||||
|
|
||||||
namespace OpenSim.Region.Environment.Modules.Communications.REST
|
namespace OpenSim.Region.Environment.Modules.Communications.REST
|
||||||
{
|
{
|
||||||
public class RESTInterregionComms : IRegionModule, IInterregionCommsOut
|
public class RESTInterregionComms : IRegionModule, IInterregionCommsOut
|
||||||
{
|
{
|
||||||
private static bool initialized = false;
|
private static bool initialized = false;
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
protected bool m_enabled = false;
|
protected bool m_enabled = false;
|
||||||
protected Scene m_aScene;
|
protected Scene m_aScene;
|
||||||
// RESTInterregionComms does not care about local regions; it delegates that to the Local module
|
// RESTInterregionComms does not care about local regions; it delegates that to the Local module
|
||||||
protected LocalInterregionComms m_localBackend;
|
protected LocalInterregionComms m_localBackend;
|
||||||
|
|
||||||
protected CommunicationsManager m_commsManager;
|
protected CommunicationsManager m_commsManager;
|
||||||
|
|
||||||
#region IRegionModule
|
#region IRegionModule
|
||||||
|
|
||||||
public virtual void Initialise(Scene scene, IConfigSource config)
|
public virtual void Initialise(Scene scene, IConfigSource config)
|
||||||
{
|
{
|
||||||
if (!initialized)
|
if (!initialized)
|
||||||
{
|
{
|
||||||
initialized = true;
|
initialized = true;
|
||||||
IConfig startupConfig = config.Configs["Communications"];
|
IConfig startupConfig = config.Configs["Communications"];
|
||||||
if ((startupConfig != null) && (startupConfig.GetString("InterregionComms", "RESTCommms") == "RESTComms"))
|
if ((startupConfig != null) && (startupConfig.GetString("InterregionComms", "RESTCommms") == "RESTComms"))
|
||||||
{
|
{
|
||||||
m_enabled = true;
|
m_enabled = true;
|
||||||
InitOnce(scene);
|
InitOnce(scene);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!m_enabled)
|
if (!m_enabled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
InitEach(scene);
|
InitEach(scene);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void PostInitialise()
|
public virtual void PostInitialise()
|
||||||
{
|
{
|
||||||
if (m_enabled)
|
if (m_enabled)
|
||||||
AddHTTPHandlers();
|
AddHTTPHandlers();
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void Close()
|
public virtual void Close()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual string Name
|
public virtual string Name
|
||||||
{
|
{
|
||||||
get { return "RESTInterregionCommsModule"; }
|
get { return "RESTInterregionCommsModule"; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual bool IsSharedModule
|
public virtual bool IsSharedModule
|
||||||
{
|
{
|
||||||
get { return true; }
|
get { return true; }
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual void InitEach(Scene scene)
|
protected virtual void InitEach(Scene scene)
|
||||||
{
|
{
|
||||||
m_localBackend.Init(scene);
|
m_localBackend.Init(scene);
|
||||||
scene.RegisterModuleInterface<IInterregionCommsOut>(this);
|
scene.RegisterModuleInterface<IInterregionCommsOut>(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual void InitOnce(Scene scene)
|
protected virtual void InitOnce(Scene scene)
|
||||||
{
|
{
|
||||||
m_localBackend = new LocalInterregionComms();
|
m_localBackend = new LocalInterregionComms();
|
||||||
m_commsManager = scene.CommsManager;
|
m_commsManager = scene.CommsManager;
|
||||||
m_aScene = scene;
|
m_aScene = scene;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual void AddHTTPHandlers()
|
protected virtual void AddHTTPHandlers()
|
||||||
{
|
{
|
||||||
m_aScene.AddHTTPHandler("/ChildAgentUpdate/", ChildAgentUpdateHandler);
|
m_aScene.AddHTTPHandler("/ChildAgentUpdate/", ChildAgentUpdateHandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion /* IRegionModule */
|
#endregion /* IRegionModule */
|
||||||
|
|
||||||
#region IInterregionComms
|
#region IInterregionComms
|
||||||
|
|
||||||
public bool SendChildAgentUpdate(ulong regionHandle, AgentData cAgentData)
|
public bool SendChildAgentUpdate(ulong regionHandle, AgentData cAgentData)
|
||||||
{
|
{
|
||||||
// Try local first
|
// Try local first
|
||||||
if (m_localBackend.SendChildAgentUpdate(regionHandle, cAgentData))
|
if (m_localBackend.SendChildAgentUpdate(regionHandle, cAgentData))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
// else do the remote thing
|
// else do the remote thing
|
||||||
RegionInfo regInfo = m_commsManager.GridService.RequestNeighbourInfo(regionHandle);
|
RegionInfo regInfo = m_commsManager.GridService.RequestNeighbourInfo(regionHandle);
|
||||||
if (regInfo != null)
|
if (regInfo != null)
|
||||||
{
|
{
|
||||||
return DoChildAgentUpdateCall(regInfo, cAgentData);
|
return DoChildAgentUpdateCall(regInfo, cAgentData);
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected bool DoChildAgentUpdateCall(RegionInfo region, AgentData cAgentData)
|
protected bool DoChildAgentUpdateCall(RegionInfo region, AgentData cAgentData)
|
||||||
{
|
{
|
||||||
string uri = "http://" + region.ExternalEndPoint.Address + ":" + region.HttpPort + "/ChildAgentUpdate/";
|
string uri = "http://" + region.ExternalEndPoint.Address + ":" + region.HttpPort + "/ChildAgentUpdate/";
|
||||||
//Console.WriteLine(" >>> DoChildAgentUpdateCall <<< " + uri);
|
//Console.WriteLine(" >>> DoChildAgentUpdateCall <<< " + uri);
|
||||||
|
|
||||||
WebRequest ChildUpdateRequest = WebRequest.Create(uri);
|
WebRequest ChildUpdateRequest = WebRequest.Create(uri);
|
||||||
ChildUpdateRequest.Method = "PUT";
|
ChildUpdateRequest.Method = "PUT";
|
||||||
ChildUpdateRequest.ContentType = "application/json";
|
ChildUpdateRequest.ContentType = "application/json";
|
||||||
ChildUpdateRequest.Timeout = 10000;
|
ChildUpdateRequest.Timeout = 10000;
|
||||||
|
|
||||||
// Fill it in
|
// Fill it in
|
||||||
OSDMap args = null;
|
OSDMap args = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
args = cAgentData.PackUpdateMessage();
|
args = cAgentData.PackUpdateMessage();
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
m_log.Debug("[REST COMMS]: PackUpdateMessage failed with exception: " + e.Message);
|
m_log.Debug("[REST COMMS]: PackUpdateMessage failed with exception: " + e.Message);
|
||||||
}
|
}
|
||||||
// Add the regionhandle of the destination region
|
// Add the regionhandle of the destination region
|
||||||
ulong regionHandle = GetRegionHandle(region);
|
ulong regionHandle = GetRegionHandle(region);
|
||||||
args["destination_handle"] = OSD.FromString(regionHandle.ToString());
|
args["destination_handle"] = OSD.FromString(regionHandle.ToString());
|
||||||
|
|
||||||
string strBuffer = "";
|
string strBuffer = "";
|
||||||
byte[] buffer = new byte[1];
|
byte[] buffer = new byte[1];
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
strBuffer = OSDParser.SerializeJsonString(args);
|
strBuffer = OSDParser.SerializeJsonString(args);
|
||||||
System.Text.UTF8Encoding str = new System.Text.UTF8Encoding();
|
System.Text.UTF8Encoding str = new System.Text.UTF8Encoding();
|
||||||
buffer = str.GetBytes(strBuffer);
|
buffer = str.GetBytes(strBuffer);
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
m_log.WarnFormat("[OSG2]: Exception thrown on serialization of ChildUpdate: {0}", e.Message);
|
m_log.WarnFormat("[OSG2]: Exception thrown on serialization of ChildUpdate: {0}", e.Message);
|
||||||
// ignore. buffer will be empty, caller should check.
|
// ignore. buffer will be empty, caller should check.
|
||||||
}
|
}
|
||||||
|
|
||||||
Stream os = null;
|
Stream os = null;
|
||||||
try
|
try
|
||||||
{ // send the Post
|
{ // send the Post
|
||||||
ChildUpdateRequest.ContentLength = buffer.Length; //Count bytes to send
|
ChildUpdateRequest.ContentLength = buffer.Length; //Count bytes to send
|
||||||
os = ChildUpdateRequest.GetRequestStream();
|
os = ChildUpdateRequest.GetRequestStream();
|
||||||
os.Write(buffer, 0, strBuffer.Length); //Send it
|
os.Write(buffer, 0, strBuffer.Length); //Send it
|
||||||
os.Close();
|
os.Close();
|
||||||
//m_log.InfoFormat("[REST COMMS]: Posted ChildAgentUpdate request to remote sim {0}", uri);
|
//m_log.InfoFormat("[REST COMMS]: Posted ChildAgentUpdate request to remote sim {0}", uri);
|
||||||
}
|
}
|
||||||
catch (WebException ex)
|
catch (WebException ex)
|
||||||
{
|
{
|
||||||
//m_log.InfoFormat("[REST COMMS]: Bad send on ChildAgentUpdate {0}", ex.Message);
|
//m_log.InfoFormat("[REST COMMS]: Bad send on ChildAgentUpdate {0}", ex.Message);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Let's wait for the response
|
// Let's wait for the response
|
||||||
//m_log.Info("[REST COMMS]: Waiting for a reply after ChildAgentUpdate");
|
//m_log.Info("[REST COMMS]: Waiting for a reply after ChildAgentUpdate");
|
||||||
string reply = null;
|
string reply = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
WebResponse webResponse = ChildUpdateRequest.GetResponse();
|
WebResponse webResponse = ChildUpdateRequest.GetResponse();
|
||||||
if (webResponse == null)
|
if (webResponse == null)
|
||||||
{
|
{
|
||||||
m_log.Info("[REST COMMS]: Null reply on ChilAgentUpdate post");
|
m_log.Info("[REST COMMS]: Null reply on ChilAgentUpdate post");
|
||||||
}
|
}
|
||||||
|
|
||||||
StreamReader sr = new StreamReader(webResponse.GetResponseStream());
|
StreamReader sr = new StreamReader(webResponse.GetResponseStream());
|
||||||
reply = sr.ReadToEnd().Trim();
|
reply = sr.ReadToEnd().Trim();
|
||||||
sr.Close();
|
sr.Close();
|
||||||
//m_log.InfoFormat("[REST COMMS]: ChilAgentUpdate reply was {0} ", reply);
|
//m_log.InfoFormat("[REST COMMS]: ChilAgentUpdate reply was {0} ", reply);
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (WebException ex)
|
catch (WebException ex)
|
||||||
{
|
{
|
||||||
m_log.InfoFormat("[REST COMMS]: exception on reply of ChilAgentUpdate {0}", ex.Message);
|
m_log.InfoFormat("[REST COMMS]: exception on reply of ChilAgentUpdate {0}", ex.Message);
|
||||||
// ignore, really
|
// ignore, really
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion /* IInterregionComms */
|
#endregion /* IInterregionComms */
|
||||||
|
|
||||||
#region Called from remote instances on this instance
|
#region Called from remote instances on this instance
|
||||||
|
|
||||||
public Hashtable ChildAgentUpdateHandler(Hashtable request)
|
public Hashtable ChildAgentUpdateHandler(Hashtable request)
|
||||||
{
|
{
|
||||||
//m_log.Debug("[CONNECTION DEBUGGING]: ChildDataUpdateHandler Called");
|
//m_log.Debug("[CONNECTION DEBUGGING]: ChildDataUpdateHandler Called");
|
||||||
|
|
||||||
Hashtable responsedata = new Hashtable();
|
Hashtable responsedata = new Hashtable();
|
||||||
responsedata["content_type"] = "text/html";
|
responsedata["content_type"] = "text/html";
|
||||||
|
|
||||||
OSDMap args = null;
|
OSDMap args = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
OSD buffer;
|
OSD buffer;
|
||||||
// We should pay attention to the content-type, but let's assume we know it's Json
|
// We should pay attention to the content-type, but let's assume we know it's Json
|
||||||
buffer = OSDParser.DeserializeJson((string)request["body"]);
|
buffer = OSDParser.DeserializeJson((string)request["body"]);
|
||||||
if (buffer.Type == OSDType.Map)
|
if (buffer.Type == OSDType.Map)
|
||||||
args = (OSDMap)buffer;
|
args = (OSDMap)buffer;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// uh?
|
// uh?
|
||||||
m_log.Debug("[REST COMMS]: Got OSD of type " + buffer.Type.ToString());
|
m_log.Debug("[REST COMMS]: Got OSD of type " + buffer.Type.ToString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
m_log.InfoFormat("[REST COMMS]: exception on parse of ChildAgentUpdate message {0}", ex.Message);
|
m_log.InfoFormat("[REST COMMS]: exception on parse of ChildAgentUpdate message {0}", ex.Message);
|
||||||
responsedata["int_response_code"] = 400;
|
responsedata["int_response_code"] = 400;
|
||||||
responsedata["str_response_string"] = "false";
|
responsedata["str_response_string"] = "false";
|
||||||
|
|
||||||
return responsedata;
|
return responsedata;
|
||||||
}
|
}
|
||||||
|
|
||||||
// retrieve the regionhandle
|
// retrieve the regionhandle
|
||||||
ulong regionhandle = 0;
|
ulong regionhandle = 0;
|
||||||
if (args["destination_handle"] != null)
|
if (args["destination_handle"] != null)
|
||||||
UInt64.TryParse(args["destination_handle"].AsString(), out regionhandle);
|
UInt64.TryParse(args["destination_handle"].AsString(), out regionhandle);
|
||||||
|
|
||||||
AgentData agent = new AgentData();
|
AgentData agent = new AgentData();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
agent.UnpackUpdateMessage(args);
|
agent.UnpackUpdateMessage(args);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
m_log.InfoFormat("[REST COMMS]: exception on unpacking ChildAgentUpdate message {0}", ex.Message);
|
m_log.InfoFormat("[REST COMMS]: exception on unpacking ChildAgentUpdate message {0}", ex.Message);
|
||||||
}
|
}
|
||||||
//agent.Dump();
|
//agent.Dump();
|
||||||
|
|
||||||
bool result = m_localBackend.SendChildAgentUpdate(regionhandle, agent);
|
bool result = m_localBackend.SendChildAgentUpdate(regionhandle, agent);
|
||||||
|
|
||||||
|
|
||||||
responsedata["int_response_code"] = 200;
|
responsedata["int_response_code"] = 200;
|
||||||
responsedata["str_response_string"] = result.ToString();
|
responsedata["str_response_string"] = result.ToString();
|
||||||
return responsedata;
|
return responsedata;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Misc
|
#region Misc
|
||||||
|
|
||||||
protected virtual ulong GetRegionHandle(RegionInfo region)
|
protected virtual ulong GetRegionHandle(RegionInfo region)
|
||||||
{
|
{
|
||||||
return region.RegionHandle;
|
return region.RegionHandle;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion /* Misc */
|
#endregion /* Misc */
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -325,7 +325,7 @@ namespace OpenSim.Region.Environment.Modules.Scripting.VectorRender
|
||||||
int hex = 0;
|
int hex = 0;
|
||||||
|
|
||||||
Color newColour;
|
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);
|
newColour = Color.FromArgb(hex);
|
||||||
}
|
}
|
||||||
|
|
|
@ -533,7 +533,7 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions
|
||||||
{
|
{
|
||||||
permission = true;
|
permission = true;
|
||||||
}
|
}
|
||||||
else if(group.IsAttachment)
|
else if (group.IsAttachment)
|
||||||
{
|
{
|
||||||
permission = false;
|
permission = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -4456,14 +4456,14 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
// update non-physical objects like the joint proxy objects that represent the position
|
// update non-physical objects like the joint proxy objects that represent the position
|
||||||
// of the joints in the scene.
|
// 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
|
// WARNING: be careful of deadlocks here if you manipulate the scene. Remember you are being called
|
||||||
// from within the OdePhysicsScene.
|
// from within the OdePhysicsScene.
|
||||||
|
|
||||||
protected internal void jointMoved(PhysicsJoint joint)
|
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
|
// FIXME: this causes a sequential lookup of all objects in the scene; use a dictionary
|
||||||
SceneObjectPart jointProxyObject = GetSceneObjectPart(joint.ObjectNameInScene);
|
SceneObjectPart jointProxyObject = GetSceneObjectPart(joint.ObjectNameInScene);
|
||||||
if (jointProxyObject == null)
|
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
|
// update non-physical objects like the joint proxy objects that represent the position
|
||||||
// of the joints in the scene.
|
// 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
|
// WARNING: be careful of deadlocks here if you manipulate the scene. Remember you are being called
|
||||||
// from within the OdePhysicsScene.
|
// from within the OdePhysicsScene.
|
||||||
protected internal void jointDeactivated(PhysicsJoint joint)
|
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
|
// alert the user of errors by using the debug channel in the same way that scripts alert
|
||||||
// the user of compile errors.
|
// 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
|
// WARNING: be careful of deadlocks here if you manipulate the scene. Remember you are being called
|
||||||
// from within the OdePhysicsScene.
|
// from within the OdePhysicsScene.
|
||||||
public void jointErrorMessage(PhysicsJoint joint, string message)
|
public void jointErrorMessage(PhysicsJoint joint, string message)
|
||||||
|
|
|
@ -1624,7 +1624,7 @@ if (m_shape != null) {
|
||||||
part.m_fromUserInventoryItemID = fromUserInventoryItemId;
|
part.m_fromUserInventoryItemID = fromUserInventoryItemId;
|
||||||
|
|
||||||
// for tempOnRez objects, we have to fix the Expire date.
|
// 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;
|
return part;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,55 +1,55 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) Contributors, http://opensimulator.org/
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
* * Redistributions of source code must retain the above copyright
|
* * Redistributions of source code must retain the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* notice, this list of conditions and the following disclaimer.
|
||||||
* * Redistributions in binary form must reproduce the above copyright
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* documentation and/or other materials provided with the distribution.
|
* documentation and/or other materials provided with the distribution.
|
||||||
* * Neither the name of the OpenSim Project nor the
|
* * Neither the name of the OpenSim Project nor the
|
||||||
* names of its contributors may be used to endorse or promote products
|
* names of its contributors may be used to endorse or promote products
|
||||||
* derived from this software without specific prior written permission.
|
* derived from this software without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
* 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
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
|
|
||||||
namespace OpenSim.Region.Physics.Manager
|
namespace OpenSim.Region.Physics.Manager
|
||||||
{
|
{
|
||||||
public enum PhysicsJointType : int
|
public enum PhysicsJointType : int
|
||||||
{
|
{
|
||||||
Ball = 0,
|
Ball = 0,
|
||||||
Hinge = 1
|
Hinge = 1
|
||||||
}
|
}
|
||||||
|
|
||||||
public class PhysicsJoint
|
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 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 PhysicsJointType Type;
|
||||||
public string RawParams;
|
public string RawParams;
|
||||||
public List<string> BodyNames = new List<string>();
|
public List<string> BodyNames = new List<string>();
|
||||||
public PhysicsVector Position; // global coords
|
public PhysicsVector Position; // global coords
|
||||||
public Quaternion Rotation; // global coords
|
public Quaternion Rotation; // global coords
|
||||||
public string ObjectNameInScene; // proxy object in scene that represents the joint position/orientation
|
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 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 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 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
|
public const int maxErrorMessages = 100; // no more than this # of error messages will be printed for each joint
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,49 +1,49 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) Contributors, http://opensimulator.org/
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
* * Redistributions of source code must retain the above copyright
|
* * Redistributions of source code must retain the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* notice, this list of conditions and the following disclaimer.
|
||||||
* * Redistributions in binary form must reproduce the above copyright
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* documentation and/or other materials provided with the distribution.
|
* documentation and/or other materials provided with the distribution.
|
||||||
* * Neither the name of the OpenSim Project nor the
|
* * Neither the name of the OpenSim Project nor the
|
||||||
* names of its contributors may be used to endorse or promote products
|
* names of its contributors may be used to endorse or promote products
|
||||||
* derived from this software without specific prior written permission.
|
* derived from this software without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
* 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
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
using Ode.NET;
|
using Ode.NET;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using OpenSim.Region.Physics.Manager;
|
using OpenSim.Region.Physics.Manager;
|
||||||
using OpenSim.Region.Physics.Manager;
|
using OpenSim.Region.Physics.Manager;
|
||||||
using OpenSim.Region.Physics.OdePlugin;
|
using OpenSim.Region.Physics.OdePlugin;
|
||||||
|
|
||||||
namespace OpenSim.Region.Physics.OdePlugin
|
namespace OpenSim.Region.Physics.OdePlugin
|
||||||
{
|
{
|
||||||
class OdePhysicsJoint : PhysicsJoint
|
class OdePhysicsJoint : PhysicsJoint
|
||||||
{
|
{
|
||||||
public override bool IsInPhysicsEngine
|
public override bool IsInPhysicsEngine
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return (jointID != IntPtr.Zero);
|
return (jointID != IntPtr.Zero);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public IntPtr jointID;
|
public IntPtr jointID;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1366,28 +1366,28 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
get { return m_NINJA_physics_joints_enabled; }
|
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)
|
private void InternalAddActiveJoint(PhysicsJoint joint)
|
||||||
{
|
{
|
||||||
activeJoints.Add(joint);
|
activeJoints.Add(joint);
|
||||||
SOPName_to_activeJoint.Add(joint.ObjectNameInScene, 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)
|
private void InternalAddPendingJoint(OdePhysicsJoint joint)
|
||||||
{
|
{
|
||||||
pendingJoints.Add(joint);
|
pendingJoints.Add(joint);
|
||||||
SOPName_to_pendingJoint.Add(joint.ObjectNameInScene, 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)
|
private void InternalRemovePendingJoint(PhysicsJoint joint)
|
||||||
{
|
{
|
||||||
pendingJoints.Remove(joint);
|
pendingJoints.Remove(joint);
|
||||||
SOPName_to_pendingJoint.Remove(joint.ObjectNameInScene);
|
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)
|
private void InternalRemoveActiveJoint(PhysicsJoint joint)
|
||||||
{
|
{
|
||||||
activeJoints.Remove(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)
|
public override PhysicsVector GetJointAnchor(PhysicsJoint joint)
|
||||||
{
|
{
|
||||||
Debug.Assert(joint.IsInPhysicsEngine);
|
Debug.Assert(joint.IsInPhysicsEngine);
|
||||||
|
@ -1666,7 +1666,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
return new PhysicsVector(pos.X, pos.Y, pos.Z);
|
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
|
// 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
|
// 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.
|
// 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)
|
if (SupportsNINJAJoints)
|
||||||
{
|
{
|
||||||
DeleteRequestedJoints(); // 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
|
CreateRequestedJoints(); // this must be outside of the lock (OdeLock) to avoid deadlocks
|
||||||
}
|
}
|
||||||
|
|
||||||
lock (OdeLock)
|
lock (OdeLock)
|
||||||
|
|
|
@ -3644,7 +3644,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
|
|
||||||
partItemID = item.ItemID;
|
partItemID = item.ItemID;
|
||||||
int linkNumber = m_host.LinkNum;
|
int linkNumber = m_host.LinkNum;
|
||||||
if(m_host.ParentGroup.Children.Count == 1)
|
if (m_host.ParentGroup.Children.Count == 1)
|
||||||
linkNumber = 0;
|
linkNumber = 0;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
Copyright (c) 2008, Andrew Arnott, Scott Hanselman, Jason Alexander, et. al
|
Copyright (c) 2008, Andrew Arnott, Scott Hanselman, Jason Alexander, et. al
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
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 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.
|
* 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 DotNetOpenId nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
* Neither the name of the DotNetOpenId 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 COPYRIGHT HOLDERS AND CONTRIBUTORS "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 COPYRIGHT OWNER OR 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.
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 COPYRIGHT OWNER OR 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.
|
Loading…
Reference in New Issue