Main Page Class Hierarchy Compound List File List Compound Members File Members

# ws_clientII.c File Reference

`#include <stdio.h>`
`#include <stdlib.h>`
`#include <string.h>`
`#include <time.h>`
`#include <errno.h>`
`#include <earthworm.h>`
`#include <ws_clientII.h>`
`#include <socket_ew.h>`
`#include <time_ew.h>`

Go to the source code of this file.

## Defines
#define | WS_MAX_RECV_BUF_LEN 4096
## Functions
int | recv_all (SOCKET, char FAR *, int, int, int)
int | wsWaitAscii (WS_MENU, char *, int, int)
int | wsWaitBinHeader (WS_MENU, char *, int, int)
int | wsParseMenuReply (WS_MENU, char *)
int | wsParseBinHeaderReply (TRACE_REQ *, char *)
int | wsParseAsciiHeaderReply (TRACE_REQ *, char *)
void | wsSkipN (char *, int, int *)
timeval FAR * | resetTimeout (struct timeval FAR *)
Time_ew | adjustTimeoutLength (int timeout_msec)
int | wsAppendMenu (char *ipAdr, char *port, WS_MENU_QUEUE_REC *menu_queue, int timeout)
void | wsKillMenu (WS_MENU_QUEUE_REC *menu_queue)
int | wsGetTraceBin (TRACE_REQ *getThis, WS_MENU_QUEUE_REC *menu_queue, int timeout)
int | wsGetTraceAscii (TRACE_REQ *getThis, WS_MENU_QUEUE_REC *menu_queue, int timeout)
void | wsKillPSCN (WS_PSCN pscn)
int | wsGetServerPSCN (char *addr, char *port, WS_PSCN *pscnp, WS_MENU_QUEUE_REC *menu_queue)
int | wsSearchSCN (TRACE_REQ *getThis, WS_MENU *menup, WS_PSCN *pscnp, WS_MENU_QUEUE_REC *menu_queue)
int | wsAttachServer (WS_MENU menu, int timeout)
void | wsDetachServer (WS_MENU menu)
int | setWsClient_ewDebug (int debug)
## Variables
int | menu_reqid = 0
int | WS_CL_DEBUG = 0

## Define Documentation

#define WS_MAX_RECV_BUF_LEN 4096

| Definition at line 58 of file ws_clientII.c. Referenced by wsWaitAscii().

## Function Documentation

Time_ew adjustTimeoutLength | ( | int | timeout_msec | ) |

| Definition at line 139 of file socket_ew.c. Referenced by accept_ew(), recv_all(), recv_ew(), recvfrom_ew(), send_ew(), sendto_ew(), wsWaitAscii(), and wsWaitBinHeader().

int recv_all | ( | SOCKET | ,
|  | char FAR * | ,
|  | int | ,
|  | int | ,
|  | int |
| ) |

| Definition at line 447 of file socket_ew_common.c.

struct timeval FAR* resetTimeout | ( | struct timeval FAR * |  | ) |

| Referenced by accept_ew(), recv_all(), recv_ew(), recvfrom_ew(), send_ew(), and sendto_ew().

int setWsClient_ewDebug | ( | int | debug | ) |

| Definition at line 1312 of file ws_clientII.c. References WS_CL_DEBUG.

int wsAppendMenu | ( | char * | ipAdr,
|  | char * | port,
|  | WS_MENU_QUEUE_REC * | menu_queue,
|  | int | timeout
| ) |

| Definition at line 84 of file ws_clientII.c. References _WS_MENU_REC::addr, WS_MENU_QUEUE_REC::head, logit(), _WS_MENU_REC::next, _WS_MENU_REC::port, _WS_MENU_REC::pscn, send_ew(), _WS_MENU_REC::sock, WS_MENU_QUEUE_REC::tail, WS_ERR_BROKEN_CONNECTION, WS_ERR_BUFFER_OVERFLOW, WS_ERR_EMPTY_MENU, WS_ERR_INPUT, WS_ERR_MEMORY, WS_ERR_NO_CONNECTION, WS_ERR_NONE, WS_ERR_PARSE, WS_ERR_TIMEOUT, wsADRLEN, wsAttachServer(), wsDetachServer(), wsKillPSCN(), wsParseMenuReply(), wsREQLEN, and wsWaitAscii().

int wsAttachServer | ( | WS_MENU | menu,
|  | int | timeout
| ) |

| Definition at line 603 of file ws_clientII.c. References _WS_MENU_REC::addr, connect_ew(), logit(), _WS_MENU_REC::port, _WS_MENU_REC::sock, socket_ew(), WS_ERR_INPUT, WS_ERR_NO_CONNECTION, WS_ERR_NONE, WS_ERR_SOCKET, and wsDetachServer(). Referenced by wsAppendMenu().

void wsDetachServer | ( | WS_MENU | menu | ) |

| Definition at line 681 of file ws_clientII.c. References closesocket_ew(), and _WS_MENU_REC::sock. Referenced by wsAppendMenu(), wsAttachServer(), wsGetTraceAscii(), and wsGetTraceBin().

int wsGetServerPSCN | ( | char * | addr,
|  | char * | port,
|  | WS_PSCN * | pscnp,
|  | WS_MENU_QUEUE_REC * | menu_queue
| ) |

| Definition at line 497 of file ws_clientII.c. References _WS_MENU_REC::addr, WS_MENU_QUEUE_REC::head, logit(), _WS_MENU_REC::next, _WS_MENU_REC::port, _WS_MENU_REC::pscn, WS_ERR_EMPTY_MENU, WS_ERR_NONE, and WS_ERR_SERVER_NOT_IN_MENU.

int wsGetTraceAscii | ( | TRACE_REQ * | getThis,
|  | WS_MENU_QUEUE_REC * | menu_queue,
|  | int | timeout
| ) |

| Definition at line 387 of file ws_clientII.c. References _WS_MENU_REC::addr, TRACE_REQ::bufLen, _WS_PSCN_REC::chan, TRACE_REQ::fill, WS_MENU_QUEUE_REC::head, logit(), _WS_PSCN_REC::net, TRACE_REQ::pBuf, _WS_MENU_REC::port, TRACE_REQ::reqEndtime, TRACE_REQ::reqStarttime, send_ew(), _WS_MENU_REC::sock, _WS_PSCN_REC::sta, WS_CL_DEBUG, WS_ERR_BROKEN_CONNECTION, WS_ERR_BUFFER_OVERFLOW, WS_ERR_EMPTY_MENU, WS_ERR_NO_CONNECTION, WS_ERR_NONE, WS_ERR_TIMEOUT, wsDetachServer(), wsParseAsciiHeaderReply(), wsREQLEN, wsSearchSCN(), and wsWaitAscii().

int wsGetTraceBin | ( | TRACE_REQ * | getThis,
|  | WS_MENU_QUEUE_REC * | menu_queue,
|  | int | timeout
| ) |

| Definition at line 239 of file ws_clientII.c. References TRACE_REQ::actLen, _WS_MENU_REC::addr, TRACE_REQ::bufLen, _WS_PSCN_REC::chan, WS_MENU_QUEUE_REC::head, logit(), _WS_PSCN_REC::net, TRACE_REQ::pBuf, _WS_MENU_REC::port, recv_all(), TRACE_REQ::reqEndtime, TRACE_REQ::reqStarttime, send_ew(), _WS_MENU_REC::sock, _WS_PSCN_REC::sta, WS_ERR_BROKEN_CONNECTION, WS_ERR_BUFFER_OVERFLOW, WS_ERR_EMPTY_MENU, WS_ERR_INPUT, WS_ERR_NO_CONNECTION, WS_ERR_NONE, WS_ERR_PARSE, WS_ERR_TIMEOUT, WS_WRN_FLAGGED, wsDetachServer(), wsParseBinHeaderReply(), wsREQLEN, wsSearchSCN(), and wsWaitBinHeader().

void wsKillMenu | ( | WS_MENU_QUEUE_REC * | menu_queue | ) |

| Definition at line 207 of file ws_clientII.c. References closesocket_ew(), WS_MENU_QUEUE_REC::head, menu_reqid, _WS_MENU_REC::next, _WS_MENU_REC::pscn, _WS_MENU_REC::sock, WS_MENU_QUEUE_REC::tail, and wsKillPSCN().

void wsKillPSCN | ( | WS_PSCN | pscn | ) |

| Definition at line 478 of file ws_clientII.c. References _WS_PSCN_REC::next. Referenced by wsAppendMenu(), and wsKillMenu().

int wsParseAsciiHeaderReply | ( | TRACE_REQ * | ,
|  | char * |
| ) | `[static]`

| Definition at line 1173 of file ws_clientII.c. References TRACE_REQ::actEndtime, TRACE_REQ::actLen, TRACE_REQ::actStarttime, logit(), TRACE_REQ::pinno, TRACE_REQ::retFlag, TRACE_REQ::samprate, WS_ERR_INPUT, WS_ERR_NONE, WS_ERR_PARSE, WS_WRN_FLAGGED, and wsSkipN(). Referenced by wsGetTraceAscii().

int wsParseBinHeaderReply | ( | TRACE_REQ * | ,
|  | char * |
| ) | `[static]`

| Definition at line 1048 of file ws_clientII.c. References TRACE_REQ::actEndtime, TRACE_REQ::actLen, TRACE_REQ::actStarttime, logit(), TRACE_REQ::pinno, TRACE_REQ::retFlag, TRACE_REQ::samprate, WS_ERR_INPUT, WS_ERR_NONE, WS_ERR_PARSE, WS_WRN_FLAGGED, and wsSkipN(). Referenced by wsGetTraceBin().

int wsParseMenuReply | ( | WS_MENU | ,
|  | char * |
| ) | `[static]`

| Definition at line 977 of file ws_clientII.c. References _WS_PSCN_REC::chan, logit(), _WS_PSCN_REC::net, _WS_PSCN_REC::next, _WS_PSCN_REC::pinno, _WS_MENU_REC::pscn, _WS_PSCN_REC::sta, _WS_PSCN_REC::tankEndtime, _WS_PSCN_REC::tankStarttime, WS_ERR_INPUT, WS_ERR_MEMORY, WS_ERR_NONE, WS_ERR_PARSE, and wsSkipN(). Referenced by wsAppendMenu().

int wsSearchSCN | ( | TRACE_REQ * | getThis,
|  | WS_MENU * | menup,
|  | WS_PSCN * | pscnp,
|  | WS_MENU_QUEUE_REC * | menu_queue
| ) |

| Definition at line 546 of file ws_clientII.c. References TRACE_REQ::chan, _WS_PSCN_REC::chan, WS_MENU_QUEUE_REC::head, logit(), TRACE_REQ::net, _WS_PSCN_REC::net, _WS_MENU_REC::next, _WS_PSCN_REC::next, _WS_MENU_REC::pscn, TRACE_REQ::sta, _WS_PSCN_REC::sta, WS_ERR_EMPTY_MENU, WS_ERR_NONE, and WS_ERR_SCN_NOT_IN_MENU. Referenced by wsGetTraceAscii(), and wsGetTraceBin().

void wsSkipN | ( | char * | ,
|  | int | ,
|  | int * |
| ) | `[static]`

| Definition at line 1283 of file ws_clientII.c. Referenced by wsParseAsciiHeaderReply(), wsParseBinHeaderReply(), and wsParseMenuReply().

int wsWaitAscii | ( | WS_MENU | ,
|  | char * | ,
|  | int | ,
|  | int |
| ) | `[static]`

| Definition at line 841 of file ws_clientII.c. References adjustTimeoutLength(), GetTime_ew(), logit(), resetTimeout(), sleep_ew(), _WS_MENU_REC::sock, socketGetError_ew(), WS_ERR_BROKEN_CONNECTION, WS_ERR_BUFFER_OVERFLOW, WS_ERR_INPUT, WS_ERR_NONE, WS_ERR_SOCKET, WS_ERR_TIMEOUT, and WS_MAX_RECV_BUF_LEN. Referenced by wsAppendMenu(), and wsGetTraceAscii().

int wsWaitBinHeader | ( | WS_MENU | ,
|  | char * | ,
|  | int | ,
|  | int |
| ) | `[static]`

| Definition at line 703 of file ws_clientII.c. References adjustTimeoutLength(), GetTime_ew(), logit(), resetTimeout(), sleep_ew(), _WS_MENU_REC::sock, socketGetError_ew(), WS_ERR_BROKEN_CONNECTION, WS_ERR_BUFFER_OVERFLOW, WS_ERR_INPUT, WS_ERR_NONE, WS_ERR_SOCKET, and WS_ERR_TIMEOUT. Referenced by wsGetTraceBin().

## Variable Documentation

int menu_reqid = 0`[static]`

| Definition at line 60 of file ws_clientII.c. Referenced by wsKillMenu().

int WS_CL_DEBUG = 0

| Definition at line 61 of file ws_clientII.c. Referenced by setWsClient_ewDebug(), and wsGetTraceAscii().