jolly has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-remsim/+/43741?usp=email ) Change subject: libifd_remsim_client supports multiple slots ...................................................................... libifd_remsim_client supports multiple slots Proof of concept. DEVICENAME <C>:<n>:<ip osmo-remsim-server>:<port> - First part is the Client ID (default: 0) - Second part is the number of slots (default: 1) Change-Id: Ia8baa2fbe112c2ee6de94a8d706900b09fe548aa --- M src/client/user_ifdhandler.c 1 file changed, 13 insertions(+), 6 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-remsim refs/changes/41/43741/1 diff --git a/src/client/user_ifdhandler.c b/src/client/user_ifdhandler.c index 7435832..bd58c6f 100644 --- a/src/client/user_ifdhandler.c +++ b/src/client/user_ifdhandler.c @@ -549,6 +549,7 @@ } #define MAX_SLOTS 256 +static int num_slots = 1; static struct ifd_client *ifd_client[MAX_SLOTS]; #define LUN2SLOT(lun) ((lun) & 0xffff) @@ -569,7 +570,8 @@ .client_id = 0, .client_slot = 0, }; - char *r, *client_id, *slot_nr, *host, *port; + char device_name[strlen(DeviceName) + 1]; + char *r, *client_id, *slots, *host, *port; if (LUN2RDR(Lun) != 0) return IFD_NO_SUCH_DEVICE; @@ -579,15 +581,20 @@ ensure_osmo_ctx(); - client_id = strtok_r(DeviceName, ":", &r); + strcpy(device_name, DeviceName); + + client_id = strtok_r(device_name, ":", &r); if (!client_id) goto end_parse; cfg.client_id = atoi(client_id); + cfg.client_slot = LUN2SLOT(Lun); - slot_nr = strtok_r(NULL, ":", &r); - if (!slot_nr) + slots = strtok_r(NULL, ":", &r); + if (!slots) goto end_parse; - cfg.client_slot = atoi(slot_nr); + num_slots = atoi(slots); + if (num_slots < 1 || num_slots > MAX_SLOTS) + return IFD_NO_SUCH_DEVICE; host = strtok_r(NULL, ":", &r); if (!host) @@ -718,7 +725,7 @@ /* Return the number of slots in this reader in Value[0] */ if (*Length < 1) goto err; - *Value = 1; + *Value = num_slots; *Length = 1; break; case TAG_IFD_THREAD_SAFE: -- To view, visit https://gerrit.osmocom.org/c/osmo-remsim/+/43741?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: newchange Gerrit-Project: osmo-remsim Gerrit-Branch: master Gerrit-Change-Id: Ia8baa2fbe112c2ee6de94a8d706900b09fe548aa Gerrit-Change-Number: 43741 Gerrit-PatchSet: 1 Gerrit-Owner: jolly <andreas@eversberg.eu>