open OpenSSL MsgTypes Slave
val a2i = fn Add => 0
- | Delete => 1
+ | Delete true => 1
| Modify => 2
+ | Delete false => 3
val i2a = fn 0 => Add
- | 1 => Delete
+ | 1 => Delete true
| 2 => Modify
+ | 3 => Delete false
| _ => raise OpenSSL.OpenSSL "Bad action number to deserialize"
fun sendAcl (bio, {user, class, value}) =
| SOME 1 => SOME true
| _ => NONE
+fun sendSockPerm (bio, p) =
+ case p of
+ Any => OpenSSL.writeInt (bio, 0)
+ | Client => OpenSSL.writeInt (bio, 1)
+ | Server => OpenSSL.writeInt (bio, 2)
+ | Nada => OpenSSL.writeInt (bio, 3)
+
+fun recvSockPerm bio =
+ case OpenSSL.readInt bio of
+ SOME 0 => SOME Any
+ | SOME 1 => SOME Client
+ | SOME 2 => SOME Server
+ | SOME 3 => SOME Nada
+ | _ => NONE
+
+fun sendQuery (bio, q) =
+ case q of
+ QApt s => (OpenSSL.writeInt (bio, 0);
+ OpenSSL.writeString (bio, s))
+ | QCron s => (OpenSSL.writeInt (bio, 1);
+ OpenSSL.writeString (bio, s))
+ | QFtp s => (OpenSSL.writeInt (bio, 2);
+ OpenSSL.writeString (bio, s))
+ | QTrustedPath s => (OpenSSL.writeInt (bio, 3);
+ OpenSSL.writeString (bio, s))
+ | QSocket s => (OpenSSL.writeInt (bio, 4);
+ OpenSSL.writeString (bio, s))
+ | QFirewall s => (OpenSSL.writeInt (bio, 5);
+ OpenSSL.writeString (bio, s))
+ | QAptExists s => (OpenSSL.writeInt (bio, 6);
+ OpenSSL.writeString (bio, s))
+
+fun recvQuery bio =
+ case OpenSSL.readInt bio of
+ SOME n =>
+ (case n of
+ 0 => Option.map QApt (OpenSSL.readString bio)
+ | 1 => Option.map QCron (OpenSSL.readString bio)
+ | 2 => Option.map QFtp (OpenSSL.readString bio)
+ | 3 => Option.map QTrustedPath (OpenSSL.readString bio)
+ | 4 => Option.map QSocket (OpenSSL.readString bio)
+ | 5 => Option.map QFirewall (OpenSSL.readString bio)
+ | 6 => Option.map QAptExists (OpenSSL.readString bio)
+ | _ => NONE)
+ | NONE => NONE
+
fun send (bio, m) =
case m of
MsgOk => OpenSSL.writeInt (bio, 1)
| MsgCreateDbUser {dbtype, passwd} => (OpenSSL.writeInt (bio, 16);
OpenSSL.writeString (bio, dbtype);
sendOption OpenSSL.writeString (bio, passwd))
- | MsgCreateDbTable {dbtype, dbname} => (OpenSSL.writeInt (bio, 17);
- OpenSSL.writeString (bio, dbtype);
- OpenSSL.writeString (bio, dbname))
+ | MsgCreateDb {dbtype, dbname, encoding} => (OpenSSL.writeInt (bio, 17);
+ OpenSSL.writeString (bio, dbtype);
+ OpenSSL.writeString (bio, dbname);
+ sendOption OpenSSL.writeString (bio, encoding))
| MsgNewMailbox {domain, user, passwd, mailbox} =>
(OpenSSL.writeInt (bio, 18);
OpenSSL.writeString (bio, domain);
| MsgShutdown => OpenSSL.writeInt (bio, 29)
| MsgYes => OpenSSL.writeInt (bio, 30)
| MsgNo => OpenSSL.writeInt (bio, 31)
- | MsgApt s => (OpenSSL.writeInt (bio, 32);
- OpenSSL.writeString (bio, s))
+ | MsgQuery q => (OpenSSL.writeInt (bio, 32);
+ sendQuery (bio, q))
+ | MsgSocket p => (OpenSSL.writeInt (bio, 33);
+ sendSockPerm (bio, p))
+ | MsgFirewall ls => (OpenSSL.writeInt (bio, 34);
+ sendList OpenSSL.writeString (bio, ls))
+ | MsgRegenerateTc => OpenSSL.writeInt (bio, 35)
+ | MsgDropDb {dbtype, dbname} => (OpenSSL.writeInt (bio, 36);
+ OpenSSL.writeString (bio, dbtype);
+ OpenSSL.writeString (bio, dbname))
+ | MsgGrantDb {dbtype, dbname} => (OpenSSL.writeInt (bio, 37);
+ OpenSSL.writeString (bio, dbtype);
+ OpenSSL.writeString (bio, dbname))
+ | MsgMysqlFixperms => OpenSSL.writeInt (bio, 38)
+ | MsgDescribe dom => (OpenSSL.writeInt (bio, 39);
+ OpenSSL.writeString (bio, dom))
+ | MsgDescription s => (OpenSSL.writeInt (bio, 40);
+ OpenSSL.writeString (bio, s))
+ | MsgReUsers => OpenSSL.writeInt (bio, 41)
+ | MsgVmailChanged => OpenSSL.writeInt (bio, 42)
+ | MsgFirewallRegen => OpenSSL.writeInt (bio, 43)
fun checkIt v =
case v of
(SOME dbtype, SOME passwd) =>
SOME (MsgCreateDbUser {dbtype = dbtype, passwd = passwd})
| _ => NONE)
- | 17 => (case (OpenSSL.readString bio, OpenSSL.readString bio) of
- (SOME dbtype, SOME dbname) =>
- SOME (MsgCreateDbTable {dbtype = dbtype, dbname = dbname})
+ | 17 => (case (OpenSSL.readString bio, OpenSSL.readString bio, recvOption OpenSSL.readString bio) of
+ (SOME dbtype, SOME dbname, SOME encoding) =>
+ SOME (MsgCreateDb {dbtype = dbtype, dbname = dbname, encoding = encoding})
| _ => NONE)
| 18 => (case (OpenSSL.readString bio, OpenSSL.readString bio,
OpenSSL.readString bio, OpenSSL.readString bio) of
| 29 => SOME MsgShutdown
| 30 => SOME MsgYes
| 31 => SOME MsgNo
- | 32 => Option.map MsgApt (OpenSSL.readString bio)
+ | 32 => Option.map MsgQuery (recvQuery bio)
+ | 33 => Option.map MsgSocket (recvSockPerm bio)
+ | 34 => Option.map MsgFirewall (recvList OpenSSL.readString bio)
+ | 35 => SOME MsgRegenerateTc
+ | 36 => (case (OpenSSL.readString bio, OpenSSL.readString bio) of
+ (SOME dbtype, SOME dbname) =>
+ SOME (MsgDropDb {dbtype = dbtype, dbname = dbname})
+ | _ => NONE)
+ | 37 => (case (OpenSSL.readString bio, OpenSSL.readString bio) of
+ (SOME dbtype, SOME dbname) =>
+ SOME (MsgGrantDb {dbtype = dbtype, dbname = dbname})
+ | _ => NONE)
+ | 38 => SOME MsgMysqlFixperms
+ | 39 => Option.map MsgDescribe (OpenSSL.readString bio)
+ | 40 => Option.map MsgDescription (OpenSSL.readString bio)
+ | 41 => SOME MsgReUsers
+ | 42 => SOME MsgVmailChanged
+ | 43 => SOME MsgFirewallRegen
| _ => NONE)
end