summaryrefslogtreecommitdiff
path: root/wl1271/CUDK/os/linux/src
diff options
context:
space:
mode:
Diffstat (limited to 'wl1271/CUDK/os/linux/src')
-rw-r--r--wl1271/CUDK/os/linux/src/Android.mk89
-rw-r--r--wl1271/CUDK/os/linux/src/ParsEvent.c279
-rw-r--r--wl1271/CUDK/os/linux/src/cu_wext.c488
-rw-r--r--wl1271/CUDK/os/linux/src/ipc_event.c679
-rw-r--r--wl1271/CUDK/os/linux/src/ipc_sta.c195
-rw-r--r--wl1271/CUDK/os/linux/src/ipc_wpa.c185
-rw-r--r--wl1271/CUDK/os/linux/src/makefile136
-rw-r--r--wl1271/CUDK/os/linux/src/os_trans.c168
-rw-r--r--wl1271/CUDK/os/linux/src/osapi.c621
9 files changed, 0 insertions, 2840 deletions
diff --git a/wl1271/CUDK/os/linux/src/Android.mk b/wl1271/CUDK/os/linux/src/Android.mk
deleted file mode 100644
index 8d673a5..0000000
--- a/wl1271/CUDK/os/linux/src/Android.mk
+++ /dev/null
@@ -1,89 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-STATIC_LIB ?= y
-DEBUG ?= y
-BUILD_SUPPL ?= n
-WPA_ENTERPRISE ?= y
-
-ifeq ($(DEBUG),y)
- DEBUGFLAGS = -O2 -g -DDEBUG -DTI_DBG -fno-builtin
-else
- DEBUGFLAGS = -O2
-endif
-
-WILINK_ROOT = ../../../..
-CUDK_ROOT = $(WILINK_ROOT)/CUDK
-ifndef WPA_SUPPLICANT_VERSION
-WPA_SUPPLICANT_VERSION := VER_0_5_X
-endif
-
-ifeq ($(WPA_SUPPLICANT_VERSION),VER_0_5_X)
-WPA_SUPPL_DIR = external/wpa_supplicant
-else
-WPA_SUPPL_DIR = external/wpa_supplicant_6/wpa_supplicant
-endif
-WPA_SUPPL_DIR_INCLUDE = $(WPA_SUPPL_DIR)
-ifeq ($(WPA_SUPPLICANT_VERSION),VER_0_6_X)
-WPA_SUPPL_DIR_INCLUDE += $(WPA_SUPPL_DIR)/src \
- $(WPA_SUPPL_DIR)/src/common \
- $(WPA_SUPPL_DIR)/src/drivers \
- $(WPA_SUPPL_DIR)/src/l2_packet \
- $(WPA_SUPPL_DIR)/src/utils \
- $(WPA_SUPPL_DIR)/src/wps
-endif
-
-DK_DEFINES =
-ifeq ($(WPA_ENTERPRISE), y)
-DK_DEFINES += -D WPA_ENTERPRISE
-endif
-
-ifeq ($(BUILD_SUPPL), y)
-DK_DEFINES += -D WPA_SUPPLICANT -D CONFIG_CTRL_IFACE -D CONFIG_CTRL_IFACE_UNIX
--include $(WPA_SUPPL_DIR)/.config
-ifdef CONFIG_WPS
-DK_DEFINES += -DCONFIG_WPS
-endif
-endif
-
-LOCAL_CFLAGS += \
- -Wall -Wstrict-prototypes $(DEBUGFLAGS) -D__LINUX__ $(DK_DEFINES) -D__BYTE_ORDER_LITTLE_ENDIAN -fno-common #-pipe
-
-LOCAL_SRC_FILES:= \
- cu_wext.c \
- ipc_sta.c \
- ipc_event.c \
- ipc_wpa.c \
- os_trans.c \
- ParsEvent.c \
- osapi.c
-
-ifeq ($(BUILD_SUPPL), y)
- ifeq ($(WPA_SUPPLICANT_VERSION),VER_0_5_X)
- LOCAL_SRC_FILES += $(WPA_SUPPL_DIR)/wpa_ctrl.c
- else
- LOCAL_SRC_FILES += $(WPA_SUPPL_DIR)/common/src/wpa_ctrl.c
- endif
-endif
-
-LOCAL_C_INCLUDES := \
- $(LOCAL_PATH)/../inc \
- $(LOCAL_PATH)/../../common/inc \
- $(LOCAL_PATH)/$(WILINK_ROOT)/stad/Export_Inc \
- $(LOCAL_PATH)/$(WILINK_ROOT)/stad/src/Sta_Management \
- $(LOCAL_PATH)/$(WILINK_ROOT)/stad/src/Application \
- $(LOCAL_PATH)/$(WILINK_ROOT)/utils \
- $(LOCAL_PATH)/$(WILINK_ROOT)/Txn \
- $(LOCAL_PATH)/$(WILINK_ROOT)/TWD/TWDriver \
- $(LOCAL_PATH)/$(WILINK_ROOT)/TWD/FirmwareApi \
- $(LOCAL_PATH)/$(WILINK_ROOT)/TWD/FW_Transfer/Export_Inc \
- $(LOCAL_PATH)/$(WILINK_ROOT)/TWD/TwIf \
- $(LOCAL_PATH)/$(WILINK_ROOT)/platforms/os/linux/inc \
- $(LOCAL_PATH)/$(WILINK_ROOT)/platforms/os/common/inc \
- $(LOCAL_PATH)/$(WILINK_ROOT)/TWD/FirmwareApi \
- $(LOCAL_PATH)/$(CUDK_ROOT)/configurationutility/inc \
- $(WPA_SUPPL_DIR_INCLUDE)
-
-LOCAL_MODULE := libtiOsLib
-
-include $(BUILD_STATIC_LIBRARY)
diff --git a/wl1271/CUDK/os/linux/src/ParsEvent.c b/wl1271/CUDK/os/linux/src/ParsEvent.c
deleted file mode 100644
index 43d65b0..0000000
--- a/wl1271/CUDK/os/linux/src/ParsEvent.c
+++ /dev/null
@@ -1,279 +0,0 @@
-/*
- * ParsEvent.c
- *
- * Copyright 2001-2009 Texas Instruments, Inc. - http://www.ti.com/
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/****************************************************************************
-*
-* MODULE: ParsEvent.c
-*
-* PURPOSE:
-*
-* DESCRIPTION:
-* ============
-*
-*
-****************************************************************************/
-
-/* includes */
-/************/
-#include <stdint.h>
-#include <sys/types.h>
-#ifdef ANDROID
-#include <net/if_ether.h>
-#else
-#include <netinet/if_ether.h>
-#endif
-#include <linux/rtnetlink.h>
-#include <net/if.h>
-#include <linux/wireless.h>
-#include "ParsEvent.h"
-#include "cu_osapi.h"
-
-#define IW_DESCR_FLAG_NONE 0x0000
-#define IW_DESCR_FLAG_DUMP 0x0001
-#define IW_DESCR_FLAG_EVENT 0x0002
-#define IW_DESCR_FLAG_RESTRICT 0x0004
-#define IW_DESCR_FLAG_NOMAX 0x0008
-#define IW_DESCR_FLAG_WAIT 0x0100
-
-/* local types */
-/***************/
-static int ParsEvent_GetEventParam( unsigned short uEventCmd,
- unsigned int* uEventLen,
- unsigned int* pEventFlag,
- unsigned short* pMaxPayload,
- unsigned short* pPayloadNum,
- unsigned int* bIsPoint);
-/**
- * \fn ParsEvent_GetEvent()
- * \brief get next event from the event stream.
- * support the following events that CLI uses: SIOCGIWAP, SIOCGIWESSID, SIOCGIWNAME, SIOCGIWMODE,
- * SIOCGIWFREQ, IWEVQUAL, SIOCGIWENCODE, SIOCGIWRATE, IWEVCUSTOM,
- * IWEVMICHAELMICFAILURE, SIOCGIWSCAN, IWEVASSOCREQIE, IWEVASSOCRESPIE,
- * IWEVPMKIDCAND.
- * \note
- * \param pEventStream - Event stream pointer.
- * \param pEvent - return Event.
- * \return value > 0 meens valide event
- * \sa
- */
-int ParsEvent_GetEvent(struct stream_descr* pEventStream, struct iw_event* pEvent)
-
-{
- unsigned int uStatus = 0;
- char* pPtr;
- unsigned int uEventLen = 1;
- unsigned int uDataLen = 0;
- unsigned int uEventFlag = 0;
- unsigned short uMaxPayload = 0;
- unsigned short uPayloadNum = 0;
- unsigned int uMoreLen;
- unsigned int bIsPoint = 0;
-
- /* Check validity */
- if((pEventStream->current + IW_EV_LCP_LEN) > pEventStream->end)
- {
- return 0;
- }
-
- /* copy tha event */
- os_memcpy((char *)pEvent, pEventStream->current, IW_EV_LCP_LEN);
-
- /* Check validity */
- if(pEvent->len <= IW_EV_LCP_LEN)
- {
- return 0;
- }
-
- /* get event parameters */
- uStatus = ParsEvent_GetEventParam( pEvent->cmd, &uEventLen, &uEventFlag, &uMaxPayload, &uPayloadNum, &bIsPoint);
-
- if(uEventLen <= IW_EV_LCP_LEN)
- {
- /* jump to next event */
- pEventStream->current += pEvent->len;
- return 1;
- }
-
- /* get payload */
- if(pEventStream->value == NULL)
- {
- pPtr = pEventStream->current + IW_EV_LCP_LEN;
- }
- else
- {
- pPtr = pEventStream->value;
- }
-
- uDataLen = uEventLen - IW_EV_LCP_LEN;
-
- /* Check validity */
- if((pPtr + uDataLen) > pEventStream->end)
- {
- /* jump to next event */
- pEventStream->current += pEvent->len;
- return 0;
- }
-
- if(bIsPoint == TRUE)
- {
- os_memcpy((char *) pEvent + IW_EV_LCP_LEN + IW_EV_POINT_OFF, pPtr, uDataLen);
- }
- else
- {
- os_memcpy((char *) pEvent + IW_EV_LCP_LEN, pPtr, uDataLen);
- }
-
- /* jump to next event */
- pPtr = pPtr + uDataLen;
-
- if(bIsPoint == FALSE)
- {
- /* verify more values */
- if((pPtr + uDataLen) > (pEventStream->current + pEvent->len))
- {
- pEventStream->current += pEvent->len;
- pEventStream->value = NULL;
- }
- else
- {
- pEventStream->value = pPtr;
- }
-
- }
- else
- {
- uMoreLen = pEvent->len - uEventLen;
-
- if((uMoreLen == 0) ||
- ( uStatus == 0) ||
- (!(uEventFlag & IW_DESCR_FLAG_NOMAX) && (pEvent->u.data.length > uMaxPayload)) ||
- ((pEvent->u.data.length * uPayloadNum) > uMoreLen)
- )
- {
- pEvent->u.data.pointer = NULL;
- }
- else
- {
- pEvent->u.data.pointer = pPtr;
- }
-
- pEventStream->current += pEvent->len;
- }
-
- return 1;
-}
-
-
-static int ParsEvent_GetEventParam( unsigned short uEventCmd,
- unsigned int* uEventLen,
- unsigned int* pEventFlag,
- unsigned short* pMaxPayload,
- unsigned short* pPayloadNum,
- unsigned int* bIsPoint)
-{
-
- switch(uEventCmd)
- {
- case SIOCGIWAP:
- *uEventLen = IW_EV_ADDR_LEN;
- *pEventFlag = IW_DESCR_FLAG_DUMP;
- *bIsPoint = FALSE;
- break;
-
- case SIOCGIWESSID:
- *uEventLen = IW_EV_POINT_LEN;
- *pEventFlag = IW_DESCR_FLAG_DUMP;
- *pMaxPayload = IW_ESSID_MAX_SIZE + 1;
- *pPayloadNum = 1;
- *bIsPoint = TRUE;
- break;
-
- case SIOCGIWNAME:
- *uEventLen = IW_EV_CHAR_LEN;
- *pEventFlag = IW_DESCR_FLAG_DUMP;
- *bIsPoint = FALSE;
- break;
- case SIOCGIWMODE:
- *uEventLen = IW_EV_UINT_LEN;
- *pEventFlag = IW_DESCR_FLAG_DUMP;
- *bIsPoint = FALSE;
- break;
- case SIOCGIWFREQ:
- *uEventLen = IW_EV_FREQ_LEN;
- *pEventFlag = IW_DESCR_FLAG_DUMP;
- *bIsPoint = FALSE;
- break;
- case IWEVQUAL:
- *uEventLen = IW_EV_QUAL_LEN;
- *bIsPoint = FALSE;
- break;
- case SIOCGIWENCODE:
- *uEventLen = IW_EV_POINT_LEN;
- *pEventFlag = IW_DESCR_FLAG_DUMP | IW_DESCR_FLAG_RESTRICT;
- *pMaxPayload = IW_ENCODING_TOKEN_MAX;
- *pPayloadNum = 1;
- *bIsPoint = TRUE;
- break;
- case SIOCGIWRATE:
- *uEventLen = IW_EV_PARAM_LEN;
- *bIsPoint = FALSE;
- break;
- case IWEVCUSTOM:
- *uEventLen = IW_EV_POINT_LEN;
- *pMaxPayload = IW_CUSTOM_MAX;
- *pPayloadNum = 1;
- *bIsPoint = TRUE;
- break;
- case IWEVMICHAELMICFAILURE:
- *uEventLen = IW_EV_POINT_LEN;
- *pMaxPayload = sizeof(struct iw_michaelmicfailure);
- *pPayloadNum = 1;
- *bIsPoint = TRUE;
- break;
- case SIOCGIWSCAN:
- *uEventLen = IW_EV_POINT_LEN;
- *pEventFlag = IW_DESCR_FLAG_NOMAX;
- *pMaxPayload = IW_SCAN_MAX_DATA;
- *pPayloadNum = 1;
- *bIsPoint = TRUE;
- break;
- case IWEVASSOCREQIE:
- *uEventLen = IW_EV_POINT_LEN;
- *pMaxPayload = IW_GENERIC_IE_MAX;
- *pPayloadNum = 1;
- *bIsPoint = TRUE;
- break;
- case IWEVASSOCRESPIE :
- *uEventLen = IW_EV_POINT_LEN;
- *pMaxPayload = IW_GENERIC_IE_MAX;
- *pPayloadNum = 1;
- *bIsPoint = TRUE;
- break;
- case IWEVPMKIDCAND:
- *uEventLen = IW_EV_POINT_LEN;
- *pMaxPayload = sizeof(struct iw_pmkid_cand);
- *pPayloadNum = 1;
- *bIsPoint = TRUE;
- break;
- default:
- return 0;
- }
-
- return 1;
-}
-
diff --git a/wl1271/CUDK/os/linux/src/cu_wext.c b/wl1271/CUDK/os/linux/src/cu_wext.c
deleted file mode 100644
index 39189ad..0000000
--- a/wl1271/CUDK/os/linux/src/cu_wext.c
+++ /dev/null
@@ -1,488 +0,0 @@
-/*
- * cu_wext.c
- *
- * Copyright 2001-2009 Texas Instruments, Inc. - http://www.ti.com/
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/****************************************************************************
-*
-* MODULE: CU_Wext.c
-*
-* PURPOSE:
-*
-* DESCRIPTION:
-* ============
-*
-*
-****************************************************************************/
-
-/* includes */
-/************/
-#include "cu_osapi.h"
-#include "oserr.h"
-#include <net/if.h>
-#include <linux/rtnetlink.h>
-#include <linux/wireless.h>
-#include <string.h>
-#include <stdlib.h>
-
-#include "TWDriver.h"
-#include "STADExternalIf.h"
-#include "ParsEvent.h"
-#include "ipc_sta.h"
-#include "cu_os.h"
-
-/* defines */
-/***********/
-
-/* local types */
-/***************/
-/* Module control block */
-typedef struct
-{
- THandle hIpcSta;
- union iwreq_data req_data;
-
- struct iw_scan_req *scan_req;
- U16 scan_flag;
-} TCuWext;
-
-/* local variables */
-/*******************/
-
-/* local fucntions */
-/*******************/
-static S32 CuWext_FillBssidList(struct iw_event *iwe, OS_802_11_BSSID_EX* bssidList, S32 index)
-{
- S32 res = 0;
- switch(iwe->cmd)
- {
- case SIOCGIWAP:
- os_memcpy(bssidList[index].MacAddress, iwe->u.ap_addr.sa_data, MAC_ADDR_LEN);
- bssidList[index].Configuration.BeaconPeriod = 0; /* default configuration */
- res = 1;
- break;
- case SIOCGIWESSID:
- bssidList[index-1].Ssid.SsidLength = iwe->u.data.length;
- os_memcpy(bssidList[index-1].Ssid.Ssid, iwe->u.data.pointer, bssidList[index-1].Ssid.SsidLength);
- if(iwe->u.data.length != MAX_SSID_LEN)
- bssidList[index-1].Ssid.Ssid[bssidList[index-1].Ssid.SsidLength] = 0;
- break;
- case SIOCGIWNAME:
- {
- unsigned i;
- S8 buffer[IFNAMSIZ];
- static const char *ieee80211_modes[] = {
- "?",
- "IEEE 802.11 B",
- "IEEE 802.11 A",
- "IEEE 802.11 BG",
- "IEEE 802.11 ABG" };
-
- os_memset(buffer, 0, IFNAMSIZ);
- os_memcpy(buffer, iwe->u.name, IFNAMSIZ);
- for(i=0;i<SIZE_ARR(ieee80211_modes); i++)
- if (0 == os_strcmp((PS8)ieee80211_modes[i], buffer))
- break;
- bssidList[index-1].NetworkTypeInUse = i;
- }
- break;
- case SIOCGIWMODE:
- if(iwe->u.mode == IW_MODE_ADHOC)
- bssidList[index-1].InfrastructureMode = os802_11IBSS;
- else if (iwe->u.mode == IW_MODE_INFRA)
- bssidList[index-1].InfrastructureMode = os802_11Infrastructure;
- else if (iwe->u.mode == IW_MODE_AUTO)
- bssidList[index-1].InfrastructureMode = os802_11AutoUnknown;
- else
- bssidList[index-1].InfrastructureMode = os802_11InfrastructureMax;
-
- break;
- case SIOCGIWFREQ:
- bssidList[index-1].Configuration.Union.channel = iwe->u.freq.m;
- break;
- case IWEVQUAL:
- bssidList[index-1].Rssi = (S8)iwe->u.qual.level;
- break;
- case SIOCGIWENCODE:
- if(iwe->u.data.flags == (IW_ENCODE_ENABLED | IW_ENCODE_NOKEY))
- {
- bssidList[index-1].Privacy = TRUE;
- bssidList[index-1].Capabilities |= CAP_PRIVACY_MASK<<CAP_PRIVACY_SHIFT;
- }
- else
- {
- bssidList[index-1].Privacy = FALSE;
- bssidList[index-1].Capabilities &= ~(CAP_PRIVACY_MASK<<CAP_PRIVACY_SHIFT);
- }
- break;
- case SIOCGIWRATE:
- break;
- case IWEVCUSTOM:
- {
- S8 buffer[100];
-
- os_memset(buffer, 0, 100);
- os_memcpy(buffer, iwe->u.data.pointer, iwe->u.data.length);
-
- if(!os_strncmp(buffer, (PS8)"Bcn", 3))
- {
- char *p1;
- p1 = strtok(&buffer[10], " ");
- bssidList[index-1].Configuration.BeaconPeriod = atoi(p1);
- }
- }
- break;
- }
-
- return res;
-}
-
-
-/* functions */
-/*************/
-
-THandle CuOs_Create(THandle hIpcSta)
-{
- TCuWext* pCuWext = (TCuWext*)os_MemoryCAlloc(sizeof(TCuWext), sizeof(U8));
- if(pCuWext == NULL)
- {
- os_error_printf(CU_MSG_ERROR, (PS8)"ERROR - CuOs_Create - cant allocate control block\n");
- return NULL;
- }
-
- pCuWext->hIpcSta = hIpcSta;
-
- return pCuWext;
-}
-
-VOID CuOs_Destroy(THandle hCuWext)
-{
- TCuWext* pCuWext = (TCuWext*)hCuWext;
-
- os_MemoryFree(pCuWext);
-}
-
-S32 CuOs_Get_SSID(THandle hCuWext, OS_802_11_SSID* ssid)
-{
- TCuWext* pCuWext = (TCuWext*)hCuWext;
- S32 res;
-
- os_memset(ssid->Ssid, 0, sizeof(OS_802_11_SSID) - sizeof(U32));
-
- pCuWext->req_data.essid.pointer = (PVOID)ssid->Ssid;
- pCuWext->req_data.essid.length = sizeof(OS_802_11_SSID) - sizeof(U32);
- pCuWext->req_data.essid.flags = 0;
-
- res = IPC_STA_Wext_Send(pCuWext->hIpcSta, SIOCGIWESSID, &pCuWext->req_data, sizeof(struct iw_point));
- if(res != OK)
- return res;
-
- ssid->SsidLength = pCuWext->req_data.essid.length;
-
- return OK;
-}
-
-S32 CuOs_Get_BSSID(THandle hCuWext, TMacAddr bssid)
-{
- TCuWext* pCuWext = (TCuWext*)hCuWext;
- S32 res,i;
-
- os_memset(&pCuWext->req_data.ap_addr, 0x00, sizeof(struct sockaddr));
-
- res = IPC_STA_Wext_Send(pCuWext->hIpcSta, SIOCGIWAP, &pCuWext->req_data, sizeof(struct sockaddr));
- if(res != OK)
- return res;
-
- for(i=0;i<MAC_ADDR_LEN;i++)
- bssid[i] = pCuWext->req_data.ap_addr.sa_data[i];
-
- return OK;
-}
-
-S32 CuOs_GetCurrentChannel(THandle hCuWext, U32* channel)
-{
- TCuWext* pCuWext = (TCuWext*)hCuWext;
- S32 res;
-
- pCuWext->req_data.freq.m = 0;
-
- res = IPC_STA_Wext_Send(pCuWext->hIpcSta, SIOCGIWFREQ, &pCuWext->req_data, sizeof(struct iw_freq ));
- if(res != OK)
- return res;
-
- *channel = pCuWext->req_data.freq.m;
-
- return OK;
-}
-
-/*Usage example of SIOCGIWSTATS. This WEXT is used by wireless tools such as iwconfig, iwlib etc.*/
-S32 CuOs_GetCurrentStats(THandle hCuWext, S32* rssi)
-{
- TCuWext* pCuWext = (TCuWext*)hCuWext;
- S32 res;
- struct iw_statistics stat;
- *rssi = 0;
-
- pCuWext->req_data.data.pointer = &stat;
-
- res = IPC_STA_Wext_Send(pCuWext->hIpcSta, SIOCGIWSTATS, &pCuWext->req_data, sizeof(struct iw_statistics));
- if(res != OK)
- return res;
-
- *rssi = stat.qual.level;
-
- return OK;
-}
-
-S32 CuOs_Start_Scan(THandle hCuWext, OS_802_11_SSID* ssid, U8 scanType)
-{
- TCuWext* pCuWext = (TCuWext*)hCuWext;
- struct iw_scan_req tReq;
- S32 res;
-
- if (ssid->SsidLength > IW_ESSID_MAX_SIZE)
- {
- os_error_printf(CU_MSG_ERROR, (PS8)"ERROR - CuOs_Start_Scan - too long SSID (%lu)\n",ssid->SsidLength);
- return OSAL_ERROR;
- }
-
- if (ssid->Ssid[0] && ssid->SsidLength)
- {
- os_memset(&tReq, 0, sizeof(tReq));
- tReq.essid_len = ssid->SsidLength;
- /*
- * tReq.bssid.sa_family = ARPHRD_ETHER;
- * os_memset(tReq.bssid.sa_data, 0xff, ETH_ALEN);
- */
- os_memcpy(tReq.essid, ssid->Ssid, ssid->SsidLength);
- pCuWext->scan_req = &tReq;
- pCuWext->req_data.data.flags = IW_SCAN_THIS_ESSID;
- }
- else
- {
- pCuWext->req_data.data.flags = 0;
- }
-
- tReq.scan_type = scanType;
- pCuWext->req_data.data.pointer = &tReq;
- pCuWext->req_data.data.length = sizeof(struct iw_scan_req);
-
- res = IPC_STA_Wext_Send(pCuWext->hIpcSta, SIOCSIWSCAN, &pCuWext->req_data, sizeof(struct iw_point));
- if(res != OK)
- return res;
-
- return OK;
-}
-
-S32 CuOs_GetBssidList(THandle hCuWext, OS_802_11_BSSID_LIST_EX *bssidList)
-{
- TCuWext* pCuWext = (TCuWext*)hCuWext;
- S32 res, NumberOfItems;
-
- /* allocate the scan result buffer */
- U8* buffer = os_MemoryCAlloc(IW_SCAN_MAX_DATA, sizeof(U8));
- if(buffer == NULL)
- {
- os_error_printf(CU_MSG_ERROR, (PS8)"ERROR - CuOs_Get_BssidList - cant allocate scan result buffer\n");
- return EOALERR_CU_WEXT_ERROR_CANT_ALLOCATE;
- }
-
- NumberOfItems = 0;
- pCuWext->req_data.data.pointer = buffer;
- pCuWext->req_data.data.flags = 0;
- do
- {
- pCuWext->req_data.data.length = IW_SCAN_MAX_DATA;
-
- res = IPC_STA_Wext_Send(pCuWext->hIpcSta, SIOCGIWSCAN, &pCuWext->req_data, sizeof(struct iw_point));
- if(res != OK)
- {
- os_MemoryFree(buffer);
- return res;
- }
-
- /* parse the scan results */
- if(pCuWext->req_data.data.length)
- {
- struct iw_event iwe;
- struct stream_descr stream;
- S32 ret;
-
- /* init the event stream */
- os_memset((char *)&stream, '\0', sizeof(struct stream_descr));
- stream.current = (char *)buffer;
- stream.end = (char *)(buffer + pCuWext->req_data.data.length);
-
- do
- {
- /* Extract an event and print it */
- ret = ParsEvent_GetEvent(&stream, &iwe);
- if(ret > 0)
- NumberOfItems += CuWext_FillBssidList(&iwe, bssidList->Bssid, NumberOfItems);
- }
- while(ret > 0);
- }
-
- } while(pCuWext->req_data.data.flags);
-
- bssidList->NumberOfItems = NumberOfItems;
-
- /* free the scan result buffer */
- os_MemoryFree(buffer);
-
- return OK;
-}
-
-
-S32 CuOs_Set_BSSID(THandle hCuWext, TMacAddr bssid)
-{
- TCuWext* pCuWext = (TCuWext*)hCuWext;
- S32 res;
-
- os_memcpy(pCuWext->req_data.ap_addr.sa_data, bssid, MAC_ADDR_LEN);
-
- res = IPC_STA_Wext_Send(pCuWext->hIpcSta, SIOCSIWAP, &pCuWext->req_data, sizeof(struct sockaddr));
-
- if(res != OK)
- return res;
-
- return OK;
-}
-
-S32 CuOs_Set_ESSID(THandle hCuWext, OS_802_11_SSID* ssid)
-{
- TCuWext* pCuWext = (TCuWext*)hCuWext;
- S32 res;
-
- pCuWext->req_data.essid.pointer = (PVOID)ssid->Ssid;
- pCuWext->req_data.essid.length = ssid->SsidLength;
- if(ssid->SsidLength)
- pCuWext->req_data.essid.flags = 1;
- else
- pCuWext->req_data.essid.flags = 0;
- pCuWext->req_data.essid.flags |= SET_SSID_WITHOUT_SUPPL;
-
- res = IPC_STA_Wext_Send(pCuWext->hIpcSta, SIOCSIWESSID, &pCuWext->req_data, sizeof(struct sockaddr));
-
- if(res != OK)
- return res;
-
- return OK;
-}
-
-S32 CuOs_GetTxPowerLevel(THandle hCuWext, S32* pTxPowerLevel)
-{
- TCuWext* pCuWext = (TCuWext*)hCuWext;
- S32 res;
-
- os_memset(&pCuWext->req_data.txpower, 0, sizeof(struct iw_param));
-
- res = IPC_STA_Wext_Send(pCuWext->hIpcSta, SIOCGIWTXPOW, &pCuWext->req_data, sizeof(struct iw_param));
-
- if(res != OK)
- return res;
-
- *pTxPowerLevel = pCuWext->req_data.txpower.value;
-
- return OK;
-}
-
-S32 CuOs_SetTxPowerLevel(THandle hCuWext, S32 txPowerLevel)
-{
- TCuWext* pCuWext = (TCuWext*)hCuWext;
- S32 res;
-
- os_memset(&pCuWext->req_data.txpower, 0, sizeof(struct iw_param));
-
- pCuWext->req_data.txpower.value = txPowerLevel;
-
- res = IPC_STA_Wext_Send(pCuWext->hIpcSta, SIOCSIWTXPOW, &pCuWext->req_data, sizeof(struct iw_param));
-
- if(res != OK)
- return res;
-
- return OK;
-}
-
-S32 CuOs_GetRtsTh(THandle hCuWext, PS32 pRtsTh)
-{
- TCuWext* pCuWext = (TCuWext*)hCuWext;
- S32 res;
-
- os_memset(&pCuWext->req_data.rts, 0, sizeof(struct iw_param));
-
- res = IPC_STA_Wext_Send(pCuWext->hIpcSta, SIOCGIWRTS, &pCuWext->req_data, sizeof(struct iw_param));
- if(res != OK)
- return res;
-
- *pRtsTh = pCuWext->req_data.rts.value;
-
- return OK;
-}
-
-
-S32 CuOs_SetRtsTh(THandle hCuWext, S32 RtsTh)
-{
- TCuWext* pCuWext = (TCuWext*)hCuWext;
- S32 res;
-
- os_memset(&pCuWext->req_data.rts, 0, sizeof(struct iw_param));
- pCuWext->req_data.rts.value = RtsTh;
-
- res = IPC_STA_Wext_Send(pCuWext->hIpcSta, SIOCSIWRTS, &pCuWext->req_data, sizeof(struct iw_param));
- if(res != OK)
- return res;
-
-
-
- return OK;
-}
-
-S32 CuOs_GetFragTh(THandle hCuWext, PS32 pFragTh)
-{
- TCuWext* pCuWext = (TCuWext*)hCuWext;
- S32 res;
-
- os_memset(&pCuWext->req_data.frag, 0, sizeof(struct iw_param));
-
- res = IPC_STA_Wext_Send(pCuWext->hIpcSta, SIOCGIWFRAG, &pCuWext->req_data, sizeof(struct iw_param));
- if(res != OK)
- return res;
-
- *pFragTh = pCuWext->req_data.frag.value;
-
- return OK;
-}
-
-S32 CuOs_SetFragTh(THandle hCuWext, S32 FragTh)
-{
- TCuWext* pCuWext = (TCuWext*)hCuWext;
- S32 res;
-
- os_memset(&pCuWext->req_data.frag, 0, sizeof(struct iw_param));
- pCuWext->req_data.frag.value = FragTh;
-
- res = IPC_STA_Wext_Send(pCuWext->hIpcSta, SIOCSIWFRAG, &pCuWext->req_data, sizeof(struct iw_param));
- if(res != OK)
- return res;
-
- return OK;
-}
-/*stab function (should be filled later on for Linux to get ThreadID of the WLAN driver*/
-S32 CuOs_GetDriverThreadId(THandle hCuWext, U32* threadid)
-{
- return OK;
-}
diff --git a/wl1271/CUDK/os/linux/src/ipc_event.c b/wl1271/CUDK/os/linux/src/ipc_event.c
deleted file mode 100644
index e8be991..0000000
--- a/wl1271/CUDK/os/linux/src/ipc_event.c
+++ /dev/null
@@ -1,679 +0,0 @@
-/*
- * ipc_event.c
- *
- * Copyright 2001-2009 Texas Instruments, Inc. - http://www.ti.com/
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/****************************************************************************
-*
-* MODULE: IPC_Event.c
-*
-* PURPOSE:
-*
-* DESCRIPTION:
-* ============
-*
-*
-****************************************************************************/
-
-/* includes */
-/************/
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <net/if.h>
-#include <linux/rtnetlink.h>
-#include <signal.h>
-#include <sys/mman.h>
-#include <unistd.h>
-#include <linux/wireless.h>
-#include "cu_osapi.h"
-#include "oserr.h"
-
-#include "TWDriver.h"
-#include "STADExternalIf.h"
-
-#include "ParsEvent.h"
-#include "ipc_event.h"
-
-/* defines */
-/***********/
-#define PIPE_READ 0
-#define PIPE_WRITE 1
-#define IPC_EVENT_KEY ((key_t)123456789)
-
-/* IPC evemt messages to child */
-#define IPC_EVENT_MSG_KILL "IPC_EVENT_MSG_KILL"
-#define IPC_EVENT_MSG_UPDATE_DEBUG_LEVEL "IPC_EVENT_MSG_UPDATE_DEBUG_LEVEL"
-#define IPC_EVENT_MSG_MAX_LEN 50
-
-/* local types */
-/***************/
-typedef struct IpcEvent_Shared_Memory_t
-{
- int pipe_fields[2];
- u64 event_mask;
- union
- {
- S32 debug_level;
- } content;
-} IpcEvent_Shared_Memory_t;
-
-/* Module control block */
-typedef struct IpcEvent_t
-{
- IpcEvent_Shared_Memory_t* p_shared_memory;
- S32 child_process_id;
- S32 pipe_to_child;
-} IpcEvent_t;
-
-typedef struct IpcEvent_Child_t
-{
- S32 STA_socket;
- IpcEvent_Shared_Memory_t* p_shared_memory;
- S32 pipe_from_parent;
-} IpcEvent_Child_t;
-
-/* local variables */
-/*******************/
-VOID g_tester_send_event(U8 event_index);
-/* local fucntions */
-/*******************/
-static VOID IpcEvent_SendMessageToChild(IpcEvent_t* pIpcEvent, PS8 msg)
-{
- write(pIpcEvent->pipe_to_child, msg, os_strlen(msg));
-}
-
-static S32 IpcEvent_Sockets_Open(VOID)
-{
- S32 skfd;
- struct sockaddr_nl local;
-
- skfd = socket(PF_NETLINK, SOCK_RAW, NETLINK_ROUTE);
- if (skfd < 0)
- {
- return -1;
- }
-
- os_memset(&local, 0, sizeof(local));
- local.nl_family = AF_NETLINK;
- local.nl_groups = RTMGRP_LINK;
- if (bind(skfd, (struct sockaddr *) &local, sizeof(local)) < 0)
- {
- close(skfd);
- return -2;
- }
-
- return skfd;
-}
-
-static inline VOID IpcEvent_Sockets_Close(S32 skfd)
-{
- close(skfd);
-}
-
-void ProcessLoggerMessage(PU8 data, U16 len);
-
-static VOID IpcEvent_PrintEvent(IpcEvent_Child_t* pIpcEventChild, U32 EventId, TI_UINT8* pData, S32 DataLen)
-{
-
- if(pIpcEventChild->p_shared_memory->event_mask & ((u64)1<<EventId))
- {
- switch(EventId)
- {
- case IPC_EVENT_DISASSOCIATED:
- {
- OS_802_11_DISASSOCIATE_REASON_T *pDisAssoc;
-
- if (NULL == pData)
- {
- return;
- }
- else
- {
- pDisAssoc = (OS_802_11_DISASSOCIATE_REASON_T*)pData;
- }
-
- switch(pDisAssoc->eDisAssocType)
- {
- case OS_DISASSOC_STATUS_UNSPECIFIED:
- os_error_printf(CU_MSG_ERROR, "CLI Event - Disassociated with unspecified reason (User/SG/Recovery)\n");
- break;
- case OS_DISASSOC_STATUS_AUTH_REJECT:
- if (pDisAssoc->uStatusCode == STATUS_PACKET_REJ_TIMEOUT)
- {
- os_error_printf(CU_MSG_ERROR, "CLI Event - Disassociated due to no Auth response \n");
- }
- else
- {
- os_error_printf(CU_MSG_ERROR, "CLI Event - Disassociated due to Auth response packet with reason = %d\n", pDisAssoc->uStatusCode);
- }
- break;
- case OS_DISASSOC_STATUS_ASSOC_REJECT:
- if (pDisAssoc->uStatusCode == STATUS_PACKET_REJ_TIMEOUT)
- {
- os_error_printf(CU_MSG_ERROR, "CLI Event - Disassociated due to no Assoc response \n");
- }
- else
- {
- os_error_printf(CU_MSG_ERROR, "CLI Event - Disassociated due to Assoc response packet with reason = %d\n", pDisAssoc->uStatusCode);
- }
- break;
- case OS_DISASSOC_STATUS_SECURITY_FAILURE:
- os_error_printf(CU_MSG_ERROR, "CLI Event - Disassociated due to RSN failure\n");
- break;
- case OS_DISASSOC_STATUS_AP_DEAUTHENTICATE:
- os_error_printf(CU_MSG_ERROR, "CLI Event - Disassociated due to AP deAuthenticate packet with reason = %d\n", pDisAssoc->uStatusCode);
- break;
- case OS_DISASSOC_STATUS_AP_DISASSOCIATE:
- os_error_printf(CU_MSG_ERROR, "CLI Event - Disassociated due to AP disAssoc packet with reason = %d\n", pDisAssoc->uStatusCode);
- break;
- case OS_DISASSOC_STATUS_ROAMING_TRIGGER:
- os_error_printf(CU_MSG_ERROR, "CLI Event - Disassociated due to roaming trigger = %d\n", pDisAssoc->uStatusCode);
- break;
- default:
- os_error_printf(CU_MSG_ERROR, "CLI Event - Disassociated with unknown reason = %d\n", pDisAssoc->eDisAssocType);
- break;
- }
-
- break; /* the end of the IPC_EVENT_DISASSOCIATED case */
- }
- case IPC_EVENT_ASSOCIATED:
- os_error_printf(CU_MSG_ERROR, (PS8)"IpcEvent_PrintEvent - received IPC_EVENT_ASSOCIATED\n");
- break;
- case IPC_EVENT_MEDIA_SPECIFIC:
- os_error_printf(CU_MSG_ERROR, (PS8)"IpcEvent_PrintEvent - received IPC_EVENT_MEDIA_SPECIFIC\n");
- break;
- case IPC_EVENT_SCAN_COMPLETE:
- os_error_printf(CU_MSG_ERROR, (PS8)"IpcEvent_PrintEvent - received IPC_EVENT_SCAN_COMPLETE\n");
- break;
- /* custom events */
- case IPC_EVENT_SCAN_STOPPED:
- os_error_printf(CU_MSG_ERROR, (PS8)"IpcEvent_PrintEvent - received IPC_EVENT_SCAN_STOPPED\n");
- break;
- case IPC_EVENT_LINK_SPEED:
- os_error_printf(CU_MSG_ERROR, (PS8)"IpcEvent_PrintEvent - received IPC_EVENT_LINK_SPEED\n");
- break;
- case IPC_EVENT_AUTH_SUCC:
- os_error_printf(CU_MSG_ERROR, (PS8)"IpcEvent_PrintEvent - received IPC_EVENT_AUTH_SUCC\n");
- break;
- case IPC_EVENT_CCKM_START:
- os_error_printf(CU_MSG_ERROR, (PS8)"IpcEvent_PrintEvent - received IPC_EVENT_CCKM_START\n");
- break;
- case IPC_EVENT_EAPOL:
- os_error_printf(CU_MSG_ERROR, (PS8)"IpcEvent_PrintEvent - received IPC_EVENT_EAPOL\n");
- break;
- case IPC_EVENT_RE_AUTH_STARTED:
- os_error_printf(CU_MSG_ERROR, (PS8)"IpcEvent_PrintEvent - received IPC_EVENT_RE_AUTH_STARTED\n");
- break;
- case IPC_EVENT_RE_AUTH_COMPLETED:
- os_error_printf(CU_MSG_ERROR, (PS8)"IpcEvent_PrintEvent - received IPC_EVENT_RE_AUTH_COMPLETED\n");
- break;
- case IPC_EVENT_RE_AUTH_TERMINATED:
- os_error_printf(CU_MSG_ERROR, (PS8)"IpcEvent_PrintEvent - received IPC_EVENT_RE_AUTH_TERMINATED\n");
- break;
- case IPC_EVENT_BOUND:
- os_error_printf(CU_MSG_ERROR, (PS8)"IpcEvent_PrintEvent - received IPC_EVENT_BOUND\n");
- break;
- case IPC_EVENT_UNBOUND:
- os_error_printf(CU_MSG_ERROR, (PS8)"IpcEvent_PrintEvent - received IPC_EVENT_UNBOUND\n");
- break;
- case IPC_EVENT_PREAUTH_EAPOL:
- os_error_printf(CU_MSG_ERROR, (PS8)"IpcEvent_PrintEvent - received IPC_EVENT_PREAUTH_EAPOL\n");
- break;
- case IPC_EVENT_LOW_RSSI:
- os_error_printf(CU_MSG_ERROR, (PS8)"IpcEvent_PrintEvent - received IPC_EVENT_LOW_RSSI\n");
- break;
- case IPC_EVENT_TSPEC_STATUS:
- os_error_printf(CU_MSG_ERROR, (PS8)"IpcEvent_PrintEvent - received IPC_EVENT_TSPEC_STATUS\n");
-
- OS_802_11_QOS_TSPEC_PARAMS* tspec = (OS_802_11_QOS_TSPEC_PARAMS*)pData;
- os_error_printf(CU_MSG_ERROR, "CLI Event - IPC_EVENT_TSPEC_STATUS -- (ReasonCode = %d) \n",tspec->uReasonCode);
- os_error_printf(CU_MSG_ERROR, "Tspec Parameters (as received through event handler):\n");
- os_error_printf(CU_MSG_ERROR, "-----------------------------------------------------\n");
- os_error_printf(CU_MSG_ERROR, "userPriority = %d\n",tspec->uUserPriority);
- os_error_printf(CU_MSG_ERROR, "uNominalMSDUsize = %d\n",tspec->uNominalMSDUsize);
- os_error_printf(CU_MSG_ERROR, "uMeanDataRate = %d\n",tspec->uMeanDataRate);
- os_error_printf(CU_MSG_ERROR, "uMinimumPHYRate = %d\n",tspec->uMinimumPHYRate);
- os_error_printf(CU_MSG_ERROR, "uSurplusBandwidthAllowance = %d\n",tspec->uSurplusBandwidthAllowance);
- os_error_printf(CU_MSG_ERROR, "uAPSDFlag = %d\n",tspec->uAPSDFlag);
- os_error_printf(CU_MSG_ERROR, "MinimumServiceInterval = %d\n",tspec->uMinimumServiceInterval);
- os_error_printf(CU_MSG_ERROR, "MaximumServiceInterval = %d\n",tspec->uMaximumServiceInterval);
- os_error_printf(CU_MSG_ERROR, "uMediumTime = %d\n\n",tspec->uMediumTime);
-
- break;
- case IPC_EVENT_TSPEC_RATE_STATUS:
- os_error_printf(CU_MSG_ERROR, (PS8)"IpcEvent_PrintEvent - received IPC_EVENT_TSPEC_RATE_STATUS\n");
- break;
- case IPC_EVENT_MEDIUM_TIME_CROSS:
- os_error_printf(CU_MSG_ERROR, (PS8)"IpcEvent_PrintEvent - received IPC_EVENT_MEDIUM_TIME_CROSS\n");
- break;
- case IPC_EVENT_ROAMING_COMPLETE:
- os_error_printf(CU_MSG_ERROR, (PS8)"IpcEvent_PrintEvent - received IPC_EVENT_ROAMING_COMPLETE\n");
- break;
- case IPC_EVENT_EAP_AUTH_FAILURE:
- os_error_printf(CU_MSG_ERROR, (PS8)"IpcEvent_PrintEvent - received IPC_EVENT_EAP_AUTH_FAILURE\n");
- break;
- case IPC_EVENT_WPA2_PREAUTHENTICATION:
- os_error_printf(CU_MSG_ERROR, (PS8)"IpcEvent_PrintEvent - received IPC_EVENT_WPA2_PREAUTHENTICATION\n");
- break;
- case IPC_EVENT_TRAFFIC_INTENSITY_THRESHOLD_CROSSED:
- {
- U32 *crossInfo = (U32 *)pData;
- os_error_printf(CU_MSG_ERROR, (PS8)"IpcEvent_PrintEvent - received IPC_EVENT_TRAFFIC_INTENSITY_THRESHOLD_CROSSED\n");
- os_error_printf(CU_MSG_ERROR, (PS8)"Threshold(High=0, Low=1) crossed= %d\n", crossInfo[0]);
- os_error_printf(CU_MSG_ERROR, (PS8)"Direction(Above=0, Below=1) crossed= %d\n", crossInfo[1]);
- break;
- }
- case IPC_EVENT_SCAN_FAILED:
- os_error_printf(CU_MSG_ERROR, (PS8)"IpcEvent_PrintEvent - received IPC_EVENT_SCAN_FAILED\n");
- break;
- case IPC_EVENT_WPS_SESSION_OVERLAP:
- os_error_printf(CU_MSG_ERROR, (PS8)"IpcEvent_PrintEvent - received IPC_EVENT_WPS_SESSION_OVERLAP\n");
- break;
- case IPC_EVENT_RSSI_SNR_TRIGGER:
- os_error_printf(CU_MSG_ERROR, (PS8)"IpcEvent_PrintEvent - received IPC_EVENT_RSSI_SNR_TRIGGER (index = %d), Data = %d\n", (S8)(*(pData + 2) - 1),(S8)(*pData));
- break;
- case IPC_EVENT_TIMEOUT:
- os_error_printf(CU_MSG_ERROR, (PS8)"IpcEvent_PrintEvent - received IPC_EVENT_TIMEOUT\n");
- break;
- case IPC_EVENT_GWSI:
- os_error_printf(CU_MSG_ERROR, (PS8)"IpcEvent_PrintEvent - received IPC_EVENT_GWSI\n");
- break;
- case IPC_EVENT_LOGGER:
-#ifdef ETH_SUPPORT
- ProcessLoggerMessage(pData, (U16)DataLen);
-#endif
- break;
- default :
- os_error_printf(CU_MSG_ERROR, (PS8)"**** Unknow EventId %d ****\n", EventId);
- }
- }
-}
-
-static VOID IpcEvent_wext_event_wireless(IpcEvent_Child_t* pIpcEventChild, PS8 data, S32 len)
-{
- struct iw_event iwe;
- struct stream_descr stream;
- S32 ret;
- IPC_EV_DATA* pEvent;
- U32 EventId = 0;
-
- /* init the event stream */
- os_memset((char *)&stream, '\0', sizeof(struct stream_descr));
- stream.current = (char *)data;
- stream.end = (char *)(data + len);
-
- do
- {
- /* Extract an event and print it */
- ret = ParsEvent_GetEvent(&stream, &iwe);
-
- if(ret <= 0)
- break;
-
- switch (iwe.cmd)
- {
- case SIOCGIWAP:
- if((iwe.u.ap_addr.sa_data[0] == 0) &&
- (iwe.u.ap_addr.sa_data[1] == 0) &&
- (iwe.u.ap_addr.sa_data[2] == 0) &&
- (iwe.u.ap_addr.sa_data[3] == 0) &&
- (iwe.u.ap_addr.sa_data[4] == 0) &&
- (iwe.u.ap_addr.sa_data[5] == 0))
- {
- EventId=IPC_EVENT_DISASSOCIATED;
- IpcEvent_PrintEvent(pIpcEventChild, EventId, NULL,0);
- }
- else
- {
-#ifdef XCC_MODULE_INCLUDED
- /* Send a signal to the udhcpc application to trigger the renew request */
- system("killall -SIGUSR1 udhcpc");
-#endif
- EventId=IPC_EVENT_ASSOCIATED;
- IpcEvent_PrintEvent(pIpcEventChild, EventId, NULL,0);
- }
- break;
- case IWEVMICHAELMICFAILURE:
- EventId=IPC_EVENT_MEDIA_SPECIFIC;
- IpcEvent_PrintEvent(pIpcEventChild, EventId, NULL,0);
- break;
- case IWEVCUSTOM:
- pEvent = (IPC_EV_DATA*)iwe.u.data.pointer;
- if (pEvent)
- {
- EventId = (U32)pEvent->EvParams.uEventType;
- IpcEvent_PrintEvent (pIpcEventChild, EventId, pEvent->uBuffer, pEvent->uBufferSize);
- }
- break;
- case SIOCGIWSCAN:
- EventId=IPC_EVENT_SCAN_COMPLETE;
- IpcEvent_PrintEvent(pIpcEventChild, EventId, NULL,0);
- break;
- case IWEVASSOCREQIE:
- /* NOP */
- break;
- case IWEVASSOCRESPIE:
- /* NOP */
- break;
- case IWEVPMKIDCAND:
- EventId=IPC_EVENT_MEDIA_SPECIFIC;
- IpcEvent_PrintEvent(pIpcEventChild, EventId, NULL,0);
- break;
- }
-
- g_tester_send_event((U8) EventId);
-
- }
- while(1);
-}
-
-static VOID IpcEvent_wext_event_rtm_newlink(IpcEvent_Child_t* pIpcEventChild, struct nlmsghdr *h,
- S32 len)
-{
- struct ifinfomsg *ifi;
- S32 attrlen, nlmsg_len, rta_len;
- struct rtattr * attr;
-
- if (len < sizeof(*ifi))
- return;
-
- ifi = NLMSG_DATA(h);
-
- /*
- if ((if_nametoindex("wlan") != ifi->ifi_index) && (if_nametoindex("wifi") != ifi->ifi_index))
- {
- os_error_printf(CU_MSG_ERROR, "ERROR - IpcEvent_wext_event_rtm_newlink - Ignore event for foreign ifindex %d",
- ifi->ifi_index);
- return;
- }
- */
-
- nlmsg_len = NLMSG_ALIGN(sizeof(struct ifinfomsg));
-
- attrlen = h->nlmsg_len - nlmsg_len;
- if (attrlen < 0)
- return;
-
- attr = (struct rtattr *) (((char *) ifi) + nlmsg_len);
-
- rta_len = RTA_ALIGN(sizeof(struct rtattr));
- while (RTA_OK(attr, attrlen)) {
- if (attr->rta_type == IFLA_WIRELESS)
- {
- IpcEvent_wext_event_wireless(pIpcEventChild, ((PS8) attr) + rta_len,
- attr->rta_len - rta_len);
- }
- else if (attr->rta_type == IFLA_IFNAME)
- {
- os_error_printf(CU_MSG_WARNING, (PS8)"WARNING - IpcEvent_wext_event_rtm_newlink - unsupported rta_type = IFLA_IFNAME\n");
-
- }
- attr = RTA_NEXT(attr, attrlen);
- }
-}
-
-static VOID IpcEvent_Handle_STA_Event(IpcEvent_Child_t* pIpcEventChild)
-{
- S8 buf[512];
- S32 left;
- struct sockaddr_nl from;
- socklen_t fromlen;
- struct nlmsghdr *h;
-
- fromlen = sizeof(from);
- left = recvfrom(pIpcEventChild->STA_socket, buf, sizeof(buf), MSG_DONTWAIT,
- (struct sockaddr *) &from, &fromlen);
- if (left < 0)
- {
- os_error_printf(CU_MSG_ERROR, (PS8)"ERROR - IpcEvent_Handle_STA_Event - cant recv from socket %X .\n",
- pIpcEventChild->STA_socket);
- return;
- }
-
- h = (struct nlmsghdr *) buf;
-
- while (left >= sizeof(*h))
- {
- S32 len, plen;
-
- len = h->nlmsg_len;
- plen = len - sizeof(*h);
- if (len > left || plen < 0) {
- os_error_printf(CU_MSG_ERROR, (PS8)"ERROR - IpcEvent_Handle_STA_Event - Malformed netlink message: len=%d left=%d plen=%d",
- len, left, plen);
- break;
- }
-
- switch (h->nlmsg_type)
- {
- case RTM_NEWLINK:
- IpcEvent_wext_event_rtm_newlink(pIpcEventChild, h, plen);
- break;
- }
-
- len = NLMSG_ALIGN(len);
- left -= len;
- h = (struct nlmsghdr *) ((char *) h + len);
- }
-
- if (left > 0)
- {
- os_error_printf(CU_MSG_ERROR, (PS8)"ERROR - IpcEvent_Handle_STA_Event - %d extra bytes in the end of netlink ",
- left);
- IpcEvent_Handle_STA_Event(pIpcEventChild);
- }
-
-}
-
-static S32 IpcEvent_Handle_Parent_Event(IpcEvent_Child_t* pIpcEventChild)
-{
- S8 msg[IPC_EVENT_MSG_MAX_LEN];
-
- S32 msgLen = read(pIpcEventChild->pipe_from_parent,msg, IPC_EVENT_MSG_MAX_LEN);
- msg[msgLen] = 0;
-
- if(!os_strcmp(msg, (PS8)IPC_EVENT_MSG_KILL))
- {
- return TRUE;
- }
- if(!os_strcmp(msg, (PS8)IPC_EVENT_MSG_UPDATE_DEBUG_LEVEL))
- {
-/* g_debug_level= pIpcEventChild->p_shared_memory->content.debug_level;*/
- return FALSE;
- }else
- os_error_printf(CU_MSG_ERROR, (PS8)"ERROR - IpcEvent_Handle_Parent_Event - unknown msgLen=%d msg=|%s| \n",msgLen,msg);
-
- return FALSE;
-
-}
-
-static VOID IpcEvent_Child_Destroy(IpcEvent_Child_t* pIpcEventChild)
-{
- if(pIpcEventChild->STA_socket)
- {
- IpcEvent_Sockets_Close(pIpcEventChild->STA_socket);
- }
-
-}
-
-static VOID IpcEvent_Child(IpcEvent_Child_t* pIpcEventChild)
-{
- /* open the socket from the driver */
- pIpcEventChild->STA_socket = IpcEvent_Sockets_Open();
- if(pIpcEventChild->STA_socket < 0)
- {
- os_error_printf(CU_MSG_ERROR, (PS8)"ERROR - IpcEvent_Create - cant open socket for communication with the driver (%d)\n",pIpcEventChild->STA_socket);
- return;
- }
-
- while(1)
- {
- fd_set read_set; /* File descriptors for select */
- S32 ret;
-
- FD_ZERO(&read_set);
- FD_SET(pIpcEventChild->STA_socket, &read_set);
- FD_SET(pIpcEventChild->pipe_from_parent, &read_set);
-
-#ifndef ANDROID
- ret = select(max(pIpcEventChild->pipe_from_parent,pIpcEventChild->STA_socket) + 1,
- &read_set, NULL, NULL, NULL);
-#else
- ret = select(pIpcEventChild->STA_socket + 1,
- &read_set, NULL, NULL, NULL);
-#endif
-
- if(ret < 0)
- {
- os_error_printf(CU_MSG_ERROR, (PS8)"ERROR - IpcEvent_Child - Unhandled signal - exiting...\n");
- break;
- }
- if(ret == 0) { continue; } /* Check for interface discovery events. */
- if(FD_ISSET(pIpcEventChild->STA_socket, &read_set))
- IpcEvent_Handle_STA_Event(pIpcEventChild);
-
-#ifndef ANDROID
- if(FD_ISSET(pIpcEventChild->pipe_from_parent, &read_set))
- {
- S32 exit = IpcEvent_Handle_Parent_Event(pIpcEventChild);
- if(exit)
- break;
- }
-#endif
-
- }
-
- IpcEvent_Child_Destroy(pIpcEventChild);
-}
-
-/* functions */
-/*************/
-THandle IpcEvent_Create(VOID)
-{
- IpcEvent_t* pIpcEvent = (IpcEvent_t*)os_MemoryCAlloc(sizeof(IpcEvent_t), sizeof(U8));
- if(pIpcEvent == NULL)
- {
- os_error_printf(CU_MSG_ERROR, (PS8)"ERROR - IpcEvent_Create - cant allocate control block\n");
- return NULL;
- }
-
- /* create a shared memory space */
- pIpcEvent->p_shared_memory = mmap(0, sizeof(IpcEvent_Shared_Memory_t), PROT_READ | PROT_WRITE, MAP_ANON | MAP_SHARED, -1, 0);
- if ( pIpcEvent->p_shared_memory == ((PVOID)-1))
- {
- os_error_printf(CU_MSG_ERROR, (PS8)"ERROR - IpcEvent_Create - cant allocate shared memory\n");
- IpcEvent_Destroy(pIpcEvent);
- return NULL;
- }
-
- /* create a pipe */
- pipe(pIpcEvent->p_shared_memory->pipe_fields);
-
- /* set the event mask to all disabled */
- pIpcEvent->p_shared_memory->event_mask = 0;
-
- /* Create a child process */
- pIpcEvent->child_process_id = fork();
-
- if (0 == pIpcEvent->child_process_id)
- {
- /******************/
- /* Child process */
- /****************/
- IpcEvent_Child_t* pIpcEventChild = (IpcEvent_Child_t*)os_MemoryCAlloc(sizeof(IpcEvent_Child_t), sizeof(U8));
- if(pIpcEventChild == NULL)
- {
- os_error_printf(CU_MSG_ERROR, (PS8)"ERROR - IpcEvent_Create - cant allocate child control block\n");
- _exit(1);
- }
-
- pIpcEventChild->p_shared_memory = pIpcEvent->p_shared_memory;
-
- pIpcEventChild->pipe_from_parent = pIpcEventChild->p_shared_memory->pipe_fields[PIPE_READ];
- close(pIpcEventChild->p_shared_memory->pipe_fields[PIPE_WRITE]);
-
- IpcEvent_Child(pIpcEventChild);
-
- os_MemoryFree(pIpcEventChild);
-
- _exit(0);
- }
-
- pIpcEvent->pipe_to_child = pIpcEvent->p_shared_memory->pipe_fields[PIPE_WRITE];
- close(pIpcEvent->p_shared_memory->pipe_fields[PIPE_READ]);
-
- return pIpcEvent;
-}
-
-VOID IpcEvent_Destroy(THandle hIpcEvent)
-{
- IpcEvent_t* pIpcEvent = (IpcEvent_t*)hIpcEvent;
-
- if((pIpcEvent->p_shared_memory != ((PVOID)-1)) && (pIpcEvent->p_shared_memory))
- {
- munmap(pIpcEvent->p_shared_memory, sizeof(IpcEvent_Shared_Memory_t));
- }
-
- /* kill child process */
- kill(pIpcEvent->child_process_id, SIGKILL);
-
- os_MemoryFree(pIpcEvent);
-
-}
-
-S32 IpcEvent_EnableEvent(THandle hIpcEvent, U32 event)
-{
- IpcEvent_t* pIpcEvent = (IpcEvent_t*)hIpcEvent;
-
- if(pIpcEvent->p_shared_memory->event_mask & ((u64)1 << event))
- {
- return EOALERR_IPC_EVENT_ERROR_EVENT_ALREADY_ENABLED;
- }
- else
- {
- pIpcEvent->p_shared_memory->event_mask |= ((u64)1 << event);
- }
-
- return OK;
-
-}
-
-S32 IpcEvent_DisableEvent(THandle hIpcEvent, U32 event)
-{
- IpcEvent_t* pIpcEvent = (IpcEvent_t*)hIpcEvent;
-
- if(!(pIpcEvent->p_shared_memory->event_mask & (1 << event)))
- {
- return EOALERR_IPC_EVENT_ERROR_EVENT_ALREADY_DISABLED;
- }
- else
- {
- pIpcEvent->p_shared_memory->event_mask &= ~(1 << event);
- }
-
- return OK;
-}
-
-S32 IpcEvent_UpdateDebugLevel(THandle hIpcEvent, S32 debug_level)
-{
- IpcEvent_t* pIpcEvent = (IpcEvent_t*)hIpcEvent;
-
- pIpcEvent->p_shared_memory->content.debug_level = debug_level;
- IpcEvent_SendMessageToChild(pIpcEvent, (PS8)IPC_EVENT_MSG_UPDATE_DEBUG_LEVEL);
-
- return OK;
-}
-
diff --git a/wl1271/CUDK/os/linux/src/ipc_sta.c b/wl1271/CUDK/os/linux/src/ipc_sta.c
deleted file mode 100644
index 53ecef0..0000000
--- a/wl1271/CUDK/os/linux/src/ipc_sta.c
+++ /dev/null
@@ -1,195 +0,0 @@
-/*
- * ipc_sta.c
- *
- * Copyright 2001-2009 Texas Instruments, Inc. - http://www.ti.com/
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/****************************************************************************
-*
-* MODULE: IPC_STA.c
-*
-* PURPOSE:
-*
-* DESCRIPTION:
-* ============
-*
-*
-****************************************************************************/
-
-/* includes */
-/************/
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <net/if.h>
-#include <linux/rtnetlink.h>
-#include <errno.h>
-#include <sys/ioctl.h>
-#include <unistd.h>
-#include <linux/wireless.h>
-#include "cu_osapi.h"
-#include "oserr.h"
-#include "STADExternalIf.h"
-#include "ipc_sta.h"
-
-/* defines */
-/***********/
-
-/* local types */
-/***************/
-/* Module control block */
-typedef struct IpcSta_t
-{
- struct iwreq wext_req;
- ti_private_cmd_t private_cmd;
- S32 STA_socket;
-
-} IpcSta_t;
-
-/* local variables */
-/*******************/
-
-/* local fucntions */
-/*******************/
-
-/*
- * IpcSta_Sockets_Open - Open a socket.
- * Depending on the protocol present, open the right socket. The socket
- * will allow us to talk to the driver.
- */
-static S32 IpcSta_Sockets_Open(VOID)
-{
- static const S32 families[] = {
- AF_INET, AF_IPX, AF_APPLETALK
- };
- U32 i;
- S32 sock;
-
- /*
- * Now pick any (exisiting) useful socket family for generic queries
- * Note : don't open all the socket, only returns when one matches,
- * all protocols might not be valid.
- * Workaround by Jim Kaba <jkaba@sarnoff.com>
- * Note : in 2001% of the case, we will just open the inet_sock.
- * The remaining 2002% case are not fully correct...
- */
-
- /* Try all families we support */
- for(i = 0; i < sizeof(families)/sizeof(int); ++i)
- {
- /* Try to open the socket, if success returns it */
- sock = socket(families[i], SOCK_DGRAM, 0);
- if(sock >= 0)
- return sock;
- }
-
- return -1;
-}
-
-/*
- * IpcSta_Sockets_Close - Close the socket used for ioctl.
- */
-static inline VOID IpcSta_Sockets_Close(S32 skfd)
-{
- close(skfd);
-}
-
-
-/* functions */
-/*************/
-THandle IpcSta_Create(const PS8 device_name)
-{
- IpcSta_t* pIpcSta = (IpcSta_t*)os_MemoryCAlloc(sizeof(IpcSta_t), sizeof(U8));
- if(pIpcSta == NULL)
- {
- os_error_printf(CU_MSG_ERROR, (PS8)"ERROR - IpcSta_Create - cant allocate control block\n");
- return NULL;
- }
-
- /* open the socket to the driver */
- pIpcSta->STA_socket = IpcSta_Sockets_Open();
- if(pIpcSta->STA_socket == -1)
- {
- os_error_printf(CU_MSG_ERROR, (PS8)"ERROR - IpcSta_Create - cant open socket for communication with the driver\n");
- return NULL;
- }
-
- /* set the driver name */
- os_strcpy((PS8)pIpcSta->wext_req.ifr_ifrn.ifrn_name, device_name);
-
- return pIpcSta;
-}
-
-VOID IpcSta_Destroy(THandle hIpcSta)
-{
- IpcSta_t* pIpcSta = (IpcSta_t*)hIpcSta;
-
- /* close the socket to the driver */
- IpcSta_Sockets_Close(pIpcSta->STA_socket);
-
- os_MemoryFree(pIpcSta);
-}
-
-S32 IPC_STA_Private_Send(THandle hIpcSta, U32 ioctl_cmd, PVOID bufIn, U32 sizeIn,
- PVOID bufOut, U32 sizeOut)
-
-{
- IpcSta_t* pIpcSta = (IpcSta_t*)hIpcSta;
- S32 res;
-
- pIpcSta ->private_cmd.cmd = ioctl_cmd;
- if(bufOut == NULL)
- pIpcSta ->private_cmd.flags = PRIVATE_CMD_SET_FLAG;
- else
- pIpcSta ->private_cmd.flags = PRIVATE_CMD_GET_FLAG;
-
- pIpcSta ->private_cmd.in_buffer = bufIn;
- pIpcSta ->private_cmd.in_buffer_len = sizeIn;
- pIpcSta ->private_cmd.out_buffer = bufOut;
- pIpcSta ->private_cmd.out_buffer_len = sizeOut;
-
-
- pIpcSta->wext_req.u.data.pointer = &pIpcSta->private_cmd;
- pIpcSta->wext_req.u.data.length = sizeof(ti_private_cmd_t);
- pIpcSta->wext_req.u.data.flags = 0;
-
- res = ioctl(pIpcSta->STA_socket, SIOCIWFIRSTPRIV, &pIpcSta->wext_req);
- if(res != OK)
- {
- os_error_printf(CU_MSG_ERROR, (PS8)"ERROR - IPC_STA_Private_Send - error sending Wext private IOCTL to STA driver (ioctl_cmd = %x, res = %d, errno = %d)\n", ioctl_cmd,res,errno);
- return EOALERR_IPC_STA_ERROR_SENDING_WEXT;
- }
-
- return OK;
-}
-
-S32 IPC_STA_Wext_Send(THandle hIpcSta, U32 wext_request_id, PVOID p_iwreq_data, U32 len)
-{
- IpcSta_t* pIpcSta = (IpcSta_t*)hIpcSta;
- S32 res;
-
- os_memcpy(&pIpcSta->wext_req.u.data, p_iwreq_data, len);
-
- res = ioctl(pIpcSta->STA_socket, wext_request_id, &pIpcSta->wext_req);
- if(res != OK)
- {
- os_error_printf(CU_MSG_ERROR, (PS8)"ERROR - IPC_STA_Wext_Send - error sending Wext IOCTL to STA driver (wext_request_id = 0x%x, res = %d, errno = %d)\n",wext_request_id,res,errno);
- return EOALERR_IPC_STA_ERROR_SENDING_WEXT;
- }
-
- os_memcpy(p_iwreq_data, &pIpcSta->wext_req.u.data, len);
-
- return OK;
-}
-
diff --git a/wl1271/CUDK/os/linux/src/ipc_wpa.c b/wl1271/CUDK/os/linux/src/ipc_wpa.c
deleted file mode 100644
index 03f050d..0000000
--- a/wl1271/CUDK/os/linux/src/ipc_wpa.c
+++ /dev/null
@@ -1,185 +0,0 @@
-/*
- * ipc_wpa.c
- *
- * Copyright 2001-2009 Texas Instruments, Inc. - http://www.ti.com/
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/****************************************************************************
-*
-* MODULE: Ipc_Wpa.c
-*
-* PURPOSE:
-*
-* DESCRIPTION:
-* ============
-*
-*
-****************************************************************************/
-
-/* includes */
-/************/
-#include <sys/types.h>
-
-
-#include "cu_osapi.h"
-#include "oserr.h"
-#include "wpa_ctrl.h"
-#include "ipc_wpa.h"
-
-/* defines */
-/***********/
-#define IPC_WPA_CTRL_OPEN_RETRIES 5
-
-/* local types */
-/***************/
-/* Module control block */
-typedef struct TIpcWpa
-{
- struct wpa_ctrl *pWpaCtrl;
-#if 0
- S32 socket;
- struct sockaddr_in local;
- struct sockaddr_in dest;
-#endif
-} TIpcWpa;
-
-/* local variables */
-/*******************/
-
-/* local fucntions */
-/*******************/
-static S32 IpcWpa_Sockets_Open(TIpcWpa* pIpcWpa, PS8 pSupplIfFile)
-{
-#ifdef WPA_SUPPLICANT
- S32 i;
-
- for(i=0; i< IPC_WPA_CTRL_OPEN_RETRIES; i++)
- {
- pIpcWpa->pWpaCtrl = wpa_ctrl_open((char*)pSupplIfFile);
- if(pIpcWpa->pWpaCtrl)
- break;
- }
-#else
- pIpcWpa->pWpaCtrl = NULL;
-#endif
- if(pIpcWpa->pWpaCtrl == NULL)
- {
- os_error_printf(CU_MSG_ERROR, (PS8)"ERROR - IpcWpa_Sockets_Open - can't connect the socket\n");
- return EOALERR_IPC_WPA_ERROR_CANT_CONNECT_TO_SUPPL;
- }
-
- return OK;
-}
-
-static VOID IpcWpa_Sockets_Close(TIpcWpa* pIpcWpa)
-{
-#ifdef WPA_SUPPLICANT
- wpa_ctrl_close(pIpcWpa->pWpaCtrl);
-#endif
-}
-
-
-/* functions */
-/*************/
-THandle IpcWpa_Create(PS32 pRes, PS8 pSupplIfFile)
-{
- TIpcWpa* pIpcWpa = (TIpcWpa*)os_MemoryCAlloc(sizeof(TIpcWpa), sizeof(U8));
- if(pIpcWpa == NULL)
- {
- *pRes = OK;
- os_error_printf(CU_MSG_ERROR, (PS8)"ERROR - IpcWpa_Create - cant allocate control block\n");
- return NULL;
- }
-
- *pRes = IpcWpa_Sockets_Open(pIpcWpa, pSupplIfFile);
- if(*pRes)
- {
- IpcWpa_Destroy(pIpcWpa);
- return NULL;
- }
-
- return pIpcWpa;
-}
-
-VOID IpcWpa_Destroy(THandle hIpcWpa)
-{
- TIpcWpa* pIpcWpa = (TIpcWpa*)hIpcWpa;
-
- if(pIpcWpa->pWpaCtrl)
- IpcWpa_Sockets_Close(pIpcWpa);
-
- os_MemoryFree(pIpcWpa);
-}
-
-S32 IpcWpa_Command(THandle hIpcWpa, PS8 cmd, S32 print)
-{
-#ifdef WPA_SUPPLICANT
- TIpcWpa* pIpcWpa = (TIpcWpa*)hIpcWpa;
- S8 Resp[IPC_WPA_RESP_MAX_LEN];
- TI_SIZE_T RespLen = IPC_WPA_RESP_MAX_LEN - 1;
- S32 ret;
-
- ret = wpa_ctrl_request(pIpcWpa->pWpaCtrl, (char*)cmd, os_strlen(cmd), (char*)Resp, (size_t*)&RespLen, NULL);
-
- if (ret == -2)
- {
- os_error_printf(CU_MSG_ERROR, (PS8)"'%s' command timed out.\n", cmd);
- return EOALERR_IPC_WPA_ERROR_CMD_TIMEOUT;
- }
- else if (ret < 0)
- {
- os_error_printf(CU_MSG_ERROR, (PS8)"'%s' command failed (%d).\n", cmd, ret);
- return EOALERR_IPC_WPA_ERROR_CMD_FAILED;
- }
- if (print)
- {
- Resp[RespLen] = '\0';
- os_error_printf(CU_MSG_INFO2, (PS8)"%s", Resp);
- }
- return OK;
-#else
- return EOALERR_IPC_WPA_ERROR_CMD_FAILED;
-#endif
-}
-
-S32 IpcWpa_CommandWithResp(THandle hIpcWpa, PS8 cmd, S32 print, PS8 pResp, PU32 pRespLen)
-{
-#ifdef WPA_SUPPLICANT
- TIpcWpa* pIpcWpa = (TIpcWpa*)hIpcWpa;
- S32 ret;
-
- *pRespLen = IPC_WPA_RESP_MAX_LEN - 1;
- ret = wpa_ctrl_request(pIpcWpa->pWpaCtrl, (char*)cmd, os_strlen(cmd), (char*)pResp, (size_t*)pRespLen, NULL);
-
- if (ret == -2)
- {
- os_error_printf(CU_MSG_ERROR, (PS8)"'%s' command timed out.\n", cmd);
- return EOALERR_IPC_WPA_ERROR_CMD_TIMEOUT;
- }
- else if (ret < 0)
- {
- os_error_printf(CU_MSG_ERROR, (PS8)"'%s' command failed.\n", cmd);
- return EOALERR_IPC_WPA_ERROR_CMD_FAILED;
- }
- if (print)
- {
- pResp[*pRespLen] = '\0';
- os_error_printf(CU_MSG_INFO2, (PS8)"%s", pResp);
- }
- return OK;
-#else
- return EOALERR_IPC_WPA_ERROR_CMD_FAILED;
-#endif
-}
diff --git a/wl1271/CUDK/os/linux/src/makefile b/wl1271/CUDK/os/linux/src/makefile
deleted file mode 100644
index 2bca27c..0000000
--- a/wl1271/CUDK/os/linux/src/makefile
+++ /dev/null
@@ -1,136 +0,0 @@
-STATIC_LIB ?= y
-DEBUG ?= y
-BUILD_SUPPL ?= y
-SUPPL ?= ANDROID
-WPA_ENTERPRISE ?= y
-ETH_SUPPORT ?= n
-
-ifeq ($(DEBUG),y)
- DEBUGFLAGS = -O2 -g -DDEBUG -DTI_DBG -fno-builtin
-else
- DEBUGFLAGS = -O2
-endif
-
-WILINK_ROOT = ../../../..
-CUDK_ROOT = $(WILINK_ROOT)/CUDK
-LIB_NAME = tiOsLib
-OUTPUT_DIR ?= $(CUDK_ROOT)/output
-
-DK_DEFINES =
-ifeq ($(WPA_ENTERPRISE), y)
- DK_DEFINES += -D WPA_ENTERPRISE
-endif
-
-ifeq ($(BUILD_SUPPL), y)
- DK_DEFINES += -D WPA_SUPPLICANT -D CONFIG_CTRL_IFACE -D CONFIG_CTRL_IFACE_UNIX
- -include $(CUDK_ROOT)/$(TI_SUPP_LIB_DIR)/.config
- ifeq ($(CONFIG_EAP_WSC), y)
- DK_DEFINES += -DCONFIG_EAP_WSC
- endif
-endif
-
-ifeq ($(STATIC_LIB),y)
- TARGET = $(OUTPUT_DIR)/$(LIB_NAME).a
-else
- TARGET = $(OUTPUT_DIR)/$(LIB_NAME).so
-endif
-
-ifeq ($(ETH_SUPPORT), y)
- DK_DEFINES += -DETH_SUPPORT
-endif
-
-SRCS := \
- cu_wext.c \
- ipc_sta.c \
- ipc_event.c \
- ipc_wpa.c \
- os_trans.c \
- ParsEvent.c \
- osapi.c
-ifeq ($(BUILD_SUPPL), y)
-SRCS += \
- $(CUDK_ROOT)/$(TI_SUPP_LIB_DIR)/wpa_ctrl.c
-endif
-
-OBJS = $(SRCS:.c=.o)
-
-DEPS = $(SRCS:%.c=%.d)
-
-ARMFLAGS = -fno-common -pipe
-
-INCLUDES = \
- -I ../inc \
- -I ../../common/inc \
- -I $(WILINK_ROOT)/stad/Export_Inc \
- -I $(WILINK_ROOT)/stad/src/Sta_Management \
- -I $(WILINK_ROOT)/stad/src/Application \
- -I $(WILINK_ROOT)/utils \
- -I $(WILINK_ROOT)/Txn \
- -I $(WILINK_ROOT)/TWD/TWDriver \
- -I $(WILINK_ROOT)/TWD/FirmwareApi \
- -I $(WILINK_ROOT)/TWD/FW_Transfer/Export_Inc \
- -I $(WILINK_ROOT)/TWD/TwIf \
- -I $(WILINK_ROOT)/platforms/os/linux/inc \
- -I $(WILINK_ROOT)/platforms/os/common/inc \
- -I $(WILINK_ROOT)/TWD/FirmwareApi \
- -I $(CUDK_ROOT)/$(TI_SUPP_LIB_DIR) \
- -I $(CUDK_ROOT)/configurationutility/inc
-
-CFLAGS = -Wall -Wstrict-prototypes $(DEBUGFLAGS) $(INCLUDES) -D__LINUX__ $(DK_DEFINES) -D__BYTE_ORDER_LITTLE_ENDIAN
-
-ifneq "$(CROSS_COMPILE)" "" #compile for ARM
- CFLAGS += $(ARMFLAGS)
- # strip symbols
-ifneq "$(DEBUG)" "y"
- LDFLAGS = -s
-endif
-
-endif # CROSS_COMPILE != ""
-
-.PHONY: all
-
-all: $(TARGET)
-
-$(OUTPUT_DIR)/$(LIB_NAME).a: $(OBJS)
- rm -f $@
- $(CROSS_COMPILE)$(AR) -q $@ $^
-
-$(OUTPUT_DIR)/$(LIB_NAME).so: $(OBJS)
- rm -f $@
- $(CROSS_COMPILE)gcc -shared $(CFLAGS) $(OBJS) -lc -o $@
- $(CROSS_COMPILE)strip $@
-
-ifeq ("$(findstring $(MAKECMDGOALS), clean cleanall)", "")
--include .depend
-endif
-
-%.o: %.cpp
- @echo $@
- @$(CROSS_COMPILE)gcc $(CFLAGS) -c $^ -o $@
-
-%.o: %.c
- @echo $@
- @$(CROSS_COMPILE)gcc -s $(CFLAGS) -c $< -o $@
-
-%.i: %.c
- @$(CROSS_COMPILE)gcc $(CFLAGS) -E -c $< > $@
-
-%.d: %.c
- @echo $@
- @$(CROSS_COMPILE)gcc $< -MT$(^:%.c=%.o) -M $(CFLAGS) > $@
-
-%.d: %.cpp
- @echo $@
- @$(CROSS_COMPILE)gcc $< -MT$(^:%.cpp=%.o) -M $(CFLAGS) > $@
-
-.depend: $(DEPS)
- rm -f $@
- for aa in $^; do cat $$aa >> $@; done
-
-.PHONY: clean
-clean:
- @echo cleaning OS library...
- rm -f .depend $(OBJS) $(DEPS) $(SRCS:.c=.i) *.ko .*.cmd .*.flags *.mod.c *~ *.~* $(TARGET)
-
-cleanall: clean
-
diff --git a/wl1271/CUDK/os/linux/src/os_trans.c b/wl1271/CUDK/os/linux/src/os_trans.c
deleted file mode 100644
index c235626..0000000
--- a/wl1271/CUDK/os/linux/src/os_trans.c
+++ /dev/null
@@ -1,168 +0,0 @@
-/*
- * os_trans.c
- *
- * Copyright 2001-2009 Texas Instruments, Inc. - http://www.ti.com/
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include <netinet/in.h>
-#include <sys/socket.h>
-#include <sys/types.h>
-#include <arpa/inet.h>
-#include <unistd.h>
-
-
-#include "cu_osapi.h"
-#include "os_trans.h"
-
-TI_BOOL os_trans_create()
-{
- return TRUE;
-}
-
-
-TI_BOOL os_socket (THandle* pSock)
-{
- SOCKET socket_id;
- TI_BOOL optval = TRUE;
-
- socket_id = socket(PF_INET, SOCK_STREAM, 0);
-
- if (socket_id==SOCKET_ERROR)
- {
- /* Error opening socket */
- os_error_printf(CU_MSG_ERROR, "%s: error opening socket.\n", __FUNCTION__);
- return (FALSE);
- }
-
- /*************************/
- /* Configure the socket */
- /***********************/
-
- if (setsockopt(socket_id, SOL_SOCKET, SO_REUSEADDR, (const THandle)&optval, sizeof(optval)) == OSAL_ERROR) {
- /* Error setting socket option */
- os_error_printf(CU_MSG_ERROR, "%s: error setting socket option. Error %d\n", __FUNCTION__, os_get_last_error());
- close(socket_id); //close socket
- return FALSE;
- }
-
- *pSock = (THandle) socket_id;
-
- return TRUE;
-}
-
-
-TI_BOOL os_bind (THandle sock, U16 port)
-{
- struct sockaddr_in server_addr;
- TI_SIZE_T result;
-
- server_addr.sin_family = AF_INET;
- server_addr.sin_addr.s_addr = htonl (INADDR_ANY);
- server_addr.sin_port = htons(port);
-
- result = bind((SOCKET)sock, (struct sockaddr *)&server_addr, sizeof(server_addr));
-
- if (result != OK) {
- /* Error binding socket */
- os_error_printf(CU_MSG_ERROR, "%s: error binding socket. Error %d\n", __FUNCTION__, os_get_last_error());
- close((SOCKET)sock);
- return(FALSE);
- }
-
- return TRUE;
-}
-
-
-TI_BOOL os_sockWaitForConnection (THandle socket_id, THandle* pConnSock)
-{
- struct sockaddr_in client_addr;
- socklen_t client_addr_len;
- TI_SIZE_T result;
-
- result = listen((SOCKET)socket_id, MAX_QUEUE_LENGTH);
-
- if (result == OSAL_ERROR) {
- /* Error listening to socket */
- /* os_error_printf(CU_MSG_ERROR, "%s: error listening to socket. Error %d\n", __FUNCTION__, errno);
- *pConnSock = NULL;
- closesocket((SOCKET)socket_id);
- return(FALSE);*/
- }
-
- /**********************/
- /* Accept connection */
- /********************/
- client_addr_len = sizeof(client_addr);
-
- /* We suppose to get new socket id after accept (blocking action) */
- result = accept((SOCKET)socket_id, (struct sockaddr *)&client_addr, &client_addr_len);
-
- if (result == OSAL_ERROR) {
- *pConnSock = NULL;
- /* Error accepting connection */
- os_error_printf(CU_MSG_ERROR, "%s: error accepting connection. Error %d\n", __FUNCTION__, os_get_last_error());
- close((SOCKET) socket_id);
- return(FALSE);
- }
-
- *pConnSock = (THandle) result;
-
- return TRUE;
-}
-
-
-TI_BOOL os_sockSend (THandle socket_id, PS8 buffer, U32 bufferSize)
-{
- TI_SIZE_T result;
-
- /* Write to the socket */
- result = send( (SOCKET) socket_id, buffer, (U32)bufferSize, 0);
- if (result == SOCKET_ERROR) {
-
- /**************************/
- /* Error writing to port */
- /************************/
- os_error_printf(CU_MSG_ERROR, "%s: Error writing to socket (result = %d), error %d\n",
- __FUNCTION__, result, os_get_last_error());
-
- return FALSE;
- }
-
- return TRUE;
-}
-
-VOID os_trans_destroy()
-{
-
-}
-
-S32 os_sockRecv (THandle socket_id, PU8 pBuffer, U32 bufferSize, TI_SIZE_T flags)
-
-{
- TI_SIZE_T result;
-
- /* Read from the socket */
- result = recv((SOCKET)socket_id, pBuffer, bufferSize, flags);
- if (result == SOCKET_ERROR) {
-
- /***************************/
- /* Error reading from port */
- /***************************/
-
- os_error_printf(CU_MSG_ERROR, "%s: Error reading from socket (result = %d), error %d\n", __FUNCTION__, result, os_get_last_error());
- }
-
- return (S32)result;
-}
-
diff --git a/wl1271/CUDK/os/linux/src/osapi.c b/wl1271/CUDK/os/linux/src/osapi.c
deleted file mode 100644
index b124211..0000000
--- a/wl1271/CUDK/os/linux/src/osapi.c
+++ /dev/null
@@ -1,621 +0,0 @@
-/*
- * osapi.c
- *
- * Copyright 2001-2009 Texas Instruments, Inc. - http://www.ti.com/
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/****************************************************************************
-*
-* MODULE: osapi.c
-*
-* PURPOSE:
-*
-* DESCRIPTION:
-* ============
-* OS Memory API for user mode application (CUDK)
-*
-****************************************************************************/
-
-/* includes */
-/************/
-#include <stdarg.h>
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include <unistd.h>
-#include <signal.h>
-#include <errno.h>
-#include "cu_os.h"
-#include "cu_osapi.h"
-
-/* defines */
-/***********/
-#define MAX_HOST_MESSAGE_SIZE 512
-
-S32 ipc_pipe[2];
-
-extern S32 user_main (S32 argc, PPS8 argv);
-
-/**
- * \fn main
- * \brief Main entry point to a user-mode program
- *
- * This is the main() function for a user mode program, or the entry point
- * called by the OS, This calls an OS-abstracted main function
- *
- * \param argc - command line argument count
- * \param argv - command line arguments
- * \return 0 on success, any other value indicates error
- * \sa user_main
- */
-int main (int argc, char** argv)
-{
- return user_main (argc, (PPS8)argv);
-}
-
-/****************************************************************************************
- * os_error_printf()
- ****************************************************************************************
-DESCRIPTION: This function prints a debug message
-
-ARGUMENTS: OsContext - our adapter context.
- arg_list - string to output with arguments
-
-RETURN: None
-*****************************************************************************************/
-VOID os_error_printf(S32 debug_level, const PS8 arg_list ,...)
-{
- static int g_debug_level = CU_MSG_ERROR; /* TODO ronen: create debug logic for CLI */
- S8 msg[MAX_HOST_MESSAGE_SIZE];
- va_list ap;
-#ifdef OS_CLI_LOG_TO_FILE
- char file_name[30]="/cli.log";
- FILE *ftmp;
-#endif
-
- if (debug_level < g_debug_level)
- return;
-
- /* Format the message */
- va_start(ap, arg_list);
- vsprintf((char *)msg, (char *)arg_list, ap);
- va_end(ap);
-
- /* print the message */
- fprintf(stderr, (char *)msg);
-
-#ifdef OS_CLI_LOG_TO_FILE
- ftmp = fopen(file_name, "a");
- if (ftmp != NULL) {
- fprintf(ftmp,(char *)msg);
- fclose(ftmp);
- }
-#endif
-}
-
-/****************************************************************************************
- * os_strcpy()
- ****************************************************************************************
-DESCRIPTION: wrapper to the OS strcpy fucntion
-
-ARGUMENTS:
-
-RETURN:
-*****************************************************************************************/
-inline PS8 os_strcpy(PS8 dest, const PS8 src)
-{
- return (PS8)strcpy((char*)dest, (char*)src);
-}
-
-/****************************************************************************************
- * os_strncpy()
- ****************************************************************************************
-DESCRIPTION: wrapper to the OS strncpy fucntion
-
-ARGUMENTS:
-
-RETURN:
-*****************************************************************************************/
-PS8 os_strncpy(PS8 dest, const PS8 src, S32 n)
-{
- return (PS8)strncpy((char*)dest, (char*)src, n);
-}
-
-/****************************************************************************************
- * os_sprintf()
- ****************************************************************************************
-DESCRIPTION: wrapper to the OS sprintf fucntion
-
-ARGUMENTS:
-
-RETURN:
-*****************************************************************************************/
-S32 os_sprintf(PS8 str, const PS8 arg_list, ...)
-{
- va_list ap;
- S8 msg[MAX_HOST_MESSAGE_SIZE];
-
- va_start(ap, arg_list);
- vsprintf((char*)msg, (char*)arg_list, ap);
- va_end(ap);
-
- return sprintf((char*)str, (char*)msg);
-}
-
-/****************************************************************************************
- * os_Printf()
- ****************************************************************************************
-DESCRIPTION: wrapper to the OS printf fucntion
-
-ARGUMENTS:
-
-RETURN:
-*****************************************************************************************/
-S32 os_Printf(const PS8 buffer)
-{
- return printf((char*)buffer);
-}
-
-
-/****************************************************************************************
- * os_strcat()
- ****************************************************************************************
-DESCRIPTION: wrapper to the OS strcat fucntion
-
-ARGUMENTS:
-
-RETURN:
-*****************************************************************************************/
-PS8 os_strcat(PS8 dest, const PS8 src)
-{
- return (PS8)strcat((char*)dest, (char*)src);
-}
-
-/****************************************************************************************
- * os_strlen()
- ****************************************************************************************
-DESCRIPTION: wrapper to the OS strlen fucntion
-
-ARGUMENTS:
-
-RETURN:
-*****************************************************************************************/
-U32 os_strlen(const PS8 s)
-{
- return strlen((char*)s);
-}
-
-/****************************************************************************************
- * os_memoryCAlloc()
- ****************************************************************************************
-DESCRIPTION: Allocates an array in memory with elements initialized to 0.
-
-ARGUMENTS: OsContext - our adapter context.
- Number - Number of elements
- Size - Length in bytes of each element
-
-RETURN: Pointer to the allocated memory.
-*****************************************************************************************/
-PVOID os_MemoryCAlloc(U32 Number, U32 Size)
-{
- return calloc(Number, Size);
-}
-
-/****************************************************************************************
- * os_memoryAlloc()
- ****************************************************************************************
-DESCRIPTION: Allocates resident (nonpaged) system-space memory.
-
-ARGUMENTS: OsContext - our adapter context.
- Size - Specifies the size, in bytes, to be allocated.
-
-RETURN: Pointer to the allocated memory.
-*****************************************************************************************/
-PVOID os_MemoryAlloc(U32 Size)
-{
- return malloc(Size);
-}
-
-/****************************************************************************************
- * os_memoryFree()
- ****************************************************************************************
-DESCRIPTION: This function releases a block of memory previously allocated with the
- os_memoryAlloc function.
-
-
-ARGUMENTS: OsContext - our adapter context.
- pMemPtr - Pointer to the base virtual address of the allocated memory.
- This address was returned by the os_memoryAlloc function.
- Size - Redundant, needed only for kernel mode.
-
-RETURN: None
-*****************************************************************************************/
-VOID os_MemoryFree(PVOID pMemPtr)
-{
- free(pMemPtr);
-}
-
-/****************************************************************************************
- * os_memset()
- ****************************************************************************************
-DESCRIPTION: wrapper to the OS memset fucntion
-
-ARGUMENTS:
-
-RETURN:
-*****************************************************************************************/
-PVOID os_memset(PVOID s, U8 c, U32 n)
-{
- return memset(s, c, n);
-}
-
-/****************************************************************************************
- * os_memcpy()
- ****************************************************************************************
-DESCRIPTION: wrapper to the OS memcpy fucntion
-
-ARGUMENTS:
-
-RETURN:
-*****************************************************************************************/
-PVOID os_memcpy(PVOID dest, const PVOID src, U32 n)
-{
- return memcpy(dest, src, n);
-}
-
-/****************************************************************************************
- * os_memcmp()
- ****************************************************************************************
-DESCRIPTION: wrapper to the OS memcmp fucntion
-
-ARGUMENTS:
-
-RETURN:
-*****************************************************************************************/
-S32 os_memcmp(const PVOID s1, const PVOID s2, S32 n)
-{
- return memcmp(s1, s2, n);
-}
-
-/************************************************************************
- * os_strcmp *
- ************************************************************************
-DESCRIPTION: wrapper to the OS strcmp fucntion
-
-CONTEXT:
-************************************************************************/
-S32 os_strcmp(const PS8 s1, const PS8 s2)
-{
- return strcmp((char*)s1,(char*)s2);
-}
-
-
-/************************************************************************
- * os_strncmp *
- ************************************************************************
-DESCRIPTION: wrapper to the OS strcmp fucntion
-
-CONTEXT:
-************************************************************************/
-S32 os_strncmp(const PS8 s1, const PS8 s2, U32 n)
-{
- return strncmp((char*)s1,(char*)s2,n);
-}
-
-/************************************************************************
- * os_sscanf *
- ************************************************************************
-DESCRIPTION: wrapper to the OS sscanf fucntion
-
-CONTEXT:
-************************************************************************/
-S32 os_sscanf(const PS8 str, const PS8 arg_list, ...)
-{
- va_list ap;
- S8 msg[MAX_HOST_MESSAGE_SIZE];
-
- va_start(ap, arg_list);
- vsprintf((char*)msg, (char*)arg_list, ap);
- va_end(ap);
-
- return sscanf((char*)str, (char*)msg);
-}
-
-/************************************************************************
- * os_strchr *
- ************************************************************************
-DESCRIPTION: wrapper to the OS strchr fucntion
-
-CONTEXT:
-************************************************************************/
-PS8 os_strchr(const PS8 s, S32 c)
-{
- return (PS8)strchr((char*)s,c);
-}
-
-/************************************************************************
- * os_strtol *
- ************************************************************************
-DESCRIPTION: wrapper to the OS strtol fucntion
-
-CONTEXT:
-************************************************************************/
-S32 os_strtol(const PS8 nptr, PPS8 endptr, S32 base)
-{
- return strtol((char*)nptr, (char**)endptr, base);
-}
-
-/************************************************************************
- * os_strtoul *
- ************************************************************************
-DESCRIPTION: wrapper to the OS strtoul fucntion
-
-CONTEXT:
-************************************************************************/
-U32 os_strtoul(const PS8 nptr, PPS8 endptr, S32 base)
-{
- return strtoul((char*)nptr, (char**)endptr, base);
-}
-
-/************************************************************************
- * os_tolower *
- ************************************************************************
-DESCRIPTION: wrapper to the OS tolower fucntion
-
-CONTEXT:
-************************************************************************/
-S32 os_tolower(S32 c)
-{
- return tolower(c);
-}
-
-/************************************************************************
- * os_tolower *
- ************************************************************************
-DESCRIPTION: wrapper to the OS tolower fucntion
-
-CONTEXT:
-************************************************************************/
-S32 os_isupper(S32 c)
-{
- return isupper(c);
-}
-
-/************************************************************************
- * os_tolower *
- ************************************************************************
-DESCRIPTION: wrapper to the OS tolower fucntion
-
-CONTEXT:
-************************************************************************/
-S32 os_toupper(S32 c)
-{
- return toupper(c);
-
-}
-
-/************************************************************************
- * os_atoi *
- ************************************************************************
-DESCRIPTION: wrapper to the OS atoi fucntion
-
-CONTEXT:
-************************************************************************/
-S32 os_atoi(const PS8 str)
-{
- return (S32)atoi(str);
-}
-
-/************************************************************************
- * os_fopen *
- ************************************************************************
-DESCRIPTION: wrapper to the OS fopen fucntion
-
-CONTEXT:
-************************************************************************/
-PVOID os_fopen(const PS8 path, os_fopen_mode_e mode)
-{
- switch(mode)
- {
- case OS_FOPEN_READ:
- return fopen((char*)path, "r");
- case OS_FOPEN_READ_BINARY:
- return fopen((char*)path, "rb");
- case OS_FOPEN_WRITE:
- return fopen(path, "w");
- case OS_FOPEN_WRITE_BINARY:
- return fopen(path, "wb");
-
-
- default:
- return NULL;
- }
-}
-
-/************************************************************************
- * os_getFileSize *
- ************************************************************************
-DESCRIPTION: wrapper to the OS fopen fucntion
-
-CONTEXT:
-************************************************************************/
-S32 os_getFileSize (PVOID file)
-{
- S32 size;
-
- if (fseek(file, 0, SEEK_END))
- {
- os_error_printf (CU_MSG_ERROR, (PS8)"Cannot seek file to end\n");
- return -1;
- }
- size = ftell(file);
- rewind(file);
- return size;
-}
-
-/************************************************************************
- * os_fgets *
- ************************************************************************
-DESCRIPTION: wrapper to the OS fgets fucntion
-
-CONTEXT:
-************************************************************************/
-inline PS8 os_fgets(PS8 s, S32 size, PVOID stream)
-{
- return (PS8)fgets((char*)s, size, stream);
-}
-
-/************************************************************************
- * os_fread *
- ************************************************************************
-DESCRIPTION: wrapper to the OS fread fucntion
-
-CONTEXT:
-************************************************************************/
-inline S32 os_fread (PVOID ptr, S32 size, S32 nmemb, PVOID stream)
-{
- return fread (ptr, size, nmemb, stream);
-}
-
-/************************************************************************
- * os_fwrite *
- ************************************************************************
-DESCRIPTION: wrapper to the OS fwrite fucntion
-
-CONTEXT:
-************************************************************************/
-S32 os_fwrite (PVOID ptr, S32 size, S32 nmemb, PVOID stream)
-{
- return fwrite (ptr, size, nmemb, stream);
-}
-
-/************************************************************************
- * os_fclose *
- ************************************************************************
-DESCRIPTION: wrapper to the OS fclose fucntion
-
-CONTEXT:
-************************************************************************/
-inline S32 os_fclose(PVOID stream)
-{
- return fclose(stream);
-}
-
-/************************************************************************
- * os_getInputString *
- ************************************************************************
-DESCRIPTION: get the input string for the console from the appropiate inputs
-
-CONTEXT:
-************************************************************************/
-S32 os_getInputString(PS8 inbuf, S32 len)
-{
- fd_set read_set;
- S32 max_fd_index;
- S32 result;
- S32 pid;
-
- /*
- * Wait for one of two external events:
- * -----------------------------------
- *
- * 1. Data received from STDIN
- * 2. Data received from the event process
- */
-
- /* Prepare the read set fields */
- FD_ZERO(&read_set);
- FD_SET(0, &read_set);
- FD_SET(ipc_pipe[0], &read_set);
-
- /* Determine the maximum index of the file descriptor */
- max_fd_index = max(0, ipc_pipe[0]) + 1;
-
- /* Wait for event - blocking */
- result = select(max_fd_index, &read_set, NULL, NULL, NULL);
-
- if (result > 0)
- {
- if (FD_ISSET(0, &read_set))
- {
- /* Data received from STDIN */
- if ( fgets( (char*)inbuf, len, stdin ) == NULL )
- return FALSE;
- else
- return TRUE;
- }
-
- if (FD_ISSET(ipc_pipe[0], &read_set))
- {
- /**********************************/
- /* Data received from TCP client */
- /********************************/
- result = read(ipc_pipe[0], inbuf, len);
-
- /* Get the pid of the calling process */
- pid = *(inbuf + 0) | (*(inbuf + 1) << 8);
-
- /*
- Signal the calling process (tell him that we have
- received the command, and he can send us another one
- */
- if (pid != 0xFFFF)
- {
- kill(pid, SIGUSR1);
- }
-
- if ( result <= 0 )
- return FALSE;
- else
- return TRUE;
- }
- }
-
- /* Error */
- os_error_printf(CU_MSG_ERROR, (PS8)"Input selection mismatch (0x%x)...\n", read_set);
- return FALSE;
-}
-
-/************************************************************************
- * os_Catch_CtrlC_Signal *
- ************************************************************************
-DESCRIPTION: register to catch the Ctrl+C signal
-
-CONTEXT:
-************************************************************************/
-VOID os_Catch_CtrlC_Signal(PVOID SignalCB)
-{
- if(signal(SIGINT, SignalCB) == SIG_ERR)
- os_error_printf(CU_MSG_ERROR, (PS8)"ERROR - os_Catch_CtrlC_Signal - cant catch Ctrl+C signal\n");
-}
-
-
-VOID os_OsSpecificCmdParams(S32 argc, PS8* argv)
-{
-}
-
-VOID os_InitOsSpecificModules(VOID)
-{
-}
-
-VOID os_DeInitOsSpecificModules(VOID)
-{
-}
-
-TI_SIZE_T os_get_last_error()
-{
- return errno;
-}