Skip to content

Commit

Permalink
Enable generation of SIPSorcery.xml documentation file (#1106)
Browse files Browse the repository at this point in the history
* Enabled GenerateDocumentationFile in SIPSorcery.csproj
* Disabled "missing XML comment" warnings
* Fixed most malformed XML comments (warnings about these are not disabled)
  • Loading branch information
exyi committed Apr 24, 2024
1 parent 453b9e2 commit 10effcb
Show file tree
Hide file tree
Showing 35 changed files with 234 additions and 244 deletions.
3 changes: 3 additions & 0 deletions src/SIPSorcery.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
<TargetFrameworks>netstandard2.0;netstandard2.1;netcoreapp3.1;net461;net5.0;net6.0;net8.0</TargetFrameworks>
<SuppressTfmSupportBuildWarnings>true</SuppressTfmSupportBuildWarnings>
<NoWarn>$(NoWarn);SYSLIB0050</NoWarn>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<!-- Disable warning for missing XML doc comments. -->
<NoWarn>$(NoWarn);CS1591;CS1573;CS1587</NoWarn>
<Authors>Aaron Clauson, Christophe Irles, Rafael Soares &amp; Contributors</Authors>
<Copyright>Copyright © 2010-2024 Aaron Clauson</Copyright>
<PackageLicenseExpression>BSD-3-Clause</PackageLicenseExpression>
Expand Down
3 changes: 1 addition & 2 deletions src/app/Media/Codecs/AudioEncoder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,8 @@ public byte[] EncodeAudio(short[] pcm, AudioFormat format)
/// <summary>
/// Event handler for receiving RTP packets from the remote party.
/// </summary>
/// <param name="remoteEP">The remote end point the RTP was received from.</param>
/// <param name="encodedSample">Data received from an RTP socket.</param>
/// <param name="format">The audio format of the encoded packets.</param>
/// <param name="rtpPacket">The RTP packet with the media sample.</param>
public short[] DecodeAudio(byte[] encodedSample, AudioFormat format)
{
if (format.Codec == AudioCodecsEnum.G722)
Expand Down
6 changes: 3 additions & 3 deletions src/app/Media/Codecs/G729Codec/CodLd8k.cs
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ COPYRIGHT NOTICE
/**
* Initialization of variables for the encoder.
* Initialize pointers to speech vector.
*<pre>
*<pre> <![CDATA[
* |--------------------|-------------|-------------|------------|
* previous speech sf1 sf2 L_NEXT
*
Expand All @@ -166,7 +166,7 @@ COPYRIGHT NOTICE
* p_wind | |
* speech |
* new_speech
* </pre>
* ]]></pre>
*/

public void init_coder_ld8k()
Expand Down Expand Up @@ -543,4 +543,4 @@ int[] ana
Util.copy(old_exc, L_FRAME, old_exc, PIT_MAX + L_INTERPOL);
}
}
}
}
4 changes: 2 additions & 2 deletions src/app/Media/Codecs/G729Codec/CorFunc.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ COPYRIGHT NOTICE
* @param xn input : target vector x[0:l_subfr]
* @param y1 input : filtered adaptive codebook vector
* @param y2 input : filtered 1st codebook innovation
* @param g_coeff output: <y2,y2> , -2<xn,y2> , and 2<y1,y2>
* @param g_coeff <![CDATA[ output: <y2,y2> , -2<xn,y2> , and 2<y1,y2> ]]>
*/

public static void corr_xy2(
Expand Down Expand Up @@ -115,4 +115,4 @@ float[] d
}
}
}
}
}
6 changes: 3 additions & 3 deletions src/app/Media/Codecs/G729Codec/Gainpred.cs
Original file line number Diff line number Diff line change
Expand Up @@ -118,13 +118,13 @@ float g_code

/**
* Update table of past quantized energies (frame erasure).
* <pre>
* <pre> <![CDATA[
* av_pred_en = 0.0;
* for (i = 0; i < 4; i++)
* av_pred_en += past_qua_en[i];
* av_pred_en = av_pred_en*0.25 - 4.0;
* if (av_pred_en < -14.0) av_pred_en = -14.0;
* </pre>
* ]]></pre>
*
* @param past_qua_en input/output:Past quantized energies
*/
Expand All @@ -147,4 +147,4 @@ float[] past_qua_en
past_qua_en[0] = av_pred_en;
}
}
}
}
6 changes: 3 additions & 3 deletions src/app/Media/Codecs/G729Codec/Ld8k.cs
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,12 @@ public class Ld8k
public static float GAMMA2_PST = 0.55f;

/**
* tilt weighting factor when k1<0
* tilt weighting factor when k1 &lt; 0
*/
public static float GAMMA3_MINUS = 0.9f;

/**
* tilt weighting factor when k1>0
* tilt weighting factor when k1 &gt; 0
*/
public static float GAMMA3_PLUS = 0.2f;

Expand Down Expand Up @@ -479,4 +479,4 @@ COPYRIGHT NOTICE
* resolution of fractional delays
*/
}
}
}
5 changes: 3 additions & 2 deletions src/app/Media/Codecs/G729Codec/Pitch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -351,14 +351,15 @@ int corr_norm_offset
}
}

/**
/** <![CDATA[
* Compute adaptive codebook gain and compute <y1,y1> , -2<xn,y1>
*
* @param xn input : target vector
* @param y1 input : filtered adaptive codebook vector
* @param g_coeff output: <y1,y1> and -2<xn,y1>
* @param l_subfr input : vector dimension
* @return pitch gain
* ]]>
*/

public static float g_pitch(
Expand Down Expand Up @@ -528,4 +529,4 @@ float x
return 1.0f / (float)Math.Sqrt(x);
}
}
}
}
4 changes: 2 additions & 2 deletions src/app/Media/Codecs/G729Codec/Postfil.cs
Original file line number Diff line number Diff line change
Expand Up @@ -635,7 +635,7 @@ float gain_plt

/**
* Compute delayed signal,
* num & den of gain for fractional delay
* num &amp; den of gain for fractional delay
* with long interpolation filter
*
* @param s_in input signal with past
Expand Down Expand Up @@ -906,4 +906,4 @@ float gain_prec
return gain_prec;
}
}
}
}
4 changes: 2 additions & 2 deletions src/app/Media/IMediaSession.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public interface IMediaSession
/// if they are.
/// </summary>
/// <param name="sdpType">Whether the SDP being set is an offer or answer.</param>
/// <param name="sdp">The SDP description from the remote party.</param>
/// <param name="sessionDescription">The SDP description from the remote party.</param>
/// <returns>If successful an OK enum result. If not an enum result indicating the
/// failure cause.</returns>
SetDescriptionResultEnum SetRemoteDescription(SdpType sdpType, SDP sessionDescription);
Expand Down Expand Up @@ -150,4 +150,4 @@ public interface IMediaSession
/// <param name="reason">Optional. A descriptive reason for closing the session.</param>
void Close(string reason);
}
}
}
2 changes: 1 addition & 1 deletion src/app/Media/Sources/AudioSignalGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public SignalGenerator()
/// Initializes a new instance for the Generator (UserDef SampleRate &amp; Channels)
/// </summary>
/// <param name="sampleRate">Desired sample rate</param>
/// <param name="channel">Number of channels</param>
/// <param name="channels">Number of channels</param>
public SignalGenerator(int sampleRate, int channels)
{
phi = 0;
Expand Down
2 changes: 1 addition & 1 deletion src/app/SIPUserAgents/SIPCallDescriptor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ public SIPFromHeader GetFromHeader()
/// </summary>
/// <param name="fromDisplayName"></param>
/// <param name="fromUsername"></param>
/// <param name="fromhost"></param>
/// <param name="fromHost"></param>
public void SetGeneralFromHeaderFields(string fromDisplayName, string fromUsername, string fromHost)
{
if (!fromDisplayName.IsNullOrBlank() && FromDisplayName == null)
Expand Down
4 changes: 2 additions & 2 deletions src/app/SIPUserAgents/SIPUserAgent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ public SIPUserAgent(SIPTransport transport, SIPEndPoint outboundProxy, bool isTr

/// <summary>
/// Attempts to place a new outgoing call AND waits for the call to be answered or fail.
/// Use <see cref="InitiateCallAsync(SIPCallDescriptor, IMediaSession)"/> to start a call without
/// Use <see cref="InitiateCallAsync(SIPCallDescriptor, IMediaSession, int)"/> to start a call without
/// waiting for it to complete and monitor <see cref="ClientCallAnsweredHandler"/> and
/// <see cref="ClientCallFailedHandler"/> to detect an answer or failure.
/// </summary>
Expand Down Expand Up @@ -464,7 +464,7 @@ public Task<bool> Call(string dst, string username, string password, IMediaSessi

/// <summary>
/// Attempts to place a new outgoing call AND waits for the call to be answered or fail.
/// Use <see cref="InitiateCallAsync(SIPCallDescriptor, IMediaSession)"/> to start a call without
/// Use <see cref="InitiateCallAsync(SIPCallDescriptor, IMediaSession, int)"/> to start a call without
/// waiting for it to complete and monitor <see cref="ClientCallAnsweredHandler"/> and
/// <see cref="ClientCallFailedHandler"/> to detect an answer or failure.
/// </summary>
Expand Down
150 changes: 75 additions & 75 deletions src/net/DtlsSrtp/Transform/SrtcpTransformer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,58 +15,58 @@
// License:
// BSD 3-Clause "New" or "Revised" License, see included LICENSE.md file.
// Original Source: AGPL-3.0 License
//-----------------------------------------------------------------------------

//-----------------------------------------------------------------------------

using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Collections.Generic;
using System.Threading;

namespace SIPSorcery.Net
namespace SIPSorcery.Net
{
/// <summary>
/// SRTCPTransformer implements PacketTransformer.
/// It encapsulate the encryption / decryption logic for SRTCP packets
///
/// @author Bing SU (nova.su @gmail.com)
/// @author Werner Dittmann<Werner.Dittmann@t-online.de>
/// </summary>
public class SrtcpTransformer : IPacketTransformer
{
private int _isLocked = 0;
private RawPacket packet;

private SrtpTransformEngine forwardEngine;
private SrtpTransformEngine reverseEngine;

/** All the known SSRC's corresponding SRTCPCryptoContexts */
private ConcurrentDictionary<long, SrtcpCryptoContext> contexts;

public SrtcpTransformer(SrtpTransformEngine engine) : this(engine, engine)
{

}

public SrtcpTransformer(SrtpTransformEngine forwardEngine, SrtpTransformEngine reverseEngine)
{
this.packet = new RawPacket();
this.forwardEngine = forwardEngine;
this.reverseEngine = reverseEngine;
this.contexts = new ConcurrentDictionary<long, SrtcpCryptoContext>();
}

/// <summary>
/// Encrypts a SRTCP packet
/// SRTCPTransformer implements PacketTransformer.
/// It encapsulate the encryption / decryption logic for SRTCP packets
///
/// @author Bing SU (nova.su @gmail.com)
/// @author Werner Dittmann (Werner.Dittmann@t-online.de)
/// </summary>
public class SrtcpTransformer : IPacketTransformer
{
private int _isLocked = 0;
private RawPacket packet;

private SrtpTransformEngine forwardEngine;
private SrtpTransformEngine reverseEngine;

/** All the known SSRC's corresponding SRTCPCryptoContexts */
private ConcurrentDictionary<long, SrtcpCryptoContext> contexts;

public SrtcpTransformer(SrtpTransformEngine engine) : this(engine, engine)
{

}

public SrtcpTransformer(SrtpTransformEngine forwardEngine, SrtpTransformEngine reverseEngine)
{
this.packet = new RawPacket();
this.forwardEngine = forwardEngine;
this.reverseEngine = reverseEngine;
this.contexts = new ConcurrentDictionary<long, SrtcpCryptoContext>();
}

/// <summary>
/// Encrypts a SRTCP packet
/// </summary>
/// <param name="pkt">plain SRTCP packet to be encrypted.</param>
/// <returns>encrypted SRTCP packet.</returns>
public byte[] Transform(byte[] pkt)
{
return Transform(pkt, 0, pkt.Length);
}

public byte[] Transform(byte[] pkt, int offset, int length)
{
var isLocked = Interlocked.CompareExchange(ref _isLocked, 1, 0) != 0;
public byte[] Transform(byte[] pkt)
{
return Transform(pkt, 0, pkt.Length);
}

public byte[] Transform(byte[] pkt, int offset, int length)
{
var isLocked = Interlocked.CompareExchange(ref _isLocked, 1, 0) != 0;
try
{
// Wrap the data into raw packet for readable format
Expand All @@ -90,23 +90,23 @@ public byte[] Transform(byte[] pkt, int offset, int length)
byte[] result = packet.GetData();

return result;
}
finally
}
finally
{
//Unlock
if (!isLocked)
Interlocked.CompareExchange(ref _isLocked, 0, 1);
}
}

public byte[] ReverseTransform(byte[] pkt)
{
return ReverseTransform(pkt, 0, pkt.Length);
}

public byte[] ReverseTransform(byte[] pkt, int offset, int length)
{
var isLocked = Interlocked.CompareExchange(ref _isLocked, 1, 0) != 0;
}
}

public byte[] ReverseTransform(byte[] pkt)
{
return ReverseTransform(pkt, 0, pkt.Length);
}

public byte[] ReverseTransform(byte[] pkt, int offset, int length)
{
var isLocked = Interlocked.CompareExchange(ref _isLocked, 1, 0) != 0;
try
{
// wrap data into raw packet for readable format
Expand All @@ -133,36 +133,36 @@ public byte[] ReverseTransform(byte[] pkt, int offset, int length)
result = packet.GetData();
}
return result;
}
finally
}
finally
{
//Unlock
if (!isLocked)
Interlocked.CompareExchange(ref _isLocked, 0, 1);
}
}

}
}

/// <summary>
/// Close the transformer and underlying transform engine.
/// The close functions closes all stored crypto contexts. This deletes key data
/// and forces a cleanup of the crypto contexts.
/// </summary>
public void Close()
{
forwardEngine.Close();
/// </summary>
public void Close()
{
forwardEngine.Close();
if (forwardEngine != reverseEngine)
{
reverseEngine.Close();
}

var keys = new List<long>(contexts.Keys);
foreach (var ssrc in keys)
}

var keys = new List<long>(contexts.Keys);
foreach (var ssrc in keys)
{
if (contexts.TryRemove(ssrc, out var context))
{
context.Close();
}
}
}
}
}
}
}
}
}
}

0 comments on commit 10effcb

Please sign in to comment.