Disclosure of Invention
In order to overcome the problems in the related art, the present specification provides a camera identification method and apparatus.
According to a first aspect of embodiments of the present specification, there is provided a camera identification method applied to a network device, the method including:
when an interface UP event of network equipment is received, acquiring address information of a terminal inserted into the network equipment, wherein the address information is carried in the UP event;
sending a universal protocol message used for communicating with the camera to the inserted terminal according to the address information;
if the response information of the terminal is received, judging that the terminal is a camera;
and reporting the information of the terminal as a camera to a management server.
Optionally, the general protocol packet used for communicating with the camera is a packet of an open network video interface ONVIF protocol.
Optionally, the down event of the interface is reported to the management server when the down event of the interface is received.
Optionally, the method further includes: and after the terminal is judged to be a camera, recording that the terminal accessed by the interface is the camera, and reporting the down event of the terminal to the management server after receiving the down event of the interface.
Optionally, if the response message of the terminal is not received within the preset time, the UP event of the interface is ignored.
According to a second aspect of embodiments herein, there is provided an identification apparatus of a camera, the apparatus including: the device comprises an interface module, a log module and a scanning module;
the interface module is used for receiving an interface UP event of the network equipment and acquiring address information of a terminal inserted into the network equipment, wherein the address information is carried in the UP event;
the interface module sends the UP event to a log module, and the log module is used for recording the UP event and the address information of the terminal;
the log module is used for informing the scanning module of the UP event of the interface so that the scanning module sends a universal protocol message used for communicating with the camera to the inserted terminal according to the address information;
if the interface module receives the response information of the terminal, judging that the terminal is a camera;
and the scanning module reports the information of the terminal as a camera to a management server.
Optionally, the general protocol packet used for the communication between the scanning module and the camera is a packet of an open network video interface ONVIF protocol.
Optionally, after receiving the down event of the interface, the interface module notifies the log module, and the log module notifies the scan module of the down event of the interface, so that the scan module reports the down event of the interface to the management server.
Optionally, the log module is further configured to record that the terminal accessed by the interface is a camera after the scanning module determines that the terminal is the camera, and then after the log module receives a down event of the interface, the scanning module reports the down event of the terminal to the management server.
Optionally, if the interface module does not receive the response message of the terminal within the preset time, the interface UP event is ignored.
The technical scheme provided by the embodiment of the specification can have the following beneficial effects: the camera identification method provided in this embodiment does not adopt a manual scanning mode of an administrator any more, and can sense the camera in time when the camera is accessed and report the camera to the management server, so that the subsequent management server can manage the camera of the dumb terminal type conveniently.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the specification.
Detailed Description
Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, like numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present specification. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the specification, as detailed in the appended claims.
The scanners in the related art are all actively scanned by an administrator or set a periodic scanning interval to scan the accessed terminal devices, and the IP address range of the scanning needs to be configured.
But this implementation cannot timely detect the change in the state of the camera.
The utility model provides a camera identification method, this method can in time discern the terminal station of camera type, therefore can in time report the pile body of this camera to the management server, after discerning this camera, when receiving the down incident of the interface that this terminal inserts, report the off-line incident of this camera to the management server, thus can make the management server in time perceive the online and off-line information of this dumb terminal type of camera.
Specifically, fig. 1 is a schematic flowchart of a camera identification method provided in an embodiment of the present disclosure, fig. 2 is a schematic diagram of a network architecture to which the method of the present disclosure can be applied, and fig. 2 includes a management server, a network device, and a terminal accessing the network device. The management server is used for managing various devices accessed to the network, and the network devices can be switches or routers and the like and are used for forwarding messages in the network; the terminal in the access network device can be any terminal type such as a camera, a server and the like.
The method provided by this embodiment may be applied to a network device, as shown in fig. 1 and fig. 2, and the method includes:
step 101, when receiving an interface UP event of a network device, acquiring address information of a terminal inserted into the network device carried in the UP event.
When the network device is started, if a physical interface of the network device is inserted into the terminal device, if other devices access the terminal device, network traffic is generated, and therefore address information and the like of the terminal device can be acquired.
Generally, after the physical port UP, the log module generates a log of the interface UP, and the log may record the IP address and/or MAC address of the network device accessed by the interface in the UP state.
And 102, sending a general protocol message used for communicating with the camera to the inserted terminal according to the address information.
And sending a universal protocol message used for communicating with the camera to the terminal according to the IP address of the terminal. In an alternative embodiment, a general standard protocol such as open Network Video Interface (onvif) may be selected, where the protocol is originally named from an open Network Video Interface forum, and is later popularized and used by multiple manufacturers, and gradually becomes a more general protocol in the field of cameras.
Of course, the generic protocol packet in this embodiment may also be a T28181 protocol implemented by the national standard.
Generally, a relatively common protocol is selected instead of a proprietary protocol, which may result in the cameras of other vendors not being recognized.
And 103, if the response information of the terminal is received, judging that the terminal is a camera.
And if the network equipment receives the response information of the terminal within the preset time, the terminal is a camera. This is recognized for the cameras in the network.
And if the response information of the terminal is not received within the preset time, ignoring the interface UP event.
Andstep 104, reporting the information that the terminal is a camera to a management server.
After the camera is identified, the network equipment reports the information of the camera to the management server.
Specifically, the address information of the camera and the current operating state, for example, the UP state, may be reported to the management server, so that the management server can manage the camera conveniently. For example, according to a corresponding policy, if the management server determines that the camera is an illegally-accessed camera, the management server may issue an instruction to the network device to close an interface accessed by the terminal, so that the camera cannot access the network, and the like. The subsequent specific management mode and policy of the management server can be set according to the actual situation, and are not described in detail in this disclosure.
Therefore, the embodiment provides a camera identification method, which does not adopt a manual scanning mode of an administrator any more, can sense the access of a camera in time and report the sensed access to a management server, so that a subsequent management server can manage the camera of a dumb terminal type conveniently.
On the basis of the above embodiment, after the terminal that is accessed is judged to be the camera, the terminal can be recorded as the camera, and after the down event of the corresponding interface is received, the identifier representing the camera can be carried when the down event is reported to the management server, so that the management server can distinguish that the down event represented by the down event is the down event of the camera when receiving the down event.
In another alternative embodiment, the network device may only notify the management server of the down event corresponding to the corresponding interface of the network device, so that the management server analyzes the down terminal type represented by the down event in detail according to the down event.
On the basis of the above embodiments, the present disclosure further provides an identification apparatus for a camera, as shown in fig. 3, the apparatus includes: aninterface module 301, alog module 302 and ascanning module 303;
aninterface module 301, configured to receive an interface UP event of a network device, and acquire address information of a terminal, which is inserted into the network device, carried in the UP event;
theinterface module 301 sends the UP event to alog module 302, where thelog module 302 is configured to record the UP event and address information of the terminal;
thelog module 302 is configured to notify the scanning module of the UP event of the interface, so that thescanning module 303 sends a common protocol packet used for communicating with a camera to an inserted terminal according to the address information;
if theinterface module 301 receives the response information of the terminal, it determines that the terminal is a camera;
thescanning module 303 reports the information that the terminal is a camera to a management server.
Optionally, the general protocol packet used by thescanning module 303 for communicating with the camera is a packet of an open network video interface ONVIF protocol.
Optionally, after receiving the down event of the interface, theinterface module 301 notifies thelog module 302, and thelog module 302 notifies thescan module 303 of the down event of the interface, so that thescan module 303 reports the down event of the interface to the management server.
Thelog module 302 is further configured to record that the terminal accessed by the interface is a camera after thescanning module 303 determines that the terminal is the camera, and then after thelog module 302 receives the down event of the interface, thescanning module 303 reports the down event of the terminal to the management server.
Optionally, if theinterface module 301 does not receive the response message of the terminal within the preset time, the interface UP event is ignored.
The utility model provides an identification means of camera, the device can in time discern the terminal of camera type, consequently can be timely report management server with the pile body of this camera, after discerning this camera, when receiving the down incident of this terminal male interface, then report the event of inserting the line of this camera to management server to can make the timely perception of management server to the online and the information of inserting the line of this kind of dumb terminal type of camera.
The device provided by the embodiment is used for executing the camera recognition device provided by the embodiment. The specific steps may refer to the identification method of the camera, and details are not described in this embodiment.
Fig. 4 is a schematic structural diagram of anetwork device 40 according to another embodiment of the present disclosure, and as shown in fig. 4, thenetwork device 40 includes aprocessor 401 and amemory 402, where thememory 402 is used to store program instructions, theprocessor 401 is used to call the program instructions stored in the memory, and when theprocessor 401 executes the program instructions stored in thememory 402, the processor is used to execute the method executed by the controller according to the above embodiment.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other ways. The apparatus embodiments described above are merely illustrative, and for example, the flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods and computer program products according to embodiments of the present application. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
In addition, functional modules in the embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.
The functions, if implemented in the form of software functional modules and sold or used as a stand-alone product, may be stored in a readable storage medium. Based on such understanding, the technical solution of the present application or portions thereof that substantially contribute to the prior art may be embodied in the form of a software product stored in a readable storage medium, which includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method described in the embodiments of the present application. And the aforementioned readable storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
It will be understood that the present description is not limited to the precise arrangements described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present description is limited only by the appended claims.
The above description is only a preferred embodiment of the present disclosure, and should not be taken as limiting the present disclosure, and any modifications, equivalents, improvements, etc. made within the spirit and principle of the present disclosure should be included in the scope of the present disclosure.
It will be understood that the present description is not limited to the precise arrangements described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present description is limited only by the appended claims.
The above description is only a preferred embodiment of the present disclosure, and should not be taken as limiting the present disclosure, and any modifications, equivalents, improvements, etc. made within the spirit and principle of the present disclosure should be included in the scope of the present disclosure.