URGENT: Simulation of computer network using Container classes
Posted on 2003-11-22
I am just starting to learn some C++ programming and would really appreciate some help from you experts *****
The program I am trying to work with will need to perform a simulation of a computer network. The network is represented as a class called comp_network. I am planning to declare this as a container class. This network supports an unlimited number of users and provides password security. It also contains functions to allow you to log-on and log-off of the system, and a way of shutting the network down.
Although this class is simulating a network with this program, there is no reason this class couldn't serve as a front end to a real network. In this capacity, the class could serve as an interface to the network for other computers on the local network. We could then write functions such as check_passwd() and logon() to provide hooks into the real network. Security issues aside, my goal is to make such information private so that the interface to the network doesn't have to change if the implementation details change.
Some things I want this code to do is -->
1. at object creation only 1 user is known, in UNIX this is the superuser called root.
2. this user can add new users, delete users, and print lists of users.
3. I also would like to add new users to the system, with both names and passwords
4. I would like to supply a dummy command interface routine that just accepts commands, but doesn't do anything but print a "Finished with <command>" message. This must understand "logoff"
5. need to store a list that is dynamic, it grows with new users and shrinks when they are deleted. Don't need to store this list from program invocation to invocation. Everytime the program is restarted it will only have the original users.
6. logoff will be the command to exit from the simulated dummy command interface session. This brings you back to the user name prompt.
7. a username of done will terminate the program.
I was wondering if the code could utilize the main program given below. My idea was to declare a CONTAINER CLASS called "comp_network" and another class called "user".
cplusplus.install(); // installs known users/passwords
cplusplus.operate_net(); //prints opening message
//and prompts for user and
//password, then goes into
//the command loop
// a username of "done" will
// finish the program
**** I would really appreciate it if some one could help me with some coding for this..as I am just getting the feel of C++ now..thanks a lot