- Copy cwmp-1-0..4.ts source classes from cwmp-connector (papaye) into app/protocol/ as local files (ts-nocheck, external dependency) - Add soap_envelope.ts: SoapEnvelope, SoapEnvelopeHeader, CwmpID, NAMESPACES - Add tr069_types.ts: re-exports all CWMP classes + CwmpMessage discriminated union + typed task payload interfaces (CWMPTaskType, CWMPTaskPayload, etc.) - Rewrite cwmp_message_builder.ts to use class-based builders instead of raw XML template strings; add transferCompleteResponse() and soapFault() - soap.ts: extractCwmpMessage returns CwmpMessage union, adds runtime allowlist guard against unknown CWMP method names from CPE - cwmp_middleware.ts: envelope typed SoapEnvelope|null, message CwmpMessage|null - cwmp_controller.ts: handleInform(informData: Inform), remove any, migrate TransferComplete and fault to new builder path, drop buildSoapEnvelope import - task_queue.ts: CWMPTask.type → CWMPTaskType literal union, payload → CWMPTaskPayload, result → CWMPTaskResultData - device_action_executor.ts: GPV/GPN/GPA responses typed, no more any - main_state_machine.ts: DeviceContext.message.data → CWMPTaskResultData, organizeParameters receives ParameterInfoStruct[] directly - device.ts: tmpParamValues typed ParameterValueStruct[], organizeParameters signature updated, updateFromValues typed - device_id.ts: fromInform typed with DeviceIdStruct - soap_envelope.ts: remove unconditional <cwmp:noMoreRequests> header (CPE→ACS only per TR-069 §3.7.1.4)
70 lines
2.2 KiB
TypeScript
70 lines
2.2 KiB
TypeScript
// @ts-nocheck — fichier copié de cwmp-connector (papaye)
|
|
import { Cwmp_1_3 } from './cwmp-1-3.js'
|
|
|
|
/**
|
|
* CWMP Version 1.4 Protocol Classes
|
|
*
|
|
* Extends CWMP 1.3 with:
|
|
* - New ACS Fault Code 8006 (handled at validation level, not needed here)
|
|
* - New Event Code: 13 WAKEUP
|
|
* - New SOAP Header elements: SupportedCWMPVersions, UseCWMPVersion
|
|
*/
|
|
export class Cwmp_1_4 extends Cwmp_1_3 {
|
|
public '@class' = '.Cwmp_1_4'
|
|
public SupportedCWMPVersions?: SupportedCWMPVersions
|
|
public UseCWMPVersion?: UseCWMPVersion
|
|
|
|
constructor(props: any = {}) {
|
|
super(props)
|
|
this.SupportedCWMPVersions = props.SupportedCWMPVersions ? new SupportedCWMPVersions(props.SupportedCWMPVersions) : undefined
|
|
this.UseCWMPVersion = props.UseCWMPVersion ? new UseCWMPVersion(props.UseCWMPVersion) : undefined
|
|
}
|
|
}
|
|
|
|
export enum EventCode_1_4 {
|
|
BOOTSTRAP = '0 BOOTSTRAP',
|
|
BOOT = '1 BOOT',
|
|
PERIODIC = '2 PERIODIC',
|
|
SCHEDULED = '3 SCHEDULED',
|
|
VALUE_CHANGE = '4 VALUE CHANGE',
|
|
KICKED = '5 KICKED',
|
|
CONNECTION_REQUEST = '6 CONNECTION REQUEST',
|
|
TRANSFER_COMPLETE = '7 TRANSFER COMPLETE',
|
|
DIAGNOSTICS_COMPLETE = '8 DIAGNOSTICS COMPLETE',
|
|
REQUEST_DOWNLOAD = '9 REQUEST DOWNLOAD',
|
|
AUTONOMOUS_TRANSFER_COMPLETE = '10 AUTONOMOUS TRANSFER COMPLETE',
|
|
DU_STATE_CHANGE_COMPLETE = '11 DU STATE CHANGE COMPLETE',
|
|
AUTONOMOUS_DU_STATE_CHANGE_COMPLETE = '12 AUTONOMOUS DU STATE CHANGE COMPLETE',
|
|
WAKEUP = '13 WAKEUP',
|
|
REBOOT = 'M Reboot',
|
|
SCHEDULE_INFORM = 'M ScheduleInform',
|
|
DOWNLOAD = 'M Download',
|
|
SCHEDULE_DOWNLOAD = 'M ScheduleDownload',
|
|
UPLOAD = 'M Upload',
|
|
CHANGE_DU_STATE = 'M ChangeDUState',
|
|
X_METHOD = 'M X_',
|
|
X_PATTERN = 'X [0-9A-F]{6} .*',
|
|
}
|
|
|
|
export class SupportedCWMPVersions {
|
|
public '@class' = '.SupportedCWMPVersions'
|
|
public MustUnderstand?: string // should be 0 per spec, optional due to SOAP 1.1 quirks
|
|
public _: string // space or comma separated list per implementation
|
|
|
|
constructor(props: any = {}) {
|
|
this.MustUnderstand = props.MustUnderstand ?? '0'
|
|
this._ = props._ || ''
|
|
}
|
|
}
|
|
|
|
export class UseCWMPVersion {
|
|
public '@class' = '.UseCWMPVersion'
|
|
public MustUnderstand: string = '1'
|
|
public _: string
|
|
|
|
constructor(props: any = {}) {
|
|
this.MustUnderstand = props.MustUnderstand ?? '1'
|
|
this._ = props._ || ''
|
|
}
|
|
}
|