Skip to content

Commit

Permalink
integrated pa_data_type
Browse files Browse the repository at this point in the history
  • Loading branch information
awuersch committed May 9, 2017
1 parent 7e76e95 commit 5acb922
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions lib/krb5lib.mli
Original file line number Diff line number Diff line change
Expand Up @@ -563,12 +563,12 @@ module Msg : sig
*)
module Pa_data : sig
type t =
{ padata_type : Krb_int32.t
{ padata_type : Pa_data_type.t
; padata_value : Octet_string.t
} [@@deriving sexp]
include Asn1_intf.S with
type t := t
and type Ast.t = Krb_int32.Ast.t * Cstruct.t
and type Ast.t = Pa_data_type.Ast.t * Cstruct.t
end

(** Authorization data, see {{:https://tools.ietf.org/html/rfc4120#section-5.2.6}rfc4120 Section 5.2.6 AuthorizationData}
Expand Down
10 changes: 5 additions & 5 deletions lib/pa_data.ml
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,24 @@ open Asn.S
open Krb_combinators

type t =
{ padata_type : Krb_int32.t
{ padata_type : Pa_data_type.t
; padata_value : Octet_string.t
} [@@deriving sexp]

module Ast = struct
type t = Krb_int32.Ast.t * Cstruct.t
type t = Pa_data_type.Ast.t * Cstruct.t

let asn =
sequence2
(* First value is 1 not 0 *)
(tag_required ~label:"padata_type" 1 Krb_int32.Ast.asn)
(tag_required ~label:"padata_type" 1 Pa_data_type.Ast.asn)
(tag_required ~label:"padata_value" 2 Octet_string.Ast.asn)
end

let ast_of_t t =
(Krb_int32.ast_of_t t.padata_type, Octet_string.ast_of_t t.padata_value)
(Pa_data_type.ast_of_t t.padata_type, Octet_string.ast_of_t t.padata_value)

let t_of_ast (a, b) =
{ padata_type = Krb_int32.t_of_ast a
{ padata_type = Pa_data_type.t_of_ast a
; padata_value = Octet_string.t_of_ast b
}

0 comments on commit 5acb922

Please sign in to comment.