forked from awm22/NetFPGA-P33
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sr_main.c
57 lines (51 loc) · 1.84 KB
/
sr_main.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/*-----------------------------------------------------------------------------
* file: sr_main.c
* Date: Mon Feb 02 21:48:59 PST 2004
* (adapted from sr_cli_main.c Wed Nov 26 03:02:17 PST 2003)
* Author: Martin Casado <[email protected]>
*
* Description:
*
* Main function for sr_router. Here we basically handle the command
* line options and start the 'lower level' routing functionality which
* involves connecting to the VNS server and negotiating the topology
* and host information.
*
* The router functionality should be extended to support:
*
* - ARP
* - ICMP
* - IP
* - TCP
* - Routing
* - OSPF
*
* Once the router is fully implemented it should support 'user level' network
* code using standard BSD sockets. To demonstrate this, main(..) must be
* extended to support a fully interactive CLI from which you can telnet into
* your router, configure the routing table and the interfaces, print
* statistics and any other advanced functionality you choose to support.
*
*---------------------------------------------------------------------------*/
#include <stdio.h>
#include <unistd.h>
#include "cli/cli_main.h"
#include "sr_base.h"
/** run the command-line interface on CLI_PORT */
uint16_t CLI_PORT = 2300;
int main(int argc, char** argv)
{
/* --
* start the low-level network subsystem
*
* Note: sr recognizes the following command
* line args (in getopt format)
* "hs:v:p:c:t:r:l:" and doesn't
* clean argv
* -- */
sr_init_low_level_subystem(argc, argv);
/* start the command-line interface (blocks until the router terminates) */
if( cli_main( CLI_PORT ) == CLI_ERROR )
fprintf( stderr, "Error: unable to setup the command-line interface server\n" );
return 0;
} /* -- main -- */