Commits

Anonymous committed 8af4e8c

Change the name of the credential method to query_.

  • Participants
  • Parent commits 40cb1ac
  • Branches PAGODA

Comments (0)

Files changed (2)

File sasl/sasl_supplicant.ml

+(*---------------------------------------------------------------------------*
+  IMPLEMENTATION  sasl_supplicant.ml
+
+  Copyright (c) 2004, James H. Woodyatt
+  All rights reserved.
+
+  Redistribution and use in source and binary forms, with or without
+  modification, are permitted provided that the following conditions
+  are met:
+
+    Redistributions of source code must retain the above copyright
+    notice, this list of conditions and the following disclaimer.
+
+    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
+
+  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+  ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+  COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+  (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+  SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+  STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+  OF THE POSSIBILITY OF SUCH DAMAGE. 
+ *---------------------------------------------------------------------------*)
+
+module R = Iom_reactor
+open Cf_cmonad.Op
+
+module Sec = Sasl_security
+module Err = Sasl_error
+
+type ('id, 'q, 'cr) request_t = Request of 'q * ('id * 'cr) option R.tx
+
+class type ['id, 'q, 'cr] core =
+    object
+        method supplicant: 's. ('id, 'q, 'cr) request_t R.rx -> ('s, unit) R.t
+    end
+
+class virtual ['id, 'q, 'cr] simple id =
+    object(self:('id, 'q, 'cr) #core)
+        method private virtual query_: 'q -> 'cr
+
+        method supplicant:
+            's. ('id, 'q, 'cr) request_t R.rx -> ('s, unit) R.t =
+            fun reqRx ->
+                let reqRx = (reqRx :> ('id, 'q, 'cr) request_t R.rx) in
+                let rec loop () =
+                    R.guard begin
+                        reqRx#get begin fun (req : ('id, 'q, 'cr) request_t) ->
+                            let Request (q, ansTx) = req in
+                            ansTx#put (Some (id, self#query_ q)) >>= loop
+                        end
+                    end
+                in
+                R.start (loop ()) ()
+    end
+
+let start s =
+    let s = (s :> ('id, 'q, 'cr) core) in
+    R.simplex >>= fun (chRx, chTx) ->
+    s#supplicant chRx >>= fun () ->
+    Cf_cmonad.return chTx
+
+(*--- End of File [ sasl_supplicant.ml ] ---*)

File sasl/sasl_supplicant.mli

+(*---------------------------------------------------------------------------*
+  INTERFACE  sasl_supplicant.mli
+
+  Copyright (c) 2004, James H. Woodyatt
+  All rights reserved.
+
+  Redistribution and use in source and binary forms, with or without
+  modification, are permitted provided that the following conditions
+  are met:
+
+    Redistributions of source code must retain the above copyright
+    notice, this list of conditions and the following disclaimer.
+
+    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
+
+  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+  ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+  COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+  (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+  SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+  STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+  OF THE POSSIBILITY OF SUCH DAMAGE. 
+ *---------------------------------------------------------------------------*)
+
+open Iom_reactor
+
+type ('id, 'q, 'cr) request_t = Request of 'q * ('id * 'cr) option tx
+
+class type ['id, 'q, 'cr] core =
+    object
+        method supplicant: 's. ('id, 'q, 'cr) request_t rx -> ('s, unit) t
+    end
+
+class virtual ['id, 'q, 'cr] simple:
+    'id ->
+    object
+        inherit ['id, 'q, 'cr] core
+        method private virtual query_: 'q -> 'cr
+    end
+
+val start: ('id, 'q, 'cr) #core -> ('s, ('id, 'q, 'cr) request_t tx) t
+
+(*--- End of File [ sasl_supplicant.mli ] ---*)