diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 154 |
1 files changed, 132 insertions, 22 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index a44185a..a9a5630 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | |||
@@ -1074,44 +1074,154 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1074 | m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Unknown); | 1074 | m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Unknown); |
1075 | } | 1075 | } |
1076 | 1076 | ||
1077 | static private readonly byte[] GenericMessageHeader = new byte[] { | ||
1078 | Helpers.MSG_RELIABLE, //| Helpers.MSG_ZEROCODED, not doing spec zeroencode on this | ||
1079 | 0, 0, 0, 0, // sequence number | ||
1080 | 0, // extra | ||
1081 | 0xff, 0xff, 1, 5 // ID 261 (low frequency bigendian) | ||
1082 | }; | ||
1083 | |||
1077 | public void SendGenericMessage(string method, UUID invoice, List<string> message) | 1084 | public void SendGenericMessage(string method, UUID invoice, List<string> message) |
1078 | { | 1085 | { |
1079 | GenericMessagePacket gmp = new GenericMessagePacket(); | 1086 | UDPPacketBuffer buf = m_udpServer.GetNewUDPBuffer(m_udpClient.RemoteEndPoint); |
1087 | byte[] data = buf.Data; | ||
1080 | 1088 | ||
1081 | gmp.AgentData.AgentID = AgentId; | 1089 | //setup header |
1082 | gmp.AgentData.SessionID = m_sessionId; | 1090 | Buffer.BlockCopy(GenericMessageHeader, 0, data, 0, 10); |
1083 | gmp.AgentData.TransactionID = invoice; | ||
1084 | 1091 | ||
1085 | gmp.MethodData.Method = Util.StringToBytes256(method); | 1092 | //agentdata block |
1086 | gmp.ParamList = new GenericMessagePacket.ParamListBlock[message.Count]; | 1093 | m_agentId.ToBytes(data, 10); // 26 |
1087 | int i = 0; | 1094 | m_sessionId.ToBytes(data, 26); // 42 sessionID zero?? TO check |
1088 | foreach (string val in message) | 1095 | UUID.Zero.ToBytes(data, 42); // 58 |
1096 | |||
1097 | int pos = 58; | ||
1098 | |||
1099 | //method block | ||
1100 | byte[] tmp = Util.StringToBytes256(method); | ||
1101 | int len = tmp.Length; | ||
1102 | data[pos++] = (byte)len; | ||
1103 | if (len > 0) | ||
1104 | Buffer.BlockCopy(tmp, 0, data, pos, len); pos += len; | ||
1105 | invoice.ToBytes(data, pos); pos += 16; | ||
1106 | |||
1107 | //ParamList block | ||
1108 | if (message.Count == 0) | ||
1089 | { | 1109 | { |
1090 | gmp.ParamList[i] = new GenericMessagePacket.ParamListBlock(); | 1110 | data[pos++] = 0; |
1091 | gmp.ParamList[i++].Parameter = Util.StringToBytes256(val); | 1111 | buf.DataLength = pos; |
1112 | //m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Unknown, null, false, true); | ||
1113 | m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Unknown); | ||
1114 | return; | ||
1092 | } | 1115 | } |
1093 | 1116 | ||
1094 | OutPacket(gmp, ThrottleOutPacketType.Task); | 1117 | int countpos = pos; |
1118 | ++pos; | ||
1119 | |||
1120 | int count = 0; | ||
1121 | foreach (string val in message) | ||
1122 | { | ||
1123 | tmp = Util.StringToBytes256(val); | ||
1124 | len = tmp.Length; | ||
1125 | |||
1126 | if (pos + len >= LLUDPServer.MAXPAYLOAD) | ||
1127 | { | ||
1128 | data[countpos] = (byte)count; | ||
1129 | buf.DataLength = pos; | ||
1130 | //m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Task, null, false, true); | ||
1131 | m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Task); | ||
1132 | |||
1133 | UDPPacketBuffer newbuf = m_udpServer.GetNewUDPBuffer(m_udpClient.RemoteEndPoint); | ||
1134 | Buffer.BlockCopy(data, 0, newbuf.Data, 0, countpos); | ||
1135 | pos = countpos + 1; | ||
1136 | data = buf.Data; | ||
1137 | count = 1; | ||
1138 | } | ||
1139 | else | ||
1140 | ++count; | ||
1141 | |||
1142 | data[pos++] = (byte)len; | ||
1143 | if (len > 0) | ||
1144 | Buffer.BlockCopy(tmp, 0, data, pos, len); pos += len; | ||
1145 | } | ||
1146 | if (count > 0) | ||
1147 | { | ||
1148 | data[countpos] = (byte)count; | ||
1149 | buf.DataLength = pos; | ||
1150 | //m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Unknown, null, false, true); | ||
1151 | m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Unknown); | ||
1152 | } | ||
1095 | } | 1153 | } |
1096 | 1154 | ||
1097 | public void SendGenericMessage(string method, UUID invoice, List<byte[]> message) | 1155 | public void SendGenericMessage(string method, UUID invoice, List<byte[]> message) |
1098 | { | 1156 | { |
1099 | GenericMessagePacket gmp = new GenericMessagePacket(); | 1157 | UDPPacketBuffer buf = m_udpServer.GetNewUDPBuffer(m_udpClient.RemoteEndPoint); |
1158 | byte[] data = buf.Data; | ||
1100 | 1159 | ||
1101 | gmp.AgentData.AgentID = AgentId; | 1160 | //setup header |
1102 | gmp.AgentData.SessionID = m_sessionId; | 1161 | Buffer.BlockCopy(GenericMessageHeader, 0, data, 0, 10); |
1103 | gmp.AgentData.TransactionID = invoice; | ||
1104 | 1162 | ||
1105 | gmp.MethodData.Method = Util.StringToBytes256(method); | 1163 | //agentdata block |
1106 | gmp.ParamList = new GenericMessagePacket.ParamListBlock[message.Count]; | 1164 | m_agentId.ToBytes(data, 10); // 26 |
1107 | int i = 0; | 1165 | m_sessionId.ToBytes(data, 26); // 42 sessionID zero?? TO check |
1108 | foreach (byte[] val in message) | 1166 | UUID.Zero.ToBytes(data, 42); // 58 |
1167 | |||
1168 | int pos = 58; | ||
1169 | |||
1170 | //method block | ||
1171 | byte[] tmp = Util.StringToBytes256(method); | ||
1172 | int len = tmp.Length; | ||
1173 | data[pos++] = (byte)len; | ||
1174 | if (len > 0) | ||
1175 | Buffer.BlockCopy(tmp, 0, data, pos, len); pos += len; | ||
1176 | invoice.ToBytes(data, pos); pos += 16; | ||
1177 | |||
1178 | //ParamList block | ||
1179 | if (message.Count == 0) | ||
1109 | { | 1180 | { |
1110 | gmp.ParamList[i] = new GenericMessagePacket.ParamListBlock(); | 1181 | data[pos++] = 0; |
1111 | gmp.ParamList[i++].Parameter = val; | 1182 | buf.DataLength = pos; |
1183 | //m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Unknown, null, false, true); | ||
1184 | m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Unknown); | ||
1185 | return; | ||
1112 | } | 1186 | } |
1113 | 1187 | ||
1114 | OutPacket(gmp, ThrottleOutPacketType.Task); | 1188 | int countpos = pos; |
1189 | ++pos; | ||
1190 | |||
1191 | int count = 0; | ||
1192 | foreach (byte[] val in message) | ||
1193 | { | ||
1194 | len = val.Length; | ||
1195 | if(len > 255) | ||
1196 | len = 255; | ||
1197 | |||
1198 | if (pos + len >= LLUDPServer.MAXPAYLOAD) | ||
1199 | { | ||
1200 | data[countpos] = (byte)count; | ||
1201 | buf.DataLength = pos; | ||
1202 | //m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Task, null, false, true); | ||
1203 | m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Task); | ||
1204 | |||
1205 | UDPPacketBuffer newbuf = m_udpServer.GetNewUDPBuffer(m_udpClient.RemoteEndPoint); | ||
1206 | Buffer.BlockCopy(data, 0, newbuf.Data, 0, countpos); | ||
1207 | pos = countpos + 1; | ||
1208 | data = buf.Data; | ||
1209 | count = 1; | ||
1210 | } | ||
1211 | else | ||
1212 | ++count; | ||
1213 | |||
1214 | data[pos++] = (byte)len; | ||
1215 | if (len > 0) | ||
1216 | Buffer.BlockCopy(val, 0, data, pos, len); pos += len; | ||
1217 | } | ||
1218 | if (count > 0) | ||
1219 | { | ||
1220 | data[countpos] = (byte)count; | ||
1221 | buf.DataLength = pos; | ||
1222 | //m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Unknown, null, false, true); | ||
1223 | m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Unknown); | ||
1224 | } | ||
1115 | } | 1225 | } |
1116 | 1226 | ||
1117 | public void SendGroupActiveProposals(UUID groupID, UUID transactionID, GroupActiveProposals[] Proposals) | 1227 | public void SendGroupActiveProposals(UUID groupID, UUID transactionID, GroupActiveProposals[] Proposals) |