本文整理汇总了C++中sk_void_num函数的典型用法代码示例。如果您正苦于以下问题:C++ sk_void_num函数的具体用法?C++ sk_void_num怎么用?C++ sk_void_num使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sk_void_num函数的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: dlfcn_bind_func
static DSO_FUNC_TYPE dlfcn_bind_func(DSO *dso, const char *symname)
{
void *ptr;
union {
DSO_FUNC_TYPE sym;
void *dlret;
} u;
if((dso == NULL) || (symname == NULL))
{
DSOerr(DSO_F_DLFCN_BIND_FUNC,ERR_R_PASSED_NULL_PARAMETER);
return(NULL);
}
if(sk_void_num(dso->meth_data) < 1)
{
DSOerr(DSO_F_DLFCN_BIND_FUNC,DSO_R_STACK_ERROR);
return(NULL);
}
ptr = sk_void_value(dso->meth_data, sk_void_num(dso->meth_data) - 1);
if(ptr == NULL)
{
DSOerr(DSO_F_DLFCN_BIND_FUNC,DSO_R_NULL_HANDLE);
return(NULL);
}
u.dlret = dlsym(ptr, symname);
if(u.dlret == NULL)
{
DSOerr(DSO_F_DLFCN_BIND_FUNC,DSO_R_SYM_FAILURE);
ERR_add_error_data(4, "symname(", symname, "): ", dlerror());
return(NULL);
}
return u.sym;
}
开发者ID:sofuture,项目名称:bitrig,代码行数:33,代码来源:dso_dlfcn.c
示例2: win32_bind_func
static DSO_FUNC_TYPE win32_bind_func(DSO *dso, const char *symname)
{
HINSTANCE *ptr;
void *sym;
if ((dso == NULL) || (symname == NULL)) {
DSOerr(DSO_F_WIN32_BIND_FUNC, ERR_R_PASSED_NULL_PARAMETER);
return (NULL);
}
if (sk_void_num(dso->meth_data) < 1) {
DSOerr(DSO_F_WIN32_BIND_FUNC, DSO_R_STACK_ERROR);
return (NULL);
}
ptr = sk_void_value(dso->meth_data, sk_void_num(dso->meth_data) - 1);
if (ptr == NULL) {
DSOerr(DSO_F_WIN32_BIND_FUNC, DSO_R_NULL_HANDLE);
return (NULL);
}
sym = GetProcAddress(*ptr, symname);
if (sym == NULL) {
DSOerr(DSO_F_WIN32_BIND_FUNC, DSO_R_SYM_FAILURE);
ERR_add_error_data(3, "symname(", symname, ")");
return (NULL);
}
return ((DSO_FUNC_TYPE)sym);
}
开发者ID:crypto-org-ua,项目名称:openssl-ua,代码行数:26,代码来源:dso_win32.c
示例3: DSOerr
static void *dlfcn_bind_var(DSO *dso, const char *symname)
{
void *ptr, *sym;
if((dso == NULL) || (symname == NULL))
{
DSOerr(DSO_F_DLFCN_BIND_VAR,ERR_R_PASSED_NULL_PARAMETER);
return(NULL);
}
if(sk_void_num(dso->meth_data) < 1)
{
DSOerr(DSO_F_DLFCN_BIND_VAR,DSO_R_STACK_ERROR);
return(NULL);
}
ptr = sk_void_value(dso->meth_data, sk_void_num(dso->meth_data) - 1);
if(ptr == NULL)
{
DSOerr(DSO_F_DLFCN_BIND_VAR,DSO_R_NULL_HANDLE);
return(NULL);
}
sym = dlsym(ptr, symname);
if(sym == NULL)
{
DSOerr(DSO_F_DLFCN_BIND_VAR,DSO_R_SYM_FAILURE);
ERR_add_error_data(4, "symname(", symname, "): ", dlerror());
return(NULL);
}
return(sym);
}
开发者ID:sofuture,项目名称:bitrig,代码行数:29,代码来源:dso_dlfcn.c
示例4: DSOerr
/*
* Using GetProcAddress for variables? TODO: Check this out in the Win32 API
* docs, there's probably a variant for variables.
*/
static void *win32_bind_var(DSO *dso, const char *symname)
{
HINSTANCE *ptr;
union {
void *p;
FARPROC f;
} sym;
if ((dso == NULL) || (symname == NULL)) {
DSOerr(DSO_F_WIN32_BIND_VAR, ERR_R_PASSED_NULL_PARAMETER);
return (NULL);
}
if (sk_void_num(dso->meth_data) < 1) {
DSOerr(DSO_F_WIN32_BIND_VAR, DSO_R_STACK_ERROR);
return (NULL);
}
ptr = sk_void_value(dso->meth_data, sk_void_num(dso->meth_data) - 1);
if (ptr == NULL) {
DSOerr(DSO_F_WIN32_BIND_VAR, DSO_R_NULL_HANDLE);
return (NULL);
}
sym.f = GetProcAddress(*ptr, symname);
if (sym.p == NULL) {
DSOerr(DSO_F_WIN32_BIND_VAR, DSO_R_SYM_FAILURE);
ERR_add_error_data(3, "symname(", symname, ")");
return (NULL);
}
return (sym.p);
}
开发者ID:ntvis,项目名称:openssl,代码行数:33,代码来源:dso_win32.c
示例5: win32_unload
static int win32_unload(DSO *dso)
{
HINSTANCE *p;
if (dso == NULL) {
DSOerr(DSO_F_WIN32_UNLOAD, ERR_R_PASSED_NULL_PARAMETER);
return (0);
}
if (sk_void_num(dso->meth_data) < 1)
return (1);
p = sk_void_pop(dso->meth_data);
if (p == NULL) {
DSOerr(DSO_F_WIN32_UNLOAD, DSO_R_NULL_HANDLE);
return (0);
}
if (!FreeLibrary(*p)) {
DSOerr(DSO_F_WIN32_UNLOAD, DSO_R_UNLOAD_FAILED);
/*
* We should push the value back onto the stack in case of a retry.
*/
sk_void_push(dso->meth_data, p);
return (0);
}
/* Cleanup */
OPENSSL_free(p);
return (1);
}
开发者ID:crypto-org-ua,项目名称:openssl-ua,代码行数:26,代码来源:dso_win32.c
示例6: dlfcn_unload
static int dlfcn_unload(DSO *dso)
{
return 0;
#if 0
void *ptr;
if (dso == NULL) {
DSOerr(DSO_F_DLFCN_UNLOAD, ERR_R_PASSED_NULL_PARAMETER);
return (0);
}
if (sk_void_num(dso->meth_data) < 1)
return (1);
ptr = sk_void_pop(dso->meth_data);
if (ptr == NULL) {
DSOerr(DSO_F_DLFCN_UNLOAD, DSO_R_NULL_HANDLE);
/*
* Should push the value back onto the stack in case of a retry.
*/
sk_void_push(dso->meth_data, ptr);
return (0);
}
/* For now I'm not aware of any errors associated with dlclose() */
dlclose(ptr);
return (1);
#endif
}
开发者ID:johnjohnsp1,项目名称:opensgx,代码行数:25,代码来源:dso_dlfcn.c
示例7: vms_unload
/*
* Note that this doesn't actually unload the shared image, as there is no
* such thing in VMS. Next time it get loaded again, a new copy will
* actually be loaded.
*/
static int vms_unload(DSO *dso)
{
DSO_VMS_INTERNAL *p;
if (dso == NULL) {
DSOerr(DSO_F_VMS_UNLOAD, ERR_R_PASSED_NULL_PARAMETER);
return (0);
}
if (sk_void_num(dso->meth_data) < 1)
return (1);
p = (DSO_VMS_INTERNAL *)sk_void_pop(dso->meth_data);
if (p == NULL) {
DSOerr(DSO_F_VMS_UNLOAD, DSO_R_NULL_HANDLE);
return (0);
}
/* Cleanup */
OPENSSL_free(p);
return (1);
}
开发者ID:Adallom,项目名称:openssl,代码行数:23,代码来源:dso_vms.c
示例8: CRYPTO_set_ex_data
/*
* For a given CRYPTO_EX_DATA variable, set the value corresponding to a
* particular index in the class used by this variable
*/
int CRYPTO_set_ex_data(CRYPTO_EX_DATA *ad, int idx, void *val)
{
int i;
if (ad->sk == NULL) {
if ((ad->sk = sk_void_new_null()) == NULL) {
CRYPTOerr(CRYPTO_F_CRYPTO_SET_EX_DATA, ERR_R_MALLOC_FAILURE);
return 0;
}
}
for (i = sk_void_num(ad->sk); i <= idx; ++i) {
if (!sk_void_push(ad->sk, NULL)) {
CRYPTOerr(CRYPTO_F_CRYPTO_SET_EX_DATA, ERR_R_MALLOC_FAILURE);
return 0;
}
}
sk_void_set(ad->sk, idx, val);
return 1;
}
开发者ID:akamai,项目名称:openssl,代码行数:24,代码来源:ex_data.c
示例9: CRYPTO_set_ex_data
int CRYPTO_set_ex_data(CRYPTO_EX_DATA *ad, int index, void *val) {
int n, i;
if (ad->sk == NULL) {
ad->sk = sk_void_new_null();
if (ad->sk == NULL) {
OPENSSL_PUT_ERROR(CRYPTO, CRYPTO_set_ex_data, ERR_R_MALLOC_FAILURE);
return 0;
}
}
n = sk_void_num(ad->sk);
/* Add NULL values until the stack is long enough. */
for (i = n; i <= index; i++) {
if (!sk_void_push(ad->sk, NULL)) {
OPENSSL_PUT_ERROR(CRYPTO, CRYPTO_set_ex_data, ERR_R_MALLOC_FAILURE);
return 0;
}
}
sk_void_set(ad->sk, index, val);
return 1;
}
开发者ID:HungMingWu,项目名称:libquic,代码行数:24,代码来源:ex_data.c
示例10: sk_void_value
void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad, int idx) {
if (ad->sk == NULL || idx < 0 || (size_t)idx >= sk_void_num(ad->sk)) {
return NULL;
}
return sk_void_value(ad->sk, idx);
}
开发者ID:HungMingWu,项目名称:libquic,代码行数:6,代码来源:ex_data.c
示例11: vms_bind_sym
void vms_bind_sym(DSO *dso, const char *symname, void **sym)
{
DSO_VMS_INTERNAL *ptr;
int status;
# if 0
int flags = (1 << 4); /* LIB$M_FIS_MIXEDCASE, but this symbol isn't
* defined in VMS older than 7.0 or so */
# else
int flags = 0;
# endif
struct dsc$descriptor_s symname_dsc;
/* Arrange 32-bit pointer to (copied) string storage, if needed. */
# if __INITIAL_POINTER_SIZE == 64
# define SYMNAME symname_32p
# pragma pointer_size save
# pragma pointer_size 32
char *symname_32p;
# pragma pointer_size restore
char symname_32[NAMX_MAXRSS + 1];
# else /* __INITIAL_POINTER_SIZE == 64 */
# define SYMNAME ((char *) symname)
# endif /* __INITIAL_POINTER_SIZE == 64 [else] */
*sym = NULL;
if ((dso == NULL) || (symname == NULL)) {
DSOerr(DSO_F_VMS_BIND_SYM, ERR_R_PASSED_NULL_PARAMETER);
return;
}
# if __INITIAL_POINTER_SIZE == 64
/* Copy the symbol name to storage with a 32-bit pointer. */
symname_32p = symname_32;
strcpy(symname_32p, symname);
# endif /* __INITIAL_POINTER_SIZE == 64 [else] */
symname_dsc.dsc$w_length = strlen(SYMNAME);
symname_dsc.dsc$b_dtype = DSC$K_DTYPE_T;
symname_dsc.dsc$b_class = DSC$K_CLASS_S;
symname_dsc.dsc$a_pointer = SYMNAME;
if (sk_void_num(dso->meth_data) < 1) {
DSOerr(DSO_F_VMS_BIND_SYM, DSO_R_STACK_ERROR);
return;
}
ptr = (DSO_VMS_INTERNAL *)sk_void_value(dso->meth_data,
sk_void_num(dso->meth_data) - 1);
if (ptr == NULL) {
DSOerr(DSO_F_VMS_BIND_SYM, DSO_R_NULL_HANDLE);
return;
}
if (dso->flags & DSO_FLAG_UPCASE_SYMBOL)
flags = 0;
status = do_find_symbol(ptr, &symname_dsc, sym, flags);
if (!$VMS_STATUS_SUCCESS(status)) {
unsigned short length;
char errstring[257];
struct dsc$descriptor_s errstring_dsc;
errstring_dsc.dsc$w_length = sizeof(errstring);
errstring_dsc.dsc$b_dtype = DSC$K_DTYPE_T;
errstring_dsc.dsc$b_class = DSC$K_CLASS_S;
errstring_dsc.dsc$a_pointer = errstring;
*sym = NULL;
status = sys$getmsg(status, &length, &errstring_dsc, 1, 0);
if (!$VMS_STATUS_SUCCESS(status))
lib$signal(status); /* This is really bad. Abort! */
else {
errstring[length] = '\0';
DSOerr(DSO_F_VMS_BIND_SYM, DSO_R_SYM_FAILURE);
if (ptr->imagename_dsc.dsc$w_length)
ERR_add_error_data(9,
"Symbol ", symname,
" in ", ptr->filename,
" (", ptr->imagename, ")",
": ", errstring);
else
ERR_add_error_data(6,
"Symbol ", symname,
" in ", ptr->filename, ": ", errstring);
}
return;
}
return;
}
开发者ID:Adallom,项目名称:openssl,代码行数:92,代码来源:dso_vms.c
示例12: CRYPTO_dup_ex_data
/*
* Duplicate a CRYPTO_EX_DATA variable - including calling dup() callbacks
* for each index in the class used by this variable
*/
int CRYPTO_dup_ex_data(int class_index, CRYPTO_EX_DATA *to,
const CRYPTO_EX_DATA *from)
{
int mx, j, i;
void *ptr;
EX_CALLBACK *stack[10];
EX_CALLBACK **storage = NULL;
EX_CALLBACKS *ip;
int toret = 0;
OSSL_EX_DATA_GLOBAL *global = openssl_ctx_get_ex_data_global(from->ctx);
if (global == NULL)
return 0;
to->ctx = from->ctx;
if (from->sk == NULL)
/* Nothing to copy over */
return 1;
if ((ip = get_and_lock(from->ctx, class_index)) == NULL)
return 0;
mx = sk_EX_CALLBACK_num(ip->meth);
j = sk_void_num(from->sk);
if (j < mx)
mx = j;
if (mx > 0) {
if (mx < (int)OSSL_NELEM(stack))
storage = stack;
else
storage = OPENSSL_malloc(sizeof(*storage) * mx);
if (storage != NULL)
for (i = 0; i < mx; i++)
storage[i] = sk_EX_CALLBACK_value(ip->meth, i);
}
CRYPTO_THREAD_unlock(global->ex_data_lock);
if (mx == 0)
return 1;
if (storage == NULL) {
CRYPTOerr(CRYPTO_F_CRYPTO_DUP_EX_DATA, ERR_R_MALLOC_FAILURE);
return 0;
}
/*
* Make sure the ex_data stack is at least |mx| elements long to avoid
* issues in the for loop that follows; so go get the |mx|'th element
* (if it does not exist CRYPTO_get_ex_data() returns NULL), and assign
* to itself. This is normally a no-op; but ensures the stack is the
* proper size
*/
if (!CRYPTO_set_ex_data(to, mx - 1, CRYPTO_get_ex_data(to, mx - 1)))
goto err;
for (i = 0; i < mx; i++) {
ptr = CRYPTO_get_ex_data(from, i);
if (storage[i] != NULL && storage[i]->dup_func != NULL)
if (!storage[i]->dup_func(to, from, &ptr, i,
storage[i]->argl, storage[i]->argp))
goto err;
CRYPTO_set_ex_data(to, i, ptr);
}
toret = 1;
err:
if (storage != stack)
OPENSSL_free(storage);
return toret;
}
开发者ID:akamai,项目名称:openssl,代码行数:70,代码来源:ex_data.c
注:本文中的sk_void_num函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论