Macros | Functions | Variables
yhash.c File Reference
#include "yhash.h"
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include "yproto.h"
Include dependency graph for yhash.c:

Go to the source code of this file.

Macros

#define __eds__
 
#define __FILE_ID__   "yhash"
 
#define BLK(hdl)   (yHashTable[(hdl)>>1].blk[(hdl)&1])
 
#define HLOGF(x)
 
#define WP(hdl)   (BLK(hdl).wpEntry)
 
#define YA(hdl)   (BLK(hdl).ypArray)
 
#define YC(hdl)   (BLK(hdl).ypCateg)
 
#define YP(hdl)   (BLK(hdl).ypEntry)
 

Functions

int decodeNetFuncValV2 (const u8 *p, Notification_funydx *funInfo, char *funcVal)
 
static u16 fletcher16 (const u8 *data, u16 len, u16 virtlen)
 
static yBlkHdl functionSearch (YAPI_FUNCTION fundesc)
 
void wpAllowUnregisterEx (void)
 
u16 wpEntryCount (void)
 
static void wpExecuteUnregisterUnsec (void)
 
int wpGetAllDevUsingHubUrl (yUrlRef hubUrl, yStrRef *buffer, int sizeInStrRef)
 
yStrRef wpGetAttribute (yBlkHdl hdl, yWPAttribute attridx)
 
int wpGetDeviceInfo (YAPI_DEVICE devdesc, u16 *deviceid, char *productname, char *serial, char *logicalname, u8 *beacon)
 
int wpGetDeviceUrl (YAPI_DEVICE devdesc, char *roothubserial, char *request, int requestsize, int *neededsize)
 
yUrlRef wpGetDeviceUrlRef (YAPI_DEVICE devdesc)
 
int wpGetDevYdx (yStrRef serial)
 
void wpGetLogicalName (yBlkHdl hdl, char *logicalName)
 
void wpGetSerial (yBlkHdl hdl, char *serial)
 
int wpMarkForUnregister (yStrRef serial)
 
void wpPreventUnregisterEx (void)
 
int wpRegister (int devYdx, yStrRef serial, yStrRef logicalName, yStrRef productName, u16 productId, yUrlRef devUrl, s8 beacon)
 
YAPI_DEVICE wpSearch (const char *device_str)
 
YAPI_DEVICE wpSearchByNameHash (yStrRef strref)
 
YAPI_DEVICE wpSearchByUrl (const char *host, const char *rootUrl)
 
YAPI_DEVICE wpSearchEx (yStrRef strref)
 
static yBlkHdl yBlkAlloc (void)
 
static void yBlkFree (yBlkHdl hdl)
 
u16 yBlkListLength (yBlkHdl hdl)
 
yBlkHdl yBlkListSeek (yBlkHdl hdl, u16 pos)
 
static int yComputeRelPath (yAbsUrl *absurl, const char *rootUrl, u8 testonly)
 
void yHashFree (void)
 
void yHashGetBuf (yHash yhash, u8 *destbuf, u16 bufsize)
 
void yHashGetStr (yHash yhash, char *destbuf, u16 bufsize)
 
u16 yHashGetStrLen (yHash yhash)
 
char * yHashGetStrPtr (yHash yhash)
 
yAsbUrlType yHashGetUrlPort (yUrlRef urlref, char *url, u16 *port, yAsbUrlProto *proto, yStrRef *user, yStrRef *password)
 
void yHashInit (void)
 
static yHash yHashPut (const u8 *buf, u16 len, u8 testonly)
 
yHash yHashPutBuf (const u8 *buf, u16 len)
 
yHash yHashPutStr (const char *str)
 
int yHashSameHub (yUrlRef url_a, yUrlRef url_b)
 
yHash yHashTestBuf (const u8 *buf, u16 len)
 
yHash yHashTestStr (const char *str)
 
yUrlRef yHashUrl (const char *url, const char *rootUrl, u8 testonly, char *errmsg)
 
yUrlRef yHashUrlAPI (void)
 
yUrlRef yHashUrlFromRef (yUrlRef urlref, const char *rootUrl)
 
yUrlRef yHashUrlUSB (yHash serial)
 
s16 ypFindBootloaders (yStrRef *serials, u16 maxSerials)
 
int ypGetAttributes (yBlkHdl hdl, yStrRef *serial, yStrRef *funcId, yStrRef *funcName, Notification_funydx *funcInfo, char *funcVal)
 
int ypGetAttributesByYdx (u8 devYdx, u8 funYdx, yStrRef *serial, yStrRef *logicalName, yStrRef *funcId, yStrRef *funcName, Notification_funydx *funcInfo, char *funcVal)
 
void ypGetCategory (yBlkHdl hdl, char *name, yBlkHdl *entries)
 
int ypGetFunctionInfo (YAPI_FUNCTION fundesc, char *serial, char *funcId, char *baseType, char *funcName, char *funcVal)
 
int ypGetFunctions (const char *class_str, YAPI_DEVICE devdesc, YAPI_FUNCTION prevfundesc, YAPI_FUNCTION *buffer, int maxsize, int *neededsize)
 
int ypGetFunctionsEx (yStrRef categref, YAPI_DEVICE devdesc, YAPI_FUNCTION prevfundesc, YAPI_FUNCTION *buffer, int maxsize, int *neededsize)
 
int ypGetType (yBlkHdl hdl)
 
int ypRegister (yStrRef categ, yStrRef serial, yStrRef funcId, yStrRef funcName, int funClass, int funYdx, const char *funcVal)
 
int ypRegisterByYdx (u8 devYdx, Notification_funydx funInfo, const char *funcVal, YAPI_FUNCTION *fundesc)
 
YAPI_FUNCTION ypSearch (const char *class_str, const char *func_or_name)
 
static void ypUnregister (yStrRef serial)
 

Variables

static yBlkHdl devYdxPtr [NB_MAX_DEVICES]
 
yBlkHdl freeBlks = INVALID_BLK_HDL
 
static yBlkHdl funYdxPtr [NB_MAX_DEVICES]
 
static u8 nextCatYdx = 1
 
static u16 nextDevYdx = 0
 
static u16 nextHashEntry = 256
 
char SerialNumberStr [YOCTO_SERIAL_LEN] = ""
 
yStrRef SerialRef = INVALID_HASH_IDX
 
static u16 usedDevYdx [NB_MAX_DEVICES/16]
 
static int wpLockCount = 0
 
static int wpSomethingUnregistered = 0
 
yCRITICAL_SECTION yFreeMutex
 
yCRITICAL_SECTION yHashMutex
 
static YHashSlot yHashTable [NB_MAX_HASH_ENTRIES]
 
yBlkHdl yWpListHead = INVALID_BLK_HDL
 
yCRITICAL_SECTION yWpMutex
 
yBlkHdl yYpListHead = INVALID_BLK_HDL
 
yCRITICAL_SECTION yYpMutex
 

Macro Definition Documentation

#define __eds__

Definition at line 54 of file yhash.c.

#define __FILE_ID__   "yhash"

Definition at line 40 of file yhash.c.

#define BLK (   hdl)    (yHashTable[(hdl)>>1].blk[(hdl)&1])

Definition at line 91 of file yhash.c.

#define HLOGF (   x)

Definition at line 66 of file yhash.c.

#define WP (   hdl)    (BLK(hdl).wpEntry)

Definition at line 92 of file yhash.c.

#define YA (   hdl)    (BLK(hdl).ypArray)

Definition at line 95 of file yhash.c.

#define YC (   hdl)    (BLK(hdl).ypCateg)

Definition at line 93 of file yhash.c.

#define YP (   hdl)    (BLK(hdl).ypEntry)

Definition at line 94 of file yhash.c.

Function Documentation

int decodeNetFuncValV2 ( const u8 *  p,
Notification_funydx funInfo,
char *  funcVal 
)

Definition at line 2056 of file yhash.c.

static u16 fletcher16 ( const u8 *  data,
u16  len,
u16  virtlen 
)
static

Definition at line 160 of file yhash.c.

static yBlkHdl functionSearch ( YAPI_FUNCTION  fundesc)
static

Definition at line 1832 of file yhash.c.

void wpAllowUnregisterEx ( void  )

Definition at line 741 of file yhash.c.

u16 wpEntryCount ( void  )

Definition at line 963 of file yhash.c.

static void wpExecuteUnregisterUnsec ( void  )
static

Definition at line 668 of file yhash.c.

int wpGetAllDevUsingHubUrl ( yUrlRef  hubUrl,
yStrRef buffer,
int  sizeInStrRef 
)

Definition at line 1072 of file yhash.c.

yStrRef wpGetAttribute ( yBlkHdl  hdl,
yWPAttribute  attridx 
)

Definition at line 880 of file yhash.c.

int wpGetDeviceInfo ( YAPI_DEVICE  devdesc,
u16 *  deviceid,
char *  productname,
char *  serial,
char *  logicalname,
u8 *  beacon 
)

Definition at line 1220 of file yhash.c.

int wpGetDeviceUrl ( YAPI_DEVICE  devdesc,
char *  roothubserial,
char *  request,
int  requestsize,
int *  neededsize 
)

Definition at line 1124 of file yhash.c.

yUrlRef wpGetDeviceUrlRef ( YAPI_DEVICE  devdesc)

Definition at line 1102 of file yhash.c.

int wpGetDevYdx ( yStrRef  serial)

Definition at line 968 of file yhash.c.

void wpGetLogicalName ( yBlkHdl  hdl,
char *  logicalName 
)

Definition at line 910 of file yhash.c.

void wpGetSerial ( yBlkHdl  hdl,
char *  serial 
)

Definition at line 901 of file yhash.c.

int wpMarkForUnregister ( yStrRef  serial)

Definition at line 919 of file yhash.c.

void wpPreventUnregisterEx ( void  )

Definition at line 733 of file yhash.c.

int wpRegister ( int  devYdx,
yStrRef  serial,
yStrRef  logicalName,
yStrRef  productName,
u16  productId,
yUrlRef  devUrl,
s8  beacon 
)

Definition at line 783 of file yhash.c.

YAPI_DEVICE wpSearch ( const char *  device_str)

Definition at line 1014 of file yhash.c.

YAPI_DEVICE wpSearchByNameHash ( yStrRef  strref)

Definition at line 1023 of file yhash.c.

YAPI_DEVICE wpSearchByUrl ( const char *  host,
const char *  rootUrl 
)

Definition at line 1048 of file yhash.c.

YAPI_DEVICE wpSearchEx ( yStrRef  strref)

Definition at line 988 of file yhash.c.

static yBlkHdl yBlkAlloc ( void  )
static

Definition at line 99 of file yhash.c.

static void yBlkFree ( yBlkHdl  hdl)
static

Definition at line 125 of file yhash.c.

u16 yBlkListLength ( yBlkHdl  hdl)

Definition at line 136 of file yhash.c.

yBlkHdl yBlkListSeek ( yBlkHdl  hdl,
u16  pos 
)

Definition at line 147 of file yhash.c.

static int yComputeRelPath ( yAbsUrl absurl,
const char *  rootUrl,
u8  testonly 
)
static

parse the rootUrl string and update the path field of the yAbsUrl structure passed in argument

Definition at line 430 of file yhash.c.

void yHashFree ( void  )

Definition at line 240 of file yhash.c.

void yHashGetBuf ( yHash  yhash,
u8 *  destbuf,
u16  bufsize 
)

Definition at line 342 of file yhash.c.

void yHashGetStr ( yHash  yhash,
char *  destbuf,
u16  bufsize 
)

Definition at line 365 of file yhash.c.

u16 yHashGetStrLen ( yHash  yhash)

Definition at line 377 of file yhash.c.

char* yHashGetStrPtr ( yHash  yhash)

Definition at line 401 of file yhash.c.

yAsbUrlType yHashGetUrlPort ( yUrlRef  urlref,
char *  url,
u16 *  port,
yAsbUrlProto proto,
yStrRef user,
yStrRef password 
)

Definition at line 579 of file yhash.c.

void yHashInit ( void  )

Definition at line 189 of file yhash.c.

static yHash yHashPut ( const u8 *  buf,
u16  len,
u8  testonly 
)
static

Definition at line 250 of file yhash.c.

yHash yHashPutBuf ( const u8 *  buf,
u16  len 
)

Definition at line 312 of file yhash.c.

yHash yHashPutStr ( const char *  str)

Definition at line 318 of file yhash.c.

int yHashSameHub ( yUrlRef  url_a,
yUrlRef  url_b 
)

Definition at line 619 of file yhash.c.

yHash yHashTestBuf ( const u8 *  buf,
u16  len 
)

Definition at line 327 of file yhash.c.

yHash yHashTestStr ( const char *  str)

Definition at line 333 of file yhash.c.

yUrlRef yHashUrl ( const char *  url,
const char *  rootUrl,
u8  testonly,
char *  errmsg 
)

if testonly is non zero it do not add the hash if the hash has not been already recorded in this case we return INVALID_HASH_IDX

Definition at line 474 of file yhash.c.

yUrlRef yHashUrlAPI ( void  )

Definition at line 650 of file yhash.c.

yUrlRef yHashUrlFromRef ( yUrlRef  urlref,
const char *  rootUrl 
)

create and register a new url with the host form urlref and the path from rootUrl. return: the yUrlRef for the new created url

Definition at line 454 of file yhash.c.

yUrlRef yHashUrlUSB ( yHash  serial)

Definition at line 637 of file yhash.c.

s16 ypFindBootloaders ( yStrRef serials,
u16  maxSerials 
)

Definition at line 1964 of file yhash.c.

int ypGetAttributes ( yBlkHdl  hdl,
yStrRef serial,
yStrRef funcId,
yStrRef funcName,
Notification_funydx funcInfo,
char *  funcVal 
)

Definition at line 1515 of file yhash.c.

int ypGetAttributesByYdx ( u8  devYdx,
u8  funYdx,
yStrRef serial,
yStrRef logicalName,
yStrRef funcId,
yStrRef funcName,
Notification_funydx funcInfo,
char *  funcVal 
)

Definition at line 1450 of file yhash.c.

void ypGetCategory ( yBlkHdl  hdl,
char *  name,
yBlkHdl entries 
)

Definition at line 1508 of file yhash.c.

int ypGetFunctionInfo ( YAPI_FUNCTION  fundesc,
char *  serial,
char *  funcId,
char *  baseType,
char *  funcName,
char *  funcVal 
)

Definition at line 1866 of file yhash.c.

int ypGetFunctions ( const char *  class_str,
YAPI_DEVICE  devdesc,
YAPI_FUNCTION  prevfundesc,
YAPI_FUNCTION buffer,
int  maxsize,
int *  neededsize 
)

Definition at line 1763 of file yhash.c.

int ypGetFunctionsEx ( yStrRef  categref,
YAPI_DEVICE  devdesc,
YAPI_FUNCTION  prevfundesc,
YAPI_FUNCTION buffer,
int  maxsize,
int *  neededsize 
)

Definition at line 1906 of file yhash.c.

int ypGetType ( yBlkHdl  hdl)

Definition at line 1551 of file yhash.c.

int ypRegister ( yStrRef  categ,
yStrRef  serial,
yStrRef  funcId,
yStrRef  funcName,
int  funClass,
int  funYdx,
const char *  funcVal 
)

Definition at line 1253 of file yhash.c.

int ypRegisterByYdx ( u8  devYdx,
Notification_funydx  funInfo,
const char *  funcVal,
YAPI_FUNCTION fundesc 
)

Definition at line 1395 of file yhash.c.

YAPI_FUNCTION ypSearch ( const char *  class_str,
const char *  func_or_name 
)

Definition at line 1603 of file yhash.c.

static void ypUnregister ( yStrRef  serial)
static

Definition at line 1564 of file yhash.c.

Variable Documentation

yBlkHdl devYdxPtr[NB_MAX_DEVICES]
static

Definition at line 76 of file yhash.c.

Definition at line 97 of file yhash.c.

yBlkHdl funYdxPtr[NB_MAX_DEVICES]
static

Definition at line 77 of file yhash.c.

u8 nextCatYdx = 1
static

Definition at line 73 of file yhash.c.

u16 nextDevYdx = 0
static

Definition at line 71 of file yhash.c.

u16 nextHashEntry = 256
static

Definition at line 74 of file yhash.c.

char SerialNumberStr[YOCTO_SERIAL_LEN] = ""

Definition at line 80 of file yhash.c.

Definition at line 82 of file yhash.c.

u16 usedDevYdx[NB_MAX_DEVICES/16]
static

Definition at line 70 of file yhash.c.

int wpLockCount = 0
static

Definition at line 665 of file yhash.c.

int wpSomethingUnregistered = 0
static

Definition at line 666 of file yhash.c.

yCRITICAL_SECTION yFreeMutex

Definition at line 57 of file yhash.c.

yCRITICAL_SECTION yHashMutex

Definition at line 56 of file yhash.c.

YHashSlot yHashTable[NB_MAX_HASH_ENTRIES]
static

Definition at line 55 of file yhash.c.

yBlkHdl yWpListHead = INVALID_BLK_HDL

Definition at line 84 of file yhash.c.

Definition at line 58 of file yhash.c.

yBlkHdl yYpListHead = INVALID_BLK_HDL

Definition at line 85 of file yhash.c.

Definition at line 59 of file yhash.c.



yoctopuce_altimeter
Author(s): Anja Sheppard
autogenerated on Mon Jun 10 2019 15:49:13