]>
git.ipfire.org Git - people/ms/rstp.git/blob - rstplib/uid_sock.h
1 /************************************************************************
2 * RSTP library - Rapid Spanning Tree (802.1t, 802.1w)
3 * Copyright (C) 2001-2003 Optical Access
6 * This file is part of RSTP library.
8 * RSTP library is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU Lesser General Public License as published by the
10 * Free Software Foundation; version 2.1
12 * RSTP library is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
15 * General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public License
18 * along with RSTP library; see the file COPYING. If not, write to the Free
19 * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
21 **********************************************************************/
23 #ifndef _UID_SOCKET_H__
24 #define _UID_SOCKET_H__
28 #include <sys/socket.h> /* basic socket definitions */
29 #include <netinet/in.h>
30 #include <linux/un.h> /* for Unix domain sockets */
32 #define UID_REPL_PATH "/tmp/UidSocketFile"
34 typedef struct sockaddr SA
;
36 #define SOCKET_NAME_LENGTH 108
37 #define SIZE_OF_ADDRESS sizeof(struct sockaddr_un)
45 typedef char UID_SOCK_ID
[SOCKET_NAME_LENGTH
];
49 struct sockaddr_un clientAddr
;
50 struct sockaddr_un serverAddr
; // Only for socket of UID_BIND_AS_CLIENT
51 UID_SOCK_ID socket_id
;
52 TYPE_OF_BINDING binding
;
55 #define MESSAGE_SIZE 2048
57 int UiD_SocketInit(UID_SOCKET_T
* sock
,
59 TYPE_OF_BINDING binding
);
61 int UiD_SocketRecvfrom (UID_SOCKET_T
* sock
,
64 UID_SOCKET_T
* sock_4_reply
);
66 int UiD_SocketSendto (UID_SOCKET_T
* sock
,
70 int UiD_SocketClose(UID_SOCKET_T
* sock
);
72 int UiD_SocketSetReadTimeout (UID_SOCKET_T
* s
, int timeout
);
75 UiD_SocketCompare (UID_SOCKET_T
* s
, UID_SOCKET_T
* t
);
77 #define GET_FILE_DESCRIPTOR(sock) (((UID_SOCKET_T*)sock)->sock_fd)
79 #endif /* _UID_SOCKET_H__ */