WEBVTT

00:04.980 --> 00:09.260
So guys, continuing with our implementation of Publisher subscriber example.

00:09.270 --> 00:14.700
So to begin with, we need a routing table data structures to begin with, right?

00:14.700 --> 00:17.570
Because we have chosen routing table as a data source.

00:17.580 --> 00:23.370
So we need a data structure which represents a routing table and we need a couple of APIs which can

00:23.370 --> 00:26.880
perform, create, delete or update operations on this routing table.

00:26.880 --> 00:31.230
So we need to define data structures, which represents a routing table.

00:31.230 --> 00:37.590
So you can see on the left hand side the keys of the routing table comprises of the destination as well

00:37.590 --> 00:39.510
as mask value, right?

00:39.600 --> 00:47.070
So mask value is any value between 0 to 32 and destination is any IP address, which can be 16 bytes

00:47.070 --> 00:47.640
long.

00:48.090 --> 00:52.320
So this data structure represents a key of a routing table entry.

00:52.470 --> 00:59.970
And this particular data structure that is entry represents one complete routing table entry, right?

00:59.970 --> 01:07.420
So a routing table entry has the keys and after that it has other data which is outgoing interface and

01:07.420 --> 01:08.230
Gateway.

01:08.410 --> 01:09.190
Right?

01:09.870 --> 01:14.060
And we were going to model this routing table as a doubly linked list.

01:14.070 --> 01:14.940
Right?

01:16.500 --> 01:21.540
So routing table is nothing, but it is a doubly linked list of routing table entries.

01:21.570 --> 01:27.950
It is for this reason that I have previous and next pointer within the routing table entry structure.

01:27.960 --> 01:28.740
Right.

01:29.100 --> 01:34.620
If you want some other alternative as an implementation of routing table, for example, you want to

01:34.620 --> 01:37.800
model routing table as an array, right?

01:37.950 --> 01:41.850
Array with some fixed number of entries, then you can do so.

01:41.850 --> 01:45.750
It really do not matter as long as this project is concerned.

01:46.710 --> 01:49.740
All you need is that you need a data source.

01:49.830 --> 01:55.070
And finally, we have a highest level data structure which actually represents a routing table.

01:55.080 --> 02:01.080
So routing table data structure simply carries a pointer, which points to the first entry of the routing

02:01.110 --> 02:01.680
table.

02:01.680 --> 02:03.990
That is the first entry, right?

02:04.580 --> 02:09.140
So you need to define all these data structures in the file attach.

02:09.140 --> 02:15.560
And after you have defined all these data structures in the file attach, we need to implement, create,

02:15.560 --> 02:19.240
read, update, delete operations on this routing table as well.

02:19.250 --> 02:20.030
Right.

02:20.330 --> 02:26.500
So let us look at the prototype of the APIs that would perform the Crud operations on this routing table.

02:26.510 --> 02:34.010
So you can see on the left hand side, following are the prototypes which would implement Crud operations

02:34.010 --> 02:35.390
on this routing table.

02:35.930 --> 02:38.750
Now to make things easier and faster.

02:38.750 --> 02:45.170
I have given you a raw file or underscore rorge and underscore raw.

02:45.860 --> 02:51.290
See these file exactly implements each of these APIs already.

02:51.320 --> 02:52.230
Right.

02:52.250 --> 02:59.990
So if you want to skip this dumb work of implementing a routing table as a data source, you can start

02:59.990 --> 03:05.370
the project by using underscore raw edge and underscore raw dot C file.

03:05.390 --> 03:11.500
You can rename these files to dot H and dot C in your project code.

03:11.510 --> 03:12.260
Right.

03:13.370 --> 03:18.700
Or it's up to you If you want to implement the routing table from absolute scratch, you can do so.

03:18.710 --> 03:24.230
But before using your own implementation of the routing table with the rest of the project, make sure

03:24.230 --> 03:27.890
that your implementation is bug free or otherwise.

03:27.890 --> 03:32.780
I would suggest use these raw files to start with this project.

03:32.780 --> 03:38.240
Right now, coming to the discussion on each of these prototypes of this API, you can see that the

03:38.240 --> 03:44.660
first API is used to actually add or update a particular entry in the routing table, right?

03:45.560 --> 03:49.520
Whereas the second API is used to delete an entry from the routing table.

03:49.520 --> 03:57.080
And for that all you need to specify is the key to find out uniquely an entry in the routing table which

03:57.080 --> 03:58.250
you want to delete.

03:58.280 --> 04:03.950
Similarly, you have implemented a lookup API to look up certain entry from the routing table.

04:04.100 --> 04:08.420
Of course, this API must return null if such an entry do not exist.

04:08.420 --> 04:09.080
Right.

04:09.080 --> 04:15.210
And then final is the API which you want to implement to dump the contents of the routing table.

04:15.210 --> 04:15.900
Right.

04:16.970 --> 04:22.520
Now in the next lecture video, let us start with our main function and see how we can going to build

04:22.520 --> 04:23.480
up this project.
