|
1 # |
|
2 # Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 # All rights reserved. |
|
4 # This component and the accompanying materials are made available |
|
5 # under the terms of "Eclipse Public License v1.0" |
|
6 # which accompanies this distribution, and is available |
|
7 # at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 # |
|
9 # Initial Contributors: |
|
10 # Nokia Corporation - initial contribution. |
|
11 # |
|
12 # Contributors: |
|
13 # |
|
14 # Description: |
|
15 # |
|
16 |
|
17 |
|
18 $#ARGV==6 or die "7 arguments required"; |
|
19 |
|
20 my $input = $ARGV[0]; |
|
21 my $output = $ARGV[1]; |
|
22 my $ipAddress = $ARGV[2]; |
|
23 my $ipGateway = $ARGV[3]; |
|
24 my $ipMask = $ARGV[4]; |
|
25 my $ipDNS = $ARGV[5]; |
|
26 my $IpAddrFromServer = $ARGV[6]; |
|
27 |
|
28 my $writeEnabled = 1; |
|
29 |
|
30 open INPUT, "<$input" or die "Cannot open $input: $!"; |
|
31 open OUTPUT,">$output" or die "Cannot open $output: $!"; |
|
32 |
|
33 my $iapTable = <<END; |
|
34 <IAP operation=\"add\"> |
|
35 <Name>Ethernet WinTAP</Name> |
|
36 <IAPService>LANService.Ethernet WinTAP</IAPService> |
|
37 <IAPBearer>LANBearer.Ethernet WinTAP</IAPBearer> |
|
38 <IAPNetwork>Network.Intranet</IAPNetwork> |
|
39 <IAPNetworkWeighting>0</IAPNetworkWeighting> |
|
40 <LocationRef>Location.Office</LocationRef> |
|
41 </IAP> |
|
42 END |
|
43 |
|
44 my $lanBearerTable = <<END; |
|
45 <LANBearer operation=\"add\"> |
|
46 <Name>Ethernet WinTAP</Name> |
|
47 <Agent>nullagt.agt</Agent> |
|
48 <IfName>ethint</IfName> |
|
49 <LDDFilename>enet</LDDFilename> |
|
50 <LDDName>=Ethernet</LDDName> |
|
51 <PDDFilename>ethertap</PDDFilename> |
|
52 <PDDName>Ethertap.Wins</PDDName> |
|
53 <PacketDriverName>EtherPkt.drv</PacketDriverName> |
|
54 <LastSocketActivityTimeout>-1</LastSocketActivityTimeout> |
|
55 <LastSessionClosedTimeout>-1</LastSessionClosedTimeout> |
|
56 <LastSocketClosedTimeout>-1</LastSocketClosedTimeout> |
|
57 </LANBearer> |
|
58 END |
|
59 |
|
60 my $lanServiceTable = <<END; |
|
61 <LANService operation="add"> |
|
62 <Name>Ethernet WinTAP</Name> |
|
63 <IfNetworks>ip</IfNetworks> |
|
64 <IpNetMask>$ipMask</IpNetMask> |
|
65 <IpGateway>$ipGateway</IpGateway> |
|
66 <IpAddrFromServer>FALSE</IpAddrFromServer> |
|
67 <IpAddr>$ipAddress</IpAddr> |
|
68 <IpDNSAddrFromServer>$IpAddrFromServer</IpDNSAddrFromServer> |
|
69 <IpNameServer1>$ipDNS</IpNameServer1> |
|
70 <IpNameServer2>10.23.58.12</IpNameServer2> |
|
71 <Ip6DNSAddrFromServer>FALSE</Ip6DNSAddrFromServer> |
|
72 </LANService> |
|
73 END |
|
74 |
|
75 my $connectionPreferencesTable = <<END; |
|
76 <ConnectionPreferences operation="add"> |
|
77 <Name>ConnectionPreferencesTable1</Name> |
|
78 <Ranking>1</Ranking> |
|
79 <Direction>OUTGOING</Direction> |
|
80 <BearerSet>LAN</BearerSet> |
|
81 <DialogPref>PROMPT</DialogPref> |
|
82 <IAPRef>IAP.Ethernet WinTAP</IAPRef> |
|
83 </ConnectionPreferences> |
|
84 END |
|
85 |
|
86 while (<INPUT>) |
|
87 { |
|
88 if($writeEnabled == 1) |
|
89 { |
|
90 print OUTPUT; |
|
91 } |
|
92 |
|
93 #add IAPTable |
|
94 if(/<IAPTable>/) |
|
95 { |
|
96 print "<IAPTable> found..."; |
|
97 print OUTPUT $iapTable; |
|
98 print "updated\n"; |
|
99 } |
|
100 |
|
101 #add LANBearerTable |
|
102 if(/<LANBearerTable>/) |
|
103 { |
|
104 print "<LANBearerTable> found..."; |
|
105 print OUTPUT $lanBearerTable; |
|
106 print "updated\n"; |
|
107 } |
|
108 |
|
109 #add LANServiceTable |
|
110 if(/<LANServiceTable>/) |
|
111 { |
|
112 print "<LANServiceTable> found..."; |
|
113 print OUTPUT $lanServiceTable; |
|
114 print "updated\n"; |
|
115 } |
|
116 |
|
117 #add ConnectionPreferencesTable |
|
118 if(/<ConnectionPreferencesTable>/) |
|
119 { |
|
120 $writeEnabled = 0; |
|
121 print "<ConnectionPreferencesTable> found..."; |
|
122 print OUTPUT $connectionPreferencesTable; |
|
123 } |
|
124 |
|
125 if(/<\/ConnectionPreferencesTable>/) |
|
126 { |
|
127 $writeEnabled = 1; |
|
128 print OUTPUT; |
|
129 print "updated\n"; |
|
130 } |
|
131 |
|
132 } |
|
133 |
|
134 close INPUT; |
|
135 close OUTPUT; |