
C++ Application Converting to DLL (Network Knowledge Required)
5222
£350(approx. $471)
- Posted:
- Proposals: 2
- Remote
- #123958
- Archived
Description
Experience Level: Expert
Internet Gateway Project
Requirements
Convert the sample application provided (written in C) into a DLL that can be started and interfaced with from a .NET windows application.
The existing sample application allows users on the client network to access the internet via Network Address Translation (NAT) .
This application needs to be modified to allow traffic to be filtered and redirected under certain circumstances.
You will be dealing with raw packets passing over the gateway and will have to find a way of checking the source address. If a client who is not allowed attempts to access the internet eg.: http://www.google.co.uk/ then the associated packets must be dropped and a new packet sent back to the client that redirects the client's browser to a portal page.
The process
1. A client connects a new computer to the client side of the network. They attempt to browse the internet however they are redirected to a welcome screen hosted at eg.: http://10.0.0.1/portal.aspx
This is achieved by sending a HTTP 302 header to the client.
HTTP/1.1 302 Found
Location: http://10.0.0.1/portal.aspx
2. The portal.aspx page will have the relevant forms etc. to allow a user to sign in. (these will be created by me)
3. Signing in will trigger the AddClient method (described below) passing in the client's MAC address.
4. The client will then be informed via html page that they can now access the internet.
5. Subsequent requests will not be redirected until the RemoveClient method is called.
Note: No html pages will need to be created by you.
I will simply require a way to invoke the methods such as AddClient from a .NET application. (a simple console app will be sufficient to test this)
Methods that need to be available to .NET
SetProviderAdapter(macAddress as String)
Sets the provider network adapter, identified by its MAC address on the local system.
This method sets a variable that is used later by the NAT server thread.
SetClientAdapter(macAddress as String)
Sets the client network adapter, identified by its MAC address on the local system.
This method sets a variable that is used later by the NAT server thread.
Note: The client network adapter will provide clients with a gateway to the internet.
SetRedirectURL(strURL as String)
Sets the URL that HTTP requests from unknown clients are redirected to via a 301 location redirect. E.g.: SetRedirectURL(“http://10.0.0.1/portal.aspx”)
AddAllowedURL(strURL as String)
This method adds a new URL to a hash table of allowed URLs. Unknown clients are not redirected when accessing any of the URLs contained in the hashtable. This could be called multiple times for multiple URLs.
StartNATServer() As Boolean
Calling this method starts the Network Address Translation thread and returns True if start was successful.
StopNATServer() As Boolean
Calling this method stops the Network Address Translation thread and returns True if stop was successful.
AddClient(strMacAddress as String) As Boolean
This method adds a new MAC address to a hash table of allowed clients.
Clients accessing the internet via NAT are not redirected to the redirect URL if the source MAC address exists in the hash table.
RemoveClient(strMacAddress as String) As Boolean
This method removes any MAC address that exists in the hash table of allowed clients, that matches the MAC address. If the client then accesses the internet, they will be redirected as before.
GetClients() As String()
This method returns a string array of MAC addresses that currently exist in the hash table of allowed clients.
To Do:
1. Create a test environment. You will need a PC running windows server 2003/2008 with 2 network adapters. The first adapter will be connected to the internet, the other will provide clients with a gateway to the internet. You will need a PC/laptop connected to the client side in order to test.
2. Remove the existing user interface (forms etc.) and implement the methods described above to configure/start/stop the NAT service thread.
3. The NAT thread needs to remain running within the DLL whilst the .NET application is running.
4. Modify the code so that there is virtually no impact performance for verifying if a client has been granted access or not.
5. Modify the code so that new clients can be added and removed without the need to restart the NAT thread or interrupt other traffic passing over the gateway.
6. All internet bound traffic must be dropped for clients that do not exist in the clients hash table. Once they have been added into the hash table, packets are then forwarded and HTTP requests on port 80 are no longer sent to the redirect URL.
Requirements
Convert the sample application provided (written in C) into a DLL that can be started and interfaced with from a .NET windows application.
The existing sample application allows users on the client network to access the internet via Network Address Translation (NAT) .
This application needs to be modified to allow traffic to be filtered and redirected under certain circumstances.
You will be dealing with raw packets passing over the gateway and will have to find a way of checking the source address. If a client who is not allowed attempts to access the internet eg.: http://www.google.co.uk/ then the associated packets must be dropped and a new packet sent back to the client that redirects the client's browser to a portal page.
The process
1. A client connects a new computer to the client side of the network. They attempt to browse the internet however they are redirected to a welcome screen hosted at eg.: http://10.0.0.1/portal.aspx
This is achieved by sending a HTTP 302 header to the client.
HTTP/1.1 302 Found
Location: http://10.0.0.1/portal.aspx
2. The portal.aspx page will have the relevant forms etc. to allow a user to sign in. (these will be created by me)
3. Signing in will trigger the AddClient method (described below) passing in the client's MAC address.
4. The client will then be informed via html page that they can now access the internet.
5. Subsequent requests will not be redirected until the RemoveClient method is called.
Note: No html pages will need to be created by you.
I will simply require a way to invoke the methods such as AddClient from a .NET application. (a simple console app will be sufficient to test this)
Methods that need to be available to .NET
SetProviderAdapter(macAddress as String)
Sets the provider network adapter, identified by its MAC address on the local system.
This method sets a variable that is used later by the NAT server thread.
SetClientAdapter(macAddress as String)
Sets the client network adapter, identified by its MAC address on the local system.
This method sets a variable that is used later by the NAT server thread.
Note: The client network adapter will provide clients with a gateway to the internet.
SetRedirectURL(strURL as String)
Sets the URL that HTTP requests from unknown clients are redirected to via a 301 location redirect. E.g.: SetRedirectURL(“http://10.0.0.1/portal.aspx”)
AddAllowedURL(strURL as String)
This method adds a new URL to a hash table of allowed URLs. Unknown clients are not redirected when accessing any of the URLs contained in the hashtable. This could be called multiple times for multiple URLs.
StartNATServer() As Boolean
Calling this method starts the Network Address Translation thread and returns True if start was successful.
StopNATServer() As Boolean
Calling this method stops the Network Address Translation thread and returns True if stop was successful.
AddClient(strMacAddress as String) As Boolean
This method adds a new MAC address to a hash table of allowed clients.
Clients accessing the internet via NAT are not redirected to the redirect URL if the source MAC address exists in the hash table.
RemoveClient(strMacAddress as String) As Boolean
This method removes any MAC address that exists in the hash table of allowed clients, that matches the MAC address. If the client then accesses the internet, they will be redirected as before.
GetClients() As String()
This method returns a string array of MAC addresses that currently exist in the hash table of allowed clients.
To Do:
1. Create a test environment. You will need a PC running windows server 2003/2008 with 2 network adapters. The first adapter will be connected to the internet, the other will provide clients with a gateway to the internet. You will need a PC/laptop connected to the client side in order to test.
2. Remove the existing user interface (forms etc.) and implement the methods described above to configure/start/stop the NAT service thread.
3. The NAT thread needs to remain running within the DLL whilst the .NET application is running.
4. Modify the code so that there is virtually no impact performance for verifying if a client has been granted access or not.
5. Modify the code so that new clients can be added and removed without the need to restart the NAT thread or interrupt other traffic passing over the gateway.
6. All internet bound traffic must be dropped for clients that do not exist in the clients hash table. Once they have been added into the hash table, packets are then forwarded and HTTP requests on port 80 are no longer sent to the redirect URL.
Dan L.
100% (1)Projects Completed
1
Freelancers worked with
1
Projects awarded
0%
Last project
13 Aug 2014
United Kingdom
New Proposal
Login to your account and send a proposal now to get this project.
Log inClarification Board Ask a Question
-
There are no clarification messages.
We collect cookies to enable the proper functioning and security of our website, and to enhance your experience. By clicking on 'Accept All Cookies', you consent to the use of these cookies. You can change your 'Cookies Settings' at any time. For more information, please read ourCookie Policy
Cookie Settings
Accept All Cookies