Click here to Skip to main content
16,005,181 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Stupid Questions on C++ .NET Pin
Serge Krynine22-Mar-05 22:13
Serge Krynine22-Mar-05 22:13 
GeneralRe: Stupid Questions on C++ .NET Pin
Ravi Bhavnani23-Mar-05 2:45
professionalRavi Bhavnani23-Mar-05 2:45 
GeneralRe: Stupid Questions on C++ .NET Pin
Anonymous23-Mar-05 4:51
Anonymous23-Mar-05 4:51 
GeneralCannot allocate memory with malloc?! Pin
Dani10000122-Mar-05 8:25
Dani10000122-Mar-05 8:25 
GeneralRe: Cannot allocate memory with malloc?! Pin
Chris Losinger22-Mar-05 8:55
professionalChris Losinger22-Mar-05 8:55 
GeneralRe: Cannot allocate memory with malloc?! Pin
Dani10000122-Mar-05 9:53
Dani10000122-Mar-05 9:53 
GeneralRe: Cannot allocate memory with malloc?! Pin
toxcct22-Mar-05 21:19
toxcct22-Mar-05 21:19 
GeneralNeed help to get started on it Pin
Tahito22-Mar-05 7:53
Tahito22-Mar-05 7:53 
I pasted my assignment on the bottom of my post. Basically I know a little bit on how to program but I dont know how to work with the IP addresses as variables. I have the algorithm but i just don't know how I can put it into form. If someone can please help me out with that, i'll really appreciate it. Another thing is I dont know how to do BINARY AND with the input IP address and the subnet mask. It's a really short program.

::Algorithm::
Router forwarding algorithm:
Extract netid from datagram's destination IP address
If (netid is for a directly connected network)
deliver it
Else if (table contains a next hop for netid)
send datagram to next hop
Else if (table contains a default route)
send datagram to default router
Else
error


::::Instructions:::

Write a program that simulates a 5 interface IP router using CIDR addressing.
To simplify the program, assume traffic flows in one direction only - all
traffic will enter port A and will be routed to ports B, C, D or E.

The program should prompt the user to enter an IP address in dotted decimal
notation. Your program should then consult the routing table and display the
input IP address, the next hop IP address in dotted decimal notation, and the
output port. Your program should continue in this manner until the user
decides to quit.

Routing Table

Destination Next Hop Port

128.6.30.0/24 192.200.5.11 B
33.33.32.0/24 192.150.7.21 C
40.33.101.0/24 192.180.45.3 E
50.60.70.0/24 135.200.2.11 D
45.45.4.0/24 192.200.5.11 B
150.7.200.0/22 192.200.5.11 B
130.3.4.0/22 135.200.2.11 D
250.123.192.0/20 192.180.45.3 E
128.235.0.0/16 192.200.5.11 B
30.0.0.0/8 192.150.7.21 C
0.0.0.0/0 192.150.7.21 C

Design Requirements

Your program must convert the input IP address to binary and AND it with the
masks in the routing table. Any other approach will result in points being
taken off.

The information in the routing table should be hard-coded into your program.
You may use any convenient format to represent the information .

There are no specific requirements on the user interface - either a console
application or a graphical interface is acceptable.

I prefer that you use the C, C++, or Java language, but you may propose using
another. You may use any compiler/development environment as long as I am
able to run your program on a PC running Windows XP.
GeneralRe: Need help to get started on it Pin
Christian Graus22-Mar-05 14:15
protectorChristian Graus22-Mar-05 14:15 
GeneralRe: Need help to get started on it Pin
Tahito23-Mar-05 2:07
Tahito23-Mar-05 2:07 
GeneralQuery builder Pin
WildWildWind22-Mar-05 7:00
WildWildWind22-Mar-05 7:00 
GeneralQuestion About Mobile App Pin
Leyu22-Mar-05 6:21
Leyu22-Mar-05 6:21 
GeneralRe: Question About Mobile App Pin
toxcct22-Mar-05 21:12
toxcct22-Mar-05 21:12 
QuestionCan we displaying a form as a dialog? Pin
Santanu Lahiri22-Mar-05 6:05
Santanu Lahiri22-Mar-05 6:05 
AnswerRe: Can we displaying a form as a dialog? Pin
Ravi Bhavnani23-Mar-05 2:49
professionalRavi Bhavnani23-Mar-05 2:49 
GeneralSysTray Icon Pin
Menny Even Danan22-Mar-05 5:58
Menny Even Danan22-Mar-05 5:58 
GeneralRe: SysTray Icon Pin
David Crow22-Mar-05 7:22
David Crow22-Mar-05 7:22 
GeneralRe: SysTray Icon Pin
Menny Even Danan22-Mar-05 20:36
Menny Even Danan22-Mar-05 20:36 
GeneralWave File Manipulation Pin
RedDragon2k22-Mar-05 5:51
RedDragon2k22-Mar-05 5:51 
GeneralClipping a Dialog Window Pin
sweep12322-Mar-05 5:45
sweep12322-Mar-05 5:45 
Generalpc to cash register Pin
yunuskajee22-Mar-05 4:09
yunuskajee22-Mar-05 4:09 
GeneralRe: pc to cash register Pin
Renjith Ramachandran22-Mar-05 22:25
Renjith Ramachandran22-Mar-05 22:25 
GeneralRe: pc to cash register Pin
Cerebro91119-Mar-09 22:54
Cerebro91119-Mar-09 22:54 
GeneralSetting Default Soundcard Pin
peterchen22-Mar-05 3:34
peterchen22-Mar-05 3:34 
GeneralRe: Setting Default Soundcard Pin
Mircea Puiu22-Mar-05 4:36
Mircea Puiu22-Mar-05 4:36 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.