Version | Date | Description |
---|---|---|
V1.0.00 | 2008/04/02 |
|
V1.0.01 | 2008/07/14 |
|
V1.0.02 | 2008/07/18 |
|
V1.0.03 | 2008/09/17 |
|
V1.0.04 | 2011/09/28 |
|
All IP cameras, video encoders and video decoders were configured by remote controller (NVR) through network generally. Because these devices don't have any interface, like local display, to show and configure their settings, they become very difficult to be managed if users do not know the network addresses of them. The device search mechanism provides an mechanism to solve this issue. Users could use that to discover all devices in the network (Intranet) and configure them easily.
The following figure illustrate how the device search protocol could discover the devices.
There are two functions in the Device Search Mechanism.
The device responses the device search request sent by remote controller with its basic configurations. The remote controller collects all responses in a certain period after it sent the device search request. Based on the reply in the device search response packets, the remote controller could know what devices are on the network and their configurations.
To allow all devices could receive the device search request packets, the device search request packet is using the local broadcasting address (255.255.255.255). Therefore, this request packet could not pass the router, gateway and some firewall devices. The Device Search Mechanism is limited to be used in the Intranet environment.
To allow the remote controller could received all response packets from different devices, the device search response packet is using local broadcasting address again.
All packets used in this mechanism are UDP packets. And the default UDP port for Device Search Request is 6005 (Search Port 1). The Device Search Response packets will be sent to the UDP port 6005 (Search Port 1) and 6006 (Search Port 2) by default.
Format of the Device Search Request Packet
typedef struct {
char Head[8];
} DevSearchReq;
The value in Head[8] is "80503736"
Format of the Device Search Response Packets
There are two types of device search response packets. Each packet carried different information to the different destination UDP ports.
The common part of the these two response packers are listed below.
/* ##### definitions of MsgType in DevSearchRespHeader data structure ##### */ #define MSG_TYPE_SEARCH_RESP 0 typedef struct { unsigned char Head[4]; // fixed to "ACTi" unsigned int MsgType; unsigned int Length; // the length of the information after this header (in bytes) } DevSearchRespHeader; typedef struct { unsigned char HostName[24];
unsigned char ProductID[8];
unsigned char WanIP[16];
unsigned char LanIP[16];
unsigned char MulticastIP[16];
unsigned char MAC[32];
unsigned char DevType; // not used. forces to 0
unsigned char SearchVersion; // 0: version 0.0 for TCP1.0, 1: version 1.1 for TCP2.0
unsigned char Channel; // Channel ID started from 1
unsigned char Rsvd[1];
unsigned char FirmwareVersion[32];
unsigned short PortHttp;
unsigned short PortSerach1;
unsigned short PortSearch2;
unsigned short PortRegister;
unsigned short PortControl;
unsigned short PortStream;
unsigned short PortMcast;
unsigned short Pad;
} DevSearchBasicInfo; typedef struct { unsigned char ModelName[16]; // device model in text string
unsigned char SerialNum[24]; // serial number in text string
unsigned char SystemType; // 'E': Embedded System, 'P': PC System
unsigned char DevType; // 'A' : Video Encoder or IP Camera, 'B': Video Decoder
unsigned char ChannelID; // Channel ID started from 1
unsigned char Multiplexing; // 'X': None, 'Q': QUAD Encoder, 'R': Rack Mount, 'B': Blade Server
unsigned char AudioWays; // '0': No Audio, '1': One-Way Audio, '2': Two-Way Audio
unsigned char AudioType; // '0': PCM, '1': ADPCM
unsigned char MotionType; // '0': Encoder, '1':QUAD
unsigned char ProtocolType; // '0': TCP 1.0, '1': TCP 2.0
unsigned char EncoderType; // Current stream 1 encoder type. 1: MPEG4, 2: MJPEG, 3: H.264
unsigned char AnalogVideo; // 'N': NTSC, 'P': PAL
unsigned char Resolution; // Resolution Index
unsigned char BitRate; // Video Bitrate Index
unsigned char FPSMode; // 'C': FPS MODE 1 (Constant FPS), 'V': FPS MODE 2 (Variable FPS)
unsigned char FPS Number; // Frame Rate of FPS MODE 1 or MODE 2 depends on FPSMode
unsigned char CompanyName[10]; // Company Name
unsigned char ModelDescription[24]; // short description of the device
unsigned char Rsvd[4];} DevSearchAdvanceInfo; Resolution Index Table
Video Resolution Video Resolution Index N1920x1080 0x45 N1600x1200 0x44 N1280x1024 0x43 N1280x960 0x42 N1280x720 0x41 N640x480 0x40 N720x480 0x00 N352x240 0x01 N160x112 0x02 N176x120 0x06 N320x240 0x46 N160x120 0x47 P720x576 0x03 P640x480 0xc0 P352x288 0x04 P320x240 0xC6 P176x144 0x05 P160x120 0xC7 Video Bit Rate Index Table
Video Bit Rate Video Bit Rate Index 28 Kbps 0x0 56 Kbps 0x1 128 Kbps 0x2 256 Kbps 0x3 384 Kbps 0x4 500 Kbps 0x5 750 Kbps 0x6 1 Mbps 0x7 1.2 Mbps 0x8 1.5 Mbps 0x9 2 Mbps 0xA 2.5 Mbps 0xB 3 Mbps 0xC 3.5 Mbps 0xD 4 Mbps 0xE 4.5 Mbps 0xF 5 Mbps 0x10 5.5 Mbps 0x11 6 Mbps 0x12 Format of the Device Search Response 1 Packet
typedef struct { DevSearchRespHeader Head;
DevSearchBasicInfo BasicInfo;} DevSearchResp1Pkt; The Length in Head.Length is sizeof(DevSearchBasicInfo) in DevSearchResp1Pkt. This packet will be sent to Control Center through the Search Port 2.
Format of the Device Search Response 2 Packet
typedef struct { DevSearchRespHeader Head;
DevSearchBasicInfo BasicInfo;
DevSearchAdvanceInfo AdvInfo;} DevSearchResp2Pkt; The Length in Head.Length is sizeof(DevSearchBasicInfo) + sizeof(DevSearchAdvanceInfo) in DevSearchResp2Pkt.
This packet will be sent to Control Center through the Search Port 1.
Signal Flow
In general, the IP address in the device might not be in the same subnet of the Control Center. The Control Center could not access the device in this case. It becomes not convenient to install the devices. This function provides the Control Center to change the device networking settings.
After the device search mechanism, the Control Center knows what devices were attached to its network. All device's configurations were collected as well. The Control Center could send the DevIPChgReqPkt packet with the local broadcasting address (255.255.255.255) as the destination IP address on the UDP Search Port 1. Again, the mechanism is limited to be used in the Intranet environment.
The DevIPChgReqPkt could carry lots of device's DevIPChgPattern to change the specific devices' networking configurations. The DevIPChgPattern are listed below.
unsigned char MAC[32]; // MAC address of device. The format is xx:xx:xx:xx:xx:xx where x is 0~9 and A~F.
unsigned char Name[32]; //Root account name
unsigned char Challenge[64]; // base64(Name:Password)} DevID;
int WanType; // 1: Dynamic, 2: Static, 3: PPPoE
unsigned char WanIP[16]; //WAN Port IP address.
unsigned char WanMask[16]; //WAN Port IP Netmask
unsigned char WanGW[16]; //WAN Port Gateway IP address
unsigned char LanIP[16]; //LAN Port IP. It will be NULL if the device has no LAN port
unsigned char LanMask[16]; //LAN Port IP Netmask. It will be NULL if the device has no LAN port} DevNetConfig;
DevID ID;
DevNetConfig NetConfig;} DevIPChgPattern;
As the devices received the DevIPChgReqPkt, the MAC and root account in every DevIPChgPattern will be checked. If the MAC and root account matched, the networking configuration in the matched DevIPChgPattern will be applied to its networking configurations. After the status was replied, the device will reboot by itself and the new networking settings will be activated then.
Device IP Change Request Packet
/* ##### definitions of MsgType in DevSearchRespHeader data structure ##### */
#define MSG_TYPE_IP_CHG_REQ 1DevSearchRespHeader Head;
unsigned char Payload[1]; // Cascade devices' DevIPChgPattern, but the entire packet should not be fragmented by MTU limitation} DevIPChgReqPkt;
The DevIPChgReqPkt packet allows the Control Center to set up several devices' networking configurations at the same time.
Here is the illustration of DevIPChgReqPkt packet.
Note if there are too many DevIPChgPattern to accommodate to a single UDP packet, the DevIPChgReqPkt has to be divided into several DevIPChgReqPkt packets which have their own DevSearchRespHeader headers.
Device IP Change Status Packet
The device will check all DevIPChgPattern in received DevIPChgReqPkt packets. If the device's MAC address matched the MAC address in DevIPChgPattern, the device will check the account. If the account is correct, the networking setting in DevIPChgPattern will be applied to its networking configurations. Then, reboot itself. The status will be returned with different return code in the DevIPChgRespPkt packet.
The DevIPChgRespPkt packet is a local boradcast packet and carried by UDP session on Search Port 1. The Name and Challenge in Pattern are NULL in the packet.
/* ##### definitions of MsgType in DevSearchRespHeader data structure ##### */
#define MSG_TYPE_IP_CHG_RESP 2
/* ##### definitions of Status in DevIPChgRespPkt data structure ##### */
#define DEV_IP_CHG_OK 0
#define DEV_IP_CHG_ERR 1DevSearchRespHeader Head;
DevIPChgPattern Pattern;
int Status;} DevIPChgRespPkt;
Signal Flow