NetSim Source Code Help v14.4
All 13 Components
 
Loading...
Searching...
No Matches
emu_if.h
1/************************************************************************************
2* Copyright (C) 2023 *
3* TETCOS, Bangalore. India *
4* *
5* Tetcos owns the intellectual property rights in the Product and its content. *
6* The copying, redistribution, reselling or publication of any or all of the *
7* Product or its content without express prior written consent of Tetcos is *
8* prohibited. Ownership and / or any other right relating to the software and all *
9* intellectual property rights therein shall remain at all times with Tetcos. *
10* *
11* Author: Shashi Kant Suman *
12* *
13* ---------------------------------------------------------------------------------*/
14#ifndef _EMU_IF_H_
15#define _EMU_IF_H_
16
17#ifndef _CRT_SECURE_NO_DEPRECATE
18#define _CRT_SECURE_NO_DEPRECATE
19#endif
20
21#ifndef _CRT_SECURE_NO_WARNINGS
22#define _CRT_SECURE_NO_WARNINGS
23#endif
24
25# define _CRTDBG_MAP_ALLOC
26
27#include <winsock2.h>
28#include <iphlpapi.h>
29#include <stdio.h>
30#include <stdlib.h>
31#pragma comment(lib, "IPHLPAPI.lib") //IP helper library
32#pragma comment(lib,"ws2_32.lib") //Winsock Library
33#ifndef _EMU_LIB_CODE_
34#pragma comment(lib,"emu_lib.lib") //Socket interface library
35#endif
36
37#ifdef __cplusplus
38extern "C" {
39#endif
40
41WSADATA wsaData; //variable to hold WSA
42
43//Function prototype
44void emu_socket_init();
45SOCKET emu_create_socket();
46void emu_start_server(SOCKET s,SOCKADDR_IN* con,unsigned short port);
47int recvData(SOCKET s,char *recvbuf,int size);
48int sendData(SOCKET s,char *sendbuf);
49void closeConnection(SOCKET s);
50void waitForClient(SOCKET* s,SOCKADDR* clientaddr,int* clientlen);
51void emu_socket_close();
52
53int emu_connectServer(SOCKET s, char *ip,int port);
54
55#ifdef __cplusplus
56}
57#endif
58#endif //_EMU_IF_H_