package MumbleProto;

option optimize_for = SPEED;

message	Version {
	optional uint32 version = 1;
	optional string release = 2;
	optional string os = 3;
	optional string os_version = 4;
}

message UDPTunnel {
	required bytes packet = 1;
}

message Authenticate {
	optional string username = 1;
	optional string password = 2;
	repeated string tokens = 3;
	repeated int32 celt_versions = 4;
	optional bool opus = 5 [default = false];
}

message Ping {
	optional uint64 timestamp = 1;
	optional uint32 good = 2;
	optional uint32 late = 3;
	optional uint32 lost = 4;
	optional uint32 resync = 5;
	optional uint32 udp_packets = 6;
	optional uint32 tcp_packets = 7;
	optional float udp_ping_avg = 8;
	optional float udp_ping_var = 9;
	optional float tcp_ping_avg = 10;
	optional float tcp_ping_var = 11;
}

message Reject {
	enum RejectType {
		None = 0;
		WrongVersion = 1;
		InvalidUsername = 2;
		WrongUserPW = 3;
		WrongServerPW = 4;
		UsernameInUse = 5;
		ServerFull = 6;
		NoCertificate = 7;
	}
	optional RejectType type = 1;
	optional string reason = 2;
}

message ServerConfig {
	optional uint32 max_bandwidth = 1;
	optional string welcome_text = 2;
	optional bool allow_html = 3;
	optional uint32 message_length = 4;
	optional uint32 image_message_length = 5;
}

message ServerSync {
	optional uint32 session = 1;
	optional uint32 max_bandwidth = 2;
	optional string welcome_text = 3;
	optional uint64 permissions = 4;
}

message ChannelRemove {
	required uint32 channel_id = 1;
}

message ChannelState {
	optional uint32 channel_id = 1;
	optional uint32 parent = 2;
	optional string name = 3;
	repeated uint32 links = 4;
	optional string description = 5;
	repeated uint32 links_add = 6;
	repeated uint32 links_remove = 7;
	optional bool temporary = 8 [default = false];
	optional int32 position = 9 [default = 0];
	optional bytes description_hash = 10;
}

message UserRemove {
	required uint32 session = 1;
	optional uint32 actor = 2;
	optional string reason = 3;
	optional bool ban = 4;
}

message UserState {
	optional uint32 session = 1;
	optional uint32 actor = 2;
	optional string name = 3;
	optional uint32 user_id = 4;
	optional uint32 channel_id = 5;
	optional bool mute = 6;
	optional bool deaf = 7;
	optional bool suppress = 8;
	optional bool self_mute = 9;
	optional bool self_deaf = 10;
	optional bytes texture = 11;
	optional bytes plugin_context = 12;
	optional string plugin_identity = 13;
	optional string comment = 14;
	optional string hash = 15;
	optional bytes comment_hash = 16;
	optional bytes texture_hash = 17;
	optional bool priority_speaker = 18;
	optional bool recording = 19;
}

message BanList {
	message BanEntry {
		required bytes address = 1;
		required uint32 mask = 2;
		optional string name = 3;
		optional string hash = 4;
		optional string reason = 5;
		optional string start = 6;
		optional uint32 duration = 7;
	}
	repeated BanEntry bans = 1;
	optional bool query = 2 [default = false];
}

message TextMessage {
	optional uint32 actor = 1;
	repeated uint32 session = 2;
	repeated uint32 channel_id = 3;
	repeated uint32 tree_id = 4;
	required string message = 5;
}

message PermissionDenied {
	enum DenyType {
		Text = 0;
		Permission = 1;
		SuperUser = 2;
		ChannelName = 3;
		TextTooLong = 4;
		H9K = 5;
		TemporaryChannel = 6;
		MissingCertificate = 7;
		UserName = 8;
		ChannelFull = 9;
		NestingLimit = 10;
	}
	optional uint32 permission = 1;
	optional uint32 channel_id = 2;
	optional uint32 session = 3;
	optional string reason = 4;
	optional DenyType type = 5;
	optional string name = 6;
}

message ACL {
	message ChanGroup {
		required string name = 1;
		optional bool inherited = 2 [default = true];
		optional bool inherit = 3 [default = true];
		optional bool inheritable = 4 [default = true];
		repeated uint32 add = 5;
		repeated uint32 remove = 6;
		repeated uint32 inherited_members = 7;
	}
	message ChanACL {
		optional bool apply_here = 1 [default = true];
		optional bool apply_subs = 2 [default = true];
		optional bool inherited = 3 [default = true];
		optional uint32 user_id = 4;
		optional string group = 5;
		optional uint32 grant = 6;
		optional uint32 deny = 7;
	}
	required uint32 channel_id = 1;
	optional bool inherit_acls = 2 [default = true];
	repeated ChanGroup groups = 3;
	repeated ChanACL acls = 4;
	optional bool query = 5 [default = false];
}

message QueryUsers {
	repeated uint32 ids = 1;
	repeated string names = 2;
}

message CryptSetup {
	optional bytes key = 1;
	optional bytes client_nonce = 2;
	optional bytes server_nonce = 3;
}

message ContextActionModify {
	enum Context {
		Server = 0x01;
		Channel = 0x02;
		User = 0x04;
	}
	enum Operation {
		Add = 0;
		Remove = 1;
	}
	required string action = 1;
	optional string text = 2;
	optional uint32 context = 3;
	optional Operation operation = 4;
}

message ContextAction {
	optional uint32 session = 1;
	optional uint32 channel_id = 2;
	required string action = 3;
}

message UserList {
	message User {
		required uint32 user_id = 1;
		optional string name = 2;
	}
	repeated User users = 1;
}

message VoiceTarget {
	message Target {
		repeated uint32 session = 1;
		optional uint32 channel_id = 2;
		optional string group = 3;
		optional bool links = 4 [default = false];
		optional bool children = 5 [default = false];
	}
	optional uint32 id = 1;
	repeated Target targets = 2;
}

message PermissionQuery {
	optional uint32 channel_id = 1;
	optional uint32 permissions = 2;
	optional bool flush = 3 [default = false];
}

message CodecVersion {
	required int32 alpha = 1;
	required int32 beta = 2;
	required bool prefer_alpha = 3 [default = true];
	optional bool opus = 4 [default = false];
}

message UserStats {
	message Stats {
		optional uint32 good = 1;
		optional uint32 late = 2;
		optional uint32 lost = 3;
		optional uint32 resync = 4;
	}

	optional uint32 session = 1;
	optional bool stats_only = 2 [default = false];
	repeated bytes certificates = 3;
	optional Stats from_client = 4;
	optional Stats from_server = 5;

	optional uint32 udp_packets = 6;
	optional uint32 tcp_packets = 7;
	optional float udp_ping_avg = 8;
	optional float udp_ping_var = 9;
	optional float tcp_ping_avg = 10;
	optional float tcp_ping_var = 11;

	optional Version version = 12;
	repeated int32 celt_versions = 13;
	optional bytes address = 14;
	optional uint32 bandwidth = 15;
	optional uint32 onlinesecs = 16;
	optional uint32 idlesecs = 17;
	optional bool strong_certificate = 18 [default = false];
	optional bool opus = 19 [default = false];
}

message SuggestConfig {
	optional uint32 version = 1;
	optional bool positional = 2;
	optional bool push_to_talk = 3;
}

message RequestBlob {
	repeated uint32 session_texture = 1;
	repeated uint32 session_comment = 2;
	repeated uint32 channel_description = 3;
}
