jens@2
|
1 |
//
|
jens@2
|
2 |
// maindocs.h
|
jens@2
|
3 |
// MYNetwork
|
jens@2
|
4 |
//
|
jens@2
|
5 |
// Created by Jens Alfke on 5/24/08.
|
jens@2
|
6 |
// Copyright 2008 Jens Alfke. All rights reserved.
|
jens@2
|
7 |
//
|
jens@2
|
8 |
// This file just contains the Doxygen comments that generate the main (index.html) page content.
|
jens@2
|
9 |
|
jens@2
|
10 |
|
jens@2
|
11 |
/*! \mainpage MYNetwork: Mooseyard Networking library, including BLIP protocol implementation.
|
jens@2
|
12 |
|
jens@4
|
13 |
\section intro_sec Introduction
|
jens@2
|
14 |
|
jens@2
|
15 |
MYNetwork is a set of Objective-C networking classes for Cocoa applications on Mac OS X.
|
jens@2
|
16 |
It consists of:
|
jens@2
|
17 |
<ul>
|
jens@2
|
18 |
<li>Networking utility classes (presently only IPAddress);
|
jens@2
|
19 |
<li>A generic TCP client/server implementation,
|
jens@2
|
20 |
useful for implementing your own network protocols; (see TCPListener and TCPConnection)
|
jens@2
|
21 |
<li>An implementation of BLIP, a lightweight network protocol I've invented as an easy way
|
jens@2
|
22 |
to send request and response messages between peers. (see BLIPListener, BLIPConnection, BLIPRequest, etc.)
|
jens@2
|
23 |
</ul>
|
jens@2
|
24 |
|
jens@2
|
25 |
MYNetwork is released under a BSD license, which means you can freely use it in open-source
|
jens@2
|
26 |
or commercial projects, provided you give credit in your documentation or About box.
|
jens@4
|
27 |
|
jens@4
|
28 |
\section blipdesc What's BLIP?
|
jens@2
|
29 |
|
jens@4
|
30 |
BLIP is a message-oriented network protocol that lets the two peers on either end of a TCP socket send request and response messages to each other. It's a generic protocol, in that the requests and responses can contain any kind of data you like.
|
jens@4
|
31 |
|
jens@4
|
32 |
BLIP was inspired by <a
|
jens@4
|
33 |
href="http://beepcore.org">BEEP</a> (in fact BLIP stands for "BEEP-LIke Protocol") but is
|
jens@4
|
34 |
deliberately simpler and somewhat more limited. That translates to a smaller and cleaner implemenation, especially since it takes advantage of Cocoa's and CFNetwork's existing support for network streams, SSL and Bonjour.
|
jens@4
|
35 |
|
jens@4
|
36 |
\subsection blipfeatures BLIP Features:
|
jens@4
|
37 |
|
jens@4
|
38 |
<ul>
|
jens@4
|
39 |
<li>Each message is very much like a MIME body, as in email or HTTP: it consists of a
|
jens@4
|
40 |
blob of data of arbitrary length, plus a set of key/value pairs called "properties". The
|
jens@4
|
41 |
properties are mostly ignored by BLIP itself, but clients can use them for metadata about the
|
jens@4
|
42 |
body, and for delivery information (i.e. something like BEEP's "profiles".)
|
jens@4
|
43 |
|
jens@4
|
44 |
<li>Either peer can send a request at any time; there's no notion of "client" and "server" roles.
|
jens@4
|
45 |
|
jens@4
|
46 |
<li> Multiple messages can be transmitted simultaneously in the same direction over the same connection, so a very long
|
jens@4
|
47 |
message does not block any other messages from being delivered. This means that message ordering
|
jens@4
|
48 |
is a bit looser than in BEEP or HTTP 1.1: the receiver will see the beginnings of messages in the
|
jens@4
|
49 |
same order in which the sender posted them, but they might not <i>end</i> in that same order. (For
|
jens@4
|
50 |
example, a long message will take longer to be delivered, so it may finish after messages that
|
jens@4
|
51 |
were begun after it.)
|
jens@4
|
52 |
|
jens@4
|
53 |
<li>The sender can indicate whether or not a message needs to be replied to; the response is tagged with the
|
jens@4
|
54 |
identity of the original message, to make it easy for the sender to recognize. This makes it
|
jens@4
|
55 |
straighforward to implement RPC-style (or REST-style) interactions. (Responses
|
jens@4
|
56 |
cannot be replied to again, however.)
|
jens@4
|
57 |
|
jens@4
|
58 |
<li>A message can be flagged as "urgent". Urgent messages are pushed ahead in the outgoing queue and
|
jens@4
|
59 |
get a higher fraction of the available bandwidth.
|
jens@4
|
60 |
|
jens@4
|
61 |
<li>A message can be flagged as "compressed". This runs its body through the gzip algorithm, ideally
|
jens@4
|
62 |
making it faster to transmit. (Common markup-based data formats like XML and JSON compress
|
jens@4
|
63 |
extremely well, at ratios up to 10::1.) The message is decompressed on the receiving end,
|
jens@4
|
64 |
invisibly to client code.
|
jens@4
|
65 |
|
jens@4
|
66 |
<li>The implementation supports SSL connections (with optional client-side certificates), and Bonjour service advertising.
|
jens@4
|
67 |
</ul>
|
jens@4
|
68 |
|
jens@4
|
69 |
\section config Configuration
|
jens@2
|
70 |
|
jens@2
|
71 |
MYNetwork requires Mac OS X 10.5 or later, since it uses Objective-C 2 features like
|
jens@2
|
72 |
properties and for...in loops.
|
jens@2
|
73 |
|
jens@2
|
74 |
MYNetwork uses my <a href="/hg/hgwebdir.cgi/MYUtilities">MYUtilities</a> library. You'll need to have downloaded that library, and added
|
jens@2
|
75 |
the necessary source files and headers to your project. See the MYNetwork Xcode project,
|
jens@2
|
76 |
which contains the minimal set of MYUtilities files needed to build MYUtilities. (That project
|
jens@2
|
77 |
has its search paths set up to assume that MYUtilities is in a directory next to MYNetwork.)
|
jens@2
|
78 |
|
jens@4
|
79 |
\section download How To Get It
|
jens@2
|
80 |
|
jens@2
|
81 |
<ul>
|
jens@4
|
82 |
<li><a href="/hg/hgwebdir.cgi/MYNetwork/archive/tip.zip">Download the current source code</a>
|
jens@2
|
83 |
<li>To check out the source code using <a href="http://selenic.com/mercurial">Mercurial</a>:
|
jens@4
|
84 |
\verbatim hg clone /hg/hgwebdir.cgi/MYNetwork/ MYNetwork \endverbatim
|
jens@4
|
85 |
<li>As described above, you'll also need to download or check out <a href="/hg/hgwebdir.cgi/MYUtilities">MYUtilities</a> and put it in
|
jens@4
|
86 |
a directory next to MYNetwork.
|
jens@2
|
87 |
</ul>
|
jens@2
|
88 |
|
jens@2
|
89 |
Or if you're just looking:
|
jens@2
|
90 |
|
jens@2
|
91 |
<ul>
|
jens@4
|
92 |
<li><a href="/hg/hgwebdir.cgi/MYNetwork/file/tip">Browse the source code</a>
|
jens@2
|
93 |
<li><a href="annotated.html">Browse the class documentation</a>
|
jens@2
|
94 |
</ul>
|
jens@2
|
95 |
|
jens@4
|
96 |
There isn't any conceptual documentation yet, beyond what's in the API docs, but you can
|
jens@4
|
97 |
<a href="/hg/hgwebdir.cgi/MYNetwork/file/tip/BLIP/Demo/">look
|
jens@4
|
98 |
at the sample BLIPEcho client and server</a>, which are based on Apple's
|
jens@4
|
99 |
<a href="http://developer.apple.com/samplecode/CocoaEcho/index.html">CocoaEcho</a> sample code.
|
jens@4
|
100 |
|
jens@2
|
101 |
*/
|