예제 #1
0
파일: tcp.c 프로젝트: okirch/twopence
// Initialize the handle
//
// Returns 0 if everything went fine, or -1 in case of error
static int
__twopence_tcp_init(struct twopence_tcp_target *handle, const char *server_spec)
{

  twopence_pipe_target_init(&handle->pipe, TWOPENCE_PLUGIN_TCP, &twopence_tcp_ops, &twopence_tcp_link_ops);
  handle->server_spec = twopence_strdup(server_spec);
  return 0;
}
예제 #2
0
파일: virtio.c 프로젝트: CasaMallo/twopence
// Initialize the handle
//
// Returns 0 if everything went fine, or -1 in case of error
static int
__twopence_virtio_init(struct twopence_virtio_target *handle, const char *sockname)
{
    twopence_pipe_target_init(&handle->pipe, TWOPENCE_PLUGIN_VIRTIO, &twopence_virtio_ops, &twopence_virtio_link_ops);

    // Initialize the socket address
    handle->address.sun_family = AF_LOCAL;
    if (strlen(sockname) >= sizeof(handle->address.sun_path))
        return -1;
    strcpy(handle->address.sun_path, sockname);

    return 0;
}