WEBVTT

00:06.260 --> 00:12.170
So, guys, now in this section of the course, we will going to learn how to write Netlink userspace

00:12.170 --> 00:12.830
program.

00:13.760 --> 00:18.710
So you can see on the slide that we will begin writing userspace Netlink program.

00:18.800 --> 00:23.990
This userspace program will do the following in userspace program.

00:23.990 --> 00:29.180
The very first thing that we will going to do is to create a userspace netlink socket.

00:29.300 --> 00:36.050
Then from the main thread we will going to create a separate thread which is called netlink message

00:36.050 --> 00:37.250
receiver thread.

00:37.370 --> 00:38.180
Right?

00:38.360 --> 00:44.690
So you can see in the below diagram that we have a userspace dot c program and from the main thread

00:44.690 --> 00:52.220
which is represented by the yellow line, we create a new thread which is represented by the blue line.

00:52.220 --> 00:52.930
Right?

00:52.940 --> 00:59.750
The purpose of this separate thread is only to receive messages coming from the kernel space, whereas

00:59.750 --> 01:03.590
in the main thread we will send the message to the kernel space.

01:03.590 --> 01:08.100
So our userspace application will be to threaded application.

01:08.130 --> 01:14.160
The main thread will take the responsibility to send the message to the kernel space, whereas the receiver

01:14.160 --> 01:19.080
thread will take the responsibility to receive the messages from the kernel space.

01:19.530 --> 01:26.640
So in the main thread we will ask the user for the input to send the greet message to the kernel.

01:26.640 --> 01:34.110
So in fact we can design the main thread as a menu driven program, giving users multiple choices to

01:34.110 --> 01:39.390
send different types of data to the kernel space as per the choice chosen by him.

01:39.930 --> 01:45.840
So in the main thread we will ask the user the input and accordingly we will send message to the kernel

01:45.840 --> 01:48.240
space receiver thread.

01:48.270 --> 01:54.780
On the other hand, only has the responsibility to receive a messages from the kernel space and in this

01:54.780 --> 02:00.210
case our receiver thread will going to receive a reply denoted by greet reply.

02:00.240 --> 02:00.960
Right.

02:00.960 --> 02:04.650
So the design of our user space application is fairly simple.

02:04.650 --> 02:06.510
It is two threaded application.

02:06.510 --> 02:12.000
The one thread will take the responsibility to send messages to the kernel space while the another thread

02:12.000 --> 02:13.860
does exactly the opposite.

02:13.890 --> 02:14.700
Right.
