Forum | Documentation | Website | Blog

Skip to content
Snippets Groups Projects
Verified Commit 5c46002f authored by Ayush Singh's avatar Ayush Singh
Browse files

Refactor code


- Add comments
- Run checkpatch

Signed-off-by: default avatarAyush Singh <ayushdevel1325@gmail.com>
parent 0e6a5edc
Branches
No related merge requests found
Pipeline #5491 passed with stage
in 2 minutes and 36 seconds
......@@ -11,12 +11,45 @@
static const struct in6_addr mdns_addr = {
{{0xFF, 0x02, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xFB}}};
/*
* Open a new MDNS socket
*
* @param multicast address
*
* @return socket if successfull. Else negative
*/
int mdns_socket_open_ipv6(const struct in6_addr *saddr);
/*
* Close mdns socket
*
* @param socket
*/
void mdns_socket_close(int sock);
/*
* Send DNS-SD query over mdns
*
* @param socket
* @param query
* @param query length
*
* @return 0 if successfull. Else negative
*/
int mdns_query_send(int sock, const char *name, size_t length);
/*
* Receive DNS-SD query response
*
* @param socket
* @param address list to populate with discovered nodes
* @param address list length
* @param query
* @param query length
* @param timeout
*
* @return number of items written to address list
*/
size_t mdns_query_recv(int sock, struct in6_addr *addr_list, size_t addr_list_len,
const char *query, size_t query_len, int timeout);
......
/* SPDX-License-Identifier: Apache-2.0 */
/*
* Copyright (c) 2023 Ayush Singh <ayushdevel1325@gmail.com>
*/
#ifndef _TCP_DISCOVERY_H_
#define _TCP_DISCOVERY_H_
#define NODE_DISCOVERY_INTERVAL 5000
/*
* Start Greybus Node discovery over network
*/
void tcp_discovery_start(void);
/*
* Stop Greybus Node discovery over network
*/
void tcp_discovery_stop(void);
#endif
......@@ -30,7 +30,7 @@ K_HEAP_DEFINE(cports_heap, CONFIG_BEAGLEPLAY_GREYBUS_MAX_CPORTS * sizeof(int));
static sys_dlist_t node_interface_list = SYS_DLIST_STATIC_INIT(&node_interface_list);
static struct in6_addr node_addr_cache[MAX_GREYBUS_NODES];
static size_t node_addr_cache_pos = 0;
static size_t node_addr_cache_pos;
static int ipaddr_cmp(const struct in6_addr *a, const struct in6_addr *b)
{
......
// SPDX-License-Identifier: Apache-2.0
/*
* Copyright (c) 2023 Ayush Singh <ayushdevel1325@gmail.com>
*/
#include "tcp_discovery.h"
#include "node.h"
#include "mdns.h"
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment