[Nym3-commit] r58 - trunk

nym3-devel@lists.noreply.org nym3-devel@lists.noreply.org
Mon, 02 Aug 2004 16:49:00 +0200


Author: laurent
Date: 2004-08-02 16:48:57 +0200 (Mon, 02 Aug 2004)
New Revision: 58

Removed:
   trunk/config.ml
   trunk/message.ml
   trunk/synopsis.ml
   trunk/user.ml
Log:
OCaml files no longer needed.


Deleted: trunk/config.ml
===================================================================
--- trunk/config.ml	2004-08-02 14:24:16 UTC (rev 57)
+++ trunk/config.ml	2004-08-02 14:48:57 UTC (rev 58)
@@ -1,17 +0,0 @@
-(* $Id$ *)
-
-(* Read the configuration options from a file *)
-
-open ConfigParser (* from missinglib *)
-
-let conffile = ref "/var/lib/nym3/conf";;
-
-let set_conffile file = conffile := file; ();;
-
-let userdb = ref "";;
-
-let load_config =
-	let cp = new rawConfigParser in
-	cp#readfile !conffile;
-	userdb := cp#get "" "userdb";;
-	

Deleted: trunk/message.ml
===================================================================
--- trunk/message.ml	2004-08-02 14:24:16 UTC (rev 57)
+++ trunk/message.ml	2004-08-02 14:48:57 UTC (rev 58)
@@ -1,119 +0,0 @@
-(* $Id$ *)
-
-exception Bad_message;;
-
-let sig_length = 256;;
-
-type header = { sign : string; nl : int; nym : string; seqno : string };;
-
-let read_header buffer start len=
-  let sign = String.sub buffer start sig_length in
-  let nl = Char.code buffer.[start+sig_length] in
-  let nym = String.sub buffer (start + sig_length + 1) nl in
-  let seqno = String.sub buffer (start + sig_length + 1 + nl) 20 in
-  { sign = sign; nl = nl; nym = nym; seqno = seqno };;
-
-(* Prepare an unsigned header *)
-let make_header nym seq_no =
-  let nl = String.length nym in
-  assert( nl < 256 && String.length seq_no = 20);
-  let length = sig_length + 1 + nl + 20 in
-  let s = String.make length '\000' in
-  s.[sig_length] <- Char.chr nl;
-  String.blit nym 0 s (sig_length+1) nl;
-  String.blit seq_no 0 s (sig_length + 1 + nl) 20;
-  s;;
-
-(*TODO change this when we add the surb properly*)
-type surb;;
-type config_option;;
-
-(*TODO describe explicitely which data corresponds to what (int * int * string) maybe isn't explicit enough *)
-(* is it necessary to separate them *)
-type command2server = 
-    Create of string list (*add the proof of work too *)
-  | Create2 of string
-  | Surb of surb list
-  | Newpk of string * string
-  | Relay of int * string * string (* routing type * routing info * email body *)
-  | Get of string list
-  | Summarize of int * string 
-  | Delete of string list
-  | Policy of config_option
-
-type command2client =
-    Created of string * string 
-  | Status of int * int * int * int * string list 
-  (* do we use native int for 4 bytes length? 
-  laurent: no we shouldn't, ocaml's int are shorter by one bit anyway *)
-  | Summary of int * string
-  | Msg of string * string
-  | Dropped of string list
-  | Error of string * string
-
-type message2client = command2client list
-type message2server = header * command2server list
- 
-let read_command2client buffer start = 
-  0,[];;
-
-let read_command2server buffer start = 
-  try
-    let cs = 0 in
-    let n = cs + 4 in
-    let m =
-      (* read a list of msg id, used for Get and delete *)
-      let rec aux_msgid_list string idx stop accu =
-	if idx = stop then
-	  accu
-	else
-	  aux_get string (idx + 20) stop (String.sub string idx 20)::accu
-      in
-      match Chr.code buffer.[start] with
-	0 -> (* TODO add the proof of work *) 
-	  let nnym = Chr.code buffer.[start+4] in
-	  let rec aux_create buffer idx stop accu =
-	    if idx = stop then
-	      accu
-	    else
-	      let nl = Chr.code buffer.[idx] in
-	      aux_create buffer (idx + nl + 1) stop (String.sub buffer (idx+1) nl)::accu
-	  in
-	  Create(aux_create buffer (start+5) (start+4+cs) [])
-      | 1 -> Create2(String.sub buffer (start+4) cs)
-      | 2 -> Surb([]) (*TODO change this when we add the surb properly*)
-      | 3 -> 
-	  let id_l = 0 in
-	  Newpk( String.sub buffer (start + 4) id_l , String.sub buffer (start + 4 + id_l) (cs - id_l))
-      | 4 ->
-      | 5 ->
-	  if cs mod 20 != 0 then Get([]) (* if you cannot form a Get request correctly it is ignored *)
-	  else
-	    Get(aux_msgid_list buffer (start + 4) (start + 4 + cs) [])
-      | 6 ->
-	  if cs != 22 then
-	    Summarize(0,"")
-	  else
-	    let num = in
-	    let after = String.sub buffer (start + 6) 20 in
-	    Summarize(num,after)
-      | 7 ->
-	  if cs mod 20 != 0 then Delete([]) (* if you cannot form a Delete request correctly it is ignored *)
-	  else
-	    Delete(aux_msgid_list buffer (start + 4) (start + 4 + cs) [])
-      | 8 ->
-	  0,[]
-    in
-    n,m
-  with
-    _ -> raise Bad_argument;;
-  
-let read_command_list f s start =
-  let rec aux buffer start accu =
-    if start > (String.length buffer) then
-      accu
-    else
-      let n,e = f buffer start in
-      aux buffer (start + n) (e::accu)
-  in
-  aux s start [];;

Deleted: trunk/synopsis.ml
===================================================================
--- trunk/synopsis.ml	2004-08-02 14:24:16 UTC (rev 57)
+++ trunk/synopsis.ml	2004-08-02 14:48:57 UTC (rev 58)
@@ -1,60 +0,0 @@
-(* $Id$ *)
-
-open Str;;
-
-(* Grep the relevant headers and cut at 80 chars *)
-let synopsize_headers headers =
-	let good_headers = [ "Cc"; "From"; "Date"; "Subject";
-						 "In-Reply-To"; "Message-Id"; "To";
-						 "References"; "Return-Path"; "Sender";
-						 "X-Anonymous"; "X-Spam-Level" ] in
-	let rec aux x = match x with
-		| [] -> ""
-		| [a] -> "\\(^" ^ a ^ ":.*\\)"
-		| a::b -> "\\(^" ^ a ^ ":.*\\)\\|" ^ (aux b)
-	in
-	let headerre = aux good_headers in
-	let rec unfold l = match l with
-		| [] -> []
-		| [a] -> [a]
-		| a::b::q -> 
-		  if Str.string_match (Str.regexp "^\\(\t\\| \\)+\\(.*\\)$") b 0 
-		  then unfold ((a ^ " " ^ (Str.matched_group 2 b))::q)
-		  else a::(unfold (b::q))
-	in
-	let rec grep limit re l = match l with
-		| [] -> []
-		| a::b -> if Str.string_partial_match re a 0 then 
-			let la = 
-				if String.length a > limit then
-					Str.first_chars a limit
-				else
-					a
-			in
-			la::(grep limit re b) else
-				  grep limit re b
-	in
-	grep 80 (Str.regexp headerre) (unfold headers);;
-
-
-(* Uncomment to test
-
-let l = ref [];;
-
-try
-	while true do
-		l := (read_line ()) :: !l;
-	done
-with
-	_ -> ();;
-
-l := List.rev !l;
-
-let res = ref (synopsize_headers !l) in
-	while !res != [] do
-		print_string "Debut de header\n";
-		print_string (List.hd !res);
-		print_string "\nFin de header\n";
-		res := List.tl !res;
-	done;;
-*)

Deleted: trunk/user.ml
===================================================================
--- trunk/user.ml	2004-08-02 14:24:16 UTC (rev 57)
+++ trunk/user.ml	2004-08-02 14:48:57 UTC (rev 58)
@@ -1,48 +0,0 @@
-(* $Id$ *)
-
-(* Types for the user data, utilities to fetch them from the disk,
-   etc *)
-
-open Dbm
-open Marshal
-open Unix
-open Config
-
-type policy;; (* TODO : define that *)
-
-type hold = Never | Quota | Always;;
-
-type status = Reserved of string | Created;;
-
-(* This follows section 2.1, "Information associated with each nym" of
-   the nym-specs. status may hold a challenge. *)
-type userdata = { idkey : string; cipherkey: string; policy : policy;
-				  email_latency : int; syn_latency : int;
-				  surb_rate : int; max_clear_syn : int;
-				  hold_policy : hold; shutdown : string;
-				  max_queued : int; max_size : int; max_space : int;
-				  status : status; };;
-
-let open_userdb path =
-	Dbm.opendbm path [Dbm.Dbm_rdwr; Dbm.Dbm_create] (6 * 64 + 4 * 8);;
-	
-let close_userdb db = 
-	Dbm.close db;;
-
-let read_userdata nym =
-	let db = open_userdb !Config.userdb in
-	let marshalled = 
-	try
-		Dbm.find db nym
-	with
-		Not_found -> close_userdb db; raise Not_found; ""
-	in
-	close_userdb db;
-	(Marshal.from_string marshalled 0 : userdata);;
-
-let write_userdata nym data =
-	let db = open_userdb !Config.userdb in
-	let marshalled = Marshal.to_string data [] in
-	Dbm.replace db nym marshalled;
-	close_userdb db;;
-