Harlequin RIP SDK

Implementation of socket input device type. More...

#include "skinkit.h"
#include "kitdevs.h"
#include "file.h"
#include "mem.h"
#include "psock.h"
#include "swdevice.h"
#include "hqmemcpy.h"
#include "skindevs.h"
#include "devutils.h"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#include <errno.h>

Functions

static int32 sock_device_init (DEVICELIST *dev)
 socket input device initialisation. This is called for each device (note: not device type) when its type number is assigned by a call to setdevparams.
 
static DEVICE_FILEDESCRIPTOR sock_open_file (DEVICELIST *dev, uint8 *filename, int32 openflags)
 The file_open call for the socket input device type.
 
static int32 sock_read_file (DEVICELIST *dev, DEVICE_FILEDESCRIPTOR descriptor, uint8 *buff, int32 len)
 The read_file routine for the socket input device type. More...
 
static int32 sock_write_file (DEVICELIST *dev, DEVICE_FILEDESCRIPTOR descriptor, uint8 *buff, int32 len)
 The write_file routine for the socket input device type. More...
 
static int32 sock_close_file (DEVICELIST *dev, DEVICE_FILEDESCRIPTOR descriptor)
 The close_file routine for the socket input device type. More...
 
static int32 sock_seek_file (DEVICELIST *dev, DEVICE_FILEDESCRIPTOR descriptor, Hq32x2 *destination, int32 flags)
 The seek_file routine for the socket input device type.
 
static int32 sock_bytes_file (DEVICELIST *dev, DEVICE_FILEDESCRIPTOR descriptor, Hq32x2 *bytes, int32 reason)
 The bytes_file routine for the socket input device type.
 
static int32 sock_status_file (DEVICELIST *dev, uint8 *filename, STAT *statbuff)
 The status_file routine for the socket input device type.
 
static void * sock_start_file_list (DEVICELIST *dev, uint8 *pattern)
 
  • sock_start_file_list

 
static int32 sock_next_file (DEVICELIST *dev, void **handle, uint8 *pattern, FILEENTRY *entry)
 sock_next_file
 
static int32 sock_end_file_list (DEVICELIST *dev, void *handle)
 sock_end_file_list
 
static int32 sock_rename_file (DEVICELIST *dev, uint8 *file1, uint8 *file2)
 The rename_file routine for the socket input device type.
 
static int32 sock_delete_file (DEVICELIST *dev, uint8 *filename)
 The delete_file routine for the socket input device type.
 
static int32 sock_set_param (DEVICELIST *dev, DEVICEPARAM *param)
 The set_param routine for the socket input device type.
 
static int32 sock_start_param (DEVICELIST *dev)
 The start_param routine for the socket input device type. More...
 

Variables

DEVICETYPE Socket_Device_Type
 The device type structure for the socket input devices.
 

Detailed Description

Implementation of socket input device type.

This is an absolute device that can be used to open a network stream for reading or writing. This device supports the parameters:

Address
The dotted quad IPv4 address of the server or client to connect to.
Port
The port number to connect to.

A single read or write stream can be connected or bound for each device instance. Sockets can be opened for read or write, but not both at once.

Function Documentation

◆ sock_close_file()

static int32 sock_close_file ( DEVICELIST dev,
DEVICE_FILEDESCRIPTOR  descriptor 
)
static

The close_file routine for the socket input device type.

The abort call also invokes this function, because an abnormal close is the same as a normal close for the socket input device type.

◆ sock_read_file()

static int32 sock_read_file ( DEVICELIST dev,
DEVICE_FILEDESCRIPTOR  descriptor,
uint8 buff,
int32  len 
)
static

The read_file routine for the socket input device type.

Read from file described by ‘descriptor’ which is on the device ‘dev’ into the buffer ‘buff’.

For abnormally large buffers (only when the device requests such sizes by the appropriate device type call), reading from the socket in chunks might be required, with SwOften calls between each.

◆ sock_start_param()

static int32 sock_start_param ( DEVICELIST dev)
static

The start_param routine for the socket input device type.

The routine is called as part of the currentdevparams operator; the individual parameters are returned one at a time by subsequent calls to the get_param function. sock_param_count is used to maintain the state between calls to get_param.

Also return the number of parameters recognized by this implementation of the socket input device type.

◆ sock_write_file()

static int32 sock_write_file ( DEVICELIST dev,
DEVICE_FILEDESCRIPTOR  descriptor,
uint8 buff,
int32  len 
)
static

The write_file routine for the socket input device type.

Write to the file described by ‘descriptor’ which is on the device ‘dev’ from the buffer ‘buff’.

The comment for reading regarding SwOften also applies here.