Implemented DvbNipTestForMulticastSession and DvbNipInsertMulticastSession in PostgreSQL.
This commit is contained in:
parent
693f3adc79
commit
26ee56172c
@ -35,7 +35,7 @@ namespace skyscraper5.Data
|
|||||||
putObjectArgs = putObjectArgs.WithBucket(_minioBucket);
|
putObjectArgs = putObjectArgs.WithBucket(_minioBucket);
|
||||||
putObjectArgs = putObjectArgs.WithObject(fullName);
|
putObjectArgs = putObjectArgs.WithObject(fullName);
|
||||||
putObjectArgs = putObjectArgs.WithStreamData(buffer);
|
putObjectArgs = putObjectArgs.WithStreamData(buffer);
|
||||||
putObjectArgs = putObjectArgs.WithObjectSize(buffer.Length);
|
//putObjectArgs = putObjectArgs.WithObjectSize(buffer.Length);
|
||||||
putObjectArgs = putObjectArgs.WithContentType(mime);
|
putObjectArgs = putObjectArgs.WithContentType(mime);
|
||||||
putObjectArgs = putObjectArgs.WithHeaders(optionalData);
|
putObjectArgs = putObjectArgs.WithHeaders(optionalData);
|
||||||
|
|
||||||
@ -44,6 +44,8 @@ namespace skyscraper5.Data
|
|||||||
_tasks.Add(_minioClient.PutObjectAsync(putObjectArgs).ContinueWith(task =>
|
_tasks.Add(_minioClient.PutObjectAsync(putObjectArgs).ContinueWith(task =>
|
||||||
{
|
{
|
||||||
droppedFiles.Add(fullName);
|
droppedFiles.Add(fullName);
|
||||||
|
definetlyKnownFiles.Add(fullName);
|
||||||
|
definetlyMissingFiles.Remove(fullName);
|
||||||
buffer.Close();
|
buffer.Close();
|
||||||
buffer.Dispose();
|
buffer.Dispose();
|
||||||
}));
|
}));
|
||||||
@ -108,11 +110,15 @@ namespace skyscraper5.Data
|
|||||||
|
|
||||||
public bool FileExists(string combine)
|
public bool FileExists(string combine)
|
||||||
{
|
{
|
||||||
|
if (definetlyMissingFiles == null)
|
||||||
|
definetlyMissingFiles = new HashSet<string>();
|
||||||
if (definetlyKnownFiles == null)
|
if (definetlyKnownFiles == null)
|
||||||
definetlyKnownFiles = new HashSet<string>();
|
definetlyKnownFiles = new HashSet<string>();
|
||||||
|
|
||||||
if (definetlyKnownFiles.Contains(combine))
|
if (definetlyKnownFiles.Contains(combine))
|
||||||
return true;
|
return true;
|
||||||
|
if (definetlyMissingFiles.Contains(combine))
|
||||||
|
return false;
|
||||||
|
|
||||||
if (droppedFiles != null)
|
if (droppedFiles != null)
|
||||||
{
|
{
|
||||||
@ -132,6 +138,7 @@ namespace skyscraper5.Data
|
|||||||
MinioException minioException = e.InnerExceptions[0] as MinioException;
|
MinioException minioException = e.InnerExceptions[0] as MinioException;
|
||||||
if (minioException.Message.Contains("Minio.Exceptions.ObjectNotFoundException"))
|
if (minioException.Message.Contains("Minio.Exceptions.ObjectNotFoundException"))
|
||||||
{
|
{
|
||||||
|
definetlyMissingFiles.Add(combine);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -226,6 +233,8 @@ namespace skyscraper5.Data
|
|||||||
}
|
}
|
||||||
|
|
||||||
private int uiVersion;
|
private int uiVersion;
|
||||||
|
private HashSet<string> definetlyMissingFiles;
|
||||||
|
|
||||||
public void UiSetVersion(int version)
|
public void UiSetVersion(int version)
|
||||||
{
|
{
|
||||||
this.uiVersion = version;
|
this.uiVersion = version;
|
||||||
@ -244,8 +253,8 @@ namespace skyscraper5.Data
|
|||||||
|
|
||||||
public bool DvbNipTestForFile(string announcedFileContentLocation)
|
public bool DvbNipTestForFile(string announcedFileContentLocation)
|
||||||
{
|
{
|
||||||
string path = "/nip/" + announcedFileContentLocation;
|
string path = "/nip/" + DvbNipUtilities.MakeFilename(announcedFileContentLocation);
|
||||||
return FileExists(path);
|
return FileExists(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DvbNipFileArrival(NipActualCarrierInformation carrier, FluteListener listener)
|
public void DvbNipFileArrival(NipActualCarrierInformation carrier, FluteListener listener)
|
||||||
|
|||||||
@ -8,7 +8,10 @@ using System.Linq;
|
|||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using System.Xml;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
using Npgsql.Replication.PgOutput.Messages;
|
||||||
|
using skyscraper8.Skyscraper.Scraper.Storage.Utilities;
|
||||||
|
|
||||||
namespace skyscraper5.Data.PostgreSql
|
namespace skyscraper5.Data.PostgreSql
|
||||||
{
|
{
|
||||||
@ -101,10 +104,55 @@ namespace skyscraper5.Data.PostgreSql
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//PDS noch nicht bekannt
|
//PDS noch nicht bekannt, also in DB nachgucken
|
||||||
EnqueueTask(x => InsertDvbNipPrivateDataSpecifier(x,coordinates,versionUpdate,privateDataSessions));
|
|
||||||
_dvbNipPrivateDataSpecifiers[coordinates] = versionUpdate;
|
bool result = false;
|
||||||
return true;
|
DateTime lastUpdated = DateTime.MinValue;
|
||||||
|
NpgsqlConnection connection = new NpgsqlConnection(connectionStringBuilder.ToString());
|
||||||
|
connection.Open();
|
||||||
|
NpgsqlCommand command = connection.CreateCommand();
|
||||||
|
command.CommandText =
|
||||||
|
"SELECT version_update FROM dvbnip_private_data_specifiers WHERE nid = @nid AND cid = @cid AND lid = @lid AND sid = @sid AND private_data_specifier = @pds";
|
||||||
|
command.Parameters.AddWithValue("@nid", NpgsqlDbType.Integer, (int)coordinates.Item1);
|
||||||
|
command.Parameters.AddWithValue("@cid", NpgsqlDbType.Integer, (int)coordinates.Item2);
|
||||||
|
command.Parameters.AddWithValue("@lid", NpgsqlDbType.Integer, (int)coordinates.Item3);
|
||||||
|
command.Parameters.AddWithValue("@sid", NpgsqlDbType.Integer, (int)coordinates.Item4);
|
||||||
|
command.Parameters.AddWithValue("@pds", NpgsqlDbType.Bigint, (long)coordinates.Item5);
|
||||||
|
NpgsqlDataReader dataReader = command.ExecuteReader();
|
||||||
|
result = dataReader.Read();
|
||||||
|
if (result)
|
||||||
|
{
|
||||||
|
lastUpdated = dataReader.GetDateTime(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
dataReader.Close();
|
||||||
|
command.Dispose();
|
||||||
|
connection.Close();
|
||||||
|
|
||||||
|
if (result)
|
||||||
|
{
|
||||||
|
//schon in DB
|
||||||
|
if (lastUpdated < versionUpdate)
|
||||||
|
{
|
||||||
|
//Gesendetes Paket neuer als das in DB
|
||||||
|
EnqueueTask(x => UpdateDvbNipPrivateDataSpecifier(x, coordinates, versionUpdate, privateDataSessions));
|
||||||
|
_dvbNipPrivateDataSpecifiers[coordinates] = versionUpdate;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//Keine Änderung.
|
||||||
|
_dvbNipPrivateDataSpecifiers[coordinates] = versionUpdate;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//noch nicht in DB
|
||||||
|
EnqueueTask(x => InsertDvbNipPrivateDataSpecifier(x, coordinates, versionUpdate, privateDataSessions));
|
||||||
|
_dvbNipPrivateDataSpecifiers[coordinates] = versionUpdate;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -273,26 +321,245 @@ namespace skyscraper5.Data.PostgreSql
|
|||||||
_knownDvbNipServices.Add(coordinates);
|
_knownDvbNipServices.Add(coordinates);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private HashSet<string> _knownDvbNipMulticastSessions;
|
||||||
public bool DvbNipTestForMulticastSession(MulticastSessionType multicastSession)
|
public bool DvbNipTestForMulticastSession(MulticastSessionType multicastSession)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
if (_knownDvbNipMulticastSessions == null)
|
||||||
|
_knownDvbNipMulticastSessions = new HashSet<string>();
|
||||||
|
|
||||||
|
if (_knownDvbNipMulticastSessions.Contains(multicastSession.serviceIdentifier))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
bool result;
|
||||||
|
NpgsqlConnection connection = new NpgsqlConnection(connectionStringBuilder.ToString());
|
||||||
|
connection.Open();
|
||||||
|
NpgsqlCommand command = connection.CreateCommand();
|
||||||
|
command.CommandText = "SELECT dateadded FROM dvbnip_multicast_sessions WHERE service_identifier = @si";
|
||||||
|
command.Parameters.AddWithValue("@si", NpgsqlDbType.Text, multicastSession.serviceIdentifier);
|
||||||
|
NpgsqlDataReader dataReader = command.ExecuteReader();
|
||||||
|
if (result = dataReader.Read())
|
||||||
|
{
|
||||||
|
_knownDvbNipMulticastSessions.Add(multicastSession.serviceIdentifier);
|
||||||
|
}
|
||||||
|
dataReader.Close();
|
||||||
|
command.Dispose();
|
||||||
|
connection.Close();
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DvbNipInsertMulticastSession(MulticastSessionType multicastSession)
|
public void DvbNipInsertMulticastSession(MulticastSessionType multicastSession)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
EnqueueTask(x => DvbNipInsertMulticastSessionEx(x, multicastSession));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void DvbNipInsertMulticastSessionEx(NpgsqlConnection connection, MulticastSessionType multicastSession)
|
||||||
|
{
|
||||||
|
NpgsqlCommand command = connection.CreateCommand();
|
||||||
|
command.CommandText =
|
||||||
|
"INSERT INTO dvbnip_multicast_sessions (service_identifier, content_playback_availability_offset) VALUES (@si,@cpao) RETURNING serial";
|
||||||
|
command.Parameters.AddWithValue("@si", multicastSession.serviceIdentifier);
|
||||||
|
command.Parameters.AddWithValue("@cpao", multicastSession.contentPlaybackAvailabilityOffset);
|
||||||
|
NpgsqlDataReader dataReader = command.ExecuteReader();
|
||||||
|
dataReader.Read();
|
||||||
|
int serial = dataReader.GetInt32(0);
|
||||||
|
dataReader.Close();
|
||||||
|
command.Dispose();
|
||||||
|
|
||||||
|
if (multicastSession.MulticastGatewaySessionReporting != null)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException(nameof(multicastSession.MulticastGatewaySessionReporting));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (multicastSession.MulticastTransportSession != null)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < multicastSession.MulticastTransportSession.Length; i++)
|
||||||
|
{
|
||||||
|
DvbNipInsertMulticastSessionTransport(connection,serial,i,multicastSession.MulticastTransportSession[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (multicastSession.PresentationManifestLocator != null)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < multicastSession.PresentationManifestLocator.Length; i++)
|
||||||
|
{
|
||||||
|
DvbNipInsertPresentationManifestLocator(connection, serial, i, multicastSession.PresentationManifestLocator[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DvbNipInsertPresentationManifestLocator(NpgsqlConnection connection, int serial, int ordinal, MulticastSessionTypePresentationManifestLocator multicastSessionTypePresentationManifestLocator)
|
||||||
|
{
|
||||||
|
NpgsqlCommand command = connection.CreateCommand();
|
||||||
|
command.CommandText = "INSERT INTO dvbnip_presentation_manifest_locator VALUES (@parent,@ordinal,DEFAULT,@cppp,@ct,@mi,@to)";
|
||||||
|
command.Parameters.AddWithValue("@parent", NpgsqlDbType.Integer, serial);
|
||||||
|
command.Parameters.AddWithValue("@ordinal", NpgsqlDbType.Integer, ordinal);
|
||||||
|
command.Parameters.AddWithValue("@cppp", NpgsqlDbType.Text, multicastSessionTypePresentationManifestLocator.contentPlaybackPathPattern);
|
||||||
|
command.Parameters.AddWithValue("@ct", NpgsqlDbType.Text, multicastSessionTypePresentationManifestLocator.contentType);
|
||||||
|
command.Parameters.AddWithValue("@mi", NpgsqlDbType.Uuid, Guid.Parse(multicastSessionTypePresentationManifestLocator.manifestId));
|
||||||
|
command.Parameters.AddWithValue("@to", NpgsqlDbType.Text, multicastSessionTypePresentationManifestLocator.transportObjectURI);
|
||||||
|
int executeNonQuery = command.ExecuteNonQuery();
|
||||||
|
if (executeNonQuery != 1)
|
||||||
|
throw new DataException(String.Format("Expected to insert {0} rows, but it were {1}", 1, executeNonQuery));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DvbNipInsertMulticastSessionTransport(NpgsqlConnection connection, int serial, int ordinal, MulticastTransportSessionType transport)
|
||||||
|
{
|
||||||
|
NpgsqlCommand command = connection.CreateCommand();
|
||||||
|
command.CommandText =
|
||||||
|
"INSERT INTO dvbnip_multicast_transport_session VALUES " +
|
||||||
|
"(@serial,@ordinal,DEFAULT,DEFAULT,@id,@average,@maximum,@mediaTsi,@dstaddr,@srcaddr,@dstport,@protocolId,@protocolVersion,@contentIngestMethod," +
|
||||||
|
" @sessionIdleTimeout,@transmissionMode,@transportSecurity) " +
|
||||||
|
"RETURNING uuid";
|
||||||
|
command.Parameters.AddWithValue("@serial", NpgsqlDbType.Integer, serial);
|
||||||
|
command.Parameters.AddWithValue("@ordinal", NpgsqlDbType.Integer, ordinal);
|
||||||
|
command.Parameters.AddWithValue("@id", NpgsqlDbType.Text, transport.id);
|
||||||
|
command.Parameters.AddWithValue("@average", NpgsqlDbType.Integer, int.Parse(transport.BitRate.average));
|
||||||
|
command.Parameters.AddWithValue("@maximum", NpgsqlDbType.Integer, int.Parse(transport.BitRate.maximum));
|
||||||
|
command.Parameters.AddWithValue("@mediaTsi", NpgsqlDbType.Integer, int.Parse(transport.EndpointAddress[0].MediaTransportSessionIdentifier));
|
||||||
|
command.Parameters.AddWithValue("@dstaddr", NpgsqlDbType.Inet, IPAddress.Parse(transport.EndpointAddress[0].NetworkDestinationGroupAddress));
|
||||||
|
command.Parameters.AddWithValue("@srcaddr", NpgsqlDbType.Inet, IPAddress.Parse(transport.EndpointAddress[0].NetworkSourceAddress));
|
||||||
|
command.Parameters.AddWithValue("@dstport", NpgsqlDbType.Integer, int.Parse(transport.EndpointAddress[0].TransportDestinationPort));
|
||||||
|
command.Parameters.AddWithValue("@protocolId", NpgsqlDbType.Text, transport.TransportProtocol.protocolIdentifier);
|
||||||
|
command.Parameters.AddWithValue("@protocolVersion", NpgsqlDbType.Integer, int.Parse(transport.TransportProtocol.protocolVersion));
|
||||||
|
command.Parameters.AddWithValue("@contentIngestMethod", NpgsqlDbType.Integer, (int)transport.contentIngestMethod);
|
||||||
|
command.Parameters.AddWithValue("@sessionIdleTimeout", NpgsqlDbType.Integer, int.Parse(transport.sessionIdleTimeout));
|
||||||
|
command.Parameters.AddWithValue("@transmissionMode", NpgsqlDbType.Integer, (int)transport.transmissionMode);
|
||||||
|
command.Parameters.AddWithValue("@transportSecurity", NpgsqlDbType.Integer, (int)transport.transportSecurity);
|
||||||
|
NpgsqlDataReader dataReader = command.ExecuteReader();
|
||||||
|
dataReader.Read();
|
||||||
|
Guid uuid = dataReader.GetGuid(0);
|
||||||
|
dataReader.Close();
|
||||||
|
command.Dispose();
|
||||||
|
|
||||||
|
if (transport.ForwardErrorCorrectionParameters != null)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException(nameof(transport.ForwardErrorCorrectionParameters));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (transport.EndpointAddress.Length > 1)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException(nameof(transport.EndpointAddress));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (transport.ServiceComponentIdentifier != null)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < transport.ServiceComponentIdentifier.Length; i++)
|
||||||
|
{
|
||||||
|
ServiceComponentIdentifierType serviceComponentIdentifier = transport.ServiceComponentIdentifier[i];
|
||||||
|
DvbNipInsertServiceComponentIdentifier(connection,uuid, i, serviceComponentIdentifier);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (transport.UnicastRepairParameters != null)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException(nameof(transport.UnicastRepairParameters));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DvbNipInsertServiceComponentIdentifier(NpgsqlConnection connection, Guid uuid, int i, ServiceComponentIdentifierType serviceComponentIdentifier)
|
||||||
|
{
|
||||||
|
NpgsqlCommand command = connection.CreateCommand();
|
||||||
|
command.CommandText = "INSERT INTO dvbnip_service_component_identifier VALUES (@guid,@ordinal,@xsiType,@manifestId,@representation_id,@period_id,@adaption_set_id,@media_playlist_locator)";
|
||||||
|
command.Parameters.AddWithValue("@guid", NpgsqlDbType.Uuid, uuid);
|
||||||
|
command.Parameters.AddWithValue("@ordinal", NpgsqlDbType.Integer, i);
|
||||||
|
command.Parameters.Add("@xsiType", NpgsqlDbType.Integer);
|
||||||
|
command.Parameters.AddWithValue("@manifestId", NpgsqlDbType.Uuid, Guid.Parse(serviceComponentIdentifier.manifestIdRef));
|
||||||
|
command.Parameters.Add("@representation_id", NpgsqlDbType.Text);
|
||||||
|
command.Parameters.Add("@period_id", NpgsqlDbType.Text);
|
||||||
|
command.Parameters.Add("@adaption_set_id", NpgsqlDbType.Integer);
|
||||||
|
command.Parameters.Add("@media_playlist_locator", NpgsqlDbType.Text);
|
||||||
|
|
||||||
|
XmlAttribute xmlAttribute = serviceComponentIdentifier.AnyAttr[0];
|
||||||
|
string xsiType = xmlAttribute.Value;
|
||||||
|
switch (xsiType)
|
||||||
|
{
|
||||||
|
case "DASHComponentIdentifierType":
|
||||||
|
command.Parameters["@xsiType"].Value = 1;
|
||||||
|
DASHComponentIdentifierType dash = (DASHComponentIdentifierType)serviceComponentIdentifier;
|
||||||
|
command.Parameters["@representation_id"].Value = dash.representationIdentifier;
|
||||||
|
command.Parameters["@period_id"].Value = dash.periodIdentifier;
|
||||||
|
command.Parameters["@adaption_set_id"].Value = (int)dash.adaptationSetIdentifier;
|
||||||
|
break;
|
||||||
|
case "HLSComponentIdentifierType":
|
||||||
|
command.Parameters["@xsiType"].Value = 2;
|
||||||
|
HLSComponentIdentifierType hls = (HLSComponentIdentifierType)serviceComponentIdentifier;
|
||||||
|
command.Parameters["@media_playlist_locator"].Value = hls.mediaPlaylistLocator;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw new NotImplementedException(xsiType);
|
||||||
|
}
|
||||||
|
|
||||||
|
SetNulls(command);
|
||||||
|
int executeNonQuery = command.ExecuteNonQuery();
|
||||||
|
if (executeNonQuery != 1)
|
||||||
|
throw new DataException(String.Format("Expected to insert {0} rows, but it were {1}", 1, executeNonQuery));
|
||||||
|
command.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
private HashSet<DatabaseKeyNipMulticastGatewayConfigurationTransportSession> _knownNipMulticastGatewayConfigurationTransportSessions;
|
||||||
public bool DvbNipTestForMulticastGatewayConfigurationTransportSession(NipActualCarrierInformation carrier,
|
public bool DvbNipTestForMulticastGatewayConfigurationTransportSession(NipActualCarrierInformation carrier,
|
||||||
MulticastEndpointAddressType multicastEndpointAddressType)
|
MulticastEndpointAddressType multicastEndpointAddressType)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
if (_knownNipMulticastGatewayConfigurationTransportSessions == null)
|
||||||
|
_knownNipMulticastGatewayConfigurationTransportSessions = new HashSet<DatabaseKeyNipMulticastGatewayConfigurationTransportSession>();
|
||||||
|
|
||||||
|
DatabaseKeyNipMulticastGatewayConfigurationTransportSession key = new DatabaseKeyNipMulticastGatewayConfigurationTransportSession(carrier, multicastEndpointAddressType);
|
||||||
|
if (_knownNipMulticastGatewayConfigurationTransportSessions.Contains(key))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
bool result;
|
||||||
|
NpgsqlConnection connection = new NpgsqlConnection(connectionStringBuilder.ToString());
|
||||||
|
connection.Open();
|
||||||
|
NpgsqlCommand command = connection.CreateCommand();
|
||||||
|
command.CommandText =
|
||||||
|
"SELECT dateadded " +
|
||||||
|
"FROM dvbnip_multicast_gateway_configuration_transport_sessions " +
|
||||||
|
"WHERE network_id = @nid AND carrier_id = @cid AND link_id = @lid AND service_id = @sid " +
|
||||||
|
"AND source_address = @srcaddr AND destination_address = @dstaddr AND destination_port = @dstport AND tsi = @tsi";
|
||||||
|
command.Parameters.AddWithValue("@nid", NpgsqlDbType.Integer, (int)key.NetworkId);
|
||||||
|
command.Parameters.AddWithValue("@cid", NpgsqlDbType.Integer, (int)key.CarrierId);
|
||||||
|
command.Parameters.AddWithValue("@lid", NpgsqlDbType.Integer, (int)key.LinkId);
|
||||||
|
command.Parameters.AddWithValue("@sid", NpgsqlDbType.Integer, (int)key.ServiceId);
|
||||||
|
command.Parameters.AddWithValue("@srcaddr", NpgsqlDbType.Inet, key.SourceAddress);
|
||||||
|
command.Parameters.AddWithValue("@dstaddr", NpgsqlDbType.Inet, key.DestinationAddress);
|
||||||
|
command.Parameters.AddWithValue("@dstport", NpgsqlDbType.Integer, (int)key.DestinationPort);
|
||||||
|
command.Parameters.AddWithValue("@tsi", NpgsqlDbType.Integer, key.TSI);
|
||||||
|
SetNulls(command);
|
||||||
|
NpgsqlDataReader dataReader = command.ExecuteReader();
|
||||||
|
if (result = dataReader.Read())
|
||||||
|
{
|
||||||
|
_knownNipMulticastGatewayConfigurationTransportSessions.Add(key);
|
||||||
|
}
|
||||||
|
dataReader.Close();
|
||||||
|
command.Dispose();
|
||||||
|
connection.Close();
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DvbNipInsertMulticastGatewayConfigurationTransportSession(NipActualCarrierInformation carrier,
|
public void DvbNipInsertMulticastGatewayConfigurationTransportSession(NipActualCarrierInformation carrier,
|
||||||
MulticastGatewayConfigurationTransportSessionType multicastGatewayConfigurationTransportSession)
|
MulticastEndpointAddressType multicastGatewayConfigurationTransportSession)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
EnqueueTask(x => DvbNipInsertMulticastGatewayConfigurationTransportSessionEx(x, carrier, multicastGatewayConfigurationTransportSession));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DvbNipInsertMulticastGatewayConfigurationTransportSessionEx(NpgsqlConnection connection, NipActualCarrierInformation carrier, MulticastEndpointAddressType multicastEndpointAddressType)
|
||||||
|
{
|
||||||
|
DatabaseKeyNipMulticastGatewayConfigurationTransportSession key = new DatabaseKeyNipMulticastGatewayConfigurationTransportSession(carrier, multicastEndpointAddressType);
|
||||||
|
_knownNipMulticastGatewayConfigurationTransportSessions.Add(key);
|
||||||
|
NpgsqlCommand command = connection.CreateCommand();
|
||||||
|
command.CommandText = "INSERT INTO dvbnip_multicast_gateway_configuration_transport_sessions VALUES (@nid,@cid,@lid,@sid,@srcaddr,@dstaddr,@dstport,@tsi,DEFAULT)";
|
||||||
|
command.Parameters.AddWithValue("@nid", NpgsqlDbType.Integer, (int)key.NetworkId);
|
||||||
|
command.Parameters.AddWithValue("@cid", NpgsqlDbType.Integer, (int)key.CarrierId);
|
||||||
|
command.Parameters.AddWithValue("@lid", NpgsqlDbType.Integer, (int)key.LinkId);
|
||||||
|
command.Parameters.AddWithValue("@sid", NpgsqlDbType.Integer, (int)key.ServiceId);
|
||||||
|
command.Parameters.AddWithValue("@srcaddr", NpgsqlDbType.Inet, key.SourceAddress);
|
||||||
|
command.Parameters.AddWithValue("@dstaddr", NpgsqlDbType.Inet, key.DestinationAddress);
|
||||||
|
command.Parameters.AddWithValue("@dstport", NpgsqlDbType.Integer, (int)key.DestinationPort);
|
||||||
|
command.Parameters.AddWithValue("@tsi", NpgsqlDbType.Integer, key.TSI);
|
||||||
|
int executeNonQuery = command.ExecuteNonQuery();
|
||||||
|
if (executeNonQuery != 1)
|
||||||
|
throw new DataException(String.Format("Expected to insert {0} rows, but it were {1}", 1, executeNonQuery));
|
||||||
|
command.Dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2486,7 +2486,7 @@ namespace skyscraper5.Skyscraper.Scraper
|
|||||||
endpointAddress.NetworkDestinationGroupAddress, endpointAddress.TransportDestinationPort,
|
endpointAddress.NetworkDestinationGroupAddress, endpointAddress.TransportDestinationPort,
|
||||||
endpointAddress.MediaTransportSessionIdentifier);
|
endpointAddress.MediaTransportSessionIdentifier);
|
||||||
LogEvent(SkyscraperContextEvent.DvbNipMulticastGatewayConfigurationTransportSession, name);
|
LogEvent(SkyscraperContextEvent.DvbNipMulticastGatewayConfigurationTransportSession, name);
|
||||||
ScraperStorage.DvbNipInsertMulticastGatewayConfigurationTransportSession(carrier, multicastGatewayConfigurationTransportSession);
|
ScraperStorage.DvbNipInsertMulticastGatewayConfigurationTransportSession(carrier, endpointAddress);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1496,7 +1496,7 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.Filesystem
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void DvbNipInsertMulticastGatewayConfigurationTransportSession(NipActualCarrierInformation carrier,
|
public void DvbNipInsertMulticastGatewayConfigurationTransportSession(NipActualCarrierInformation carrier,
|
||||||
MulticastGatewayConfigurationTransportSessionType multicastGatewayConfigurationTransportSession)
|
MulticastEndpointAddressType multicastGatewayConfigurationTransportSession)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -193,7 +193,7 @@ namespace skyscraper5.Skyscraper.Scraper.Storage
|
|||||||
bool DvbNipTestForMulticastSession(MulticastSessionType multicastSession);
|
bool DvbNipTestForMulticastSession(MulticastSessionType multicastSession);
|
||||||
void DvbNipInsertMulticastSession(MulticastSessionType multicastSession);
|
void DvbNipInsertMulticastSession(MulticastSessionType multicastSession);
|
||||||
bool DvbNipTestForMulticastGatewayConfigurationTransportSession(NipActualCarrierInformation carrier, MulticastEndpointAddressType multicastEndpointAddressType);
|
bool DvbNipTestForMulticastGatewayConfigurationTransportSession(NipActualCarrierInformation carrier, MulticastEndpointAddressType multicastEndpointAddressType);
|
||||||
void DvbNipInsertMulticastGatewayConfigurationTransportSession(NipActualCarrierInformation carrier, MulticastGatewayConfigurationTransportSessionType multicastGatewayConfigurationTransportSession);
|
void DvbNipInsertMulticastGatewayConfigurationTransportSession(NipActualCarrierInformation carrier, MulticastEndpointAddressType multicastGatewayConfigurationTransportSession);
|
||||||
bool DvbNipTestForCarrier(NipActualCarrierInformation currentCarrierInformation);
|
bool DvbNipTestForCarrier(NipActualCarrierInformation currentCarrierInformation);
|
||||||
void DvbNipInsertCarrier(NipActualCarrierInformation currentCarrierInformation);
|
void DvbNipInsertCarrier(NipActualCarrierInformation currentCarrierInformation);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1538,7 +1538,7 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.InMemory
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Dictionary<DatabaseKeyNipMulticastGatewayConfigurationTransportSession,
|
private Dictionary<DatabaseKeyNipMulticastGatewayConfigurationTransportSession,
|
||||||
MulticastGatewayConfigurationTransportSessionType> _nipMulticastGatewayConfigurationTransportSessions;
|
MulticastEndpointAddressType> _nipMulticastGatewayConfigurationTransportSessions;
|
||||||
|
|
||||||
public bool DvbNipTestForMulticastGatewayConfigurationTransportSession(NipActualCarrierInformation carrier,
|
public bool DvbNipTestForMulticastGatewayConfigurationTransportSession(NipActualCarrierInformation carrier,
|
||||||
MulticastEndpointAddressType multicastEndpointAddressType)
|
MulticastEndpointAddressType multicastEndpointAddressType)
|
||||||
@ -1552,16 +1552,16 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.InMemory
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void DvbNipInsertMulticastGatewayConfigurationTransportSession(NipActualCarrierInformation carrier,
|
public void DvbNipInsertMulticastGatewayConfigurationTransportSession(NipActualCarrierInformation carrier,
|
||||||
MulticastGatewayConfigurationTransportSessionType multicastGatewayConfigurationTransportSession)
|
MulticastEndpointAddressType multicastGatewayConfigurationTransportSession)
|
||||||
{
|
{
|
||||||
if (_nipMulticastGatewayConfigurationTransportSessions == null)
|
if (_nipMulticastGatewayConfigurationTransportSessions == null)
|
||||||
_nipMulticastGatewayConfigurationTransportSessions =
|
_nipMulticastGatewayConfigurationTransportSessions =
|
||||||
new Dictionary<DatabaseKeyNipMulticastGatewayConfigurationTransportSession,
|
new Dictionary<DatabaseKeyNipMulticastGatewayConfigurationTransportSession,
|
||||||
MulticastGatewayConfigurationTransportSessionType>();
|
MulticastEndpointAddressType>();
|
||||||
|
|
||||||
DatabaseKeyNipMulticastGatewayConfigurationTransportSession key =
|
DatabaseKeyNipMulticastGatewayConfigurationTransportSession key =
|
||||||
new DatabaseKeyNipMulticastGatewayConfigurationTransportSession(carrier,
|
new DatabaseKeyNipMulticastGatewayConfigurationTransportSession(carrier,
|
||||||
multicastGatewayConfigurationTransportSession.EndpointAddress[0]);
|
multicastGatewayConfigurationTransportSession);
|
||||||
_nipMulticastGatewayConfigurationTransportSessions.Add(key, multicastGatewayConfigurationTransportSession);
|
_nipMulticastGatewayConfigurationTransportSessions.Add(key, multicastGatewayConfigurationTransportSession);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -191,7 +191,7 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.Split
|
|||||||
bool DvbNipTestForMulticastSession(MulticastSessionType multicastSession);
|
bool DvbNipTestForMulticastSession(MulticastSessionType multicastSession);
|
||||||
void DvbNipInsertMulticastSession(MulticastSessionType multicastSession);
|
void DvbNipInsertMulticastSession(MulticastSessionType multicastSession);
|
||||||
bool DvbNipTestForMulticastGatewayConfigurationTransportSession(NipActualCarrierInformation carrier, MulticastEndpointAddressType multicastEndpointAddressType);
|
bool DvbNipTestForMulticastGatewayConfigurationTransportSession(NipActualCarrierInformation carrier, MulticastEndpointAddressType multicastEndpointAddressType);
|
||||||
void DvbNipInsertMulticastGatewayConfigurationTransportSession(NipActualCarrierInformation carrier, MulticastGatewayConfigurationTransportSessionType multicastGatewayConfigurationTransportSession);
|
void DvbNipInsertMulticastGatewayConfigurationTransportSession(NipActualCarrierInformation carrier, MulticastEndpointAddressType multicastGatewayConfigurationTransportSession);
|
||||||
|
|
||||||
bool DvbNipTestForCarrier(NipActualCarrierInformation currentCarrierInformation);
|
bool DvbNipTestForCarrier(NipActualCarrierInformation currentCarrierInformation);
|
||||||
void DvbNipInsertCarrier(NipActualCarrierInformation currentCarrierInformation);
|
void DvbNipInsertCarrier(NipActualCarrierInformation currentCarrierInformation);
|
||||||
|
|||||||
@ -953,7 +953,7 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.Split
|
|||||||
}
|
}
|
||||||
|
|
||||||
[DebuggerStepThrough]
|
[DebuggerStepThrough]
|
||||||
public void DvbNipInsertMulticastGatewayConfigurationTransportSession(NipActualCarrierInformation carrier, MulticastGatewayConfigurationTransportSessionType multicastGatewayConfigurationTransportSession)
|
public void DvbNipInsertMulticastGatewayConfigurationTransportSession(NipActualCarrierInformation carrier, MulticastEndpointAddressType multicastGatewayConfigurationTransportSession)
|
||||||
{
|
{
|
||||||
dataStorage.DvbNipInsertMulticastGatewayConfigurationTransportSession(carrier, multicastGatewayConfigurationTransportSession);
|
dataStorage.DvbNipInsertMulticastGatewayConfigurationTransportSession(carrier, multicastGatewayConfigurationTransportSession);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user