Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 6 additions & 12 deletions checkST2110.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const mediaclkTypePattern = /[\r\n]a=mediaclk[^\s=]+/g;
const mediaclkDirectPattern = /[\r\n]a=mediaclk:direct=\d+\s+/g;
const sourceFilterPattern = /a=source-filter:\s(incl|excl)/;
const tsrefclkPattern = /[\r\n]a=ts-refclk/;
const ptpPattern = /traceable|((([0-9a-fA-F]{2}-){7}[0-9a-fA-F]{2})(:(\d+|domain-name=\S+))?)/;
const ptpPattern = /traceable|((([0-9A-F]{2}-){7}[0-9A-F]{2})(:(\d+))?)$/;
const macPattern = /(([0-9a-fA-F]{2}-){5}[0-9a-fA-F]{2})/;
const dupPattern = /[\r\n]m=[\s\S]+a=ssrc-group:DUP|[\r\n]a=group:DUP[\s\S]+m=/;
const ssrcGroupPattern = /a=ssrc-group:DUP\s+(\d+)\s+(\d+)/;
Expand Down Expand Up @@ -180,24 +180,18 @@ const test_10_82_3 = sdp => {
continue; // no longer acceptable form
}
if (!ptpDetails.startsWith('IEEE1588-2008:')) {
errors.push(new Error(`Line ${x + 1}: The only supported PTP versions are 'IEEE1588-2008' and 'traceable', as per SMPTE ST 2110-10 Section 8.2.`));
errors.push(new Error(`Line ${x + 1}: The only supported PTP version is 'IEEE1588-2008', as per SMPTE ST 2110-10 Section 8.2.`));
continue;
}
if (!ptpPattern.test(ptpDetails.slice(14))) {
errors.push(new Error(`Line ${x + 1}: RFC 7273 PTP reference clock attribute parameters for 'ptp-server' do not match acceptable patterns.`));
continue;
}
let ptpMatch = ptpDetails.slice(14).match(ptpPattern);
if (!ptpMatch[4] && ptpDetails.endsWith(':')) {
errors.push(new Error(`Line ${x + 1}: Where no PTP domain is specified, 'ptp-version' cannot end with a ':', as per RFC 7273 Section 4.8.`));
continue;
}
if (ptpMatch[4]) {
if (!ptpMatch[4].startsWith('domain-name=')) {
let domainNmbr = +ptpMatch[4];
if (domainNmbr < 0 || domainNmbr > 127) {
errors.push(new Error(`Line ${x + 1}: PTP domain number must be a value between 0 and 127 inclusive, as per RFC 7273 Section 4.8.`));
}
if (ptpMatch[5]) {
let domainNmbr = +ptpMatch[5];
if (domainNmbr < 0 || domainNmbr > 127) {
errors.push(new Error(`Line ${x + 1}: PTP domain number must be a value between 0 and 127 inclusive, as per RFC 7273 Section 4.8.`));
}
}
}
Expand Down