+meshlink_submesh_t *meshlink_submesh_open(meshlink_handle_t *mesh, const char *submesh) {
+ meshlink_submesh_t *s = NULL;
+ if(!mesh) {
+ logger(NULL, MESHLINK_ERROR, "No mesh handle given!\n");
+ meshlink_errno = MESHLINK_EINVAL;
+ return NULL;
+ }
+
+ if(!submesh || !*submesh) {
+ logger(NULL, MESHLINK_ERROR, "No submesh name given!\n");
+ meshlink_errno = MESHLINK_EINVAL;
+ return NULL;
+ }
+
+ s = (meshlink_submesh_t *)lookup_submesh(mesh, submesh);
+
+ if (s) {
+ logger(NULL, MESHLINK_ERROR, "SubMesh Already exists!\n");
+ meshlink_errno = MESHLINK_EEXIST;
+ return NULL;
+ }
+
+ s = (meshlink_submesh_t *)new_submesh();
+ s->name = xstrdup(submesh);
+
+ submesh_add(mesh, (submesh_t *)s);
+
+ meshlink_errno = MESHLINK_OK;
+ return s;
+}
+