DOC PREVIEW
USF CS 635 - A RealTek Application

This preview shows page 1-2-3-4-5 out of 14 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 14 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 14 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 14 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 14 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 14 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 14 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

A RealTek ApplicationOur ‘rxplustx.c’ driverOur ‘arpquery.cpp’ programSlide 4Slide 5Format for ARP FramesTerminal ‘line graphics’Uniform terminal interfaceHow ‘terminfo’ is usedLine-graphic character-codesSpecial terminal effectsSlide 13In-class exerciseA RealTek ApplicationUsing our own device-driver and a standard networking protocol to discover the ‘active’ workstationsOur ‘rxplustx.c’ driveropenreadwritemy_fopsioctl my_ioctl() my_open() my_read() my_write() my_release() my_isr() init_module() cleanup_module()releaseOur ‘arpquery.cpp’ programOpens device-fileGets netaddressthen forksInstalls a signal-handlerWhile-loopreceives ARP repliesuntil signaled parent-process child-processFor-looptransmitsARP requestto all stationson local networkthen signals parentand exitsARP requestA BC D ErequestStation ‘A’ wants to know the Ethernet Address for station ‘B’So ‘A’ broadcasts an ARP request-packet to all other stationsARP replyA BC D EreplyStation ‘B’ recognizes that the request is for its Ethernet Address. So ‘B’ replies directly to ‘A’, and other stations ignore the request.Format for ARP FramesSource MAC address0x0806PTYPE0x0800HLEN0x06PLEN0x04ARPcommandSource hardware addressSourceprotocol addressDestinationhardware addressDestination protocol addressDestination MAC addressHTYPE0x0001Legend: ARP commands (0x0001=request, 0x0002=reply)‘roomview.cpp’8 9 10 15 16 17 18 19 20 28 29 304 5 6 7 11 12 13 14 24 25 26 271 2 3 21 22 23Terminal ‘line graphics’ •Most text-mode terminals can draw ‘boxes’ by using an ‘alternate character set’ which includes the so-called ‘line graphic’ glyphs: Upper-Left: ┌ Upper-Right: ┐Horizontal-bar: ─ Vertical-bar: │Lower-left: └ Lower-right: ┘┌───────────────┐└───────────────┘Uniform terminal interface•Because terminal hardware may differ, we need a standard software interface to get the same desired effects on all platforms•UNIX programming environments offer a long-established mechanism for doing this •Need this header-file: #include <term.h>•Need linkage with ‘ncurses’ function-libraryHow ‘terminfo’ is used•Initialize with the ‘setupterm()’ function•Extract your terminal’s parameters (e.g., numbers or special control-strings) using the functions ‘tigetnum()’ and ‘tigetstr()’•Parametrize control-strings with ‘tparm()’•Output these control-strings with ‘putp()’•Our ‘roomview.cpp’ demonstrates theseLine-graphic character-codes•Your terminal’s mapping of the numbers for the line-graphics glyphs can be found by a string-search of terminfo’s database •This is illustrated in our ‘roomview’ demo•Examples:char *acsc = tigetstr( “acsc” );char HZ = strchr( acsc, ‘q’ )[ 1 ];char VT = strchr( scsc, ‘x’ )[ 1 ];Special terminal effects•You can enable (or disable) use of glyphs from the terminal’s alternate character set, by using special control-sequences: ‘smacs’ and ‘rmacs’•You can put the cursor where you want it, by outputting a special control-sequence: ‘cup’•You can draw characters in ‘reverse-video’, by outputting a special control-sequence: ‘rev’•You can draw characters in ‘normal’ mode, by outputting a special control-sequence: ‘sgr0’‘roomview.cpp’8 9 10 15 16 17 18 19 20 28 29 304 5 6 7 11 12 13 14 24 25 26 271 2 3 21 22 23In-class exercise•Combine the programming ideas used in ‘roomview.cpp’ and ‘arpquery.cpp’ so you get a view of all the Kudlick Classroom’s workstations, but with those that sent ARP reply-packets shown with ‘reverse-video’ so as to highlight their presence


View Full Document

USF CS 635 - A RealTek Application

Download A RealTek Application
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view A RealTek Application and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view A RealTek Application 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?