So guys, continuing with our implementation of Publisher subscriber example.
So to begin with, we need a routing table data structures to begin with, right?
Because we have chosen routing table as a data source.
So we need a data structure which represents a routing table and we need a couple of APIs which can
perform, create, delete or update operations on this routing table.
So we need to define data structures, which represents a routing table.
So you can see on the left hand side the keys of the routing table comprises of the destination as well
as mask value, right?
So mask value is any value between 0 to 32 and destination is any IP address, which can be 16 bytes
long.
So this data structure represents a key of a routing table entry.
And this particular data structure that is entry represents one complete routing table entry, right?
So a routing table entry has the keys and after that it has other data which is outgoing interface and
Gateway.
Right?
And we were going to model this routing table as a doubly linked list.
Right?
So routing table is nothing, but it is a doubly linked list of routing table entries.
It is for this reason that I have previous and next pointer within the routing table entry structure.
Right.
If you want some other alternative as an implementation of routing table, for example, you want to
model routing table as an array, right?
Array with some fixed number of entries, then you can do so.
It really do not matter as long as this project is concerned.
All you need is that you need a data source.
And finally, we have a highest level data structure which actually represents a routing table.
So routing table data structure simply carries a pointer, which points to the first entry of the routing
table.
That is the first entry, right?
So you need to define all these data structures in the file attach.
And after you have defined all these data structures in the file attach, we need to implement, create,
read, update, delete operations on this routing table as well.
Right.
So let us look at the prototype of the APIs that would perform the Crud operations on this routing table.
So you can see on the left hand side, following are the prototypes which would implement Crud operations
on this routing table.
Now to make things easier and faster.
I have given you a raw file or underscore rorge and underscore raw.
See these file exactly implements each of these APIs already.
Right.
So if you want to skip this dumb work of implementing a routing table as a data source, you can start
the project by using underscore raw edge and underscore raw dot C file.
You can rename these files to dot H and dot C in your project code.
Right.
Or it's up to you If you want to implement the routing table from absolute scratch, you can do so.
But before using your own implementation of the routing table with the rest of the project, make sure
that your implementation is bug free or otherwise.
I would suggest use these raw files to start with this project.
Right now, coming to the discussion on each of these prototypes of this API, you can see that the
first API is used to actually add or update a particular entry in the routing table, right?
Whereas the second API is used to delete an entry from the routing table.
And for that all you need to specify is the key to find out uniquely an entry in the routing table which
you want to delete.
Similarly, you have implemented a lookup API to look up certain entry from the routing table.
Of course, this API must return null if such an entry do not exist.
Right.
And then final is the API which you want to implement to dump the contents of the routing table.
Right.
Now in the next lecture video, let us start with our main function and see how we can going to build
up this project.