video networking network card selection method and system

文档序号:1711834 发布日期:2019-12-13 浏览:4次 中文

阅读说明:本技术 一种视联网网卡选择方法和系统 (video networking network card selection method and system ) 是由 史鑫 龙宇锋 李飞 王艳辉 于 2019-08-02 设计创作,主要内容包括:本申请实施例提供了一种视联网网卡选择方法和系统。所述方法包括:获取全部待选择网卡信息;根据待选择网卡信息获取每个待选择网卡的过程特性分析软件包pcap标识,利用pcap获取每个待选择网卡的网络数据包;针对每个待选择网卡,从各自获取的全部网络数据包中筛选具有视联网特征的数据包,并计算具有视联网特征的数据包占全部网络数据包的百分比;将具有视联网特征的数据包百分比最大的待选择网卡确定为视联网网卡,从而可以方便而准确的进行视联网网卡的选择。(The embodiment of the application provides a method and a system for selecting a video networking network card. The method comprises the following steps: acquiring all network card information to be selected; acquiring a process characteristic analysis software packet pcap identifier of each network card to be selected according to the information of the network card to be selected, and acquiring a network data packet of each network card to be selected by using the pcap; for each network card to be selected, screening data packets with video networking characteristics from all the acquired network data packets, and calculating the percentage of the data packets with the video networking characteristics in all the network data packets; and determining the network card to be selected with the largest data packet percentage with the video networking characteristics as the video networking network card, so that the video networking network card can be conveniently and accurately selected.)

1. A method for selecting a network card of a video network, the method comprising:

acquiring all network card information to be selected;

Acquiring a process characteristic analysis software packet pcap identifier of each network card to be selected according to the information of the network card to be selected, and acquiring a network data packet of each network card to be selected by using the pcap;

For each network card to be selected, screening data packets with video networking characteristics from all the acquired network data packets, and calculating the percentage of the data packets with the video networking characteristics in all the network data packets;

and determining the network card to be selected with the largest data packet percentage with the video networking characteristics as the video networking network card.

2. The method of claim 1, wherein the obtaining the pcap identifier of each network card to be selected according to the information of the network card to be selected, and obtaining the network data packet of each network card to be selected by using the pcap comprises:

Acquiring a pcap handle of each network card to be selected;

acquiring a network data packet by using the pcap handle;

and when the number of the acquired network data packets reaches a set threshold value and/or the acquisition duration reaches a set duration, stopping acquiring the network data packets.

3. the method of claim 2, wherein said obtaining a pcap handle for each network card to be selected comprises:

Creating a pcap handle by using a pcap _ open _ live function and a network card name to be selected;

the acquiring of the network data packet of each network card to be selected by utilizing the pcap comprises the following steps:

Starting a network data packet capturing thread by using a pcap _ loop function;

and transmitting a callback function pointer by using the pcap _ loop function to acquire a network data packet captured from the network card to be selected.

4. The method of claim 1, wherein the step of screening the data packets with the video networking characteristics from all the network data packets obtained from each network card to be selected and calculating the percentage of the data packets with the video networking characteristics to all the network data packets comprises:

Setting the quantity of all network data packets obtained by each network card to be selected as Aiwherein i is a network card identifier to be selected;

Screening the data packets with the video networking characteristics of each network card to be selected, and setting the number of the data packets with the video networking characteristics as Bi

calculating the percentage of the data packets with the video networking characteristics of each network card to be selected in all the acquired network data packets as Bi/Ai

5. a video networking network card selection system, the system comprising:

the acquisition module is used for acquiring all network card information to be selected;

The packet capturing module is used for acquiring a process characteristic analysis software packet pcap identifier of each network card to be selected according to the information of the network card to be selected and acquiring a network data packet of each network card to be selected by using the pcap;

The computing module is used for screening data packets with the video networking characteristics from all the acquired network data packets aiming at each network card to be selected and computing the percentage of the data packets with the video networking characteristics in all the network data packets;

And the selection module is used for determining the network card to be selected with the largest data packet percentage with the video networking characteristics as the video networking network card.

6. The system of claim 5, wherein the bale plucking module is specifically configured to:

Acquiring a pcap handle of each network card to be selected;

acquiring a network data packet by using the pcap handle;

And when the number of the acquired network data packets reaches a set threshold value and/or the acquisition duration reaches a set duration, stopping acquiring the network data packets.

7. The system of claim 6, comprising:

The acquiring of the pcap handle of each network card to be selected includes:

creating a pcap handle by using a pcap _ open _ live function and a network card name to be selected;

The acquiring of the network data packet of each network card to be selected by utilizing the pcap comprises the following steps:

Starting a network data packet capturing thread by using a pcap _ loop function;

And transmitting a callback function pointer by using the pcap _ loop function to acquire a data packet captured from the network card to be selected.

8. The system of claim 5, wherein the computing module is specifically configured to:

setting the quantity of all network data packets obtained by each network card to be selected as Aiwherein i is a network card identifier to be selected;

Screening the data packets with the video networking characteristics of each network card to be selected, and setting the number of the data packets with the video networking characteristics as Bi

Calculating the percentage of the data packets with the video networking characteristics of each network card to be selected in all the acquired network data packets as Bi/Ai

9. a computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the method of any one of claims 1 to 4 when executing the computer program.

10. A computer-readable storage medium, characterized in that the computer-readable storage medium stores a computer program for executing the method of any one of claims 1 to 4.

Technical Field

The application relates to the technical field of video networking, in particular to a video networking network card selection method and system.

Background

With the rapid development of the video networking, video conferences, video teaching and the like based on the video networking are widely popularized in the aspects of life, work, learning and the like of users.

At present, because there is no unique field for fixedly identifying the video network card available in the network card information of the video network card, when the video network card is selected, the description field of the video network card is mainly manually judged, and then the description field is written into a configuration file to realize the selection of the video network card.

However, the steps of manually judging the network card description information and writing the configuration file are complicated, and errors are easy to occur.

Disclosure of Invention

In view of the above, embodiments of the present application are proposed to provide a method and system for selecting a network card for a video network that overcome or at least partially solve the above problems.

in a first aspect, an embodiment of the present application discloses a method for selecting a network card of a video network, where the method includes:

Acquiring all network card information to be selected;

acquiring a process characteristic analysis software packet pcap identifier of each network card to be selected according to the information of the network card to be selected, and acquiring a network data packet of each network card to be selected by using the pcap;

For each network card to be selected, screening data packets with video networking characteristics from all the acquired network data packets, and calculating the percentage of the data packets with the video networking characteristics in all the network data packets;

And determining the network card to be selected with the largest data packet percentage with the video networking characteristics as the video networking network card.

Optionally, the obtaining a pcap identifier of each network card to be selected according to the information of the network card to be selected, and obtaining a network data packet of each network card to be selected by using the pcap includes:

Acquiring a pcap handle of each network card to be selected;

Acquiring a network data packet by using the pcap handle;

And when the number of the acquired network data packets reaches a set threshold value and/or the acquisition duration reaches a set duration, stopping acquiring the network data packets.

optionally, the acquiring a pcap handle of each network card to be selected includes:

creating a pcap handle by using a pcap _ open _ live function and a network card name to be selected;

Optionally, the obtaining, by using the pcap, a network data packet of each network card to be selected includes:

Starting a network data packet capturing thread by using a pcap _ loop function;

and transmitting a callback function pointer by using the pcap _ loop function to acquire a network data packet captured from the network card to be selected.

Optionally, the selecting, for each network card to be selected, data packets with video networking characteristics from all network data packets obtained from the network card to be selected, and calculating the percentage of the data packets with video networking characteristics in all network data packets, includes:

Setting the quantity of all network data packets obtained by each network card to be selected as Aiwherein i is a network card identifier to be selected;

screening the data packets with the video networking characteristics of each network card to be selected, and setting the number of the data packets with the video networking characteristics as Bi

Calculating the percentage of the data packets with the video networking characteristics of each network card to be selected in all the acquired network data packets as Bi/Ai

In a second aspect, an embodiment of the present application discloses a video networking network card selection system, including:

the acquisition module is used for acquiring all network card information to be selected;

The packet capturing module is used for acquiring a process characteristic analysis software packet pcap identifier of each network card to be selected according to the information of the network card to be selected and acquiring a network data packet of each network card to be selected by using the pcap;

The computing module is used for screening data packets with the video networking characteristics from all the acquired network data packets aiming at each network card to be selected and computing the percentage of the data packets with the video networking characteristics in all the network data packets;

And the selection module is used for determining the network card to be selected with the largest data packet percentage with the video networking characteristics as the video networking network card.

optionally, the bale plucking module is specifically configured to:

Acquiring a pcap handle of each network card to be selected;

Acquiring a network data packet by using the pcap handle;

And when the number of the acquired network data packets reaches a set threshold value and/or the acquisition duration reaches a set duration, stopping acquiring the network data packets.

optionally, comprising:

The acquiring of the pcap handle of each network card to be selected includes:

Creating a pcap handle by using a pcap _ open _ live function and a network card name to be selected;

the acquiring of the network data packet of each network card to be selected by utilizing the pcap comprises the following steps:

Starting a network data packet capturing thread by using a pcap _ loop function;

And transmitting a callback function pointer by using the pcap _ loop function to acquire a data packet captured from the network card to be selected.

Optionally, the calculation module is specifically configured to:

Setting the quantity of all network data packets obtained by each network card to be selected as AiWherein i is a network card identifier to be selected;

Screening the data packets with the video networking characteristics of each network card to be selected, and setting the number of the data packets with the video networking characteristics as Bi

Calculating the percentage of the data packets with the video networking characteristics of each network card to be selected in all the acquired network data packets as Bi/Ai

In a third aspect, an embodiment of the present application further discloses a computer device, which includes a memory, a processor, and a computer program stored on the memory and executable on the processor, and when the processor executes the computer program, the method of any one of the first aspect is implemented.

in a fourth aspect, an embodiment of the present application further discloses a computer-readable storage medium, where a computer program for executing any one of the methods in the first aspect is stored in the computer-readable storage medium.

According to the method for selecting the network card of the video network, all network card information to be selected is obtained; acquiring a process characteristic analysis software packet pcap identifier of each network card to be selected according to the information of the network card to be selected, and acquiring a network data packet of each network card to be selected by using the pcap; for each network card to be selected, screening data packets with video networking characteristics from all the acquired network data packets, and calculating the percentage of the data packets with the video networking characteristics in all the network data packets; and determining the network card to be selected with the largest data packet percentage with the video networking characteristics as the video networking network card, so that the video networking network card can be conveniently and accurately selected.

Drawings

Fig. 1 is a schematic networking diagram of a video network provided in an embodiment of the present application;

fig. 2 is a schematic hardware structure diagram of a node server according to an embodiment of the present application;

Fig. 3 is a schematic hardware structure diagram of an access switch according to an embodiment of the present application;

fig. 4 is a schematic hardware structure diagram of an ethernet protocol conversion gateway according to an embodiment of the present application;

FIG. 5 is a flowchart illustrating steps of a method for selecting a network card for a video network according to an embodiment of the present disclosure;

FIG. 6 is a diagram illustrating an example of an embodiment of a method provided by an embodiment of the present application;

Fig. 7 is a block diagram of a video networking network card selection system according to an embodiment of the present application.

Detailed Description

In order to make the aforementioned objects, features and advantages of the present application more comprehensible, the present application is described in further detail with reference to the accompanying drawings and the detailed description.

the video networking is an important milestone for network development, is a real-time network, can realize high-definition video real-time transmission, and pushes a plurality of internet applications to high-definition video, and high-definition faces each other.

The video networking adopts a real-time high-definition video exchange technology, can integrate required services such as dozens of services of video, voice, pictures, characters, communication, data and the like on a system platform on a network platform, such as high-definition video conference, video monitoring, intelligent monitoring analysis, emergency command, digital broadcast television, delayed television, network teaching, live broadcast, VOD on demand, television mail, Personal Video Recorder (PVR), intranet (self-office) channels, intelligent video broadcast control, information distribution and the like, and realizes high-definition quality video broadcast through a television or a computer.

To better understand the embodiments of the present application, the following description refers to the internet of view:

Some of the technologies applied in the video networking are as follows:

Network Technology (Network Technology)

Network technology innovation in video networking has improved over traditional Ethernet (Ethernet) to face the potentially enormous video traffic on the network. Unlike pure network Packet Switching (Packet Switching) or network circuit Switching (circuit Switching), the internet of vision technology employs network Packet Switching to satisfy the demand of Streaming (which is interpreted as Streaming, continuous broadcasting, and is a data transmission technology that changes received data into a stable continuous stream and continuously transmits the stream, so that the sound heard or image seen by the user is very smooth, and the user can start browsing on the screen before the whole data is transmitted). The video networking technology has the advantages of flexibility, simplicity and low price of packet switching, and simultaneously has the quality and safety guarantee of circuit switching, thereby realizing the seamless connection of the whole network switching type virtual circuit and the data format.

switching Technology (Switching Technology)

The video network adopts two advantages of asynchronism and packet switching of the Ethernet, eliminates the defects of the Ethernet on the premise of full compatibility, has end-to-end seamless connection of the whole network, is directly communicated with a user terminal, and directly bears an IP data packet. The user data does not require any format conversion across the entire network. The video networking is a higher-level form of the Ethernet, is a real-time exchange platform, can realize the real-time transmission of the whole-network large-scale high-definition video which cannot be realized by the existing Internet, and pushes a plurality of network video applications to high-definition and unification.

Server Technology (Server Technology)

The server technology on the video networking and unified video platform is different from the traditional server, the streaming media transmission of the video networking and unified video platform is established on the basis of connection orientation, the data processing capacity of the video networking and unified video platform is independent of flow and communication time, and a single network layer can contain signaling and data transmission. For voice and video services, the complexity of video networking and unified video platform streaming media processing is much simpler than that of data processing, and the efficiency is greatly improved by more than one hundred times compared with that of a traditional server.

storage Technology (Storage Technology)

The super-high speed storage technology of the unified video platform adopts the most advanced real-time operating system in order to adapt to the media content with super-large capacity and super-large flow, the program information in the server instruction is mapped to the specific hard disk space, the media content is not passed through the server any more, and is directly sent to the user terminal instantly, and the general waiting time of the user is less than 0.2 second. The optimized sector distribution greatly reduces the mechanical motion of the magnetic head track seeking of the hard disk, the resource consumption only accounts for 20% of that of the IP internet of the same grade, but concurrent flow which is 3 times larger than that of the traditional hard disk array is generated, and the comprehensive efficiency is improved by more than 10 times.

Network Security Technology (Network Security Technology)

The structural design of the video network completely eliminates the network security problem troubling the internet structurally by the modes of independent service permission control each time, complete isolation of equipment and user data and the like, generally does not need antivirus programs and firewalls, avoids the attack of hackers and viruses, and provides a structural carefree security network for users.

Service Innovation Technology (Service Innovation Technology)

the unified video platform integrates services and transmission, and is not only automatically connected once whether a single user, a private network user or a network aggregate. The user terminal, the set-top box or the PC are directly connected to the unified video platform to obtain various multimedia video services in various forms. The unified video platform adopts a menu type configuration table mode to replace the traditional complex application programming, can realize complex application by using very few codes, and realizes infinite new service innovation.

Networking of the video network is as follows:

the video network is a centralized control network structure, and the network can be a tree network, a star network, a ring network and the like, but on the basis of the centralized control node, the whole network is controlled by the centralized control node in the network.

As shown in fig. 1, the video network is divided into an access network and a metropolitan network.

The devices of the access network part can be mainly classified into 3 types: node server, access switch, terminal (including various set-top boxes, coding boards, memories, etc.). The node server is connected to an access switch, which may be connected to a plurality of terminals and may be connected to an ethernet network.

The node server is a node which plays a centralized control function in the access network and can control the access switch and the terminal. The node server can be directly connected with the access switch or directly connected with the terminal.

Similarly, devices of the metropolitan network portion may also be classified into 3 types: a metropolitan area server, a node switch and a node server. The metro server is connected to a node switch, which may be connected to a plurality of node servers.

the node server is a node server of the access network part, namely the node server belongs to both the access network part and the metropolitan area network part.

the metropolitan area server is a node which plays a centralized control function in the metropolitan area network and can control a node switch and a node server. The metropolitan area server can be directly connected with the node switch or directly connected with the node server.

Therefore, the whole video network is a network structure with layered centralized control, and the network controlled by the node server and the metropolitan area server can be in various structures such as tree, star and ring.

the access network part can form a unified video platform (circled part), and a plurality of unified video platforms can form a video network; each unified video platform may be interconnected via metropolitan area and wide area video networking.

Video networking device classification

1.1 devices in the video network of the embodiment of the present application can be mainly classified into 3 types: servers, switches (including ethernet gateways), terminals (including various set-top boxes, code boards, memories, etc.). The video network as a whole can be divided into a metropolitan area network (or national network, global network, etc.) and an access network.

1.2 wherein the devices of the access network part can be mainly classified into 3 types: node servers, access switches (including ethernet gateways), terminals (including various set-top boxes, code boards, memories, etc.).

The specific hardware structure of each access network device is as follows:

a node server:

As shown in fig. 2, the system mainly includes a network interface module 201, a switching engine module 202, a CPU module 203, and a disk array module 204.

The network interface module 201, the CPU module 203, and the disk array module 204 all enter the switching engine module 202; the switching engine module 202 performs an operation of looking up the address table 205 on the incoming packet, thereby obtaining the direction information of the packet; and stores the packet in a queue of the corresponding packet buffer 206 based on the packet's steering information; if the queue of the packet buffer 206 is nearly full, it is discarded; the switching engine module 202 polls all packet buffer queues for forwarding if the following conditions are met: 1) the port send buffer is not full; 2) the queue packet counter is greater than zero. The disk array module 204 mainly implements control over the hard disk, including initialization, read-write, and other operations on the hard disk; the CPU module 203 is mainly responsible for protocol processing with an access switch and a terminal (not shown in the figure), configuring an address table 205 (including a downlink protocol packet address table, an uplink protocol packet address table, and a data packet address table), and configuring the disk array module 204.

the access switch:

As shown in fig. 3, the network interface module (downstream network interface module 301, upstream network interface module 302), the switching engine module 303, and the CPU module 304 are mainly included.

Wherein, the packet (uplink data) coming from the downlink network interface module 301 enters the packet detection module 305; the packet detection module 305 detects whether the Destination Address (DA), the Source Address (SA), the packet type, and the packet length of the packet meet the requirements, if so, allocates a corresponding stream identifier (stream-id) and enters the switching engine module 303, otherwise, discards the stream identifier; the packet (downstream data) coming from the upstream network interface module 302 enters the switching engine module 303; the incoming data packet of the CPU module 304 enters the switching engine module 303; the switching engine module 303 performs an operation of looking up the address table 306 on the incoming packet, thereby obtaining the direction information of the packet; if the packet entering the switching engine module 303 is from the downstream network interface to the upstream network interface, the packet is stored in the queue of the corresponding packet buffer 307 in association with the stream-id; if the queue of the packet buffer 307 is nearly full, it is discarded; if the packet entering the switching engine module 303 is not from the downlink network interface to the uplink network interface, the data packet is stored in the queue of the corresponding packet buffer 307 according to the guiding information of the packet; if the queue of the packet buffer 307 is nearly full, it is discarded.

The switching engine module 303 polls all packet buffer queues, which in this embodiment is divided into two cases:

if the queue is from the downlink network interface to the uplink network interface, the following conditions are met for forwarding: 1) the port send buffer is not full; 2) the queued packet counter is greater than zero; 3) and obtaining the token generated by the code rate control module.

if the queue is not from the downlink network interface to the uplink network interface, the following conditions are met for forwarding: 1) the port send buffer is not full; 2) the queue packet counter is greater than zero.

The rate control module 208 is configured by the CPU module 204, and generates tokens for packet buffer queues from all downstream network interfaces to upstream network interfaces at programmable intervals to control the rate of upstream forwarding.

the CPU module 304 is mainly responsible for protocol processing with the node server, configuration of the address table 306, and configuration of the code rate control module 308.

Ethernet protocol conversion gateway

As shown in fig. 4, the apparatus mainly includes a network interface module (a downlink network interface module 401 and an uplink network interface module 402), a switching engine module 403, a CPU module 404, a packet detection module 405, a rate control module 408, an address table 406, a packet buffer 407, a MAC adding module 409, and a MAC deleting module 410.

wherein, the data packet coming from the downlink network interface module 401 enters the packet detection module 405; the packet detection module 405 detects whether the ethernet MAC DA, the ethernet MAC SA, the ethernet length or frame type, the video network destination address DA, the video network source address SA, the video network packet type, and the packet length of the packet meet the requirements, and if so, allocates a corresponding stream identifier (stream-id); then, the MAC deletion module 410 subtracts MAC DA, MAC SA, length or frame type (2byte) and enters the corresponding receiving buffer, otherwise, discards it;

The downlink network interface module 401 detects the sending buffer of the port, and if there is a packet, acquires the ethernet MAC DA of the corresponding terminal according to the video networking destination address DA of the packet, adds the ethernet MAC DA of the terminal, the MACSA of the ethernet coordination gateway, and the ethernet length or frame type, and sends the packet.

the other modules in the ethernet protocol gateway function similarly to the access switch.

A terminal:

The system mainly comprises a network interface module, a service processing module and a CPU module; for example, the set-top box mainly comprises a network interface module, a video and audio coding and decoding engine module and a CPU module; the coding board mainly comprises a network interface module, a video and audio coding engine module and a CPU module; the memory mainly comprises a network interface module, a CPU module and a disk array module.

1.3 devices of the metropolitan area network part can be mainly classified into 3 types: node server, node exchanger, metropolitan area server. The node switch mainly comprises a network interface module, a switching engine module and a CPU module; the metropolitan area server mainly comprises a network interface module, a switching engine module and a CPU module.

2. Video networking packet definition

2.1 Access network packet definition

The data packet of the access network mainly comprises the following parts: destination Address (DA), Source Address (SA), reserved byte, Payload (PDU), CRC.

as shown in the following table, the data packet of the access network mainly includes the following parts:

DA SA Reserved Payload CRC

The Destination Address (DA) is composed of 8 bytes (byte), the first byte represents the type of the data packet (e.g. various protocol packets, multicast data packets, unicast data packets, etc.), there are at most 256 possibilities, the second byte to the sixth byte are metropolitan area network addresses, and the seventh byte and the eighth byte are access network addresses.

The Source Address (SA) is also composed of 8 bytes (byte), defined as the same as the Destination Address (DA).

The reserved byte consists of 2 bytes.

The payload part has different lengths according to types of different datagrams, and is 64 bytes if the type of the datagram is a variety of protocol packets, or is 1056 bytes if the type of the datagram is a unicast packet, but is not limited to the above 2 types.

The CRC consists of 4 bytes and is calculated in accordance with the standard ethernet CRC algorithm.

2.2 metropolitan area network packet definition

the topology of a metropolitan area network is a graph and there may be 2, or even more than 2, connections between two devices, i.e., there may be more than 2 connections between a node switch and a node server, a node switch and a node switch, and a node switch and a node server. However, the metro network address of the metro network device is unique, and in order to accurately describe the connection relationship between the metro network devices, parameters are introduced in the embodiment of the present application: a label to uniquely describe a metropolitan area network device.

In this specification, the definition of the Label is similar to that of a Label of Multi-Protocol Label switching (MPLS), and assuming that there are two connections between a device a and a device B, there are 2 labels for a packet from the device a to the device B, and 2 labels for a packet from the device B to the device a. The label is classified into an incoming label and an outgoing label, and assuming that the label (incoming label) of the packet entering the device a is 0x0000, the label (outgoing label) of the packet leaving the device a may become 0x 0001. The network access process of the metro network is a network access process under centralized control, that is, address allocation and label allocation of the metro network are both dominated by the metro server, and the node switch and the node server are both passively executed, which is different from label allocation of MPLS, and label allocation of MPLS is a result of mutual negotiation between the switch and the server.

as shown in the following table, the data packet of the metro network mainly includes the following parts:

DA SA Reserved label (R) Payload CRC

Namely Destination Address (DA), Source Address (SA), Reserved byte (Reserved), tag, Payload (PDU), CRC. The format of the tag may be defined by reference to the following: the tag is 32 bits with the upper 16 bits reserved and only the lower 16 bits used, and its position is between the reserved bytes and payload of the packet.

A Network Interface Controller (NIC), also called a network interface controller, a network adapter, a network card, or a local area network receiver (LAN adapter) is a piece of computer hardware designed to allow a computer to communicate over a computer network. It belongs to layer 1 of the OSI model because it possesses a MAC address. It allows users to connect to each other by cable or wirelessly. Each network card has a unique 48-bit serial number, called the MAC address, which is written in a ROM on the card. Each computer on the network must have a unique MAC address. No two produced network cards have the same address.

The connection between the computer and the external LAN is realized by inserting a network interface board into the main case (or inserting a PCMCIA card into the notebook computer).

the data packets captured from the video networking network card have own characteristics compared with the data packets captured from the internet network card, so that in the embodiment of the application, a certain number of data packets are captured for all currently available network cards of the PC in sequence, the data packets are analyzed, and the data packets with the characteristics of the video networking data packets are judged to be the largest percentage of the total data, namely the video networking network card.

according to the embodiment of the application, the video networking network card is accurately selected under the condition that the video networking network card, the Internet network card and other network cards exist. The purpose of selecting the video networking network card is to find any network card capable of capturing video networking data.

The process characterization software package PACP is a network programming interface used to capture network data packets. The packet capture library provides a high-level interface for the packet capture system. All packets on the network, including those sent to other hosts, can be captured by this mechanism. It also supports saving captured packets as and reading information from local files.

fig. 5 shows a video networking network card selection method provided by the embodiment of the present application, which includes the following steps:

Step 501: and acquiring all network card information to be selected.

step 502: and acquiring a process characteristic analysis software packet pcap identifier of each network card to be selected according to the information of the network card to be selected, and acquiring a network data packet of each network card to be selected by using the pcap.

Step 503: and aiming at each network card to be selected, screening data packets with the video networking characteristics from all the acquired network data packets, and calculating the percentage of the data packets with the video networking characteristics in all the network data packets.

step 504: and determining the network card to be selected with the largest data packet percentage with the video networking characteristics as the video networking network card.

in step 502, first, a pcap handle of each network card to be selected is obtained; acquiring a network data packet by using the pcap handle; and when the number of the acquired network data packets reaches a set threshold value and/or the acquisition duration reaches a set duration, stopping acquiring the network data packets.

Regarding the process of acquiring network packets. For example, firstly, a pcap handle is created by using a pcap _ open _ live function and a network card name to be selected; further, starting a network data packet capturing thread by utilizing a pcap _ loop function; and transmitting a callback function pointer by using the pcap _ loop function to acquire a network data packet captured from the network card to be selected.

It should be noted that the manner of acquiring the network data packet according to the embodiment of the present application is only an example, and the embodiment of the present application does not limit the specific manner of acquiring the network data packet.

In step 503, the number of all network packets acquired by each network card to be selected is set to aiwherein i is a network card identifier to be selected; screening the data packets with the video networking characteristics of each network card to be selected, and setting the number of the data packets with the video networking characteristics as Bi(ii) a Calculating the percentage of the data packets with the video networking characteristics of each network card to be selected in all the acquired network data packets as Bi/Ai

the data packets with the characteristics of the video networking are determined according to the type of the video networking protocol. For example, a 64-bit video networking protocol is taken as an example, and a data packet with a length of 100 and two bytes of 0x0001 starting from the 36 th byte is taken as a data packet with video networking characteristics. The method provided by the embodiment of the application can be applied only by changing the mode of judging the data packet with the video networking characteristics, so that the automatic selection of the video networking network card under the 16-bit video networking protocol is realized. Under the 16-bit video networking protocol, a data packet with the length of 92 and the two bytes starting from the 28 th byte of 0x8a01 is taken as a data packet with the video networking characteristics.

to more clearly describe the method for selecting a network card of a video network provided by the embodiment of the present Application, an example is given based on fig. 6, first, information (including a PCAP handle) of all network cards of a current PC is obtained through an Application Programming Interface (API) provided by a system, each network card executes the API provided by a PCAP packet capture library for the information of the network card to capture a data packet, for example, the PCAP handle of a first network card is obtained when the number of the captured data packets reaches a set threshold or the time length for capturing the data packets reaches a set time length, further, the API provided by the PCAP library is used to capture 100 data packets, or the time length for capturing the data packets is set to 3 seconds, and if yes, the next step is performed, if not, the PCAP of a next network card is obtained, and the packet capture process is repeated.

and further, calculating the percentage of the number of the data packets with the characteristics of the video network to the total number of the packets to be captured, and recording. A variable a is created to record the total number of data packets, a variable b is created to record the number of data packets with the video networking characteristics, and b/a can obtain the percentage of the number of the data packets with the video networking characteristics in the total number of the grabbed data packets. Until the percentage of all the grabbed data packets is recorded. Comparing the network cards with the maximum percentage of the number of the data packets with the characteristics of the video networking data packets in the total number of the grabbed packets, and recording the serial numbers of the network cards. The network card is the video network card.

The subsequent video networking related operations can obtain information required by other network cards, such as network card names, network card descriptions and the like, through the network card serial number according to needs.

in summary, according to the method for selecting the network card of the video network provided by the embodiment of the application, all the information of the network card to be selected is acquired; acquiring a process characteristic analysis software packet pcap identifier of each network card to be selected according to the information of the network card to be selected, and acquiring a network data packet of each network card to be selected by using the pcap; for each network card to be selected, screening data packets with video networking characteristics from all the acquired network data packets, and calculating the percentage of the data packets with the video networking characteristics in all the network data packets; and determining the network card to be selected with the largest data packet percentage with the video networking characteristics as the video networking network card, so that the video networking network card can be conveniently and accurately selected.

It should be noted that, for simplicity of description, the method embodiments are described as a series of acts or combination of acts, but those skilled in the art will recognize that the embodiments are not limited by the order of acts described, as some steps may occur in other orders or concurrently depending on the embodiments. Further, those skilled in the art will also appreciate that the embodiments described in the specification are presently preferred and that no particular act is required of the embodiments of the application.

based on the same technical concept, referring to fig. 7, a structural block diagram of a network card selection system of a video network provided in the embodiment of the present application is shown, where the apparatus may be applied to a video network, and specifically may include the following modules:

The obtaining module 701 is configured to obtain all network card information to be selected.

And the packet capturing module 702 is configured to obtain a pcap identifier of the process characteristic analysis software packet for each network card to be selected according to the information of the network card to be selected, and obtain a network data packet for each network card to be selected by using the pcap.

The calculating module 703 is configured to, for each network card to be selected, screen a data packet with video networking characteristics from all the network data packets acquired respectively, and calculate a percentage of the data packet with video networking characteristics in all the network data packets.

and a selecting module 704, configured to determine the network card to be selected with the largest percentage of data packets having the video networking feature as the video networking network card.

optionally, the packet capturing module 702 is specifically configured to: acquiring a pcap handle of each network card to be selected; acquiring a network data packet by using the pcap handle; and when the number of the acquired network data packets reaches a set threshold value and/or the acquisition duration reaches a set duration, stopping acquiring the network data packets.

Optionally, the acquiring a pcap handle of each network card to be selected includes: and creating a pcap handle by using a pcap _ open _ live function and a network card name to be selected.

Optionally, the obtaining, by using the pcap, a network data packet of each network card to be selected includes: starting a network data packet capturing thread by using a pcap _ loop function; and transmitting a callback function pointer by using the pcap _ loop function to acquire a data packet captured from the network card to be selected.

Optionally, the calculating module 703 is specifically configured to: setting the quantity of all network data packets obtained by each network card to be selected as AiWherein i is a network card identifier to be selected; screening the data packets with the video networking characteristics of each network card to be selected, and setting the number of the data packets with the video networking characteristics as Bi(ii) a Calculating the percentage of the data packets with the video networking characteristics of each network card to be selected in all the acquired network data packets as Bi/Ai

for the device embodiment, since it is basically similar to the method embodiment, the description is simple, and for the relevant points, refer to the partial description of the method embodiment.

the embodiments in the present specification are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other.

As will be appreciated by one of skill in the art, embodiments of the present application may be provided as a method, apparatus, or computer program product. Accordingly, embodiments of the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, embodiments of the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.

Embodiments of the present application are described with reference to flowchart illustrations and/or block diagrams of methods, terminal devices (systems), and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing terminal to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing terminal, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.

these computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing terminal to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.

These computer program instructions may also be loaded onto a computer or other programmable data processing terminal to cause a series of operational steps to be performed on the computer or other programmable terminal to produce a computer implemented process such that the instructions which execute on the computer or other programmable terminal provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.

While preferred embodiments of the present application have been described, additional variations and modifications of these embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. Therefore, it is intended that the appended claims be interpreted as including the preferred embodiment and all such alterations and modifications as fall within the true scope of the embodiments of the application.

Finally, it should also be noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or terminal that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or terminal. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or terminal that comprises the element.

the video networking network card selection method and system provided by the application are provided. The detailed description is given, and the principle and the implementation of the present application are explained by applying specific examples, and the above description of the embodiments is only used to help understanding the method and the core idea of the present application; meanwhile, for a person skilled in the art, according to the idea of the present application, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present application.

18页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:针对多类不均衡异常流量的网络攻击检测方法及装置

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!

技术分类