44
|
1 ;;; url-ns.el --- Various netscape-ish functions for proxy definitions
|
|
2 ;; Author: wmperry
|
169
|
3 ;; Created: 1997/06/29 22:51:33
|
|
4 ;; Version: 1.3
|
44
|
5 ;; Keywords: comm, data, processes, hypermedia
|
|
6
|
|
7 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
8 ;;; Copyright (c) 1997 Free Software Foundation, Inc.
|
|
9 ;;;
|
|
10 ;;; This file is not part of GNU Emacs, but the same permissions apply.
|
|
11 ;;;
|
|
12 ;;; GNU Emacs is free software; you can redistribute it and/or modify
|
|
13 ;;; it under the terms of the GNU General Public License as published by
|
|
14 ;;; the Free Software Foundation; either version 2, or (at your option)
|
|
15 ;;; any later version.
|
|
16 ;;;
|
|
17 ;;; GNU Emacs is distributed in the hope that it will be useful,
|
|
18 ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
19 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
20 ;;; GNU General Public License for more details.
|
|
21 ;;;
|
|
22 ;;; You should have received a copy of the GNU General Public License
|
|
23 ;;; along with GNU Emacs; see the file COPYING. If not, write to the
|
|
24 ;;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
25 ;;; Boston, MA 02111-1307, USA.
|
|
26 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
27
|
169
|
28 (require 'url-gw)
|
|
29
|
44
|
30 (defun isPlainHostName (host)
|
122
|
31 (not (string-match "\\." host)))
|
44
|
32
|
|
33 (defun dnsDomainIs (host dom)
|
|
34 (setq host (url-gateway-nslookup-host host))
|
|
35 (string-match (concat (regexp-quote dom) "$") host))
|
|
36
|
|
37 (defun dnsResolve (host)
|
|
38 (url-gateway-nslookup-host host))
|
|
39
|
|
40 (defun isResolvable (host)
|
|
41 (if (string-match "^[0-9.]+$" host)
|
|
42 t
|
|
43 (not (string= host (url-gateway-nslookup-host host)))))
|
|
44
|
|
45 (defun isInNet (ip net mask)
|
|
46 (let ((netc (split-string ip "\\."))
|
|
47 (ipc (split-string net "\\."))
|
|
48 (maskc (split-string mask "\\.")))
|
|
49 (if (or (/= (length netc) (length ipc))
|
|
50 (/= (length ipc) (length maskc)))
|
|
51 nil
|
|
52 (setq netc (mapcar 'string-to-int netc)
|
|
53 ipc (mapcar 'string-to-int ipc)
|
|
54 maskc (mapcar 'string-to-int maskc))
|
|
55 (and
|
|
56 (= (logand (nth 0 netc) (nth 0 maskc))
|
|
57 (logand (nth 0 ipc) (nth 0 maskc)))
|
|
58 (= (logand (nth 1 netc) (nth 1 maskc))
|
|
59 (logand (nth 1 ipc) (nth 1 maskc)))
|
|
60 (= (logand (nth 2 netc) (nth 2 maskc))
|
|
61 (logand (nth 2 ipc) (nth 2 maskc)))
|
|
62 (= (logand (nth 3 netc) (nth 3 maskc))
|
|
63 (logand (nth 3 ipc) (nth 3 maskc)))))))
|
|
64
|
|
65 (provide 'url-ns)
|