change iso_pcbconnect so that specifying a null nsap as target
[unix-history] / usr / src / sys / netiso / iso_addrs.c
CommitLineData
b9795b8b
KS
1/***********************************************************
2 Copyright IBM Corporation 1987
3
4 All Rights Reserved
5
6Permission to use, copy, modify, and distribute this software and its
7documentation for any purpose and without fee is hereby granted,
8provided that the above copyright notice appear in all copies and that
9both that copyright notice and this permission notice appear in
10supporting documentation, and that the name of IBM not be
11used in advertising or publicity pertaining to distribution of the
12software without specific, written prior permission.
13
14IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
15ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
16IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
17ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
18WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
19ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
20SOFTWARE.
21
22******************************************************************/
23
24/*
25 * ARGO Project, Computer Sciences Dept., University of Wisconsin - Madison
26 */
27
28iso_maskmatch(sisoa, sisob, smask)
29 struct sockaddr_iso *sisoa, *sisob, smask;
30{
31 caddr_t a, b, c;
32 int compare_len;
33
34 if ( smask ) {
35 compare_len = smask->isoa_len;
36 } else if ((compare_len = isoaa->isoa_len) != isoab->isoa_len)
37 return 0;
38
39 return masked_cmp(&sisoa->siso_addr, &sisob->siso_addr,
40 &smask->siso_addr, compare_len);
41}
42
43int masked_cmp( a, b, c, len)
44 register caddr_t a, b, c;
45 int len;
46{
47 caddr_t ax=a, bx=b, cx=c;
48 register int i;
49
50 for( i=0; i< len; i++) {
51 if( (*a)&(*c) != (*b)&(*c) )
52 break;
53 a++;
54 b++;
55 c++;
56 }
57 return (int) i;
58}