本文整理汇总了C++中smpd_enter_fn函数的典型用法代码示例。如果您正苦于以下问题:C++ smpd_enter_fn函数的具体用法?C++ smpd_enter_fn怎么用?C++ smpd_enter_fn使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了smpd_enter_fn函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: smpd_set_user_data
int smpd_set_user_data(const char *key, const char *value)
{
#ifdef HAVE_WINDOWS_H
HKEY tkey;
DWORD len, result;
char err_msg[512];
smpd_enter_fn(FCNAME);
if (key == NULL || value == NULL)
{
smpd_exit_fn(FCNAME);
return SMPD_FAIL;
}
result = RegCreateKeyEx(HKEY_CURRENT_USER, SMPD_REGISTRY_KEY,
0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &tkey, NULL);
if (result != ERROR_SUCCESS)
{
smpd_translate_win_error(result, err_msg, 512, "Unable to open the HKEY_CURRENT_USER\\" SMPD_REGISTRY_KEY " registry key, error %d: ", result);
smpd_err_printf("%s\n", err_msg);
smpd_exit_fn(FCNAME);
return SMPD_FAIL;
}
len = (DWORD)(strlen(value)+1);
result = RegSetValueEx(tkey, key, 0, REG_SZ, (const BYTE *)value, len);
if (result != ERROR_SUCCESS)
{
smpd_translate_win_error(result, err_msg, 512, "Unable to write the user smpd registry value '%s:%s', error %d\n", key, value, result);
smpd_err_printf("%s\n", err_msg);
RegCloseKey(tkey);
smpd_exit_fn(FCNAME);
return SMPD_FAIL;
}
result = RegCloseKey(tkey);
if (result != ERROR_SUCCESS)
{
smpd_translate_win_error(result, err_msg, 512, "Unable to close the HKEY_CURRENT_USER\\" SMPD_REGISTRY_KEY " registry key, error %d: ", result);
smpd_err_printf("%s\n", err_msg);
smpd_exit_fn(FCNAME);
return SMPD_FAIL;
}
smpd_exit_fn(FCNAME);
return SMPD_SUCCESS;
#else
int result;
smpd_enter_fn(FCNAME);
result = smpd_set_smpd_data(key, value);
smpd_exit_fn(FCNAME);
return result;
#endif
}
开发者ID:OngOngoing,项目名称:219351_homework,代码行数:55,代码来源:smpd_user_data.c
示例2: smpd_get_user_data
int smpd_get_user_data(const char *key, char *value, int value_len)
{
#ifdef HAVE_WINDOWS_H
HKEY tkey;
DWORD len, result;
char err_msg[512];
smpd_enter_fn(FCNAME);
result = RegOpenKeyEx(HKEY_CURRENT_USER, SMPD_REGISTRY_KEY, 0, KEY_READ, &tkey);
if (result != ERROR_SUCCESS)
{
smpd_translate_win_error(result, err_msg, 512, "Unable to open the HKEY_CURRENT_USER\\" SMPD_REGISTRY_KEY " registry key, error %d\n", result);
smpd_dbg_printf("%s\n", err_msg);
result = smpd_get_user_data_default(key, value, value_len);
smpd_exit_fn(FCNAME);
return result;
}
len = value_len;
result = RegQueryValueEx(tkey, key, 0, NULL, (unsigned char *)value, &len);
if (result != ERROR_SUCCESS)
{
smpd_translate_win_error(result, err_msg, 512, "Unable to read the smpd registry key '%s', error %d\n", key, result);
smpd_dbg_printf("%s\n", err_msg);
RegCloseKey(tkey);
result = smpd_get_user_data_default(key, value, value_len);
smpd_exit_fn(FCNAME);
return result;
}
result = RegCloseKey(tkey);
if (result != ERROR_SUCCESS)
{
smpd_translate_win_error(result, err_msg, 512, "Unable to close the HKEY_CURRENT_USER\\" SMPD_REGISTRY_KEY " registry key, error %d: ", result);
smpd_err_printf("%s\n", err_msg);
smpd_exit_fn(FCNAME);
return SMPD_FAIL;
}
smpd_exit_fn(FCNAME);
return SMPD_SUCCESS;
#else
int result;
smpd_enter_fn(FCNAME);
result = smpd_get_smpd_data(key, value, value_len);
if (result != SMPD_SUCCESS)
{
result = smpd_get_user_data_default(key, value, value_len);
}
smpd_exit_fn(FCNAME);
return result;
#endif
}
开发者ID:OngOngoing,项目名称:219351_homework,代码行数:54,代码来源:smpd_user_data.c
示例3: smpd_delete_user_data
int smpd_delete_user_data(const char *key)
{
#ifdef HAVE_WINDOWS_H
HKEY tkey;
DWORD result;
char err_msg[512];
smpd_enter_fn(FCNAME);
if (key == NULL)
{
smpd_exit_fn(FCNAME);
return SMPD_FAIL;
}
result = RegCreateKeyEx(HKEY_CURRENT_USER, SMPD_REGISTRY_KEY,
0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &tkey, NULL);
if (result != ERROR_SUCCESS)
{
smpd_translate_win_error(result, err_msg, 512, "Unable to open the HKEY_CURRENT_USER\\" SMPD_REGISTRY_KEY " registry key, error %d: ", result);
smpd_err_printf("%s\n", err_msg);
smpd_exit_fn(FCNAME);
return SMPD_FAIL;
}
result = RegDeleteValue(tkey, key);
if (result != ERROR_SUCCESS)
{
smpd_translate_win_error(result, err_msg, 512, "Unable to delete the user smpd registry value '%s', error %d: ", key, result);
smpd_err_printf("%s\n", err_msg);
RegCloseKey(tkey);
smpd_exit_fn(FCNAME);
return SMPD_FAIL;
}
result = RegCloseKey(tkey);
if (result != ERROR_SUCCESS)
{
smpd_translate_win_error(result, err_msg, 512, "Unable to close the HKEY_CURRENT_USER\\" SMPD_REGISTRY_KEY " registry key, error %d: ", result);
smpd_err_printf("%s\n", err_msg);
smpd_exit_fn(FCNAME);
return SMPD_FAIL;
}
smpd_exit_fn(FCNAME);
return SMPD_SUCCESS;
#else
int result;
smpd_enter_fn(FCNAME);
result = smpd_delete_smpd_data(key);
smpd_exit_fn(FCNAME);
return result;
#endif
}
开发者ID:OngOngoing,项目名称:219351_homework,代码行数:54,代码来源:smpd_user_data.c
示例4: smpd_hash
int smpd_hash(char *input, int input_length, char *output, int output_length)
{
/*int i;*/
unsigned char hash[MD5_DIGEST_LENGTH];
smpd_enter_fn(FCNAME);
if (output_length < (MD5_DIGEST_LENGTH * 2 + 1))
{
smpd_exit_fn(FCNAME);
return SMPD_FAIL;
}
#ifdef HAVE_MD5_CALC
md5_calc(hash, (unsigned char *)input, (unsigned int)input_length);
#else
MD5(input, input_length, hash);
#endif
/*
for (i=0; i<MD5_DIGEST_LENGTH; i++)
{
sprintf(output, "%02x", hash[i]);
output += 2;
}
*/
sprintf(output, "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x",
hash[0], hash[1], hash[2], hash[3], hash[4], hash[5], hash[6], hash[7],
hash[8], hash[9], hash[10], hash[11], hash[12], hash[13], hash[14], hash[15]);
smpd_exit_fn(FCNAME);
return SMPD_SUCCESS;
}
开发者ID:OngOngoing,项目名称:219351_homework,代码行数:33,代码来源:smpd_hash.c
示例5: smpd_lock_smpd_data
int smpd_lock_smpd_data(void)
{
smpd_enter_fn(FCNAME);
#ifdef HAVE_WINDOWS_H
if (smpd_process.hSMPDDataMutex == NULL)
{
smpd_process.hSMPDDataMutex = CreateMutex(NULL, FALSE, SMPD_DATA_MUTEX_NAME);
if (smpd_process.hSMPDDataMutex == NULL)
{
smpd_exit_fn(FCNAME);
return SMPD_FAIL;
}
}
if (WaitForSingleObject(smpd_process.hSMPDDataMutex, SMPD_SHORT_TIMEOUT*1000) != WAIT_OBJECT_0)
{
smpd_err_printf("lock_smpd_data failed\n");
smpd_exit_fn(FCNAME);
return SMPD_FAIL;
}
#else
/* No lock implemented for Unix systems */
#endif
smpd_exit_fn(FCNAME);
return SMPD_SUCCESS;
}
开发者ID:OngOngoing,项目名称:219351_homework,代码行数:25,代码来源:smpd_user_data.c
示例6: smpd_dbs_nextdb
int smpd_dbs_nextdb(char *name)
{
smpd_enter_fn(FCNAME);
#ifdef USE_WIN_MUTEX_PROTECT
WaitForSingleObject(smpd_process.hDBSMutex, INFINITE);
#endif
if (smpd_process.pDatabaseIter == NULL)
name[0] = '\0';
else
{
smpd_process.pDatabaseIter = smpd_process.pDatabaseIter->pNext;
if (smpd_process.pDatabaseIter)
strcpy(name, smpd_process.pDatabaseIter->pszName);
else
name[0] = '\0';
}
#ifdef USE_WIN_MUTEX_PROTECT
ReleaseMutex(smpd_process.hDBSMutex);
#endif
smpd_exit_fn(FCNAME);
return SMPD_DBS_SUCCESS;
}
开发者ID:OngOngoing,项目名称:219351_homework,代码行数:26,代码来源:smpd_database.c
示例7: smpd_get_opt_double
int smpd_get_opt_double(int *argc, char ***argv, char * flag, double *d)
{
int i,j;
smpd_enter_fn(FCNAME);
if (flag == NULL)
{
smpd_exit_fn(FCNAME);
return 0;
}
for (i=0; i<*argc; i++)
{
if (strcmp((*argv)[i], flag) == 0)
{
if (i+1 == *argc)
{
smpd_exit_fn(FCNAME);
return 0;
}
*d = atof((*argv)[i+1]);
for (j=i; j<*argc-1; j++)
{
(*argv)[j] = (*argv)[j+2];
}
*argc -= 2;
smpd_exit_fn(FCNAME);
return 1;
}
}
smpd_exit_fn(FCNAME);
return 0;
}
开发者ID:OngOngoing,项目名称:219351_homework,代码行数:33,代码来源:smpd_get_opt.c
示例8: smpd_get_opt
int smpd_get_opt(int *argc, char ***argv, char * flag)
{
int i,j;
smpd_enter_fn(FCNAME);
if (flag == NULL)
{
smpd_exit_fn(FCNAME);
return 0;
}
for (i=0; i<*argc; i++)
{
if (strcmp((*argv)[i], flag) == 0)
{
for (j=i; j<*argc; j++)
{
(*argv)[j] = (*argv)[j+1];
}
*argc -= 1;
smpd_exit_fn(FCNAME);
return 1;
}
}
smpd_exit_fn(FCNAME);
return 0;
}
开发者ID:OngOngoing,项目名称:219351_homework,代码行数:27,代码来源:smpd_get_opt.c
示例9: smpd_spn_list_finalize
int smpd_spn_list_finalize(smpd_spn_list_hnd_t *spn_list_hnd_p)
{
smpd_host_spn_node_t *spn_list_head, *cur_node;
smpd_enter_fn(FCNAME);
if(spn_list_hnd_p == NULL){
smpd_err_printf("Invalid pointer to spn list handle\n");
smpd_exit_fn(FCNAME);
return SMPD_FAIL;
}
if(!SMPD_SPN_LIST_HND_IS_INIT(*spn_list_hnd_p)){
smpd_dbg_printf("Trying to finalize an uninitialized handle\n");
smpd_exit_fn(FCNAME);
return SMPD_FAIL;
}
spn_list_head = **spn_list_hnd_p;
while(spn_list_head != NULL){
cur_node = spn_list_head;
spn_list_head = cur_node->next;
MPIU_Free(cur_node);
}
/* Free contents of the spn handle */
MPIU_Free(*spn_list_hnd_p);
*spn_list_hnd_p = NULL;
smpd_exit_fn(FCNAME);
return SMPD_SUCCESS;
}
开发者ID:dbrowneup,项目名称:pmap,代码行数:29,代码来源:smpd_ad.cpp
示例10: smpd_get_string
const char * smpd_get_string(const char *str, char *val, int maxlen, int *num_chars)
{
smpd_enter_fn(FCNAME);
if (maxlen < 1)
{
*num_chars = 0;
smpd_exit_fn(FCNAME);
return NULL;
}
/* line up with the first token */
str = first_token(str);
if (str == NULL)
{
*num_chars = 0;
smpd_exit_fn(FCNAME);
return NULL;
}
/* copy the token */
token_copy(str, val, maxlen);
*num_chars = (int)strlen(val);
/* move to the next token */
str = next_token(str);
smpd_exit_fn(FCNAME);
return str;
}
开发者ID:OngOngoing,项目名称:219351_homework,代码行数:29,代码来源:smpd_get_opt.c
示例11: smpd_free_sspi_client_context
int smpd_free_sspi_client_context(smpd_sspi_client_context_t **context)
{
smpd_sspi_client_context_t *iter, *trailer;
smpd_enter_fn(FCNAME);
trailer = iter = smpd_process.sspi_context_list;
while (iter)
{
if (iter == *context)
{
if (trailer != iter)
{
trailer->next = iter->next;
}
else
{
smpd_process.sspi_context_list = iter->next;
}
break;
}
if (trailer != iter)
trailer = trailer->next;
iter = iter->next;
}
if (iter == NULL)
{
smpd_dbg_printf("freeing a sspi_client_context not in the global list\n");
}
/* FIXME: cleanup sspi structures */
MPIU_Free(*context);
*context = NULL;
smpd_exit_fn(FCNAME);
return SMPD_SUCCESS;
}
开发者ID:qingu,项目名称:WRF-Libraries,代码行数:35,代码来源:smpd_connect.c
示例12: FmtEnvVarsForSSH
/* This function formats the environment strings of the form,
* foo1=bar1 foo2=bar2 foo3=bar3
* TO
* "foo1=bar1" "foo2=bar2" "foo3=bar3"
* and returns the length of the formatted string
* Note: The formatted string contains a space in the front
*/
static int FmtEnvVarsForSSH(char *bEnv, char *fmtEnv, int fmtEnvLen)
{
char name[SMPD_MAX_ENV_LENGTH], equals[3], value[SMPD_MAX_ENV_LENGTH];
int curLen = 0, totLen = 0;
smpd_enter_fn(FCNAME);
if(fmtEnv && bEnv){
for (;;)
{
name[0] = '\0';
equals[0] = '\0';
value[0] = '\0';
if(fmtEnvLen <= 0)
break;
if (MPIU_Str_get_string(&bEnv, name, SMPD_MAX_ENV_LENGTH) != MPIU_STR_SUCCESS)
break;
if (name[0] == '\0')
break;
if (MPIU_Str_get_string(&bEnv, equals, 3) != MPIU_STR_SUCCESS)
break;
if (equals[0] == '\0')
break;
if (MPIU_Str_get_string(&bEnv, value, SMPD_MAX_ENV_LENGTH) != MPIU_STR_SUCCESS)
break;
MPIU_Snprintf(fmtEnv, fmtEnvLen, " \"%s=%s\"", name, value);
curLen = strlen(fmtEnv);
totLen += curLen;
fmtEnv += curLen;
fmtEnvLen -= curLen;
}
}
smpd_exit_fn(FCNAME);
return totLen;
}
开发者ID:OngOngoing,项目名称:219351_homework,代码行数:41,代码来源:mpiexec_rsh.c
示例13: smpd_get_password
void smpd_get_password(char *password)
{
#ifdef HAVE_WINDOWS_H
HANDLE hStdin;
DWORD dwMode;
#else
struct termios terminal_settings, original_settings;
#endif
size_t len;
smpd_enter_fn(FCNAME);
#ifdef HAVE_WINDOWS_H
hStdin = GetStdHandle(STD_INPUT_HANDLE);
if (!GetConsoleMode(hStdin, &dwMode))
dwMode = ENABLE_LINE_INPUT | ENABLE_PROCESSED_INPUT | ENABLE_MOUSE_INPUT;
SetConsoleMode(hStdin, dwMode & ~ENABLE_ECHO_INPUT);
*password = '\0';
fgets(password, 100, stdin);
SetConsoleMode(hStdin, dwMode);
fprintf(stderr, "\n");
#else
/* save the current terminal settings */
tcgetattr(STDIN_FILENO, &terminal_settings);
original_settings = terminal_settings;
/* turn off echo */
terminal_settings.c_lflag &= ~ECHO;
terminal_settings.c_lflag |= ECHONL;
tcsetattr(STDIN_FILENO, TCSAFLUSH, &terminal_settings);
/* check that echo is off */
tcgetattr(STDIN_FILENO, &terminal_settings);
if (terminal_settings.c_lflag & ECHO)
{
smpd_err_printf("\nunable to turn off the terminal echo\n");
tcsetattr(STDIN_FILENO, TCSANOW, &original_settings);
}
fgets(password, 100, stdin);
/* restore the original settings */
tcsetattr(STDIN_FILENO, TCSANOW, &original_settings);
#endif
while ((len = strlen(password)) > 0)
{
if (password[len-1] == '\r' || password[len-1] == '\n')
password[len-1] = '\0';
else
break;
}
smpd_exit_fn(FCNAME);
}
开发者ID:qingu,项目名称:WRF-Libraries,代码行数:59,代码来源:smpd_connect.c
示例14: smpd_watch_processes
int smpd_watch_processes()
{
smpd_enter_fn(FCNAME);
printf("Process watching not implemented under unix systems, exiting...\n");
fflush(stdout);
smpd_exit_fn(FCNAME);
return SMPD_SUCCESS;
}
开发者ID:dbrowneup,项目名称:pmap,代码行数:8,代码来源:smpd_watchprocs.c
示例15: smpd_add_host_to_default_list
int smpd_add_host_to_default_list(const char *hostname)
{
int result;
smpd_enter_fn(FCNAME);
result = smpd_add_extended_host_to_default_list(hostname, NULL, 1);
smpd_exit_fn(FCNAME);
return result;
}
开发者ID:qingu,项目名称:WRF-Libraries,代码行数:8,代码来源:smpd_connect.c
示例16: smpd_dbsIter_finalize
int smpd_dbsIter_finalize(smpd_dbsIter_t *pIter){
smpd_enter_fn(FCNAME);
if(pIter){
*pIter = NULL;
}
smpd_exit_fn(FCNAME);
return SMPD_DBS_SUCCESS;
}
开发者ID:OngOngoing,项目名称:219351_homework,代码行数:8,代码来源:smpd_database.c
示例17: smpd_get_smpd_password_from_parent
int smpd_get_smpd_password_from_parent(SMPDU_Sock_set_t set, SMPDU_Sock_t sock)
{
smpd_enter_fn(FCNAME);
SMPD_UNREFERENCED_ARG(set);
SMPD_UNREFERENCED_ARG(sock);
smpd_exit_fn(FCNAME);
return SMPD_FAIL;
}
开发者ID:qingu,项目名称:WRF-Libraries,代码行数:8,代码来源:smpd_connect.c
示例18: smpd_remove_from_dynamic_hosts
int smpd_remove_from_dynamic_hosts(void)
{
#ifndef HAVE_WINDOWS_H
char myhostname[SMPD_MAX_HOST_LENGTH];
char hosts[8192];
char hosts_less_me[8192];
char *host;
#endif
smpd_enter_fn(FCNAME);
#ifndef HAVE_WINDOWS_H
if (smpd_get_hostname(myhostname, SMPD_MAX_HOST_LENGTH) != 0)
{
smpd_err_printf("smpd_get_hostname failed, errno = %d\n", errno);
smpd_exit_fn(FCNAME);
return SMPD_FAIL;
}
smpd_lock_smpd_data();
hosts[0] = '\0';
if (smpd_get_smpd_data(SMPD_DYNAMIC_HOSTS_KEY, hosts, 8192) != SMPD_SUCCESS)
{
smpd_unlock_smpd_data();
smpd_dbg_printf("not removing host because "SMPD_DYNAMIC_HOSTS_KEY" does not exist\n");
smpd_exit_fn(FCNAME);
return SMPD_FAIL;
}
/* create a new hosts lists without this host name in it */
hosts_less_me[0] = '\0';
host = strtok(hosts, " \t\r\n");
while (host)
{
if (strcmp(host, myhostname))
{
if (hosts_less_me[0] != '\0')
strcat(hosts_less_me, " ");
strcat(hosts_less_me, host);
}
host = strtok(NULL, " \t\r\n");
}
if (hosts_less_me[0] == '\0')
{
smpd_dbg_printf("removing "SMPD_DYNAMIC_HOSTS_KEY"\n");
smpd_delete_smpd_data(SMPD_DYNAMIC_HOSTS_KEY);
}
else
{
smpd_dbg_printf("setting new "SMPD_DYNAMIC_HOSTS_KEY": %s\n", hosts_less_me);
smpd_set_smpd_data(SMPD_DYNAMIC_HOSTS_KEY, hosts_less_me);
}
smpd_unlock_smpd_data();
#endif
smpd_exit_fn(FCNAME);
return SMPD_SUCCESS;
}
开发者ID:qingu,项目名称:WRF-Libraries,代码行数:58,代码来源:smpd_connect.c
示例19: smpd_get_smpd_data_default
int smpd_get_smpd_data_default(const char *key, char *value, int value_len)
{
smpd_enter_fn(FCNAME);
#ifdef HAVE_WINDOWS_H
/* A default passphrase is only available for Windows */
if (strcmp(key, "phrase") == 0)
{
strncpy(value, SMPD_DEFAULT_PASSPHRASE, value_len);
value[value_len-1] = '\0';
smpd_exit_fn(FCNAME);
return SMPD_SUCCESS;
}
if(strcmp(key, "port") == 0)
{
snprintf(value, value_len, "%d", SMPD_LISTENER_PORT);
smpd_exit_fn(FCNAME);
return SMPD_SUCCESS;
}
#endif
if (strcmp(key, "log") == 0)
{
strncpy(value, "no", value_len);
value[value_len-1] = '\0';
}
else if (strcmp(key, "prepend_rank") == 0)
{
strncpy(value, "yes", value_len);
value[value_len-1] = '\0';
}
else if (strcmp(key, "trace") == 0)
{
strncpy(value, "yes", value_len);
value[value_len-1] = '\0';
}
else if (strcmp(key, "noprompt") == 0)
{
strncpy(value, "no", value_len);
value[value_len-1] = '\0';
}
/*
else if (strcmp(key, "hosts") == 0)
{
if (smpd_get_hostname(value, value_len) != 0)
{
smpd_exit_fn(FCNAME);
return SMPD_FAIL;
}
}
*/
else
{
smpd_exit_fn(FCNAME);
return SMPD_FAIL;
}
smpd_exit_fn(FCNAME);
return SMPD_SUCCESS;
}
开发者ID:OngOngoing,项目名称:219351_homework,代码行数:57,代码来源:smpd_user_data.c
示例20: smpd_get_user_data_default
int smpd_get_user_data_default(const char *key, char *value, int value_len)
{
smpd_enter_fn(FCNAME);
/* FIXME: function not implemented */
SMPD_UNREFERENCED_ARG(key);
SMPD_UNREFERENCED_ARG(value);
SMPD_UNREFERENCED_ARG(value_len);
smpd_exit_fn(FCNAME);
return SMPD_FAIL;
}
开发者ID:OngOngoing,项目名称:219351_homework,代码行数:10,代码来源:smpd_user_data.c
注:本文中的smpd_enter_fn函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论