* prefix all BS11 specific OML functions with proper name
* add more BS11 specific OML commands (TRX power, logon, OML TEI, ...)

diff --git a/include/openbsc/abis_nm.h b/include/openbsc/abis_nm.h
index 8255f11..b86e022 100644
--- a/include/openbsc/abis_nm.h
+++ b/include/openbsc/abis_nm.h
@@ -363,10 +363,15 @@
 int abis_nm_reset_resource(struct gsm_bts *bts);
 
 /* Siemens / BS-11 specific */
-int abis_nm_db_transmission(struct gsm_bts *bts, int begin);
-int abis_nm_create_object(struct gsm_bts *bts, enum abis_bs11_objtype type,
+int abis_nm_bs11_db_transmission(struct gsm_bts *bts, int begin);
+int abis_nm_bs11_create_object(struct gsm_bts *bts, enum abis_bs11_objtype type,
 			  u_int8_t idx);
-int abis_nm_create_envaBTSE(struct gsm_bts *bts, u_int8_t idx);
-int abis_nm_create_bport(struct gsm_bts *bts, u_int8_t idx);
+int abis_nm_bs11_create_envaBTSE(struct gsm_bts *bts, u_int8_t idx);
+int abis_nm_bs11_create_bport(struct gsm_bts *bts, u_int8_t idx);
+int abis_nm_bs11_set_oml_tei(struct gsm_bts *bts, u_int8_t tei);
+int abis_nm_bs11_conn_oml(struct gsm_bts *bts, u_int8_t e1_port,
+			  u_int8_t e1_timeslot, u_int8_t e1_subslot);
+int abis_nm_bs11_set_trx_power(struct gsm_bts_trx *trx, u_int8_t level);
+int abis_nm_bs11_factory_logon(struct gsm_bts *bts);
 
 #endif /* _NM_H */
diff --git a/src/abis_nm.c b/src/abis_nm.c
index 0a4f6bb..2ce5923 100644
--- a/src/abis_nm.c
+++ b/src/abis_nm.c
@@ -324,6 +324,7 @@
 	struct msgb *msg = nm_msgb_alloc();
 
 	oh = (struct abis_om_hdr *) msgb_put(msg, ABIS_OM_FOM_HDR_SIZE);
+	/* FIXME: len correct? */
 	fill_om_fom_hdr(oh, sizeof(*oh), NM_MT_CONN_TERR_SIGN,
 			NM_OC_RADIO_CARRIER, bts->bts_nr, trx->nr, 0xff);
 	
@@ -350,6 +351,7 @@
 	struct msgb *msg = nm_msgb_alloc();
 
 	oh = (struct abis_om_hdr *) msgb_put(msg, ABIS_OM_FOM_HDR_SIZE);
+	/* FIXME: len correct? */
 	fill_om_fom_hdr(oh, sizeof(*ch), NM_MT_CONN_TERR_TRAF,
 			NM_OC_BASEB_TRANSC, bts->bts_nr, ts->trx->nr, ts->nr);
 
@@ -428,12 +430,12 @@
 
 /* Siemens (or BS-11) specific commands */
 
-int abis_nm_reset_resource(struct gsm_bts *bts)
+int abis_nm_bs11_reset_resource(struct gsm_bts *bts)
 {
 	return __simple_cmd(bts, NM_MT_BS11_RESET_RESOURCE);
 }
 
-int abis_nm_db_transmission(struct gsm_bts *bts, int begin)
+int abis_nm_bs11_db_transmission(struct gsm_bts *bts, int begin)
 {
 	if (begin)
 		return __simple_cmd(bts, NM_MT_BS11_BEGIN_DB_TX);
@@ -441,8 +443,8 @@
 		return __simple_cmd(bts, NM_MT_BS11_END_DB_TX);
 }
 
-int abis_nm_create_object(struct gsm_bts *bts, enum abis_bs11_objtype type,
-			  u_int8_t idx)
+int abis_nm_bs11_create_object(struct gsm_bts *bts,
+				enum abis_bs11_objtype type, u_int8_t idx)
 {
 	struct abis_om_hdr *oh;
 	struct msgb *msg = nm_msgb_alloc();
@@ -454,7 +456,7 @@
 	return abis_nm_sendmsg(bts, msg);
 }
 
-int abis_nm_create_envaBTSE(struct gsm_bts *bts, u_int8_t idx)
+int abis_nm_bs11_create_envaBTSE(struct gsm_bts *bts, u_int8_t idx)
 {
 	struct abis_om_hdr *oh;
 	struct msgb *msg = nm_msgb_alloc();
@@ -466,7 +468,7 @@
 	return abis_nm_sendmsg(bts, msg);
 }
 
-int abis_nm_create_bport(struct gsm_bts *bts, u_int8_t idx)
+int abis_nm_bs11_create_bport(struct gsm_bts *bts, u_int8_t idx)
 {
 	struct abis_om_hdr *oh;
 	struct msgb *msg = nm_msgb_alloc();
@@ -477,3 +479,72 @@
 
 	return abis_nm_sendmsg(bts, msg);
 }
+
+int abis_nm_bs11_set_oml_tei(struct gsm_bts *bts, u_int8_t tei)
+{
+	struct abis_om_hdr *oh;
+	struct msgb *msg = nm_msgb_alloc();
+	u_int8_t len = sizeof(*oh) + 2;
+
+	oh = (struct abis_om_hdr *) msgb_put(msg, ABIS_OM_FOM_HDR_SIZE);
+	fill_om_fom_hdr(oh, len, NM_MT_BS11_SET_ATTR, NM_OC_SITE_MANAGER,
+			0xff, 0xff, 0xff);
+	msgb_tv_put(msg, NM_ATT_TEI, tei);
+
+	return abis_nm_sendmsg(bts, msg);
+}
+
+/* like abis_nm_conn_terr_traf */
+int abis_nm_bs11_conn_oml(struct gsm_bts *bts, u_int8_t e1_port, 
+			  u_int8_t e1_timeslot, u_int8_t e1_subslot)
+{
+	struct abis_om_hdr *oh;
+	struct abis_nm_channel *ch;
+	struct msgb *msg = nm_msgb_alloc();
+
+	oh = (struct abis_om_hdr *) msgb_put(msg, ABIS_OM_FOM_HDR_SIZE);
+	/* FIXME: len correct? */
+	fill_om_fom_hdr(oh, sizeof(*ch), NM_MT_BS11_SET_ATTR,
+			NM_OC_SITE_MANAGER, 0xff, 0xff, 0xff);
+
+	ch = (struct abis_nm_channel *) msgb_put(msg, sizeof(*ch));
+	fill_nm_channel(ch, e1_port, e1_timeslot, e1_subslot);
+
+	return abis_nm_sendmsg(bts, msg);
+}
+
+int abis_nm_bs11_set_trx_power(struct gsm_bts_trx *trx, u_int8_t level)
+{
+	struct abis_om_hdr *oh;
+	struct msgb *msg = nm_msgb_alloc();
+	u_int8_t len = sizeof(*oh) + 3;
+
+	oh = (struct abis_om_hdr *) msgb_put(msg, ABIS_OM_FOM_HDR_SIZE);
+	fill_om_fom_hdr(oh, len, NM_MT_BS11_SET_ATTR,
+			NM_OC_BS11, BS11_OBJ_PA, 0x00, trx->nr);
+	msgb_tlv_put(msg, NM_ATT_BS11_TXPWR, 1, &level);
+
+	return abis_nm_sendmsg(trx->bts, msg);
+}
+
+static const u_int8_t bs11_logon_c7[] = 
+	{ 0x07, 0xd9, 0x01, 0x11, 0x0d, 0x10, 0x20 };
+static const u_int8_t bs11_logon_c8[] = { 0x01, 0x02 };
+static const u_int8_t bs11_logon_c9[] = "FACTORY";
+
+int abis_nm_bs11_factory_logon(struct gsm_bts *bts)
+{
+	struct abis_om_hdr *oh;
+	struct msgb *msg = nm_msgb_alloc();
+	u_int8_t len = sizeof(*oh) + 3*2 + sizeof(bs11_logon_c7)
+			+ sizeof(bs11_logon_c8) + sizeof(bs11_logon_c9);
+
+	oh = (struct abis_om_hdr *) msgb_put(msg, ABIS_OM_FOM_HDR_SIZE);
+	fill_om_fom_hdr(oh, len, NM_MT_BS11_FACTORY_LOGON,
+			NM_OC_BS11_A3, 0xff, 0xff, 0xff);
+	msgb_tlv_put(msg, 0xc7, sizeof(bs11_logon_c7), bs11_logon_c7);
+	msgb_tlv_put(msg, 0xc8, sizeof(bs11_logon_c8), bs11_logon_c8);
+	msgb_tlv_put(msg, 0xc9, sizeof(bs11_logon_c9), bs11_logon_c9);
+	
+	return abis_nm_sendmsg(bts, msg);
+}
diff --git a/src/bsc_hack.c b/src/bsc_hack.c
index 1f48c8d..a521eec 100644
--- a/src/bsc_hack.c
+++ b/src/bsc_hack.c
@@ -270,16 +270,16 @@
 	abis_nm_event_reports(bts, 0);
 
 	/* begin DB transmission */
-	abis_nm_db_transmission(bts, 1);
+	abis_nm_bs11_db_transmission(bts, 1);
 
 	/* end DB transmission */
-	abis_nm_db_transmission(bts, 0);
+	abis_nm_bs11_db_transmission(bts, 0);
 
 	/* Reset BTS Site manager resource */
 	abis_nm_reset_resource(bts);
 
 	/* begin DB transmission */
-	abis_nm_db_transmission(bts, 1);
+	abis_nm_bs11_db_transmission(bts, 1);
 
 	abis_nm_raw_msg(bts, sizeof(msg_1), msg_1); /* set BTS SiteMgr attr*/
 	abis_nm_raw_msg(bts, sizeof(msg_2), msg_2); /* set BTS attr */
@@ -336,7 +336,7 @@
 	abis_nm_conn_terr_traf(&trx->ts[7], 0, 3, 3);
 
 	/* end DB transmission */
-	abis_nm_db_transmission(bts, 0);
+	abis_nm_bs11_db_transmission(bts, 0);
 
 	/* Reset BTS Site manager resource */
 	abis_nm_reset_resource(bts);
@@ -351,10 +351,10 @@
 	abis_nm_event_reports(bts, 0);
 
 	/* begin DB transmission */
-	abis_nm_db_transmission(bts, 1);
+	abis_nm_bs11_db_transmission(bts, 1);
 
 	/* end DB transmission */
-	abis_nm_db_transmission(bts, 0);
+	abis_nm_bs11_db_transmission(bts, 0);
 
 	/* Reset BTS Site manager resource */
 	abis_nm_reset_resource(bts);