Commit | Line | Data |
---|---|---|
b9795b8b KS |
1 | /*********************************************************** |
2 | Copyright IBM Corporation 1987 | |
3 | ||
4 | All Rights Reserved | |
5 | ||
6 | Permission to use, copy, modify, and distribute this software and its | |
7 | documentation for any purpose and without fee is hereby granted, | |
8 | provided that the above copyright notice appear in all copies and that | |
9 | both that copyright notice and this permission notice appear in | |
10 | supporting documentation, and that the name of IBM not be | |
11 | used in advertising or publicity pertaining to distribution of the | |
12 | software without specific, written prior permission. | |
13 | ||
14 | IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING | |
15 | ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL | |
16 | IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR | |
17 | ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, | |
18 | WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, | |
19 | ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS | |
20 | SOFTWARE. | |
21 | ||
22 | ******************************************************************/ | |
23 | ||
24 | /* | |
25 | * ARGO Project, Computer Sciences Dept., University of Wisconsin - Madison | |
26 | */ | |
27 | ||
28 | iso_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 | ||
43 | int 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 | } |