Skip to content

Commit

Permalink
Update public API
Browse files Browse the repository at this point in the history
  • Loading branch information
Danielius1922 committed Sep 28, 2024
1 parent 97a24ff commit 89c88f2
Show file tree
Hide file tree
Showing 4 changed files with 90 additions and 40 deletions.
2 changes: 1 addition & 1 deletion api/unittest/buffersettingstest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ TEST(BufferSettings, SetMinAppDataSize)
oc_set_min_app_data_size(42);
EXPECT_EQ(42, oc_get_min_app_data_size());

oc_set_min_app_data_size(max_app_size);
oc_set_min_app_data_size(min_app_size);
}

#endif /* !OC_APP_DATA_BUFFER_SIZE && OC_REP_ENCODING_REALLOC */
Expand Down
38 changes: 3 additions & 35 deletions port/oc_connectivity.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include "oc_export.h"
#include "oc_network_events.h"
#include "oc_session_events.h"
#include "port/oc_dns.h"
#include "util/oc_atomic.h"
#include "util/oc_features.h"
#include "util/oc_memb.h"
Expand Down Expand Up @@ -141,57 +142,24 @@ typedef struct oc_message_s
#endif /* OC_HAS_FEATURE_MESSAGE_DYNAMIC_BUFFER */
} oc_message_t;

/**
* @brief send buffer
*
* @param message message to send
* @return int >=0 number of sent bytes
* @return int -1 on error
*/
int oc_send_buffer(oc_message_t *message);

/**
* @brief send discovery request
*
* @param message the message
*/
void oc_send_discovery_request(oc_message_t *message);

/**
* @brief end TCP session for the specific endpoint.
*
* @param endpoint the endpoint to close the session for
*
* @deprecated replaced by oc_close_session in v2.2.5.14
*/
OC_API
void oc_connectivity_end_session(const oc_endpoint_t *endpoint)
OC_DEPRECATED("replaced by oc_close_session in v2.2.5.14");

#ifdef OC_DNS_LOOKUP
/**
* @brief dns look up
*
* @param domain the url
* @param addr the address
* @param flags the transport flags
* @return int 0 = success
*/
int oc_dns_lookup(const char *domain, oc_string_t *addr, transport_flags flags);
#ifdef OC_DNS_CACHE
/**
* @brief clear the DNS cache
*
*/
void oc_dns_clear_cache(void);
#endif /* OC_DNS_CACHE */
#endif /* OC_DNS_LOOKUP */

/**
* @brief retrieve list of endpoints for the device
*
* @param device the device index
* @return oc_endpoint_t* list of endpoints
*/
OC_API
oc_endpoint_t *oc_connectivity_get_endpoints(size_t device);

#ifdef OC_TCP
Expand Down
26 changes: 22 additions & 4 deletions port/oc_connectivity_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,15 @@ int oc_connectivity_init(size_t device, oc_connectivity_ports_t ports);
*/
void oc_connectivity_shutdown(size_t device);

/**
* @brief send buffer
*
* @param message message to send
* @return int >=0 number of sent bytes
* @return int -1 on error
*/
int oc_send_buffer(oc_message_t *message);

/**
* @brief Send message to endpoint.
*
Expand All @@ -65,13 +74,22 @@ void oc_connectivity_shutdown(size_t device);
*/
int oc_send_buffer2(oc_message_t *message, bool queue);

#ifdef OC_DYNAMIC_ALLOCATION
/**
* @brief send a wakeup signal to the device to start consuming network events
* @brief send discovery request
*
* @param device the device index
* @param message the message
*/
void oc_connectivity_wakeup(size_t device);
void oc_send_discovery_request(oc_message_t *message);
oc_set_min_app_data_size

#ifdef OC_DYNAMIC_ALLOCATION
/**
* @brief send a wakeup signal to the device to start consuming network events
*
* @param device the device index
*/
void
oc_connectivity_wakeup(size_t device);
#endif /* OC_DYNAMIC_ALLOCATION */

#ifdef OC_NETWORK_MONITOR
Expand Down
64 changes: 64 additions & 0 deletions port/oc_dns.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/****************************************************************************
*
* Copyright (c) 2016, 2018, 2020 Intel Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License"),
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific
* language governing permissions and limitations under the License.
*
****************************************************************************/

/**
* @file
*/

#ifndef OC_PORT_DNS_H
#define OC_PORT_DNS_H

#include "oc_endpoint.h"
#include "oc_export.h"
#include "oc_helpers.h"
#include "util/oc_features.h"

#ifdef __cplusplus
extern "C" {
#endif

#ifdef OC_DNS_LOOKUP

/**
* @brief dns look up
*
* @param domain the url
* @param addr the address
* @param flags the transport flags
* @return int 0 = success
*/
OC_API
int oc_dns_lookup(const char *domain, oc_string_t *addr, transport_flags flags);

#ifdef OC_DNS_CACHE

/**
* @brief clear the DNS cache
*/
OC_API
void oc_dns_clear_cache(void);

#endif /* OC_DNS_CACHE */

#endif /* OC_DNS_LOOKUP */

#ifdef __cplusplus
}
#endif

#endif /* OC_PORT_DNS_H */

0 comments on commit 89c88f2

Please sign in to comment.