Implement GSMTAP log target

This target wraps the to-be-logged string (With metadata) into a GSMTAP
packet and sends it to the configured destination address.

Change-Id: I9a7e72b8c9c6f6f2d76d1ea2332dcdee12394625
diff --git a/include/osmocom/core/logging.h b/include/osmocom/core/logging.h
index 581ebce..ad775b9 100644
--- a/include/osmocom/core/logging.h
+++ b/include/osmocom/core/logging.h
@@ -9,6 +9,7 @@
 #include <stdio.h>
 #include <stdint.h>
 #include <stdarg.h>
+#include <stdbool.h>
 #include <osmocom/core/linuxlist.h>
 
 /*! \brief Maximum number of logging contexts */
@@ -122,6 +123,7 @@
 
 struct log_info;
 struct vty;
+struct gsmtap_inst;
 
 typedef void log_print_filters(struct vty *vty,
 			       const struct log_info *info,
@@ -156,6 +158,7 @@
 	LOG_TGT_TYPE_FILE,	/*!< \brief text file logging */
 	LOG_TGT_TYPE_STDERR,	/*!< \brief stderr logging */
 	LOG_TGT_TYPE_STRRB,	/*!< \brief osmo_strrb-backed logging */
+	LOG_TGT_TYPE_GSMTAP,	/*!< \brief GSMTAP network logging */
 };
 
 /*! \brief structure representing a logging target */
@@ -204,6 +207,12 @@
 		struct {
 			void *rb;
 		} tgt_rb;
+
+		struct {
+			struct gsmtap_inst *gsmtap_inst;
+			const char *ident;
+			const char *hostname;
+		} tgt_gsmtap;
 	};
 
 	/*! \brief call-back function to be called when the logging framework
@@ -254,6 +263,7 @@
 void log_set_print_category(struct log_target *target, int);
 void log_set_log_level(struct log_target *target, int log_level);
 void log_parse_category_mask(struct log_target *target, const char* mask);
+const char* log_category_name(int subsys);
 int log_parse_level(const char *lvl);
 const char *log_level_str(unsigned int lvl);
 int log_parse_category(const char *category);
@@ -267,6 +277,10 @@
 struct log_target *log_target_create_file(const char *fname);
 struct log_target *log_target_create_syslog(const char *ident, int option,
 					    int facility);
+struct log_target *log_target_create_gsmtap(const char *host, uint16_t port,
+					    const char *ident,
+					    bool ofd_wq_mode,
+					    bool add_sink);
 int log_target_file_reopen(struct log_target *tgt);
 int log_targets_reopen(void);