<commit_before>package msproto;

// SMTP response for smtpd hooks
message SmtpResponse {
	required int32 code = 1; 			// SMTP code (ignored if eq 0)
	required string msg = 2; 			// SMTP message (ignored if eq "")

	//optional bool close_connection = 16;	// if true connection is closed
	//optional string data_link = 17; 		// link for downloading additional (large) data
	//repeated string extra_headers = 18; 	// headers to add
}


// smtpd telemetry
message SmtpdTelemetry {
	required string server_id = 1;
	required string session_id = 2;
	required string remote_address = 3;
	required bool success = 4;
	required uint32 smtp_response_code = 5;
	required string env_mailfrom = 6;
	repeated string env_rcptto = 7;
	required uint32 message_size = 8;
	required bool is_tls = 9;
	required uint32 concurrency = 10;
	required uint32 exec_time = 11;
	}

// Hook SMTPd New client
// SmtpdNewClientQuery
message SmtpdNewClientQuery {
	required string session_id = 1; // smtpd session ID
	required string remote_ip = 2; 	// remote (client) IP
}

// SmtpdNewClientResponse
message SmtpdNewClientResponse {
	required string session_id = 1;
	optional SmtpResponse smtp_response = 2;
	optional bool drop_connection = 3;
}

// Hook smtpd RCPT TO command
// smtpdRcptToQuery
message SmtpdRcptToQuery {
	required string session_id = 1;
	required string rcptto = 2;
}

// SmtpdRcpttoAccessIsGrantedResponse
message SmtpdRcptToResponse {
	required string session_id = 1;
	optional SmtpResponse smtp_response = 2;
	optional bool drop_connection = 3;
	optional bool relay_granted = 4;
}

// Hook smtpd DATA
// smtpdDataMsg
message SmtpdDataQuery {
	required string session_id = 1;
	required string data_link = 2;
}

// smtpdDataMsg
message SmtpdDataResponse {
	required string session_id = 1;
	optional SmtpResponse smtp_response = 2;
	optional string data_link = 3;
	optional bool drop_connection = 4;
	repeated string extra_headers = 5;
}

// SmtpdBeforeQueing Query
message SmtpdBeforeQueuingQuery {
	required string session_id = 1;
	required string mail_from = 2;
	repeated string rcpt_to = 3;
}

// SmtpdBefore queuing Response
message SmtpdBeforeQueuingResponse {
	required string session_id = 1;
	optional string mail_from  = 2;
	repeated string rcpt_to = 3;
	optional SmtpResponse smtp_response = 4;
	optional bool drop_connection = 5;
}

// deliverd

// telemetry
message DeliverdTelemetry {
	required string server_id = 1;
	required string deliverd_id = 2;
	required bool success = 3; // status of delivery (success or not)
	required uint32 exec_time = 4; // in nanosecond
	required uint32 messages_in_queue = 5;
	required uint32 concurrency_remote = 6;
	required uint32 concurrency_local = 7;
	required string from = 8;
	required string to = 9;
	required bool is_local = 10;
	optional string local_address = 11;
	optional string remote_address =12;
	optional uint32 remote_smtp_response_code = 13; // 250, 420, 550,...
}

// Get routes query
message DeliverdGetRoutesQuery {
	required string deliverd_id = 1;
	required string mailfrom = 2;
	required string rcptto =  3;
	required string authentified_user = 4;
}

// get routes response
message DeliverdGetRoutesResponse {
	message Route {
		required string remote_host = 1;
		required int64 remote_port = 2;
		optional string local_ip = 3;
		optional int32 priority = 4;
		optional string smtpauth_login = 5;
		optional string smtpauth_password = 6;
	}
	required string deliverd_id = 1;
	repeated Route routes = 2;
}
<commit_msg>Update tmail.proto<commit_after>package msproto;

// SMTP response for smtpd hooks
message SmtpResponse {
	required int32 code = 1; 			// SMTP code (ignored if eq 0)
	required string msg = 2; 			// SMTP message (ignored if eq "")

	//optional bool close_connection = 16;	// if true connection is closed
	//optional string data_link = 17; 		// link for downloading additional (large) data
	//repeated string extra_headers = 18; 	// headers to add
}


// smtpd telemetry
message SmtpdTelemetry {
	required string server_id = 1;
	required string session_id = 2;
	required string remote_address = 3;
	required bool success = 4;
	required uint32 smtp_response_code = 5;
	required string env_mailfrom = 6;
	repeated string env_rcptto = 7;
	required uint32 message_size = 8;
	required bool is_tls = 9;
	required uint32 concurrency = 10;
	required uint32 exec_time = 11;
	}

// Hook SMTPd New client
// SmtpdNewClientQuery
message SmtpdNewClientQuery {
	required string session_id = 1; // smtpd session ID
	required string remote_ip = 2; 	// remote (client) IP
}

// SmtpdNewClientResponse
message SmtpdNewClientResponse {
	required string session_id = 1;
	optional SmtpResponse smtp_response = 2;
	optional bool drop_connection = 3;
}

// Hook smtpd RCPT TO command
// smtpdRcptToQuery
message SmtpdRcptToQuery {
	required string session_id = 1;
	required string rcptto = 2;
}

// SmtpdRcpttoAccessIsGrantedResponse
message SmtpdRcptToResponse {
	required string session_id = 1;
	optional SmtpResponse smtp_response = 2;
	optional bool drop_connection = 3;
	optional bool relay_granted = 4;
}

// Hook smtpd DATA
// smtpdDataMsg
message SmtpdDataQuery {
	required string session_id = 1;
	required string data_link = 2;
}

// smtpdDataMsg
message SmtpdDataResponse {
	required string session_id = 1;
	optional SmtpResponse smtp_response = 2;
	optional string data_link = 3;
	optional bool drop_connection = 4;
	repeated string extra_headers = 5;
}

// SmtpdBeforeQueing Query
message SmtpdBeforeQueuingQuery {
	required string session_id = 1;
	required string mail_from = 2;
	repeated string rcpt_to = 3;
}

// SmtpdBefore queuing Response
message SmtpdBeforeQueuingResponse {
	required string session_id = 1;
	optional string mail_from  = 2;
	repeated string rcpt_to = 3;
	optional SmtpResponse smtp_response = 4;
	optional bool drop_connection = 5;
}

// deliverd

// telemetry
message DeliverdTelemetry {
	required string server_id = 1;
	required string deliverd_id = 2;
	required bool success = 3; // status of delivery (success or not)
	required uint32 exec_time = 4; // in nanosecond
	required uint32 messages_in_queue = 5;
	required uint32 concurrency_remote = 6;
	required uint32 concurrency_local = 7;
	required string from = 8;
	required string to = 9;
	required bool is_local = 10;
	optional string local_address = 11;
	optional string remote_address = 12;
	optional uint32 remote_smtp_response_code = 13; // 250, 420, 550,...
}

// Get routes query
message DeliverdGetRoutesQuery {
	required string deliverd_id = 1;
	required string mailfrom = 2;
	required string rcptto =  3;
	required string authentified_user = 4;
}

// get routes response
message DeliverdGetRoutesResponse {
	message Route {
		required string remote_host = 1;
		required int64 remote_port = 2;
		optional string local_ip = 3;
		optional int32 priority = 4;
		optional string smtpauth_login = 5;
		optional string smtpauth_password = 6;
	}
	required string deliverd_id = 1;
	repeated Route routes = 2;
}

{'fraction_non_alphanumeric': 0.07035971223021582, 'fraction_numerical': 0.031654676258992806, 'mean_word_length': 4.195067264573991, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4300744', 'n_tokens_mistral': 2466, 'n_tokens_neox': 2232, 'n_words': 757}