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
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00069 #ifndef PLAYERCCLIENT_H
00070 #define PLAYERCCLIENT_H
00071
00072 #ifdef __cplusplus
00073 extern "C" {
00074 #endif
00075
00076
00077 #include <player.h>
00078 #include <netinet/in.h>
00079
00089 typedef struct player_connection
00090 {
00091
00092 int sock;
00093
00094
00095 int protocol;
00096
00097
00098 uint16_t id;
00099
00100 struct sockaddr_in server_addr;
00101
00102 char banner[PLAYER_IDENT_STRLEN];
00103 } player_connection_t;
00104
00105 #define PLAYER_CCLIENT_DEBUG_LEVEL_DEFAULT 5
00106
00112 int player_debug_level(int level);
00113
00123 int player_connect(player_connection_t* conn,
00124 const char* host,
00125 const int port);
00126
00127 int player_connect_host(player_connection_t* conn,
00128 const char* host,
00129 const int port);
00130
00141 int player_connect_ip(player_connection_t* conn,
00142 const struct in_addr* addr,
00143 const int port);
00154 int player_connect_sockaddr(player_connection_t* conn,
00155 const struct sockaddr_in* server);
00165 int player_disconnect(player_connection_t* conn);
00166
00177 int player_request(player_connection_t* conn,
00178 uint16_t device, uint16_t device_index,
00179 const char* payload, size_t payloadlen,
00180 player_msghdr_t* replyhdr, char* reply, size_t replylen);
00181
00191 int player_request_device_access(player_connection_t* conn,
00192 uint16_t device,
00193 uint16_t device_index,
00194 uint8_t req_access,
00195 uint8_t* grant_access,
00196 char* driver_name,
00197 int driver_name_len);
00198
00209 int player_peek(player_connection_t *conn, int timeout);
00210
00219 int player_read(player_connection_t* conn, player_msghdr_t* hdr,
00220 char* payload, size_t payloadlen);
00221
00222 int player_read_tcp(player_connection_t* conn, player_msghdr_t* hdr,
00223 char* payload, size_t payloadlen);
00224
00225 int player_read_udp(player_connection_t* conn, player_msghdr_t* hdr,
00226 char* payload, size_t payloadlen);
00227
00236 int player_write(player_connection_t* conn,
00237 uint16_t device, uint16_t device_index,
00238 const char* command, size_t commandlen);
00242 #ifdef __cplusplus
00243 }
00244 #endif
00245
00246 #endif
00247