00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 #ifndef _ctrl_socks_h
00033 #define _ctrl_socks_h
00034 #include <sys/types.h>
00035 #include <sys/socket.h>
00036 #include <sys/un.h>
00037 #include <sys/uio.h>
00038 #include "../../ip_addr.h"
00039 #include "init_socks.h"
00040
00041
00042
00043 enum payload_proto { P_BINRPC , P_FIFO };
00044
00045 struct id_list{
00046 char* name;
00047 enum socket_protos proto;
00048 enum payload_proto data_proto;
00049 int port;
00050 char* buf;
00051 struct id_list* next;
00052 };
00053
00054 union sockaddr_u{
00055 union sockaddr_union sa_in;
00056 struct sockaddr_un sa_un;
00057 };
00058
00059
00060
00061
00062 struct ctrl_socket{
00063 int fd;
00064 int write_fd;
00065 enum socket_protos transport;
00066 enum payload_proto p_proto;
00067 char* name;
00068 int port;
00069 struct ctrl_socket* next;
00070 union sockaddr_u u;
00071 void *data;
00072 };
00073
00074
00075
00076 struct id_list* parse_listen_id(char*, int, enum socket_protos);
00077
00078 int init_ctrl_sockets(struct ctrl_socket** c_lst, struct id_list* lst,
00079 int def_port, int perm, int uid, int gid);
00080 void free_id_list(struct id_list*);
00081 void free_ctrl_socket_list(struct ctrl_socket* l);
00082
00083
00084 inline static char* payload_proto_name(enum payload_proto p)
00085 {
00086 switch(p){
00087 case P_BINRPC:
00088 return "binrpc";
00089 case P_FIFO:
00090 return "fifo";
00091 default:
00092 ;
00093 }
00094 return "<unknown>";
00095 }
00096
00097 #endif