1 /** @file
2 
3   A brief file description
4 
5   @section license License
6 
7   Licensed to the Apache Software Foundation (ASF) under one
8   or more contributor license agreements.  See the NOTICE file
9   distributed with this work for additional information
10   regarding copyright ownership.  The ASF licenses this file
11   to you under the Apache License, Version 2.0 (the
12   "License"); you may not use this file except in compliance
13   with the License.  You may obtain a copy of the License at
14 
15       http://www.apache.org/licenses/LICENSE-2.0
16 
17   Unless required by applicable law or agreed to in writing, software
18   distributed under the License is distributed on an "AS IS" BASIS,
19   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20   See the License for the specific language governing permissions and
21   limitations under the License.
22  */
23 
24 #pragma once
25 
26 #include "tscore/ink_platform.h"
27 
28 //-------------------------------------------------------------------------
29 // transient_error
30 //-------------------------------------------------------------------------
31 
32 bool mgmt_transient_error();
33 
34 //-------------------------------------------------------------------------
35 // system calls (based on implementation from UnixSocketManager);
36 //-------------------------------------------------------------------------
37 
38 //-------------------------------------------------------------------------
39 // mgmt_accept
40 //-------------------------------------------------------------------------
41 
42 int mgmt_accept(int s, struct sockaddr *addr, socklen_t *addrlen);
43 
44 //-------------------------------------------------------------------------
45 // mgmt_fopen
46 //-------------------------------------------------------------------------
47 
48 FILE *mgmt_fopen(const char *filename, const char *mode);
49 
50 //-------------------------------------------------------------------------
51 // mgmt_open
52 //-------------------------------------------------------------------------
53 
54 int mgmt_open(const char *path, int oflag);
55 
56 //-------------------------------------------------------------------------
57 // mgmt_open_mode
58 //-------------------------------------------------------------------------
59 
60 int mgmt_open_mode(const char *path, int oflag, mode_t mode);
61 
62 //-------------------------------------------------------------------------
63 // mgmt_open_mode_elevate
64 //-------------------------------------------------------------------------
65 
66 int mgmt_open_mode_elevate(const char *path, int oflag, mode_t mode, bool elevate_p = false);
67 
68 //-------------------------------------------------------------------------
69 // mgmt_select
70 //-------------------------------------------------------------------------
71 
72 int mgmt_select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *errorfds, struct timeval *timeout);
73 
74 //-------------------------------------------------------------------------
75 // mgmt_sendto
76 //-------------------------------------------------------------------------
77 
78 int mgmt_sendto(int fd, void *buf, int len, int flags, struct sockaddr *to, int tolen);
79 
80 //-------------------------------------------------------------------------
81 // mgmt_socket
82 //-------------------------------------------------------------------------
83 
84 int mgmt_socket(int domain, int type, int protocol);
85 
86 //-------------------------------------------------------------------------
87 // mgmt_write_timeout
88 //-------------------------------------------------------------------------
89 int mgmt_write_timeout(int fd, int sec, int usec);
90 
91 //-------------------------------------------------------------------------
92 // mgmt_read_timeout
93 //-------------------------------------------------------------------------
94 int mgmt_read_timeout(int fd, int sec, int usec);
95 
96 // Do we support passing Unix domain credentials on this platform?
97 bool mgmt_has_peereid();
98 
99 // Get the Unix domain peer credentials.
100 int mgmt_get_peereid(int fd, uid_t *euid, gid_t *egid);
101