| 
 
 
 
 | 
 
|  |  | 
 Classes |  | struct | player_connection |  |  | Connection structure.  More... 
 
 |  | 
 Defines |  | #define | PLAYER_CCLIENT_DEBUG_LEVEL_DEFAULT   5 |  | 
 Typedefs |  | typedef player_connection | player_connection_t |  |  | Connection structure. 
 
 |  | 
 Functions |  | int | player_debug_level (int level) |  |  | Adjust debug ouput. 
 
 |  | int | player_connect (player_connection_t *conn, const char *host, const int port) |  |  | Connect to server listening at host:port. 
 
 |  | int | player_connect_host (player_connection_t *conn, const char *host, const int port) |  | int | player_connect_ip (player_connection_t *conn, const struct in_addr *addr, const int port) |  |  | Connect to server listening at addr:port. 
 
 |  | int | player_connect_sockaddr (player_connection_t *conn, const struct sockaddr_in *server) |  |  | Connect to server listening at the address specified in sockaddr. 
 
 |  | int | player_disconnect (player_connection_t *conn) |  |  | Close a connection. 
 
 |  | int | player_request (player_connection_t *conn, uint16_t device, uint16_t device_index, const char *payload, size_t payloadlen, player_msghdr_t *replyhdr, char *reply, size_t replylen) |  |  | Issue some request to the server. 
 
 |  | int | player_request_device_access (player_connection_t *conn, uint16_t device, uint16_t device_index, uint8_t req_access, uint8_t *grant_access, char *driver_name, int driver_name_len) |  |  | Issue a single device request (special case of player_request()). 
 
 |  | int | player_peek (player_connection_t *conn, int timeout) |  |  | Test to see if there is pending data on the connection. 
 
 |  | int | player_read (player_connection_t *conn, player_msghdr_t *hdr, char *payload, size_t payloadlen) |  |  | Read from the indicated connection. 
 
 |  | int | player_read_tcp (player_connection_t *conn, player_msghdr_t *hdr, char *payload, size_t payloadlen) |  | int | player_read_udp (player_connection_t *conn, player_msghdr_t *hdr, char *payload, size_t payloadlen) |  | int | player_write (player_connection_t *conn, uint16_t device, uint16_t device_index, const char *command, size_t commandlen) |  
 Define Documentation
 
  
    | 
        
          | #define PLAYER_CCLIENT_DEBUG_LEVEL_DEFAULT   5 |  |  
 Typedef Documentation
 
  
    |  | 
Connection structure. 
 
A pointer to this structure is passed into all functions; it keeps track of connection state.      |  
 Function Documentation
 
  
    | 
        
          | int player_debug_level | ( | int | level | ) |  |  |  
  
    |  | 
Adjust debug ouput. 
 
Higher numbers are more output, 0 is none. Incidentally, it returns the current level, and if you give -1 for <level>, then the current level is unchanged.      |  
 
  
    |  | 
Connect to server listening at host:port. 
 
conn is filled in with relevant information, and is used in subsequent player function calls. 
Returns: 
0 if everything is OK (connection opened)-1 if something went wrong (connection NOT opened)  |  
 
 
  
    | 
        
          | int player_connect_ip | ( | player_connection_t * | conn, |  
          |  |  | const struct in_addr * | addr, |  
          |  |  | const int | port |  
          |  | ) |  |  |  
  
    |  | 
Connect to server listening at addr:port. 
 
conn is filled in with relevant information, and is used in subsequent player function calls. (alternative to player_connect() using binary address) 
Returns: 
0 if everything is OK (connection opened)-1 if something went wrong (connection NOT opened)  |  
 
  
    |  | 
Connect to server listening at the address specified in sockaddr. 
 
conn is filled in with relevant information, and is used in subsequent player function calls. player_connect() and player_connect_ip use this function. 
Returns: 
0 if everything is OK (connection opened)-1 if something went wrong (connection NOT opened)  |  
 
  
    |  | 
Close a connection. 
 
conn should be a value that was previously returned by a call to player_connect() 
Returns: 
0 if everything is OK (connection closed)-1 if something went wrong (connection not closed)  |  
 
  
    | 
        
          | int player_request | ( | player_connection_t * | conn, |  
          |  |  | uint16_t | device, |  
          |  |  | uint16_t | device_index, |  
          |  |  | const char * | payload, |  
          |  |  | size_t | payloadlen, |  
          |  |  | player_msghdr_t * | replyhdr, |  
          |  |  | char * | reply, |  
          |  |  | size_t | replylen |  
          |  | ) |  |  |  
  
    |  | 
Issue some request to the server. 
 
requestlen is the length of the request. reply, if non-NULL, will be used to hold the reply; replylen is the size of the buffer (player_request() will not overrun your buffer) 
Returns: 
0 if everything went OK-1 if something went wrong (you should probably close the connection!)  |  
 
  
    | 
        
          | int player_request_device_access | ( | player_connection_t * | conn, |  
          |  |  | uint16_t | device, |  
          |  |  | uint16_t | device_index, |  
          |  |  | uint8_t | req_access, |  
          |  |  | uint8_t * | grant_access, |  
          |  |  | char * | driver_name, |  
          |  |  | int | driver_name_len |  
          |  | ) |  |  |  
  
    |  | 
Issue a single device request (special case of player_request()). 
 
If grant_access is non-NULL, then the actual granted access will be written there. 
Returns: 
0 if everything went OK-1 if something went wrong (you should probably close the connection!)  |  
 
  
    |  | 
Test to see if there is pending data on the connection. 
 
Checks whether there is data waiting on the connection, blocking for up to timeoutmilliseconds (set to 0 to not block). 
Returns: 
0 if there is no data waiting1 if there is data waiting-1 if something went wrong  |  
 
  
    |  | 
Read from the indicated connection. 
 
Put the data in buffer, up to bufferlen. 
Returns: 
0 if everything went OK-1 if something went wrong (you should probably close the connection!)  |  
 
 
 
  
    | 
        
          | int player_write | ( | player_connection_t * | conn, |  
          |  |  | uint16_t | device, |  
          |  |  | uint16_t | device_index, |  
          |  |  | const char * | command, |  
          |  |  | size_t | commandlen |  
          |  | ) |  |  |  
  
    |  | 
brief Write commands to the indicated connection. 
Writes the data contained in command, up to commandlen. 
Returns: 
0 if everything goes OK-1 if something went wrong (you should probably close the connection!)  |  Generated on Tue May 3 14:16:15 2005 for Player by
  1.3.6 |