本文整理汇总了C++中os_calloc函数的典型用法代码示例。如果您正苦于以下问题:C++ os_calloc函数的具体用法?C++ os_calloc怎么用?C++ os_calloc使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了os_calloc函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: dump_registry_ignore_regex
int dump_registry_ignore_regex(syscheck_config *syscheck, char *regex, int arch) {
OSMatch *mt_pt;
int ign_size = 0;
if (!syscheck->registry_ignore_regex) {
os_calloc(2, sizeof(registry_regex),
syscheck->registry_ignore_regex);
syscheck->registry_ignore_regex[0].regex = NULL;
syscheck->registry_ignore_regex[1].regex = NULL;
} else {
while (syscheck->registry_ignore_regex[ign_size].regex != NULL) {
ign_size++;
}
os_realloc(syscheck->registry_ignore_regex,
sizeof(registry_regex) * (ign_size + 2),
syscheck->registry_ignore_regex);
syscheck->registry_ignore_regex[ign_size + 1].regex = NULL;
}
os_calloc(1, sizeof(OSMatch),
syscheck->registry_ignore_regex[ign_size].regex);
if (!OSMatch_Compile(regex,
syscheck->registry_ignore_regex[ign_size].regex, 0)) {
mt_pt = syscheck->registry_ignore_regex[ign_size].regex;
merror(REGEX_COMPILE, __local_name, regex, mt_pt->error);
return (0);
}
syscheck->registry_ignore_regex[ign_size].arch = arch;
return 1;
}
开发者ID:Cryptophobia,项目名称:ossec-wazuh,代码行数:33,代码来源:syscheck-config.c
示例2: SyscheckInit
/* Initialize the necessary information to process the syscheck information */
void SyscheckInit()
{
int i = 0;
sdb.db_err = 0;
for (; i <= MAX_AGENTS; i++) {
sdb.agent_ips[i] = NULL;
sdb.agent_fps[i] = NULL;
sdb.agent_cp[i][0] = '0';
}
/* Clear db memory */
memset(sdb.buf, '\0', OS_MAXSTR + 1);
memset(sdb.comment, '\0', OS_MAXSTR + 1);
memset(sdb.size, '\0', OS_FLSIZE + 1);
memset(sdb.perm, '\0', OS_FLSIZE + 1);
memset(sdb.owner, '\0', OS_FLSIZE + 1);
memset(sdb.gowner, '\0', OS_FLSIZE + 1);
memset(sdb.md5, '\0', OS_FLSIZE + 1);
memset(sdb.sha1, '\0', OS_FLSIZE + 1);
memset(sdb.mtime, '\0', OS_FLSIZE + 1);
memset(sdb.inode, '\0', OS_FLSIZE + 1);
/* Create decoder */
os_calloc(1, sizeof(OSDecoderInfo), sdb.syscheck_dec);
sdb.syscheck_dec->id = getDecoderfromlist(SYSCHECK_MOD);
sdb.syscheck_dec->name = SYSCHECK_MOD;
sdb.syscheck_dec->type = OSSEC_RL;
sdb.syscheck_dec->fts = 0;
os_calloc(Config.decoder_order_size, sizeof(char *), sdb.syscheck_dec->fields);
sdb.syscheck_dec->fields[SCK_FILE] = "file";
sdb.syscheck_dec->fields[SCK_SIZE] = "size";
sdb.syscheck_dec->fields[SCK_PERM] = "perm";
sdb.syscheck_dec->fields[SCK_UID] = "uid";
sdb.syscheck_dec->fields[SCK_GID] = "gid";
sdb.syscheck_dec->fields[SCK_MD5] = "md5";
sdb.syscheck_dec->fields[SCK_SHA1] = "sha1";
sdb.syscheck_dec->fields[SCK_UNAME] = "uname";
sdb.syscheck_dec->fields[SCK_GNAME] = "gname";
sdb.syscheck_dec->fields[SCK_INODE] = "inode";
sdb.id1 = getDecoderfromlist(SYSCHECK_MOD);
sdb.id2 = getDecoderfromlist(SYSCHECK_MOD2);
sdb.id3 = getDecoderfromlist(SYSCHECK_MOD3);
sdb.idn = getDecoderfromlist(SYSCHECK_NEW);
sdb.idd = getDecoderfromlist(SYSCHECK_DEL);
debug1("%s: SyscheckInit completed.", ARGV0);
}
开发者ID:Cryptophobia,项目名称:ossec-wazuh,代码行数:53,代码来源:syscheck.c
示例3: dump_registry_ignore
void dump_registry_ignore(syscheck_config *syscheck, char *entry, int arch) {
int ign_size = 0;
if (syscheck->registry_ignore) {
int ign_size;
/* We do not add duplicated entries */
for (ign_size = 0; syscheck->registry_ignore[ign_size].entry; ign_size++)
if (syscheck->registry_ignore[ign_size].arch == arch &&
strcmp(syscheck->registry_ignore[ign_size].entry, entry) == 0)
return;
os_realloc(syscheck->registry_ignore,
sizeof(registry) * (ign_size + 2),
syscheck->registry_ignore);
syscheck->registry_ignore[ign_size + 1].entry = NULL;
} else {
ign_size = 0;
os_calloc(2, sizeof(registry), syscheck->registry_ignore);
syscheck->registry_ignore[0].entry = NULL;
syscheck->registry_ignore[1].entry = NULL;
}
os_strdup(entry, syscheck->registry_ignore[ign_size].entry);
syscheck->registry_ignore[ign_size].arch = arch;
}
开发者ID:Cryptophobia,项目名称:ossec-wazuh,代码行数:27,代码来源:syscheck-config.c
示例4: radius_copy_class
int radius_copy_class(struct radius_class_data *dst,
const struct radius_class_data *src)
{
size_t i;
if (src->attr == NULL)
return 0;
dst->attr = os_calloc(src->count, sizeof(struct radius_attr_data));
if (dst->attr == NULL)
return -1;
dst->count = 0;
for (i = 0; i < src->count; i++) {
dst->attr[i].data = os_malloc(src->attr[i].len);
if (dst->attr[i].data == NULL)
break;
dst->count++;
os_memcpy(dst->attr[i].data, src->attr[i].data,
src->attr[i].len);
dst->attr[i].len = src->attr[i].len;
}
return 0;
}
开发者ID:0x000000FF,项目名称:wpa_supplicant_for_edison,代码行数:26,代码来源:radius.c
示例5: tiz_os_calloc
void *
tiz_os_calloc (const tiz_os_t * ap_os, size_t a_size)
{
assert (ap_os);
assert (ap_os->p_soa);
return os_calloc (ap_os->p_soa, a_size);
}
开发者ID:juanrubio,项目名称:tizonia-openmax-il,代码行数:7,代码来源:tizobjsys.c
示例6: tiz_os_init
OMX_ERRORTYPE
tiz_os_init (tiz_os_t ** app_os, const OMX_HANDLETYPE ap_hdl,
tiz_soa_t * ap_soa)
{
tiz_os_t * p_os = NULL;
assert (app_os);
assert (ap_hdl);
TIZ_TRACE (ap_hdl, "Init");
if (NULL == (p_os = (tiz_os_t *) os_calloc (ap_soa, sizeof (tiz_os_t))))
{
return OMX_ErrorInsufficientResources;
}
assert (p_os);
if (OMX_ErrorNone != tiz_map_init (&(p_os->p_map), os_map_compare_func,
os_map_free_func, NULL))
{
os_free (ap_soa, p_os);
p_os = NULL;
return OMX_ErrorInsufficientResources;
}
p_os->p_hdl = ap_hdl;
p_os->p_soa = ap_soa;
*app_os = p_os;
return OMX_ErrorNone;
}
开发者ID:juanrubio,项目名称:tizonia-openmax-il,代码行数:33,代码来源:tizobjsys.c
示例7: os_str_stream_create
struct os_stream *
os_str_stream_create(size_t size)
{
struct os_str_stream *stream;
stream = (struct os_str_stream *)os_calloc(1, sizeof(*stream));
if(!stream)
goto no_stream;
stream->base.close = &os_str_stream_close;
stream->base.write = &os_str_stream_write;
stream->base.flush = &os_str_stream_flush;
stream->base.vprintf = &os_default_stream_vprintf;
stream->str = os_malloc(size);
if(!stream->str)
goto no_str;
stream->size = size;
return &stream->base;
no_str:
os_free(stream);
no_stream:
return NULL;
}
开发者ID:1065672644894730302,项目名称:Chromium,代码行数:27,代码来源:os_stream_str.c
示例8: memset
/* os_get_unix_process_list: Get list of Unix processes */
void *os_get_process_list()
{
int i = 1;
pid_t max_pid = MAX_PID;
OSList *p_list = NULL;
char ps[OS_SIZE_1024 +1];
/* Checking where ps is */
memset(ps, '\0', OS_SIZE_1024 +1);
strncpy(ps, "/bin/ps", OS_SIZE_1024);
if(!is_file(ps))
{
strncpy(ps, "/usr/bin/ps", OS_SIZE_1024);
if(!is_file(ps))
{
merror("%s: ERROR: 'ps' not found.", ARGV0);
return(NULL);
}
}
/* Creating process list */
p_list = OSList_Create();
if(!p_list)
{
merror(LIST_ERROR, ARGV0);
return(NULL);
}
for(i = 1; i<= max_pid; i++)
{
/* Checking if the pid is present. */
if((!((getsid(i) == -1)&&(errno == ESRCH))) &&
(!((getpgid(i) == -1)&&(errno == ESRCH))))
{
Proc_Info *p_info;
char *p_name;
p_name = _os_get_runps(ps, (int)i);
if(!p_name)
{
continue;
}
os_calloc(1, sizeof(Proc_Info), p_info);
p_info->p_path = p_name;
p_info->p_name = NULL;
OSList_AddData(p_list, p_info);
}
}
return((void *)p_list);
}
开发者ID:Ar0xA,项目名称:ossec-hids,代码行数:58,代码来源:unix-process.c
示例9: gas_dialog_create
static struct gas_dialog_info *
gas_dialog_create(struct hostapd_data *hapd, const u8 *addr, u8 dialog_token)
{
struct sta_info *sta;
struct gas_dialog_info *dia = NULL;
int i, j;
sta = ap_get_sta(hapd, addr);
if (!sta) {
/*
* We need a STA entry to be able to maintain state for
* the GAS query.
*/
wpa_printf(MSG_DEBUG, "ANQP: Add a temporary STA entry for "
"GAS query");
sta = ap_sta_add(hapd, addr);
if (!sta) {
wpa_printf(MSG_DEBUG, "Failed to add STA " MACSTR
" for GAS query", MAC2STR(addr));
return NULL;
}
sta->flags |= WLAN_STA_GAS;
/*
* The default inactivity is 300 seconds. We don't need
* it to be that long.
*/
ap_sta_session_timeout(hapd, sta, 5);
} else {
ap_sta_replenish_timeout(hapd, sta, 5);
}
if (sta->gas_dialog == NULL) {
sta->gas_dialog = os_calloc(GAS_DIALOG_MAX,
sizeof(struct gas_dialog_info));
if (sta->gas_dialog == NULL)
return NULL;
}
for (i = sta->gas_dialog_next, j = 0; j < GAS_DIALOG_MAX; i++, j++) {
if (i == GAS_DIALOG_MAX)
i = 0;
if (sta->gas_dialog[i].valid)
continue;
dia = &sta->gas_dialog[i];
dia->valid = 1;
dia->dialog_token = dialog_token;
sta->gas_dialog_next = (++i == GAS_DIALOG_MAX) ? 0 : i;
return dia;
}
wpa_msg(hapd->msg_ctx, MSG_ERROR, "ANQP: Could not create dialog for "
MACSTR " dialog_token %u. Consider increasing "
"GAS_DIALOG_MAX.", MAC2STR(addr), dialog_token);
return NULL;
}
开发者ID:cococorp,项目名称:hostap-upstream,代码行数:56,代码来源:gas_serv.c
示例10: OS_DBD
/* OS_DBD: Monitor the alerts and insert them into the database.
* Only return in case of error.
*/
void OS_DBD(DBConfig *db_config)
{
time_t tm;
struct tm *p;
file_queue *fileq;
alert_data *al_data;
/* Getting currently time before starting */
tm = time(NULL);
p = localtime(&tm);
/* Initating file queue - to read the alerts */
os_calloc(1, sizeof(file_queue), fileq);
Init_FileQueue(fileq, p, 0);
/* Creating location hash */
db_config->location_hash = OSHash_Create();
if(!db_config->location_hash)
{
ErrorExit(MEM_ERROR, ARGV0);
}
/* Getting maximum ID */
db_config->alert_id = OS_SelectMaxID(db_config);
db_config->alert_id++;
/* Infinite loop reading the alerts and inserting them. */
while(1)
{
tm = time(NULL);
p = localtime(&tm);
/* Get message if available (timeout of 5 seconds) */
al_data = Read_FileMon(fileq, p, 5);
if(!al_data)
{
continue;
}
/* Inserting into the db */
OS_Alert_InsertDB(al_data, db_config);
/* Clearing the memory */
FreeAlertData(al_data);
}
}
开发者ID:jrossi,项目名称:ossec-hids-old-unused,代码行数:58,代码来源:dbd.c
示例11: os_calloc
epbase *epoll_init(int size)
{
epbase *base = os_calloc(sizeof(epbase));
base->evsize = size;
base->epfd = epoll_create(size);
if (base->epfd < 0) {
return NULL;
}
base->evlist = os_calloc(sizeof(struct epoll_event) * base->evsize);
if (base->evlist == NULL) {
return NULL;
}
base->eflags |= EPEDGE; // default using edge trigger.
return base;
}
开发者ID:songshaodong,项目名称:ostrichserver,代码行数:20,代码来源:eventpoll.c
示例12: radius_msg_initialize
static int radius_msg_initialize(struct radius_msg *msg)
{
msg->attr_pos = os_calloc(RADIUS_DEFAULT_ATTR_COUNT,
sizeof(*msg->attr_pos));
if (msg->attr_pos == NULL)
return -1;
msg->attr_size = RADIUS_DEFAULT_ATTR_COUNT;
msg->attr_used = 0;
return 0;
}
开发者ID:0x000000FF,项目名称:wpa_supplicant_for_edison,代码行数:12,代码来源:radius.c
示例13: srandom_init
char *OS_AddNewAgent(const char *name, const char *ip, const char *id)
{
FILE *fp;
os_md5 md1;
os_md5 md2;
char str1[STR_SIZE + 1];
char str2[STR_SIZE + 1];
char *muname;
char *finals;
char nid[9];
srandom_init();
muname = getuname();
snprintf(str1, STR_SIZE, "%d%s%d%s", (int)time(0), name, (int)random(), muname);
snprintf(str2, STR_SIZE, "%s%s%ld", ip, id, (long int)random());
OS_MD5_Str(str1, md1);
OS_MD5_Str(str2, md2);
free(muname);
nid[8] = '\0';
if (id == NULL) {
int i = 1024;
snprintf(nid, 6, "%d", i);
while (IDExist(nid)) {
i++;
snprintf(nid, 6, "%d", i);
if (i >= (MAX_AGENTS + 1024)) {
return (NULL);
}
}
id = nid;
}
fp = fopen(KEYSFILE_PATH, "a");
if (!fp) {
return (NULL);
}
os_calloc(2048, sizeof(char), finals);
if (ip == NULL) {
snprintf(finals, 2048, "%s %s any %s%s", id, name, md1, md2);
} else {
snprintf(finals, 2048, "%s %s %s %s%s", id, name, ip, md1, md2);
}
fprintf(fp, "%s\n", finals);
fclose(fp);
return (finals);
}
开发者ID:AiGangJingYe,项目名称:ossec-hids,代码行数:53,代码来源:validate.c
示例14: _wpa_dbus_dict_entry_get_byte_array
static dbus_bool_t _wpa_dbus_dict_entry_get_byte_array(
DBusMessageIter *iter, struct wpa_dbus_dict_entry *entry)
{
dbus_uint32_t count = 0;
dbus_bool_t success = FALSE;
char *buffer, *nbuffer;
entry->bytearray_value = NULL;
entry->array_type = DBUS_TYPE_BYTE;
buffer = os_calloc(BYTE_ARRAY_CHUNK_SIZE, BYTE_ARRAY_ITEM_SIZE);
if (!buffer)
return FALSE;
entry->bytearray_value = buffer;
entry->array_len = 0;
while (dbus_message_iter_get_arg_type(iter) == DBUS_TYPE_BYTE) {
char byte;
if ((count % BYTE_ARRAY_CHUNK_SIZE) == 0 && count != 0) {
nbuffer = os_realloc_array(
buffer, count + BYTE_ARRAY_CHUNK_SIZE,
BYTE_ARRAY_ITEM_SIZE);
if (nbuffer == NULL) {
os_free(buffer);
wpa_printf(MSG_ERROR, "dbus: _wpa_dbus_dict_"
"entry_get_byte_array out of "
"memory trying to retrieve the "
"string array");
goto done;
}
buffer = nbuffer;
}
entry->bytearray_value = buffer;
dbus_message_iter_get_basic(iter, &byte);
entry->bytearray_value[count] = byte;
entry->array_len = ++count;
dbus_message_iter_next(iter);
}
/* Zero-length arrays are valid. */
if (entry->array_len == 0) {
os_free(entry->bytearray_value);
entry->bytearray_value = NULL;
}
success = TRUE;
done:
return success;
}
开发者ID:0x000000FF,项目名称:wpa_supplicant_for_edison,代码行数:52,代码来源:dbus_dict_helpers.c
示例15: FillEvent
void FillEvent(Eventinfo *lf, const char *f_name, const SyscheckSum *sum) {
os_strdup(f_name, lf->filename);
os_strdup(sum->size, lf->size_after);
lf->perm_after = sum->perm;
os_strdup(sum->uid, lf->owner_after);
os_strdup(sum->gid, lf->gowner_after);
os_strdup(sum->md5, lf->md5_after);
os_strdup(sum->sha1, lf->sha1_after);
if (sum->uname)
os_strdup(sum->uname, lf->uname_after);
if (sum->gname)
os_strdup(sum->gname, lf->gname_after);
lf->mtime_after = sum->mtime;
lf->inode_after = sum->inode;
/* Fields */
os_strdup(f_name, lf->fields[SCK_FILE]);
os_strdup(sum->size, lf->fields[SCK_SIZE]);
os_calloc(7, sizeof(char), lf->fields[SCK_PERM]);
snprintf(lf->fields[SCK_PERM], 7, "%06o", sum->perm);
os_strdup(sum->uid, lf->fields[SCK_UID]);
os_strdup(sum->gid, lf->fields[SCK_GID]);
os_strdup(sum->md5, lf->fields[SCK_MD5]);
os_strdup(sum->sha1, lf->fields[SCK_SHA1]);
if (sum->uname)
os_strdup(sum->uname, lf->fields[SCK_UNAME]);
if (sum->gname)
os_strdup(sum->gname, lf->fields[SCK_GNAME]);
if (sum->inode) {
os_calloc(20, sizeof(char), lf->fields[SCK_INODE]);
snprintf(lf->fields[SCK_INODE], 20, "%ld", sum->inode);
}
}
开发者ID:Cryptophobia,项目名称:ossec-wazuh,代码行数:39,代码来源:syscheck.c
示例16: hostapd_init
/**
* hostapd_init - Allocate and initialize per-interface data
* @config_file: Path to the configuration file
* Returns: Pointer to the allocated interface data or %NULL on failure
*
* This function is used to allocate main data structures for per-interface
* data. The allocated data buffer will be freed by calling
* hostapd_cleanup_iface().
*/
static struct hostapd_iface * hostapd_init(const char *config_file)
{
struct hostapd_iface *hapd_iface = NULL;
struct hostapd_config *conf = NULL;
struct hostapd_data *hapd;
size_t i;
hapd_iface = os_zalloc(sizeof(*hapd_iface));
if (hapd_iface == NULL)
goto fail;
hapd_iface->config_fname = os_strdup(config_file);
if (hapd_iface->config_fname == NULL)
goto fail;
conf = hostapd_config_read(hapd_iface->config_fname);
if (conf == NULL)
goto fail;
hapd_iface->conf = conf;
hapd_iface->num_bss = conf->num_bss;
hapd_iface->bss = os_calloc(conf->num_bss,
sizeof(struct hostapd_data *));
if (hapd_iface->bss == NULL)
goto fail;
for (i = 0; i < conf->num_bss; i++) {
hapd = hapd_iface->bss[i] =
hostapd_alloc_bss_data(hapd_iface, conf,
&conf->bss[i]);
if (hapd == NULL)
goto fail;
hapd->msg_ctx = hapd;
hapd->setup_complete_cb = hostapd_setup_complete_cb;
}
return hapd_iface;
fail:
wpa_printf(MSG_ERROR, "Failed to set up interface with %s",
config_file);
if (conf)
hostapd_config_free(conf);
if (hapd_iface) {
os_free(hapd_iface->config_fname);
os_free(hapd_iface->bss);
os_free(hapd_iface);
}
return NULL;
}
开发者ID:shizhai,项目名称:proj_shizhai,代码行数:59,代码来源:main.c
示例17: InitACMStore
/* Initialize an storage object */
OS_ACM_Store * InitACMStore() {
OS_ACM_Store *obj;
os_calloc(1, sizeof(OS_ACM_Store), obj);
obj->timestamp = 0;
obj->srcuser = NULL;
obj->dstuser = NULL;
obj->srcip = NULL;
obj->dstip = NULL;
obj->srcport = NULL;
obj->dstport = NULL;
obj->data = NULL;
return obj;
}
开发者ID:DaneTheory,项目名称:ossec-hids,代码行数:16,代码来源:accumulator.c
示例18: hostapd_global_init
static int hostapd_global_init(struct hapd_interfaces *interfaces,
const char *entropy_file)
{
int i;
os_memset(&global, 0, sizeof(global));
hostapd_logger_register_cb(hostapd_logger_cb);
if (eap_server_register_methods()) {
wpa_printf(MSG_ERROR, "Failed to register EAP methods");
return -1;
}
if (eloop_init()) {
wpa_printf(MSG_ERROR, "Failed to initialize event loop");
return -1;
}
random_init(entropy_file);
#ifndef CONFIG_NATIVE_WINDOWS
eloop_register_signal(SIGHUP, handle_reload, interfaces);
eloop_register_signal(SIGUSR1, handle_dump_state, interfaces);
#endif /* CONFIG_NATIVE_WINDOWS */
eloop_register_signal_terminate(handle_term, interfaces);
/*Timeout event is triggered after 5 seconds of start of hostapd. The parameters are pulled after the event is triggered in the handler*/
// eloop_register_timeout(5, 0, get_params_handler, &ctx, NULL);
#ifndef CONFIG_NATIVE_WINDOWS
openlog("hostapd", 0, LOG_DAEMON);
#endif /* CONFIG_NATIVE_WINDOWS */
for (i = 0; wpa_drivers[i]; i++)
global.drv_count++;
if (global.drv_count == 0) {
wpa_printf(MSG_ERROR, "No drivers enabled");
return -1;
}
global.drv_priv = os_calloc(global.drv_count, sizeof(void *));
if (global.drv_priv == NULL)
return -1;
return 0;
}
开发者ID:PavanKulk,项目名称:codebase,代码行数:46,代码来源:main.c
示例19: ieee80211n_scan_channels_2g4
static void ieee80211n_scan_channels_2g4(struct hostapd_iface *iface, struct wpa_driver_scan_params *params)
{
/* Scan only the affected frequency range */
int pri_freq, sec_freq;
int affected_start, affected_end;
int i, pos;
struct hostapd_hw_modes *mode;
if (iface->current_mode == NULL) {
return;
}
pri_freq = hostapd_hw_get_freq(iface->bss[0], iface->conf->channel);
if (iface->conf->secondary_channel > 0) {
sec_freq = pri_freq + 20;
} else {
sec_freq = pri_freq - 20;
}
/*
* Note: Need to find the PRI channel also in cases where the affected
* channel is the SEC channel of a 40 MHz BSS, so need to include the
* scanning coverage here to be 40 MHz from the center frequency.
*/
affected_start = (pri_freq + sec_freq) / 2 - 40;
affected_end = (pri_freq + sec_freq) / 2 + 40;
wpa_printf(MSG_DEBUG, "40 MHz affected channel range: [%d,%d] MHz", affected_start, affected_end);
mode = iface->current_mode;
params->freqs = os_calloc(mode->num_channels + 1, sizeof(int));
if (params->freqs == NULL) {
return;
}
pos = 0;
for (i = 0; i < mode->num_channels; i++) {
struct hostapd_channel_data *chan = &mode->channels[i];
if (chan->flag & HOSTAPD_CHAN_DISABLED) {
continue;
}
if (chan->freq < affected_start || chan->freq > affected_end) {
continue;
}
params->freqs[pos++] = chan->freq;
}
}
开发者ID:tool3210,项目名称:TizenRT,代码行数:45,代码来源:hw_features.c
示例20: wnm_set_scan_freqs
static void wnm_set_scan_freqs(struct wpa_supplicant *wpa_s)
{
int *freqs;
int num_freqs = 0;
unsigned int i;
if (!wpa_s->wnm_neighbor_report_elements)
return;
if (wpa_s->hw.modes == NULL)
return;
os_free(wpa_s->next_scan_freqs);
wpa_s->next_scan_freqs = NULL;
freqs = os_calloc(wpa_s->wnm_num_neighbor_report + 1, sizeof(int));
if (freqs == NULL)
return;
for (i = 0; i < wpa_s->wnm_num_neighbor_report; i++) {
struct neighbor_report *nei;
nei = &wpa_s->wnm_neighbor_report_elements[i];
if (nei->freq <= 0) {
wpa_printf(MSG_DEBUG,
"WNM: Unknown neighbor operating frequency for "
MACSTR " - scan all channels",
MAC2STR(nei->bssid));
os_free(freqs);
return;
}
if (chan_supported(wpa_s, nei->freq))
add_freq(freqs, &num_freqs, nei->freq);
}
if (num_freqs == 0) {
os_free(freqs);
return;
}
wpa_printf(MSG_DEBUG,
"WNM: Scan %d frequencies based on transition candidate list",
num_freqs);
wpa_s->next_scan_freqs = freqs;
}
开发者ID:gxk,项目名称:hostap,代码行数:45,代码来源:wnm_sta.c
注:本文中的os_calloc函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论