property_protocol.h File Reference

Network property protocol specific definitions and APIs. More...

Data Structures

struct  DCDevice
 Remote device structure. More...

Defines

#define NETPP_PROTOCOL_VERSION   0x01
 Netpp protocol version.
#define DISCOVERY_PORT   7208
 Port for netpp discovery.

Typedefs

typedef struct DCDevice RemoteDevice
 Remote device structure.
typedef void(* LogCallback )(const char *fmt, va_list argp)
 Event logging callback function pointer.

Functions

int handle_sockerr (int error, const char *txt)
 Handle Socket error.
int net_send_packet (Peer *peer, PropertyPacketHdr *h, const char *data, size_t len)
 Send network packet.
int net_openbyname (RemoteDevice *d, const char *name, int(*con_init)(Peer *p, int bufsize))
 Open remote connection by name.
uint32_t local_getroot (struct DCDevice *d)
 Get Root node token.
int slave_handler (RemoteDevice *d)
 Enters the slave handler reacting to a property protocol request.
int device_write (struct DCDevice *d, uint32_t addr, const unsigned char *buf, unsigned long size)
 Device backend write register or memory function.
int device_read (struct DCDevice *d, uint32_t addr, unsigned char *buf, unsigned long size)
 Device backend read register.
void register_proplist (struct device_desc_t *d, int n)
 Register property list with netpp backend (Slave side).
int str_fromip (char name[], unsigned long ip, unsigned short port)
 Convert IP long to string.
int protocol_request (RemoteDevice *d, int request)
 Internal protocol request.
int tcp_openbyname (RemoteDevice *d, const char *addr)
 Master: Explicit opening of a TCP connection.
int tcp_getremoteaddr (RemoteDevice *d, unsigned long *ip, unsigned short *port)
 Get remote IP from TCP.
int tcp_cleanup (RemoteDevice *d)
 Clean up TCP connection This simply closes the socket and is the default cleanup function if a Peer has disconnected.
void tcp_set_disconnect_cleanup (RemoteDevice *d, int(*cleanup)(struct DCDevice *d))
 Set TCP cleanup function.
int usb_server_init (Peer *p)
 USB server init function.
int usb_server_exit (Peer *p)
 USB server deinitialization.
int dev_server_init (Peer *p)
 DEV server init function.
int dev_server_exit (Peer *p)
 DEV server deinitialization.

Variables

void(* netpp_log )(int log_level, const char *fmt,...)
 Log function pointer.

Detailed Description

(c) 2005-2008, Martin Strubel <strubel@section5.ch>


Function Documentation

int dev_server_init ( Peer *  p  ) 
Parameters:
p Pointer to uninitialized Peer structure
Examples:
server.c.
int tcp_getremoteaddr ( RemoteDevice d,
unsigned long *  ip,
unsigned short *  port 
)
Parameters:
d Remote device handle
ip Pointer to IP address returned by this function
port Pointer to Port number returned by this function
int tcp_openbyname ( RemoteDevice d,
const char *  addr 
)
Parameters:
d Remote device structure, can be uninitialized.
addr Hostname address (currently in IP notation) This can be of the form "<ip>:<port>"
void tcp_set_disconnect_cleanup ( RemoteDevice d,
int(*)(struct DCDevice *d)  cleanup 
)

This function is called on a disconnect (from peer), in general: when the connection is lost.

int usb_server_init ( Peer *  p  ) 
Parameters:
p Pointer to uninitialized Peer structure
Examples:
server.c.

Variable Documentation

void(* netpp_log)(int log_level, const char *fmt,...)
Parameters:
log_level one of DCLOG_ERROR, DCLOG_DEBUG, DCLOG_VERBOSE
fmt printf compatible string format
... printf compatible arguments
Examples:
handler.c.

Generated on Thu Feb 24 13:50:16 2011 for Device Control library by  doxygen 1.6.1