Nt1310 Unit 5 Lab Assignment

888 Words 4 Pages
CPSC 558 — Adv Networking — Lab Assignment – Simple Data Link
A1: Simple Data Link
Introduction
Build one data line between two nodes, that can send and receive a text string of ‘1’s and ‘0’s. We transmit the string "10010" in one direction and reply with the string "01101".
Implementation Language: C++ (or C) Implementation Structure
A Link class that has several fcns (methods).
1. A name() fcn, which returns the Link object's name string (eg, assigned during object construction).
2. An attach() fcn, which takes and a Node pointer and installs that pointer as a member of the link, and returns an ID int for that node pointer. A link can hold up to constant KNODES_SIZE such node pointers. If there is no more room, then do nothing and return -1. For
…show more content…
A name() fcn, which returns the Node object's name string (eg, assigned during object construction).
2. An attach() fcn, which takes and a Link pointer and installs that pointer as connected to the node, and returns an ID int for that link pointer. A node can hold up to constant KLINKS_SIZE such link pointers. If there is no more room, then do nothing and return -1. For LLA1, that size should be 1. ID ints should be assigned starting from 0, counting upward.
3. A contents() fcn, which outputs each currently attached link pointer value in hex, prefaced by its ID. Eg, “0: L”.
4. rcv() fcn, which will store the passed string argument internally. The fcn will also output the string (message) prefaced by "Node rcvd: ", where is the node object's name. Eg, “ Node B rcvd: 10010”.
5. An snd() fcn, which takes a binary text string and an ID int (for a link pointer), and passes that string to the xmt() fcn of the link object. If it turns out that there is no attached link for that ID, then also output an error message. The fcn will also output the string (message) prefaced by
"Node sent: ", where is the node object's name.
C. Siska February 18, 2016 Page 1 of 2
CPSC 558 — Adv Networking — Lab Assignment – Simple Data

Related Documents