File: network_utils.h

package info (click to toggle)
swupdate 2025.12%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 10,004 kB
  • sloc: ansic: 66,621; python: 6,291; makefile: 791; sh: 538; javascript: 229
file content (32 lines) | stat: -rw-r--r-- 693 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/*
 * (C) Copyright 2023
 * Felix Moessbauer <felix.moessbauer@siemens.com>
 *
 * SPDX-License-Identifier:     GPL-2.0-only
 */
#pragma once

/**
 * \brief create or attach to socket at path
 * 
 * \param path absolute path to socket file
 * \param type socket type of socket()
 * \return fd on success, -1 on error
*/
int listener_create(const char *path, int type);

/**
 * \brief initialize unlink functionality for sockets
 * 
 * Call this function before \c register_socket_unlink
 * \return 0 on success
 */
int init_socket_unlink_handler(void);

/** 
 * \brief unlink socket path on exit
 * 
 * \note threadsafe
 * \return 0 on success
 */
int register_socket_unlink(const char* path);