home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / unix / volume26 / mcast / part01 < prev    next >
Encoding:
Text File  |  1993-04-05  |  108.1 KB  |  3,082 lines

  1. Newsgroups: comp.sources.unix
  2. From: casey@gauss.llnl.gov (Casey Leedom)
  3. Subject: v26i105: mcast - LLNL IP multicast implementation, V1.2.3, Part01/04
  4. Sender: unix-sources-moderator@vix.com
  5. Approved: paul@vix.com
  6.  
  7. Submitted-By: casey@gauss.llnl.gov (Casey Leedom)
  8. Posting-Number: Volume 26, Issue 105
  9. Archive-Name: mcast/part01
  10.  
  11. WHAT IS LLNL MCAST?:
  12.  
  13.     The LLNL MCAST software is an experimental implementation of a
  14.     multicast communication system.  It allows applications to communicate
  15.     in a broadcast-like manner with other applications.  Multicast would
  16.     typically be used by the parts of a distributed application.
  17.  
  18.     The system consists of an application programming interface (API)
  19.     modeled on the Berkeley socket abstraction, a communications server,
  20.     and a complete set of manual pages.
  21.  
  22.     The communication server implements the multicast message passing
  23.     semantics.  A version of the system which uses network level multicast
  24.     facilities is planned, but we needed something up and running quickly
  25.     so other members of our project team could proceed with their work.
  26.     Hence, this version.  Our goal is to be able to slip in a true
  27.     multicast implementation using the same API under our applications
  28.     without the applications noticing the difference ...
  29.  
  30. WHERE TO SEND CORRESPONDENCE:
  31.  
  32.     If you have bug reports, fixes, suggestions, or just want to talk about
  33.     the software, address your correspondence to:
  34.  
  35.         Casey Leedom
  36.         Mail Stop: L-287
  37.         Lawrence Livermore National Laboratory
  38.         Livermore, CA
  39.         USA
  40.  
  41.         email: casey@gauss.llnl.gov
  42.         phone: (USA) 510-423-7775
  43.  
  44. #! /bin/sh
  45. # This is a shell archive.  Remove anything before this line, then unpack
  46. # it by saving it into a file and typing "sh file".  To overwrite existing
  47. # files, type "sh file -c".  You can also feed this as standard input via
  48. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  49. # will see the following message at the end:
  50. #        "End of archive 1 (of 4)."
  51. # Contents:  MANIFEST MEMO Makefile Makefile.tmpl PATCHLEVEL README
  52. #   TODO config config/Makefile.config config/Makefile.std doc
  53. #   doc/Makefile doc/Makefile.tmpl include include/netmcast
  54. #   include/netmcast/Makefile include/netmcast/Makefile.tmpl
  55. #   include/netmcast/mcastd.h libmcast libmcast/Makefile
  56. #   libmcast/Makefile.tmpl libmcast/_mc_state.c libmcast/mc_close.c
  57. #   libmcast/mc_getpeername.c libmcast/mc_getsockname.c
  58. #   libmcast/mc_getsockopt.c libmcast/mc_ioctl.c libmcast/mc_read.c
  59. #   libmcast/mc_readv.c libmcast/mc_recv.c libmcast/mc_recvfrom.c
  60. #   libmcast/mc_send.c libmcast/mc_setsockopt.c libmcast/mc_shutdown.c
  61. #   libmcast/mc_write.c libmcast/mc_writev.c man man/Makefile
  62. #   man/Makefile.tmpl man/mc_close.2 man/mc_shutdown.2 mcastd
  63. #   mcastd/Makefile mcastd/Makefile.tmpl test test/Makefile
  64. #   test/Makefile.tmpl test/mc_hello.c
  65. # Wrapped by vixie@gw.home.vix.com on Tue Apr  6 12:49:43 1993
  66. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  67. if test -f 'MANIFEST' -a "${1}" != "-c" ; then 
  68.   echo shar: Will not clobber existing file \"'MANIFEST'\"
  69. else
  70. echo shar: Extracting \"'MANIFEST'\" \(2761 characters\)
  71. sed "s/^X//" >'MANIFEST' <<'END_OF_FILE'
  72. X   File Name        Archive #    Description
  73. X-----------------------------------------------------------
  74. X ABSTRACT                   3    
  75. X MANIFEST                   1    This shipping list
  76. X MEMO                       1    
  77. X Makefile                   1    
  78. X Makefile.tmpl              1    
  79. X PATCHLEVEL                 1    
  80. X README                     1    
  81. X TODO                       1    
  82. X config                     1    
  83. X config/Makefile.config     1    
  84. X config/Makefile.std        1    
  85. X doc                        1    
  86. X doc/Makefile               1    
  87. X doc/Makefile.tmpl          1    
  88. X doc/cover.me               3    
  89. X doc/notes.me               4    
  90. X include                    1    
  91. X include/netmcast           1    
  92. X include/netmcast/Makefile  1    
  93. X include/netmcast/Makefile.tmpl  1    
  94. X include/netmcast/mcast.h   3    
  95. X include/netmcast/mcastd.h  1    
  96. X libmcast                   1    
  97. X libmcast/Makefile          1    
  98. X libmcast/Makefile.tmpl     1    
  99. X libmcast/_mc_read.c        3    
  100. X libmcast/_mc_state.c       1    
  101. X libmcast/_mc_write.c       2    
  102. X libmcast/mc_bind.c         2    
  103. X libmcast/mc_close.c        1    
  104. X libmcast/mc_connect.c      2    
  105. X libmcast/mc_fcntl.c        2    
  106. X libmcast/mc_getpeername.c  1    
  107. X libmcast/mc_getsockname.c  1    
  108. X libmcast/mc_getsockopt.c   1    
  109. X libmcast/mc_ioctl.c        1    
  110. X libmcast/mc_lib.h          2    
  111. X libmcast/mc_read.c         1    
  112. X libmcast/mc_readv.c        1    
  113. X libmcast/mc_recv.c         1    
  114. X libmcast/mc_recvfrom.c     1    
  115. X libmcast/mc_send.c         1    
  116. X libmcast/mc_sendto.c       2    
  117. X libmcast/mc_setsockopt.c   1    
  118. X libmcast/mc_shutdown.c     1    
  119. X libmcast/mc_socket.c       2    
  120. X libmcast/mc_write.c        1    
  121. X libmcast/mc_writev.c       1    
  122. X libmcast/mcast_getgroupbyname.c  2    
  123. X libmcast/mcast_newaddr.c   2    
  124. X libmcast/mcast_sopen.c     2    
  125. X man                        1    
  126. X man/Makefile               1    
  127. X man/Makefile.tmpl          1    
  128. X man/mc_bind.2              2    
  129. X man/mc_close.2             1    
  130. X man/mc_connect.2           2    
  131. X man/mc_fcntl.2             2    
  132. X man/mc_getpeername.2       2    
  133. X man/mc_getsockname.2       2    
  134. X man/mc_getsockopt.2        3    
  135. X man/mc_ioctl.2             2    
  136. X man/mc_read.2              3    
  137. X man/mc_recv.2              3    
  138. X man/mc_send.2              3    
  139. X man/mc_shutdown.2          1    
  140. X man/mc_socket.2            3    
  141. X man/mc_write.2             2    
  142. X man/mcast.4                3    
  143. X man/mcast_getgroupbyname.3  2    
  144. X man/mcast_newaddr.3        3    
  145. X man/mcast_sopen.3          3    
  146. X man/mcastd.8               3    
  147. X mcastd                     1    
  148. X mcastd/Makefile            1    
  149. X mcastd/Makefile.tmpl       1    
  150. X mcastd/mcastd.c            4    
  151. X test                       1    
  152. X test/Makefile              1    
  153. X test/Makefile.tmpl         1    
  154. X test/mc_clock.c            2    
  155. X test/mc_hello.c            1    
  156. X test/mc_listen.c           2    
  157. X test/mc_ping.c             3    
  158. X test/mc_send.c             2    
  159. END_OF_FILE
  160. if test 2761 -ne `wc -c <'MANIFEST'`; then
  161.     echo shar: \"'MANIFEST'\" unpacked with wrong size!
  162. fi
  163. # end of 'MANIFEST'
  164. fi
  165. if test -f 'MEMO' -a "${1}" != "-c" ; then 
  166.   echo shar: Will not clobber existing file \"'MEMO'\"
  167. else
  168. echo shar: Extracting \"'MEMO'\" \(1074 characters\)
  169. sed "s/^X//" >'MEMO' <<'END_OF_FILE'
  170. X                        Thursday, January 11, 1992
  171. X
  172. To: Marliss Rash
  173. X
  174. XFrom: Leith (Casey) Leedom
  175. X
  176. Regarding: Memo of understanding for release of ``MCAST'' software
  177. X
  178. X
  179. Marliss,
  180. X
  181. You asked me to tell you why I want do an unrestricted release of the
  182. MCAST multicast testbed software I developed.  There are two fundamental
  183. reasons:
  184. X
  185. X    1.    My software software is simple enough that it will allow people to
  186. X    experiment with multicast concepts without getting bogged down in
  187. X    one of the already existing multicast packages.  Those existing
  188. X    packages are all enormous and complicated -- although far more
  189. X    sophisticated and more complete than my package.
  190. X
  191. X    Because of the large amount of startup effort needed to use
  192. X    existing packages, there isn't a widespread general interest in
  193. X    multicast.  Thus, I think that distributing my software will
  194. X    benefit the network research community by exposing more people to
  195. X    multicast concepts.
  196. X
  197. X    2.    This is the equivalent of publishing a paper for me.  It will
  198. X    gain me recognition and advance my career.
  199. X
  200. X
  201. X                    Yours sincerely,
  202. X
  203. X                    Leith (Casey) Leedom
  204. END_OF_FILE
  205. if test 1074 -ne `wc -c <'MEMO'`; then
  206.     echo shar: \"'MEMO'\" unpacked with wrong size!
  207. fi
  208. # end of 'MEMO'
  209. fi
  210. if test -f 'Makefile' -a "${1}" != "-c" ; then 
  211.   echo shar: Will not clobber existing file \"'Makefile'\"
  212. else
  213. echo shar: Extracting \"'Makefile'\" \(597 characters\)
  214. sed "s/^X//" >'Makefile' <<'END_OF_FILE'
  215. X#
  216. X# $Header: /u0/casey/src/mcast/RCS/Makefile,v 1.1 92/10/16 18:21:06 casey Exp $
  217. X#
  218. X
  219. X          TOP = .
  220. X       CURDIR = .
  221. X
  222. X.DEFAULT:
  223. X    @$(MAKE) $(MFLAGS) TOP="$(TOP)" CURDIR="$(CURDIR)" \
  224. X        -f $(TOP)/config/Makefile.config \
  225. X        -f ./Makefile.tmpl \
  226. X        -f $(TOP)/config/Makefile.std \
  227. X        $@
  228. X
  229. X.c.o:
  230. X    @$(MAKE) $(MFLAGS) TOP="$(TOP)" CURDIR="$(CURDIR)" \
  231. X        -f $(TOP)/config/Makefile.config \
  232. X        -f ./Makefile.tmpl \
  233. X        -f $(TOP)/config/Makefile.std \
  234. X        $@
  235. X
  236. all:
  237. X    @$(MAKE) $(MFLAGS) TOP="$(TOP)" CURDIR="$(CURDIR)" \
  238. X        -f $(TOP)/config/Makefile.config \
  239. X        -f ./Makefile.tmpl \
  240. X        -f $(TOP)/config/Makefile.std
  241. END_OF_FILE
  242. if test 597 -ne `wc -c <'Makefile'`; then
  243.     echo shar: \"'Makefile'\" unpacked with wrong size!
  244. fi
  245. # end of 'Makefile'
  246. fi
  247. if test -f 'Makefile.tmpl' -a "${1}" != "-c" ; then 
  248.   echo shar: Will not clobber existing file \"'Makefile.tmpl'\"
  249. else
  250. echo shar: Extracting \"'Makefile.tmpl'\" \(435 characters\)
  251. sed "s/^X//" >'Makefile.tmpl' <<'END_OF_FILE'
  252. X#
  253. X# $Header: /u0/casey/src/mcast/RCS/Makefile.tmpl,v 1.1 92/10/16 18:21:14 casey Exp $
  254. X#
  255. X      SUBDIRS = doc include/netmcast libmcast mcastd man test
  256. X
  257. X.DEFAULT:
  258. X    @set +x; \
  259. X    for i in $(SUBDIRS); do \
  260. X        (cd $$i; echo "Doing " $@ " in " $$i " ..."; \
  261. X         $(MAKE) $(MFLAGS) DESTDIR="$(DESTDIR)" $@); \
  262. X    done
  263. X
  264. all: $(SUBDIRS)
  265. X
  266. X$(SUBDIRS): FRC
  267. X    @set +x; \
  268. X    (cd $@; echo "Making in $@ ..."; \
  269. X     $(MAKE) $(MFLAGS) DESTDIR="$(DESTDIR)")
  270. X
  271. XFRC:
  272. END_OF_FILE
  273. if test 435 -ne `wc -c <'Makefile.tmpl'`; then
  274.     echo shar: \"'Makefile.tmpl'\" unpacked with wrong size!
  275. fi
  276. # end of 'Makefile.tmpl'
  277. fi
  278. if test -f 'PATCHLEVEL' -a "${1}" != "-c" ; then 
  279.   echo shar: Will not clobber existing file \"'PATCHLEVEL'\"
  280. else
  281. echo shar: Extracting \"'PATCHLEVEL'\" \(33 characters\)
  282. sed "s/^X//" >'PATCHLEVEL' <<'END_OF_FILE'
  283. version 1
  284. release 2
  285. patchlevel 3
  286. END_OF_FILE
  287. if test 33 -ne `wc -c <'PATCHLEVEL'`; then
  288.     echo shar: \"'PATCHLEVEL'\" unpacked with wrong size!
  289. fi
  290. # end of 'PATCHLEVEL'
  291. fi
  292. if test -f 'README' -a "${1}" != "-c" ; then 
  293.   echo shar: Will not clobber existing file \"'README'\"
  294. else
  295. echo shar: Extracting \"'README'\" \(9246 characters\)
  296. sed "s/^X//" >'README' <<'END_OF_FILE'
  297. X$Header: /u0/casey/src/mcast/RCS/README,v 1.3 93/01/21 09:37:37 casey Exp $
  298. X
  299. X
  300. X          INSTALLATION NOTES ON THE LLNL MCAST DISTRIBUTION
  301. X
  302. X
  303. X Copyright (c) 1992 The Regents of the University of California.
  304. X All rights reserved.
  305. X
  306. X Redistribution and use in source and binary forms, with or without
  307. X modification, are permitted provided that the following conditions
  308. X are met:
  309. X 1. Redistributions of source code must retain the above copyright
  310. X    notice, this list of conditions and the following disclaimer.
  311. X 2. Redistributions in binary form must reproduce the above copyright
  312. X    notice, this list of conditions and the following disclaimer in the
  313. X    documentation and/or other materials provided with the distribution.
  314. X 3. All advertising materials mentioning features or use of this software
  315. X    must display the following acknowledgement:
  316. X    This product includes software developed by the University of
  317. X    California, Lawrence Livermore National Laboratory and its
  318. X    contributors.
  319. X 4. Neither the name of the University nor the names of its contributors
  320. X    may be used to endorse or promote products derived from this software
  321. X    without specific prior written permission.
  322. X
  323. X THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  324. X ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  325. X IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  326. X ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  327. X FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  328. X DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  329. X OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  330. X HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  331. X LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  332. X OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  333. X SUCH DAMAGE.
  334. X
  335. X
  336. WHAT IS LLNL MCAST?:
  337. X
  338. X    The LLNL MCAST software is an experimental implementation of a
  339. X    multicast communication system.  It allows applications to communicate
  340. X    in a broadcast-like manner with other applications.  Multicast would
  341. X    typically be used by the parts of a distributed application.
  342. X
  343. X    The system consists of an application programming interface (API)
  344. X    modeled on the Berkeley socket abstraction, a communications server,
  345. X    and a complete set of manual pages.
  346. X
  347. X    The communication server implements the multicast message passing
  348. X    semantics.  A version of the system which uses network level multicast
  349. X    facilities is planned, but we needed something up and running quickly
  350. X    so other members of our project team could proceed with their work.
  351. X    Hence, this version.  Our goal is to be able to slip in a true
  352. X    multicast implementation using the same API under our applications
  353. X    without the applications noticing the difference ...
  354. X
  355. X
  356. HOW TO INSTALL MCAST:
  357. X
  358. X    PORTABILITY:
  359. X
  360. X        Where possible, this software has been written to conform to
  361. X    ANSI C as defined in ANSI X3.159-1989 and POSIX 1003.1 as
  362. X        defined in IEEE Std 1003.1-1990.  Unfortunately there are no
  363. X        standards available yet for networking APIs.  Where we were
  364. X        forced to step beyond the ANSI C and POSIX 1003.1 standards,
  365. X        we chose to use the BSD (Berkeley Software Distribution)
  366. X        definitions.  As such, it depends on the BSD socket
  367. X        facilities, I/O control mechanisms, select, etc.
  368. X
  369. X        At the time of this writing the software has been compiled and
  370. X    tested on IBM RS6000s running AIX 3.2, SGIs running IRIX 4.0.1
  371. X    and Suns running SunOS 4.1.1.
  372. X
  373. X    All the configuration information is contained in the file
  374. X    "config/Makefile.config."  The configuration scheme is grossly modeled
  375. X    on the X11 imake scheme, but without imake ...  (I told you it was
  376. X    gross.)
  377. X
  378. X    In any case, each directory contains two Makefiles: "Makefile" and
  379. X    "Makefile.tmpl."  The Makefile basically reinvokes make for all
  380. X    targets with roughly the following command:
  381. X
  382. X        make -f $(TOP)/config/Makefile.config \
  383. X             -f ./Makefile \
  384. X             -f $(TOP)/config/Makefile.std
  385. X
  386. X    The Makefile.tmpl contains all the real make commands to generate and
  387. X    install the contents of the current directory.
  388. X
  389. X    You may also have to change the MCD_SERVICE_PORT constant in
  390. X    include/netmcast/mcastd.h if the default port, 8001, conflicts with a
  391. X    port already in use on your system.  This constant controls the
  392. X    default port the multicast server uses.
  393. X
  394. X    After editing config/Makefile.config (and possibly mcastd.h), type
  395. X    the following in the top level directory:
  396. X
  397. X        host-foo% make clean
  398. X        host-foo% make
  399. X
  400. X    TESTING THE SYSTEM:
  401. X
  402. X        If everything went okay, you should now have a working system.  To
  403. X        test it, try the following:
  404. X
  405. X        In one window, type:
  406. X            host-foo% cd mcastd
  407. X            host-foo% ./mcastd -d -l 7
  408. X        (This will start up the multicast server on host-foo.)
  409. X
  410. X        In second window, type:
  411. X            host-bar% cd test
  412. X            host-bar% setenv MCASTD_SERVER host-foo
  413. X            host-bar% ./mc_listen snee
  414. X        (This will start a small test application up, that listens to
  415. X         multicast group "snee" and outputs any messages it receives onto
  416. X         standard output.)
  417. X
  418. X        Finally, in a third window, type:
  419. X            host-baz% cd test
  420. X            host-baz% setenv MCASTD_SERVER host-foo
  421. X            host-baz% ./mc_clock snee
  422. X        (This will start a second small test application up, that emits an
  423. X         ASCII date/time stamp onto the multicast group snee every five
  424. X         seconds.)
  425. X
  426. X        What you should see is copious amounts of output in the window you
  427. X        started mcastd in.  It will register nearly every action that it's
  428. X        taking.  In the mc_listen window, you should see a data/time stamp
  429. X        appearing once every five seconds.
  430. X
  431. X        If you want, you can start up multiple listener processes, using
  432. X        the same or different multicast groups, and the same with the clock
  433. X        processes.  You can also start up a sender processes, mc_send,
  434. X        which copies standard input to a specified multicast group.
  435. X
  436. X        For giggles, there's the ubiquitous hello world program, mc_hello,
  437. X        which simply emits the message "hello world!" onto the multicast
  438. X        group "hello-world-group".  This is an especially fun application
  439. X        because it shows just how short a working multicast application can
  440. X        be.  Not counting comments, it's 18 lines long, two of which are
  441. X        blank and three of which are error recovery.
  442. X
  443. X        Finally, there's an incomplete version of the nearly as ubiquitous
  444. X        ping program, mc_ping.  This program opens a connection to a
  445. X        specified multicast group and sends itself messages in order to
  446. X        measure the round trip time through the multicast server, mcastd.
  447. X        This would be more complete if it allowed one to ping a specified
  448. X        recipient application, say, ``pong,'' to measure application to
  449. X        application round trip time, but other projects were pressing ...
  450. X
  451. X    Once you're happy with the software and want to install it on your
  452. X    system, just type the following in the top level directory:
  453. X
  454. X        host-foo% make install
  455. X        host-foo% make clean
  456. X
  457. X
  458. WHERE TO GO FROM HERE:
  459. X
  460. X    Hopefully the test programs in the "test" subdirectory should serve as
  461. X    useful trivial examples.  At least I always find it easier to steal
  462. X    code than to read manual pages. :-)
  463. X
  464. X    If you find yourself overcome with an urge to RTFM, a complete set of
  465. X    manual pages has been provided.  You should probably start with
  466. X    mcast.4, move on to mcast_sopen.3, and finally mc_read.2 and
  467. X    mc_write.2.  Once you feel comfortable with those, you should probably
  468. X    attack mc_socket.2, mc_bind.2, mcast_newaddr.3, and
  469. X    mcast_getgroupbyname.3.  Mcast_sopen takes much of the pain out of
  470. X    setting up a multicast socket and basically just calls mc_socket,
  471. X    mcast_newaddr, mcast_getgroupbyname, and mc_bind for you.
  472. X
  473. X    The file ABSTRACT contains a summary abstract of this software.  It
  474. X    is used by LLNL's software release program to help catalogue software
  475. X    in a standard form.  Similarly, the file MEMO is also part of LLNL's
  476. X    software release process and contains a ``memo of understanding''
  477. X    describing why I wanted to release this software.
  478. X
  479. X    The file TODO in the top level directory contains a brief set of notes
  480. X    describing things left to finish in the implementation.  The file
  481. X    doc/notes.me contains a set of implementation notes about the multicast
  482. X    abstraction we provide, the API, and our experiences.  The file
  483. X    doc/cover.me is a short introduction and table of contents which we use
  484. X    when we put together a bound documentation and source printout.
  485. X
  486. X
  487. WHERE TO SEND CORRESPONDENCE:
  488. X
  489. X    If you have bug reports, fixes, suggestions, or just want to talk about
  490. X    the software, address your correspondence to:
  491. X
  492. X        Casey Leedom
  493. X        Mail Stop: L-287
  494. X        Lawrence Livermore National Laboratory
  495. X        Livermore, CA
  496. X        USA
  497. X
  498. X        email: casey@gauss.llnl.gov
  499. X        phone: (USA) 510-423-7775
  500. END_OF_FILE
  501. if test 9246 -ne `wc -c <'README'`; then
  502.     echo shar: \"'README'\" unpacked with wrong size!
  503. fi
  504. # end of 'README'
  505. fi
  506. if test -f 'TODO' -a "${1}" != "-c" ; then 
  507.   echo shar: Will not clobber existing file \"'TODO'\"
  508. else
  509. echo shar: Extracting \"'TODO'\" \(1124 characters\)
  510. sed "s/^X//" >'TODO' <<'END_OF_FILE'
  511. X$Header: /u0/casey/src/mcast/RCS/TODO,v 1.1 92/10/16 18:21:18 casey Exp $
  512. X
  513. X
  514. X              UNFINISHED WORK ON THE LLNL MCAST DISTRIBUTION
  515. X
  516. X
  517. X    o    Implement a real naming scheme: registration and lookup.  Currently
  518. X    mcast_getgroupbyname just zeros out a multicast address and then
  519. X    strncpy copies the group name into the address.  Pretty hokey, but
  520. X    it let us get started.
  521. X
  522. X    o    Implement the readv and writev limcast routines.  This will require
  523. X    rewriting the _mc_read and _mc_write low level routines to accept
  524. X    a uio structure.  Obviously all the mc_read, mc_write, mc_recv,
  525. X    mc_send, etc. routines will also have to be modified to follow
  526. X    suit.
  527. X
  528. X    o    Implement a way to get the current multicast group membership and
  529. X    also a way to get asynchronous notification of group membership
  530. X    changes.
  531. X
  532. X    o    Write general documentation covering multicast abstraction and
  533. X    interface.
  534. X
  535. X    o    Write up implementation notes for the internal structure of the
  536. X    multicast server.  Diagrams describing the varied data structures
  537. X    would be especially nice ...
  538. X
  539. X    o    Well, obviously a true multicast implementation would be nice too ...
  540. END_OF_FILE
  541. if test 1124 -ne `wc -c <'TODO'`; then
  542.     echo shar: \"'TODO'\" unpacked with wrong size!
  543. fi
  544. # end of 'TODO'
  545. fi
  546. if test ! -d 'config' ; then
  547.     echo shar: Creating directory \"'config'\"
  548.     mkdir 'config'
  549. fi
  550. if test -f 'config/Makefile.config' -a "${1}" != "-c" ; then 
  551.   echo shar: Will not clobber existing file \"'config/Makefile.config'\"
  552. else
  553. echo shar: Extracting \"'config/Makefile.config'\" \(3111 characters\)
  554. sed "s/^X//" >'config/Makefile.config' <<'END_OF_FILE'
  555. X#
  556. X# $Header: /u0/casey/src/mcast/config/RCS/Makefile.config,v 1.4 93/01/16 19:02:08 casey Exp $
  557. X#
  558. X      DESTDIR = /TFA/unclassified
  559. X       BINDIR = $(DESTDIR)/bin
  560. X       LIBDIR = $(DESTDIR)/lib
  561. X       INCDIR = $(DESTDIR)/include
  562. X       ETCDIR = $(DESTDIR)/bin
  563. X      MANROOT = $(DESTDIR)/man
  564. X      MAN1DIR = $(MANROOT)/cat1
  565. X      MAN1EXT = 1
  566. X      MAN2DIR = $(MANROOT)/cat2
  567. X      MAN2EXT = 2
  568. X      MAN3DIR = $(MANROOT)/cat3
  569. X      MAN3EXT = 3
  570. X      MAN4DIR = $(MANROOT)/cat4
  571. X      MAN4EXT = 4
  572. X      MAN5DIR = $(MANROOT)/cat5
  573. X      MAN5EXT = 5
  574. X      MAN8DIR = $(MANROOT)/cat8
  575. X      MAN8EXT = 8
  576. X      MANDIRS = $(MAN1DIR) $(MAN2DIR) $(MAN3DIR) $(MAN4DIR) $(MAN5DIR) \
  577. X        $(MAN8DIR)
  578. X
  579. X# Specify "man" for MANINSTALL if you want unformatted troff source manual
  580. X# pages installed in the above locations.  Specify "cat" if you want nroff
  581. X# formatted manual pages installed.
  582. X#
  583. X   MANINSTALL = cat
  584. X
  585. X  BUILDINCTOP = $(TOP)/include
  586. X  LIBMCASTDIR = $(TOP)/libmcast
  587. X     LIBMCAST = $(LIBMCASTDIR)/libmcast.a
  588. X    MCASTDDIR = $(TOP)/mcastd
  589. X       MCASTD = $(MCASTDDIR)/mcastd
  590. X
  591. X#
  592. X# Operating system/platform specific values:
  593. X#
  594. X# IBM AIX 3.2:
  595. X#   1.    STD_DEFINES should contain -qlanglvl=ansi -D_ALL_SOURCE -D_BSD.
  596. X#   2.    CDEBUGFLAGS should contain -qsrcmsg.  It should probably also contain
  597. X#    -qextchk, but that causes the loader to complain about a type
  598. X#    mismatch for mc_fcntl between mc_fcntl.c and mc_ioctl.c in
  599. X#    libmcast when you try to link against the library.  This is
  600. X#    completely bogus.  CDEBUGFLAGS should also probably contain -g or
  601. X#    -O depending on your debugging/performance needs.
  602. X#   3.    Set RANLIB to /bin/true.
  603. X#
  604. X# SGI IRIX 4.0:
  605. X#   1.    CDEBUGFLAGS should contain -prototypes in order to get C function
  606. X#    prototype checking.  CDEBUGFLAGS should also probably contain -g
  607. X#    or -O depending on your debugging/performance needs.
  608. X#   2.    Set RANLIB to /bin/true.
  609. X#
  610. X# SUN OS 4.1.1:
  611. X#   1.    CC should be an ANSI C compiler like gcc or Sun's unbundled compiler.
  612. X#    Sun's bundled compiler won't work.
  613. X#   2.    If gcc is used, you'll probably have to add -I/usr/include to
  614. X#    STD_INCLUDES because gcc seems to search its own local include
  615. X#    directory before /usr/include which leads to all sorts of problems.
  616. X#   3.    Add -DNEED_STRERROR, -DNEED_OFFSETOF, -DNEED_EXIT_CODES and
  617. X#    -DBROKEN_INET_NTOA to STD_DEFINES.  Sun OS 4.1.1 fails to supply
  618. X#    the ANSI C X3.159-1989 strerror routine, the offsetof macro and the
  619. X#    EXIT_SUCCESS and EXIT_FAILURE defines.  It also changes inet_ntoa
  620. X#    to take a *pointer to* a struct in_addr instead of the struct itself
  621. X#    (which it fails to document in the manual page).
  622. X#   4.    CDEBUGFLAGS should also probably contain -g or -O depending on your
  623. X#    debugging/performance needs.
  624. X#   5.    Set RANLIB to ranlib.
  625. X#
  626. X           CC = cc
  627. X STD_INCLUDES = -I.
  628. X TOP_INCLUDES = -I$(BUILDINCTOP)
  629. X     INCLUDES = 
  630. X  ALLINCLUDES = $(INCLUDES) $(TOP_INCLUDES) $(STD_INCLUDES)
  631. X  STD_DEFINES = 
  632. X      DEFINES = 
  633. X   ALLDEFINES = $(STD_DEFINES) $(DEFINES)
  634. X  CDEBUGFLAGS = -O -prototypes
  635. X       CFLAGS = $(CDEBUGFLAGS) $(ALLDEFINES) $(ALLINCLUDES)
  636. X
  637. X        SHELL = /bin/sh
  638. X           AR = ar cq
  639. X       RANLIB = /bin/true
  640. END_OF_FILE
  641. if test 3111 -ne `wc -c <'config/Makefile.config'`; then
  642.     echo shar: \"'config/Makefile.config'\" unpacked with wrong size!
  643. fi
  644. # end of 'config/Makefile.config'
  645. fi
  646. if test -f 'config/Makefile.std' -a "${1}" != "-c" ; then 
  647.   echo shar: Will not clobber existing file \"'config/Makefile.std'\"
  648. else
  649. echo shar: Extracting \"'config/Makefile.std'\" \(206 characters\)
  650. sed "s/^X//" >'config/Makefile.std' <<'END_OF_FILE'
  651. X#
  652. X# $Header: /u0/casey/src/mcast/config/RCS/Makefile.std,v 1.1 92/10/16 18:22:26 casey Exp $
  653. X#
  654. X$(LIBMCAST):
  655. X    @echo "Making $(LIBMCAST)"
  656. X    cd $(LIBMCASTDIR); $(MAKE) $(MFLAGS)
  657. X    @echo "Returning to $(CURDIR)"
  658. END_OF_FILE
  659. if test 206 -ne `wc -c <'config/Makefile.std'`; then
  660.     echo shar: \"'config/Makefile.std'\" unpacked with wrong size!
  661. fi
  662. # end of 'config/Makefile.std'
  663. fi
  664. if test ! -d 'doc' ; then
  665.     echo shar: Creating directory \"'doc'\"
  666.     mkdir 'doc'
  667. fi
  668. if test -f 'doc/Makefile' -a "${1}" != "-c" ; then 
  669.   echo shar: Will not clobber existing file \"'doc/Makefile'\"
  670. else
  671. echo shar: Extracting \"'doc/Makefile'\" \(605 characters\)
  672. sed "s/^X//" >'doc/Makefile' <<'END_OF_FILE'
  673. X#
  674. X# $Header: /u0/casey/src/mcast/doc/RCS/Makefile,v 1.1 92/10/16 18:22:28 casey Exp $
  675. X#
  676. X          TOP = ..
  677. X       CURDIR = ./doc
  678. X
  679. X.DEFAULT:
  680. X    @$(MAKE) $(MFLAGS) TOP="$(TOP)" CURDIR="$(CURDIR)" \
  681. X        -f $(TOP)/config/Makefile.config \
  682. X        -f ./Makefile.tmpl \
  683. X        -f $(TOP)/config/Makefile.std \
  684. X        $@
  685. X
  686. X.c.o:
  687. X    @$(MAKE) $(MFLAGS) TOP="$(TOP)" CURDIR="$(CURDIR)" \
  688. X        -f $(TOP)/config/Makefile.config \
  689. X        -f ./Makefile.tmpl \
  690. X        -f $(TOP)/config/Makefile.std \
  691. X        $@
  692. X
  693. all:
  694. X    @$(MAKE) $(MFLAGS) TOP="$(TOP)" CURDIR="$(CURDIR)" \
  695. X        -f $(TOP)/config/Makefile.config \
  696. X        -f ./Makefile.tmpl \
  697. X        -f $(TOP)/config/Makefile.std
  698. END_OF_FILE
  699. if test 605 -ne `wc -c <'doc/Makefile'`; then
  700.     echo shar: \"'doc/Makefile'\" unpacked with wrong size!
  701. fi
  702. # end of 'doc/Makefile'
  703. fi
  704. if test -f 'doc/Makefile.tmpl' -a "${1}" != "-c" ; then 
  705.   echo shar: Will not clobber existing file \"'doc/Makefile.tmpl'\"
  706. else
  707. echo shar: Extracting \"'doc/Makefile.tmpl'\" \(335 characters\)
  708. sed "s/^X//" >'doc/Makefile.tmpl' <<'END_OF_FILE'
  709. X#
  710. X# $Header: /u0/casey/src/mcast/doc/RCS/Makefile.tmpl,v 1.1 92/10/16 18:22:30 casey Exp $
  711. X#
  712. X
  713. X        TROFF = psroff
  714. X         SRCS = cover.me notes.me
  715. X
  716. all:
  717. X
  718. print: cover notes
  719. X
  720. cover: cover.me
  721. X    $(TROFF) -me cover.me
  722. X
  723. notes: notes.me
  724. X    $(TROFF) -me notes.me
  725. X
  726. includes:
  727. X
  728. install:
  729. X
  730. clean:
  731. X    rm -f *~ *.o core a.out MAKELOG
  732. X
  733. lint:
  734. X
  735. depend:
  736. END_OF_FILE
  737. if test 335 -ne `wc -c <'doc/Makefile.tmpl'`; then
  738.     echo shar: \"'doc/Makefile.tmpl'\" unpacked with wrong size!
  739. fi
  740. # end of 'doc/Makefile.tmpl'
  741. fi
  742. if test ! -d 'include' ; then
  743.     echo shar: Creating directory \"'include'\"
  744.     mkdir 'include'
  745. fi
  746. if test ! -d 'include/netmcast' ; then
  747.     echo shar: Creating directory \"'include/netmcast'\"
  748.     mkdir 'include/netmcast'
  749. fi
  750. if test -f 'include/netmcast/Makefile' -a "${1}" != "-c" ; then 
  751.   echo shar: Will not clobber existing file \"'include/netmcast/Makefile'\"
  752. else
  753. echo shar: Extracting \"'include/netmcast/Makefile'\" \(635 characters\)
  754. sed "s/^X//" >'include/netmcast/Makefile' <<'END_OF_FILE'
  755. X#
  756. X# $Header: /u0/casey/src/mcast/include/netmcast/RCS/Makefile,v 1.1 92/10/16 18:22:33 casey Exp $
  757. X#
  758. X          TOP = ../..
  759. X       CURDIR = ./include/netmcast
  760. X
  761. X
  762. X.DEFAULT:
  763. X    @$(MAKE) $(MFLAGS) TOP="$(TOP)" CURDIR="$(CURDIR)" \
  764. X        -f $(TOP)/config/Makefile.config \
  765. X        -f ./Makefile.tmpl \
  766. X        -f $(TOP)/config/Makefile.std \
  767. X        $@
  768. X
  769. X.c.o:
  770. X    @$(MAKE) $(MFLAGS) TOP="$(TOP)" CURDIR="$(CURDIR)" \
  771. X        -f $(TOP)/config/Makefile.config \
  772. X        -f ./Makefile.tmpl \
  773. X        -f $(TOP)/config/Makefile.std \
  774. X        $@
  775. X
  776. all:
  777. X    @$(MAKE) $(MFLAGS) TOP="$(TOP)" CURDIR="$(CURDIR)" \
  778. X        -f $(TOP)/config/Makefile.config \
  779. X        -f ./Makefile.tmpl \
  780. X        -f $(TOP)/config/Makefile.std
  781. END_OF_FILE
  782. if test 635 -ne `wc -c <'include/netmcast/Makefile'`; then
  783.     echo shar: \"'include/netmcast/Makefile'\" unpacked with wrong size!
  784. fi
  785. # end of 'include/netmcast/Makefile'
  786. fi
  787. if test -f 'include/netmcast/Makefile.tmpl' -a "${1}" != "-c" ; then 
  788.   echo shar: Will not clobber existing file \"'include/netmcast/Makefile.tmpl'\"
  789. else
  790. echo shar: Extracting \"'include/netmcast/Makefile.tmpl'\" \(338 characters\)
  791. sed "s/^X//" >'include/netmcast/Makefile.tmpl' <<'END_OF_FILE'
  792. X#
  793. X# $Header: /u0/casey/src/mcast/include/netmcast/RCS/Makefile.tmpl,v 1.2 92/10/16 18:22:35 casey Exp $
  794. X#
  795. X      INCSRCS = mcast.h
  796. X
  797. all: $(INCSRCS)
  798. X
  799. includes:
  800. X
  801. install: $(INSRCS) $(INCDIR) $(INCDIR)/netmcast
  802. X    cp $(INCSRCS) $(INCDIR)/netmcast
  803. X
  804. X$(INCDIR) $(INCDIR)/netmcast:
  805. X    mkdir $@
  806. X
  807. clean:
  808. X    rm -f *~ *.o core a.out MAKELOG
  809. X
  810. lint:
  811. depend:
  812. END_OF_FILE
  813. if test 338 -ne `wc -c <'include/netmcast/Makefile.tmpl'`; then
  814.     echo shar: \"'include/netmcast/Makefile.tmpl'\" unpacked with wrong size!
  815. fi
  816. # end of 'include/netmcast/Makefile.tmpl'
  817. fi
  818. if test -f 'include/netmcast/mcastd.h' -a "${1}" != "-c" ; then 
  819.   echo shar: Will not clobber existing file \"'include/netmcast/mcastd.h'\"
  820. else
  821. echo shar: Extracting \"'include/netmcast/mcastd.h'\" \(2888 characters\)
  822. sed "s/^X//" >'include/netmcast/mcastd.h' <<'END_OF_FILE'
  823. X/*
  824. X * $Header: /u0/casey/src/mcast/include/netmcast/RCS/mcastd.h,v 1.1 92/10/16 18:22:37 casey Exp $
  825. X */
  826. X
  827. X/*
  828. X * Copyright (c) 1992 The Regents of the University of California.
  829. X * All rights reserved.
  830. X *
  831. X * Redistribution and use in source and binary forms, with or without
  832. X * modification, are permitted provided that the following conditions
  833. X * are met:
  834. X * 1. Redistributions of source code must retain the above copyright
  835. X *    notice, this list of conditions and the following disclaimer.
  836. X * 2. Redistributions in binary form must reproduce the above copyright
  837. X *    notice, this list of conditions and the following disclaimer in the
  838. X *    documentation and/or other materials provided with the distribution.
  839. X * 3. All advertising materials mentioning features or use of this software
  840. X *    must display the following acknowledgement:
  841. X *    This product includes software developed by the University of
  842. X *    California, Lawrence Livermore National Laboratory and its
  843. X *    contributors.
  844. X * 4. Neither the name of the University nor the names of its contributors
  845. X *    may be used to endorse or promote products derived from this software
  846. X *    without specific prior written permission.
  847. X *
  848. X * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  849. X * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  850. X * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  851. X * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  852. X * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  853. X * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  854. X * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  855. X * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  856. X * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  857. X * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  858. X * SUCH DAMAGE.
  859. X */
  860. X
  861. X#ifndef _MCASTD_H_
  862. X#define    _MCASTD_H_
  863. X
  864. X#define    MCD_SERVER_ENV        "MCASTD_SERVER"
  865. X#define    MCD_SERVER_NAME        "mcast-server"
  866. X#define    MCD_SERVER_HOST        INADDR_LOOPBACK
  867. X
  868. X#define    MCD_SERVICE_ENV        "MCASTD_PORT"
  869. X#define    MCD_SERVICE_NAME    "mcast"
  870. X#define    MCD_SERVICE_PORT    8001
  871. X
  872. X#define    MCD_MCADDR        MCADDR_ANY
  873. X
  874. typedef struct { /* MACHINE DEPENDENT */
  875. X    unsigned int    request:32;    /* function request code (see below) */
  876. X    unsigned int    :32;        /* pad to 64 bits */
  877. X    unsigned int    option:32;    /* set option state on or off */
  878. X    unsigned int    :32;        /* pad to 64 bits */
  879. X    mc_addr        group;        /* multicast group address for BIND */
  880. X    mc_addr        local;        /* member local address for BIND */
  881. X    mc_addr        remote;        /* member remote address for BIND */
  882. X} mcd_message;
  883. X
  884. X#define    MCD_BIND        1    /* bind group and member addresses */
  885. X#define    MCD_LOOPBACK        2    /* set client loopback state */
  886. X#define    MCD_SHUTDOWNRECV    3    /* set client sendonly state */
  887. X
  888. X#endif /* _MCASTD_H_ */
  889. END_OF_FILE
  890. if test 2888 -ne `wc -c <'include/netmcast/mcastd.h'`; then
  891.     echo shar: \"'include/netmcast/mcastd.h'\" unpacked with wrong size!
  892. fi
  893. # end of 'include/netmcast/mcastd.h'
  894. fi
  895. if test ! -d 'libmcast' ; then
  896.     echo shar: Creating directory \"'libmcast'\"
  897.     mkdir 'libmcast'
  898. fi
  899. if test -f 'libmcast/Makefile' -a "${1}" != "-c" ; then 
  900.   echo shar: Will not clobber existing file \"'libmcast/Makefile'\"
  901. else
  902. echo shar: Extracting \"'libmcast/Makefile'\" \(615 characters\)
  903. sed "s/^X//" >'libmcast/Makefile' <<'END_OF_FILE'
  904. X#
  905. X# $Header: /u0/casey/src/mcast/libmcast/RCS/Makefile,v 1.1 92/10/16 18:22:38 casey Exp $
  906. X#
  907. X          TOP = ..
  908. X       CURDIR = ./libmcast
  909. X
  910. X.DEFAULT:
  911. X    @$(MAKE) $(MFLAGS) TOP="$(TOP)" CURDIR="$(CURDIR)" \
  912. X        -f $(TOP)/config/Makefile.config \
  913. X        -f ./Makefile.tmpl \
  914. X        -f $(TOP)/config/Makefile.std \
  915. X        $@
  916. X
  917. X.c.o:
  918. X    @$(MAKE) $(MFLAGS) TOP="$(TOP)" CURDIR="$(CURDIR)" \
  919. X        -f $(TOP)/config/Makefile.config \
  920. X        -f ./Makefile.tmpl \
  921. X        -f $(TOP)/config/Makefile.std \
  922. X        $@
  923. X
  924. all:
  925. X    @$(MAKE) $(MFLAGS) TOP="$(TOP)" CURDIR="$(CURDIR)" \
  926. X        -f $(TOP)/config/Makefile.config \
  927. X        -f ./Makefile.tmpl \
  928. X        -f $(TOP)/config/Makefile.std
  929. END_OF_FILE
  930. if test 615 -ne `wc -c <'libmcast/Makefile'`; then
  931.     echo shar: \"'libmcast/Makefile'\" unpacked with wrong size!
  932. fi
  933. # end of 'libmcast/Makefile'
  934. fi
  935. if test -f 'libmcast/Makefile.tmpl' -a "${1}" != "-c" ; then 
  936.   echo shar: Will not clobber existing file \"'libmcast/Makefile.tmpl'\"
  937. else
  938. echo shar: Extracting \"'libmcast/Makefile.tmpl'\" \(3470 characters\)
  939. sed "s/^X//" >'libmcast/Makefile.tmpl' <<'END_OF_FILE'
  940. X #
  941. X# $Header: /u0/casey/src/mcast/libmcast/RCS/Makefile.tmpl,v 1.2 93/01/16 19:12:39 casey Exp $
  942. X#
  943. X
  944. X        SRCS1 = _mc_read.c _mc_state.c _mc_write.c mc_bind.c mc_close.c \
  945. X        mc_connect.c mc_fcntl.c mc_getpeername.c \
  946. X        mc_getsockname.c mc_getsockopt.c mc_ioctl.c mc_read.c \
  947. X        mc_readv.c mc_recv.c mc_recvfrom.c mc_send.c mc_sendto.c \
  948. X        mc_setsockopt.c mc_shutdown.c mc_socket.c mc_write.c \
  949. X        mc_writev.c
  950. X        OBJS1 = _mc_read.o _mc_state.o _mc_write.o mc_bind.o mc_close.o \
  951. X        mc_connect.o mc_fcntl.o mc_getpeername.o \
  952. X        mc_getsockname.o mc_getsockopt.o mc_ioctl.o mc_read.o \
  953. X        mc_readv.o mc_recv.o mc_recvfrom.o mc_send.o mc_sendto.o \
  954. X        mc_setsockopt.o mc_shutdown.o mc_socket.o mc_write.o \
  955. X        mc_writev.o
  956. X
  957. X        SRCS2 = mcast_getgroupbyname.c mcast_newaddr.c mcast_sopen.c
  958. X        OBJS2 = mcast_getgroupbyname.o mcast_newaddr.o mcast_sopen.o
  959. X
  960. X         SRCS = $(SRCS1) $(SRCS2)
  961. X         OBJS = $(OBJS1) $(OBJS2)
  962. X      LIBRARY = libmcast.a
  963. X
  964. all: $(LIBRARY)
  965. X
  966. includes:
  967. X
  968. X$(LIBRARY): $(OBJS)
  969. X    rm -f $(LIBRARY)
  970. X    $(AR) $(LIBRARY) $(OBJS)
  971. X    $(RANLIB) $(LIBRARY)
  972. X
  973. install: $(LIBRARY) $(LIBDIR)
  974. X    cp $(LIBRARY) $(LIBDIR)/$(LIBRARY)
  975. X    $(RANLIB) $(LIBDIR)/$(LIBRARY)
  976. X
  977. X$(LIBDIR):
  978. X    mkdir $@
  979. X
  980. clean:
  981. X    rm -f $(LIBRARY)
  982. X    rm -f *~ *.o core a.out MAKELOG
  983. X
  984. lint:
  985. X    lint -x $(ALLDEFINES) $(SRCS)
  986. X
  987. depend:
  988. X
  989. X_mc_read.o: mc_lib.h $(BUILDINCTOP)/netmcast/mcast.h $(BUILDINCTOP)/netmcast/mcastd.h
  990. X_mc_state.o: mc_lib.h $(BUILDINCTOP)/netmcast/mcast.h $(BUILDINCTOP)/netmcast/mcastd.h
  991. X_mc_write.o: mc_lib.h $(BUILDINCTOP)/netmcast/mcast.h $(BUILDINCTOP)/netmcast/mcastd.h
  992. mc_bind.o: mc_lib.h $(BUILDINCTOP)/netmcast/mcast.h $(BUILDINCTOP)/netmcast/mcastd.h
  993. mc_close.o: mc_lib.h $(BUILDINCTOP)/netmcast/mcast.h $(BUILDINCTOP)/netmcast/mcastd.h
  994. mc_connect.o: mc_lib.h $(BUILDINCTOP)/netmcast/mcast.h $(BUILDINCTOP)/netmcast/mcastd.h
  995. mc_fcntl.o: mc_lib.h $(BUILDINCTOP)/netmcast/mcast.h $(BUILDINCTOP)/netmcast/mcastd.h
  996. mc_getpeername.o: mc_lib.h $(BUILDINCTOP)/netmcast/mcast.h $(BUILDINCTOP)/netmcast/mcastd.h
  997. mc_getsockname.o: mc_lib.h $(BUILDINCTOP)/netmcast/mcast.h $(BUILDINCTOP)/netmcast/mcastd.h
  998. mc_getsockopt.o: mc_lib.h $(BUILDINCTOP)/netmcast/mcast.h $(BUILDINCTOP)/netmcast/mcastd.h
  999. mc_ioctl.o: mc_lib.h $(BUILDINCTOP)/netmcast/mcast.h $(BUILDINCTOP)/netmcast/mcastd.h
  1000. mc_read.o: mc_lib.h $(BUILDINCTOP)/netmcast/mcast.h $(BUILDINCTOP)/netmcast/mcastd.h
  1001. mc_readv.o: mc_lib.h $(BUILDINCTOP)/netmcast/mcast.h $(BUILDINCTOP)/netmcast/mcastd.h
  1002. mc_recv.o: mc_lib.h $(BUILDINCTOP)/netmcast/mcast.h $(BUILDINCTOP)/netmcast/mcastd.h
  1003. mc_recvfrom.o: mc_lib.h $(BUILDINCTOP)/netmcast/mcast.h $(BUILDINCTOP)/netmcast/mcastd.h
  1004. mc_send.o: mc_lib.h $(BUILDINCTOP)/netmcast/mcast.h $(BUILDINCTOP)/netmcast/mcastd.h
  1005. mc_sendto.o: mc_lib.h $(BUILDINCTOP)/netmcast/mcast.h $(BUILDINCTOP)/netmcast/mcastd.h
  1006. mc_setsockopt.o: mc_lib.h $(BUILDINCTOP)/netmcast/mcast.h $(BUILDINCTOP)/netmcast/mcastd.h
  1007. mc_shutdown.o: mc_lib.h $(BUILDINCTOP)/netmcast/mcast.h $(BUILDINCTOP)/netmcast/mcastd.h
  1008. mc_socket.o: mc_lib.h $(BUILDINCTOP)/netmcast/mcast.h $(BUILDINCTOP)/netmcast/mcastd.h
  1009. mc_write.o: mc_lib.h $(BUILDINCTOP)/netmcast/mcast.h $(BUILDINCTOP)/netmcast/mcastd.h
  1010. mc_writev.o: mc_lib.h $(BUILDINCTOP)/netmcast/mcast.h $(BUILDINCTOP)/netmcast/mcastd.h
  1011. mcast_getgroupbyname.o: $(BUILDINCTOP)/netmcast/mcast.h $(BUILDINCTOP)/netmcast/mcastd.h
  1012. mcast_newaddr.o: $(BUILDINCTOP)/netmcast/mcast.h $(BUILDINCTOP)/netmcast/mcastd.h
  1013. mcast_sopen.o: $(BUILDINCTOP)/netmcast/mcast.h $(BUILDINCTOP)/netmcast/mcastd.h
  1014. END_OF_FILE
  1015. if test 3470 -ne `wc -c <'libmcast/Makefile.tmpl'`; then
  1016.     echo shar: \"'libmcast/Makefile.tmpl'\" unpacked with wrong size!
  1017. fi
  1018. # end of 'libmcast/Makefile.tmpl'
  1019. fi
  1020. if test -f 'libmcast/_mc_state.c' -a "${1}" != "-c" ; then 
  1021.   echo shar: Will not clobber existing file \"'libmcast/_mc_state.c'\"
  1022. else
  1023. echo shar: Extracting \"'libmcast/_mc_state.c'\" \(2441 characters\)
  1024. sed "s/^X//" >'libmcast/_mc_state.c' <<'END_OF_FILE'
  1025. X/*
  1026. X * $Header: /u0/casey/src/mcast/libmcast/RCS/_mc_state.c,v 1.1 92/10/16 18:22:41 casey Exp $
  1027. X */
  1028. X
  1029. X/*
  1030. X * Copyright (c) 1992 The Regents of the University of California.
  1031. X * All rights reserved.
  1032. X *
  1033. X * Redistribution and use in source and binary forms, with or without
  1034. X * modification, are permitted provided that the following conditions
  1035. X * are met:
  1036. X * 1. Redistributions of source code must retain the above copyright
  1037. X *    notice, this list of conditions and the following disclaimer.
  1038. X * 2. Redistributions in binary form must reproduce the above copyright
  1039. X *    notice, this list of conditions and the following disclaimer in the
  1040. X *    documentation and/or other materials provided with the distribution.
  1041. X * 3. All advertising materials mentioning features or use of this software
  1042. X *    must display the following acknowledgement:
  1043. X *    This product includes software developed by the University of
  1044. X *    California, Lawrence Livermore National Laboratory and its
  1045. X *    contributors.
  1046. X * 4. Neither the name of the University nor the names of its contributors
  1047. X *    may be used to endorse or promote products derived from this software
  1048. X *    without specific prior written permission.
  1049. X *
  1050. X * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  1051. X * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  1052. X * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  1053. X * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  1054. X * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  1055. X * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  1056. X * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  1057. X * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  1058. X * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  1059. X * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  1060. X * SUCH DAMAGE.
  1061. X */
  1062. X
  1063. X#ifndef lint
  1064. static char rcsid[] = "$Header: /u0/casey/src/mcast/libmcast/RCS/_mc_state.c,v 1.1 92/10/16 18:22:41 casey Exp $";
  1065. static char copyright[] =
  1066. X    "Copyright (c) 1992 The Regents of the University of California.\n"
  1067. X    "All rights reserved.\n";
  1068. static char classification[] =
  1069. X    "Unclassified\n";
  1070. X#endif
  1071. X
  1072. X
  1073. X/*
  1074. X * MCAST SYSLIB PRIVATE: global data.
  1075. X */
  1076. X
  1077. X
  1078. X#include "mc_lib.h"
  1079. X
  1080. X
  1081. X/*
  1082. X * Multicast system call emulation state space.
  1083. X */
  1084. mc_state _mc_state[MC_MAX_CONNECTIONS];
  1085. END_OF_FILE
  1086. if test 2441 -ne `wc -c <'libmcast/_mc_state.c'`; then
  1087.     echo shar: \"'libmcast/_mc_state.c'\" unpacked with wrong size!
  1088. fi
  1089. # end of 'libmcast/_mc_state.c'
  1090. fi
  1091. if test -f 'libmcast/mc_close.c' -a "${1}" != "-c" ; then 
  1092.   echo shar: Will not clobber existing file \"'libmcast/mc_close.c'\"
  1093. else
  1094. echo shar: Extracting \"'libmcast/mc_close.c'\" \(2650 characters\)
  1095. sed "s/^X//" >'libmcast/mc_close.c' <<'END_OF_FILE'
  1096. X/*
  1097. X * $Header: /u0/casey/src/mcast/libmcast/RCS/mc_close.c,v 1.2 92/11/17 16:56:11 casey Exp $
  1098. X */
  1099. X
  1100. X/*
  1101. X * Copyright (c) 1992 The Regents of the University of California.
  1102. X * All rights reserved.
  1103. X *
  1104. X * Redistribution and use in source and binary forms, with or without
  1105. X * modification, are permitted provided that the following conditions
  1106. X * are met:
  1107. X * 1. Redistributions of source code must retain the above copyright
  1108. X *    notice, this list of conditions and the following disclaimer.
  1109. X * 2. Redistributions in binary form must reproduce the above copyright
  1110. X *    notice, this list of conditions and the following disclaimer in the
  1111. X *    documentation and/or other materials provided with the distribution.
  1112. X * 3. All advertising materials mentioning features or use of this software
  1113. X *    must display the following acknowledgement:
  1114. X *    This product includes software developed by the University of
  1115. X *    California, Lawrence Livermore National Laboratory and its
  1116. X *    contributors.
  1117. X * 4. Neither the name of the University nor the names of its contributors
  1118. X *    may be used to endorse or promote products derived from this software
  1119. X *    without specific prior written permission.
  1120. X *
  1121. X * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  1122. X * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  1123. X * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  1124. X * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  1125. X * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  1126. X * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  1127. X * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  1128. X * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  1129. X * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  1130. X * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  1131. X * SUCH DAMAGE.
  1132. X */
  1133. X
  1134. X#ifndef lint
  1135. static char rcsid[] = "$Header: /u0/casey/src/mcast/libmcast/RCS/mc_close.c,v 1.2 92/11/17 16:56:11 casey Exp $";
  1136. static char copyright[] =
  1137. X    "Copyright (c) 1992 The Regents of the University of California.\n"
  1138. X    "All rights reserved.\n";
  1139. static char classification[] =
  1140. X    "Unclassified\n";
  1141. X#endif
  1142. X
  1143. X
  1144. X/*
  1145. X * MCAST SYSLIB PUBLIC: mc_close: close(2) system call emulation routine.
  1146. X */
  1147. X
  1148. X
  1149. X#include "mc_lib.h"
  1150. X
  1151. X
  1152. int
  1153. mc_close(int s)
  1154. X    /*
  1155. X     * Close multicast socket.
  1156. X     */
  1157. X{
  1158. X    mc_state *sp = &_mc_state[s];
  1159. X
  1160. X    if (s < 0 || s >= MC_MAX_CONNECTIONS
  1161. X        || !(sp->state & MC_VALID)) {
  1162. X        /* return(close(s)); */
  1163. X        errno = EBADF;
  1164. X        return(-1);
  1165. X    }
  1166. X    sp->state = 0;
  1167. X    return(close(s));
  1168. X}
  1169. END_OF_FILE
  1170. if test 2650 -ne `wc -c <'libmcast/mc_close.c'`; then
  1171.     echo shar: \"'libmcast/mc_close.c'\" unpacked with wrong size!
  1172. fi
  1173. # end of 'libmcast/mc_close.c'
  1174. fi
  1175. if test -f 'libmcast/mc_getpeername.c' -a "${1}" != "-c" ; then 
  1176.   echo shar: Will not clobber existing file \"'libmcast/mc_getpeername.c'\"
  1177. else
  1178. echo shar: Extracting \"'libmcast/mc_getpeername.c'\" \(3075 characters\)
  1179. sed "s/^X//" >'libmcast/mc_getpeername.c' <<'END_OF_FILE'
  1180. X/*
  1181. X * $Header: /u0/casey/src/mcast/libmcast/RCS/mc_getpeername.c,v 1.3 93/01/16 19:43:25 casey Exp $
  1182. X */
  1183. X
  1184. X/*
  1185. X * Copyright (c) 1992 The Regents of the University of California.
  1186. X * All rights reserved.
  1187. X *
  1188. X * Redistribution and use in source and binary forms, with or without
  1189. X * modification, are permitted provided that the following conditions
  1190. X * are met:
  1191. X * 1. Redistributions of source code must retain the above copyright
  1192. X *    notice, this list of conditions and the following disclaimer.
  1193. X * 2. Redistributions in binary form must reproduce the above copyright
  1194. X *    notice, this list of conditions and the following disclaimer in the
  1195. X *    documentation and/or other materials provided with the distribution.
  1196. X * 3. All advertising materials mentioning features or use of this software
  1197. X *    must display the following acknowledgement:
  1198. X *    This product includes software developed by the University of
  1199. X *    California, Lawrence Livermore National Laboratory and its
  1200. X *    contributors.
  1201. X * 4. Neither the name of the University nor the names of its contributors
  1202. X *    may be used to endorse or promote products derived from this software
  1203. X *    without specific prior written permission.
  1204. X *
  1205. X * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  1206. X * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  1207. X * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  1208. X * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  1209. X * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  1210. X * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  1211. X * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  1212. X * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  1213. X * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  1214. X * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  1215. X * SUCH DAMAGE.
  1216. X */
  1217. X
  1218. X#ifndef lint
  1219. static char rcsid[] = "$Header: /u0/casey/src/mcast/libmcast/RCS/mc_getpeername.c,v 1.3 93/01/16 19:43:25 casey Exp $";
  1220. static char copyright[] =
  1221. X    "Copyright (c) 1992 The Regents of the University of California.\n"
  1222. X    "All rights reserved.\n";
  1223. static char classification[] =
  1224. X    "Unclassified\n";
  1225. X#endif
  1226. X
  1227. X
  1228. X/*
  1229. X * MCAST SYSLIB PUBLIC: mc_getpeername: getpeername(2) system call emulation
  1230. X * routine.
  1231. X */
  1232. X
  1233. X
  1234. X#include "mc_lib.h"
  1235. X
  1236. X
  1237. int
  1238. mc_getpeername(int s, struct sockaddr *name, int *namelen)
  1239. X    /*
  1240. X     * Get remote name of a connected multicast socket.
  1241. X     */
  1242. X{
  1243. X    mc_state *sp = &_mc_state[s];
  1244. X    struct sockaddr_mcast *np = (struct sockaddr_mcast *)name;
  1245. X    int len = min(*namelen, sizeof(struct sockaddr_mcast));
  1246. X    struct sockaddr_mcast tmp;
  1247. X
  1248. X    if (s < 0 || s >= MC_MAX_CONNECTIONS
  1249. X        || !(sp->state & MC_VALID)) {
  1250. X        /* return(recvfrom(s, buf, len, flags)); */
  1251. X        errno = EBADF;
  1252. X        return(-1);
  1253. X    }
  1254. X    if (sp->state & MC_CORRUPTED) {
  1255. X        errno = EIO;
  1256. X        return(-1);
  1257. X    }
  1258. X    tmp.family = sp->family;
  1259. X    tmp.group = sp->group;
  1260. X    tmp.member = sp->remote;
  1261. X    (void)memcpy(np, &tmp, len);
  1262. X    *namelen = len;
  1263. X    return(0);
  1264. X}
  1265. END_OF_FILE
  1266. if test 3075 -ne `wc -c <'libmcast/mc_getpeername.c'`; then
  1267.     echo shar: \"'libmcast/mc_getpeername.c'\" unpacked with wrong size!
  1268. fi
  1269. # end of 'libmcast/mc_getpeername.c'
  1270. fi
  1271. if test -f 'libmcast/mc_getsockname.c' -a "${1}" != "-c" ; then 
  1272.   echo shar: Will not clobber existing file \"'libmcast/mc_getsockname.c'\"
  1273. else
  1274. echo shar: Extracting \"'libmcast/mc_getsockname.c'\" \(3183 characters\)
  1275. sed "s/^X//" >'libmcast/mc_getsockname.c' <<'END_OF_FILE'
  1276. X/*
  1277. X * $Header: /u0/casey/src/mcast/libmcast/RCS/mc_getsockname.c,v 1.3 93/01/16 19:44:22 casey Exp $
  1278. X */
  1279. X
  1280. X/*
  1281. X * Copyright (c) 1992 The Regents of the University of California.
  1282. X * All rights reserved.
  1283. X *
  1284. X * Redistribution and use in source and binary forms, with or without
  1285. X * modification, are permitted provided that the following conditions
  1286. X * are met:
  1287. X * 1. Redistributions of source code must retain the above copyright
  1288. X *    notice, this list of conditions and the following disclaimer.
  1289. X * 2. Redistributions in binary form must reproduce the above copyright
  1290. X *    notice, this list of conditions and the following disclaimer in the
  1291. X *    documentation and/or other materials provided with the distribution.
  1292. X * 3. All advertising materials mentioning features or use of this software
  1293. X *    must display the following acknowledgement:
  1294. X *    This product includes software developed by the University of
  1295. X *    California, Lawrence Livermore National Laboratory and its
  1296. X *    contributors.
  1297. X * 4. Neither the name of the University nor the names of its contributors
  1298. X *    may be used to endorse or promote products derived from this software
  1299. X *    without specific prior written permission.
  1300. X *
  1301. X * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  1302. X * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  1303. X * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  1304. X * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  1305. X * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  1306. X * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  1307. X * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  1308. X * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  1309. X * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  1310. X * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  1311. X * SUCH DAMAGE.
  1312. X */
  1313. X
  1314. X#ifndef lint
  1315. static char rcsid[] = "$Header: /u0/casey/src/mcast/libmcast/RCS/mc_getsockname.c,v 1.3 93/01/16 19:44:22 casey Exp $";
  1316. static char copyright[] =
  1317. X    "Copyright (c) 1992 The Regents of the University of California.\n"
  1318. X    "All rights reserved.\n";
  1319. static char classification[] =
  1320. X    "Unclassified\n";
  1321. X#endif
  1322. X
  1323. X
  1324. X/*
  1325. X * MCAST SYSLIB PUBLIC: mc_getsockname: getsockname(2) system call emulation
  1326. X * routine.
  1327. X */
  1328. X
  1329. X
  1330. X#include "mc_lib.h"
  1331. X
  1332. X
  1333. int
  1334. mc_getsockname(int s, struct sockaddr *name, int *namelen)
  1335. X    /*
  1336. X     * Get local name of a multicast socket.
  1337. X     */
  1338. X{
  1339. X    mc_state *sp = &_mc_state[s];
  1340. X    struct sockaddr_mcast *np = (struct sockaddr_mcast *)name;
  1341. X    int len = min(*namelen, sizeof(struct sockaddr_mcast));
  1342. X    struct sockaddr_mcast tmp;
  1343. X
  1344. X    if (s < 0 || s >= MC_MAX_CONNECTIONS
  1345. X        || !(sp->state & MC_VALID)) {
  1346. X        /* return(recvfrom(s, buf, len, flags)); */
  1347. X        errno = EBADF;
  1348. X        return(-1);
  1349. X    }
  1350. X    if (sp->state & MC_CORRUPTED) {
  1351. X        errno = EIO;
  1352. X        return(-1);
  1353. X    }
  1354. X    /* temped to check to see if socket if bound, but that isn't done for
  1355. X       the standard protocols so we won't either */
  1356. X    tmp.family = sp->family;
  1357. X    tmp.group = sp->group;
  1358. X    tmp.member = sp->local;
  1359. X    (void)memcpy(np, &tmp, len);
  1360. X    *namelen = len;
  1361. X    return(0);
  1362. X}
  1363. END_OF_FILE
  1364. if test 3183 -ne `wc -c <'libmcast/mc_getsockname.c'`; then
  1365.     echo shar: \"'libmcast/mc_getsockname.c'\" unpacked with wrong size!
  1366. fi
  1367. # end of 'libmcast/mc_getsockname.c'
  1368. fi
  1369. if test -f 'libmcast/mc_getsockopt.c' -a "${1}" != "-c" ; then 
  1370.   echo shar: Will not clobber existing file \"'libmcast/mc_getsockopt.c'\"
  1371. else
  1372. echo shar: Extracting \"'libmcast/mc_getsockopt.c'\" \(3281 characters\)
  1373. sed "s/^X//" >'libmcast/mc_getsockopt.c' <<'END_OF_FILE'
  1374. X/*
  1375. X * $Header: /u0/casey/src/mcast/libmcast/RCS/mc_getsockopt.c,v 1.2 92/11/17 16:56:15 casey Exp $
  1376. X */
  1377. X
  1378. X/*
  1379. X * Copyright (c) 1992 The Regents of the University of California.
  1380. X * All rights reserved.
  1381. X *
  1382. X * Redistribution and use in source and binary forms, with or without
  1383. X * modification, are permitted provided that the following conditions
  1384. X * are met:
  1385. X * 1. Redistributions of source code must retain the above copyright
  1386. X *    notice, this list of conditions and the following disclaimer.
  1387. X * 2. Redistributions in binary form must reproduce the above copyright
  1388. X *    notice, this list of conditions and the following disclaimer in the
  1389. X *    documentation and/or other materials provided with the distribution.
  1390. X * 3. All advertising materials mentioning features or use of this software
  1391. X *    must display the following acknowledgement:
  1392. X *    This product includes software developed by the University of
  1393. X *    California, Lawrence Livermore National Laboratory and its
  1394. X *    contributors.
  1395. X * 4. Neither the name of the University nor the names of its contributors
  1396. X *    may be used to endorse or promote products derived from this software
  1397. X *    without specific prior written permission.
  1398. X *
  1399. X * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  1400. X * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  1401. X * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  1402. X * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  1403. X * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  1404. X * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  1405. X * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  1406. X * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  1407. X * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  1408. X * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  1409. X * SUCH DAMAGE.
  1410. X */
  1411. X
  1412. X#ifndef lint
  1413. static char rcsid[] = "$Header: /u0/casey/src/mcast/libmcast/RCS/mc_getsockopt.c,v 1.2 92/11/17 16:56:15 casey Exp $";
  1414. static char copyright[] =
  1415. X    "Copyright (c) 1992 The Regents of the University of California.\n"
  1416. X    "All rights reserved.\n";
  1417. static char classification[] =
  1418. X    "Unclassified\n";
  1419. X#endif
  1420. X
  1421. X
  1422. X/*
  1423. X * MCAST SYSLIB PUBLIC: mc_getsockopt: getsockopt(2) system call emulation
  1424. X * routine.
  1425. X */
  1426. X
  1427. X
  1428. X#include "mc_lib.h"
  1429. X
  1430. X
  1431. int
  1432. mc_getsockopt(int s, int level, int optname, void *optval, int *optlen)
  1433. X    /*
  1434. X     * Get multicast socket options.  Only socket level (SOL_SOCKET)
  1435. X     * options are supported and very few of them at that ...
  1436. X     */
  1437. X{
  1438. X    mc_state *sp = &_mc_state[s];
  1439. X
  1440. X    if (s < 0 || s >= MC_MAX_CONNECTIONS
  1441. X        || !(sp->state & MC_VALID)) {
  1442. X        /* return(getsockopt(s, level, optname, optval, optlen)); */
  1443. X        errno = EBADF;
  1444. X        return(-1);
  1445. X    }
  1446. X    if (sp->state & MC_CORRUPTED) {
  1447. X        errno = EIO;
  1448. X        return(-1);
  1449. X    }
  1450. X    if (level != SOL_SOCKET) {
  1451. X        /* only socket level options supported */
  1452. X        errno = ENOPROTOOPT;
  1453. X        return(-1);
  1454. X    }
  1455. X    if (optname == SO_TYPE)
  1456. X        return(sp->type);
  1457. X    if (optname != SO_SNDBUF && optname != SO_RCVBUF
  1458. X        && optname != SO_ERROR) {
  1459. X        /* so far only a few socket options supported */
  1460. X        errno = ENOPROTOOPT;
  1461. X        return(-1);
  1462. X    }
  1463. X    return(getsockopt(s, level, optname, optval, optlen));
  1464. X}
  1465. END_OF_FILE
  1466. if test 3281 -ne `wc -c <'libmcast/mc_getsockopt.c'`; then
  1467.     echo shar: \"'libmcast/mc_getsockopt.c'\" unpacked with wrong size!
  1468. fi
  1469. # end of 'libmcast/mc_getsockopt.c'
  1470. fi
  1471. if test -f 'libmcast/mc_ioctl.c' -a "${1}" != "-c" ; then 
  1472.   echo shar: Will not clobber existing file \"'libmcast/mc_ioctl.c'\"
  1473. else
  1474. echo shar: Extracting \"'libmcast/mc_ioctl.c'\" \(3493 characters\)
  1475. sed "s/^X//" >'libmcast/mc_ioctl.c' <<'END_OF_FILE'
  1476. X/*
  1477. X * $Header: /u0/casey/src/mcast/libmcast/RCS/mc_ioctl.c,v 1.2 92/11/17 16:56:15 casey Exp $
  1478. X */
  1479. X
  1480. X/*
  1481. X * Copyright (c) 1992 The Regents of the University of California.
  1482. X * All rights reserved.
  1483. X *
  1484. X * Redistribution and use in source and binary forms, with or without
  1485. X * modification, are permitted provided that the following conditions
  1486. X * are met:
  1487. X * 1. Redistributions of source code must retain the above copyright
  1488. X *    notice, this list of conditions and the following disclaimer.
  1489. X * 2. Redistributions in binary form must reproduce the above copyright
  1490. X *    notice, this list of conditions and the following disclaimer in the
  1491. X *    documentation and/or other materials provided with the distribution.
  1492. X * 3. All advertising materials mentioning features or use of this software
  1493. X *    must display the following acknowledgement:
  1494. X *    This product includes software developed by the University of
  1495. X *    California, Lawrence Livermore National Laboratory and its
  1496. X *    contributors.
  1497. X * 4. Neither the name of the University nor the names of its contributors
  1498. X *    may be used to endorse or promote products derived from this software
  1499. X *    without specific prior written permission.
  1500. X *
  1501. X * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  1502. X * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  1503. X * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  1504. X * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  1505. X * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  1506. X * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  1507. X * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  1508. X * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  1509. X * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  1510. X * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  1511. X * SUCH DAMAGE.
  1512. X */
  1513. X
  1514. X#ifndef lint
  1515. static char rcsid[] = "$Header: /u0/casey/src/mcast/libmcast/RCS/mc_ioctl.c,v 1.2 92/11/17 16:56:15 casey Exp $";
  1516. static char copyright[] =
  1517. X    "Copyright (c) 1992 The Regents of the University of California.\n"
  1518. X    "All rights reserved.\n";
  1519. static char classification[] =
  1520. X    "Unclassified\n";
  1521. X#endif
  1522. X
  1523. X
  1524. X/*
  1525. X * MCAST SYSLIB PUBLIC: mc_ioctl: ioctl(2) system call emulation routine.
  1526. X */
  1527. X
  1528. X
  1529. X#include "mc_lib.h"
  1530. X
  1531. X
  1532. X/*VARARGS2*/
  1533. int
  1534. mc_ioctl(int s, int request, ...)
  1535. X    /*
  1536. X     * Perform I/O control operation on multicast socket.  Most of the
  1537. X     * operations are duplicates of fcntl operations and are, in fact,
  1538. X     * shunted off to fcntl to be performed.
  1539. X     */
  1540. X{
  1541. X    mc_state *sp = &_mc_state[s];
  1542. X    va_list va;
  1543. X
  1544. X    va_start(va, request);
  1545. X    if (s < 0 || s >= MC_MAX_CONNECTIONS
  1546. X        || !(sp->state & MC_VALID)) {
  1547. X        /* return(ioctl(s, request, va_arg(va, int))); */
  1548. X        errno = EBADF;
  1549. X        return(-1);
  1550. X    }
  1551. X    if (sp->state & MC_CORRUPTED) {
  1552. X        errno = EIO;
  1553. X        return(-1);
  1554. X    }
  1555. X
  1556. X    switch (request) {
  1557. X        default:
  1558. X        errno = EINVAL;
  1559. X        return(-1);
  1560. X
  1561. X        case MCIOCLOOPBACK:
  1562. X        return(mc_fcntl(s, F_SETFL, sp->flags | MCO_LOOPBACK));
  1563. X
  1564. X        case FIONBIO:
  1565. X        return(mc_fcntl(s, F_SETFL, sp->flags | O_NONBLOCK));
  1566. X
  1567. X        case FIONREAD:
  1568. X        /*
  1569. X         * We only return the amount of data left to read in the
  1570. X         * current message instead of the agregate of all received
  1571. X         * messages.  Oh well ...
  1572. X         */
  1573. X        if (sp->resid == 0)
  1574. X            if (_mc_pullup(s, O_NONBLOCK) < 0)
  1575. X                return(-1);
  1576. X        *va_arg(va, long *) = sp->resid;
  1577. X        return(0);
  1578. X    }
  1579. X    /*NOTREACHED*/
  1580. X    va_end(va);
  1581. X}
  1582. END_OF_FILE
  1583. if test 3493 -ne `wc -c <'libmcast/mc_ioctl.c'`; then
  1584.     echo shar: \"'libmcast/mc_ioctl.c'\" unpacked with wrong size!
  1585. fi
  1586. # end of 'libmcast/mc_ioctl.c'
  1587. fi
  1588. if test -f 'libmcast/mc_read.c' -a "${1}" != "-c" ; then 
  1589.   echo shar: Will not clobber existing file \"'libmcast/mc_read.c'\"
  1590. else
  1591. echo shar: Extracting \"'libmcast/mc_read.c'\" \(2872 characters\)
  1592. sed "s/^X//" >'libmcast/mc_read.c' <<'END_OF_FILE'
  1593. X/*
  1594. X * $Header: /u0/casey/src/mcast/libmcast/RCS/mc_read.c,v 1.1 92/10/16 18:22:47 casey Exp $
  1595. X */
  1596. X
  1597. X/*
  1598. X * Copyright (c) 1992 The Regents of the University of California.
  1599. X * All rights reserved.
  1600. X *
  1601. X * Redistribution and use in source and binary forms, with or without
  1602. X * modification, are permitted provided that the following conditions
  1603. X * are met:
  1604. X * 1. Redistributions of source code must retain the above copyright
  1605. X *    notice, this list of conditions and the following disclaimer.
  1606. X * 2. Redistributions in binary form must reproduce the above copyright
  1607. X *    notice, this list of conditions and the following disclaimer in the
  1608. X *    documentation and/or other materials provided with the distribution.
  1609. X * 3. All advertising materials mentioning features or use of this software
  1610. X *    must display the following acknowledgement:
  1611. X *    This product includes software developed by the University of
  1612. X *    California, Lawrence Livermore National Laboratory and its
  1613. X *    contributors.
  1614. X * 4. Neither the name of the University nor the names of its contributors
  1615. X *    may be used to endorse or promote products derived from this software
  1616. X *    without specific prior written permission.
  1617. X *
  1618. X * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  1619. X * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  1620. X * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  1621. X * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  1622. X * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  1623. X * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  1624. X * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  1625. X * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  1626. X * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  1627. X * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  1628. X * SUCH DAMAGE.
  1629. X */
  1630. X
  1631. X#ifndef lint
  1632. static char rcsid[] = "$Header: /u0/casey/src/mcast/libmcast/RCS/mc_read.c,v 1.1 92/10/16 18:22:47 casey Exp $";
  1633. static char copyright[] =
  1634. X    "Copyright (c) 1992 The Regents of the University of California.\n"
  1635. X    "All rights reserved.\n";
  1636. static char classification[] =
  1637. X    "Unclassified\n";
  1638. X#endif
  1639. X
  1640. X
  1641. X/*
  1642. X * MCAST SYSLIB PUBLIC: mc_read: read(2) system call emulation routine.
  1643. X */
  1644. X
  1645. X
  1646. X#include "mc_lib.h"
  1647. X
  1648. X
  1649. int
  1650. mc_read(int s, void *buf, size_t len)
  1651. X{
  1652. X    mc_state *sp = &_mc_state[s];
  1653. X
  1654. X    if (s < 0 || s >= MC_MAX_CONNECTIONS
  1655. X        || !(sp->state & MC_VALID)) {
  1656. X        /* return(read(s, buf, len)); */
  1657. X        errno = EBADF;
  1658. X        return(-1);
  1659. X    }
  1660. X    if (sp->state & MC_CORRUPTED) {
  1661. X        errno = EIO;
  1662. X        return(-1);
  1663. X    }
  1664. X    if ((int)len <= 0) {
  1665. X        errno = EINVAL;
  1666. X        return(-1);
  1667. X    }
  1668. X    if (!(sp->state & MC_BOUND)) {
  1669. X        errno = EPIPE;
  1670. X        return(-1);
  1671. X    }
  1672. X    if (sp->state & MC_SHUTDOWNRECV)
  1673. X        return(0);
  1674. X    return(_mc_read(s, buf, len, 0, NULL));
  1675. X}
  1676. END_OF_FILE
  1677. if test 2872 -ne `wc -c <'libmcast/mc_read.c'`; then
  1678.     echo shar: \"'libmcast/mc_read.c'\" unpacked with wrong size!
  1679. fi
  1680. # end of 'libmcast/mc_read.c'
  1681. fi
  1682. if test -f 'libmcast/mc_readv.c' -a "${1}" != "-c" ; then 
  1683.   echo shar: Will not clobber existing file \"'libmcast/mc_readv.c'\"
  1684. else
  1685. echo shar: Extracting \"'libmcast/mc_readv.c'\" \(2993 characters\)
  1686. sed "s/^X//" >'libmcast/mc_readv.c' <<'END_OF_FILE'
  1687. X/*
  1688. X * $Header: /u0/casey/src/mcast/libmcast/RCS/mc_readv.c,v 1.2 93/01/16 19:47:40 casey Exp $
  1689. X */
  1690. X
  1691. X/*
  1692. X * Copyright (c) 1992 The Regents of the University of California.
  1693. X * All rights reserved.
  1694. X *
  1695. X * Redistribution and use in source and binary forms, with or without
  1696. X * modification, are permitted provided that the following conditions
  1697. X * are met:
  1698. X * 1. Redistributions of source code must retain the above copyright
  1699. X *    notice, this list of conditions and the following disclaimer.
  1700. X * 2. Redistributions in binary form must reproduce the above copyright
  1701. X *    notice, this list of conditions and the following disclaimer in the
  1702. X *    documentation and/or other materials provided with the distribution.
  1703. X * 3. All advertising materials mentioning features or use of this software
  1704. X *    must display the following acknowledgement:
  1705. X *    This product includes software developed by the University of
  1706. X *    California, Lawrence Livermore National Laboratory and its
  1707. X *    contributors.
  1708. X * 4. Neither the name of the University nor the names of its contributors
  1709. X *    may be used to endorse or promote products derived from this software
  1710. X *    without specific prior written permission.
  1711. X *
  1712. X * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  1713. X * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  1714. X * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  1715. X * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  1716. X * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  1717. X * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  1718. X * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  1719. X * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  1720. X * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  1721. X * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  1722. X * SUCH DAMAGE.
  1723. X */
  1724. X
  1725. X#ifndef lint
  1726. static char rcsid[] = "$Header: /u0/casey/src/mcast/libmcast/RCS/mc_readv.c,v 1.2 93/01/16 19:47:40 casey Exp $";
  1727. static char copyright[] =
  1728. X    "Copyright (c) 1992 The Regents of the University of California.\n"
  1729. X    "All rights reserved.\n";
  1730. static char classification[] =
  1731. X    "Unclassified\n";
  1732. X#endif
  1733. X
  1734. X
  1735. X/*
  1736. X * MCAST SYSLIB PUBLIC: mc_readv: readv(2) system call emulation routine.
  1737. X */
  1738. X
  1739. X
  1740. X#include "mc_lib.h"
  1741. X
  1742. X
  1743. X/*ARGSUSED*/ /* this is only because readv isn't really implemented yet */
  1744. int
  1745. mc_readv(int s, const struct iovec *iov, int iovcnt)
  1746. X{
  1747. X    mc_state *sp = &_mc_state[s];
  1748. X
  1749. X    if (s < 0 || s >= MC_MAX_CONNECTIONS
  1750. X        || !(sp->state & MC_VALID)) {
  1751. X        /* return(read(s, buf, len)); */
  1752. X        errno = EBADF;
  1753. X        return(-1);
  1754. X    }
  1755. X    if (sp->state & MC_CORRUPTED) {
  1756. X        errno = EIO;
  1757. X        return(-1);
  1758. X    }
  1759. X    if (iovcnt < 0) {
  1760. X        errno = EINVAL;
  1761. X        return(-1);
  1762. X    }
  1763. X    if (!(sp->state & MC_BOUND)) {
  1764. X        errno = EDESTADDRREQ;
  1765. X        return(-1);
  1766. X    }
  1767. X    if (sp->state & MC_SHUTDOWNRECV)
  1768. X        return(0);
  1769. X    /* readv not implemented yet ... */
  1770. X    errno = EIO;
  1771. X    return(-1);
  1772. X}
  1773. END_OF_FILE
  1774. if test 2993 -ne `wc -c <'libmcast/mc_readv.c'`; then
  1775.     echo shar: \"'libmcast/mc_readv.c'\" unpacked with wrong size!
  1776. fi
  1777. # end of 'libmcast/mc_readv.c'
  1778. fi
  1779. if test -f 'libmcast/mc_recv.c' -a "${1}" != "-c" ; then 
  1780.   echo shar: Will not clobber existing file \"'libmcast/mc_recv.c'\"
  1781. else
  1782. echo shar: Extracting \"'libmcast/mc_recv.c'\" \(2481 characters\)
  1783. sed "s/^X//" >'libmcast/mc_recv.c' <<'END_OF_FILE'
  1784. X/*
  1785. X * $Header: /u0/casey/src/mcast/libmcast/RCS/mc_recv.c,v 1.1 92/10/16 18:22:48 casey Exp $
  1786. X */
  1787. X
  1788. X/*
  1789. X * Copyright (c) 1992 The Regents of the University of California.
  1790. X * All rights reserved.
  1791. X *
  1792. X * Redistribution and use in source and binary forms, with or without
  1793. X * modification, are permitted provided that the following conditions
  1794. X * are met:
  1795. X * 1. Redistributions of source code must retain the above copyright
  1796. X *    notice, this list of conditions and the following disclaimer.
  1797. X * 2. Redistributions in binary form must reproduce the above copyright
  1798. X *    notice, this list of conditions and the following disclaimer in the
  1799. X *    documentation and/or other materials provided with the distribution.
  1800. X * 3. All advertising materials mentioning features or use of this software
  1801. X *    must display the following acknowledgement:
  1802. X *    This product includes software developed by the University of
  1803. X *    California, Lawrence Livermore National Laboratory and its
  1804. X *    contributors.
  1805. X * 4. Neither the name of the University nor the names of its contributors
  1806. X *    may be used to endorse or promote products derived from this software
  1807. X *    without specific prior written permission.
  1808. X *
  1809. X * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  1810. X * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  1811. X * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  1812. X * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  1813. X * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  1814. X * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  1815. X * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  1816. X * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  1817. X * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  1818. X * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  1819. X * SUCH DAMAGE.
  1820. X */
  1821. X
  1822. X#ifndef lint
  1823. static char rcsid[] = "$Header: /u0/casey/src/mcast/libmcast/RCS/mc_recv.c,v 1.1 92/10/16 18:22:48 casey Exp $";
  1824. static char copyright[] =
  1825. X    "Copyright (c) 1992 The Regents of the University of California.\n"
  1826. X    "All rights reserved.\n";
  1827. static char classification[] =
  1828. X    "Unclassified\n";
  1829. X#endif
  1830. X
  1831. X
  1832. X/*
  1833. X * MCAST SYSLIB PUBLIC: mc_recv: recv(2) system call emulation routine.
  1834. X */
  1835. X
  1836. X
  1837. X#include "mc_lib.h"
  1838. X
  1839. X
  1840. int
  1841. mc_recv(int s, void *buf, int len, int flags)
  1842. X{
  1843. X    return(mc_recvfrom(s, buf, len, flags, NULL, 0));
  1844. X}
  1845. END_OF_FILE
  1846. if test 2481 -ne `wc -c <'libmcast/mc_recv.c'`; then
  1847.     echo shar: \"'libmcast/mc_recv.c'\" unpacked with wrong size!
  1848. fi
  1849. # end of 'libmcast/mc_recv.c'
  1850. fi
  1851. if test -f 'libmcast/mc_recvfrom.c' -a "${1}" != "-c" ; then 
  1852.   echo shar: Will not clobber existing file \"'libmcast/mc_recvfrom.c'\"
  1853. else
  1854. echo shar: Extracting \"'libmcast/mc_recvfrom.c'\" \(3260 characters\)
  1855. sed "s/^X//" >'libmcast/mc_recvfrom.c' <<'END_OF_FILE'
  1856. X/*
  1857. X * $Header: /u0/casey/src/mcast/libmcast/RCS/mc_recvfrom.c,v 1.2 93/01/16 19:48:40 casey Exp $
  1858. X */
  1859. X
  1860. X/*
  1861. X * Copyright (c) 1992 The Regents of the University of California.
  1862. X * All rights reserved.
  1863. X *
  1864. X * Redistribution and use in source and binary forms, with or without
  1865. X * modification, are permitted provided that the following conditions
  1866. X * are met:
  1867. X * 1. Redistributions of source code must retain the above copyright
  1868. X *    notice, this list of conditions and the following disclaimer.
  1869. X * 2. Redistributions in binary form must reproduce the above copyright
  1870. X *    notice, this list of conditions and the following disclaimer in the
  1871. X *    documentation and/or other materials provided with the distribution.
  1872. X * 3. All advertising materials mentioning features or use of this software
  1873. X *    must display the following acknowledgement:
  1874. X *    This product includes software developed by the University of
  1875. X *    California, Lawrence Livermore National Laboratory and its
  1876. X *    contributors.
  1877. X * 4. Neither the name of the University nor the names of its contributors
  1878. X *    may be used to endorse or promote products derived from this software
  1879. X *    without specific prior written permission.
  1880. X *
  1881. X * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  1882. X * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  1883. X * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  1884. X * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  1885. X * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  1886. X * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  1887. X * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  1888. X * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  1889. X * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  1890. X * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  1891. X * SUCH DAMAGE.
  1892. X */
  1893. X
  1894. X#ifndef lint
  1895. static char rcsid[] = "$Header: /u0/casey/src/mcast/libmcast/RCS/mc_recvfrom.c,v 1.2 93/01/16 19:48:40 casey Exp $";
  1896. static char copyright[] =
  1897. X    "Copyright (c) 1992 The Regents of the University of California.\n"
  1898. X    "All rights reserved.\n";
  1899. static char classification[] =
  1900. X    "Unclassified\n";
  1901. X#endif
  1902. X
  1903. X
  1904. X/*
  1905. X * MCAST SYSLIB PUBLIC: mc_recvfrom: recvfrom(2) system call emulation routine.
  1906. X */
  1907. X
  1908. X
  1909. X#include "mc_lib.h"
  1910. X
  1911. X
  1912. int
  1913. mc_recvfrom(int s, void *buf, int len, int flags,
  1914. X        struct sockaddr *from, int *fromlen)
  1915. X{
  1916. X    mc_state *sp = &_mc_state[s];
  1917. X    struct sockaddr_mcast *np = (struct sockaddr_mcast *)from;
  1918. X
  1919. X    if (s < 0 || s >= MC_MAX_CONNECTIONS
  1920. X        || !(sp->state & MC_VALID)) {
  1921. X        /* return(recvfrom(s, buf, len, flags)); */
  1922. X        errno = EBADF;
  1923. X        return(-1);
  1924. X    }
  1925. X    if (sp->state & MC_CORRUPTED) {
  1926. X        errno = EIO;
  1927. X        return(-1);
  1928. X    }
  1929. X    if (len < 0) {
  1930. X        errno = EINVAL;
  1931. X        return(-1);
  1932. X    }
  1933. X    if (sp->state & MC_SHUTDOWNRECV)
  1934. X        return(0);
  1935. X    if (!(sp->state & MC_BOUND)) {
  1936. X        errno = EPIPE;
  1937. X        return(-1);
  1938. X    }
  1939. X    if (from == NULL)
  1940. X        return(_mc_read(s, buf, len, flags, NULL));
  1941. X    if (*fromlen < sizeof(struct sockaddr_mcast)) {
  1942. X        errno = EINVAL;
  1943. X        return(-1);
  1944. X    }
  1945. X    *fromlen = sizeof(struct sockaddr_mcast);
  1946. X    np->family = sp->family;
  1947. X    np->group = sp->group;
  1948. X    return(_mc_read(s, buf, len, flags, &np->member));
  1949. X}
  1950. END_OF_FILE
  1951. if test 3260 -ne `wc -c <'libmcast/mc_recvfrom.c'`; then
  1952.     echo shar: \"'libmcast/mc_recvfrom.c'\" unpacked with wrong size!
  1953. fi
  1954. # end of 'libmcast/mc_recvfrom.c'
  1955. fi
  1956. if test -f 'libmcast/mc_send.c' -a "${1}" != "-c" ; then 
  1957.   echo shar: Will not clobber existing file \"'libmcast/mc_send.c'\"
  1958. else
  1959. echo shar: Extracting \"'libmcast/mc_send.c'\" \(2485 characters\)
  1960. sed "s/^X//" >'libmcast/mc_send.c' <<'END_OF_FILE'
  1961. X/*
  1962. X * $Header: /u0/casey/src/mcast/libmcast/RCS/mc_send.c,v 1.2 93/01/16 19:49:39 casey Exp $
  1963. X */
  1964. X
  1965. X/*
  1966. X * Copyright (c) 1992 The Regents of the University of California.
  1967. X * All rights reserved.
  1968. X *
  1969. X * Redistribution and use in source and binary forms, with or without
  1970. X * modification, are permitted provided that the following conditions
  1971. X * are met:
  1972. X * 1. Redistributions of source code must retain the above copyright
  1973. X *    notice, this list of conditions and the following disclaimer.
  1974. X * 2. Redistributions in binary form must reproduce the above copyright
  1975. X *    notice, this list of conditions and the following disclaimer in the
  1976. X *    documentation and/or other materials provided with the distribution.
  1977. X * 3. All advertising materials mentioning features or use of this software
  1978. X *    must display the following acknowledgement:
  1979. X *    This product includes software developed by the University of
  1980. X *    California, Lawrence Livermore National Laboratory and its
  1981. X *    contributors.
  1982. X * 4. Neither the name of the University nor the names of its contributors
  1983. X *    may be used to endorse or promote products derived from this software
  1984. X *    without specific prior written permission.
  1985. X *
  1986. X * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  1987. X * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  1988. X * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  1989. X * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  1990. X * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  1991. X * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  1992. X * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  1993. X * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  1994. X * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  1995. X * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  1996. X * SUCH DAMAGE.
  1997. X */
  1998. X
  1999. X#ifndef lint
  2000. static char rcsid[] = "$Header: /u0/casey/src/mcast/libmcast/RCS/mc_send.c,v 1.2 93/01/16 19:49:39 casey Exp $";
  2001. static char copyright[] =
  2002. X    "Copyright (c) 1992 The Regents of the University of California.\n"
  2003. X    "All rights reserved.\n";
  2004. static char classification[] =
  2005. X    "Unclassified\n";
  2006. X#endif
  2007. X
  2008. X
  2009. X/*
  2010. X * MCAST SYSLIB PUBLIC: mc_send: send(2) system call emulation routine.
  2011. X */
  2012. X
  2013. X
  2014. X#include "mc_lib.h"
  2015. X
  2016. X
  2017. int
  2018. mc_send(int s, const void *buf, int len, int flags)
  2019. X{
  2020. X    return(mc_sendto(s, buf, len, flags, NULL, 0));
  2021. X}
  2022. END_OF_FILE
  2023. if test 2485 -ne `wc -c <'libmcast/mc_send.c'`; then
  2024.     echo shar: \"'libmcast/mc_send.c'\" unpacked with wrong size!
  2025. fi
  2026. # end of 'libmcast/mc_send.c'
  2027. fi
  2028. if test -f 'libmcast/mc_setsockopt.c' -a "${1}" != "-c" ; then 
  2029.   echo shar: Will not clobber existing file \"'libmcast/mc_setsockopt.c'\"
  2030. else
  2031. echo shar: Extracting \"'libmcast/mc_setsockopt.c'\" \(3213 characters\)
  2032. sed "s/^X//" >'libmcast/mc_setsockopt.c' <<'END_OF_FILE'
  2033. X/*
  2034. X * $Header: /u0/casey/src/mcast/libmcast/RCS/mc_setsockopt.c,v 1.2 92/11/17 16:56:16 casey Exp $
  2035. X */
  2036. X
  2037. X/*
  2038. X * Copyright (c) 1992 The Regents of the University of California.
  2039. X * All rights reserved.
  2040. X *
  2041. X * Redistribution and use in source and binary forms, with or without
  2042. X * modification, are permitted provided that the following conditions
  2043. X * are met:
  2044. X * 1. Redistributions of source code must retain the above copyright
  2045. X *    notice, this list of conditions and the following disclaimer.
  2046. X * 2. Redistributions in binary form must reproduce the above copyright
  2047. X *    notice, this list of conditions and the following disclaimer in the
  2048. X *    documentation and/or other materials provided with the distribution.
  2049. X * 3. All advertising materials mentioning features or use of this software
  2050. X *    must display the following acknowledgement:
  2051. X *    This product includes software developed by the University of
  2052. X *    California, Lawrence Livermore National Laboratory and its
  2053. X *    contributors.
  2054. X * 4. Neither the name of the University nor the names of its contributors
  2055. X *    may be used to endorse or promote products derived from this software
  2056. X *    without specific prior written permission.
  2057. X *
  2058. X * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  2059. X * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  2060. X * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  2061. X * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  2062. X * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  2063. X * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  2064. X * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  2065. X * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  2066. X * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  2067. X * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  2068. X * SUCH DAMAGE.
  2069. X */
  2070. X
  2071. X#ifndef lint
  2072. static char rcsid[] = "$Header: /u0/casey/src/mcast/libmcast/RCS/mc_setsockopt.c,v 1.2 92/11/17 16:56:16 casey Exp $";
  2073. static char copyright[] =
  2074. X    "Copyright (c) 1992 The Regents of the University of California.\n"
  2075. X    "All rights reserved.\n";
  2076. static char classification[] =
  2077. X    "Unclassified\n";
  2078. X#endif
  2079. X
  2080. X
  2081. X/*
  2082. X * MCAST SYSLIB PUBLIC: mc_setsockopt: setsockopt(2) system call emulation
  2083. X * routine.
  2084. X */
  2085. X
  2086. X
  2087. X#include "mc_lib.h"
  2088. X
  2089. X
  2090. int
  2091. mc_setsockopt(int s, int level, int optname, const void *optval, int optlen)
  2092. X    /*
  2093. X     * Set multicast socket options.  Only socket level (SOL_SOCKET)
  2094. X     * options are supported and very few of them at that ...
  2095. X     */
  2096. X{
  2097. X    mc_state *sp = &_mc_state[s];
  2098. X
  2099. X    if (s < 0 || s >= MC_MAX_CONNECTIONS
  2100. X        || !(sp->state & MC_VALID)) {
  2101. X        /* return(setsockopt(s, level, optname, optval, optlen)); */
  2102. X        errno = EBADF;
  2103. X        return(-1);
  2104. X    }
  2105. X    if (sp->state & MC_CORRUPTED) {
  2106. X        errno = EIO;
  2107. X        return(-1);
  2108. X    }
  2109. X    if (level != SOL_SOCKET) {
  2110. X        /* only socket level options supported */
  2111. X        errno = ENOPROTOOPT;
  2112. X        return(-1);
  2113. X    }
  2114. X    if (optname != SO_SNDBUF && optname != SO_RCVBUF) {
  2115. X        /* so far only a few socket options supported */
  2116. X        errno = ENOPROTOOPT;
  2117. X        return(-1);
  2118. X    }
  2119. X    return(setsockopt(s, level, optname, optval, optlen));
  2120. X}
  2121. END_OF_FILE
  2122. if test 3213 -ne `wc -c <'libmcast/mc_setsockopt.c'`; then
  2123.     echo shar: \"'libmcast/mc_setsockopt.c'\" unpacked with wrong size!
  2124. fi
  2125. # end of 'libmcast/mc_setsockopt.c'
  2126. fi
  2127. if test -f 'libmcast/mc_shutdown.c' -a "${1}" != "-c" ; then 
  2128.   echo shar: Will not clobber existing file \"'libmcast/mc_shutdown.c'\"
  2129. else
  2130. echo shar: Extracting \"'libmcast/mc_shutdown.c'\" \(3176 characters\)
  2131. sed "s/^X//" >'libmcast/mc_shutdown.c' <<'END_OF_FILE'
  2132. X/*
  2133. X * $Header: /u0/casey/src/mcast/libmcast/RCS/mc_shutdown.c,v 1.1 92/10/16 18:22:51 casey Exp $
  2134. X */
  2135. X
  2136. X/*
  2137. X * Copyright (c) 1992 The Regents of the University of California.
  2138. X * All rights reserved.
  2139. X *
  2140. X * Redistribution and use in source and binary forms, with or without
  2141. X * modification, are permitted provided that the following conditions
  2142. X * are met:
  2143. X * 1. Redistributions of source code must retain the above copyright
  2144. X *    notice, this list of conditions and the following disclaimer.
  2145. X * 2. Redistributions in binary form must reproduce the above copyright
  2146. X *    notice, this list of conditions and the following disclaimer in the
  2147. X *    documentation and/or other materials provided with the distribution.
  2148. X * 3. All advertising materials mentioning features or use of this software
  2149. X *    must display the following acknowledgement:
  2150. X *    This product includes software developed by the University of
  2151. X *    California, Lawrence Livermore National Laboratory and its
  2152. X *    contributors.
  2153. X * 4. Neither the name of the University nor the names of its contributors
  2154. X *    may be used to endorse or promote products derived from this software
  2155. X *    without specific prior written permission.
  2156. X *
  2157. X * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  2158. X * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  2159. X * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  2160. X * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  2161. X * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  2162. X * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  2163. X * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  2164. X * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  2165. X * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  2166. X * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  2167. X * SUCH DAMAGE.
  2168. X */
  2169. X
  2170. X#ifndef lint
  2171. static char rcsid[] = "$Header: /u0/casey/src/mcast/libmcast/RCS/mc_shutdown.c,v 1.1 92/10/16 18:22:51 casey Exp $";
  2172. static char copyright[] =
  2173. X    "Copyright (c) 1992 The Regents of the University of California.\n"
  2174. X    "All rights reserved.\n";
  2175. static char classification[] =
  2176. X    "Unclassified\n";
  2177. X#endif
  2178. X
  2179. X
  2180. X/*
  2181. X * MCAST SYSLIB PUBLIC: mc_shutdown: shutdown(2) system call emulation routine.
  2182. X */
  2183. X
  2184. X
  2185. X#include "mc_lib.h"
  2186. X
  2187. X
  2188. int
  2189. mc_shutdown(int s, int how)
  2190. X{
  2191. X    mc_state *sp = &_mc_state[s];
  2192. X    int mask;
  2193. X
  2194. X    if (s < 0 || s >= MC_MAX_CONNECTIONS
  2195. X        || !(sp->state & MC_VALID)) {
  2196. X        /* return(close(s)); */
  2197. X        errno = EBADF;
  2198. X        return(-1);
  2199. X    }
  2200. X    if (how == 0)
  2201. X        mask = MC_SHUTDOWNRECV;
  2202. X    else if (how == 1)
  2203. X        mask = MC_SHUTDOWNSEND;
  2204. X    else if (how == 2)
  2205. X        mask = MC_SHUTDOWNRECV|MC_SHUTDOWNSEND;
  2206. X    else {
  2207. X        errno = EINVAL;
  2208. X        return(-1);
  2209. X    }
  2210. X    /* if SHUTDOWNRECV requested and we aren't already in that state ... */
  2211. X    if ((mask & ~sp->state) & MC_SHUTDOWNRECV) {
  2212. X        mcd_message command;
  2213. X
  2214. X        (void)memset(&command, 0, sizeof(command));
  2215. X        command.request = htonl(MCD_SHUTDOWNRECV);
  2216. X        command.option = htonl(1);
  2217. X        if (_mc_write(s, &command, sizeof(command), 0, &MCD_MCADDR) < 0)
  2218. X            return(-1);
  2219. X    }
  2220. X    sp->state |= mask;
  2221. X    return(0);
  2222. X}
  2223. END_OF_FILE
  2224. if test 3176 -ne `wc -c <'libmcast/mc_shutdown.c'`; then
  2225.     echo shar: \"'libmcast/mc_shutdown.c'\" unpacked with wrong size!
  2226. fi
  2227. # end of 'libmcast/mc_shutdown.c'
  2228. fi
  2229. if test -f 'libmcast/mc_write.c' -a "${1}" != "-c" ; then 
  2230.   echo shar: Will not clobber existing file \"'libmcast/mc_write.c'\"
  2231. else
  2232. echo shar: Extracting \"'libmcast/mc_write.c'\" \(2908 characters\)
  2233. sed "s/^X//" >'libmcast/mc_write.c' <<'END_OF_FILE'
  2234. X/*
  2235. X * $Header: /u0/casey/src/mcast/libmcast/RCS/mc_write.c,v 1.2 93/01/16 19:53:33 casey Exp $
  2236. X */
  2237. X
  2238. X/*
  2239. X * Copyright (c) 1992 The Regents of the University of California.
  2240. X * All rights reserved.
  2241. X *
  2242. X * Redistribution and use in source and binary forms, with or without
  2243. X * modification, are permitted provided that the following conditions
  2244. X * are met:
  2245. X * 1. Redistributions of source code must retain the above copyright
  2246. X *    notice, this list of conditions and the following disclaimer.
  2247. X * 2. Redistributions in binary form must reproduce the above copyright
  2248. X *    notice, this list of conditions and the following disclaimer in the
  2249. X *    documentation and/or other materials provided with the distribution.
  2250. X * 3. All advertising materials mentioning features or use of this software
  2251. X *    must display the following acknowledgement:
  2252. X *    This product includes software developed by the University of
  2253. X *    California, Lawrence Livermore National Laboratory and its
  2254. X *    contributors.
  2255. X * 4. Neither the name of the University nor the names of its contributors
  2256. X *    may be used to endorse or promote products derived from this software
  2257. X *    without specific prior written permission.
  2258. X *
  2259. X * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  2260. X * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  2261. X * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  2262. X * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  2263. X * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  2264. X * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  2265. X * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  2266. X * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  2267. X * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  2268. X * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  2269. X * SUCH DAMAGE.
  2270. X */
  2271. X
  2272. X#ifndef lint
  2273. static char rcsid[] = "$Header: /u0/casey/src/mcast/libmcast/RCS/mc_write.c,v 1.2 93/01/16 19:53:33 casey Exp $";
  2274. static char copyright[] =
  2275. X    "Copyright (c) 1992 The Regents of the University of California.\n"
  2276. X    "All rights reserved.\n";
  2277. static char classification[] =
  2278. X    "Unclassified\n";
  2279. X#endif
  2280. X
  2281. X
  2282. X/*
  2283. X * MCAST SYSLIB PUBLIC: mc_write: write(2) system call emulation routine.
  2284. X */
  2285. X
  2286. X
  2287. X#include "mc_lib.h"
  2288. X
  2289. X
  2290. int
  2291. mc_write(int s, const void *buf, size_t len)
  2292. X{
  2293. X    mc_state *sp = &_mc_state[s];
  2294. X
  2295. X    if (s < 0 || s >= MC_MAX_CONNECTIONS
  2296. X        || !(sp->state & MC_VALID)) {
  2297. X        /* return(write(s, buf, len)); */
  2298. X        errno = EBADF;
  2299. X        return(-1);
  2300. X    }
  2301. X    if (sp->state & MC_CORRUPTED) {
  2302. X        errno = EIO;
  2303. X        return(-1);
  2304. X    }
  2305. X    if ((int)len <= 0) {
  2306. X        errno = EINVAL;
  2307. X        return(-1);
  2308. X    }
  2309. X    if (!(sp->state & MC_BOUND)) {
  2310. X        errno = EPIPE;
  2311. X        return(-1);
  2312. X    }
  2313. X    if (sp->state & MC_SHUTDOWNSEND) {
  2314. X        errno = EPIPE;
  2315. X        return(-1);
  2316. X    }
  2317. X    return(_mc_write(s, buf, len, 0, NULL));
  2318. X}
  2319. END_OF_FILE
  2320. if test 2908 -ne `wc -c <'libmcast/mc_write.c'`; then
  2321.     echo shar: \"'libmcast/mc_write.c'\" unpacked with wrong size!
  2322. fi
  2323. # end of 'libmcast/mc_write.c'
  2324. fi
  2325. if test -f 'libmcast/mc_writev.c' -a "${1}" != "-c" ; then 
  2326.   echo shar: Will not clobber existing file \"'libmcast/mc_writev.c'\"
  2327. else
  2328. echo shar: Extracting \"'libmcast/mc_writev.c'\" \(3171 characters\)
  2329. sed "s/^X//" >'libmcast/mc_writev.c' <<'END_OF_FILE'
  2330. X/*
  2331. X * $Header: /u0/casey/src/mcast/libmcast/RCS/mc_writev.c,v 1.2 93/01/16 19:54:15 casey Exp $
  2332. X */
  2333. X
  2334. X/*
  2335. X * Copyright (c) 1992 The Regents of the University of California.
  2336. X * All rights reserved.
  2337. X *
  2338. X * Redistribution and use in source and binary forms, with or without
  2339. X * modification, are permitted provided that the following conditions
  2340. X * are met:
  2341. X * 1. Redistributions of source code must retain the above copyright
  2342. X *    notice, this list of conditions and the following disclaimer.
  2343. X * 2. Redistributions in binary form must reproduce the above copyright
  2344. X *    notice, this list of conditions and the following disclaimer in the
  2345. X *    documentation and/or other materials provided with the distribution.
  2346. X * 3. All advertising materials mentioning features or use of this software
  2347. X *    must display the following acknowledgement:
  2348. X *    This product includes software developed by the University of
  2349. X *    California, Lawrence Livermore National Laboratory and its
  2350. X *    contributors.
  2351. X * 4. Neither the name of the University nor the names of its contributors
  2352. X *    may be used to endorse or promote products derived from this software
  2353. X *    without specific prior written permission.
  2354. X *
  2355. X * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  2356. X * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  2357. X * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  2358. X * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  2359. X * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  2360. X * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  2361. X * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  2362. X * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  2363. X * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  2364. X * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  2365. X * SUCH DAMAGE.
  2366. X */
  2367. X
  2368. X#ifndef lint
  2369. static char rcsid[] = "$Header: /u0/casey/src/mcast/libmcast/RCS/mc_writev.c,v 1.2 93/01/16 19:54:15 casey Exp $";
  2370. static char copyright[] =
  2371. X    "Copyright (c) 1992 The Regents of the University of California.\n"
  2372. X    "All rights reserved.\n";
  2373. static char classification[] =
  2374. X    "Unclassified\n";
  2375. X#endif
  2376. X
  2377. X
  2378. X/*
  2379. X * MCAST SYSLIB PUBLIC: mc_writev: writev(2) system call emulation routine.
  2380. X */
  2381. X
  2382. X
  2383. X#include "mc_lib.h"
  2384. X
  2385. X
  2386. X/*ARGSUSED*/ /* this is only because writev isn't really implemented yet */
  2387. int
  2388. mc_writev(int s, const struct iovec *iov, int iovcnt)
  2389. X{
  2390. X    mc_state *sp = &_mc_state[s];
  2391. X
  2392. X    if (s < 0 || s >= MC_MAX_CONNECTIONS
  2393. X        || !(sp->state & MC_VALID)) {
  2394. X        /* return(write(s, buf, len)); */
  2395. X        errno = EBADF;
  2396. X        return(-1);
  2397. X    }
  2398. X    if (sp->state & MC_CORRUPTED) {
  2399. X        errno = EIO;
  2400. X        return(-1);
  2401. X    }
  2402. X    if (iovcnt < 0) {
  2403. X        errno = EINVAL;
  2404. X        return(-1);
  2405. X    }
  2406. X    if (!(sp->state & MC_BOUND)) {
  2407. X        errno = EDESTADDRREQ;
  2408. X        return(-1);
  2409. X    }
  2410. X    if (sp->state & MC_SHUTDOWNSEND) {
  2411. X        for (;;) {
  2412. X            (void)kill(getpid(), SIGPIPE);
  2413. X            /*
  2414. X             * Loop in case the application has a SIGPIPE
  2415. X             * handler and tries to resume this context.
  2416. X             */
  2417. X        }
  2418. X        /*NOTREACHED*/
  2419. X    }
  2420. X    /* writev not implemented yet ... */
  2421. X    errno = EIO;
  2422. X    return(-1);
  2423. X}
  2424. END_OF_FILE
  2425. if test 3171 -ne `wc -c <'libmcast/mc_writev.c'`; then
  2426.     echo shar: \"'libmcast/mc_writev.c'\" unpacked with wrong size!
  2427. fi
  2428. # end of 'libmcast/mc_writev.c'
  2429. fi
  2430. if test ! -d 'man' ; then
  2431.     echo shar: Creating directory \"'man'\"
  2432.     mkdir 'man'
  2433. fi
  2434. if test -f 'man/Makefile' -a "${1}" != "-c" ; then 
  2435.   echo shar: Will not clobber existing file \"'man/Makefile'\"
  2436. else
  2437. echo shar: Extracting \"'man/Makefile'\" \(605 characters\)
  2438. sed "s/^X//" >'man/Makefile' <<'END_OF_FILE'
  2439. X#
  2440. X# $Header: /u0/casey/src/mcast/man/RCS/Makefile,v 1.1 92/10/16 18:22:55 casey Exp $
  2441. X#
  2442. X          TOP = ..
  2443. X       CURDIR = ./man
  2444. X
  2445. X.DEFAULT:
  2446. X    @$(MAKE) $(MFLAGS) TOP="$(TOP)" CURDIR="$(CURDIR)" \
  2447. X        -f $(TOP)/config/Makefile.config \
  2448. X        -f ./Makefile.tmpl \
  2449. X        -f $(TOP)/config/Makefile.std \
  2450. X        $@
  2451. X
  2452. X.c.o:
  2453. X    @$(MAKE) $(MFLAGS) TOP="$(TOP)" CURDIR="$(CURDIR)" \
  2454. X        -f $(TOP)/config/Makefile.config \
  2455. X        -f ./Makefile.tmpl \
  2456. X        -f $(TOP)/config/Makefile.std \
  2457. X        $@
  2458. X
  2459. all:
  2460. X    @$(MAKE) $(MFLAGS) TOP="$(TOP)" CURDIR="$(CURDIR)" \
  2461. X        -f $(TOP)/config/Makefile.config \
  2462. X        -f ./Makefile.tmpl \
  2463. X        -f $(TOP)/config/Makefile.std
  2464. END_OF_FILE
  2465. if test 605 -ne `wc -c <'man/Makefile'`; then
  2466.     echo shar: \"'man/Makefile'\" unpacked with wrong size!
  2467. fi
  2468. # end of 'man/Makefile'
  2469. fi
  2470. if test -f 'man/Makefile.tmpl' -a "${1}" != "-c" ; then 
  2471.   echo shar: Will not clobber existing file \"'man/Makefile.tmpl'\"
  2472. else
  2473. echo shar: Extracting \"'man/Makefile.tmpl'\" \(2267 characters\)
  2474. sed "s/^X//" >'man/Makefile.tmpl' <<'END_OF_FILE'
  2475. X#
  2476. X# $Header: /u0/casey/src/mcast/man/RCS/Makefile.tmpl,v 1.2 92/10/16 18:22:57 casey Exp $
  2477. X#
  2478. X
  2479. X     MAN2SRCS = mc_bind.2 mc_close.2 mc_connect.2 mc_fcntl.2 \
  2480. X        mc_getpeername.2 mc_getsockname.2 mc_getsockopt.2 \
  2481. X        mc_ioctl.2 mc_read.2 mc_recv.2 mc_send.2 mc_shutdown.2 \
  2482. X        mc_socket.2 mc_write.2
  2483. X     MAN3SRCS = mcast_getgroupbyname.3 mcast_newaddr.3 mcast_sopen.3
  2484. X     MAN4SRCS = mcast.4
  2485. X     MAN8SRCS = mcastd.8
  2486. X
  2487. X      MANSRCS = $(MAN1SRCS) $(MAN2SRCS) $(MAN3SRCS) $(MAN4SRCS) \
  2488. X        $(MAN5SRCS) $(MAN8SRCS)
  2489. X
  2490. all: $(MANSRCS)
  2491. X
  2492. includes:
  2493. X
  2494. install: $(MANSRCS) $(MANROOT) $(MANDIRS) install_$(MANINSTALL)
  2495. X
  2496. X$(MANROOT) $(MANDIRS):
  2497. X    mkdir $@
  2498. X
  2499. install_man:
  2500. X    @if [ "$(MAN2SRCS)" != "" ]; then \
  2501. X        for i in $(MAN2SRCS); do \
  2502. X            m=`basename $$i .2`.$(MAN2EXT); \
  2503. X            echo cp $$i $(MAN2DIR)/$$m; \
  2504. X                 cp $$i $(MAN2DIR)/$$m; \
  2505. X        done \
  2506. X    fi
  2507. X    @if [ "$(MAN3SRCS)" != "" ]; then \
  2508. X        for i in $(MAN3SRCS); do \
  2509. X            m=`basename $$i .3`.$(MAN3EXT); \
  2510. X            echo cp $$i $(MAN3DIR)/$$m; \
  2511. X                 cp $$i $(MAN3DIR)/$$m; \
  2512. X        done \
  2513. X    fi
  2514. X    @if [ "$(MAN4SRCS)" != "" ]; then \
  2515. X        for i in $(MAN4SRCS); do \
  2516. X            m=`basename $$i .4`.$(MAN4EXT); \
  2517. X            echo cp $$i $(MAN4DIR)/$$m; \
  2518. X                 cp $$i $(MAN4DIR)/$$m; \
  2519. X        done \
  2520. X    fi
  2521. X    @if [ "$(MAN8SRCS)" != "" ]; then \
  2522. X        for i in $(MAN8SRCS); do \
  2523. X            m=`basename $$i .8`.$(MAN8EXT); \
  2524. X            echo cp $$i $(MAN8DIR)/$$m; \
  2525. X                 cp $$i $(MAN8DIR)/$$m; \
  2526. X        done \
  2527. X    fi
  2528. X
  2529. install_cat:
  2530. X    @if [ "$(MAN2SRCS)" != "" ]; then \
  2531. X        for i in $(MAN2SRCS); do \
  2532. X            m=`basename $$i .2`.$(MAN2EXT); \
  2533. X            echo nroff -man $$i '>' $(MAN2DIR)/$$m; \
  2534. X                 nroff -man $$i > $(MAN2DIR)/$$m; \
  2535. X        done \
  2536. X    fi
  2537. X    @if [ "$(MAN3SRCS)" != "" ]; then \
  2538. X        for i in $(MAN3SRCS); do \
  2539. X            m=`basename $$i .3`.$(MAN3EXT); \
  2540. X            echo nroff -man $$i '>' $(MAN3DIR)/$$m; \
  2541. X                 nroff -man $$i > $(MAN3DIR)/$$m; \
  2542. X        done \
  2543. X    fi
  2544. X    @if [ "$(MAN4SRCS)" != "" ]; then \
  2545. X        for i in $(MAN4SRCS); do \
  2546. X            m=`basename $$i .4`.$(MAN4EXT); \
  2547. X            echo nroff -man $$i '>' $(MAN4DIR)/$$m; \
  2548. X                 nroff -man $$i > $(MAN4DIR)/$$m; \
  2549. X        done \
  2550. X    fi
  2551. X    @if [ "$(MAN8SRCS)" != "" ]; then \
  2552. X        for i in $(MAN8SRCS); do \
  2553. X            m=`basename $$i .8`.$(MAN8EXT); \
  2554. X            echo nroff -man $$i '>' $(MAN8DIR)/$$m; \
  2555. X                 nroff -man $$i > $(MAN8DIR)/$$m; \
  2556. X        done \
  2557. X    fi
  2558. X
  2559. clean:
  2560. X    rm -f *~ *.o core a.out MAKELOG
  2561. X
  2562. lint:
  2563. tags:
  2564. depend:
  2565. END_OF_FILE
  2566. if test 2267 -ne `wc -c <'man/Makefile.tmpl'`; then
  2567.     echo shar: \"'man/Makefile.tmpl'\" unpacked with wrong size!
  2568. fi
  2569. # end of 'man/Makefile.tmpl'
  2570. fi
  2571. if test -f 'man/mc_close.2' -a "${1}" != "-c" ; then 
  2572.   echo shar: Will not clobber existing file \"'man/mc_close.2'\"
  2573. else
  2574. echo shar: Extracting \"'man/mc_close.2'\" \(3430 characters\)
  2575. sed "s/^X//" >'man/mc_close.2' <<'END_OF_FILE'
  2576. X.\" Copyright (c) 1992 The Regents of the University of California.
  2577. X.\" All rights reserved.
  2578. X.\"
  2579. X.\" Redistribution and use in source and binary forms, with or without
  2580. X.\" modification, are permitted provided that the following conditions
  2581. X.\" are met:
  2582. X.\" 1. Redistributions of source code must retain the above copyright
  2583. X.\"    notice, this list of conditions and the following disclaimer.
  2584. X.\" 2. Redistributions in binary form must reproduce the above copyright
  2585. X.\"    notice, this list of conditions and the following disclaimer in the
  2586. X.\"    documentation and/or other materials provided with the distribution.
  2587. X.\" 3. All advertising materials mentioning features or use of this software
  2588. X.\"    must display the following acknowledgement:
  2589. X.\"    This product includes software developed by the University of
  2590. X.\"    California, Lawrence Livermore National Laboratory and its
  2591. X.\"    contributors.
  2592. X.\" 4. Neither the name of the University nor the names of its contributors
  2593. X.\"    may be used to endorse or promote products derived from this software
  2594. X.\"    without specific prior written permission.
  2595. X.\"
  2596. X.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  2597. X.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  2598. X.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  2599. X.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  2600. X.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  2601. X.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  2602. X.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  2603. X.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  2604. X.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  2605. X.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  2606. X.\" SUCH DAMAGE.
  2607. X.\"
  2608. X.de Hd
  2609. X.ds Dt \\$4
  2610. X..
  2611. X.Hd $Header: /u0/casey/src/mcast/man/RCS/mc_close.2,v 1.1 92/10/16 18:22:59 casey Exp $
  2612. X.TH MC_CLOSE 2 \*(Dt
  2613. X.SH NAME
  2614. mc_close \- delete a multicast socket descriptor
  2615. X.SH SYNOPSIS
  2616. X.nf
  2617. X.ft B
  2618. X#include <unistd.h>
  2619. X#include <sys/types.h>
  2620. X#include <sys/socket.h>
  2621. X#include <netmcast/mcast.h>
  2622. X
  2623. int
  2624. mc_close(int s)
  2625. X.ft P
  2626. X.fi
  2627. X.SH DESCRIPTION
  2628. The
  2629. X.IR mc_close (2)
  2630. call deletes a multicast socket descriptor from the per-process object
  2631. reference table.
  2632. If this is the last reference to the underlying object, the
  2633. object will be deactivated.
  2634. X.SH COMPATIBILITY
  2635. The
  2636. X.I mc_close
  2637. call emulates the
  2638. X.IR close (2)
  2639. system call for multicast socket descriptors created with the
  2640. X.IR mc_socket (2)
  2641. call.
  2642. See the manual page for
  2643. X.IR close (2)
  2644. for a description of the emulated semantics.
  2645. X.I Mc_close
  2646. does not provide any different semantics from
  2647. X.IR close (2).
  2648. X.SH "RETURN VALUES"
  2649. Upon successful completion, a value of 0 is returned.
  2650. Otherwise, a value of -1 is returned and the global integer variable
  2651. X.I errno
  2652. is set to indicate the error.
  2653. X.SH ERRORS
  2654. See the manual page for
  2655. X.IR close (2)
  2656. for a detailed list of errors associated with the general
  2657. X.IR close (2)
  2658. system call.
  2659. X.I Mc_close
  2660. itself will fail if:
  2661. X.TP 20
  2662. X[EBADF]
  2663. X.I S
  2664. is not a valid multicast socket descriptor as returned by
  2665. X.IR mc_socket (2).
  2666. X.SH "SEE ALSO"
  2667. X.IR close (2),
  2668. X.IR mc_socket (2),
  2669. X.IR mcast (4)
  2670. X.SH STANDARDS
  2671. There are no current standards that address multicast communication.
  2672. The software described in this manual page is experimental and subject
  2673. to change at any time.
  2674. END_OF_FILE
  2675. if test 3430 -ne `wc -c <'man/mc_close.2'`; then
  2676.     echo shar: \"'man/mc_close.2'\" unpacked with wrong size!
  2677. fi
  2678. # end of 'man/mc_close.2'
  2679. fi
  2680. if test -f 'man/mc_shutdown.2' -a "${1}" != "-c" ; then 
  2681.   echo shar: Will not clobber existing file \"'man/mc_shutdown.2'\"
  2682. else
  2683. echo shar: Extracting \"'man/mc_shutdown.2'\" \(3731 characters\)
  2684. sed "s/^X//" >'man/mc_shutdown.2' <<'END_OF_FILE'
  2685. X.\" Copyright (c) 1992 The Regents of the University of California.
  2686. X.\" All rights reserved.
  2687. X.\"
  2688. X.\" Redistribution and use in source and binary forms, with or without
  2689. X.\" modification, are permitted provided that the following conditions
  2690. X.\" are met:
  2691. X.\" 1. Redistributions of source code must retain the above copyright
  2692. X.\"    notice, this list of conditions and the following disclaimer.
  2693. X.\" 2. Redistributions in binary form must reproduce the above copyright
  2694. X.\"    notice, this list of conditions and the following disclaimer in the
  2695. X.\"    documentation and/or other materials provided with the distribution.
  2696. X.\" 3. All advertising materials mentioning features or use of this software
  2697. X.\"    must display the following acknowledgement:
  2698. X.\"    This product includes software developed by the University of
  2699. X.\"    California, Lawrence Livermore National Laboratory and its
  2700. X.\"    contributors.
  2701. X.\" 4. Neither the name of the University nor the names of its contributors
  2702. X.\"    may be used to endorse or promote products derived from this software
  2703. X.\"    without specific prior written permission.
  2704. X.\"
  2705. X.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  2706. X.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  2707. X.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  2708. X.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  2709. X.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  2710. X.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  2711. X.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  2712. X.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  2713. X.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  2714. X.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  2715. X.\" SUCH DAMAGE.
  2716. X.\"
  2717. X.de Hd
  2718. X.ds Dt \\$4
  2719. X..
  2720. X.Hd $Header: /u0/casey/src/mcast/man/RCS/mc_shutdown.2,v 1.1 92/10/16 18:23:05 casey Exp $
  2721. X.TH MC_SHUTDOWN 2 \*(Dt
  2722. X.SH NAME
  2723. mc_shutdown \- shut down part of a full-duplex connection
  2724. X.SH SYNOPSIS
  2725. X.nf
  2726. X.ft B
  2727. X#include <sys/types.h>
  2728. X#include <sys/socket.h>
  2729. X#include <netmcast/mast.h>
  2730. X
  2731. int
  2732. mc_shutdown(int s, int how)
  2733. X.ft P
  2734. X.fi
  2735. X.SH DESCRIPTION
  2736. The
  2737. X.I mc_shutdown
  2738. call causes all or part of a full-duplex connection on
  2739. the multicast socket associated with
  2740. X.I s
  2741. to be shut down.
  2742. If
  2743. X.I how
  2744. is 0, further receives will be disallowed.
  2745. If
  2746. X.I how
  2747. is 1, further sends will be disallowed.
  2748. If
  2749. X.I how
  2750. is 2, further sends and receives will be disallowed.
  2751. X.SH COMPATIBILITY
  2752. The
  2753. X.I mc_shutdown
  2754. call emulates the
  2755. X.IR shutdown (2)
  2756. system call for multicast socket descriptors created with the
  2757. X.IR mc_socket (2)
  2758. call.
  2759. See the manual page for
  2760. X.IR shutdown (2)
  2761. for a description of the emulated semantics.
  2762. X.I Mc_shutdown
  2763. does not provide any different semantics from
  2764. X.IR shutdown (2).
  2765. X.SH "RETURN VALUES"
  2766. Upon successful completion, a value of 0 is returned.
  2767. Otherwise, a value of -1 is returned and the global integer variable
  2768. X.I errno
  2769. is set to indicate the error.
  2770. X.SH ERRORS
  2771. See the manual page for
  2772. X.IR shutdown (2)
  2773. for a detailed list of errors associated with the general
  2774. X.IR shutdown (2)
  2775. system call.
  2776. X.I Mc_shutdown
  2777. itself will fail if:
  2778. X.TP 20
  2779. X[EBADF]
  2780. X.I S
  2781. is not a valid multicast socket descriptor as returned by
  2782. X.IR mc_socket (2).
  2783. X.TP 20
  2784. X[EIO]
  2785. The socket state has become corrupted.  This is an artifact of a
  2786. client/server implementation of the multicast communication system.
  2787. X.SH "SEE ALSO"
  2788. X.IR mc_connect (2),
  2789. X.IR mc_socket (2),
  2790. X.IR mcast (4),
  2791. X.IR shutdown (2)
  2792. X.SH STANDARDS
  2793. There are no current standards that address multicast communication.
  2794. The software described in this manual page is experimental and subject
  2795. to change at any time.
  2796. END_OF_FILE
  2797. if test 3731 -ne `wc -c <'man/mc_shutdown.2'`; then
  2798.     echo shar: \"'man/mc_shutdown.2'\" unpacked with wrong size!
  2799. fi
  2800. # end of 'man/mc_shutdown.2'
  2801. fi
  2802. if test ! -d 'mcastd' ; then
  2803.     echo shar: Creating directory \"'mcastd'\"
  2804.     mkdir 'mcastd'
  2805. fi
  2806. if test -f 'mcastd/Makefile' -a "${1}" != "-c" ; then 
  2807.   echo shar: Will not clobber existing file \"'mcastd/Makefile'\"
  2808. else
  2809. echo shar: Extracting \"'mcastd/Makefile'\" \(613 characters\)
  2810. sed "s/^X//" >'mcastd/Makefile' <<'END_OF_FILE'
  2811. X#
  2812. X# $Header: /u0/casey/src/mcast/mcastd/RCS/Makefile,v 1.2 92/11/17 16:28:29 casey Exp $
  2813. X#
  2814. X          TOP = ..
  2815. X       CURDIR = ./mcastd
  2816. X
  2817. X.DEFAULT:
  2818. X    @$(MAKE) $(MFLAGS) TOP="$(TOP)" CURDIR="$(CURDIR)" \
  2819. X        -f $(TOP)/config/Makefile.config \
  2820. X        -f ./Makefile.tmpl \
  2821. X        -f $(TOP)/config/Makefile.std \
  2822. X        $@
  2823. X
  2824. X.c.o:
  2825. X    @$(MAKE) $(MFLAGS) TOP="$(TOP)" CURDIR="$(CURDIR)" \
  2826. X        -f $(TOP)/config/Makefile.config \
  2827. X        -f ./Makefile.tmpl \
  2828. X        -f $(TOP)/config/Makefile.std \
  2829. X        $@
  2830. X
  2831. all:
  2832. X    @$(MAKE) $(MFLAGS) TOP="$(TOP)" CURDIR="$(CURDIR)" \
  2833. X        -f $(TOP)/config/Makefile.config \
  2834. X        -f ./Makefile.tmpl \
  2835. X        -f $(TOP)/config/Makefile.std
  2836. X    
  2837. END_OF_FILE
  2838. if test 613 -ne `wc -c <'mcastd/Makefile'`; then
  2839.     echo shar: \"'mcastd/Makefile'\" unpacked with wrong size!
  2840. fi
  2841. # end of 'mcastd/Makefile'
  2842. fi
  2843. if test -f 'mcastd/Makefile.tmpl' -a "${1}" != "-c" ; then 
  2844.   echo shar: Will not clobber existing file \"'mcastd/Makefile.tmpl'\"
  2845. else
  2846. echo shar: Extracting \"'mcastd/Makefile.tmpl'\" \(574 characters\)
  2847. sed "s/^X//" >'mcastd/Makefile.tmpl' <<'END_OF_FILE'
  2848. X#
  2849. X# $Header: /u0/casey/src/mcast/mcastd/RCS/Makefile.tmpl,v 1.1 92/10/16 18:23:11 casey Exp $
  2850. X#
  2851. X         SRCS = mcastd.c
  2852. X         OBJS = mcastd.o
  2853. X       MCASTD = mcastd
  2854. X
  2855. X
  2856. all: $(MCASTD)
  2857. X
  2858. includes:
  2859. X
  2860. X$(MCASTD): $(OBJS)
  2861. X    $(CC) $(CFLAGS) -o $(MCASTD) $(OBJS)
  2862. X
  2863. install: $(MCASTD) $(ETCDIR)
  2864. X    rm -f $(ETCDIR)/$(MCASTD)
  2865. X    cp $(MCASTD) $(ETCDIR)
  2866. X
  2867. X$(ETCDIR):
  2868. X    mkdir $(ETCDIR)
  2869. X
  2870. clean:
  2871. X    rm -f $(MCASTD)
  2872. X    rm -f *~ *.o core a.out MAKELOG
  2873. X
  2874. lint:
  2875. X    lint -x $(ALLDEFINES) $(SRCS)
  2876. X
  2877. depend:
  2878. X
  2879. mcastd.o: mcastd.c $(TOP)/include/netmcast/mcast.h
  2880. mcastd.o: mcastd.c $(TOP)/include/netmcast/mcastd.h
  2881. END_OF_FILE
  2882. if test 574 -ne `wc -c <'mcastd/Makefile.tmpl'`; then
  2883.     echo shar: \"'mcastd/Makefile.tmpl'\" unpacked with wrong size!
  2884. fi
  2885. # end of 'mcastd/Makefile.tmpl'
  2886. fi
  2887. if test ! -d 'test' ; then
  2888.     echo shar: Creating directory \"'test'\"
  2889.     mkdir 'test'
  2890. fi
  2891. if test -f 'test/Makefile' -a "${1}" != "-c" ; then 
  2892.   echo shar: Will not clobber existing file \"'test/Makefile'\"
  2893. else
  2894. echo shar: Extracting \"'test/Makefile'\" \(607 characters\)
  2895. sed "s/^X//" >'test/Makefile' <<'END_OF_FILE'
  2896. X#
  2897. X# $Header: /u0/casey/src/mcast/test/RCS/Makefile,v 1.1 92/10/16 18:23:14 casey Exp $
  2898. X#
  2899. X          TOP = ..
  2900. X       CURDIR = ./test
  2901. X
  2902. X.DEFAULT:
  2903. X    @$(MAKE) $(MFLAGS) TOP="$(TOP)" CURDIR="$(CURDIR)" \
  2904. X        -f $(TOP)/config/Makefile.config \
  2905. X        -f ./Makefile.tmpl \
  2906. X        -f $(TOP)/config/Makefile.std \
  2907. X        $@
  2908. X
  2909. X.c.o:
  2910. X    @$(MAKE) $(MFLAGS) TOP="$(TOP)" CURDIR="$(CURDIR)" \
  2911. X        -f $(TOP)/config/Makefile.config \
  2912. X        -f ./Makefile.tmpl \
  2913. X        -f $(TOP)/config/Makefile.std \
  2914. X        $@
  2915. X
  2916. all:
  2917. X    @$(MAKE) $(MFLAGS) TOP="$(TOP)" CURDIR="$(CURDIR)" \
  2918. X        -f $(TOP)/config/Makefile.config \
  2919. X        -f ./Makefile.tmpl \
  2920. X        -f $(TOP)/config/Makefile.std
  2921. END_OF_FILE
  2922. if test 607 -ne `wc -c <'test/Makefile'`; then
  2923.     echo shar: \"'test/Makefile'\" unpacked with wrong size!
  2924. fi
  2925. # end of 'test/Makefile'
  2926. fi
  2927. if test -f 'test/Makefile.tmpl' -a "${1}" != "-c" ; then 
  2928.   echo shar: Will not clobber existing file \"'test/Makefile.tmpl'\"
  2929. else
  2930. echo shar: Extracting \"'test/Makefile.tmpl'\" \(1031 characters\)
  2931. sed "s/^X//" >'test/Makefile.tmpl' <<'END_OF_FILE'
  2932. X#
  2933. X# $Header: /u0/casey/src/mcast/test/RCS/Makefile.tmpl,v 1.1 92/10/16 18:23:16 casey Exp $
  2934. X#
  2935. X
  2936. X         SRCS = mc_hello.c mc_listen.c mc_send.c mc_clock.c mc_ping.c
  2937. X         OBJS = mc_hello.o mc_listen.o mc_send.o mc_clock.o mc_ping.o
  2938. X        TESTS = mc_hello mc_listen mc_send mc_clock mc_ping
  2939. X
  2940. all: $(TESTS)
  2941. X
  2942. mc_hello: mc_hello.o $(LIBMCAST)
  2943. X    $(CC) -o mc_hello mc_hello.o $(LIBMCAST)
  2944. X
  2945. mc_listen: mc_listen.o $(LIBMCAST)
  2946. X    $(CC) -o mc_listen mc_listen.o $(LIBMCAST)
  2947. X
  2948. mc_send: mc_send.o $(LIBMCAST)
  2949. X    $(CC) -o mc_send mc_send.o $(LIBMCAST)
  2950. X
  2951. mc_clock: mc_clock.o $(LIBMCAST)
  2952. X    $(CC) -o mc_clock mc_clock.o $(LIBMCAST)
  2953. X
  2954. mc_ping: mc_ping.o $(LIBMCAST)
  2955. X    $(CC) -o mc_ping mc_ping.o $(LIBMCAST)
  2956. X
  2957. includes:
  2958. X
  2959. install:
  2960. X
  2961. clean:
  2962. X    rm -f $(TESTS)
  2963. X    rm -f *~ *.o core a.out MAKELOG
  2964. X
  2965. lint:
  2966. X    lint -x $(ALLDEFINES) $(SRCS)
  2967. X
  2968. depend:
  2969. X
  2970. mc_hello.o: $(BUILDINCTOP)/netmcast/mcast.h
  2971. mc_listen.o: $(BUILDINCTOP)/netmcast/mcast.h
  2972. mc_send.o: $(BUILDINCTOP)/netmcast/mcast.h
  2973. mc_clock.o: $(BUILDINCTOP)/netmcast/mcast.h
  2974. mc_ping.o: $(BUILDINCTOP)/netmcast/mcast.h
  2975. END_OF_FILE
  2976. if test 1031 -ne `wc -c <'test/Makefile.tmpl'`; then
  2977.     echo shar: \"'test/Makefile.tmpl'\" unpacked with wrong size!
  2978. fi
  2979. # end of 'test/Makefile.tmpl'
  2980. fi
  2981. if test -f 'test/mc_hello.c' -a "${1}" != "-c" ; then 
  2982.   echo shar: Will not clobber existing file \"'test/mc_hello.c'\"
  2983. else
  2984. echo shar: Extracting \"'test/mc_hello.c'\" \(2726 characters\)
  2985. sed "s/^X//" >'test/mc_hello.c' <<'END_OF_FILE'
  2986. X/*
  2987. X * $Header: /u0/casey/src/mcast/test/RCS/mc_hello.c,v 1.3 93/01/16 20:18:35 casey Exp $
  2988. X */
  2989. X
  2990. X/*
  2991. X * Copyright (c) 1992 The Regents of the University of California.
  2992. X * All rights reserved.
  2993. X *
  2994. X * Redistribution and use in source and binary forms, with or without
  2995. X * modification, are permitted provided that the following conditions
  2996. X * are met:
  2997. X * 1. Redistributions of source code must retain the above copyright
  2998. X *    notice, this list of conditions and the following disclaimer.
  2999. X * 2. Redistributions in binary form must reproduce the above copyright
  3000. X *    notice, this list of conditions and the following disclaimer in the
  3001. X *    documentation and/or other materials provided with the distribution.
  3002. X * 3. All advertising materials mentioning features or use of this software
  3003. X *    must display the following acknowledgement:
  3004. X *    This product includes software developed by the University of
  3005. X *    California, Lawrence Livermore National Laboratory and its
  3006. X *    contributors.
  3007. X * 4. Neither the name of the University nor the names of its contributors
  3008. X *    may be used to endorse or promote products derived from this software
  3009. X *    without specific prior written permission.
  3010. X *
  3011. X * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  3012. X * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  3013. X * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  3014. X * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  3015. X * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  3016. X * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  3017. X * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  3018. X * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  3019. X * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  3020. X * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  3021. X * SUCH DAMAGE.
  3022. X */
  3023. X
  3024. X#ifndef lint
  3025. static char rcsid[] = "$Header: /u0/casey/src/mcast/test/RCS/mc_hello.c,v 1.3 93/01/16 20:18:35 casey Exp $";
  3026. static char copyright[] =
  3027. X    "Copyright (c) 1992 The Regents of the University of California.\n"
  3028. X    "All rights reserved.\n";
  3029. static char classification[] =
  3030. X    "Unclassified\n";
  3031. X#endif
  3032. X
  3033. X/*
  3034. X * Emit "hello world!" onto the "hello-world-group" multicast group.
  3035. X */
  3036. X
  3037. X
  3038. X#include <stdio.h>
  3039. X#include <fcntl.h>
  3040. X#include <sys/types.h>
  3041. X#include <sys/socket.h>
  3042. X#include <netmcast/mcast.h>
  3043. X
  3044. X/*ARGSUSED*/
  3045. main(int argc, char *argv[])
  3046. X{
  3047. X    int s;
  3048. X
  3049. X    s = mcast_sopen("hello-world-group", PF_MCAST, SOCK_STREAM, O_WRONLY);
  3050. X    if (s < 0) {
  3051. X        perror("mcast_sopen");
  3052. X        exit(1);
  3053. X    }
  3054. X    (void)mc_write(s, "hello world!\n", 13);
  3055. X    (void)mc_close(s);
  3056. X    exit(0);
  3057. X    /*NOTREACHED*/
  3058. X}
  3059. END_OF_FILE
  3060. if test 2726 -ne `wc -c <'test/mc_hello.c'`; then
  3061.     echo shar: \"'test/mc_hello.c'\" unpacked with wrong size!
  3062. fi
  3063. # end of 'test/mc_hello.c'
  3064. fi
  3065. echo shar: End of archive 1 \(of 4\).
  3066. cp /dev/null ark1isdone
  3067. MISSING=""
  3068. for I in 1 2 3 4 ; do
  3069.     if test ! -f ark${I}isdone ; then
  3070.     MISSING="${MISSING} ${I}"
  3071.     fi
  3072. done
  3073. if test "${MISSING}" = "" ; then
  3074.     echo You have unpacked all 4 archives.
  3075.     rm -f ark[1-9]isdone
  3076. else
  3077.     echo You still need to unpack the following archives:
  3078.     echo "        " ${MISSING}
  3079. fi
  3080. ##  End of shell archive.
  3081. exit 0
  3082.