BWM and static ARP optimizations
[tomato.git] / release / src / router / www / vpn.js
blob0efe6cb6a7d9c52f3b7c3421272d75c5361880c8
1 // List of available ciphers
2 var vpnciphers = [];
3 /*AES-BEGIN*/
4 vpnciphers = vpnciphers.concat(['AES-128-CBC','AES-128-CFB','AES-128-OFB','AES-192-CBC','AES-192-CFB','AES-192-OFB','AES-256-CBC','AES-256-CFB','AES-256-OFB']);
5 /*AES-END*/
6 vpnciphers = vpnciphers.concat(['BF-CBC','BF-CFB','BF-OFB','CAST5-CBC','CAST5-CFB','CAST5-OFB','DES-CBC','DES-CFB','DES-EDE3-CBC','DES-EDE3-CFB','DES-EDE3-OFB','DES-EDE-CBC','DES-EDE-CFB','DES-EDE-OFB','DES-OFB','DESX-CBC','IDEA-CBC','IDEA-CFB','IDEA-OFB','RC2-40-CBC','RC2-64-CBC','RC2-CBC','RC2-CFB','RC2-OFB','RC5-CBC','RC5-CFB','RC5-OFB']);
8 var helpURL = new Array();
9 helpURL['howto'] = 'http://openvpn.net/index.php/open-source/documentation/howto.html';
10 helpURL['staticKeys'] = 'http://openvpn.net/index.php/open-source/documentation/miscellaneous/78-static-key-mini-howto.html';
11 helpURL['TLSKeys'] = 'http://openvpn.net/index.php/open-source/documentation/howto.html#pki';
13 // Handles parsing status files and displaying the information
14 function StatusUpdater(clients, routes, stats, time, cDiv, ncDiv, eDiv)
16         this.init(clients, routes, stats, time, cDiv, ncDiv, eDiv);
17         return this;
19 StatusUpdater.prototype =
21         init: function(clients, routes, stats, time, cDiv, ncDiv, eDiv)
22         {
23                 this.clientTable = clients? new TomatoGrid(clients,'sort',0,null): null;
24                 this.routeTable = routes? new TomatoGrid(routes,'sort',0,null): null;
25                 this.statTable = stats? new TomatoGrid(stats,'sort',0,null): null;
26                 this.statusTime = time? E(time): null;
27                 this.content = cDiv? E(cDiv): null;
28                 this.noContent = ncDiv? E(ncDiv): null;
29                 this.errors = eDiv? E(eDiv): null;
30         },
31         update: function(text)
32         {
33                 if(this.errors) this.errors.innerHTML = '';
34                 if(this.noContent) this.noContent.style.display = (text==''?'':'none');
35                 if(this.content) this.content.style.display = (text==''?'none':'');
37                 if(this.clientTable) this.clientTable.tb.parentNode.style.display = 'none';
38                 if(this.clientTable) this.clientTable.removeAllData();
39                 if(this.routeTable) this.routeTable.tb.parentNode.style.display = 'none';
40                 if(this.routeTable) this.routeTable.removeAllData();
41                 if(this.statTable) this.statTable.tb.parentNode.style.display = 'none';
42                 if(this.statTable) this.statTable.removeAllData();
44                 if(this.statTable) this.statTable.headerSet(['Name','Value']);
46                 var lines = text.split('\n');
47                 var staticStats = false;
48                 for (i = 0; text != '' && i < lines.length; ++i)
49                 {
50                         var done = false;
52                         var fields = lines[i].split(',');
53                         if ( fields.length == 0 ) continue;
54                         switch ( fields[0] )
55                         {
56                         case "TITLE":
57                                 break;
58                         case "TIME":
59                                 if(this.statusTime) this.statusTime.innerHTML = fields[1];
60                                 break;
61                         case "HEADER":
62                                 switch ( fields[1] )
63                                 {
64                                 case "CLIENT_LIST":
65                                         if(this.clientTable) this.clientTable.headerSet(fields.slice(2,fields.length-1));
66                                         break;
67                                 case "ROUTING_TABLE":
68                                         if(this.routeTable) this.routeTable.headerSet(fields.slice(2,fields.length-1));
69                                         break;
70                                 default:
71                                         if(this.errors) this.errors.innerHTML += 'Unknown header: '+lines[i]+'<br>';
72                                         break;
73                                 }
74                                 break;
75                         case "CLIENT_LIST":
76                                 if(this.clientTable) this.clientTable.tb.parentNode.style.display = '';
77                                 if(this.clientTable) this.clientTable.insertData(-1, fields.slice(1,fields.length-1))
78                                 break;
79                         case "ROUTING_TABLE":
80                                 if(this.routeTable) this.routeTable.tb.parentNode.style.display = '';
81                                 if(this.routeTable) this.routeTable.insertData(-1, fields.slice(1,fields.length-1))
82                                 break;
83                         case "GLOBAL_STATS":
84                                 if(this.statTable) this.statTable.tb.parentNode.style.display = '';
85                                 if(this.statTable) this.statTable.insertData(-1, fields.slice(1));
86                                 break;
87                         case "OpenVPN STATISTICS":
88                                 staticStats = true;
89                                 break;
90                         case "Updated":
91                                 if(staticStats)
92                                         if(this.statusTime) this.statusTime.innerHTML = fields[1];
93                                 break;
94                         case "END":
95                                 done = true;
96                                 break;
97                         default:
98                                 if(staticStats)
99                                 {
100                                         if(this.statTable) this.statTable.tb.parentNode.style.display = '';
101                                         if(this.statTable) this.statTable.insertData(-1, fields);
102                                 }
103                                 else if(this.errors) this.errors.innerHTML += 'Unknown: '+lines[i]+'<br>';
104                                 break;
105                         }
106                         if ( done ) break;
107                 }
108         }