]> git.ozlabs.org Git - ppp.git/blobdiff - pppd/chap-new.h
The use of <net/ppp_defs.h> isn't guranteed to exist on Linux (e.g. uclibc, buildroot...
[ppp.git] / pppd / chap-new.h
index 0f38ff434ecf919eb1f714a742199097b4405143..9ebec54f82f4991458c16da8342500ed3b9df51d 100644 (file)
  * 1. Redistributions of source code must retain the above copyright
  *    notice, this list of conditions and the following disclaimer.
  *
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *
- * 3. The name(s) of the authors of this software must not be used to
+ * 2. The name(s) of the authors of this software must not be used to
  *    endorse or promote products derived from this software without
  *    prior written permission.
  *
- * 4. Redistributions of any form whatsoever must retain the following
+ * 3. Redistributions of any form whatsoever must retain the following
  *    acknowledgment:
  *    "This product includes software developed by Paul Mackerras
  *     <paulus@samba.org>".
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
+#ifndef PPP_CHAP_NEW_H
+#define PPP_CHAP_NEW_H
+
+#include "pppdconf.h"
+
 /*
  * CHAP packets begin with a standard header with code, id, len (2 bytes).
  */
 #define MDTYPE_MICROSOFT_V2    0x1
 #define MDTYPE_MICROSOFT       0x2
 #define MDTYPE_MD5             0x4
+#define MDTYPE_NONE            0
 
-#ifdef CHAPMS
-#define MDTYPE_ALL (MDTYPE_MICROSOFT_V2 | MDTYPE_MICROSOFT | MDTYPE_MD5)
-#else
-#define MDTYPE_ALL (MDTYPE_MD5)
-#endif
-#define MDTYPE_NONE 0
+/* hashes supported by this instance of pppd */
+extern int chap_mdtype_all;
 
 /* Return the digest alg. ID for the most preferred digest type. */
 #define CHAP_DIGEST(mdtype) \
+    ((mdtype) & MDTYPE_MD5)? CHAP_MD5: \
     ((mdtype) & MDTYPE_MICROSOFT_V2)? CHAP_MICROSOFT_V2: \
     ((mdtype) & MDTYPE_MICROSOFT)? CHAP_MICROSOFT: \
-    ((mdtype) & MDTYPE_MD5)? CHAP_MD5: \
     0
 
 /* Return the bit flag (lsb set) for our most preferred digest type. */
@@ -113,7 +110,7 @@ struct chap_digest_type {
        void (*make_response)(unsigned char *response, int id, char *our_name,
                unsigned char *challenge, char *secret, int secret_len,
                unsigned char *priv);
-       int (*check_success)(unsigned char *pkt, int len, unsigned char *priv);
+       int (*check_success)(int id, unsigned char *pkt, int len);
        void (*handle_failure)(unsigned char *pkt, int len);
 
        struct chap_digest_type *next;
@@ -128,6 +125,9 @@ extern int (*chap_verify_hook)(char *name, char *ourname, int id,
 /* Called by digest code to register a digest type */
 extern void chap_register_digest(struct chap_digest_type *);
 
+/* Lookup a digest handler by type */
+extern struct chap_digest_type *chap_find_digest(int digest_code);
+
 /* Called by authentication code to start authenticating the peer. */
 extern void chap_auth_peer(int unit, char *our_name, int digest_code);
 
@@ -136,3 +136,5 @@ extern void chap_auth_with_peer(int unit, char *our_name, int digest_code);
 
 /* Represents the CHAP protocol to the main pppd code */
 extern struct protent chap_protent;
+
+#endif