-/* Options bits for logging. Those that will end up in log_write_selector have
-values < 0x80000000. They can be used in calls to log_write(). The others have
-values > 0x80000000 and are put into log_extra_selector (without the top bit).
-These are only ever tested independently. "All" is a magic value that is used
-only in the name table to set all options in both bit maps. */
-
-/* The L_all value must always have all bits set, as it is recognized specially
-by the function that decodes debug and log selectors. This is to enable it to
-set all the bits in a multi-word selector. */
-
-#define L_all 0xffffffff
-
-#define L_address_rewrite 0x00000001
-#define L_all_parents 0x00000002
-#define L_connection_reject 0x00000004
-#define L_delay_delivery 0x00000008
-#define L_dnslist_defer 0x00000010
-#define L_etrn 0x00000020
-#define L_host_lookup_failed 0x00000040
-#define L_lost_incoming_connection 0x00000080
-#define L_queue_run 0x00000100
-#define L_retry_defer 0x00000200
-#define L_size_reject 0x00000400
-#define L_skip_delivery 0x00000800
-#define L_smtp_connection 0x00001000
-#define L_smtp_incomplete_transaction 0x00002000
-#define L_smtp_protocol_error 0x00004000
-#define L_smtp_syntax_error 0x00008000
-
-#define LX_acl_warn_skipped 0x80000001
-#define LX_arguments 0x80000002
-#define LX_deliver_time 0x80000004
-#define LX_delivery_size 0x80000008
-#define LX_ident_timeout 0x80000010
-#define LX_incoming_interface 0x80000020
-#define LX_incoming_port 0x80000040
-#define LX_outgoing_port 0x80000080
-#define LX_pid 0x80000100
-#define LX_queue_time 0x80000200
-#define LX_queue_time_overall 0x80000400
-#define LX_received_sender 0x80000800
-#define LX_received_recipients 0x80001000
-#define LX_rejected_header 0x80002000
-#define LX_return_path_on_delivery 0x80004000
-#define LX_sender_on_delivery 0x80008000
-#define LX_sender_verify_fail 0x80010000
-#define LX_smtp_confirmation 0x80020000
-#define LX_smtp_no_mail 0x80040000
-#define LX_subject 0x80080000
-#define LX_tls_certificate_verified 0x80100000
-#define LX_tls_cipher 0x80200000
-#define LX_tls_peerdn 0x80400000
-#define LX_tls_sni 0x80800000
-#define LX_unknown_in_list 0x81000000
-
-#define L_default (L_connection_reject | \
- L_delay_delivery | \
- L_dnslist_defer | \
- L_etrn | \
- L_host_lookup_failed | \
- L_lost_incoming_connection | \
- L_queue_run | \
- L_retry_defer | \
- L_size_reject | \
- L_skip_delivery)
-
-#define LX_default ((LX_acl_warn_skipped | \
- LX_rejected_header | \
- LX_sender_verify_fail | \
- LX_tls_cipher) & 0x7fffffff)
+/* Options bits for logging. Those that have values < BITWORDSIZE can be used
+in calls to log_write(). The others are put into later words in log_selector
+and are only ever tested independently, so they do not need bit mask
+declarations. The Li_all value is recognized specially by decode_bits(). */
+
+#define LOG_BIT(name) Li_##name = IOTA(Li_iota), L_##name = BIT(Li_##name)
+
+enum {
+ Li_all = -1,
+
+ Li_iota = IOTA_INIT(0),
+ LOG_BIT(address_rewrite),
+ LOG_BIT(all_parents),
+ LOG_BIT(connection_reject),
+ LOG_BIT(delay_delivery),
+ LOG_BIT(dnslist_defer),
+ LOG_BIT(etrn),
+ LOG_BIT(host_lookup_failed),
+ LOG_BIT(lost_incoming_connection),
+ LOG_BIT(queue_run),
+ LOG_BIT(retry_defer),
+ LOG_BIT(size_reject),
+ LOG_BIT(skip_delivery),
+ LOG_BIT(smtp_connection),
+ LOG_BIT(smtp_incomplete_transaction),
+ LOG_BIT(smtp_protocol_error),
+ LOG_BIT(smtp_syntax_error),
+
+ Li_8bitmime = BITWORDSIZE,
+ Li_acl_warn_skipped,
+ Li_arguments,
+ Li_deliver_time,
+ Li_delivery_size,
+ Li_dnssec,
+ Li_ident_timeout,
+ Li_incoming_interface,
+ Li_incoming_port,
+ Li_millisec,
+ Li_outgoing_interface,
+ Li_outgoing_port,
+ Li_pid,
+ Li_proxy,
+ Li_queue_time,
+ Li_queue_time_overall,
+ Li_received_sender,
+ Li_received_recipients,
+ Li_rejected_header,
+ Li_return_path_on_delivery,
+ Li_sender_on_delivery,
+ Li_sender_verify_fail,
+ Li_smtp_confirmation,
+ Li_smtp_mailauth,
+ Li_smtp_no_mail,
+ Li_subject,
+ Li_tls_certificate_verified,
+ Li_tls_cipher,
+ Li_tls_peerdn,
+ Li_tls_sni,
+ Li_unknown_in_list,
+
+ log_selector_size = BITWORD(Li_unknown_in_list) + 1
+};
+
+#define LOGGING(opt) BIT_TEST(log_selector, log_selector_size, Li_##opt)