96 lines
3.3 KiB
C++
96 lines
3.3 KiB
C++
//----------------------------------------------------------------------------
|
||
//
|
||
// Copyright (C) 2004 Intel Corporation
|
||
//
|
||
// File: CommonDefinitions.h
|
||
//
|
||
// Contents: Sample code for an Intel<65> AMT Network client.
|
||
//
|
||
// Notes: This file contains type, function and constant definitions
|
||
// used throughout the code of the all sample applications.
|
||
//
|
||
//----------------------------------------------------------------------------
|
||
|
||
#ifndef COMMON_DEFINITIONS_H
|
||
#define COMMON_DEFINITIONS_H
|
||
|
||
|
||
#if defined (_WIN32) || defined (_WIN64)
|
||
#include <conio.h>
|
||
#else
|
||
/*
|
||
* httpDigest.h for gSoap HTTP Digest support
|
||
*/
|
||
//#include "httpDigest.h"
|
||
#endif
|
||
|
||
#include <iostream>
|
||
|
||
/*
|
||
* Function prototypes
|
||
*/
|
||
void PrintAuthenticationNote();
|
||
bool CheckReturnStatus(unsigned int res, unsigned long status,const char *message);
|
||
bool ValidateIP(const char *uri);
|
||
void GetString(char *msg, char *s, bool hidden);
|
||
bool DisplayWarning(const char *msg);
|
||
bool GetNumber(int *number);
|
||
void ReplaceSubstring(const char *oldString,const char *oldSubstr,
|
||
const char *newSubstr, char *newString);
|
||
void SetIPAddress(unsigned long &address, unsigned long bytes[]);
|
||
void NumberToIP(unsigned long address, unsigned long bytes[]);
|
||
void NumberToString(unsigned long number, char *string);
|
||
void IpToString(unsigned long address, char *string);
|
||
void StringToIP(const char *string, unsigned long &address);
|
||
void GuidToString(const unsigned char* guid, char* string);
|
||
bool ExtractIPFromUri(const char *uri, char *baseUrl);
|
||
void IsEmulator(const char *targetUrl, int *isEmulator);
|
||
bool GetOption(int *commandLineLength, char *argv[], int numOfArgs,
|
||
char **option, char ***commandLine);
|
||
void PrintSuccess(bool print = true);
|
||
void FunctionCall(const char *message);
|
||
#if defined (_WIN32) || defined (_WIN64)
|
||
bool ParseCommandLine(int commandLineLength,char* commandLine[],char **target,
|
||
char **certName, bool *local, bool *krb,bool *verbose = NULL,
|
||
char **username = NULL, char **password = NULL,char **proxy = NULL,
|
||
char **proxyUserName = NULL ,char **proxyPassWord = NULL);
|
||
#define CHAR _TCHAR
|
||
#else
|
||
bool ParseCommandLine(int commandLineLength,char* commandLine[],char **target,
|
||
char **certName = NULL,char **certPass = NULL,
|
||
bool *verbose = NULL, char **username = NULL, char **password = NULL,
|
||
char **proxy = NULL, char **proxyUserName = NULL ,char **proxyPassWord = NULL);
|
||
#define CHAR char
|
||
#endif
|
||
|
||
/*
|
||
* Constants for the common use
|
||
*/
|
||
static const int MAX_LINE_LEN = 1024;
|
||
static const int TIMEOUT = 80;
|
||
|
||
//static const int AMT_SECURE_PORT = 16993;
|
||
//static const int AMT_UNSECURE_PORT = 16992;
|
||
|
||
static const char *DEFAULT_USERNAME = "admin";
|
||
static const char *DEFAULT_PASSWORD = "admin";
|
||
static const char *CERT_NAME = "-cert";
|
||
static const char *PROXY = "-proxy";
|
||
|
||
static const char *USER = "-user";
|
||
static const char *PASS = "-pass";
|
||
static const char *VERBOSE = "-verbose";
|
||
static const char *PROXY_USER_NAME = "-proxyUserName";
|
||
static const char *PROXY_PASSWORD = "-proxyPassword";
|
||
#if defined (_WIN32) || defined (_WIN64)
|
||
static const char *LOCAL = "-local";
|
||
static const char *KRB = "-krb";
|
||
#else
|
||
static const char *CERT_PASS = "-certPass";
|
||
#endif
|
||
|
||
#define OID_LOCAL "2.16.840.1.113741.1.2.2"
|
||
#define OID_REMOTE "2.16.840.1.113741.1.2.1"
|
||
|
||
#endif
|