uri.c: Simplify coap_split_uri_sub()

Remove complexity from parsing and make it easier to add in new schemes.
This commit is contained in:
Jon Shallow authored and Jon Shallow committed 2023-01-19 16:45:03 +00:00
1 parent 7fab8aa6fb
commit 813de0e39f
8 files changed
+94 -91

No files matched your search

+1 -1
View File
@@ -83,11 +83,11 @@ typedef struct oscore_ctx_t oscore_ctx_t;
#include "coap_oscore_internal.h"
#endif /* HAVE_OSCORE */
#include "coap_pdu_internal.h"
#include "coap_session_internal.h"
#include "coap_resource_internal.h"
#include "coap_session_internal.h"
#include "coap_subscribe_internal.h"
#include "coap_tcp_internal.h"
#include "coap_uri_internal.h"
#include "coap_utlist_internal.h"
#include "coap_uthash_internal.h"
+40
View File
@@ -0,0 +1,40 @@
/*
* coap_uri_internal.h -- URI functions for libcoap
*
* Copyright (C) 2019--2023 Olaf Bergmann <bergmann@tzi.org> and others
*
* SPDX-License-Identifier: BSD-2-Clause
*
* This file is part of the CoAP library libcoap. Please see README for terms
* of use.
*/
/**
* @file coap_uri_internal.h
* @brief CoAP URI internal information
*/
#ifndef COAP_URI_INTERNAL_H_
#define COAP_URI_INTERNAL_H_
#include "coap_internal.h"
/**
* @ingroup internal_api
* @defgroup uri URI Support
* Internal API for handling CoAP URIs
* @{
*/
typedef struct {
const char *name; /**< scheme name */
uint16_t port; /**< default scheme port */
uint16_t proxy_only; /**< set if proxy support only */
coap_uri_scheme_t scheme; /**< scheme */
} coap_uri_info_t;
extern coap_uri_info_t coap_uri_scheme[COAP_URI_SCHEME_LAST];
/** @} */
#endif /* COAP_URI_INTERNAL_H_ */
-2
View File
@@ -35,8 +35,6 @@ typedef enum coap_uri_scheme_t {
COAP_URI_SCHEME_LAST /* 6 Size of scheme */
} coap_uri_scheme_t;
extern const char *coap_uri_scheme[COAP_URI_SCHEME_LAST];
/** This mask can be used to check if a parsed URI scheme is secure. */
#define COAP_URI_SCHEME_SECURE_MASK 0x01