Exemple #1
0
/**
 * See pcsl_serversocket.h for definition.
 */
int pcsl_serversocket_accept_finish(
    void *handle,
    void **pConnectionHandle,
    void **pContext)
{
  (void)pContext;
  return javacall_to_pcsl_result (javacall_server_socket_accept_finish (handle, pConnectionHandle));
}
Exemple #2
0
/**
 * See pcsl_network.h for definition.
 */
int
pcsl_network_setsockopt(void *handle, int flag, int optval) {
    javacall_result res;

    res = javacall_network_setsockopt(handle, flag, optval);

    return javacall_to_pcsl_result(res);
}
Exemple #3
0
/**
 * See pcsl_network.h for definition.
 */
int
pcsl_network_getLocalHostName(char *pLocalHost) {
    javacall_result res;

    res = javacall_network_get_local_host_name(pLocalHost);

    return javacall_to_pcsl_result(res);
}
Exemple #4
0
/**
 * See pcsl_network.h for definition.
 */
int
pcsl_network_getLocalIPAddressAsString(char *pLocalIPAddress) {
    javacall_result res;

    res = javacall_network_get_local_ip_address_as_string(pLocalIPAddress);

    return javacall_to_pcsl_result(res);
}
Exemple #5
0
/**
 * See pcsl_network.h for definition.
 */
int 
pcsl_network_init_finish(void) {
    javacall_result res;

    res = javacall_network_init_finish();

    return javacall_to_pcsl_result(res);
}
Exemple #6
0
/**
 * See pcsl_network.h for definition.
 *
 * Since the start function never returns PCSL_NET_WOULDBLOCK, this
 * function should never be called.
 */
int
pcsl_network_gethostbyname_finish(unsigned char *pAddress,
    int maxLen, int *pLen, void *handle, void *context) {
    javacall_result res;

    res = javacall_network_gethostbyname_finish(pAddress, maxLen, pLen, handle, context);

    return javacall_to_pcsl_result(res);
}
Exemple #7
0
/**
 * Finishes a pending host name lookup operation.
 * 
 * @param ipn Raw IP address to translate
 * @param hostname the host name. The value of <tt>host</tt> is set by
 *             this function.
 * @param pHandle address of variable to receive the handle to for
 *        unblocking the Java thread; this is set
 *        only when this function returns PCSL_NET_WOULDBLOCK.
 * @param context the context returned by the getHostByAddr_start function
 *
 * @return PCSL_NET_SUCCESS upon success;\n 
 * PCSL_NET_IOERROR if there is a network error;\n 
 */
int
pcsl_network_getHostByAddr_finish(int ipn, char *hostname, void **pHandle, void *context) {
    javacall_result res;

    res = javacall_network_gethostbyaddr_finish(ipn,hostname, pHandle, context);

    return javacall_to_pcsl_result(res);

}
Exemple #8
0
/**
 * See pcsl_network.h for definition.
 */
int
pcsl_network_gethostbyname_start(char *hostname,
    unsigned char *pAddress, int maxLen, int *pLen, void **pHandle, void **pContext) {
    javacall_result res;

    res = javacall_network_gethostbyname_start(hostname,
        pAddress, maxLen, pLen, pHandle, pContext);

    return javacall_to_pcsl_result(res);
}
Exemple #9
0
/**
 * See pcsl_datagram.h for definition.
 */
int pcsl_datagram_close_start(
    void *handle,
    void **pContext)
{
    int res;
    pContext = NULL;
    res = (int)javacall_datagram_close((javacall_handle) handle);

    return javacall_to_pcsl_result(res);
}
Exemple #10
0
/**
 * See pcsl_datagram.h for definition.
 */
int pcsl_datagram_open_start(
    int port,
    void **pHandle,
    void **pContext)
{
  int res;  
  *pContext = NULL;
  res =  (int)javacall_datagram_open(port,(javacall_handle *)pHandle);
  
  return javacall_to_pcsl_result(res);
}
Exemple #11
0
/**
 * See pcsl_serversocket.h for definition.
 */
int pcsl_serversocket_open(
    int port,
    void **pHandle)
{
    javacall_result res;
    void *Context;

    res = javacall_server_socket_open_start(port, pHandle, &Context);

    while (res == JAVACALL_WOULD_BLOCK)
      res = javacall_server_socket_open_finish(pHandle, &Context);
    return javacall_to_pcsl_result (res);
}
Exemple #12
0
/**
 * See pcsl_datagram.h for definition.
 */
int pcsl_datagram_read_finish(
    void *handle,
    unsigned char *pAddress,
    int *port,
    char *buffer,
    int length,
    int *pBytesRead,
    void *context)
{
  int res;
  res= (int)javacall_datagram_recvfrom_finish((javacall_handle) handle,pAddress,
        port,buffer,length,pBytesRead,context);

  return javacall_to_pcsl_result(res);
}
Exemple #13
0
/**
 * See pcsl_datagram.h for definition.
 */
int pcsl_datagram_write_finish(
    void *handle,
    unsigned char *pAddress,
    int port,
    char *buffer,
    int length,
    int *pBytesWritten,
    void *context)
{
    int res;
    res = (int)javacall_datagram_sendto_finish((javacall_handle) handle,pAddress,
        port,buffer,length,pBytesWritten,context);

    return javacall_to_pcsl_result(res);
}
Exemple #14
0
int
pcsl_network_getHostByAddr_start(int ipn, char *hostname, void **pHandle, void **pContext) {

    javacall_result res;
    res = javacall_network_gethostbyaddr_start(ipn,hostname, pHandle, pContext);

    // Fallback option,
    // If javacall_network_gethostbyaddr_start is not implemented,
    // Use a basic transformation
    if (res==JAVACALL_FAIL) {
        unsigned char ipBytes[4];
        memcpy(ipBytes, &ipn, 4);

        sprintf(hostname,"%d.%d.%d.%d",ipBytes[0],ipBytes[1],ipBytes[2],ipBytes[3]);

        return PCSL_NET_SUCCESS;
    }

    return javacall_to_pcsl_result(res);

}
Exemple #15
0
/**
 * See pcsl_serversocket.h for definition.
 */
int pcsl_serversocket_close_finish(
        void *handle,
        void *context)
{
  return javacall_to_pcsl_result (javacall_socket_close_finish (handle, context));
}
Exemple #16
0
/**
 * See pcsl_serversocket.h for definition.
 */
int pcsl_sereversocket_close_start(
    void *handle,
    void **pContext)
{
  return javacall_to_pcsl_result (javacall_socket_close_start (handle, pContext));
}