mgmt: mcumgr: smp: Expand ver to version and limit version

Expands a bitfield name from nh_ver to nh_version so it is more
obvious what it is. Also changes the version that goes into the
response to indicate what the maximum supported version of the
protocol is for a device

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
diff --git a/subsys/mgmt/mcumgr/smp/src/smp.c b/subsys/mgmt/mcumgr/smp/src/smp.c
index 1587b31..75e11f2 100644
--- a/subsys/mgmt/mcumgr/smp/src/smp.c
+++ b/subsys/mgmt/mcumgr/smp/src/smp.c
@@ -124,7 +124,8 @@
 		.nh_group = sys_cpu_to_be16(req_hdr->nh_group),
 		.nh_seq = req_hdr->nh_seq,
 		.nh_id = req_hdr->nh_id,
-		.nh_ver = req_hdr->nh_ver,
+		.nh_version = (req_hdr->nh_version > SMP_MCUMGR_VERSION_2 ? SMP_MCUMGR_VERSION_2 :
+			       req_hdr->nh_version),
 	};
 }
 
@@ -276,14 +277,14 @@
 	nbw->error_group = 0;
 	nbw->error_ret = 0;
 #else
-	if (req_hdr->nh_ver == SMP_MCUMGR_VERSION_1) {
+	if (req_hdr->nh_version == SMP_MCUMGR_VERSION_1) {
 		/* Support for the original version is excluded in this build */
 		return MGMT_ERR_UNSUPPORTED_TOO_OLD;
 	}
 #endif
 
 	/* We do not currently support future versions of the protocol */
-	if (req_hdr->nh_ver > SMP_MCUMGR_VERSION_2) {
+	if (req_hdr->nh_version > SMP_MCUMGR_VERSION_2) {
 		return MGMT_ERR_UNSUPPORTED_TOO_NEW;
 	}
 
@@ -296,7 +297,7 @@
 
 #ifdef CONFIG_MCUMGR_SMP_SUPPORT_ORIGINAL_PROTOCOL
 	/* If using the legacy protocol, translate the error code to a return code */
-	if (nbw->error_ret != 0 && req_hdr->nh_ver == 0) {
+	if (nbw->error_ret != 0 && req_hdr->nh_version == 0) {
 		rc = smp_translate_error_code(nbw->error_group, nbw->error_ret);
 		*rsn = MGMT_CTXT_RC_RSN(streamer);
 		return rc;
diff --git a/subsys/mgmt/mcumgr/transport/include/mgmt/mcumgr/transport/smp_internal.h b/subsys/mgmt/mcumgr/transport/include/mgmt/mcumgr/transport/smp_internal.h
index 3b5bcf8..828a15f 100644
--- a/subsys/mgmt/mcumgr/transport/include/mgmt/mcumgr/transport/smp_internal.h
+++ b/subsys/mgmt/mcumgr/transport/include/mgmt/mcumgr/transport/smp_internal.h
@@ -19,11 +19,11 @@
 struct smp_hdr {
 #ifdef CONFIG_LITTLE_ENDIAN
 	uint8_t  nh_op:3;		/* MGMT_OP_[...] */
-	uint8_t  nh_ver:2;
+	uint8_t  nh_version:2;
 	uint8_t  _res1:3;
 #else
 	uint8_t  _res1:3;
-	uint8_t  nh_ver:2;
+	uint8_t  nh_version:2;
 	uint8_t  nh_op:3;		/* MGMT_OP_[...] */
 #endif
 	uint8_t  nh_flags;		/* Reserved for future flags */