Update svn properties, minor formatting cleanup.

0.6.2-post-fixes
Jeff Ames 2008-12-30 01:08:07 +00:00
parent 3a6b27befb
commit 2be0f7a6f0
22 changed files with 1950 additions and 1809 deletions

View File

@ -1,5 +1,5 @@
BEGIN;
ALTER TABLE prims ADD COLUMN VolumeDetect INTEGER NOT NULL DEFAULT 0;
COMMIT;
BEGIN;
ALTER TABLE prims ADD COLUMN VolumeDetect INTEGER NOT NULL DEFAULT 0;
COMMIT;

View File

@ -1,138 +1,162 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace OpenSim.Framework.OpenJpeg
{
public static class bio
{
public static opj_bio bio_create()
{
opj_bio bio = new opj_bio();
return bio;
}
public static void bio_destroy(opj_bio bio)
{
// not needed on C#
}
public static int bio_numbytes(opj_bio bio)
{
return (bio.bp - bio.start);
}
public static void bio_init_enc(opj_bio bio, sbyte bp, int len)
{
bio.start = (byte)bp;
bio.end = (byte)(bp + (byte)len);
bio.bp = (byte)bp;
bio.buf = 0;
bio.ct = 8;
}
public static void bio_init_dec(opj_bio bio, sbyte bp, int len)
{
bio.start = (byte)bp;
bio.end = (byte)(bp + len);
bio.bp = (byte)bp;
bio.buf = 0;
bio.ct = 0;
}
public static void bio_write(opj_bio bio, int v, int n)
{
for (int i = n - 1; i >= 0; i--)
bio_putbit(bio, (v >> i) & 1);
}
public static int bio_read(opj_bio bio, int n)
{
int v = 0;
for (int i = n - 1; i >= 0; i--)
v += bio_getbit(bio) << i;
return v;
}
public static int bio_flush(opj_bio bio)
{
bio.ct = 0;
if (bio_byteout(bio) != 0)
return 1;
if (bio.ct == 7)
{
bio.ct = 0;
if (bio_byteout(bio) != 0)
return 1;
}
return 0;
}
public static int bio_inalign(opj_bio bio)
{
bio.ct = 0;
if ((bio.buf & 0xff) == 0xff)
{
if (bio_bytein(bio) != 0)
return 1;
bio.ct = 0;
}
return 0;
}
private static int bio_bytein(opj_bio bio)
{
bio.buf = (bio.buf << 8) & 0xffff;
bio.ct = bio.buf == 0xff00 ? 7 : 8;
if (bio.bp >= bio.end)
return 1;
bio.buf |= bio.bp++;
return 0;
}
private static int bio_byteout(opj_bio bio)
{
bio.buf = (bio.buf << 8) & 0xffff;
bio.ct = bio.buf == 0xff00 ? 7 : 8;
if (bio.bp >= bio.end)
return 1;
bio.bp = (byte)(bio.buf >> 8);
bio.bp++;
return 0;
}
private static void bio_putbit(opj_bio bio, int b)
{
if (bio.ct == 0)
bio_byteout(bio);
bio.ct--;
bio.buf |= (byte)(b << bio.ct);
}
private static int bio_getbit(opj_bio bio)
{
if (bio.ct == 0)
bio_bytein(bio);
bio.ct--;
return (int)((bio.buf >> bio.ct) & 1);
}
}
public struct opj_bio
{
public byte start;
public byte end;
public byte bp;
public uint buf;
public int ct;
}
}
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSimulator Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Collections.Generic;
using System.Text;
namespace OpenSim.Framework.OpenJpeg
{
public static class bio
{
public static opj_bio bio_create()
{
opj_bio bio = new opj_bio();
return bio;
}
public static void bio_destroy(opj_bio bio)
{
// not needed on C#
}
public static int bio_numbytes(opj_bio bio)
{
return (bio.bp - bio.start);
}
public static void bio_init_enc(opj_bio bio, sbyte bp, int len)
{
bio.start = (byte)bp;
bio.end = (byte)(bp + (byte)len);
bio.bp = (byte)bp;
bio.buf = 0;
bio.ct = 8;
}
public static void bio_init_dec(opj_bio bio, sbyte bp, int len)
{
bio.start = (byte)bp;
bio.end = (byte)(bp + len);
bio.bp = (byte)bp;
bio.buf = 0;
bio.ct = 0;
}
public static void bio_write(opj_bio bio, int v, int n)
{
for (int i = n - 1; i >= 0; i--)
bio_putbit(bio, (v >> i) & 1);
}
public static int bio_read(opj_bio bio, int n)
{
int v = 0;
for (int i = n - 1; i >= 0; i--)
v += bio_getbit(bio) << i;
return v;
}
public static int bio_flush(opj_bio bio)
{
bio.ct = 0;
if (bio_byteout(bio) != 0)
return 1;
if (bio.ct == 7)
{
bio.ct = 0;
if (bio_byteout(bio) != 0)
return 1;
}
return 0;
}
public static int bio_inalign(opj_bio bio)
{
bio.ct = 0;
if ((bio.buf & 0xff) == 0xff)
{
if (bio_bytein(bio) != 0)
return 1;
bio.ct = 0;
}
return 0;
}
private static int bio_bytein(opj_bio bio)
{
bio.buf = (bio.buf << 8) & 0xffff;
bio.ct = bio.buf == 0xff00 ? 7 : 8;
if (bio.bp >= bio.end)
return 1;
bio.buf |= bio.bp++;
return 0;
}
private static int bio_byteout(opj_bio bio)
{
bio.buf = (bio.buf << 8) & 0xffff;
bio.ct = bio.buf == 0xff00 ? 7 : 8;
if (bio.bp >= bio.end)
return 1;
bio.bp = (byte)(bio.buf >> 8);
bio.bp++;
return 0;
}
private static void bio_putbit(opj_bio bio, int b)
{
if (bio.ct == 0)
bio_byteout(bio);
bio.ct--;
bio.buf |= (byte)(b << bio.ct);
}
private static int bio_getbit(opj_bio bio)
{
if (bio.ct == 0)
bio_bytein(bio);
bio.ct--;
return (int)((bio.buf >> bio.ct) & 1);
}
}
public struct opj_bio
{
public byte start;
public byte end;
public byte bp;
public uint buf;
public int ct;
}
}

View File

@ -1,16 +1,43 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace OpenSim.Framework.OpenJpeg
{
public static class fix
{
public static int fix_mul(int a, int b)
{
long temp = (long)a * (long)b;
temp += temp & 4096;
return (int)(temp >> 13);
}
}
}
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSimulator Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Collections.Generic;
using System.Text;
namespace OpenSim.Framework.OpenJpeg
{
public static class fix
{
public static int fix_mul(int a, int b)
{
long temp = (long)a * (long)b;
temp += temp & 4096;
return (int)(temp >> 13);
}
}
}

View File

@ -1,58 +1,84 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace OpenSim.Framework.OpenJpeg
{
public static class int_
{
public static int int_min(int a, int b)
{
return a < b ? a : b;
}
public static int int_max(int a, int b)
{
return (a > b) ? a : b;
}
public static int int_clamp(int a, int min, int max)
{
if (a < min)
return min;
if (a > max)
return max;
return a;
}
public static int int_abs(int a)
{
return a < 0 ? -a : a;
}
public static int int_ceildiv(int a, int b)
{
return (a + b - 1) / b;
}
public static int int_ceildivpow2(int a, int b)
{
return (a + (1 << b) - 1) >> b;
}
public static int int_floordivpow2(int a, int b)
{
return a >> b;
}
public static int int_floorlog2(int a)
{
for (int l=0; a > 1; l++)
a >>= 1;
return 1;
}
}
}
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSimulator Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Collections.Generic;
using System.Text;
namespace OpenSim.Framework.OpenJpeg
{
public static class int_
{
public static int int_min(int a, int b)
{
return a < b ? a : b;
}
public static int int_max(int a, int b)
{
return (a > b) ? a : b;
}
public static int int_clamp(int a, int min, int max)
{
if (a < min)
return min;
if (a > max)
return max;
return a;
}
public static int int_abs(int a)
{
return a < 0 ? -a : a;
}
public static int int_ceildiv(int a, int b)
{
return (a + b - 1) / b;
}
public static int int_ceildivpow2(int a, int b)
{
return (a + (1 << b) - 1) >> b;
}
public static int int_floordivpow2(int a, int b)
{
return a >> b;
}
public static int int_floorlog2(int a)
{
for (int l=0; a > 1; l++)
a >>= 1;
return 1;
}
}
}

View File

@ -1,125 +1,149 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace OpenSim.Framework.OpenJpeg
{
public static class j2k
{
}
public enum J2K_STATUS
{
J2K_STATE_MHSOC = 0x0001, /**< a SOC marker is expected */
J2K_STATE_MHSIZ = 0x0002, /**< a SIZ marker is expected */
J2K_STATE_MH = 0x0004, /**< the decoding process is in the main header */
J2K_STATE_TPHSOT = 0x0008, /**< the decoding process is in a tile part header and expects a SOT marker */
J2K_STATE_TPH = 0x0010, /**< the decoding process is in a tile part header */
J2K_STATE_MT = 0x0020, /**< the EOC marker has just been read */
J2K_STATE_NEOC = 0x0040, /**< the decoding process must not expect a EOC marker because the codestream is truncated */
J2K_STATE_ERR = 0x0080 /**< the decoding process has encountered an error */
}
public enum J2K_T2_MODE
{
THRESH_CALC = 0, /** Function called in Rate allocation process*/
FINAL_PASS = 1 /** Function called in Tier 2 process*/
}
public struct opj_stepsize
{
public int expn;
public int mant;
}
public struct opj_tccp
{
public int csty;
public int numresolutions;
public int cblkw;
public int cblkh;
public int cblksty;
public int qmfbid;
public int qntsty;
/// <summary>
/// don't forget to initialize 97 elements
/// </summary>
public opj_stepsize[] stepsizes;
public int numgbits;
public int roishift;
/// <summary>
/// Don't forget to initialize 33 elements
/// </summary>
public int[] prcw;
}
public struct opj_tcp
{
public int first;
public int csty;
public PROG_ORDER prg;
public int numlayers;
public int mct;
/// <summary>
/// don't forget to initialize to 100
/// </summary>
public float[] rates;
public int numpocs;
public int POC;
/// <summary>
/// Don't forget to initialize to 32
/// </summary>
public opj_poc[] pocs;
public byte ppt_data;
public byte ppt_data_first;
public int ppt;
public int ppt_store;
public int ppt_len;
/// <summary>
/// Don't forget to initialize 100 elements
/// </summary>
public float[] distoratio;
public opj_tccp tccps;
}
public struct opj_cp
{
public CINEMA_MODE cinema;
public int max_comp_size;
public int img_size;
public RSIZ_CAPABILITIES rsiz;
public sbyte tp_on;
public sbyte tp_flag;
public int tp_pos;
public int distro_alloc;
public int fixed_alloc;
public int fixed_quality;
public int reduce;
public int layer;
public LIMIT_DECODING limit_decoding;
public int tx0;
public int ty0;
public int tdx;
public int tdy;
public sbyte? comment;
public int tw;
public int th;
public int? tileno;
public byte ppm_data;
public byte ppm_data_first;
public int ppm;
public int ppm_store;
public int ppm_previous;
public int ppm_len;
public opj_tcp tcps;
public int matrice;
}
public static class j2kdefines
{
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSimulator Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Collections.Generic;
using System.Text;
namespace OpenSim.Framework.OpenJpeg
{
public static class j2k
{
}
public enum J2K_STATUS
{
J2K_STATE_MHSOC = 0x0001, /**< a SOC marker is expected */
J2K_STATE_MHSIZ = 0x0002, /**< a SIZ marker is expected */
J2K_STATE_MH = 0x0004, /**< the decoding process is in the main header */
J2K_STATE_TPHSOT = 0x0008, /**< the decoding process is in a tile part header and expects a SOT marker */
J2K_STATE_TPH = 0x0010, /**< the decoding process is in a tile part header */
J2K_STATE_MT = 0x0020, /**< the EOC marker has just been read */
J2K_STATE_NEOC = 0x0040, /**< the decoding process must not expect a EOC marker because the codestream is truncated */
J2K_STATE_ERR = 0x0080 /**< the decoding process has encountered an error */
}
public enum J2K_T2_MODE
{
THRESH_CALC = 0, /** Function called in Rate allocation process*/
FINAL_PASS = 1 /** Function called in Tier 2 process*/
}
public struct opj_stepsize
{
public int expn;
public int mant;
}
public struct opj_tccp
{
public int csty;
public int numresolutions;
public int cblkw;
public int cblkh;
public int cblksty;
public int qmfbid;
public int qntsty;
/// <summary>
/// don't forget to initialize 97 elements
/// </summary>
public opj_stepsize[] stepsizes;
public int numgbits;
public int roishift;
/// <summary>
/// Don't forget to initialize 33 elements
/// </summary>
public int[] prcw;
}
public struct opj_tcp
{
public int first;
public int csty;
public PROG_ORDER prg;
public int numlayers;
public int mct;
/// <summary>
/// don't forget to initialize to 100
/// </summary>
public float[] rates;
public int numpocs;
public int POC;
/// <summary>
/// Don't forget to initialize to 32
/// </summary>
public opj_poc[] pocs;
public byte ppt_data;
public byte ppt_data_first;
public int ppt;
public int ppt_store;
public int ppt_len;
/// <summary>
/// Don't forget to initialize 100 elements
/// </summary>
public float[] distoratio;
public opj_tccp tccps;
}
public struct opj_cp
{
public CINEMA_MODE cinema;
public int max_comp_size;
public int img_size;
public RSIZ_CAPABILITIES rsiz;
public sbyte tp_on;
public sbyte tp_flag;
public int tp_pos;
public int distro_alloc;
public int fixed_alloc;
public int fixed_quality;
public int reduce;
public int layer;
public LIMIT_DECODING limit_decoding;
public int tx0;
public int ty0;
public int tdx;
public int tdy;
public sbyte? comment;
public int tw;
public int th;
public int? tileno;
public byte ppm_data;
public byte ppm_data_first;
public int ppm;
public int ppm_store;
public int ppm_previous;
public int ppm_len;
public opj_tcp tcps;
public int matrice;
}
public static class j2kdefines
{
public const uint J2K_CP_CSTY_PRT = 0x01;
public const uint J2K_CP_CSTY_SOP = 0x02;
public const uint J2K_CP_CSTY_EPH = 0x04;
@ -131,28 +155,28 @@ namespace OpenSim.Framework.OpenJpeg
public const uint J2K_CCP_CBLKSTY_PTERM =0x10;
public const uint J2K_CCP_CBLKSTY_SEGSYM = 0x20;
public const uint J2K_CCP_QNTSTY_NOQNT = 0;
public const uint J2K_CCP_QNTSTY_SIQNT = 1;
public const uint J2K_CCP_QNTSTY_SEQNT = 2;
public const uint J2K_MS_SOC = 0xff4f; /**< SOC marker value */
public const uint J2K_MS_SOT = 0xff90; /**< SOT marker value */
public const uint J2K_MS_SOD = 0xff93; /**< SOD marker value */
public const uint J2K_MS_EOC = 0xffd9; /**< EOC marker value */
public const uint J2K_MS_SIZ = 0xff51; /**< SIZ marker value */
public const uint J2K_MS_COD = 0xff52; /**< COD marker value */
public const uint J2K_MS_COC = 0xff53; /**< COC marker value */
public const uint J2K_MS_RGN = 0xff5e; /**< RGN marker value */
public const uint J2K_MS_QCD = 0xff5c; /**< QCD marker value */
public const uint J2K_MS_QCC = 0xff5d; /**< QCC marker value */
public const uint J2K_MS_POC = 0xff5f; /**< POC marker value */
public const uint J2K_MS_TLM = 0xff55; /**< TLM marker value */
public const uint J2K_MS_PLM = 0xff57; /**< PLM marker value */
public const uint J2K_MS_PLT = 0xff58; /**< PLT marker value */
public const uint J2K_MS_PPM = 0xff60; /**< PPM marker value */
public const uint J2K_MS_PPT = 0xff61; /**< PPT marker value */
public const uint J2K_MS_SOP = 0xff91; /**< SOP marker value */
public const uint J2K_MS_EPH = 0xff92; /**< EPH marker value */
public const uint J2K_MS_CRG = 0xff63; /**< CRG marker value */
public const uint J2K_MS_COM = 0xff64; /**< COM marker value */
}
}
public const uint J2K_CCP_QNTSTY_SIQNT = 1;
public const uint J2K_CCP_QNTSTY_SEQNT = 2;
public const uint J2K_MS_SOC = 0xff4f; /**< SOC marker value */
public const uint J2K_MS_SOT = 0xff90; /**< SOT marker value */
public const uint J2K_MS_SOD = 0xff93; /**< SOD marker value */
public const uint J2K_MS_EOC = 0xffd9; /**< EOC marker value */
public const uint J2K_MS_SIZ = 0xff51; /**< SIZ marker value */
public const uint J2K_MS_COD = 0xff52; /**< COD marker value */
public const uint J2K_MS_COC = 0xff53; /**< COC marker value */
public const uint J2K_MS_RGN = 0xff5e; /**< RGN marker value */
public const uint J2K_MS_QCD = 0xff5c; /**< QCD marker value */
public const uint J2K_MS_QCC = 0xff5d; /**< QCC marker value */
public const uint J2K_MS_POC = 0xff5f; /**< POC marker value */
public const uint J2K_MS_TLM = 0xff55; /**< TLM marker value */
public const uint J2K_MS_PLM = 0xff57; /**< PLM marker value */
public const uint J2K_MS_PLT = 0xff58; /**< PLT marker value */
public const uint J2K_MS_PPM = 0xff60; /**< PPM marker value */
public const uint J2K_MS_PPT = 0xff61; /**< PPT marker value */
public const uint J2K_MS_SOP = 0xff91; /**< SOP marker value */
public const uint J2K_MS_EPH = 0xff92; /**< EPH marker value */
public const uint J2K_MS_CRG = 0xff63; /**< CRG marker value */
public const uint J2K_MS_COM = 0xff64; /**< COM marker value */
}
}

View File

@ -1,358 +1,375 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace OpenSim.Framework.OpenJpeg
{
public class openjpeg
{
public openjpeg()
{
}
}
public enum PROG_ORDER
{
PROG_UNKNOWN = -1,
LRCP = 0,
RLCP = 1,
RPCL = 2,
PCRL = 3,
CPRL = 4
}
public enum RSIZ_CAPABILITIES
{
STD_RSIZ = 0,
CINEMA2K = 3,
CINEMA4K = 4
}
public enum CINEMA_MODE
{
OFF = 0,
CINEMA2K_24 = 1,
CINEMA2K_48 = 2,
CINEMA4K_24 = 3
}
public enum COLOR_SPACE
{
CLRSPC_UNKNOWN = -1,
CLRSPC_SRGB = 1,
CLRSPC_GRAY = 2,
CLRSPC_SYCC = 3
}
public enum CODEC_FORMAT
{
CODEC_UNKNOWN = -1,
CODEC_J2K = 0,
CODEC_JPT = 1,
CODEC_JP2 = 2
}
public enum LIMIT_DECODING
{
NO_LIMITATION = 0,
LIMIT_TO_MAIN_HEADER=1,
DECODE_ALL_BUT_PACKETS = 2
}
public struct opj_poc
{
public int resno0, compno0;
public int layno1, resno1, compno1;
public int layno0, precno0, precno1;
public PROG_ORDER prg1, prg;
/// <summary>
/// Don't forget to initialize with 5 elements
/// </summary>
public sbyte[] progorder;
public int tile;
public int tx0, tx1, ty0, ty1;
public int layS, resS, copmS, prcS;
public int layE, resE, compE, prcE;
public int txS, txE, tyS, tyE, dx, dy;
public int lay_t, res_t, comp_t, prc_t, tx0_t, ty0_t;
}
public struct opj_cparameters
{
public bool tile_size_on;
public int cp_tx0;
public int cp_ty0;
public int cp_tdx;
public int cp_tdy;
public int cp_disto_alloc;
public int cp_fixed_alloc;
public int cp_fixed_wuality;
public int cp_matrice;
public sbyte cp_comment;
public int csty;
public PROG_ORDER prog_order;
/// <summary>
/// Don't forget to initialize 32 elements
/// </summary>
public opj_poc[] POC;
public int numpocs;
public int tcp_numlayers;
/// <summary>
/// Don't forget to intitialize 100 elements
/// </summary>
public float[] tcp_rates;
/// <summary>
/// Don't forget to initialize 100 elements
/// </summary>
public float[] tcp_distoratio;
public int numresolution;
public int cblockw_init;
public int cblockh_init;
public int mode;
public int irreversible;
public int roi_compno;
public int roi_shift;
public int res_spec;
/// <summary>
/// Don't forget to initialize 33 elements
/// </summary>
public int[] prc_init;
/// <summary>
/// Don't forget to initialize 33 elements
/// </summary>
public int[] prch_init;
public string infile;
public string outfile;
public int index_on;
public string index;
public int image_offset_x0;
public int image_offset_y0;
public int subsampling_dx;
public int subsampling_dy;
public int decod_format;
public int cod_format;
public bool jpwl_epc_on;
public int jpwl_hprot_MH;
/// <summary>
/// Don't forget to initialize 16 elements
/// </summary>
public int[] jpwl_hprot_TPH_tileno;
/// <summary>
/// Don't forget to initialize 16 elements
/// </summary>
public int[] jpwl_hprot_TPH;
/// <summary>
/// Don't forget to initialize 16 elements
/// </summary>
public int[] jpwl_pprot_tileno;
public int[] jpwl_pprot_packno;
public int[] jpwl_pprot;
public int jpwl_sens_size;
public int jpwl_sense_addr;
public int jpwl_sens_range;
public int jpwl_sens_MH;
/// <summary>
/// Don't forget to initialize 16 elements
/// </summary>
public int[] jpwl_sens_TPH_tileno;
/// <summary>
/// Don't forget to initialize 16 elements
/// </summary>
public int[] jpwl_sens_TPH;
public CINEMA_MODE cp_cinema;
public int max_comp_size;
public sbyte tp_on;
public sbyte tp_flag;
public sbyte tcp_mct;
}
public struct opj_dparameters
{
public int cp_reduce;
public int cp_layer;
public string infile;
public string outfile;
public int decod_format;
public int cod_format;
public bool jpwl_correct;
public int jpwl_exp_comps;
public int jpwl_max_tiles;
public LIMIT_DECODING cp_limit_decoding;
}
public struct opj_common_fields
{
public bool is_decompressor;
public CODEC_FORMAT codec_format;
}
public struct opj_common_struct
{
public opj_common_fields flds;
}
public struct opj_cinfo
{
public opj_common_fields flds;
}
public struct opj_dinfo
{
public opj_common_fields flds;
}
public struct opj_cio
{
public opj_common_struct cinfo;
public int openmode;
public byte buffer;
public int length;
public byte start;
public byte end;
public byte bp;
}
public struct opj_image_comp
{
public int dx;
public int dy;
public int w;
public int h;
public int x0;
public int y0;
public int prec;
public int bpp;
public int sgnd;
public int resno_decoded;
public int factor;
public int data;
}
public struct opj_image
{
public int x0;
public int y0;
public int x1;
public int y1;
public int numcomps;
public COLOR_SPACE color_space;
public opj_image_comp comps;
}
public struct opj_image_comptparm
{
public int dx;
public int dy;
public int w;
public int h;
public int x0;
public int y0;
public int prec;
public int bpp;
public int sgnd;
}
public struct opj_packet_info
{
public int start_pos;
public int end_ph_pos;
public int end_pos;
public double disto;
}
public struct opj_tp_info
{
public int tp_start_pos;
public int tp_end_header;
public int tp_end_pos;
public int tp_start_pack;
public int tp_numpacks;
}
public struct opj_tile_info
{
public double thresh;
public int tileno;
public int start_pos;
public int end_header;
public int end_pos;
/// <summary>
/// Don't forget to initialize 33 elements
/// </summary>
public int[] pw;
/// <summary>
/// Don't forget to initialize 33 elements
/// </summary>
public int[] ph;
/// <summary>
/// Don't forget to initialize 33 elements
/// </summary>
public int[] pdx;
/// <summary>
/// Don't forget to initialize 33 elements
/// </summary>
public int[] pdy;
public opj_packet_info packet;
public int numpix;
public double distotile;
public int num_tps;
public opj_tp_info tp;
}
public struct opj_marker_info_t
{
public ushort type;
public int pos;
public int len;
}
public struct opj_codestream_info
{
public double D_max;
public int packno;
public int index_write;
public int image_w;
public int image_h;
public PROG_ORDER prog;
public int tile_x;
public int tile_y;
public int tile_Ox;
public int tile_Oy;
public int tw;
public int numcomps;
public int numlayers;
public int numdecompos;
public int marknum;
public opj_marker_info_t marker;
public int maxmarknum;
public int main_head_start;
public int main_head_end;
public int codestream_size;
public opj_tile_info tile;
}
public static class opj_defines
{
public const int OPJ_STREAM_READ = 0x0001;
public const int OPJ_STREAM_WRITE = 0x0002;
}
}
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSimulator Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Collections.Generic;
using System.Text;
namespace OpenSim.Framework.OpenJpeg
{
public class openjpeg
{
public openjpeg()
{
}
}
public enum PROG_ORDER
{
PROG_UNKNOWN = -1,
LRCP = 0,
RLCP = 1,
RPCL = 2,
PCRL = 3,
CPRL = 4
}
public enum RSIZ_CAPABILITIES
{
STD_RSIZ = 0,
CINEMA2K = 3,
CINEMA4K = 4
}
public enum CINEMA_MODE
{
OFF = 0,
CINEMA2K_24 = 1,
CINEMA2K_48 = 2,
CINEMA4K_24 = 3
}
public enum COLOR_SPACE
{
CLRSPC_UNKNOWN = -1,
CLRSPC_SRGB = 1,
CLRSPC_GRAY = 2,
CLRSPC_SYCC = 3
}
public enum CODEC_FORMAT
{
CODEC_UNKNOWN = -1,
CODEC_J2K = 0,
CODEC_JPT = 1,
CODEC_JP2 = 2
}
public enum LIMIT_DECODING
{
NO_LIMITATION = 0,
LIMIT_TO_MAIN_HEADER=1,
DECODE_ALL_BUT_PACKETS = 2
}
public struct opj_poc
{
public int resno0, compno0;
public int layno1, resno1, compno1;
public int layno0, precno0, precno1;
public PROG_ORDER prg1, prg;
/// <summary>
/// Don't forget to initialize with 5 elements
/// </summary>
public sbyte[] progorder;
public int tile;
public int tx0, tx1, ty0, ty1;
public int layS, resS, copmS, prcS;
public int layE, resE, compE, prcE;
public int txS, txE, tyS, tyE, dx, dy;
public int lay_t, res_t, comp_t, prc_t, tx0_t, ty0_t;
}
public struct opj_cparameters
{
public bool tile_size_on;
public int cp_tx0;
public int cp_ty0;
public int cp_tdx;
public int cp_tdy;
public int cp_disto_alloc;
public int cp_fixed_alloc;
public int cp_fixed_wuality;
public int cp_matrice;
public sbyte cp_comment;
public int csty;
public PROG_ORDER prog_order;
/// <summary>
/// Don't forget to initialize 32 elements
/// </summary>
public opj_poc[] POC;
public int numpocs;
public int tcp_numlayers;
/// <summary>
/// Don't forget to intitialize 100 elements
/// </summary>
public float[] tcp_rates;
/// <summary>
/// Don't forget to initialize 100 elements
/// </summary>
public float[] tcp_distoratio;
public int numresolution;
public int cblockw_init;
public int cblockh_init;
public int mode;
public int irreversible;
public int roi_compno;
public int roi_shift;
public int res_spec;
/// <summary>
/// Don't forget to initialize 33 elements
/// </summary>
public int[] prc_init;
/// <summary>
/// Don't forget to initialize 33 elements
/// </summary>
public int[] prch_init;
public string infile;
public string outfile;
public int index_on;
public string index;
public int image_offset_x0;
public int image_offset_y0;
public int subsampling_dx;
public int subsampling_dy;
public int decod_format;
public int cod_format;
public bool jpwl_epc_on;
public int jpwl_hprot_MH;
/// <summary>
/// Don't forget to initialize 16 elements
/// </summary>
public int[] jpwl_hprot_TPH_tileno;
/// <summary>
/// Don't forget to initialize 16 elements
/// </summary>
public int[] jpwl_hprot_TPH;
/// <summary>
/// Don't forget to initialize 16 elements
/// </summary>
public int[] jpwl_pprot_tileno;
public int[] jpwl_pprot_packno;
public int[] jpwl_pprot;
public int jpwl_sens_size;
public int jpwl_sense_addr;
public int jpwl_sens_range;
public int jpwl_sens_MH;
/// <summary>
/// Don't forget to initialize 16 elements
/// </summary>
public int[] jpwl_sens_TPH_tileno;
/// <summary>
/// Don't forget to initialize 16 elements
/// </summary>
public int[] jpwl_sens_TPH;
public CINEMA_MODE cp_cinema;
public int max_comp_size;
public sbyte tp_on;
public sbyte tp_flag;
public sbyte tcp_mct;
}
public struct opj_dparameters
{
public int cp_reduce;
public int cp_layer;
public string infile;
public string outfile;
public int decod_format;
public int cod_format;
public bool jpwl_correct;
public int jpwl_exp_comps;
public int jpwl_max_tiles;
public LIMIT_DECODING cp_limit_decoding;
}
public struct opj_common_fields
{
public bool is_decompressor;
public CODEC_FORMAT codec_format;
}
public struct opj_common_struct
{
public opj_common_fields flds;
}
public struct opj_cinfo
{
public opj_common_fields flds;
}
public struct opj_dinfo
{
public opj_common_fields flds;
}
public struct opj_cio
{
public opj_common_struct cinfo;
public int openmode;
public byte buffer;
public int length;
public byte start;
public byte end;
public byte bp;
}
public struct opj_image_comp
{
public int dx;
public int dy;
public int w;
public int h;
public int x0;
public int y0;
public int prec;
public int bpp;
public int sgnd;
public int resno_decoded;
public int factor;
public int data;
}
public struct opj_image
{
public int x0;
public int y0;
public int x1;
public int y1;
public int numcomps;
public COLOR_SPACE color_space;
public opj_image_comp comps;
}
public struct opj_image_comptparm
{
public int dx;
public int dy;
public int w;
public int h;
public int x0;
public int y0;
public int prec;
public int bpp;
public int sgnd;
}
public struct opj_packet_info
{
public int start_pos;
public int end_ph_pos;
public int end_pos;
public double disto;
}
public struct opj_tp_info
{
public int tp_start_pos;
public int tp_end_header;
public int tp_end_pos;
public int tp_start_pack;
public int tp_numpacks;
}
public struct opj_tile_info
{
public double thresh;
public int tileno;
public int start_pos;
public int end_header;
public int end_pos;
/// <summary>
/// Don't forget to initialize 33 elements
/// </summary>
public int[] pw;
/// <summary>
/// Don't forget to initialize 33 elements
/// </summary>
public int[] ph;
/// <summary>
/// Don't forget to initialize 33 elements
/// </summary>
public int[] pdx;
/// <summary>
/// Don't forget to initialize 33 elements
/// </summary>
public int[] pdy;
public opj_packet_info packet;
public int numpix;
public double distotile;
public int num_tps;
public opj_tp_info tp;
}
public struct opj_marker_info_t
{
public ushort type;
public int pos;
public int len;
}
public struct opj_codestream_info
{
public double D_max;
public int packno;
public int index_write;
public int image_w;
public int image_h;
public PROG_ORDER prog;
public int tile_x;
public int tile_y;
public int tile_Ox;
public int tile_Oy;
public int tw;
public int numcomps;
public int numlayers;
public int numdecompos;
public int marknum;
public opj_marker_info_t marker;
public int maxmarknum;
public int main_head_start;
public int main_head_end;
public int codestream_size;
public opj_tile_info tile;
}
public static class opj_defines
{
public const int OPJ_STREAM_READ = 0x0001;
public const int OPJ_STREAM_WRITE = 0x0002;
}
}

View File

@ -1,48 +1,71 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace OpenSim.Framework.OpenJpeg
{
public static class pi
{
}
public struct opj_pi_resolution
{
public int pdx, pdy;
public int pw, ph;
}
public struct opj_pi_comp
{
public int dx, dy;
public int numresolutions;
public opj_pi_resolution resolutions;
}
public struct obj_pi_iterator
{
public sbyte tp_on;
public short include;
public int step_l;
public int step_r;
public int step_c;
public int step_p;
public int compno;
public int resno;
public int precno;
public int layno;
public int first;
public opj_poc poc;
public int numcomps;
public opj_pi_comp comps;
public int tx0, ty0, tx1, ty1;
public int x, y, dx, dy;
}
}
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSimulator Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Collections.Generic;
using System.Text;
namespace OpenSim.Framework.OpenJpeg
{
public static class pi
{
}
public struct opj_pi_resolution
{
public int pdx, pdy;
public int pw, ph;
}
public struct opj_pi_comp
{
public int dx, dy;
public int numresolutions;
public opj_pi_resolution resolutions;
}
public struct obj_pi_iterator
{
public sbyte tp_on;
public short include;
public int step_l;
public int step_r;
public int step_c;
public int step_p;
public int compno;
public int resno;
public int precno;
public int layno;
public int first;
public opj_poc poc;
public int numcomps;
public opj_pi_comp comps;
public int tx0, ty0, tx1, ty1;
public int x, y, dx, dy;
}
}

View File

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

View File

@ -8248,7 +8248,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
ap.Data = new AvatarPicksReplyPacket.DataBlock[picks.Count];
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].PickID = pick.Key;
@ -8272,7 +8272,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
ac.Data = new AvatarClassifiedReplyPacket.DataBlock[classifieds.Count];
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].ClassifiedID = classified.Key;

View File

@ -1,47 +1,47 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSim Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using OpenSim.Framework;
using OpenMetaverse;
namespace OpenSim.Region.Environment.Interfaces
{
public delegate bool ChildAgentUpdateReceived(AgentData data);
public interface IInterregionCommsOut
{
bool SendChildAgentUpdate(ulong regionHandle, AgentData data);
}
// This may not be needed, but having it here for now.
public interface IInterregionCommsIn
{
event ChildAgentUpdateReceived OnChildAgentUpdate;
}
}
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSim Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using OpenSim.Framework;
using OpenMetaverse;
namespace OpenSim.Region.Environment.Interfaces
{
public delegate bool ChildAgentUpdateReceived(AgentData data);
public interface IInterregionCommsOut
{
bool SendChildAgentUpdate(ulong regionHandle, AgentData data);
}
// This may not be needed, but having it here for now.
public interface IInterregionCommsIn
{
event ChildAgentUpdateReceived OnChildAgentUpdate;
}
}

View File

@ -1,140 +1,140 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSim Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Collections;
using System.Collections.Generic;
using System.Net;
using System.Net.Sockets;
using System.Reflection;
using System.Threading;
using System.Xml;
using OpenMetaverse;
using log4net;
using Nini.Config;
using Nwc.XmlRpc;
using OpenSim.Framework;
using OpenSim.Framework.Communications.Cache;
using OpenSim.Region.Environment.Interfaces;
using OpenSim.Region.Interfaces;
using OpenSim.Region.Environment.Scenes;
namespace OpenSim.Region.Environment.Modules.Communications.Local
{
public class LocalInterregionComms : IRegionModule, IInterregionCommsOut, IInterregionCommsIn
{
private bool m_enabled = false;
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private List<Scene> m_sceneList = new List<Scene>();
#region Events
public event ChildAgentUpdateReceived OnChildAgentUpdate;
#endregion /* Events */
#region IRegionModule
public void Initialise(Scene scene, IConfigSource config)
{
if (m_sceneList.Count == 0)
{
IConfig startupConfig = config.Configs["Communications"];
if ((startupConfig == null) ||
(startupConfig != null) && (startupConfig.GetString("InterregionComms", "RESTCommms") == "LocalComms"))
m_enabled = true;
}
if (!m_enabled)
return;
Init(scene);
}
public void PostInitialise()
{
}
public void Close()
{
}
public string Name
{
get { return "LocalInterregionCommsModule"; }
}
public bool IsSharedModule
{
get { return true; }
}
/// <summary>
/// Can be called from other modules.
/// </summary>
/// <param name="scene"></param>
public void Init(Scene scene)
{
if (!m_sceneList.Contains(scene))
{
lock (m_sceneList)
{
m_sceneList.Add(scene);
if (m_enabled)
scene.RegisterModuleInterface<IInterregionCommsOut>(this);
scene.RegisterModuleInterface<IInterregionCommsIn>(this);
}
}
}
#endregion /* IRegionModule */
#region IInterregionComms
public bool SendChildAgentUpdate(ulong regionHandle, AgentData cAgentData)
{
lock (m_sceneList)
{
foreach (Scene s in m_sceneList)
{
if (s.RegionInfo.RegionHandle == regionHandle)
{
//m_log.Debug("[LOCAL COMMS]: Found region to send ChildAgentUpdate");
return s.IncomingChildAgentDataUpdate(cAgentData);
//if (OnChildAgentUpdate != null)
// return OnChildAgentUpdate(cAgentData);
}
}
}
m_log.Debug("[LOCAL COMMS]: region not found for ChildAgentUpdate");
return false;
}
#endregion /* IInterregionComms */
}
}
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSim Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Collections;
using System.Collections.Generic;
using System.Net;
using System.Net.Sockets;
using System.Reflection;
using System.Threading;
using System.Xml;
using OpenMetaverse;
using log4net;
using Nini.Config;
using Nwc.XmlRpc;
using OpenSim.Framework;
using OpenSim.Framework.Communications.Cache;
using OpenSim.Region.Environment.Interfaces;
using OpenSim.Region.Interfaces;
using OpenSim.Region.Environment.Scenes;
namespace OpenSim.Region.Environment.Modules.Communications.Local
{
public class LocalInterregionComms : IRegionModule, IInterregionCommsOut, IInterregionCommsIn
{
private bool m_enabled = false;
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private List<Scene> m_sceneList = new List<Scene>();
#region Events
public event ChildAgentUpdateReceived OnChildAgentUpdate;
#endregion /* Events */
#region IRegionModule
public void Initialise(Scene scene, IConfigSource config)
{
if (m_sceneList.Count == 0)
{
IConfig startupConfig = config.Configs["Communications"];
if ((startupConfig == null) ||
(startupConfig != null) && (startupConfig.GetString("InterregionComms", "RESTCommms") == "LocalComms"))
m_enabled = true;
}
if (!m_enabled)
return;
Init(scene);
}
public void PostInitialise()
{
}
public void Close()
{
}
public string Name
{
get { return "LocalInterregionCommsModule"; }
}
public bool IsSharedModule
{
get { return true; }
}
/// <summary>
/// Can be called from other modules.
/// </summary>
/// <param name="scene"></param>
public void Init(Scene scene)
{
if (!m_sceneList.Contains(scene))
{
lock (m_sceneList)
{
m_sceneList.Add(scene);
if (m_enabled)
scene.RegisterModuleInterface<IInterregionCommsOut>(this);
scene.RegisterModuleInterface<IInterregionCommsIn>(this);
}
}
}
#endregion /* IRegionModule */
#region IInterregionComms
public bool SendChildAgentUpdate(ulong regionHandle, AgentData cAgentData)
{
lock (m_sceneList)
{
foreach (Scene s in m_sceneList)
{
if (s.RegionInfo.RegionHandle == regionHandle)
{
//m_log.Debug("[LOCAL COMMS]: Found region to send ChildAgentUpdate");
return s.IncomingChildAgentDataUpdate(cAgentData);
//if (OnChildAgentUpdate != null)
// return OnChildAgentUpdate(cAgentData);
}
}
}
m_log.Debug("[LOCAL COMMS]: region not found for ChildAgentUpdate");
return false;
}
#endregion /* IInterregionComms */
}
}

View File

@ -1,86 +1,86 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSim Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Collections;
using System.Collections.Generic;
using System.Reflection;
using log4net;
using Nini.Config;
using OpenSim.Framework;
using OpenSim.Framework.Communications;
using OpenSim.Framework.Communications.Cache;
using OpenSim.Region.Environment.Interfaces;
using OpenSim.Region.Interfaces;
using OpenSim.Region.Environment.Scenes;
using OpenSim.Region.Environment.Scenes.Hypergrid;
namespace OpenSim.Region.Environment.Modules.Communications.REST
{
public class HGInterregionComms : RESTInterregionComms
{
private static bool initialized = false;
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
#region IRegionModule
public override void Initialise(Scene scene, IConfigSource config)
{
if (!initialized)
{
initialized = true;
IConfig startupConfig = config.Configs["Communications"];
if ((startupConfig != null) && (startupConfig.GetString("InterregionComms", "RESTCommms") == "HGRESTComms"))
{
m_enabled = true;
InitOnce(scene);
}
}
if (!m_enabled)
return;
InitEach(scene);
}
public override string Name
{
get { return "HGInterregionCommsModule"; }
}
#endregion /* IRegionModule */
#region Misc
protected override ulong GetRegionHandle(RegionInfo region)
{
return ((HGSceneCommunicationService)(m_aScene.SceneGridService)).m_hg.FindRegionHandle(region.RegionHandle);
}
#endregion /* Misc */
}
}
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSim Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Collections;
using System.Collections.Generic;
using System.Reflection;
using log4net;
using Nini.Config;
using OpenSim.Framework;
using OpenSim.Framework.Communications;
using OpenSim.Framework.Communications.Cache;
using OpenSim.Region.Environment.Interfaces;
using OpenSim.Region.Interfaces;
using OpenSim.Region.Environment.Scenes;
using OpenSim.Region.Environment.Scenes.Hypergrid;
namespace OpenSim.Region.Environment.Modules.Communications.REST
{
public class HGInterregionComms : RESTInterregionComms
{
private static bool initialized = false;
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
#region IRegionModule
public override void Initialise(Scene scene, IConfigSource config)
{
if (!initialized)
{
initialized = true;
IConfig startupConfig = config.Configs["Communications"];
if ((startupConfig != null) && (startupConfig.GetString("InterregionComms", "RESTCommms") == "HGRESTComms"))
{
m_enabled = true;
InitOnce(scene);
}
}
if (!m_enabled)
return;
InitEach(scene);
}
public override string Name
{
get { return "HGInterregionCommsModule"; }
}
#endregion /* IRegionModule */
#region Misc
protected override ulong GetRegionHandle(RegionInfo region)
{
return ((HGSceneCommunicationService)(m_aScene.SceneGridService)).m_hg.FindRegionHandle(region.RegionHandle);
}
#endregion /* Misc */
}
}

View File

@ -1,296 +1,296 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSim Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Net;
using System.Net.Sockets;
using System.Reflection;
using System.Threading;
using System.Xml;
using OpenMetaverse;
using OpenMetaverse.StructuredData;
using log4net;
using Nini.Config;
using Nwc.XmlRpc;
using OpenSim.Framework;
using OpenSim.Framework.Communications;
using OpenSim.Framework.Communications.Cache;
using OpenSim.Region.Environment.Interfaces;
using OpenSim.Region.Interfaces;
using OpenSim.Region.Environment.Scenes;
using OpenSim.Region.Environment.Modules.Communications.Local;
namespace OpenSim.Region.Environment.Modules.Communications.REST
{
public class RESTInterregionComms : IRegionModule, IInterregionCommsOut
{
private static bool initialized = false;
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
protected bool m_enabled = false;
protected Scene m_aScene;
// RESTInterregionComms does not care about local regions; it delegates that to the Local module
protected LocalInterregionComms m_localBackend;
protected CommunicationsManager m_commsManager;
#region IRegionModule
public virtual void Initialise(Scene scene, IConfigSource config)
{
if (!initialized)
{
initialized = true;
IConfig startupConfig = config.Configs["Communications"];
if ((startupConfig != null) && (startupConfig.GetString("InterregionComms", "RESTCommms") == "RESTComms"))
{
m_enabled = true;
InitOnce(scene);
}
}
if (!m_enabled)
return;
InitEach(scene);
}
public virtual void PostInitialise()
{
if (m_enabled)
AddHTTPHandlers();
}
public virtual void Close()
{
}
public virtual string Name
{
get { return "RESTInterregionCommsModule"; }
}
public virtual bool IsSharedModule
{
get { return true; }
}
protected virtual void InitEach(Scene scene)
{
m_localBackend.Init(scene);
scene.RegisterModuleInterface<IInterregionCommsOut>(this);
}
protected virtual void InitOnce(Scene scene)
{
m_localBackend = new LocalInterregionComms();
m_commsManager = scene.CommsManager;
m_aScene = scene;
}
protected virtual void AddHTTPHandlers()
{
m_aScene.AddHTTPHandler("/ChildAgentUpdate/", ChildAgentUpdateHandler);
}
#endregion /* IRegionModule */
#region IInterregionComms
public bool SendChildAgentUpdate(ulong regionHandle, AgentData cAgentData)
{
// Try local first
if (m_localBackend.SendChildAgentUpdate(regionHandle, cAgentData))
return true;
// else do the remote thing
RegionInfo regInfo = m_commsManager.GridService.RequestNeighbourInfo(regionHandle);
if (regInfo != null)
{
return DoChildAgentUpdateCall(regInfo, cAgentData);
}
return false;
}
protected bool DoChildAgentUpdateCall(RegionInfo region, AgentData cAgentData)
{
string uri = "http://" + region.ExternalEndPoint.Address + ":" + region.HttpPort + "/ChildAgentUpdate/";
//Console.WriteLine(" >>> DoChildAgentUpdateCall <<< " + uri);
WebRequest ChildUpdateRequest = WebRequest.Create(uri);
ChildUpdateRequest.Method = "PUT";
ChildUpdateRequest.ContentType = "application/json";
ChildUpdateRequest.Timeout = 10000;
// Fill it in
OSDMap args = null;
try
{
args = cAgentData.PackUpdateMessage();
}
catch (Exception e)
{
m_log.Debug("[REST COMMS]: PackUpdateMessage failed with exception: " + e.Message);
}
// Add the regionhandle of the destination region
ulong regionHandle = GetRegionHandle(region);
args["destination_handle"] = OSD.FromString(regionHandle.ToString());
string strBuffer = "";
byte[] buffer = new byte[1];
try
{
strBuffer = OSDParser.SerializeJsonString(args);
System.Text.UTF8Encoding str = new System.Text.UTF8Encoding();
buffer = str.GetBytes(strBuffer);
}
catch (Exception e)
{
m_log.WarnFormat("[OSG2]: Exception thrown on serialization of ChildUpdate: {0}", e.Message);
// ignore. buffer will be empty, caller should check.
}
Stream os = null;
try
{ // send the Post
ChildUpdateRequest.ContentLength = buffer.Length; //Count bytes to send
os = ChildUpdateRequest.GetRequestStream();
os.Write(buffer, 0, strBuffer.Length); //Send it
os.Close();
//m_log.InfoFormat("[REST COMMS]: Posted ChildAgentUpdate request to remote sim {0}", uri);
}
catch (WebException ex)
{
//m_log.InfoFormat("[REST COMMS]: Bad send on ChildAgentUpdate {0}", ex.Message);
return false;
}
// Let's wait for the response
//m_log.Info("[REST COMMS]: Waiting for a reply after ChildAgentUpdate");
string reply = null;
try
{
WebResponse webResponse = ChildUpdateRequest.GetResponse();
if (webResponse == null)
{
m_log.Info("[REST COMMS]: Null reply on ChilAgentUpdate post");
}
StreamReader sr = new StreamReader(webResponse.GetResponseStream());
reply = sr.ReadToEnd().Trim();
sr.Close();
//m_log.InfoFormat("[REST COMMS]: ChilAgentUpdate reply was {0} ", reply);
}
catch (WebException ex)
{
m_log.InfoFormat("[REST COMMS]: exception on reply of ChilAgentUpdate {0}", ex.Message);
// ignore, really
}
return true;
}
#endregion /* IInterregionComms */
#region Called from remote instances on this instance
public Hashtable ChildAgentUpdateHandler(Hashtable request)
{
//m_log.Debug("[CONNECTION DEBUGGING]: ChildDataUpdateHandler Called");
Hashtable responsedata = new Hashtable();
responsedata["content_type"] = "text/html";
OSDMap args = null;
try
{
OSD buffer;
// We should pay attention to the content-type, but let's assume we know it's Json
buffer = OSDParser.DeserializeJson((string)request["body"]);
if (buffer.Type == OSDType.Map)
args = (OSDMap)buffer;
else
{
// uh?
m_log.Debug("[REST COMMS]: Got OSD of type " + buffer.Type.ToString());
}
}
catch (Exception ex)
{
m_log.InfoFormat("[REST COMMS]: exception on parse of ChildAgentUpdate message {0}", ex.Message);
responsedata["int_response_code"] = 400;
responsedata["str_response_string"] = "false";
return responsedata;
}
// retrieve the regionhandle
ulong regionhandle = 0;
if (args["destination_handle"] != null)
UInt64.TryParse(args["destination_handle"].AsString(), out regionhandle);
AgentData agent = new AgentData();
try
{
agent.UnpackUpdateMessage(args);
}
catch (Exception ex)
{
m_log.InfoFormat("[REST COMMS]: exception on unpacking ChildAgentUpdate message {0}", ex.Message);
}
//agent.Dump();
bool result = m_localBackend.SendChildAgentUpdate(regionhandle, agent);
responsedata["int_response_code"] = 200;
responsedata["str_response_string"] = result.ToString();
return responsedata;
}
#endregion
#region Misc
protected virtual ulong GetRegionHandle(RegionInfo region)
{
return region.RegionHandle;
}
#endregion /* Misc */
}
}
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSim Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Net;
using System.Net.Sockets;
using System.Reflection;
using System.Threading;
using System.Xml;
using OpenMetaverse;
using OpenMetaverse.StructuredData;
using log4net;
using Nini.Config;
using Nwc.XmlRpc;
using OpenSim.Framework;
using OpenSim.Framework.Communications;
using OpenSim.Framework.Communications.Cache;
using OpenSim.Region.Environment.Interfaces;
using OpenSim.Region.Interfaces;
using OpenSim.Region.Environment.Scenes;
using OpenSim.Region.Environment.Modules.Communications.Local;
namespace OpenSim.Region.Environment.Modules.Communications.REST
{
public class RESTInterregionComms : IRegionModule, IInterregionCommsOut
{
private static bool initialized = false;
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
protected bool m_enabled = false;
protected Scene m_aScene;
// RESTInterregionComms does not care about local regions; it delegates that to the Local module
protected LocalInterregionComms m_localBackend;
protected CommunicationsManager m_commsManager;
#region IRegionModule
public virtual void Initialise(Scene scene, IConfigSource config)
{
if (!initialized)
{
initialized = true;
IConfig startupConfig = config.Configs["Communications"];
if ((startupConfig != null) && (startupConfig.GetString("InterregionComms", "RESTCommms") == "RESTComms"))
{
m_enabled = true;
InitOnce(scene);
}
}
if (!m_enabled)
return;
InitEach(scene);
}
public virtual void PostInitialise()
{
if (m_enabled)
AddHTTPHandlers();
}
public virtual void Close()
{
}
public virtual string Name
{
get { return "RESTInterregionCommsModule"; }
}
public virtual bool IsSharedModule
{
get { return true; }
}
protected virtual void InitEach(Scene scene)
{
m_localBackend.Init(scene);
scene.RegisterModuleInterface<IInterregionCommsOut>(this);
}
protected virtual void InitOnce(Scene scene)
{
m_localBackend = new LocalInterregionComms();
m_commsManager = scene.CommsManager;
m_aScene = scene;
}
protected virtual void AddHTTPHandlers()
{
m_aScene.AddHTTPHandler("/ChildAgentUpdate/", ChildAgentUpdateHandler);
}
#endregion /* IRegionModule */
#region IInterregionComms
public bool SendChildAgentUpdate(ulong regionHandle, AgentData cAgentData)
{
// Try local first
if (m_localBackend.SendChildAgentUpdate(regionHandle, cAgentData))
return true;
// else do the remote thing
RegionInfo regInfo = m_commsManager.GridService.RequestNeighbourInfo(regionHandle);
if (regInfo != null)
{
return DoChildAgentUpdateCall(regInfo, cAgentData);
}
return false;
}
protected bool DoChildAgentUpdateCall(RegionInfo region, AgentData cAgentData)
{
string uri = "http://" + region.ExternalEndPoint.Address + ":" + region.HttpPort + "/ChildAgentUpdate/";
//Console.WriteLine(" >>> DoChildAgentUpdateCall <<< " + uri);
WebRequest ChildUpdateRequest = WebRequest.Create(uri);
ChildUpdateRequest.Method = "PUT";
ChildUpdateRequest.ContentType = "application/json";
ChildUpdateRequest.Timeout = 10000;
// Fill it in
OSDMap args = null;
try
{
args = cAgentData.PackUpdateMessage();
}
catch (Exception e)
{
m_log.Debug("[REST COMMS]: PackUpdateMessage failed with exception: " + e.Message);
}
// Add the regionhandle of the destination region
ulong regionHandle = GetRegionHandle(region);
args["destination_handle"] = OSD.FromString(regionHandle.ToString());
string strBuffer = "";
byte[] buffer = new byte[1];
try
{
strBuffer = OSDParser.SerializeJsonString(args);
System.Text.UTF8Encoding str = new System.Text.UTF8Encoding();
buffer = str.GetBytes(strBuffer);
}
catch (Exception e)
{
m_log.WarnFormat("[OSG2]: Exception thrown on serialization of ChildUpdate: {0}", e.Message);
// ignore. buffer will be empty, caller should check.
}
Stream os = null;
try
{ // send the Post
ChildUpdateRequest.ContentLength = buffer.Length; //Count bytes to send
os = ChildUpdateRequest.GetRequestStream();
os.Write(buffer, 0, strBuffer.Length); //Send it
os.Close();
//m_log.InfoFormat("[REST COMMS]: Posted ChildAgentUpdate request to remote sim {0}", uri);
}
catch (WebException ex)
{
//m_log.InfoFormat("[REST COMMS]: Bad send on ChildAgentUpdate {0}", ex.Message);
return false;
}
// Let's wait for the response
//m_log.Info("[REST COMMS]: Waiting for a reply after ChildAgentUpdate");
string reply = null;
try
{
WebResponse webResponse = ChildUpdateRequest.GetResponse();
if (webResponse == null)
{
m_log.Info("[REST COMMS]: Null reply on ChilAgentUpdate post");
}
StreamReader sr = new StreamReader(webResponse.GetResponseStream());
reply = sr.ReadToEnd().Trim();
sr.Close();
//m_log.InfoFormat("[REST COMMS]: ChilAgentUpdate reply was {0} ", reply);
}
catch (WebException ex)
{
m_log.InfoFormat("[REST COMMS]: exception on reply of ChilAgentUpdate {0}", ex.Message);
// ignore, really
}
return true;
}
#endregion /* IInterregionComms */
#region Called from remote instances on this instance
public Hashtable ChildAgentUpdateHandler(Hashtable request)
{
//m_log.Debug("[CONNECTION DEBUGGING]: ChildDataUpdateHandler Called");
Hashtable responsedata = new Hashtable();
responsedata["content_type"] = "text/html";
OSDMap args = null;
try
{
OSD buffer;
// We should pay attention to the content-type, but let's assume we know it's Json
buffer = OSDParser.DeserializeJson((string)request["body"]);
if (buffer.Type == OSDType.Map)
args = (OSDMap)buffer;
else
{
// uh?
m_log.Debug("[REST COMMS]: Got OSD of type " + buffer.Type.ToString());
}
}
catch (Exception ex)
{
m_log.InfoFormat("[REST COMMS]: exception on parse of ChildAgentUpdate message {0}", ex.Message);
responsedata["int_response_code"] = 400;
responsedata["str_response_string"] = "false";
return responsedata;
}
// retrieve the regionhandle
ulong regionhandle = 0;
if (args["destination_handle"] != null)
UInt64.TryParse(args["destination_handle"].AsString(), out regionhandle);
AgentData agent = new AgentData();
try
{
agent.UnpackUpdateMessage(args);
}
catch (Exception ex)
{
m_log.InfoFormat("[REST COMMS]: exception on unpacking ChildAgentUpdate message {0}", ex.Message);
}
//agent.Dump();
bool result = m_localBackend.SendChildAgentUpdate(regionhandle, agent);
responsedata["int_response_code"] = 200;
responsedata["str_response_string"] = result.ToString();
return responsedata;
}
#endregion
#region Misc
protected virtual ulong GetRegionHandle(RegionInfo region)
{
return region.RegionHandle;
}
#endregion /* Misc */
}
}

View File

@ -325,7 +325,7 @@ namespace OpenSim.Region.Environment.Modules.Scripting.VectorRender
int hex = 0;
Color newColour;
if(Int32.TryParse(nextLine, NumberStyles.HexNumber, CultureInfo.InvariantCulture, out hex))
if (Int32.TryParse(nextLine, NumberStyles.HexNumber, CultureInfo.InvariantCulture, out hex))
{
newColour = Color.FromArgb(hex);
}

View File

@ -533,7 +533,7 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions
{
permission = true;
}
else if(group.IsAttachment)
else if (group.IsAttachment)
{
permission = false;
}

View File

@ -4456,14 +4456,14 @@ namespace OpenSim.Region.Environment.Scenes
// update non-physical objects like the joint proxy objects that represent the position
// of the joints in the scene.
// This routine is normally called from within a lock(OdeLock) from within the OdePhysicsScene
// This routine is normally called from within a lock (OdeLock) from within the OdePhysicsScene
// WARNING: be careful of deadlocks here if you manipulate the scene. Remember you are being called
// from within the OdePhysicsScene.
protected internal void jointMoved(PhysicsJoint joint)
{
// m_parentScene.PhysicsScene.DumpJointInfo(); // non-thread-locked version; we should already be in a lock(OdeLock) when this callback is invoked
// m_parentScene.PhysicsScene.DumpJointInfo(); // non-thread-locked version; we should already be in a lock (OdeLock) when this callback is invoked
// FIXME: this causes a sequential lookup of all objects in the scene; use a dictionary
SceneObjectPart jointProxyObject = GetSceneObjectPart(joint.ObjectNameInScene);
if (jointProxyObject == null)
@ -4521,7 +4521,7 @@ namespace OpenSim.Region.Environment.Scenes
// update non-physical objects like the joint proxy objects that represent the position
// of the joints in the scene.
// This routine is normally called from within a lock(OdeLock) from within the OdePhysicsScene
// This routine is normally called from within a lock (OdeLock) from within the OdePhysicsScene
// WARNING: be careful of deadlocks here if you manipulate the scene. Remember you are being called
// from within the OdePhysicsScene.
protected internal void jointDeactivated(PhysicsJoint joint)
@ -4547,7 +4547,7 @@ namespace OpenSim.Region.Environment.Scenes
// alert the user of errors by using the debug channel in the same way that scripts alert
// the user of compile errors.
// This routine is normally called from within a lock(OdeLock) from within the OdePhysicsScene
// This routine is normally called from within a lock (OdeLock) from within the OdePhysicsScene
// WARNING: be careful of deadlocks here if you manipulate the scene. Remember you are being called
// from within the OdePhysicsScene.
public void jointErrorMessage(PhysicsJoint joint, string message)

View File

@ -1624,7 +1624,7 @@ if (m_shape != null) {
part.m_fromUserInventoryItemID = fromUserInventoryItemId;
// for tempOnRez objects, we have to fix the Expire date.
if((part.Flags & PrimFlags.TemporaryOnRez) != 0) part.ResetExpire();
if ((part.Flags & PrimFlags.TemporaryOnRez) != 0) part.ResetExpire();
return part;
}

View File

@ -1,55 +1,55 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSim Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Collections.Generic;
using OpenSim.Framework;
using OpenMetaverse;
namespace OpenSim.Region.Physics.Manager
{
public enum PhysicsJointType : int
{
Ball = 0,
Hinge = 1
}
public class PhysicsJoint
{
public virtual bool IsInPhysicsEngine { get { return false; } } // set internally to indicate if this joint has already been passed to the physics engine or is still pending
public PhysicsJointType Type;
public string RawParams;
public List<string> BodyNames = new List<string>();
public PhysicsVector Position; // global coords
public Quaternion Rotation; // global coords
public string ObjectNameInScene; // proxy object in scene that represents the joint position/orientation
public string TrackedBodyName; // body name that this joint is attached to (ObjectNameInScene will follow TrackedBodyName)
public Quaternion LocalRotation; // joint orientation relative to one of the involved bodies, the tracked body
public int ErrorMessageCount; // total # of error messages printed for this joint since its creation. if too many, further error messages are suppressed to prevent flooding.
public const int maxErrorMessages = 100; // no more than this # of error messages will be printed for each joint
}
}
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSim Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Collections.Generic;
using OpenSim.Framework;
using OpenMetaverse;
namespace OpenSim.Region.Physics.Manager
{
public enum PhysicsJointType : int
{
Ball = 0,
Hinge = 1
}
public class PhysicsJoint
{
public virtual bool IsInPhysicsEngine { get { return false; } } // set internally to indicate if this joint has already been passed to the physics engine or is still pending
public PhysicsJointType Type;
public string RawParams;
public List<string> BodyNames = new List<string>();
public PhysicsVector Position; // global coords
public Quaternion Rotation; // global coords
public string ObjectNameInScene; // proxy object in scene that represents the joint position/orientation
public string TrackedBodyName; // body name that this joint is attached to (ObjectNameInScene will follow TrackedBodyName)
public Quaternion LocalRotation; // joint orientation relative to one of the involved bodies, the tracked body
public int ErrorMessageCount; // total # of error messages printed for this joint since its creation. if too many, further error messages are suppressed to prevent flooding.
public const int maxErrorMessages = 100; // no more than this # of error messages will be printed for each joint
}
}

View File

@ -1,49 +1,49 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSim Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using OpenMetaverse;
using Ode.NET;
using OpenSim.Framework;
using OpenSim.Region.Physics.Manager;
using OpenSim.Region.Physics.Manager;
using OpenSim.Region.Physics.OdePlugin;
namespace OpenSim.Region.Physics.OdePlugin
{
class OdePhysicsJoint : PhysicsJoint
{
public override bool IsInPhysicsEngine
{
get
{
return (jointID != IntPtr.Zero);
}
}
public IntPtr jointID;
}
}
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSim Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using OpenMetaverse;
using Ode.NET;
using OpenSim.Framework;
using OpenSim.Region.Physics.Manager;
using OpenSim.Region.Physics.Manager;
using OpenSim.Region.Physics.OdePlugin;
namespace OpenSim.Region.Physics.OdePlugin
{
class OdePhysicsJoint : PhysicsJoint
{
public override bool IsInPhysicsEngine
{
get
{
return (jointID != IntPtr.Zero);
}
}
public IntPtr jointID;
}
}

View File

@ -1366,28 +1366,28 @@ namespace OpenSim.Region.Physics.OdePlugin
get { return m_NINJA_physics_joints_enabled; }
}
// internal utility function: must be called within a lock(OdeLock)
// internal utility function: must be called within a lock (OdeLock)
private void InternalAddActiveJoint(PhysicsJoint joint)
{
activeJoints.Add(joint);
SOPName_to_activeJoint.Add(joint.ObjectNameInScene, joint);
}
// internal utility function: must be called within a lock(OdeLock)
// internal utility function: must be called within a lock (OdeLock)
private void InternalAddPendingJoint(OdePhysicsJoint joint)
{
pendingJoints.Add(joint);
SOPName_to_pendingJoint.Add(joint.ObjectNameInScene, joint);
}
// internal utility function: must be called within a lock(OdeLock)
// internal utility function: must be called within a lock (OdeLock)
private void InternalRemovePendingJoint(PhysicsJoint joint)
{
pendingJoints.Remove(joint);
SOPName_to_pendingJoint.Remove(joint.ObjectNameInScene);
}
// internal utility function: must be called within a lock(OdeLock)
// internal utility function: must be called within a lock (OdeLock)
private void InternalRemoveActiveJoint(PhysicsJoint joint)
{
activeJoints.Remove(joint);
@ -1640,7 +1640,7 @@ namespace OpenSim.Region.Physics.OdePlugin
}
}
// normally called from within OnJointMoved, which is called from within a lock(OdeLock)
// normally called from within OnJointMoved, which is called from within a lock (OdeLock)
public override PhysicsVector GetJointAnchor(PhysicsJoint joint)
{
Debug.Assert(joint.IsInPhysicsEngine);
@ -1666,7 +1666,7 @@ namespace OpenSim.Region.Physics.OdePlugin
return new PhysicsVector(pos.X, pos.Y, pos.Z);
}
// normally called from within OnJointMoved, which is called from within a lock(OdeLock)
// normally called from within OnJointMoved, which is called from within a lock (OdeLock)
// WARNING: ODE sometimes returns <0,0,0> as the joint axis! Therefore this function
// appears to be unreliable. Fortunately we can compute the joint axis ourselves by
// keeping track of the joint's original orientation relative to one of the involved bodies.
@ -2230,8 +2230,8 @@ namespace OpenSim.Region.Physics.OdePlugin
if (SupportsNINJAJoints)
{
DeleteRequestedJoints(); // this must be outside of the lock(OdeLock) to avoid deadlocks
CreateRequestedJoints(); // this must be outside of the lock(OdeLock) to avoid deadlocks
DeleteRequestedJoints(); // this must be outside of the lock (OdeLock) to avoid deadlocks
CreateRequestedJoints(); // this must be outside of the lock (OdeLock) to avoid deadlocks
}
lock (OdeLock)

View File

@ -3644,7 +3644,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
partItemID = item.ItemID;
int linkNumber = m_host.LinkNum;
if(m_host.ParentGroup.Children.Count == 1)
if (m_host.ParentGroup.Children.Count == 1)
linkNumber = 0;

View File

@ -1,10 +1,10 @@
Copyright (c) 2008, Andrew Arnott, Scott Hanselman, Jason Alexander, et. al
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
* Neither the name of the DotNetOpenId nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
Copyright (c) 2008, Andrew Arnott, Scott Hanselman, Jason Alexander, et. al
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
* Neither the name of the 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.