hexsha
stringlengths
40
40
size
int64
22
2.4M
ext
stringclasses
5 values
lang
stringclasses
1 value
max_stars_repo_path
stringlengths
3
260
max_stars_repo_name
stringlengths
5
109
max_stars_repo_head_hexsha
stringlengths
40
78
max_stars_repo_licenses
listlengths
1
9
max_stars_count
float64
1
191k
max_stars_repo_stars_event_min_datetime
stringlengths
24
24
max_stars_repo_stars_event_max_datetime
stringlengths
24
24
max_issues_repo_path
stringlengths
3
260
max_issues_repo_name
stringlengths
5
109
max_issues_repo_head_hexsha
stringlengths
40
78
max_issues_repo_licenses
listlengths
1
9
max_issues_count
float64
1
67k
max_issues_repo_issues_event_min_datetime
stringlengths
24
24
max_issues_repo_issues_event_max_datetime
stringlengths
24
24
max_forks_repo_path
stringlengths
3
260
max_forks_repo_name
stringlengths
5
109
max_forks_repo_head_hexsha
stringlengths
40
78
max_forks_repo_licenses
listlengths
1
9
max_forks_count
float64
1
105k
max_forks_repo_forks_event_min_datetime
stringlengths
24
24
max_forks_repo_forks_event_max_datetime
stringlengths
24
24
content
stringlengths
22
2.4M
avg_line_length
float64
5
169k
max_line_length
int64
5
786k
alphanum_fraction
float64
0.06
0.95
matches
listlengths
1
11
271f707105da8f3eb01e74c61fd296241aafafd0
3,103
h
C
Source/Matrix.h
mbandreeta/NetworkExtraction
72ed5b37ffeb9f46b4cf67d57b763d24f2c5b763
[ "MIT" ]
null
null
null
Source/Matrix.h
mbandreeta/NetworkExtraction
72ed5b37ffeb9f46b4cf67d57b763d24f2c5b763
[ "MIT" ]
null
null
null
Source/Matrix.h
mbandreeta/NetworkExtraction
72ed5b37ffeb9f46b4cf67d57b763d24f2c5b763
[ "MIT" ]
1
2020-10-10T02:20:26.000Z
2020-10-10T02:20:26.000Z
#pragma once #include <iostream> #include <fstream> #include "Voxel.h" #include"Sphere.h" #include<cmath> #include<string> #include <thread> #include <algorithm> #include <itkImage.h> #include "itkNiftiImageIO.h" #include "itkImageFileReader.h" #include "itkImageFileWriter.h" #include "itkSignedMaurerDistanceMapImageFilter.h" #include "itkSmoothingRecursiveGaussianImageFilter.h" #include "boost/filesystem.hpp" using namespace boost::filesystem; typedef itk::Image< unsigned int, 3 > InputImageType; typedef itk::Image< double, 3 > OutputImageType; typedef itk::ImageFileReader<InputImageType> ReaderType; typedef itk::ImageFileWriter<OutputImageType> WriterType; typedef itk::SignedMaurerDistanceMapImageFilter<InputImageType, OutputImageType> FilterMType; typedef itk::SmoothingRecursiveGaussianImageFilter<OutputImageType, OutputImageType> FilterGType; using namespace std; class Matrix { private: float*** m; int Nx; int Ny; int Nz; int total_size; int defineRange(int r, int pos, int direction, int operation); public: Matrix() {}; Matrix(int Nx, int Ny, int Nz); virtual ~Matrix(); InputImageType::Pointer readNifiti(const char* filename); void saveNifiti(const char* filename); OutputImageType::Pointer Matrix2itk(); void itk2Matrix(OutputImageType::Pointer image, size_t* total_volume, size_t* interior_surface); OutputImageType::Pointer distanceTransform(InputImageType::Pointer image); OutputImageType::Pointer gaussianFilter(OutputImageType::Pointer image, float sigma); vector<string> readFileList(const char* filepath, int init, int end); void loadBinaryNIFITI(const char* filename, size_t* total_volume, size_t* interior_surface); int getTotalSize(); int getNx() { return this->Nx; } int getNy() { return this->Ny; } int getNz() { return this->Nz; } bool isSurfaceVoxel(int x, int y, int z); bool isInternalBorder(Voxel maximum, float radius, int i_init, int i_end, int j_init, int j_end, int k_init, int k_end); void allocateMatrix(int Nx, int Ny, int Nz); void generateRandomData(); int readTaggedRegion(); void setConstant(int value); void printData(); void printDataMatrixFormat(int k); void printData(int Nx, int Ny, int Nz); double findMaximum(Voxel& maximum); double findMaximum(Voxel& maximum, int i_init, int i_end, int j_init, int j_end, int k_init, int k_end); double findMaximum(int i_init, int i_end, int j_init, int j_end, int k_init, int k_end); double findMinimum(Voxel& maximum); size_t tagRegion(Sphere& maximum); void readRegion(Sphere& maximum); float subVolumePorosity(int i_init, int i_end, int j_init, int j_end, int k_init, int k_end); double testThreshold(int threshold); double testThresholdReverse(int threshold); double applyThreshold(int threshold); void loadRawData(string filename); void saveRawData(string filename); void saveRawData8bits(string filename); void saveRawData2D(string filename, int k); size_t index(int x, int y, int z)const { return x + (y - 1) * this->Nx + ((z - 1) * this->Ny * this->Nx); } };
36.505882
122
0.746374
[ "vector" ]
5c369fc6a63e29a64712bbfa435cf94ae0afaf05
3,645
h
C
HexRuntime/Runtime/Core/JIT/HexJIT/Frontend/Transformer.h
HexJacaranda/HexRuntime
0010be8ce78e3a842df2b772a92c31239379ce6c
[ "Apache-2.0" ]
1
2021-11-03T15:48:30.000Z
2021-11-03T15:48:30.000Z
HexRuntime/Runtime/Core/JIT/HexJIT/Frontend/Transformer.h
HexJacaranda/HexRuntime
0010be8ce78e3a842df2b772a92c31239379ce6c
[ "Apache-2.0" ]
null
null
null
HexRuntime/Runtime/Core/JIT/HexJIT/Frontend/Transformer.h
HexJacaranda/HexRuntime
0010be8ce78e3a842df2b772a92c31239379ce6c
[ "Apache-2.0" ]
null
null
null
#pragma once #include "..\..\..\..\RuntimeAlias.h" #include "..\..\..\Meta\MDRecords.h" #include "..\HexJITContext.h" #include "..\JITFlow.h" #include "..\IR.h" #include "EvaluationStack.h" namespace RTJ::Hex { /// <summary> /// Transform the opcode to basic block expression tree. /// </summary> class ILTransformer :public IHexJITFlow { HexJITContext* mJITContext; RTME::ILMD* mILMD; const UInt8* mCodePtr; const UInt8* mCodePtrBound; const UInt8* mPreviousCodePtr; EvaluationStack mEvalStack; // Fast streaming template<class T> ForcedInline T ReadAs() { T ret = *(T*)mCodePtr; mCodePtr += sizeof(T); return ret; } template<class T> ForcedInline T PeekAs()const { T ret = *(T*)mCodePtr; return ret; } /// <summary> /// Get offset of now /// </summary> /// <returns></returns> ForcedInline Int32 GetOffset()const; /// <summary> /// Get offset of previous instruction /// </summary> /// <returns></returns> ForcedInline Int32 GetPreviousOffset()const; /// <summary> /// Get the raw context of our context /// </summary> /// <returns></returns> ForcedInline JITContext* GetRawContext()const; ForcedInline RTM::AssemblyContext* GetAssembly()const; /// <summary> /// Decode the instruction at current memory /// </summary> /// <param name="opcode">opcode value</param> ForcedInline void DecodeInstruction(_RE_ UInt8& opcode); CallNode* GenerateCall(); TreeNode* GenerateLoadLocalVariable(UInt8 SLMode); TreeNode* GenerateLoadArgument(UInt8 SLMode); TreeNode* GenerateLoadField(UInt8 SLMode); TreeNode* GenerateLoadArrayElement(UInt8 SLMode); TreeNode* GenerateLoadString(); TreeNode* GenerateLoadConstant(); StoreNode* GenerateStoreField(); StoreNode* GenerateStoreArgument(); StoreNode* GenerateStoreLocal(); StoreNode* GenerateStoreArrayElement(); StoreNode* GenerateStoreToAddress(); NewNode* GenerateNew(); NewArrayNode* GenerateNewArray(); CompareNode* GenerateCompare(); TreeNode* GenerateDuplicate(); BinaryArithmeticNode* GenerateBinaryArithmetic(UInt8 opcode); UnaryArithmeticNode* GenerateUnaryArtithmetic(UInt8 opcode); ConvertNode* GenerateConvert(); CastNode* GenerateCast(); UnBoxNode* GenerateUnBox(); BoxNode* GenerateBox(); void GenerateJccPP(BasicBlockPartitionPoint*& partitions); void GenerateJmpPP(BasicBlockPartitionPoint*& partitions); void GenerateReturn(BasicBlockPartitionPoint*& partitions); /// <summary> /// The key standard for generating a statement is that eval stack is empty(balanced). /// Also there is case that unbalanced eval stack is unacceptable. For example, a call /// to certian method with void return type must be a statement /// </summary> /// <param name="value"></param> /// <param name="isBalancedCritical"></param> /// <returns></returns> Statement* TryGenerateStatement(TreeNode* value, Int32 beginOffset, bool isBalancedCritical = false); /// <summary> /// Firstly translate IL to a single basic block then partition it according to the /// information we collected /// </summary> /// <returns></returns> Statement* TransformToUnpartitionedStatements(_RE_ BasicBlockPartitionPoint*& partitions); /// <summary> /// Correctly partition the chained statements according to partition information. /// </summary> /// <param name="unpartitionedStmt"></param> /// <param name="partitions"></param> /// <returns></returns> BasicBlock* PartitionToBB(Statement* unpartitionedStmt, BasicBlockPartitionPoint* partitions); public: ILTransformer(HexJITContext* context); virtual BasicBlock* PassThrough() final; }; }
32.837838
103
0.719342
[ "transform" ]
5c482fa2a08f44818568e3e43a555ef8043d91e1
47,589
c
C
tests/decode/test8_suit12/src/main.c
LairdCP/zcbor
942ae07b0d94168526ceb85bf1d0f18deaf2d482
[ "Apache-2.0" ]
4
2022-03-06T08:16:13.000Z
2022-03-23T03:41:01.000Z
tests/decode/test8_suit12/src/main.c
LairdCP/zcbor
942ae07b0d94168526ceb85bf1d0f18deaf2d482
[ "Apache-2.0" ]
28
2022-01-18T13:32:20.000Z
2022-03-30T11:42:21.000Z
tests/decode/test8_suit12/src/main.c
LairdCP/zcbor
942ae07b0d94168526ceb85bf1d0f18deaf2d482
[ "Apache-2.0" ]
5
2022-02-28T21:13:52.000Z
2022-03-15T10:38:22.000Z
/* * Copyright (c) 2021 Nordic Semiconductor ASA * * SPDX-License-Identifier: Apache-2.0 */ #include <ztest.h> #include "manifest12_decode.h" #include "zcbor_debug.h" // Enables use of print functions when debugging tests. /* Test vector discovered via fuzzing with AFL. */ uint8_t crash_vector0[] = { 0xd8, 0x30, 0xa4, 0x02, 0x58, 0x73, 0x82, 0x58, 0x24, 0x82, 0x02, 0x58, 0x20, 0x5c, 0x09, 0x7e, 0xf6, 0x4b, 0xf3, 0x00, 0x9b, 0x49, 0x4e, 0xef, 0x8d, 0x46, 0x6c, 0xc9, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x00, 0x04, 0x58, 0x56, 0x86, 0x14, 0xa4, 0x01, 0x5a, 0xfa, 0x6b, 0x4a, 0x53, 0xd5, 0xad, 0x5f, 0xdf, 0xbe, 0x9d, 0xe6, 0x63, 0xe4, 0xd4, 0x1f, 0xfe, 0x02, 0x50, 0x14, 0x92, 0xaf, 0x14, 0x25, 0x69, 0x5e, 0x48, 0xbf, 0x42, 0x9b, 0x2d, 0x51, 0xf2, 0xab, 0x45, 0x03, 0x58, 0x24, 0x82, 0x02, 0x58, 0x20, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x02, 0xf6, 0x39, 0xa8, 0x55, 0xec, 0x9a, 0xf3, 0xe9, 0xed, 0xdb, 0x99, 0x58, 0x4a, 0xd2, 0x84, 0x01, 0x00, 0x01, 0x26, 0xa0, 0xf6, 0x58, 0x40, 0xa1, 0x9f, 0xd1, 0xf2, 0x3b, 0x17, 0xbe, 0xfc, 0x32, 0x1c, 0xec, 0xe7, 0x42, 0x3d, 0xfb, 0x48, 0xc4, 0x57, 0xb8, 0xf1, 0xf6, 0xac, 0x83, 0x57, 0x7a, 0x3c, 0x10, 0xc6, 0x77, 0x3f, 0x6f, 0x3a, 0x82, 0x11, 0x37, 0x6b, 0x59, 0x54, 0x09, 0x20, 0xb6, 0xc5, 0xf5, 0x7b, 0xac, 0x5f, 0xc8, 0x54, 0x3d, 0x8f, 0x5d, 0x3d, 0x97, 0x4f, 0xaa, 0x2e, 0x6d, 0x03, 0xda, 0xa5, 0x34, 0xb4, 0x43, 0xa7, 0x03, 0x58, 0x71, 0xa5, 0x01, 0x01, 0x02, 0x00, 0x03, 0x58, 0x5f, 0xa2, 0x02, 0x81, 0x81, 0x41, 0x00, 0x04, 0x58, 0x56, 0x86, 0x14, 0xa4, 0x01, 0x50, 0xfa, 0x6b, 0x4a, 0x53, 0xd5, 0xad, 0x5f, 0xdf, 0xbe, 0x9d, 0xe6, 0x63, 0xe4, 0xd4, 0x1f, 0xfe, 0x02, 0x50, 0x14, 0x92, 0xaf, 0x14, 0x25, 0x69, 0x5e, 0x48, 0xbf, 0x42, 0x9b, 0x2d, 0x51, 0xf2, 0xab, 0x45, 0x03, 0x58, 0x24, 0x82, 0x02, 0x58, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x20, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff, 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10, 0x0e, 0x19, 0x87, 0xd0, 0x01, 0x0f, 0x02, 0x0f, 0x0a, 0x43, 0x82, 0x03, 0x0f, 0x0c, 0x00, 0x00, 0x7f, 0xff, 0x50, 0x9a, 0x00, 0xf9, 0x80, 0xb0, 0x84, 0x43, 0x64, 0xff, 0xba, 0x98, 0x49, 0x00, 0xe6, 0x76, 0xf5, 0x00, 0x00, 0xfa, 0x47, 0x00, 0x7f, 0x78, 0x51, 0x10, 0x10, 0x1a, 0xfa, 0x2c }; /* Test vector discovered via fuzzing with AFL. */ uint8_t crash_vector1[] = { 0xd8, 0x30, 0xa4, 0x02, 0x58, 0x73, 0x82, 0x58, 0x24, 0x82, 0x02, 0x58, 0x20, 0x5c, 0x09, 0x7e, 0xf6, 0x4b, 0xf3, 0x00, 0x9b, 0x49, 0x4e, 0x71, 0xe1, 0xf2, 0x41, 0x8e, 0xef, 0x8d, 0x46, 0x6c, 0xc9, 0x02, 0xf6, 0x39, 0xfb, 0x48, 0xc4, 0x57, 0xb8, 0xf1, 0xf6, 0xac, 0x83, 0x57, 0x7a, 0xd2, 0x84, 0x43, 0xa1, 0x01, 0x26, 0xa0, 0xf6, 0x58, 0x40, 0xa1, 0x9f, 0xd1, 0xf2, 0x3b, 0x17, 0xbe, 0xfc, 0x32, 0x1c, 0x00, 0x80, 0x42, 0x3d, 0xfb, 0x48, 0xc4, 0x57, 0xb8, 0xf1, 0xf6, 0xac, 0x83, 0x57, 0x7a, 0x3c, 0x10, 0xc6, 0x77, 0x3f, 0x6f, 0x3a, 0x79, 0x02, 0x37, 0x6b, 0x59, 0x54, 0x09, 0x20, 0xb6, 0xc5, 0xf5, 0x7b, 0xac, 0x5f, 0xc8, 0x54, 0x3d, 0x8f, 0x5d, 0x3d, 0x97, 0x4f, 0xaa, 0x2e, 0x6d, 0x03, 0xda, 0xa5, 0x34, 0xb4, 0x43, 0xa7, 0x03, 0x58, 0x71, 0xa5, 0x01, 0x01, 0x02, 0x00, 0x03, 0x58, 0x5f, 0xa2, 0x02, 0x60, 0x81, 0x41, 0x00, 0x04, 0x58, 0x56, 0x86, 0x14, 0xa4, 0x01, 0x50, 0xfa, 0x6b, 0x4a, 0x53, 0xd5, 0xad, 0x5f, 0xdf, 0xbe, 0x9d, 0xe6, 0x63, 0xe4, 0xd4, 0x1f, 0xfe, 0x02, 0x50, 0x14, 0x92, 0xaf, 0x14, 0x25, 0x69, 0x5e, 0x48, 0xbf, 0x42, 0x9b, 0x2d, 0x51, 0xf2, 0xab, 0x45, 0x03, 0x58, 0x24, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff, 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10, 0x0e, 0x19, 0x87, 0xd0, 0x01, 0x0f, 0x02, 0x0f, 0x0a, 0x43, 0x82, 0x03, 0x0f, 0x0c, 0x43, 0x82, 0x17, 0x01, 0x50, 0x9a, 0x00, 0xf9, 0x80, 0xb0, 0x84, 0x43, 0x64, 0xff, 0xba, 0x98, 0x49, 0x00, 0xe6, 0x76, 0xf5, 0x00, 0x00, 0xfa, 0x47, 0x00, 0x7f, 0x78, 0x51, 0x10, 0x10, 0x1a, 0xfa, 0x2c }; /* Test vector discovered via fuzzing with AFL. */ uint8_t crash_vector2[] = { 0xd8, 0x30, 0xa2, 0x02, 0x58, 0x73, 0x82, 0x58, 0x24, 0x82, 0x02, 0x58, 0x20, 0x5c, 0x09, 0x7e, 0xf6, 0x4b, 0xf3, 0x00, 0x9b, 0x49, 0x4e, 0x71, 0xe1, 0xf2, 0x41, 0x8e, 0xef, 0x8d, 0x46, 0xff, 0xff, 0xff, 0xf6, 0x39, 0xa8, 0x55, 0xec, 0x9a, 0xf3, 0xe9, 0xed, 0xdb, 0x99, 0x58, 0x4a, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xb8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0x5a, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xda, 0xc0, 0xc0, 0xc0, 0xb9, 0xc0, 0xc0, 0xc0, 0xc0, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0x80, 0x00, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xda, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xa8, 0xa8, 0xa8, 0xa8, 0x82, 0x82, 0x82, 0x82, 0xff, 0xff, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x93, 0x82, 0x82, 0x82, 0x82, 0x0b, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x83, 0x82, 0x00, 0x00, 0x00, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10, 0x0e, 0x19, 0x87, 0xd0, 0x01, 0x0f, 0x02, 0x0f, 0x0a, 0x43, 0x82, 0x03, 0x0f, 0x0c, 0x43, 0x7f, 0x02, 0x58, 0x20, 0x5c, 0x09, 0x7e, 0xf6, 0x4b, 0xdc, 0x40, 0x13, 0x63, 0xb5, 0x45, 0x03, 0x33, 0x00, 0x9b, 0x49, 0x0a, 0x43, 0x33, 0x3d, 0x50, 0x1f, 0x86, 0x64, 0xe2, 0x98, 0x14, 0x42, 0xd1, 0x3d, 0x50, 0x17, 0x6b, 0x4a, 0x53, 0xd5, 0xad, 0x5f, 0xcb, 0xbe, 0xb4, 0x45, 0x67, 0x20, 0x00, 0x50, 0x50, 0x50, 0x45, 0x50, 0x00, 0x00, 0x00, 0x20, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x9d, 0x70, 0x0f, 0x39, 0x39, 0x39, 0x39, 0x39, 0x00, 0x05, 0xff, 0xff, 0x05, 0x00, 0x02, 0x7b, 0xac, 0x70, 0xbf, 0x00, 0x8e, 0x50, 0x79, 0x80, 0xbf, 0x00, 0x6e, 0x24, 0x62, 0x01, 0x04, 0xa4, 0x01, 0xab, 0x30, 0x08, 0x08, 0x08, 0x08, 0x08, 0x07, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x70, 0x3a, 0x2f, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x66, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x05, 0xff, 0xff, 0x05, 0x00, 0x02, 0x7b, 0xac, 0x5f, 0xc8, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x07, 0xfe, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00, 0x01, 0x00, 0x08, 0x08, 0x08, 0x08, 0xe7, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x58, 0x27, 0x63, 0xe4, 0xd4, 0x5f, 0xe5, 0xe5, 0xff, 0xe5, 0xe5, 0xe5, 0x2f, 0x65, 0x0c, 0x59, 0x67, 0x82, 0xe2, 0x82, 0x81, 0x41, 0x00, 0xa0, 0x00, 0x10, 0x65, 0x78, 0x64, 0x00, 0x00, 0x50, 0x4b, 0x01, 0x55, 0x66, 0x77, 0x88, 0x00, 0xf1, 0x42, 0x02, 0x57, 0x72, 0xc8, 0x02, 0x00, 0x40, 0xb9, 0x02, 0x57, 0x91, 0xa5, 0xaf, 0x1c, 0x46, 0x69, 0x5e, 0x5f, 0xc8, 0x94, 0xa6, 0x80, 0xd6, 0xb5, 0x98, 0x3c, 0x27, 0x4d, 0xab, 0xa8, 0x97, 0xbe, 0xff, 0x80, 0xb0, 0x10, 0x50, 0x79, 0x70, 0xbf, 0x00, 0x8e, 0x50, 0x79, 0x80, 0xbf, 0x00, 0x6e, 0x24, 0x62, 0x01, 0x04, 0xa4, 0x01, 0xab, 0x30, 0x08, 0x08, 0x08, 0x08, 0x08, 0x07, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x70, 0x3a, 0x2f, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x66, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x05, 0xff, 0xff, 0x05, 0x00, 0x02, 0x7b, 0xac, 0x5f, 0xc8, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x07, 0xfe, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x1b, 0x09, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x1c, 0x01, 0x00, 0x08, 0x08, 0x08, 0x08, 0xe7, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0xf3, 0xe9, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x07, 0xee, 0x08, 0x08, 0x08, 0x58, 0x27, 0x63, 0xe4, 0xd4, 0x5f, 0xb1, 0x02, 0x50, 0x79, 0x84, 0x43, 0xa1, 0x01, 0x19, 0xa0, 0xf6, 0x2c, 0x40, 0xa1, 0xfd, 0xe5, 0xff, 0xff, 0xe5, 0xe5, 0xe5, 0x2f, 0x65, 0x0c, 0x59, 0x67, 0x82, 0xe2, 0x82, 0x81, 0x41, 0x00, 0xa0, 0x00, 0x10, 0x65, 0x78, 0x64, 0x00, 0x00, 0x50, 0x4b, 0x01, 0x55, 0x66, 0x77, 0x88, 0x00, 0xf1, 0x42, 0x02, 0x57, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x17, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x00, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0xf6, 0xac, 0x83, 0x57, 0x7a, 0x3c, 0x10, 0xc6, 0x77, 0x3f, 0x6f, 0x3a, 0x79, 0x02, 0x37, 0x6b, 0x59, 0x54, 0x09, 0x20, 0xb6, 0xc5, 0xf5, 0x7b, 0xac, 0x5f, 0xc8, 0x54, 0x3d, 0x8f, 0x5d, 0x3d, 0x97, 0x4f, 0xaa, 0x2e, 0x6d, 0x03, 0xda, 0xa5, 0x34, 0xb4, 0x43, 0xa7, 0x03, 0x58, 0x71, 0xa5, 0x01, 0x01, 0x02, 0x00, 0x03, 0x58, 0x5f, 0xa2, 0x02, 0x33, 0x81, 0x41, 0x02, 0x04, 0x58, 0x56, 0x86, 0x14, 0xa4, 0x67, 0x66, 0xab, 0xcd, 0xef, 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x20, 0x00, 0x19, 0x0e, 0x19, 0x20, 0xd0, 0x01, 0x0f, 0x02, 0x0f, 0x0a, 0x43, 0x82, 0x03, 0x00, 0x00, 0x00, 0x20, 0x17, 0x01, 0x50, 0x9a, 0x00, 0xf9, 0x80, 0xb0, 0x84, 0x43, 0x64, 0xff, 0xba, 0x98, 0x49, 0x00, 0xe6, 0x76, 0xf5, 0x00, 0x00, 0xfa, 0x47, 0x7f, 0x39, 0xa8, 0x55, 0xec, 0x9a, 0xf3, 0xe9, 0xed, 0xdb, 0x99, 0x58, 0x4a, 0xd2, 0x64, 0x00, 0x00, 0x00, 0xfe, 0x02, 0x50, 0x14, 0x92, 0xaf, 0x14, 0x25, 0x69, 0x5e, 0x01, 0xbf, 0x42, 0x9b, 0x2d, 0x51, 0xf2, 0x2b, 0x41, 0x03, 0x58, 0x24, 0x5c, 0x00, 0xf9, 0x74, 0x51, 0x00, 0x01, 0x00, 0x08, 0x08, 0x08, 0x08, 0xe7, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x07, 0xf3, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x10, 0x10, 0x1a, 0xfa, 0x2c }; /* Test vector discovered via fuzzing with AFL. */ uint8_t crash_vector3[] = { 0xd8, 0x30, 0xa4, 0x02, 0x58, 0x73, 0x82, 0x58, 0x24, 0x82, 0x02, 0x58, 0x20, 0x5c, 0x09, 0x7e, 0xf6, 0x4b, 0xf3, 0x00, 0x9b, 0x49, 0x4e, 0x71, 0xe1, 0xf2, 0x41, 0x8e, 0xef, 0x8d, 0x46, 0x6c, 0xc9, 0x02, 0xf6, 0x39, 0xa8, 0x4f, 0xec, 0x9a, 0x86, 0x73, 0xdb, 0x48, 0xbb, 0x57, 0xb8, 0xf1, 0xe5, 0xa8, 0x26, 0x38, 0x01, 0x0c, 0x7a, 0xf4, 0x80, 0x06, 0x64, 0x00, 0x10, 0x00, 0xf3, 0xe9, 0xed, 0xdb, 0x99, 0x58, 0x4a, 0xd2, 0x84, 0x43, 0xa1, 0x01, 0x26, 0xf2, 0xf6, 0x58, 0x40, 0xa1, 0x9f, 0xd1, 0xf2, 0x3b, 0x17, 0xbe, 0xfc, 0x32, 0x1c, 0xec, 0xe7, 0x42, 0x3d, 0xfb, 0x48, 0xc4, 0x20, 0x00, 0x00, 0x00, 0xac, 0x83, 0x57, 0x7a, 0x3c, 0x10, 0xc6, 0x77, 0x3f, 0x6f, 0x3a, 0x79, 0x02, 0x42, 0x3d, 0xfb, 0x48, 0xc4, 0x57, 0xb8, 0xf1, 0xf6, 0xac, 0x83, 0x57, 0x7a, 0x3c, 0x04, 0xc6, 0x77, 0x3f, 0x6f, 0x3a, 0x79, 0x02, 0x37, 0x6b, 0x59, 0x54, 0x09, 0x20, 0xb6, 0xc5, 0xf5, 0x7b, 0xac, 0x5f, 0xc8, 0x54, 0x3d, 0x8f, 0x5d, 0x3d, 0x97, 0x4f, 0xaa, 0x2e, 0x6d, 0x03, 0xda, 0xa5, 0x34, 0xb4, 0x43, 0xa7, 0x03, 0x58, 0x71, 0xa5, 0x01, 0x01, 0x02, 0x00, 0x45, 0x1b, 0x58, 0x24, 0x82, 0x02, 0x58, 0x20, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff, 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10, 0x0e, 0x19, 0x87, 0xd0, 0x01, 0x0f, 0x02, 0x0f, 0x0a, 0x43, 0x82, 0x03, 0x0f, 0x0c, 0x43, 0x82, 0x17, 0x01, 0x50, 0x9a, 0x00, 0x10, 0xff, 0x1a, 0xfa, 0x2c }; /* Test vector discovered via fuzzing with AFL. */ uint8_t crash_vector4[] = { 0xd8, 0x30, 0xa4, 0x02, 0x58, 0x73, 0x82, 0x58, 0x24, 0x82, 0x02, 0x58, 0x20, 0x5c, 0x09, 0x7e, 0xf6, 0x4b, 0xf3, 0x00, 0x9b, 0x39, 0x4e, 0x71, 0xe1, 0xf2, 0x41, 0x8e, 0xef, 0x8d, 0x46, 0x6c, 0xc9, 0x02, 0xf6, 0x39, 0xa8, 0x55, 0xec, 0x9a, 0xf3, 0xe9, 0xed, 0xdb, 0x99, 0x58, 0x4a, 0xd2, 0x84, 0x43, 0xa1, 0x01, 0x58, 0x56, 0x86, 0x14, 0xa4, 0x01, 0x5a, 0xfa, 0x6b, 0x4a, 0x53, 0xd5, 0xad, 0x5f, 0xdf, 0xbe, 0x9d, 0xe6, 0x63, 0xe4, 0xd4, 0x1f, 0xfe, 0x02, 0x81, 0x14, 0x92, 0xaf, 0x14, 0x25, 0x69, 0x5e, 0x48, 0xbf, 0x42, 0x9b, 0x3a, 0x79, 0x02, 0x37, 0x6b, 0x59, 0x54, 0x09, 0x20, 0x93, 0xc5, 0xf5, 0x7b, 0xac, 0x5f, 0xc8, 0x54, 0x3d, 0x8f, 0x5d, 0x3d, 0x97, 0x4f, 0xaa, 0x2e, 0x6d, 0x03, 0xda, 0xa5, 0x34, 0xb4, 0x43, 0xa7, 0x03, 0x58, 0x71, 0xa5, 0x01, 0x01, 0x02, 0x00, 0x03, 0x58, 0x5f, 0xa2, 0x02, 0x81, 0x81, 0x41, 0x00, 0x04, 0x58, 0x56, 0x86, 0x14, 0xa4, 0x01, 0x5a, 0xfa, 0x6b, 0x4a, 0x53, 0xd5, 0xad, 0x5f, 0xdf, 0xbe, 0x02, 0x58, 0x20, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff, 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0xaf, 0xcc, 0xbb, 0xf1, 0xe2, 0x00, 0x23, 0x45, 0xab, 0x39, 0xc9, 0xca, 0xf1, 0xfa, 0xff, 0x9a, 0x98, 0x49, 0x00, 0x04, 0x00, 0x23, 0xff, 0x0c, 0x04, 0x22, 0x58, 0x67, 0x83, 0x02, 0xba, 0x98, 0x49, 0x00, 0xe6, 0x76, 0xf5, 0x00, 0x00, 0xfa, 0x47, 0x00, 0x7f, 0x78, 0x51, 0x10, 0x10, 0x1a, 0xfa, 0x2c }; /* Test vector discovered via fuzzing with AFL. */ uint8_t crash_vector5[] = { 0xd8, 0x30, 0xa4, 0x02, 0x58, 0x73, 0x82, 0x58, 0x24, 0x82, 0x02, 0x58, 0x20, 0x5c, 0x09, 0x7e, 0xf6, 0x4b, 0xf3, 0x00, 0x9b, 0x49, 0x4e, 0x71, 0xe1, 0xf2, 0x41, 0x8e, 0xef, 0x8d, 0x46, 0x6c, 0xc9, 0x02, 0xf6, 0x39, 0xa8, 0x55, 0xec, 0x9a, 0xf3, 0xe9, 0xed, 0xdb, 0x99, 0x58, 0x34, 0xb4, 0x43, 0xa7, 0x03, 0x58, 0x71, 0xa5, 0x01, 0x01, 0x02, 0x00, 0x03, 0x58, 0x5f, 0xa2, 0x02, 0x81, 0x81, 0x41, 0x00, 0x04, 0x58, 0x56, 0x86, 0x14, 0xa4, 0x01, 0x5a, 0xfa, 0x6b, 0x4e, 0x53, 0xd5, 0xad, 0x5f, 0xdf, 0xbe, 0x9d, 0xe6, 0x63, 0xe4, 0xd4, 0x1f, 0xfe, 0x02, 0x50, 0x14, 0x92, 0xaf, 0x14, 0x25, 0x69, 0x5e, 0x48, 0xbf, 0x42, 0x9b, 0x2d, 0x51, 0xf2, 0xab, 0x45, 0x03, 0x58, 0x24, 0x82, 0x02, 0x58, 0x20, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff, 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10, 0x0e, 0x19, 0x87, 0xd0, 0x01, 0x0f, 0x02, 0x0f, 0x0a, 0x43, 0x82, 0x03, 0x0f, 0x0c, 0x43, 0x82, 0x17, 0x01, 0x50, 0x9a, 0x00, 0xf9, 0x80, 0xb0, 0x84, 0x43, 0x64, 0xff, 0xba, 0x98, 0x49, 0x00, 0xe6, 0x76, 0xf5, 0x00, 0x00, 0xfa, 0x47, 0x00, 0x7f, 0x78, 0x51, 0x10, 0x10, 0x1a, 0xfa, 0x2c }; /* Test vector discovered via fuzzing with AFL. */ uint8_t crash_vector6[] = { 0xd8, 0x30, 0xa4, 0x02, 0x58, 0x73, 0x82, 0x58, 0x24, 0x82, 0x02, 0x58, 0x20, 0x5c, 0x09, 0x7e, 0xf6, 0x4b, 0xf3, 0x00, 0x9b, 0x49, 0x4e, 0x71, 0xe1, 0xe3, 0x41, 0x8e, 0xef, 0x8d, 0x46, 0x6c, 0xc9, 0x02, 0xf6, 0x39, 0xa8, 0x55, 0xec, 0x9a, 0xf3, 0xe9, 0xed, 0xdb, 0x99, 0x58, 0x4a, 0x92, 0x84, 0x65, 0xbe, 0xfc, 0x32, 0x1c, 0xec, 0xe7, 0x42, 0x3d, 0xfb, 0x48, 0xc4, 0x57, 0xb8, 0xf1, 0xf6, 0xac, 0x83, 0x57, 0x7a, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xcf, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xa5, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xa5, 0xe4, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc3, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xef, 0x8d, 0x46, 0x51, 0xc9, 0x02, 0xf6, 0x39, 0xa8, 0x55, 0xec, 0x9a, 0xf3, 0xe9, 0xed, 0xdb, 0x99, 0x58, 0x4a, 0xd2, 0x84, 0x43, 0xa1, 0x01, 0x26, 0xa0, 0xf6, 0x58, 0x40, 0xa1, 0x9f, 0xd1, 0xf2, 0x3b, 0x17, 0xbe, 0xfc, 0x32, 0x1c, 0xec, 0xe7, 0x42, 0x3d, 0xfb, 0x48, 0xc4, 0x57, 0xb8, 0xf1, 0xf6, 0xac, 0x83, 0x57, 0x7a, 0x3c, 0x10, 0xc6, 0x77, 0x3f, 0x6f, 0xa5, 0x01, 0x01, 0x02, 0x00, 0x03, 0x58, 0x09, 0x20, 0xb6, 0xc5, 0xf5, 0x7b, 0xac, 0x5f, 0xc8, 0x54, 0x3d, 0x8f, 0x5d, 0x3d, 0x97, 0x4f, 0xaa, 0x2e, 0x6d, 0x03, 0xda, 0xa5, 0x34, 0xb4, 0x43, 0xa7, 0x03, 0x58, 0x71, 0xa5, 0x01, 0x01, 0x02, 0x00, 0x03, 0x58, 0x5f, 0xa2, 0x02, 0x81, 0x81, 0x41, 0x00, 0x1b, 0x58, 0x56, 0x86, 0x14, 0xa4, 0x01, 0x50, 0xfa, 0x6b, 0x4a, 0x53, 0xd5, 0xad, 0x5f, 0xdf, 0xbe, 0x9d, 0xe6, 0x63, 0xe4, 0xd4, 0x1f, 0xfe, 0x02, 0x50, 0x14, 0x92, 0xaf, 0x14, 0x25, 0x69, 0x5e, 0x48, 0xbf, 0x42, 0x9b, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0x76, 0xf5, 0x00, 0x00, 0xfa, 0x47, 0x00, 0x7f, 0x78, 0x51, 0x10, 0x10, 0x1a, 0xfa, 0x2c }; /* Test vector discovered via fuzzing with AFL. */ uint8_t crash_vector7[] = { 0xd8, 0x30, 0xa4, 0x02, 0x58, 0x73, 0x82, 0x58, 0x24, 0x82, 0x02, 0x58, 0x11, 0x5c, 0x09, 0x7e, 0xf6, 0x4b, 0xf3, 0x00, 0x9b, 0x49, 0x4e, 0x71, 0xe1, 0xf2, 0x41, 0x8e, 0xef, 0x8d, 0x46, 0x5a, 0xc9, 0x02, 0xf6, 0x39, 0xe8, 0x55, 0xec, 0x9a, 0xf3, 0xe9, 0xed, 0xdb, 0x99, 0x58, 0x4a, 0xd2, 0x84, 0x43, 0xa1, 0x01, 0x26, 0xa0, 0xf6, 0x58, 0x25, 0x1c, 0xec, 0xe7, 0x42, 0x3d, 0xfb, 0x48, 0xc4, 0x57, 0xb8, 0xf1, 0xf6, 0xac, 0x83, 0x57, 0x92, 0xaf, 0x14, 0x25, 0x69, 0x5e, 0x48, 0xbf, 0x42, 0x9b, 0x2d, 0x51, 0xf2, 0xab, 0x27, 0x03, 0x58, 0x24, 0x82, 0x02, 0x58, 0x20, 0x00, 0x01, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff, 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10, 0x0e, 0x19, 0x87, 0xd0, 0x01, 0x0f, 0x02, 0x0f, 0x0a, 0x43, 0x82, 0x03, 0x0f, 0x0c, 0x43, 0x82, 0x17, 0x01, 0x50, 0x9a, 0x00, 0xf9, 0x80, 0xb0, 0x84, 0x43, 0x64, 0xff, 0xba, 0x98, 0x49, 0x00, 0xe6, 0x76, 0xf5, 0x00, 0x00, 0xfa, 0x47, 0x00, 0x7f, 0x78, 0x51, 0x10, 0x10, 0x1a, 0xfa, 0x2c }; /* Test vector discovered via fuzzing with AFL. */ uint8_t crash_vector8[] = { 0xd8, 0x30, 0xa4, 0x01, 0x52, 0x9a, 0x00, 0x00, 0x00, 0x01, 0x81, 0x47, 0x94, 0x7a, 0xee, 0x9a, 0xf3, 0xe9, 0xed, 0xdb, 0x99, 0x58, 0x4a, 0xd2, 0x84, 0x43, 0xa1, 0x01, 0x26, 0xa0, 0xf6, 0x58, 0x40, 0xa1, 0x9f, 0xd1, 0xf2, 0x3b, 0x17, 0xbe, 0xfc, 0x32, 0x1c, 0xec, 0xe7, 0x42, 0x3d, 0xfb, 0x48, 0xc4, 0x57, 0xb8, 0xf1, 0xf6, 0xac, 0x83, 0x57, 0x7a, 0x3c, 0x10, 0xc6, 0x77, 0x3f, 0x6f, 0x3a, 0x79, 0x02, 0x37, 0x6b, 0x59, 0x54, 0x09, 0x20, 0xb6, 0xc5, 0xf5, 0x7b, 0xac, 0x5f, 0xc8, 0x54, 0x3d, 0x8f, 0x5d, 0x3d, 0x97, 0x4f, 0xaa, 0x2e, 0x6d, 0x03, 0xda, 0xa5, 0x34, 0xb4, 0x43, 0xa7, 0x03, 0x58, 0x71, 0xa5, 0x01, 0x01, 0x02, 0x00, 0x03, 0x00, 0x20, 0xa2, 0x02, 0x81, 0x81, 0x41, 0x00, 0x04, 0x58, 0x56, 0x86, 0xff, 0x7f, 0x01, 0x50, 0xfa, 0x6b, 0x4a, 0x53, 0xd5, 0xad, 0x5f, 0xdf, 0xbe, 0x9d, 0xe6, 0x63, 0xe4, 0xd4, 0x1f, 0xbe, 0xfe, 0x02, 0x50, 0x14, 0x92, 0xaf, 0x00, 0x00, 0xfa, 0x39, 0x00, 0x00, 0x00, 0xfa, 0x39, 0x00, 0x14, 0x25, 0x4b, 0xf3, 0x00, 0x9b, 0x49, 0x4e, 0x71, 0xe1, 0xf2, 0x41, 0x8e, 0xef, 0x8d, 0x46, 0x6c, 0xc9, 0x02, 0xf6, 0x39, 0xa8, 0x55, 0xec, 0x9a, 0xf3, 0xe9, 0xed, 0xdb, 0x99, 0x58, 0x4a, 0xd2, 0x84, 0x43, 0xa1, 0x01, 0x26, 0xa0, 0xf6, 0x58, 0x40, 0xa1, 0x9f, 0xd1, 0xf2, 0x3b, 0x17, 0xbe, 0xfc, 0x32, 0x1c, 0xec, 0xe7, 0x42, 0x3d, 0xfb, 0x48, 0xc4, 0x57, 0xb8, 0xf1, 0xf6, 0xac, 0x83, 0x57, 0x7a, 0x3c, 0x10, 0xc6, 0x77, 0x3f, 0x6f, 0x3a, 0x79, 0x02, 0x37, 0x6b, 0x59, 0x54, 0x09, 0x20, 0xb6, 0xc5, 0xf5, 0x7b, 0xac, 0x5f, 0xc8, 0x54, 0x3d, 0x8f, 0x5d, 0x3d, 0x97, 0x4f, 0xaa, 0x2e, 0x6d, 0x03, 0xda, 0xa5, 0x34, 0xb4, 0x43, 0xa7, 0x03, 0x58, 0x71, 0xa5, 0x01, 0x01, 0x02, 0x46, 0x59, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x4b, 0x46, 0x46, 0x46, 0x46, 0x46, 0x00, 0x40, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0xff, 0xff, 0xff, 0x7f, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x66, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0xe6, 0x76, 0xf5, 0x00, 0x00, 0xfa, 0x2d, 0x00, 0x88, 0x94, 0x94, 0x94, 0xbd, 0x01, 0xa2, 0xa2, 0x4d, 0x20, 0x00, 0x5f, 0x4d, 0x63, 0x00, 0x39, 0x4d, 0x00 }; /* Test vector discovered via fuzzing with AFL. */ uint8_t crash_vector9[] = { 0xd8, 0x30, 0xa4, 0x02, 0x58, 0x73, 0x82, 0x58, 0x24, 0x82, 0x02, 0x58, 0x20, 0x71, 0xe1, 0xf2, 0x41, 0x8e, 0xef, 0x6a, 0x46, 0x6c, 0xc9, 0x02, 0xf6, 0x39, 0x41, 0x8e, 0xef, 0x8d, 0x46, 0x6c, 0xc9, 0x02, 0xf6, 0x39, 0xa8, 0x55, 0xec, 0x9a, 0xf3, 0xe9, 0xed, 0xdb, 0x99, 0x58, 0x4a, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x7a, 0xf4, 0x68, 0xff, 0xff, 0xff, 0x39, 0x39, 0x35, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x3f, 0xab, 0x7d, 0x10, 0xda, 0x00, 0x00, 0x10, 0x65, 0x78, 0x64, 0x00, 0x00, 0x40, 0x13, 0x63, 0x6f, 0x4a, 0x00, 0xbf, 0x56, 0x28, 0x60, 0x9a, 0xd6, 0x38, 0x3d, 0xce, 0x14, 0xc7, 0x20, 0xa1, 0xba, 0x43, 0x00, 0x2f, 0xe3, 0xf5, 0xcd, 0x00, 0xa0, 0x41, 0x43, 0x00, 0x2f, 0xe3, 0xf5, 0xcd, 0x02, 0x40, 0x0f, 0x0c, 0xbe, 0x7a, 0xf4, 0x80, 0x80, 0x80, 0x80, 0x86, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x70, 0xe6, 0x20, 0x74, 0x70, 0x78, 0x74, 0x20, 0x25, 0x7b, 0x7b, 0x6d, 0x1a, 0x6e, 0x69, 0x68, 0xff, 0x02, 0xff, 0xd9, 0x01, 0x26, 0xa0, 0xf7, 0x1c, 0x46, 0x69, 0x5e, 0x58, 0x24, 0x82, 0x02, 0x58, 0x20, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff, 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10, 0x0e, 0x19, 0x87, 0xd0, 0x01, 0x0f, 0x02, 0x0f, 0x0a, 0x43, 0x82, 0x03, 0x0f, 0x0c, 0x43, 0x82, 0x17, 0x01, 0x50, 0x9a, 0x00, 0xf9, 0x80, 0xb0, 0x84, 0x43, 0x64, 0xff, 0xba, 0x98, 0x49, 0x00, 0xe6, 0x76, 0xf5, 0x00, 0x00, 0xfa, 0x47, 0x00, 0x7f, 0x75, 0x51, 0x10, 0x10, 0x1a, 0xfa, 0x2c }; /* Test vector discovered via fuzzing with AFL. */ uint8_t crash_vector10[] = { 0xd8, 0x30, 0xa4, 0x02, 0x58, 0x73, 0x82, 0x58, 0x24, 0x82, 0x02, 0x58, 0x20, 0x5c, 0x09, 0x7e, 0xf6, 0x4b, 0xf3, 0x00, 0x9b, 0x49, 0x4e, 0x71, 0xe1, 0xf2, 0x41, 0x8e, 0xef, 0x8d, 0x46, 0x6c, 0xc9, 0x02, 0xf6, 0x39, 0xa8, 0x55, 0xec, 0x9a, 0xf3, 0xe9, 0xed, 0xdb, 0x99, 0x58, 0x4a, 0xd2, 0x84, 0x43, 0xa1, 0x01, 0x26, 0xa0, 0xf6, 0x58, 0x40, 0xa1, 0x9f, 0xd1, 0xf2, 0x3b, 0x17, 0xbe, 0xfc, 0x32, 0x1c, 0x00, 0x80, 0x42, 0x3d, 0xfb, 0x48, 0xc4, 0x57, 0xb8, 0xf1, 0xf6, 0xac, 0x83, 0x57, 0x7a, 0x3c, 0x10, 0xc6, 0x77, 0x3f, 0x6f, 0x3a, 0x79, 0x02, 0x37, 0x6b, 0x59, 0x54, 0x09, 0x20, 0xb6, 0xc5, 0xf5, 0x7b, 0xac, 0x5f, 0xc8, 0x54, 0x3d, 0x8f, 0x5d, 0x3d, 0x97, 0x4f, 0xaa, 0x2e, 0x6d, 0x03, 0xda, 0xa5, 0x34, 0xb4, 0x43, 0xa7, 0x03, 0x58, 0x71, 0xa5, 0x01, 0x01, 0x02, 0x00, 0x03, 0x58, 0x5f, 0xa2, 0x02, 0x81, 0x81, 0x41, 0x00, 0x04, 0x58, 0x56, 0x86, 0x14, 0xa4, 0x01, 0x50, 0xfa, 0x6b, 0x4a, 0x53, 0xd5, 0xad, 0x5f, 0xdf, 0xbe, 0x9d, 0xe6, 0x63, 0xe4, 0xd4, 0x1f, 0xfe, 0x02, 0x50, 0x14, 0x92, 0xaf, 0x14, 0x25, 0x69, 0x5e, 0x48, 0xbf, 0x42, 0x9b, 0x2d, 0x51, 0xf2, 0xab, 0x45, 0x12, 0x58, 0x24, 0x88, 0x7a, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff, 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10, 0x0e, 0x19, 0x87, 0xd0, 0x01, 0x0f, 0x02, 0x0f, 0x0a, 0x43, 0x82, 0x03, 0x0f, 0x0c, 0x43, 0x82, 0x17, 0x01, 0x50, 0x9a, 0x00, 0xf9, 0x80, 0xb0, 0x84, 0x43, 0x64, 0xff, 0xba, 0x98, 0x49, 0x00, 0xe6, 0x76, 0xf5, 0x00, 0x00, 0xfa, 0x47, 0x00, 0x7f, 0x78, 0x51, 0x10, 0x10, 0x1a, 0xfa, 0x2c }; /* Test vector discovered via fuzzing with AFL. */ uint8_t crash_vector11[] = { 0xd8, 0x30, 0xa4, 0x02, 0x58, 0x73, 0x82, 0x58, 0x24, 0x82, 0x02, 0x58, 0x20, 0x5c, 0x09, 0x7e, 0xf6, 0x4b, 0xf3, 0x00, 0x9b, 0x49, 0x4e, 0x71, 0xe1, 0xf2, 0x41, 0x8e, 0xef, 0x8d, 0x46, 0xff, 0x7e, 0xde, 0x00, 0x39, 0xa8, 0x55, 0xec, 0x9a, 0xf3, 0xe9, 0xed, 0xdb, 0x99, 0x58, 0x4a, 0xd2, 0x84, 0x43, 0xa1, 0x01, 0x26, 0xa0, 0xf6, 0x58, 0x40, 0xa1, 0x9f, 0xd1, 0xf2, 0x3b, 0x17, 0xbe, 0xfc, 0x32, 0x1c, 0x00, 0x80, 0x42, 0x3d, 0xfb, 0x48, 0xc4, 0x57, 0xb8, 0xf1, 0xf6, 0xac, 0x83, 0x57, 0x7a, 0x3c, 0x10, 0xc6, 0x77, 0x3f, 0x6f, 0x3a, 0x79, 0x02, 0x37, 0x6b, 0x59, 0x54, 0x09, 0x20, 0xb6, 0xc5, 0x17, 0x7b, 0xac, 0x5f, 0xc8, 0x54, 0x3d, 0x8f, 0x5d, 0x3d, 0x97, 0x4f, 0xaa, 0x2e, 0x6d, 0x03, 0xda, 0xa5, 0x34, 0xb4, 0x43, 0xa7, 0x03, 0x58, 0x71, 0xa5, 0x01, 0x01, 0x02, 0x00, 0x03, 0x58, 0x5f, 0xa2, 0x02, 0x81, 0x81, 0x41, 0x00, 0x04, 0x58, 0x56, 0x86, 0x14, 0xa4, 0x01, 0x50, 0xfa, 0x6b, 0x4a, 0x53, 0xd5, 0xad, 0x5f, 0xdf, 0xbe, 0x9d, 0xe6, 0x63, 0xe4, 0xd4, 0x1f, 0xfe, 0x02, 0x50, 0x14, 0x92, 0xaf, 0x14, 0x25, 0x69, 0x5e, 0x48, 0xbf, 0x42, 0x9b, 0x2d, 0x51, 0xf2, 0xab, 0x45, 0x12, 0x58, 0x24, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff, 0x01, 0x23, 0x45, 0x67, 0x89, 0x32, 0x1c, 0x00, 0x80, 0x42, 0x3d, 0xfb, 0x48, 0xc4, 0x57, 0xb8, 0xf1, 0xf6, 0xac, 0x83, 0x57, 0x7a, 0xab, 0xcd, 0xef, 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10, 0x0e, 0x19, 0x87, 0xd0, 0x01, 0x0f, 0x02, 0x0f, 0x0a, 0x43, 0x82, 0x03, 0x0f, 0x0c, 0x43, 0x82, 0x17, 0x01, 0x50, 0x9a, 0x00, 0xf9, 0x80, 0xb0, 0x84, 0x43, 0x64, 0xff, 0xba, 0x98, 0x49, 0x00, 0xe6, 0x76, 0xf5, 0x00, 0x00, 0xfa, 0x47, 0x00, 0x7f, 0x78, 0x51, 0x10, 0x10, 0x1a, 0xfa, 0x2c }; /* Test vector discovered via fuzzing with AFL. */ uint8_t crash_vector12[] = { 0xd8, 0x30, 0xa4, 0x02, 0x58, 0x73, 0x82, 0x58, 0x24, 0x82, 0x02, 0x58, 0x20, 0x5c, 0x09, 0x7e, 0xf6, 0x4b, 0xf3, 0x00, 0x9b, 0x49, 0x4e, 0x71, 0xe1, 0xf2, 0x41, 0x8e, 0xef, 0x8d, 0x46, 0x6c, 0xc9, 0x02, 0xf6, 0x39, 0xa8, 0x20, 0x00, 0x00, 0x00, 0xe9, 0xed, 0xdb, 0x99, 0x58, 0x4a, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x99, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0xc4, 0x57, 0xb8, 0xf1, 0xf6, 0xac, 0x83, 0x57, 0x7a, 0x3c, 0x10, 0xc6, 0x77, 0x3f, 0x6f, 0x3a, 0x79, 0x02, 0x37, 0x6b, 0x59, 0x54, 0x09, 0x20, 0xb6, 0xc5, 0xf5, 0x7a, 0xac, 0x5f, 0xc8, 0x54, 0x3d, 0x8f, 0x5d, 0x3d, 0x97, 0x4f, 0xaa, 0x2e, 0x6d, 0x03, 0xda, 0xa5, 0x34, 0xb4, 0x43, 0xa7, 0x03, 0x58, 0x71, 0xa5, 0x01, 0xa1, 0x02, 0x00, 0x03, 0x58, 0x5f, 0xa2, 0x02, 0x81, 0x81, 0x41, 0x00, 0x04, 0x58, 0x56, 0x86, 0x14, 0xa4, 0x01, 0x50, 0xfa, 0x6b, 0x4a, 0x53, 0xd5, 0xad, 0x5f, 0xdf, 0xbe, 0x9d, 0xe6, 0x63, 0xe4, 0x43, 0x82, 0x17, 0x01, 0x64, 0x00, 0x00, 0xf9, 0x80, 0xb0, 0x84, 0x43, 0x64, 0xff, 0xba, 0x98, 0x49, 0x00, 0xe6, 0x76, 0xf5, 0x00, 0x00, 0xfa, 0x47, 0x00, 0x7f, 0x78, 0x4b, 0x10, 0x10, 0x1a, 0xfa, 0x2c }; /* Test vector discovered via fuzzing with AFL. */ uint8_t crash_vector13[] = { 0xd8, 0x30, 0xa4, 0x02, 0x58, 0x73, 0x82, 0x58, 0x24, 0x82, 0x02, 0x58, 0x20, 0x5c, 0x09, 0x7e, 0xf6, 0x4b, 0xf3, 0x00, 0x9b, 0x49, 0x4e, 0x71, 0xe1, 0xf2, 0x41, 0x8e, 0xef, 0x8d, 0x46, 0x6c, 0xc9, 0x02, 0xf6, 0x39, 0xa8, 0x20, 0x00, 0x00, 0x00, 0xe9, 0xed, 0xdb, 0x99, 0x58, 0x4a, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x99, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x7a, 0xc4, 0x57, 0xb8, 0xf1, 0xf6, 0xac, 0x83, 0x57, 0x7a, 0x3c, 0x10, 0xc6, 0x77, 0x3f, 0x6f, 0x3a, 0x79, 0x02, 0x37, 0x6b, 0x59, 0x54, 0x09, 0x20, 0xb6, 0xc5, 0xf5, 0x7b, 0xac, 0x5f, 0xc8, 0x54, 0x3d, 0x8f, 0x5d, 0x3d, 0x97, 0x4f, 0xaa, 0x2e, 0x6d, 0x03, 0xda, 0xa5, 0x34, 0xb4, 0x43, 0xa7, 0x03, 0x58, 0x71, 0xa5, 0x01, 0xa1, 0x02, 0x00, 0x03, 0x58, 0x5f, 0xa2, 0x02, 0x81, 0x81, 0x41, 0x00, 0x04, 0x58, 0x56, 0x86, 0x14, 0xa4, 0x01, 0x50, 0xfa, 0x6b, 0x4a, 0x53, 0xd5, 0xad, 0x5f, 0xdf, 0xbe, 0x9d, 0xe6, 0x63, 0xe4, 0x43, 0x82, 0x17, 0x01, 0x64, 0x00, 0x00, 0xf9, 0x80, 0xb0, 0x84, 0x43, 0x64, 0xff, 0xba, 0x98, 0x49, 0x00, 0xe6, 0x76, 0xf5, 0x00, 0x00, 0xfa, 0x47, 0x00, 0x7f, 0x78, 0x4b, 0x10, 0x10, 0x1a, 0xfa, 0x2c }; /* Test vector discovered via fuzzing with AFL. */ uint8_t crash_vector14[] = { 0xd8, 0x30, 0xa4, 0x02, 0x58, 0x73, 0x82, 0x58, 0x24, 0x82, 0x02, 0x58, 0x20, 0x5c, 0x09, 0x7e, 0xf6, 0x4b, 0x20, 0x00, 0x9b, 0x49, 0x4e, 0x71, 0xe1, 0xf2, 0x41, 0x8e, 0xef, 0x8d, 0x46, 0x6c, 0xc9, 0x02, 0xf6, 0x39, 0xa8, 0x20, 0x00, 0x00, 0x00, 0xe9, 0xed, 0xdb, 0x99, 0x58, 0x4a, 0x8e, 0x8e, 0x41, 0x00, 0xe9, 0x57, 0x56, 0x86, 0x14, 0xa4, 0x01, 0x10, 0xfa, 0x6b, 0x4a, 0x53, 0xd5, 0xad, 0x5f, 0xdf, 0xbe, 0x9d, 0xe6, 0x63, 0xe4, 0x43, 0x82, 0x17, 0x01, 0x64, 0x00, 0x00, 0xf9, 0x80, 0xb0, 0x84, 0x43, 0x64, 0xff, 0xba, 0x98, 0x49, 0x00, 0xce, 0x7a, 0xf5, 0x00, 0x00, 0x03, 0xda, 0xa5, 0x34, 0xb4, 0x43, 0xa7, 0x03, 0x58, 0x71, 0xa5, 0x01, 0x01, 0x02, 0x00, 0x03, 0x58, 0x5f, 0xa2, 0x02, 0x81, 0x81, 0xd3, 0x00, 0x04, 0x58, 0x59, 0x86, 0x14, 0xa4, 0x01, 0x50, 0xfa, 0x6b, 0x4a, 0x53, 0xd5, 0x10, 0x00, 0xdf, 0xbe, 0x9d, 0xe6, 0x63, 0xe4, 0xd4, 0x1f, 0x86, 0x14, 0xfe, 0x02, 0xff, 0x14, 0x92, 0xaf, 0x14, 0x25, 0x69, 0x5e, 0x48, 0xbf, 0x42, 0x9b, 0x2d, 0x51, 0xf2, 0xab, 0x45, 0x03, 0x58, 0x24, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff, 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, 0xfe, 0x58, 0x73, 0x82, 0x58, 0x24, 0xa2, 0x02, 0x58, 0x20, 0x5c, 0x0a, 0x5b, 0xf6, 0x4b, 0xf3, 0x00, 0x9b, 0x49, 0x4e, 0x71, 0xe1, 0xf2, 0x41, 0x8e, 0xef, 0x8d, 0x46, 0x6c, 0xc9, 0x02, 0xf6, 0x39, 0xa8, 0x20, 0x00, 0x00, 0x00, 0xe9, 0xed, 0xdb, 0x99, 0x58, 0x4a, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x99, 0x8e, 0x00, 0x00, 0x8e, 0x8e, 0x8e, 0x6b, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x7d, 0x57, 0xb8, 0xf1, 0xf6, 0xac, 0x83, 0x57, 0x69, 0x3c, 0x10, 0xc6, 0x77, 0x3f, 0x6f, 0x2b, 0x79, 0x02, 0x7b, 0x3d, 0x97, 0x4f, 0x00, 0x00, 0xff, 0xff, 0xda, 0xb8, 0x34, 0xb4, 0x43, 0xa7, 0x03, 0x58, 0x71, 0xa5, 0x01, 0xa1, 0x02, 0x00, 0x03, 0x58, 0x5f, 0xa2, 0x02, 0x81, 0x81, 0x41, 0x00, 0x04, 0x58, 0x56, 0x86, 0x14, 0xa4, 0x01, 0x50, 0xfa, 0x6b, 0x4a, 0x53, 0xd5, 0xad, 0x5f, 0xdf, 0xbe, 0x9d, 0xe6, 0x63, 0xe4, 0x43, 0x82, 0x17, 0x01, 0x86, 0x00, 0x00, 0xf9, 0x80, 0xb0, 0x84, 0x43, 0x64, 0xff, 0xba, 0x98, 0x49, 0x00, 0xe6, 0x76, 0xf5, 0x00, 0x00, 0x03, 0xda, 0xa5, 0x34, 0xb4, 0x43, 0xa7, 0x03, 0x58, 0x71, 0xa5, 0x01, 0x01, 0x02, 0x00, 0x03, 0x58, 0x5f, 0xa2, 0x02, 0x81, 0x81, 0x41, 0x00, 0x04, 0x58, 0x56, 0x86, 0x14, 0xa4, 0x01, 0x50, 0xfa, 0x6b, 0x4a, 0x53, 0xd5, 0xad, 0x5f, 0xdf, 0x20, 0x9d, 0xe6, 0x63, 0xe4, 0xd4, 0x1f, 0x86, 0x14, 0xfe, 0x02, 0xff, 0x24, 0x92, 0xaf, 0x14, 0x25, 0x69, 0x5e, 0x48, 0xbf, 0x42, 0x9b, 0x2d, 0x51, 0xf2, 0xab, 0x45, 0x97, 0x97, 0x00, 0x00, 0x01, 0x00, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x80, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x01, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0xdb, 0x99, 0x58, 0x00, 0x10, 0x84, 0x43, 0xa1, 0x01, 0x26, 0xa0, 0xf6, 0x58, 0x40, 0xa1, 0x9f, 0xd1, 0xf2, 0x3b, 0x17, 0xbe, 0xfc, 0x32, 0x1c, 0xec, 0xe7, 0x42, 0x3d, 0xfb, 0x48, 0xc4, 0x57 }; /* Test vector discovered via fuzzing with AFL. */ uint8_t crash_vector15[] = { 0xd8, 0x30, 0xa4, 0x02, 0x58, 0x73, 0x82, 0x58, 0x24, 0x82, 0x02, 0x58, 0x20, 0x5c, 0x09, 0x7e, 0xf6, 0x4b, 0xf3, 0x00, 0x9b, 0x49, 0x4e, 0x71, 0xe1, 0xf2, 0x41, 0x8e, 0xef, 0x8d, 0x46, 0x6c, 0xc9, 0x02, 0xf6, 0x39, 0xa8, 0x20, 0x00, 0x00, 0x00, 0xf3, 0xed, 0xdb, 0x99, 0x58, 0x4a, 0x8e, 0x8e, 0x00, 0x10, 0x00, 0x00, 0x10, 0x8e, 0x8e, 0x8e, 0x99, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x7a, 0xc4, 0x57, 0xb8, 0xf1, 0xf6, 0xac, 0x83, 0x55, 0x7a, 0x3c, 0x10, 0xc6, 0x77, 0x3f, 0x41, 0x8e, 0xef, 0x8d, 0x46, 0x6c, 0xc9, 0x10, 0xf6, 0x39, 0xa8, 0x55, 0xec, 0x9a, 0xf3, 0xe9, 0xed, 0xdb, 0x99, 0x58, 0x4a, 0xd2, 0x84, 0x43, 0xa1, 0x01, 0x26, 0xa0, 0xf6, 0x58, 0x40, 0xa1, 0x9f, 0xd1, 0xf2, 0x3b, 0x17, 0xbe, 0xfc, 0x32, 0x1c, 0xec, 0xe7, 0x42, 0x3d, 0xfb, 0x48, 0xc4, 0x57, 0xb8, 0xf1, 0xf6, 0xac, 0x83, 0x57, 0x7a, 0x3c, 0x10, 0xc6, 0x77, 0x3f, 0x6f, 0x3a, 0x79, 0x5d, 0x3d, 0x97, 0x4f, 0xaa, 0x2e, 0x6d, 0x03, 0xda, 0xa5, 0x34, 0xb4, 0x43, 0xa7, 0x03, 0x58, 0x71, 0xa5, 0x01, 0x01, 0x02, 0x84, 0x43, 0x64, 0xff, 0xba, 0x98, 0x49, 0x00, 0xe6, 0x76, 0xf5, 0x00, 0x00, 0xfa, 0x47, 0x00, 0x7f, 0x78, 0x4b, 0x10, 0x10, 0x5a, 0xfa, 0x2c }; /* Test vector discovered via fuzzing with AFL. */ uint8_t crash_vector16[] = { 0xd8, 0x30, 0xa4, 0x02, 0x58, 0x73, 0x82, 0x58, 0x24, 0x82, 0x02, 0x58, 0x20, 0x5c, 0x09, 0x7e, 0xf6, 0x4b, 0xf3, 0x00, 0x9b, 0x49, 0x4e, 0x71, 0xe1, 0xf2, 0x41, 0x8e, 0xef, 0x8d, 0x46, 0x6c, 0xc9, 0x02, 0xf6, 0x39, 0xa8, 0x20, 0x00, 0x00, 0x00, 0xe9, 0xed, 0xdb, 0x99, 0x58, 0x4a, 0x8e, 0x8e, 0x8e, 0x8e, 0x73, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x99, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0xc4, 0x57, 0xb8, 0xf1, 0xf6, 0xac, 0x83, 0x57, 0x7a, 0x00, 0xe7, 0x01, 0xe8, 0xff, 0x54, 0x09, 0x20, 0xb6, 0xc5, 0xf5, 0x7b, 0x00, 0xfd, 0x00, 0x40, 0x21, 0xff, 0xb9, 0xff, 0x7a, 0x43, 0x77, 0x0d, 0x00, 0x01, 0x7a, 0xff, 0x82, 0x01, 0xff, 0x20, 0x00, 0x04, 0x00, 0x0c, 0x01, 0x54, 0xc8, 0xe7, 0xe7, 0xe7, 0x6f, 0x00, 0xd1, 0x3a, 0x00, 0x00, 0xe7, 0xf2, 0xe7, 0xff, 0x54, 0x09, 0x20, 0xb6, 0xc5, 0xf5, 0x7b, 0xac, 0x5f, 0xc8, 0x54, 0x3d, 0x8f, 0x5d, 0x3d, 0x97, 0x4f, 0xaa, 0x2e, 0x6d, 0x03, 0xda, 0x20, 0x00, 0xfd, 0x00, 0x40, 0x40, 0xff, 0xb9, 0xff, 0x7a, 0x43, 0x77, 0x0d, 0x00, 0x01, 0x7a, 0x53, 0xa5, 0x01, 0xa1, 0x02, 0x00, 0x03, 0x64, 0x5f, 0xa2, 0x02, 0x81, 0x81, 0x41, 0x00, 0x04, 0x58, 0x56, 0x86, 0x14, 0xa4, 0x01, 0x50, 0xfa, 0x6b, 0x4a, 0x53, 0xd5, 0xad, 0x5f, 0xdf, 0xbe, 0x9d, 0xe6, 0x63, 0xe4, 0x37, 0x82, 0x17, 0x01, 0x64, 0x00, 0x00, 0xf9, 0x80, 0xb0, 0x84, 0x43, 0x64, 0xff, 0xba, 0x98, 0x49, 0x00, 0xe6, 0x76, 0xe0, 0x00, 0x00, 0xfa, 0x47, 0x00, 0x7f, 0x78, 0x4b, 0x10, 0x10, 0x1a, 0xfa, 0x2c }; /* Test vector discovered via fuzzing with AFL. */ uint8_t crash_vector17[] = { 0xd8, 0x30, 0xa4, 0x02, 0x58, 0x73, 0x82, 0x58, 0x24, 0x82, 0x02, 0x58, 0x20, 0x5c, 0x09, 0x7e, 0xf6, 0x4b, 0xf3, 0x00, 0x9b, 0x49, 0x4e, 0x71, 0xe1, 0xf2, 0x41, 0x8e, 0xef, 0x8d, 0x46, 0x6c, 0xc9, 0x02, 0xf6, 0x39, 0xa8, 0x20, 0x00, 0x00, 0x00, 0xe9, 0xed, 0xdb, 0x99, 0x58, 0x4a, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0xa0, 0x8e, 0x8e, 0x8e, 0x8e, 0x99, 0x8e, 0x8e, 0xf0, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0xc4, 0x7a, 0xb8, 0xf1, 0xf6, 0xac, 0x83, 0x57, 0x7a, 0x3c, 0x10, 0xc6, 0x77, 0x3f, 0x6f, 0x3a, 0x79, 0x02, 0x37, 0x6b, 0x59, 0x54, 0x09, 0x20, 0xb6, 0xc5, 0xf5, 0x7b, 0xac, 0x5f, 0xc8, 0x54, 0x3d, 0x8f, 0x5d, 0x3d, 0x97, 0x4f, 0xaa, 0x2e, 0x6d, 0x03, 0xda, 0xa5, 0x34, 0xb4, 0x43, 0xa7, 0x00, 0x00, 0x71, 0xa5, 0x01, 0xa1, 0x02, 0x00, 0x03, 0x58, 0x5f, 0xa2, 0x02, 0x81, 0x81, 0x41, 0x00, 0x04, 0x58, 0x56, 0x86, 0x14, 0xa4, 0x01, 0x50, 0xfa, 0x6b, 0x4a, 0x53, 0xd5, 0xad, 0x5f, 0xdf, 0xbe, 0x9d, 0xe6, 0x63, 0xe4, 0x43, 0x82, 0x17, 0x01, 0x64, 0x00, 0x00, 0xf9, 0x80, 0xb0, 0x84, 0x43, 0x64, 0xff, 0xba, 0x98, 0x49, 0x00, 0xe6, 0x76, 0xf5, 0x00, 0x00, 0xfa, 0x47, 0x00, 0x7f, 0x78, 0x4b, 0x10, 0x10, 0x1a, 0xfa, 0x2c }; /* Test vector discovered via fuzzing with AFL. */ uint8_t crash_vector18[] = { 0xd8, 0x30, 0xa4, 0x02, 0x58, 0x73, 0x82, 0x58, 0x24, 0x82, 0x02, 0x58, 0x20, 0x5c, 0x09, 0x7d, 0xf6, 0x4b, 0xf3, 0x00, 0x9b, 0x49, 0x4e, 0x71, 0xe1, 0xf2, 0x41, 0x8e, 0xef, 0x8d, 0x46, 0x6c, 0xc9, 0x02, 0xf6, 0x39, 0xa8, 0x20, 0x00, 0x00, 0x00, 0xe9, 0xed, 0xdb, 0x99, 0x58, 0x4a, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x99, 0x8e, 0x8e, 0x8e, 0x8e, 0xed, 0x32, 0x1c, 0xec, 0xe7, 0x42, 0x3d, 0xfb, 0x48, 0xc4, 0x57, 0xb8, 0xf1, 0xf6, 0xac, 0x83, 0x57, 0x7a, 0xbc, 0x10, 0xc6, 0x77, 0x3f, 0x6f, 0x3a, 0x79, 0x02, 0x37, 0x6b, 0x59, 0x54, 0x09, 0x20, 0xb6, 0xc5, 0xf5, 0x7b, 0xac, 0x5f, 0xc8, 0x54, 0x3d, 0x8f, 0x5d, 0x5a, 0x97, 0x4f, 0xaa, 0x2e, 0x6d, 0x03, 0xda, 0xa5, 0x34, 0xb4, 0x43, 0xa7, 0x03, 0x58, 0x71, 0x6c, 0x01, 0x01, 0x02, 0x00, 0x03, 0x58, 0x5f, 0xa2, 0x02, 0x81, 0x81, 0x41, 0x00, 0x04, 0x58, 0x56, 0x86, 0x14, 0xa4, 0x01, 0x50, 0xfe, 0x6b, 0x3c, 0x53, 0xd5, 0xad, 0x5f, 0xdf, 0xbe, 0x9d, 0xe6, 0x63, 0xe4, 0xd4, 0x1f, 0xfe, 0x02, 0x50, 0x14, 0x92, 0xaf, 0x29, 0x25, 0x69, 0x5e, 0x48, 0xbf, 0x42, 0x9b, 0x2d, 0x51, 0xf2, 0xb1, 0x45, 0x03, 0x58, 0x24, 0x82, 0x02, 0x58, 0x20, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff, 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10, 0x0e, 0x19, 0x87, 0xd0, 0x01, 0x0f, 0x02, 0x0f, 0x0a, 0x43, 0x82, 0x03, 0x0f, 0x0c, 0x43, 0x82, 0x17, 0x02 }; /* Test vector discovered via fuzzing with AFL. */ uint8_t crash_vector19[] = { 0xd8, 0x30, 0xa4, 0x02, 0x58, 0x73, 0x82, 0x58, 0x24, 0x82, 0x02, 0x58, 0x20, 0x5c, 0x09, 0x7e, 0xf6, 0x43, 0xf3, 0x00, 0x9b, 0x49, 0x4e, 0x71, 0xe1, 0xf2, 0x55, 0x8e, 0xef, 0x8d, 0x46, 0x6c, 0xc9, 0x02, 0xf6, 0x39, 0xa8, 0x55, 0xf6, 0x9a, 0xf3, 0xe9, 0xed, 0xdb, 0x99, 0x58, 0x4a, 0x97, 0x97, 0x97, 0x97, 0x97, 0x77, 0x97, 0x97, 0x97, 0x97, 0x97, 0xe5, 0xc2, 0xf0, 0xe5, 0xe5, 0xe5, 0x6f, 0x68, 0x71, 0xe1, 0xf2, 0x41, 0x8e, 0xef, 0x8d, 0x46, 0x6c, 0xc9, 0x02, 0xd4, 0xce, 0xa1, 0x01, 0x07, 0xa0, 0xd6, 0x2c, 0x40, 0xa1, 0xe5, 0xa7, 0x8e, 0x5a, 0xfe, 0x01, 0x02, 0x25, 0x03, 0x58, 0x5f, 0xa2, 0x02, 0x81, 0x81, 0x41, 0x00, 0x04, 0x58, 0x56, 0x02, 0x00, 0x03, 0x58, 0x5f, 0xa2, 0x02, 0x14, 0x25, 0x69, 0x5e, 0x23, 0x02, 0x7c, 0xdf, 0x02, 0x59, 0x25 }; /* Test vector discovered via fuzzing with AFL. */ uint8_t crash_vector20[] = { 0xd8, 0x30, 0xa4, 0x02, 0x58, 0x73, 0x82, 0x58, 0x24, 0x82, 0x02, 0x58, 0x20, 0x5c, 0x09, 0x7e, 0xf6, 0x4b, 0xf3, 0x21, 0x9b, 0x49, 0x4e, 0x71, 0xe1, 0xf2, 0x41, 0x8e, 0xef, 0x8d, 0x46, 0x6c, 0xc9, 0x02, 0xf6, 0x39, 0x01, 0x55, 0xee, 0x9a, 0xf3, 0xe9, 0xed, 0xdb, 0x99, 0x58, 0x4a, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x08, 0x15, 0x08, 0x00, 0x00, 0xff, 0xff, 0x68, 0x7a, 0xf4, 0x68, 0xff, 0xff, 0x19, 0xff, 0x7f, 0x35, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x3f, 0xab, 0x20, 0x86, 0x73, 0x74, 0x2d, 0x64, 0x69, 0x67, 0x65, 0x73, 0x40, 0x78, 0x74, 0x7d, 0x87, 0x82, 0x80, 0xff, 0x82, 0x02, 0x40, 0x0f, 0x0c, 0xbe, 0x7a, 0xf4, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x64, 0x00, 0x00, 0x00, 0x7a, 0xf4, 0x68, 0xff, 0xff, 0xff, 0x39, 0x39, 0x35, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x3f, 0xab, 0x7d, 0x10, 0xda, 0x00, 0x00, 0x10, 0x65, 0x78, 0x64, 0x00, 0x00, 0x40, 0x13, 0x63, 0x6f, 0x4a, 0x00, 0xbf, 0x56, 0x28, 0x60, 0x9a, 0xd6, 0x38, 0x3d, 0xce, 0x14, 0xc7, 0x20, 0xa1, 0xba, 0x43, 0x00, 0x2f, 0xe3, 0xf5, 0x92, 0xaf, 0x14, 0x25, 0x69, 0x5e, 0x48, 0xbf, 0x42, 0x9b, 0x2d, 0x51, 0xf2, 0xab, 0x45, 0x03, 0x58, 0x24, 0x82, 0x02, 0x58, 0x20, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff, 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10, 0x0e, 0x19, 0x87, 0xd0, 0x01, 0x0f, 0x02, 0x0f, 0x0a, 0x43, 0x82, 0x03, 0x0f, 0x0c, 0x43, 0x82, 0x17, 0x01, 0x50, 0x9a, 0x00, 0xf9, 0x80, 0xb0, 0x84, 0x43, 0x64, 0xff, 0xba, 0x98, 0x49, 0x00, 0xe6, 0x76, 0xf5, 0x00, 0x00, 0xfa, 0x47, 0x00, 0x7f, 0x78, 0x51, 0x10, 0x10, 0x1a, 0xfa, 0x2c }; /* Test vector discovered via fuzzing with AFL. */ uint8_t crash_vector21[] = { 0xd8, 0x30, 0xa4, 0x02, 0x58, 0x73, 0x82, 0x58, 0x24, 0x82, 0x02, 0x58, 0x20, 0x5c, 0x09, 0x7e, 0xf6, 0x4b, 0xf3, 0x00, 0x9b, 0x49, 0x4e, 0x71, 0xe1, 0xf2, 0x41, 0x8e, 0xef, 0x8d, 0x46, 0x6c, 0xc9, 0x02, 0xf6, 0x39, 0x01, 0x55, 0xee, 0x9a, 0xf3, 0xe9, 0xed, 0xdb, 0x99, 0x58, 0x4a, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x09, 0x20, 0xb6, 0xc5, 0xf5, 0x5a, 0xac, 0x5f, 0xc8, 0x80, 0x3d, 0x8f, 0x15, 0x10, 0xab, 0xcd, 0x39, 0x98, 0x22, 0x54, 0x32, 0x00, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x7f, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x80, 0x84, 0x84, 0x84, 0x84, 0x84, 0xfa, 0x39, 0x00, 0x14, 0x25, 0x69, 0x5e, 0x48, 0xbf, 0x42, 0x9b, 0x2d, 0x51, 0xf2, 0xab, 0x45, 0x03, 0x58, 0x24, 0x82, 0x02, 0x58, 0x20, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff, 0xf2, 0x22, 0x45, 0x10, 0x89, 0xab, 0xcd, 0xce, 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0xda, 0xa5, 0x34, 0xb4, 0x43, 0xa7, 0x03, 0x03, 0x58, 0x24, 0x82, 0x02, 0x58, 0xb2, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0xa1, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff, 0x01, 0x23, 0x45, 0x10, 0x89, 0xab, 0xcd, 0xce, 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10, 0x0e, 0x19, 0x87, 0xd0, 0x01, 0x0f, 0x02, 0x0f, 0x0a, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff, 0x0e, 0x1a, 0x00, 0x01, 0x2c, 0x22, 0x13, 0x43, 0xa1, 0x01, 0x41, 0x16, 0x00, 0xfa, 0x01, 0x03, 0x28, 0x0c, 0x45, 0x84, 0x0c, 0x02, 0x17, 0x02 }; /* Test vector discovered via fuzzing with AFL. */ uint8_t crash_vector22[] = { 0xd8, 0x30, 0xa4, 0x02, 0x58, 0x73, 0x82, 0x58, 0x24, 0x82, 0x02, 0x58, 0x20, 0x5c, 0x09, 0x7e, 0xf6, 0x4b, 0xf3, 0x00, 0x9b, 0x49, 0x4e, 0x71, 0xe1, 0xf2, 0x41, 0x8e, 0xef, 0x8d, 0x46, 0x6c, 0xc9, 0x02, 0xf6, 0x39, 0x01, 0x55, 0xee, 0x9a, 0xf3, 0xe9, 0xed, 0xdb, 0x99, 0x58, 0x4a, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x00, 0x00, 0x04, 0x00, 0x91, 0x74, 0x8a, 0x8d, 0x74, 0x74, 0x74, 0x74, 0xc6, 0x3f, 0x6f, 0x3a, 0x79, 0x02, 0x37, 0x6b, 0x59, 0x54, 0x09, 0x20, 0xb6, 0xc5, 0xf5, 0x5a, 0xac, 0x5f, 0xc8, 0x80, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x7f, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x80, 0x84, 0x84, 0x84, 0x84, 0x84, 0xfa, 0x39, 0x00, 0x14, 0x25, 0x69, 0x5e, 0x48, 0xbf, 0x42, 0x9b, 0x2d, 0x51, 0xf2, 0xab, 0x45, 0x03, 0x58, 0x24, 0x82, 0x02, 0x58, 0x20, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff, 0x01, 0x23, 0x45, 0x10, 0x89, 0xab, 0xcd, 0xce, 0xfe, 0xcc, 0xba, 0x98, 0x76, 0x54, 0x32, 0xda, 0xa5, 0x34, 0xb4, 0x43, 0xa7, 0x03, 0x03, 0x58, 0x24, 0x82, 0x02, 0x58, 0xb2, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0xa1, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff, 0x01, 0x87, 0xd0, 0x01, 0x0f, 0x02, 0x0f, 0x0a, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0x40, 0xdd, 0xee, 0xff, 0x0e, 0x1a, 0x00, 0x01, 0x2c, 0x22, 0x13, 0x43, 0xa1, 0x01, 0x01, 0x16, 0x00, 0x16, 0x02, 0x03, 0x28, 0x0c, 0x45, 0x84, 0x0c, 0x02, 0x17, 0x02 }; bool fuzz_one_input(const uint8_t *data, size_t size); #define FUZZ(x) fuzz_one_input(x, sizeof(x)) void test_manifest12_crash0(void) { FUZZ(crash_vector0); } void test_manifest12_crash1(void) { FUZZ(crash_vector1); } void test_manifest12_crash2(void) { FUZZ(crash_vector2); } void test_manifest12_crash3(void) { FUZZ(crash_vector3); } void test_manifest12_crash4(void) { FUZZ(crash_vector4); } void test_manifest12_crash5(void) { FUZZ(crash_vector5); } void test_manifest12_crash6(void) { FUZZ(crash_vector6); } void test_manifest12_crash7(void) { FUZZ(crash_vector7); } void test_manifest12_crash8(void) { FUZZ(crash_vector8); } void test_manifest12_crash9(void) { FUZZ(crash_vector9); } void test_manifest12_crash10(void) { FUZZ(crash_vector10); } void test_manifest12_crash11(void) { FUZZ(crash_vector11); } void test_manifest12_crash12(void) { FUZZ(crash_vector12); } void test_manifest12_crash13(void) { FUZZ(crash_vector13); } void test_manifest12_crash14(void) { FUZZ(crash_vector14); } void test_manifest12_crash15(void) { FUZZ(crash_vector15); } void test_manifest12_crash16(void) { FUZZ(crash_vector16); } void test_manifest12_crash17(void) { FUZZ(crash_vector17); } void test_manifest12_crash18(void) { FUZZ(crash_vector18); } void test_manifest12_crash19(void) { FUZZ(crash_vector19); } void test_manifest12_crash20(void) { FUZZ(crash_vector20); } void test_manifest12_crash21(void) { FUZZ(crash_vector21); } void test_manifest12_crash22(void) { FUZZ(crash_vector22); } void test_main(void) { ztest_test_suite(cbor_decode_test8, ztest_unit_test(test_manifest12_crash0), ztest_unit_test(test_manifest12_crash1), ztest_unit_test(test_manifest12_crash2), ztest_unit_test(test_manifest12_crash3), ztest_unit_test(test_manifest12_crash4), ztest_unit_test(test_manifest12_crash5), ztest_unit_test(test_manifest12_crash6), ztest_unit_test(test_manifest12_crash7), ztest_unit_test(test_manifest12_crash8), ztest_unit_test(test_manifest12_crash9), ztest_unit_test(test_manifest12_crash10), ztest_unit_test(test_manifest12_crash11), ztest_unit_test(test_manifest12_crash12), ztest_unit_test(test_manifest12_crash13), ztest_unit_test(test_manifest12_crash14), ztest_unit_test(test_manifest12_crash15), ztest_unit_test(test_manifest12_crash16), ztest_unit_test(test_manifest12_crash17), ztest_unit_test(test_manifest12_crash18), ztest_unit_test(test_manifest12_crash19), ztest_unit_test(test_manifest12_crash20), ztest_unit_test(test_manifest12_crash21), ztest_unit_test(test_manifest12_crash22) ); ztest_run_test_suite(cbor_decode_test8); }
55.855634
80
0.666982
[ "vector" ]
5c4d8e972dcab4bea6832544d3a746c997b1240b
2,137
h
C
include/arch/arm64/arch.h
lylezhu2014/zephyr
ebcc316e1cef9608ca0a74d9f39a6c67b2c86c0d
[ "Apache-2.0" ]
1
2017-11-01T07:37:49.000Z
2017-11-01T07:37:49.000Z
include/arch/arm64/arch.h
lylezhu2014/zephyr
ebcc316e1cef9608ca0a74d9f39a6c67b2c86c0d
[ "Apache-2.0" ]
1
2018-01-31T10:13:49.000Z
2018-01-31T10:13:49.000Z
include/arch/arm64/arch.h
lylezhu2014/zephyr
ebcc316e1cef9608ca0a74d9f39a6c67b2c86c0d
[ "Apache-2.0" ]
2
2017-11-01T07:38:56.000Z
2021-05-16T13:58:01.000Z
/* * Copyright (c) 2019 Carlo Caione <ccaione@baylibre.com> * * SPDX-License-Identifier: Apache-2.0 */ /** * @file * @brief ARM64 specific kernel interface header * * This header contains the ARM64 specific kernel interface. It is * included by the kernel interface architecture-abstraction header * (include/arm64/cpu.h) */ #ifndef ZEPHYR_INCLUDE_ARCH_ARM64_ARCH_H_ #define ZEPHYR_INCLUDE_ARCH_ARM64_ARCH_H_ /* Add include for DTS generated information */ #include <devicetree.h> #include <arch/arm64/thread.h> #include <arch/arm64/exc.h> #include <arch/arm64/irq.h> #include <arch/arm64/misc.h> #include <arch/arm64/asm_inline.h> #include <arch/arm64/cpu.h> #include <arch/arm64/macro.inc> #include <arch/arm64/sys_io.h> #include <arch/arm64/timer.h> #include <arch/arm64/error.h> #include <arch/arm64/arm_mmu.h> #include <arch/arm64/thread_stack.h> #include <arch/common/addr_types.h> #include <arch/common/sys_bitops.h> #include <arch/common/ffs.h> #ifdef __cplusplus extern "C" { #endif #ifndef _ASMLANGUAGE #include <sys/slist.h> /* Kernel macros for memory attribution * (access permissions and cache-ability). * * The macros are to be stored in k_mem_partition_attr_t * objects. The format of a k_mem_partition_attr_t object * is an uint32_t composed by permission and attribute flags * located in include/arch/arm64/arm_mmu.h */ /* Read-Write access permission attributes */ #define K_MEM_PARTITION_P_RW_U_RW ((k_mem_partition_attr_t) \ {MT_P_RW_U_RW}) #define K_MEM_PARTITION_P_RW_U_NA ((k_mem_partition_attr_t) \ {MT_P_RW_U_NA}) #define K_MEM_PARTITION_P_RO_U_RO ((k_mem_partition_attr_t) \ {MT_P_RO_U_RO}) #define K_MEM_PARTITION_P_RO_U_NA ((k_mem_partition_attr_t) \ {MT_P_RO_U_NA}) /* Execution-allowed attributes */ #define K_MEM_PARTITION_P_RX_U_RX ((k_mem_partition_attr_t) \ {MT_P_RX_U_RX}) /* Typedef for the k_mem_partition attribute */ typedef struct { uint32_t attrs; } k_mem_partition_attr_t; struct arch_mem_domain { struct arm_mmu_ptables ptables; sys_snode_t node; }; #endif /* _ASMLANGUAGE */ #ifdef __cplusplus } #endif #endif /* ZEPHYR_INCLUDE_ARCH_ARM64_ARCH_H_ */
24.848837
67
0.766027
[ "object" ]
5c504d99f6e42a7bfa6fb1e5092d199314147b23
668
h
C
Alpha/Renderers/ALPHAImageRendererViewController.h
huangboju/Alpha
278e5772c38b3e2c2464718e8f2327c455020006
[ "MIT" ]
797
2015-01-26T02:51:19.000Z
2021-11-22T07:03:36.000Z
Alpha/Renderers/ALPHAImageRendererViewController.h
huangboju/Alpha
278e5772c38b3e2c2464718e8f2327c455020006
[ "MIT" ]
61
2015-05-06T16:17:40.000Z
2017-08-18T14:58:49.000Z
Alpha/Renderers/ALPHAImageRendererViewController.h
huangboju/Alpha
278e5772c38b3e2c2464718e8f2327c455020006
[ "MIT" ]
64
2015-01-26T02:51:26.000Z
2021-10-29T18:03:33.000Z
// // ALPHAImageRendererViewController.h // Alpha // // Created by Dal Rupnik on 10/06/15. // Copyright © 2015 Unified Sense. All rights reserved. // #import "ALPHADataRenderer.h" @interface ALPHAImageRendererViewController : UIViewController <ALPHADataRenderer> #pragma mark - ALPHADataRenderer @property (nonatomic, weak) id <ALPHAViewControllerDelegate> delegate; @property (nonatomic, strong) ALPHAScreenModel* screenModel; @property (nonatomic, strong) id<ALPHASerializableItem> object; @property (nonatomic, copy) ALPHARequest *request; @property (nonatomic, strong) id<ALPHADataSource> source; @property (nonatomic, strong) ALPHATheme *theme; @end
24.740741
82
0.775449
[ "object" ]
5c5653dc2665e9fa64e3deb76358c141de79b767
3,543
h
C
src/arkode/arkode_erkstep_impl.h
aseyboldt/sundials
24937ea96143c15a8439ebe7510b32df054d2364
[ "BSD-3-Clause" ]
null
null
null
src/arkode/arkode_erkstep_impl.h
aseyboldt/sundials
24937ea96143c15a8439ebe7510b32df054d2364
[ "BSD-3-Clause" ]
null
null
null
src/arkode/arkode_erkstep_impl.h
aseyboldt/sundials
24937ea96143c15a8439ebe7510b32df054d2364
[ "BSD-3-Clause" ]
null
null
null
/*--------------------------------------------------------------- * Programmer(s): Daniel R. Reynolds @ SMU *--------------------------------------------------------------- * SUNDIALS Copyright Start * Copyright (c) 2002-2020, Lawrence Livermore National Security * and Southern Methodist University. * All rights reserved. * * See the top-level LICENSE and NOTICE files for details. * * SPDX-License-Identifier: BSD-3-Clause * SUNDIALS Copyright End *--------------------------------------------------------------- * Implementation header file for ARKode's ERK time stepper * module. *--------------------------------------------------------------*/ #ifndef _ARKODE_ERKSTEP_IMPL_H #define _ARKODE_ERKSTEP_IMPL_H #include <arkode/arkode_erkstep.h> #include "arkode_impl.h" #ifdef __cplusplus /* wrapper to enable C++ usage */ extern "C" { #endif /*=============================================================== ERK time step module constants -- move many items here from arkode_impl.h ===============================================================*/ /*=============================================================== ERK time step module data structure ===============================================================*/ /*--------------------------------------------------------------- Types : struct ARKodeERKStepMemRec, ARKodeERKStepMem --------------------------------------------------------------- The type ARKodeERKStepMem is type pointer to struct ARKodeERKStepMemRec. This structure contains fields to perform an explicit Runge-Kutta time step. ---------------------------------------------------------------*/ typedef struct ARKodeERKStepMemRec { /* ERK problem specification */ ARKRhsFn f; /* y' = f(t,y) */ /* ARK method storage and parameters */ N_Vector *F; /* explicit RHS at each stage */ int q; /* method order */ int p; /* embedding order */ int stages; /* number of stages */ ARKodeButcherTable B; /* ERK Butcher table */ /* Counters */ long int nst_attempts; /* num attempted steps */ long int nfe; /* num fe calls */ /* Reusable arrays for fused vector operations */ realtype* cvals; N_Vector* Xvecs; } *ARKodeERKStepMem; /*=============================================================== ERK time step module private function prototypes ===============================================================*/ /* Interface routines supplied to ARKode */ int erkStep_Init(void* arkode_mem, int init_type); int erkStep_FullRHS(void* arkode_mem, realtype t, N_Vector y, N_Vector f, int mode); int erkStep_TakeStep(void* arkode_mem, realtype *dsmPtr, int *nflagPtr); /* Internal utility routines */ int erkStep_AccessStepMem(void* arkode_mem, const char *fname, ARKodeMem *ark_mem, ARKodeERKStepMem *step_mem); booleantype erkStep_CheckNVector(N_Vector tmpl); int erkStep_SetButcherTable(ARKodeMem ark_mem); int erkStep_CheckButcherTable(ARKodeMem ark_mem); int erkStep_ComputeSolutions(ARKodeMem ark_mem, realtype *dsm); /*=============================================================== Reusable ERKStep Error Messages ===============================================================*/ /* Initialization and I/O error messages */ #define MSG_ERKSTEP_NO_MEM "Time step module memory is NULL." #ifdef __cplusplus } #endif #endif
35.787879
74
0.493649
[ "vector" ]
5c5c60766e4e77df3f08b8353ea6e0e003b996c9
1,454
h
C
src/f_save.h
Masrik-Dahir/xfigx-3.1.1
40ec5d16e2f7ec4a3e84940fbf6a96c7b1890645
[ "MIT" ]
null
null
null
src/f_save.h
Masrik-Dahir/xfigx-3.1.1
40ec5d16e2f7ec4a3e84940fbf6a96c7b1890645
[ "MIT" ]
null
null
null
src/f_save.h
Masrik-Dahir/xfigx-3.1.1
40ec5d16e2f7ec4a3e84940fbf6a96c7b1890645
[ "MIT" ]
null
null
null
/* * FIG : Facility for Interactive Generation of figures * Copyright (c) 1985-1988 by Supoj Sutanthavibul * Parts Copyright (c) 1989-2015 by Brian V. Smith * Parts Copyright (c) 1991 by Paul King * Parts Copyright (c) 2016-2020 by Thomas Loimer * * Any party obtaining a copy of these files is granted, free of charge, a * full and unrestricted irrevocable, world-wide, paid up, royalty-free, * nonexclusive right and license to deal in this software and documentation * files (the "Software"), including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense and/or sell copies of * the Software, and to permit persons who receive copies from any such * party to do so, with the only requirement being that the above copyright * and this permission notice remain intact. * */ #ifndef F_SAVE_H #define F_SAVE_H #include <stdio.h> #include "object.h" #include <X11/Intrinsic.h> extern int emergency_save(char *file_name); extern void write_arc(FILE *fp, F_arc *a); extern void write_compound(FILE *fp, F_compound *com); extern void write_ellipse(FILE *fp, F_ellipse *e); extern void write_fig_header(FILE *fp); extern int write_file(char *file_name, Boolean update_recent); extern void write_line(FILE *fp, F_line *l); extern void write_spline(FILE *fp, F_spline *s); extern void write_text(FILE *fp, F_text *t); extern void end_write_tmpfile(void); extern void init_write_tmpfile(void); #endif
36.35
77
0.758597
[ "object" ]
5c62b5d816cb37357a564e46e500616d141b6684
642
h
C
mc_rtc_rviz_panel/src/ArrayInputWidget.h
mmurooka/mc_rtc_ros
781b67729cd9375f558d55b190e77fee1993ca4e
[ "BSD-2-Clause" ]
7
2019-12-16T01:14:22.000Z
2021-07-18T04:59:00.000Z
mc_rtc_rviz_panel/src/ArrayInputWidget.h
mmurooka/mc_rtc_ros
781b67729cd9375f558d55b190e77fee1993ca4e
[ "BSD-2-Clause" ]
14
2020-02-04T03:00:01.000Z
2022-01-25T09:29:48.000Z
mc_rtc_rviz_panel/src/ArrayInputWidget.h
mmurooka/mc_rtc_ros
781b67729cd9375f558d55b190e77fee1993ca4e
[ "BSD-2-Clause" ]
8
2019-12-27T05:30:19.000Z
2021-07-09T06:08:53.000Z
/* * Copyright 2016-2019 CNRS-UM LIRMM, CNRS-AIST JRL */ #pragma once #include "ClientWidget.h" namespace mc_rtc_rviz { struct ArrayInputWidget : public ClientWidget { Q_OBJECT public: ArrayInputWidget(const ClientWidgetParam & param, const std::vector<std::string> & labels); void update(const Eigen::VectorXd & data); QPushButton * showHideButton() override; protected: QPushButton * lock_button_; QHBoxLayout * labels_layout_; QGridLayout * edits_layout_; int edits_row_ = 0; std::vector<QLineEdit *> edits_; private slots: void lock_toggled(bool); void edit_return_pressed(); }; } // namespace mc_rtc_rviz
18.882353
93
0.738318
[ "vector" ]
5c6e80e64d32e9594261baa53a10dd9b12b1cd86
690
h
C
src/utils.h
KnairdA/SimpleParser
d7e8d8e4cdef84ded68795ba0c41bec2f1ee37f2
[ "MIT" ]
null
null
null
src/utils.h
KnairdA/SimpleParser
d7e8d8e4cdef84ded68795ba0c41bec2f1ee37f2
[ "MIT" ]
null
null
null
src/utils.h
KnairdA/SimpleParser
d7e8d8e4cdef84ded68795ba0c41bec2f1ee37f2
[ "MIT" ]
null
null
null
#ifndef PARSER_SRC_UTILS_H_ #define PARSER_SRC_UTILS_H_ #include <string> #include <vector> #include "nodes.h" namespace SimpleParser { enum class PrecedenceLevel : uint8_t { FIRST = 1, SECOND = 2, THIRD = 3, FOURTH = 4, FIFTH = 5, }; enum class TokenType { OPERATOR_PLUS, OPERATOR_MINUS, OPERATOR_DIVIDE, OPERATOR_MULTIPLY, OPERATOR_POWER, PARENTHESES_OPEN, PARENTHESES_CLOSE, VALUE_NUMBER, VALUE_IDENTIFIER, }; TokenType determineToken(const char); TokenType determineToken(const std::string&); PrecedenceLevel precedence(TokenType); std::vector<std::string> lexer(const std::string&); double stringToDouble(const std::string&); } #endif // PARSER_SRC_UTILS_H_
16.829268
51
0.757971
[ "vector" ]
5c7abae94a2060419b40531715ec25ad7a0ba42a
3,632
h
C
samples/extensions/raytracing_basic/raytracing_basic.h
lukaprsina/Vulkan-Samples
d291a4c5b32f94462eafdce6f6b965a34970906f
[ "Apache-2.0" ]
2,842
2016-02-16T14:01:31.000Z
2022-03-30T19:10:32.000Z
samples/extensions/raytracing_basic/raytracing_basic.h
lukaprsina/Vulkan-Samples
d291a4c5b32f94462eafdce6f6b965a34970906f
[ "Apache-2.0" ]
316
2016-02-16T20:41:29.000Z
2022-03-29T02:20:32.000Z
samples/extensions/raytracing_basic/raytracing_basic.h
lukaprsina/Vulkan-Samples
d291a4c5b32f94462eafdce6f6b965a34970906f
[ "Apache-2.0" ]
504
2016-02-16T16:43:37.000Z
2022-03-31T20:24:35.000Z
/* Copyright (c) 2019-2021, Sascha Willems * * SPDX-License-Identifier: Apache-2.0 * * 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. */ /* * Basic example for hardware accelerated ray tracing using VK_KHR_ray_tracing_pipeline and VK_KHR_acceleration_structure */ #pragma once #include "api_vulkan_sample.h" #include "glsl_compiler.h" // Holds data for a scratch buffer used as a temporary storage during acceleration structure builds struct ScratchBuffer { uint64_t device_address; VkBuffer handle; VkDeviceMemory memory; }; // Wraps all data required for an acceleration structure struct AccelerationStructure { VkAccelerationStructureKHR handle; uint64_t device_address; std::unique_ptr<vkb::core::Buffer> buffer; }; class RaytracingBasic : public ApiVulkanSample { public: VkPhysicalDeviceRayTracingPipelinePropertiesKHR ray_tracing_pipeline_properties{}; VkPhysicalDeviceAccelerationStructureFeaturesKHR acceleration_structure_features{}; AccelerationStructure bottom_level_acceleration_structure; AccelerationStructure top_level_acceleration_structure; std::unique_ptr<vkb::core::Buffer> vertex_buffer; std::unique_ptr<vkb::core::Buffer> index_buffer; uint32_t index_count; std::vector<VkRayTracingShaderGroupCreateInfoKHR> shader_groups{}; std::unique_ptr<vkb::core::Buffer> raygen_shader_binding_table; std::unique_ptr<vkb::core::Buffer> miss_shader_binding_table; std::unique_ptr<vkb::core::Buffer> hit_shader_binding_table; struct StorageImage { VkDeviceMemory memory; VkImage image = VK_NULL_HANDLE; VkImageView view; VkFormat format; uint32_t width; uint32_t height; } storage_image; struct UniformData { glm::mat4 view_inverse; glm::mat4 proj_inverse; } uniform_data; std::unique_ptr<vkb::core::Buffer> ubo; VkPipeline pipeline; VkPipelineLayout pipeline_layout; VkDescriptorSet descriptor_set; VkDescriptorSetLayout descriptor_set_layout; RaytracingBasic(); ~RaytracingBasic(); void request_gpu_features(vkb::PhysicalDevice &gpu) override; uint64_t get_buffer_device_address(VkBuffer buffer); ScratchBuffer create_scratch_buffer(VkDeviceSize size); void delete_scratch_buffer(ScratchBuffer &scratch_buffer); void create_storage_image(); void create_bottom_level_acceleration_structure(); void create_top_level_acceleration_structure(); void delete_acceleration_structure(AccelerationStructure &acceleration_structure); void create_scene(); void create_shader_binding_tables(); void create_descriptor_sets(); void create_ray_tracing_pipeline(); void create_uniform_buffer(); void build_command_buffers() override; void update_uniform_buffers(); void draw(); bool prepare(vkb::Platform &platform) override; virtual void render(float delta_time) override; }; std::unique_ptr<vkb::VulkanSample> create_raytracing_basic();
33.943925
121
0.735683
[ "render", "vector" ]
5c8052ac6cea5a6dfffe3340d420402e6ca89b74
2,594
h
C
cpp/src/arrow/python/python_to_arrow.h
stspyder/arrow
16b2a44be2b71bc1a7c95df70795664b4d450b6d
[ "Apache-2.0" ]
2
2021-09-28T01:36:21.000Z
2021-12-22T08:24:17.000Z
cpp/src/arrow/python/python_to_arrow.h
stspyder/arrow
16b2a44be2b71bc1a7c95df70795664b4d450b6d
[ "Apache-2.0" ]
8
2020-04-10T19:03:51.000Z
2021-01-21T01:06:28.000Z
cpp/src/arrow/python/python_to_arrow.h
stspyder/arrow
16b2a44be2b71bc1a7c95df70795664b4d450b6d
[ "Apache-2.0" ]
1
2020-12-08T10:36:30.000Z
2020-12-08T10:36:30.000Z
// Licensed to the Apache Software Foundation (ASF) under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you 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. // Functions for converting between CPython built-in data structures and Arrow // data structures #pragma once #include "arrow/python/platform.h" #include <cstdint> #include <memory> #include "arrow/python/visibility.h" #include "arrow/type.h" #include "arrow/util/macros.h" #include "arrow/python/common.h" namespace arrow { class Array; class Status; namespace py { struct PyConversionOptions { PyConversionOptions() : type(NULLPTR), size(-1), pool(NULLPTR), from_pandas(false) {} PyConversionOptions(const std::shared_ptr<DataType>& type, int64_t size, MemoryPool* pool, bool from_pandas) : type(type), size(size), pool(default_memory_pool()), from_pandas(from_pandas) {} // Set to null if to be inferred std::shared_ptr<DataType> type; // Default is -1: infer from data int64_t size; // Memory pool to use for allocations MemoryPool* pool; // Default false bool from_pandas; }; /// \brief Convert sequence (list, generator, NumPy array with dtype object) of /// Python objects. /// \param[in] obj the sequence to convert /// \param[in] mask a NumPy array of true/false values to indicate whether /// values in the sequence are null (true) or not null (false). This parameter /// may be null /// \param[in] options various conversion options /// \param[out] out a ChunkedArray containing one or more chunks /// \return Status ARROW_PYTHON_EXPORT Status ConvertPySequence(PyObject* obj, PyObject* mask, const PyConversionOptions& options, std::shared_ptr<ChunkedArray>* out); ARROW_PYTHON_EXPORT Status ConvertPySequence(PyObject* obj, const PyConversionOptions& options, std::shared_ptr<ChunkedArray>* out); } // namespace py } // namespace arrow
32.024691
88
0.718581
[ "object" ]
5c901d5b0f84a63e9579e6650118aee760cfc29b
3,196
h
C
content/browser/media/media_internals.h
codenote/chromium-test
0637af0080f7e80bf7d20b29ce94c5edc817f390
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
1
2018-03-10T13:08:49.000Z
2018-03-10T13:08:49.000Z
content/browser/media/media_internals.h
codenote/chromium-test
0637af0080f7e80bf7d20b29ce94c5edc817f390
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
null
null
null
content/browser/media/media_internals.h
codenote/chromium-test
0637af0080f7e80bf7d20b29ce94c5edc817f390
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
1
2020-11-04T07:25:45.000Z
2020-11-04T07:25:45.000Z
// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CONTENT_BROWSER_MEDIA_MEDIA_INTERNALS_H_ #define CONTENT_BROWSER_MEDIA_MEDIA_INTERNALS_H_ #include <string> #include <vector> #include "base/memory/ref_counted.h" #include "base/memory/singleton.h" #include "base/string16.h" #include "base/values.h" #include "content/common/content_export.h" #include "content/public/common/media_stream_request.h" namespace media { struct MediaLogEvent; } namespace content { // This class stores information about currently active media. // It's constructed on the UI thread but all of its methods are called on the IO // thread. class CONTENT_EXPORT MediaInternals { public: virtual ~MediaInternals(); static MediaInternals* GetInstance(); // The following methods are virtual for gmock. // Called when an audio stream is deleted. virtual void OnDeleteAudioStream(void* host, int stream_id); // Called when an audio stream is set to playing or paused. virtual void OnSetAudioStreamPlaying(void* host, int stream_id, bool playing); // Called when the status of an audio stream is set to "created", "flushed", // "closed", or "error". virtual void OnSetAudioStreamStatus(void* host, int stream_id, const std::string& status); // Called when the volume of an audio stream is set. virtual void OnSetAudioStreamVolume(void* host, int stream_id, double volume); // Called when a MediaEvent occurs. virtual void OnMediaEvent(int render_process_id, const media::MediaLogEvent& event); // Called with the update string. typedef base::Callback<void(const string16&)> UpdateCallback; // Add/remove update callbacks (see above). void AddUpdateCallback(const UpdateCallback& callback); void RemoveUpdateCallback(const UpdateCallback& callback); void SendEverything(); private: friend class MockMediaInternals; friend class MediaInternalsTest; friend struct DefaultSingletonTraits<MediaInternals>; MediaInternals(); // Sets |property| of an audio stream to |value| and notifies observers. // (host, stream_id) is a unique id for the audio stream. // |host| will never be dereferenced. void UpdateAudioStream(void* host, int stream_id, const std::string& property, Value* value); // Removes |item| from |data_|. void DeleteItem(const std::string& item); // Sets data_.id.property = value and notifies attached UIs using update_fn. // id may be any depth, e.g. "video.decoders.1.2.3" void UpdateItem(const std::string& update_fn, const std::string& id, const std::string& property, Value* value); // Calls javascript |function|(|value|) on each attached UI. void SendUpdate(const std::string& function, Value* value); DictionaryValue data_; std::vector<UpdateCallback> update_callbacks_; DISALLOW_COPY_AND_ASSIGN(MediaInternals); }; } // namespace content #endif // CONTENT_BROWSER_MEDIA_MEDIA_INTERNALS_H_
32.948454
80
0.711827
[ "vector" ]
5c962e3976449070d7df97336cd4099af42340ef
3,628
h
C
libgearman-server/struct/server.h
xuyanjun/gearman
36af368d6a0628f30f0654cc3ce2801c758ba292
[ "BSD-3-Clause" ]
null
null
null
libgearman-server/struct/server.h
xuyanjun/gearman
36af368d6a0628f30f0654cc3ce2801c758ba292
[ "BSD-3-Clause" ]
null
null
null
libgearman-server/struct/server.h
xuyanjun/gearman
36af368d6a0628f30f0654cc3ce2801c758ba292
[ "BSD-3-Clause" ]
null
null
null
/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: * * Gearmand client and server library. * * Copyright (C) 2011 Data Differential, http://datadifferential.com/ * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following disclaimer * in the documentation and/or other materials provided with the * distribution. * * * The names of its contributors may not be used to endorse or * promote products derived from this software without specific prior * written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ #pragma once struct queue_st { void *_context; gearman_queue_add_fn *_add_fn; gearman_queue_flush_fn *_flush_fn; gearman_queue_done_fn *_done_fn; gearman_queue_replay_fn *_replay_fn; }; enum queue_version_t { QUEUE_VERSION_FUNCTION, QUEUE_VERSION_CLASS }; #ifdef __cplusplus namespace gearmand { namespace queue { class Context; } }; #endif union queue_un { struct queue_st functions; #ifdef __cplusplus gearmand::queue::Context* object; #else void *_object; #endif char raw[sizeof(struct queue_st)]; }; struct gearman_server_st { struct { /* Sets the round-robin mode on the server object. RR will distribute work fairly among every function assigned to a worker, instead of draining each function before moving on to the next. */ bool round_robin; bool threaded; } flags; struct { bool queue_startup; } state; bool shutdown; bool shutdown_graceful; bool proc_wakeup; bool proc_shutdown; uint8_t job_retries; // Set maximum job retry count. uint8_t worker_wakeup; // Set maximum number of workers to wake up per job. uint32_t job_handle_count; uint32_t thread_count; uint32_t function_count; uint32_t job_count; uint32_t unique_count; uint32_t free_packet_count; uint32_t free_job_count; uint32_t free_client_count; uint32_t free_worker_count; gearman_server_thread_st *thread_list; gearman_server_function_st *function_list; gearman_server_packet_st *free_packet_list; gearman_server_job_st *free_job_list; gearman_server_client_st *free_client_list; gearman_server_worker_st *free_worker_list; enum queue_version_t queue_version; union queue_un queue; pthread_mutex_t proc_lock; pthread_cond_t proc_cond; pthread_t proc_id; char job_handle_prefix[GEARMAND_JOB_HANDLE_SIZE]; gearman_server_job_st *job_hash[GEARMAND_JOB_HASH_SIZE]; gearman_server_job_st *unique_hash[GEARMAND_JOB_HASH_SIZE]; };
32.684685
77
0.764057
[ "object" ]
5c98d6520e3bf40f34111d9d42054008a3ffd93f
786
h
C
tf2_bot_detector/PeriodicActions.h
Chrissucks/tf2_bot_detector
4a073e576c96f017c01531e4a37541e4c74ee250
[ "MIT" ]
null
null
null
tf2_bot_detector/PeriodicActions.h
Chrissucks/tf2_bot_detector
4a073e576c96f017c01531e4a37541e4c74ee250
[ "MIT" ]
null
null
null
tf2_bot_detector/PeriodicActions.h
Chrissucks/tf2_bot_detector
4a073e576c96f017c01531e4a37541e4c74ee250
[ "MIT" ]
null
null
null
#pragma once #include "Clock.h" #include <memory> #include <vector> namespace tf2_bot_detector { class IAction; class ActionManager; class IPeriodicAction { public: virtual ~IPeriodicAction() = default; virtual duration_t GetInterval() const = 0; virtual duration_t GetInitialDelay() const { return {}; } [[nodiscard]] virtual bool Execute(ActionManager& manager) = 0; }; class StatusUpdateAction final : public IPeriodicAction { public: duration_t GetInterval() const override; bool Execute(ActionManager& manager) override; private: bool m_NextShort = false; bool m_NextPing = false; }; class ConfigAction final : public IPeriodicAction { public: duration_t GetInterval() const override; bool Execute(ActionManager& manager) override; }; }
18.714286
65
0.737913
[ "vector" ]
b151ad62e0f7528e35f9f747deb05a01c96afac6
7,931
h
C
3rdparty/openmm/openmmapi/include/openmm/PeriodicTorsionForce.h
merkys/MMB
0531385b8367405e1188e31c3eef7aa4cc50170b
[ "MIT" ]
5
2020-07-31T17:33:03.000Z
2022-01-01T19:24:37.000Z
3rdparty/openmm/openmmapi/include/openmm/PeriodicTorsionForce.h
merkys/MMB
0531385b8367405e1188e31c3eef7aa4cc50170b
[ "MIT" ]
11
2020-06-16T05:05:42.000Z
2022-03-30T09:59:14.000Z
3rdparty/openmm/openmmapi/include/openmm/PeriodicTorsionForce.h
merkys/MMB
0531385b8367405e1188e31c3eef7aa4cc50170b
[ "MIT" ]
9
2020-01-24T12:02:37.000Z
2020-10-16T06:23:56.000Z
#ifndef OPENMM_PERIODICTORSIONFORCE_H_ #define OPENMM_PERIODICTORSIONFORCE_H_ /* -------------------------------------------------------------------------- * * OpenMM * * -------------------------------------------------------------------------- * * This is part of the OpenMM molecular simulation toolkit originating from * * Simbios, the NIH National Center for Physics-Based Simulation of * * Biological Structures at Stanford, funded under the NIH Roadmap for * * Medical Research, grant U54 GM072970. See https://simtk.org. * * * * Portions copyright (c) 2008-2016 Stanford University and the Authors. * * Authors: Peter Eastman * * Contributors: * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the "Software"), * * to deal in the Software without restriction, including without limitation * * the rights to use, copy, modify, merge, publish, distribute, sublicense, * * and/or sell copies of the Software, and to permit persons to whom the * * Software is furnished to do so, subject to the following conditions: * * * * The above copyright notice and this permission notice shall be included in * * all copies or substantial portions of the Software. * * * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * * THE AUTHORS, CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE * * USE OR OTHER DEALINGS IN THE SOFTWARE. * * -------------------------------------------------------------------------- */ #include "Force.h" #include "Vec3.h" #include <map> #include <vector> #include "internal/windowsExport.h" namespace OpenMM { /** * This class implements an interaction between groups of four particles that varies periodically with the torsion angle * between them. To use it, create a PeriodicTorsionForce object then call addTorsion() once for each torsion. After * a torsion has been added, you can modify its force field parameters by calling setTorsionParameters(). This will * have no effect on Contexts that already exist unless you call updateParametersInContext(). */ class OPENMM_EXPORT PeriodicTorsionForce : public Force { public: /** * Create a PeriodicTorsionForce. */ PeriodicTorsionForce(); /** * Get the number of periodic torsion terms in the potential function */ int getNumTorsions() const { return periodicTorsions.size(); } /** * Add a periodic torsion term to the force field. * * @param particle1 the index of the first particle forming the torsion * @param particle2 the index of the second particle forming the torsion * @param particle3 the index of the third particle forming the torsion * @param particle4 the index of the fourth particle forming the torsion * @param periodicity the periodicity of the torsion * @param phase the phase offset of the torsion, measured in radians * @param k the force constant for the torsion * @return the index of the torsion that was added */ int addTorsion(int particle1, int particle2, int particle3, int particle4, int periodicity, double phase, double k); /** * Get the force field parameters for a periodic torsion term. * * @param index the index of the torsion for which to get parameters * @param[out] particle1 the index of the first particle forming the torsion * @param[out] particle2 the index of the second particle forming the torsion * @param[out] particle3 the index of the third particle forming the torsion * @param[out] particle4 the index of the fourth particle forming the torsion * @param[out] periodicity the periodicity of the torsion * @param[out] phase the phase offset of the torsion, measured in radians * @param[out] k the force constant for the torsion */ void getTorsionParameters(int index, int& particle1, int& particle2, int& particle3, int& particle4, int& periodicity, double& phase, double& k) const; /** * Set the force field parameters for a periodic torsion term. * * @param index the index of the torsion for which to set parameters * @param particle1 the index of the first particle forming the torsion * @param particle2 the index of the second particle forming the torsion * @param particle3 the index of the third particle forming the torsion * @param particle4 the index of the fourth particle forming the torsion * @param periodicity the periodicity of the torsion * @param phase the phase offset of the torsion, measured in radians * @param k the force constant for the torsion */ void setTorsionParameters(int index, int particle1, int particle2, int particle3, int particle4, int periodicity, double phase, double k); /** * Update the per-torsion parameters in a Context to match those stored in this Force object. This method provides * an efficient method to update certain parameters in an existing Context without needing to reinitialize it. * Simply call setTorsionParameters() to modify this object's parameters, then call updateParametersInContext() * to copy them over to the Context. * * The only information this method updates is the values of per-torsion parameters. The set of particles involved * in a torsion cannot be changed, nor can new torsions be added. */ void updateParametersInContext(Context& context); /** * Set whether this force should apply periodic boundary conditions when calculating displacements. * Usually this is not appropriate for bonded forces, but there are situations when it can be useful. */ void setUsesPeriodicBoundaryConditions(bool periodic); /** * Returns whether or not this force makes use of periodic boundary * conditions. * * @returns true if force uses PBC and false otherwise */ bool usesPeriodicBoundaryConditions() const; protected: ForceImpl* createImpl() const; private: class PeriodicTorsionInfo; std::vector<PeriodicTorsionInfo> periodicTorsions; bool usePeriodic; }; /** * This is an internal class used to record information about a torsion. * @private */ class PeriodicTorsionForce::PeriodicTorsionInfo { public: int particle1, particle2, particle3, particle4, periodicity; double phase, k; PeriodicTorsionInfo() { particle1 = particle2 = particle3 = particle4 = -1; periodicity = 1; phase = k = 0.0; } PeriodicTorsionInfo(int particle1, int particle2, int particle3, int particle4, int periodicity, double phase, double k) : particle1(particle1), particle2(particle2), particle3(particle3), particle4(particle4), periodicity(periodicity), phase(phase), k(k) { } }; } // namespace OpenMM #endif /*OPENMM_PERIODICTORSIONFORCE_H_*/
52.177632
155
0.638003
[ "object", "vector" ]
b15f130a9d945e9821077b9bc4b8545fb6ead48b
6,818
h
C
external-deps/collada-dom/include/1.5/dom/domFx_sources.h
j4m3z0r/GamePlay
02ca734e5734d2fbc9d00a7eff65ed2656f26975
[ "Apache-2.0", "Unlicense" ]
1
2021-09-02T01:45:24.000Z
2021-09-02T01:45:24.000Z
external-deps/collada-dom/include/1.5/dom/domFx_sources.h
j4m3z0r/GamePlay
02ca734e5734d2fbc9d00a7eff65ed2656f26975
[ "Apache-2.0", "Unlicense" ]
null
null
null
external-deps/collada-dom/include/1.5/dom/domFx_sources.h
j4m3z0r/GamePlay
02ca734e5734d2fbc9d00a7eff65ed2656f26975
[ "Apache-2.0", "Unlicense" ]
null
null
null
#ifndef __domFx_sources_h__ #define __domFx_sources_h__ #include <dae/daeDocument.h> #include <dom/domTypes.h> #include <dom/domElements.h> class DAE; class domFx_sources : public daeElement { public: virtual COLLADA_TYPE::TypeEnum getElementType() const { return COLLADA_TYPE::FX_SOURCES; } static daeInt ID() { return 182; } virtual daeInt typeID() const { return ID(); } public: class domInline; typedef daeSmartRef<domInline> domInlineRef; typedef daeTArray<domInlineRef> domInline_Array; /** * this is allows you to include some code right here....like a #define for * an uber shader that is imported */ class domInline : public daeElement { public: virtual COLLADA_TYPE::TypeEnum getElementType() const { return COLLADA_TYPE::INLINE; } static daeInt ID() { return 183; } virtual daeInt typeID() const { return ID(); } public: //Accessors and Mutators /** * Gets the value of this element. * @return Returns a xsString of the value. */ xsString getValue() const { return _value; } /** * Sets the _value of this element. * @param val The new value for this element. */ void setValue( xsString val ) { *(daeStringRef*)&_value = val; } protected: // Value /** * The xsString value of the text data of this element. */ xsString _value; protected: /** * Constructor */ domInline(DAE& dae) : daeElement(dae), _value() {} /** * Destructor */ virtual ~domInline() {} /** * Overloaded assignment operator */ virtual domInline &operator=( const domInline &cpy ) { (void)cpy; return *this; } public: // STATIC METHODS /** * Creates an instance of this class and returns a daeElementRef referencing it. * @return a daeElementRef referencing an instance of this object. */ static DLLSPEC daeElementRef create(DAE& dae); /** * Creates a daeMetaElement object that describes this element in the meta object reflection framework. * If a daeMetaElement already exists it will return that instead of creating a new one. * @return A daeMetaElement describing this COLLADA element. */ static DLLSPEC daeMetaElement* registerElement(DAE& dae); }; class domImport; typedef daeSmartRef<domImport> domImportRef; typedef daeTArray<domImportRef> domImport_Array; /** * Ref attribute identifies the sid of a code or include element */ class domImport : public daeElement { public: virtual COLLADA_TYPE::TypeEnum getElementType() const { return COLLADA_TYPE::IMPORT; } static daeInt ID() { return 184; } virtual daeInt typeID() const { return ID(); } protected: // Attribute xsToken attrRef; public: //Accessors and Mutators /** * Gets the ref attribute. * @return Returns a xsToken of the ref attribute. */ xsToken getRef() const { return attrRef; } /** * Sets the ref attribute. * @param atRef The new value for the ref attribute. */ void setRef( xsToken atRef ) { *(daeStringRef*)&attrRef = atRef; _validAttributeArray[0] = true; } protected: /** * Constructor */ domImport(DAE& dae) : daeElement(dae), attrRef() {} /** * Destructor */ virtual ~domImport() {} /** * Overloaded assignment operator */ virtual domImport &operator=( const domImport &cpy ) { (void)cpy; return *this; } public: // STATIC METHODS /** * Creates an instance of this class and returns a daeElementRef referencing it. * @return a daeElementRef referencing an instance of this object. */ static DLLSPEC daeElementRef create(DAE& dae); /** * Creates a daeMetaElement object that describes this element in the meta object reflection framework. * If a daeMetaElement already exists it will return that instead of creating a new one. * @return A daeMetaElement describing this COLLADA element. */ static DLLSPEC daeMetaElement* registerElement(DAE& dae); }; protected: // Elements /** * this is allows you to include some code right here....like a #define for * an uber shader that is imported @see domInline */ domInline_Array elemInline_array; /** * Ref attribute identifies the sid of a code or include element @see domImport */ domImport_Array elemImport_array; /** * Used to preserve order in elements that do not specify strict sequencing of sub-elements. */ daeElementRefArray _contents; /** * Used to preserve order in elements that have a complex content model. */ daeUIntArray _contentsOrder; /** * Used to store information needed for some content model objects. */ daeTArray< daeCharArray * > _CMData; public: //Accessors and Mutators /** * Gets the inline element array. * @return Returns a reference to the array of inline elements. */ domInline_Array &getInline_array() { return elemInline_array; } /** * Gets the inline element array. * @return Returns a constant reference to the array of inline elements. */ const domInline_Array &getInline_array() const { return elemInline_array; } /** * Gets the import element array. * @return Returns a reference to the array of import elements. */ domImport_Array &getImport_array() { return elemImport_array; } /** * Gets the import element array. * @return Returns a constant reference to the array of import elements. */ const domImport_Array &getImport_array() const { return elemImport_array; } /** * Gets the _contents array. * @return Returns a reference to the _contents element array. */ daeElementRefArray &getContents() { return _contents; } /** * Gets the _contents array. * @return Returns a constant reference to the _contents element array. */ const daeElementRefArray &getContents() const { return _contents; } protected: /** * Constructor */ domFx_sources(DAE& dae) : daeElement(dae), elemInline_array(), elemImport_array() {} /** * Destructor */ virtual ~domFx_sources() { daeElement::deleteCMDataArray(_CMData); } /** * Overloaded assignment operator */ virtual domFx_sources &operator=( const domFx_sources &cpy ) { (void)cpy; return *this; } public: // STATIC METHODS /** * Creates an instance of this class and returns a daeElementRef referencing it. * @return a daeElementRef referencing an instance of this object. */ static DLLSPEC daeElementRef create(DAE& dae); /** * Creates a daeMetaElement object that describes this element in the meta object reflection framework. * If a daeMetaElement already exists it will return that instead of creating a new one. * @return A daeMetaElement describing this COLLADA element. */ static DLLSPEC daeMetaElement* registerElement(DAE& dae); }; #endif
30.168142
106
0.686858
[ "object", "model" ]
b160b6db5e9dcce2d1c96816eef33e93c91d26c4
3,218
h
C
svc_container.h
mikejac/rpcmqtt.esp8266-nonos.cpp
a2a6b8821dde314c8feadd809029c4c07fec4186
[ "MIT" ]
null
null
null
svc_container.h
mikejac/rpcmqtt.esp8266-nonos.cpp
a2a6b8821dde314c8feadd809029c4c07fec4186
[ "MIT" ]
null
null
null
svc_container.h
mikejac/rpcmqtt.esp8266-nonos.cpp
a2a6b8821dde314c8feadd809029c4c07fec4186
[ "MIT" ]
null
null
null
/* * The MIT License (MIT) * * ESP8266 Non-OS Firmware * Copyright (c) 2015 Michael Jacobsen (github.com/mikejac) * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * */ #ifndef SVC_CONTAINER_H #define SVC_CONTAINER_H #include "svc_accessory.h" #ifdef __cplusplus extern "C" { #endif /****************************************************************************************************************** * * */ typedef struct MqttDevice MqttDevice; /****************************************************************************************************************** * * */ typedef struct Container Container; struct Container { const char* Nodename; // "nodename" const char* Name; // "name" const char* SerialNumber; // "serialnumber" const char* Manufacturer; // "manufacturer" const char* Model; // "model" Accessory* Accessories; // "value" int idCount; int marshalBufferSize; MqttDevice* parent; }; /****************************************************************************************************************** * prototypes * */ /** * * @param nodename * @param name * @param serialnumber * @param manufacturer * @param model * @param marshalBufferSize * @return */ Container* NewContainer(const char* nodename, const char* name, const char* serialnumber, const char* manufacturer, const char* model, int marshalBufferSize); /** * AddAccessory adds an accessory to the container. * This method ensures that the accessory ids are valid and unique withing the container. * @param cont * @param a * @return */ sint64_t AddAccessory(Container* cont, Accessory* a); /** * * @param cont * @param aid * @return */ Accessory* FindByAid(Container* cont, sint64_t aid); /** * * @param aid * @param iid * @param format * @param value * @return */ char* MarshalValue(sint64_t aid, sint64_t iid, CharacteristicFormat format, CharacteristicValue* value); /** * * @param cont * @return */ char* marshalContainer(Container* cont); #ifdef __cplusplus } #endif #endif /* SVC_CONTAINER_H */
27.741379
158
0.61156
[ "model" ]
b16be43ab786534da4501cc1808f5c8d0e62c193
4,075
h
C
include/sonar_image_proc/AbstractSonarInterface.h
amarburg/libdraw_sonar
b7203d7a9aedee0a01779b5269ddcfe503f7971f
[ "BSD-3-Clause" ]
null
null
null
include/sonar_image_proc/AbstractSonarInterface.h
amarburg/libdraw_sonar
b7203d7a9aedee0a01779b5269ddcfe503f7971f
[ "BSD-3-Clause" ]
null
null
null
include/sonar_image_proc/AbstractSonarInterface.h
amarburg/libdraw_sonar
b7203d7a9aedee0a01779b5269ddcfe503f7971f
[ "BSD-3-Clause" ]
null
null
null
// Copyright 2021 University of Washington Applied Physics Laboratory // #pragma once #include <limits> #include <math.h> #include <stdint.h> #include <utility> #include <vector> namespace sonar_image_proc { typedef std::pair<float, float> Bounds_t; extern const Bounds_t UnsetBounds; struct AzimuthRangeIndices { AzimuthRangeIndices(size_t a, size_t r) : _rangeIdx(r), _azimuthIdx(a) { ; } size_t range() const { return _rangeIdx; } size_t azimuth() const { return _azimuthIdx; } size_t _rangeIdx, _azimuthIdx; }; // Abstract class strictly for drawing sonar images // Designed as a "common abstact type" between the Blueprint // Subsea SimplePingResult and ROS ImagingSonarMsg struct AbstractSonarInterface { public: AbstractSonarInterface(); enum DataType_t { TYPE_NONE, TYPE_UINT8, TYPE_UINT16, TYPE_UINT32, TYPE_FLOAT32 }; virtual DataType_t data_type() const = 0; // // azimuths are in **radians** // virtual const std::vector<float> &azimuths() const = 0; int nBearings() const { return azimuths().size(); } __attribute__((deprecated)); float bearing(int n) const { return azimuths().at(n); } __attribute__((deprecated)); int nAzimuth() const { return azimuths().size(); } int nAzimuths() const { return azimuths().size(); } // Whoops, should be consistent float azimuth(int n) const { return azimuths().at(n); } Bounds_t azimuthBounds() const; float minAzimuth() const { return azimuthBounds().first; } float maxAzimuth() const { return azimuthBounds().second; } float minAzimuthTan() const { checkAzimuthBounds(); return _minAzimuthTan; } float maxAzimuthTan() const { checkAzimuthBounds(); return _maxAzimuthTan; } // // ranges are in **meters** // virtual const std::vector<float> &ranges() const = 0; int nRanges() const { return ranges().size(); } float range(int n) const { return ranges().at(n); } Bounds_t rangeBounds() const; float minRange() const { return rangeBounds().first; } float maxRange() const { return rangeBounds().second; } float maxRangeSquared() const { checkRangeBounds(); return _maxRangeSquared; } // // Rather than dive into template magic, it's up to the // end user to understand the underlying data type // stored in a sonar data format. // // The "native" format is float ... so intensity_float() // is the only pure virtual. The default implementations of // _unit8 and _uint16 calculate from the float; but // depending on the original data format, it may be more efficient // to override these implementations // virtual float intensity_float(const AzimuthRangeIndices &idx) const = 0; virtual uint8_t intensity_uint8(const AzimuthRangeIndices &idx) const { return INT8_MAX * intensity_float(idx); } virtual uint16_t intensity_uint16(const AzimuthRangeIndices &idx) const { return INT16_MAX * intensity_float(idx); } virtual uint32_t intensity_uint32(const AzimuthRangeIndices &idx) const { return INT32_MAX * intensity_float(idx); } // Trivial wrappers. These will be deprecated eventually float intensity_float(size_t a, size_t r) const { return intensity_float(AzimuthRangeIndices(a, r)); } __attribute__((deprecated)); uint8_t intensity_uint8(size_t a, size_t r) const { return intensity_uint8(AzimuthRangeIndices(a, r)); } __attribute__((deprecated)); uint16_t intensity_uint16(size_t a, size_t r) const { return intensity_uint16(AzimuthRangeIndices(a, r)); } __attribute__((deprecated)); private: // In a few cases, need to "check and potentially calculate cached // value" without actually getting the value void checkRangeBounds() const; void checkAzimuthBounds() const; private: // Since we search extensively for the bounds // (rather than assuming the first and last are the bounds), // cache the results mutable Bounds_t _rangeBounds, _azimuthBounds; mutable float _minAzimuthTan, _maxAzimuthTan; mutable float _maxRangeSquared; }; } // namespace sonar_image_proc
27.910959
78
0.71681
[ "vector" ]
b17489cee58c5632032ce8a794fd98b20ac5e9dc
1,328
h
C
engine/core/audio/impl/sound_impl.h
ValtoForks/EtherealEngine
ab769803dcd71a61c2805afd259959b62fcdc1ff
[ "BSD-2-Clause" ]
791
2016-11-04T14:13:41.000Z
2022-03-20T20:47:31.000Z
engine/core/audio/impl/sound_impl.h
ValtoForks/EtherealEngine
ab769803dcd71a61c2805afd259959b62fcdc1ff
[ "BSD-2-Clause" ]
28
2016-12-01T05:59:30.000Z
2021-03-20T09:49:26.000Z
engine/core/audio/impl/sound_impl.h
ValtoForks/EtherealEngine
ab769803dcd71a61c2805afd259959b62fcdc1ff
[ "BSD-2-Clause" ]
151
2016-12-21T09:44:43.000Z
2022-03-31T13:42:18.000Z
#pragma once #include "../sound_data.h" #include <AL/al.h> #include <mutex> namespace audio { namespace priv { class source_impl; class sound_impl { public: using native_handle_type = ALuint; sound_impl(); ~sound_impl(); sound_impl(std::vector<std::uint8_t>&& buffer, const sound_info& info, bool stream = false); sound_impl(sound_impl&& rhs) = delete; sound_impl& operator=(sound_impl&& rhs) = delete; sound_impl(const sound_impl& rhs) = delete; sound_impl& operator=(const sound_impl& rhs) = delete; bool is_valid() const; const std::vector<native_handle_type>& native_handles() const { return handles_; } bool load_buffer(); private: friend class source_impl; bool load_buffer(const size_t chunk_size); void bind_to_source(source_impl* source); void unbind_from_source(source_impl* source); void unbind_from_all_sources(); void cleanup(); std::vector<native_handle_type> handles_; // transient data valid until the audio is being streamed from memory std::vector<std::uint8_t> buf_; size_t buf_ptr_ = 0; sound_info buf_info_; /// openal doesn't let us destroy sounds that are /// binded, so we have to keep this bookkeeping std::mutex mutex_; std::vector<source_impl*> bound_to_sources_; }; } }
22.508475
96
0.693524
[ "vector" ]
b17981bf6639982a97049b7335aa610084e807ce
787
h
C
examples/FightingGame2D/FightingGame2DGame.h
xcasadio/casaengine
19e34c0457265435c28667df7f2e5c137d954b98
[ "MIT" ]
null
null
null
examples/FightingGame2D/FightingGame2DGame.h
xcasadio/casaengine
19e34c0457265435c28667df7f2e5c137d954b98
[ "MIT" ]
null
null
null
examples/FightingGame2D/FightingGame2DGame.h
xcasadio/casaengine
19e34c0457265435c28667df7f2e5c137d954b98
[ "MIT" ]
null
null
null
#ifndef FightingGame2DGAME_H_ #define FightingGame2DGAME_H_ #include "GameTime.h" #include "Game/Game.h" #include "Sprite/SpriteRenderer.h" #include "World/World.h" #include "Entities/Components/AnimatedSpriteComponent.h" using namespace CasaEngine; class FightingGame2DGame : public Game { public: FightingGame2DGame(); ~FightingGame2DGame(); void Initialize(); void LoadContent(); void Update(const CasaEngine::GameTime& gameTime_); void Draw(); private: void AddGameComponent(); std::vector<Animation2DData> LoadAnimations(); void LoadSprites(); void DisplayGrid(); void DisplayCollisions(); void DisplayCollision(BaseEntity* pEntity); void DisplayPositions(); void DisplayPosition(BaseEntity* pEntity); void DisplayUI(); private: World* m_pWorld; }; #endif
18.738095
56
0.770013
[ "vector" ]
b17a61901d4e22e294e9e023807b141f416af4e9
190
h
C
inc/branch.h
Programmer74/vno-cli
9d6c04cac2aaf8b9f0e440699e02aa9957173060
[ "MIT" ]
null
null
null
inc/branch.h
Programmer74/vno-cli
9d6c04cac2aaf8b9f0e440699e02aa9957173060
[ "MIT" ]
null
null
null
inc/branch.h
Programmer74/vno-cli
9d6c04cac2aaf8b9f0e440699e02aa9957173060
[ "MIT" ]
null
null
null
#ifndef BRANCH_H #define BRANCH_H #include <vector> #include <string> #include <iostream> class branch { public: static void do_branch(std::string branch_name); }; #endif // COMMIT_H
12.666667
51
0.726316
[ "vector" ]
b17f3fba0df099cf2c56ca11a943413ea0362ce7
32,577
c
C
src/hg/lib/wikiTrack.c
bowhan/kent
714d060bfe004719bb2465a2fecde52f746ab4fb
[ "IJG" ]
3
2017-10-11T21:10:01.000Z
2018-03-14T22:19:20.000Z
src/hg/lib/wikiTrack.c
bowhan/kent
714d060bfe004719bb2465a2fecde52f746ab4fb
[ "IJG" ]
null
null
null
src/hg/lib/wikiTrack.c
bowhan/kent
714d060bfe004719bb2465a2fecde52f746ab4fb
[ "IJG" ]
3
2016-10-25T18:19:35.000Z
2021-03-07T01:46:18.000Z
/* wikiTrack.c was originally generated by the autoSql program, which also * generated wikiTrack.h and wikiTrack.sql. This module links the database and * the RAM representation of objects. */ #include "common.h" #include "linefile.h" #include "dystring.h" #include "jksql.h" #include "wikiTrack.h" #include "errCatch.h" void wikiTrackStaticLoad(char **row, struct wikiTrack *ret) /* Load a row from wikiTrack table into ret. The contents of ret will * be replaced at the next call to this function. */ { ret->bin = sqlUnsigned(row[0]); ret->chrom = row[1]; ret->chromStart = sqlUnsigned(row[2]); ret->chromEnd = sqlUnsigned(row[3]); ret->name = row[4]; ret->score = sqlUnsigned(row[5]); safecpy(ret->strand, sizeof(ret->strand), row[6]); ret->db = row[7]; ret->owner = row[8]; ret->color = row[9]; ret->class = row[10]; ret->creationDate = row[11]; ret->lastModifiedDate = row[12]; ret->descriptionKey = row[13]; ret->id = sqlUnsigned(row[14]); ret->geneSymbol = row[15]; } struct wikiTrack *wikiTrackLoad(char **row) /* Load a wikiTrack from row fetched with select * from wikiTrack * from database. Dispose of this with wikiTrackFree(). */ { struct wikiTrack *ret; AllocVar(ret); ret->bin = sqlUnsigned(row[0]); ret->chrom = cloneString(row[1]); ret->chromStart = sqlUnsigned(row[2]); ret->chromEnd = sqlUnsigned(row[3]); ret->name = cloneString(row[4]); ret->score = sqlUnsigned(row[5]); safecpy(ret->strand, sizeof(ret->strand), row[6]); ret->db = cloneString(row[7]); ret->owner = cloneString(row[8]); ret->color = cloneString(row[9]); ret->class = cloneString(row[10]); ret->creationDate = cloneString(row[11]); ret->lastModifiedDate = cloneString(row[12]); ret->descriptionKey = cloneString(row[13]); ret->id = sqlUnsigned(row[14]); ret->geneSymbol = cloneString(row[15]); return ret; } struct wikiTrack *wikiTrackLoadAll(char *fileName) /* Load all wikiTrack from a whitespace-separated file. * Dispose of this with wikiTrackFreeList(). */ { struct wikiTrack *list = NULL, *el; struct lineFile *lf = lineFileOpen(fileName, TRUE); char *row[16]; while (lineFileRow(lf, row)) { el = wikiTrackLoad(row); slAddHead(&list, el); } lineFileClose(&lf); slReverse(&list); return list; } struct wikiTrack *wikiTrackLoadAllByChar(char *fileName, char chopper) /* Load all wikiTrack from a chopper separated file. * Dispose of this with wikiTrackFreeList(). */ { struct wikiTrack *list = NULL, *el; struct lineFile *lf = lineFileOpen(fileName, TRUE); char *row[16]; while (lineFileNextCharRow(lf, chopper, row, ArraySize(row))) { el = wikiTrackLoad(row); slAddHead(&list, el); } lineFileClose(&lf); slReverse(&list); return list; } struct wikiTrack *wikiTrackLoadByQuery(struct sqlConnection *conn, char *query) /* Load all wikiTrack from table that satisfy the query given. * Where query is of the form 'select * from example where something=something' * or 'select example.* from example, anotherTable where example.something = * anotherTable.something'. * Dispose of this with wikiTrackFreeList(). */ { struct wikiTrack *list = NULL, *el; struct sqlResult *sr; char **row; sr = sqlGetResult(conn, query); while ((row = sqlNextRow(sr)) != NULL) { el = wikiTrackLoad(row); slAddHead(&list, el); } slReverse(&list); sqlFreeResult(&sr); return list; } void wikiTrackSaveToDb(struct sqlConnection *conn, struct wikiTrack *el, char *tableName, int updateSize) /* Save wikiTrack as a row to the table specified by tableName. * As blob fields may be arbitrary size updateSize specifies the approx size * of a string that would contain the entire query. Arrays of native types are * converted to comma separated strings and loaded as such, User defined types are * inserted as NULL. Strings are automatically escaped to allow insertion into the database. */ { struct dyString *update = newDyString(updateSize); sqlDyStringPrintf(update, "insert into %s values ( %u,'%s',%u,%u,'%s',%u,'%s','%s','%s','%s','%s','%s','%s','%s',%u,'%s')", tableName, el->bin, el->chrom, el->chromStart, el->chromEnd, el->name, el->score, el->strand, el->db, el->owner, el->color, el->class, el->creationDate, el->lastModifiedDate, el->descriptionKey, el->id, el->geneSymbol); sqlUpdate(conn, update->string); freeDyString(&update); } struct wikiTrack *wikiTrackCommaIn(char **pS, struct wikiTrack *ret) /* Create a wikiTrack out of a comma separated string. * This will fill in ret if non-null, otherwise will * return a new wikiTrack */ { char *s = *pS; if (ret == NULL) AllocVar(ret); ret->bin = sqlUnsignedComma(&s); ret->chrom = sqlStringComma(&s); ret->chromStart = sqlUnsignedComma(&s); ret->chromEnd = sqlUnsignedComma(&s); ret->name = sqlStringComma(&s); ret->score = sqlUnsignedComma(&s); sqlFixedStringComma(&s, ret->strand, sizeof(ret->strand)); ret->db = sqlStringComma(&s); ret->owner = sqlStringComma(&s); ret->color = sqlStringComma(&s); ret->class = sqlStringComma(&s); ret->creationDate = sqlStringComma(&s); ret->lastModifiedDate = sqlStringComma(&s); ret->descriptionKey = sqlStringComma(&s); ret->id = sqlUnsignedComma(&s); ret->geneSymbol = sqlStringComma(&s); *pS = s; return ret; } void wikiTrackFree(struct wikiTrack **pEl) /* Free a single dynamically allocated wikiTrack such as created * with wikiTrackLoad(). */ { struct wikiTrack *el; if ((el = *pEl) == NULL) return; freeMem(el->chrom); freeMem(el->name); freeMem(el->db); freeMem(el->owner); freeMem(el->color); freeMem(el->class); freeMem(el->creationDate); freeMem(el->lastModifiedDate); freeMem(el->descriptionKey); freeMem(el->geneSymbol); freez(pEl); } void wikiTrackFreeList(struct wikiTrack **pList) /* Free a list of dynamically allocated wikiTrack's */ { struct wikiTrack *el, *next; for (el = *pList; el != NULL; el = next) { next = el->next; wikiTrackFree(&el); } *pList = NULL; } void wikiTrackOutput(struct wikiTrack *el, FILE *f, char sep, char lastSep) /* Print out wikiTrack. Separate fields with sep. Follow last field with lastSep. */ { fprintf(f, "%u", el->bin); fputc(sep,f); if (sep == ',') fputc('"',f); fprintf(f, "%s", el->chrom); if (sep == ',') fputc('"',f); fputc(sep,f); fprintf(f, "%u", el->chromStart); fputc(sep,f); fprintf(f, "%u", el->chromEnd); fputc(sep,f); if (sep == ',') fputc('"',f); fprintf(f, "%s", el->name); if (sep == ',') fputc('"',f); fputc(sep,f); fprintf(f, "%u", el->score); fputc(sep,f); if (sep == ',') fputc('"',f); fprintf(f, "%s", el->strand); if (sep == ',') fputc('"',f); fputc(sep,f); if (sep == ',') fputc('"',f); fprintf(f, "%s", el->db); if (sep == ',') fputc('"',f); fputc(sep,f); if (sep == ',') fputc('"',f); fprintf(f, "%s", el->owner); if (sep == ',') fputc('"',f); fputc(sep,f); if (sep == ',') fputc('"',f); fprintf(f, "%s", el->color); if (sep == ',') fputc('"',f); fputc(sep,f); if (sep == ',') fputc('"',f); fprintf(f, "%s", el->class); if (sep == ',') fputc('"',f); fputc(sep,f); if (sep == ',') fputc('"',f); fprintf(f, "%s", el->creationDate); if (sep == ',') fputc('"',f); fputc(sep,f); if (sep == ',') fputc('"',f); fprintf(f, "%s", el->lastModifiedDate); if (sep == ',') fputc('"',f); fputc(sep,f); if (sep == ',') fputc('"',f); fprintf(f, "%s", el->descriptionKey); if (sep == ',') fputc('"',f); fputc(sep,f); fprintf(f, "%u", el->id); fputc(sep,f); if (sep == ',') fputc('"',f); fprintf(f, "%s", el->geneSymbol); if (sep == ',') fputc('"',f); fputc(lastSep,f); } /* -------------------------------- End autoSql Generated Code -------------------------------- */ #include "hgConfig.h" #include "wikiLink.h" #include "cheapcgi.h" #include "hdb.h" #include "hui.h" #include "net.h" #include "cart.h" #include "hPrint.h" #include "grp.h" #include "obscure.h" #include "hCommon.h" #include "web.h" #include "hgColors.h" #ifdef NOT static void savePosInTextBox(char *chrom, int start, int end) /* Save basic position/database info in text box and hidden var. Positions becomes chrom:start-end*/ { char position[128]; char *newPos; safef(position, 128, "%s:%d-%d", chrom, start, end); newPos = addCommasToPos(position); cgiMakeTextVar("getDnaPos", newPos, strlen(newPos) + 2); cgiContinueHiddenVar("db"); } #endif boolean wikiTrackReadOnly() /* return TRUE if wiki track is in Read-Only mode, default answer is FALSE */ { return cfgOptionBooleanDefault(CFG_WIKI_TRACK_READ_ONLY, FALSE); } boolean wikiTrackEnabled(char *database, char **wikiUserName) /*determine if wikiTrack can be used, and is this user logged into the wiki ?*/ { static boolean done = FALSE; static boolean status = FALSE; static boolean wikiUp = TRUE; static char *userName = NULL; /* do not repeat this query */ if (done) { if (wikiUserName) *wikiUserName = userName; /* returning name indicates logged in */ return status; } done = TRUE; /* only need to do this once */ if (wikiUserName) *wikiUserName = NULL; /* assume not logged in until proven otherwise */ /* potentially a comma separated list */ char *dbListString = cfgOption(CFG_WIKI_DB_LIST); char *dbList[256]; int dbCount = 0; if (NULL != dbListString) { dbCount = chopByChar(cloneString(dbListString), ',', dbList, ArraySize(dbList)); } boolean validDb = TRUE; if (dbCount > 0) { validDb = FALSE; int i; for (i = 0; i < dbCount; ++i) { if (sameWord(dbList[i],database)) { validDb = TRUE; break; } } } /* must have wiki login system enabled, and the new cfg options exist too. */ if (validDb && wikiLinkEnabled() && (cfgOption(CFG_WIKI_SESSION_COOKIE) != NULL) && (cfgOption(CFG_WIKI_BROWSER) != NULL) && (cfgOption(CFG_WIKI_URL) != NULL)) { char *wikiUser = wikiLinkUserName(); if ( (wikiUser) && (findCookieData(cfgOption(CFG_WIKI_SESSION_COOKIE)) != NULL) ) { struct htmlPage *page = NULL; /* protect against temporarily offline wiki site */ struct errCatch *errCatch = errCatchNew(); if (errCatchStart(errCatch)) { page = fetchEditPage(TEST_EMAIL_VERIFIED); } errCatchEnd(errCatch); if (errCatch->gotError) // we think it is supposed to be there { wikiUp = FALSE; // but it will not respond } errCatchFree(&errCatch); char *loginExpired = NULL; if (page) loginExpired = stringIn(LOGIN_EXPIRED, page->fullText); if (loginExpired == NULL) { if (wikiTrackReadOnly()) userName = NULL; /* read-only mode 2012-06-25 */ else userName = wikiUser; } } /* see if table exists, create it if it is not yet there */ struct sqlConnection *wikiConn = wikiConnect(); if (! sqlTableExists(wikiConn,WIKI_TRACK_TABLE)) { char *query = wikiTrackGetCreateSql(WIKI_TRACK_TABLE); sqlUpdate(wikiConn, query); freeMem(query); } wikiDisconnect(&wikiConn); if (wikiUp) status = TRUE; /* system is enabled */ } if (wikiUserName) *wikiUserName = userName; /* returning name indicates logged in */ return status; } /* from hg/lib/wikiTrack.sql */ static char *createString = "CREATE TABLE %s (\n" "bin smallint unsigned not null,\n" "chrom varchar(255) not null,\n" "chromStart int unsigned not null,\n" "chromEnd int unsigned not null,\n" "name varchar(255) not null,\n" "score int unsigned not null,\n" "strand char(1) not null,\n" "db varchar(36) not null,\n" "owner varchar(255) not null,\n" "color varchar(255) not null,\n" "class varchar(255) not null,\n" "creationDate varchar(255) not null,\n" "lastModifiedDate varchar(255) not null,\n" "descriptionKey varchar(255) not null,\n" "id int unsigned not null auto_increment,\n" "geneSymbol varchar(255) null,\n" "PRIMARY KEY(id),\n" "INDEX chrom (db,bin,chrom),\n" "INDEX name (db,name),\n" "INDEX gene (geneSymbol)\n" ")\n"; char *wikiTrackGetCreateSql(char *tableName) /* return sql create statement for wiki track with tableName */ { struct dyString *dy = dyStringNew(512); sqlDyStringPrintf(dy, createString, tableName); return (dyStringCannibalize(&dy)); } char *wikiDbName() /* return name of database where wiki track is located currently this is central.db but the future may be configurable */ { static char *dbName = NULL; if (dbName) return dbName; char setting[64]; safef(setting, sizeof(setting), "central.db"); dbName = cfgOption(setting); return dbName; } struct sqlConnection *wikiConnect() /* connect to db where wikiTrack table is located * currently this is hConnectCentral() but the future may be * configurable */ { struct sqlConnection *conn = hConnectCentral(); return conn; } void wikiDisconnect(struct sqlConnection **pConn) /* disconnect from wikiTrack table database */ { hDisconnectCentral(pConn); } struct wikiTrack *findWikiItemId(char *wikiItemId) /* given a wikiItemId return the row from the table */ { struct wikiTrack *item; char query[256]; struct sqlConnection *wikiConn = wikiConnect(); sqlSafef(query, ArraySize(query), "SELECT * FROM %s WHERE id='%s' limit 1", WIKI_TRACK_TABLE, wikiItemId); item = wikiTrackLoadByQuery(wikiConn, query); if (NULL == item) errAbort("display wiki item: failed to load item '%s'", wikiItemId); wikiDisconnect(&wikiConn); return item; } struct wikiTrack *findWikiItemByGeneSymbol(char *db, char *geneSymbol) /* given a db and UCSC known gene geneSymbol, find the wiki item */ { struct wikiTrack *item = NULL; /* make sure neither of these arguments is NULL */ if (db && geneSymbol) { char query[256]; struct sqlConnection *wikiConn = wikiConnect(); sqlSafef(query, ArraySize(query), "SELECT * FROM %s WHERE db='%s' AND geneSymbol='%s' limit 1", WIKI_TRACK_TABLE, db, geneSymbol); item = wikiTrackLoadByQuery(wikiConn, query); wikiDisconnect(&wikiConn); } return item; } struct wikiTrack *findWikiItemByName(char *db, char *name) /* given a db,name pair return the row from the table, can return NULL */ { struct wikiTrack *item = NULL; /* make sure neither of these arguments is NULL */ if (name && db) { char query[256]; struct sqlConnection *wikiConn = wikiConnect(); sqlSafef(query, ArraySize(query), "SELECT * FROM %s WHERE db='%s' AND name='%s' limit 1", WIKI_TRACK_TABLE, db, name); item = wikiTrackLoadByQuery(wikiConn, query); wikiDisconnect(&wikiConn); } return item; } static char *stripEditURLs(char *rendered) /* test for actual text, remove edit sections and any html comment strings */ { char *stripped = cloneString(rendered); char *found = NULL; char *begin = "<div class=\"editsection\""; char *end = "></a>"; /* XXXX is this response going to be language dependent ? */ if (stringIn(WIKI_NO_TEXT_RESPONSE,rendered)) return NULL; /* remove any edit sections */ while (NULL != (found = stringBetween(begin, end, stripped)) ) { if (strlen(found) > 0) { struct dyString *rm = newDyString(1024); dyStringPrintf(rm, "%s%s%s", begin, found, end); stripString(stripped, rm->string); freeMem(found); freeDyString(&rm); } } /* and remove comment strings from the wiki */ begin = "<!--"; end = "-->"; while (NULL != (found = stringBetween(begin, end, stripped)) ) { if (strlen(found) > 0) { struct dyString *rm = newDyString(1024); dyStringPrintf(rm, "%s%s%s", begin, found, end); stripString(stripped, rm->string); freeMem(found); freeDyString(&rm); } } return stripped; } void htmlCloneFormVarSet(struct htmlForm *parent, struct htmlForm *clone, char *name, char *val) /* clone form variable from parent, with new value, * if *val is NULL, clone val from parent */ { struct htmlFormVar *cloneVar; struct htmlFormVar *var; if (parent == NULL) errAbort("Null parent form passed to htmlCloneFormVarSet"); if (clone == NULL) errAbort("Null clone form passed to htmlCloneFormVarSet"); var = htmlFormVarGet(parent, name); if (var == NULL) errAbort("Variable '%s' not found in parent in htmlCloneFormVarSet", name); AllocVar(cloneVar); cloneVar->name = cloneString(var->name); cloneVar->tagName = cloneString(var->tagName); cloneVar->type = cloneString(var->type); if (NULL == val) cloneVar->curVal = cloneString(var->curVal); else cloneVar->curVal = cloneString(val); slAddHead(&clone->vars, cloneVar); } char *fetchWikiRawText(char *descriptionKey) /* fetch page from wiki in raw form as it is in the edit form */ { char wikiPageUrl[512]; safef(wikiPageUrl, sizeof(wikiPageUrl), "%s/index.php?title=%s&action=raw", cfgOptionDefault(CFG_WIKI_URL, NULL), descriptionKey); struct lineFile *lf = netLineFileMayOpen(wikiPageUrl); struct dyString *wikiPage = newDyString(1024); if (lf) { char *line; int lineSize; while (lineFileNext(lf, &line, &lineSize)) dyStringPrintf(wikiPage, "%s\n", line); lineFileClose(&lf); } /* test for text, remove any edit sections and comment strings */ char *rawText = NULL; if (wikiPage->string) { /* XXXX is this response going to be language dependent ? */ if (stringIn(WIKI_NO_TEXT_RESPONSE,wikiPage->string)) return NULL; rawText = dyStringCannibalize(&wikiPage); } freeDyString(&wikiPage); return rawText; } char *fetchWikiRenderedText(char *descriptionKey) /* fetch page from wiki in rendered form, strip it of edit URLs, * html comments, and test for actual proper return. * returned string can be freed after use */ { char wikiPageUrl[512]; safef(wikiPageUrl, sizeof(wikiPageUrl), "%s/index.php/%s?action=render", cfgOptionDefault(CFG_WIKI_URL, NULL), descriptionKey); struct lineFile *lf = netLineFileMayOpen(wikiPageUrl); struct dyString *wikiPage = newDyString(1024); if (lf) { char *line; int lineSize; while (lineFileNext(lf, &line, &lineSize)) dyStringPrintf(wikiPage, "%s\n", line); lineFileClose(&lf); } /* test for text, remove any edit sections and comment strings */ char *strippedRender = NULL; if (wikiPage->string) strippedRender = stripEditURLs(wikiPage->string); freeDyString(&wikiPage); return strippedRender; } char *adjustWikiUrls (char *comments) /* change relative to full urls for images */ { char *com; char buf[128]; char *url = cfgOptionDefault(CFG_WIKI_URL, NULL); safef(buf, sizeof(buf), "img src=\"%s/images", url); com = replaceChars(comments, "img src=\"/images", buf); return com; } void displayComments(struct wikiTrack *item) /* display the rendered comments for this item */ { char *url = cfgOptionDefault(CFG_WIKI_URL, NULL); hPrintf("<B>Description and comments from the wiki article " "<A HREF=\"%s/index.php/%s\" TARGET=_blank>%s:</B></A><BR>\n", url, item->descriptionKey, item->descriptionKey); /* the nbsp is displayed if the browser does not honor the frame tag */ hPrintf("<P>\n<IFRAME SRC='%s/index.php/%s?action=render'\n" " style='width:800px;height:600px;' frameborder='1'\n" " scrolling='yes' marginwidth='5' marginheight='5'\n" "&nbsp;</IFRAME>\n</P>\n", url, item->descriptionKey); #ifdef NOT char *comments = fetchWikiRenderedText(item->descriptionKey); if (comments && (strlen(comments) > 2)) { /* change relative to full urls for images */ char *com = adjustWikiUrls(comments); hPrintf("\n%s\n", com); } else hPrintf("\n(no comments for this item at the current time)<BR>\n"); #endif } struct htmlPage *fetchEditPage(char *descriptionKey) /* fetch edit page for descriptionKey page name in wiki */ { struct htmlCookie *cookie; char wikiPageUrl[512]; /* must pass the session cookie from the wiki in order to edit */ AllocVar(cookie); cookie->name = cloneString(cfgOption(CFG_WIKI_SESSION_COOKIE)); cookie->value = cloneString(findCookieData(cookie->name)); /* fetch the edit page to get the wpEditToken, and current contents */ safef(wikiPageUrl, sizeof(wikiPageUrl), "%s/index.php/%s?action=edit", cfgOptionDefault(CFG_WIKI_URL, NULL), descriptionKey); char *fullText = htmlSlurpWithCookies(wikiPageUrl,cookie); struct htmlPage *page = htmlPageParseOk(wikiPageUrl, fullText); /* fullText pointer is placed in page->fullText */ /* the submit on the edit is going to need these cookies */ page->cookies = cookie; return (page); } void prefixComments(struct wikiTrack *item, char *comments, char *userName, char *seqName, int winStart, int winEnd, char *database, char *extraHeader, char *extraTag, char *category) /* add comments at the beginning of an existing wiki item */ { /* do nothing if given nothing */ if (NULL == comments) return; struct dyString *content = newDyString(1024); struct htmlPage *page = fetchEditPage(item->descriptionKey); /* create a stripped down edit form, we don't want all the variables */ struct htmlForm *strippedEditForm; AllocVar(strippedEditForm); struct htmlForm *currentEditForm = htmlFormGet(page,"editform"); if (NULL == currentEditForm) errAbort("prefixComments: can not get editform ? (wiki login confused ?)"); strippedEditForm->name = cloneString(currentEditForm->name); /* the lower case "post" in the editform does not work ? */ /*strippedEditForm->method = cloneString(currentEditForm->method);*/ strippedEditForm->method = cloneString("POST"); strippedEditForm->startTag = currentEditForm->startTag; strippedEditForm->endTag = currentEditForm->endTag; /* fetch any current page contents in the edit form to continue them */ struct htmlFormVar *wpTextbox1 = htmlPageGetVar(page, currentEditForm, "wpTextbox1"); /* these new comments are the first thing on the page */ dyStringPrintf(content, "''comments added: ~~~~''"); if (extraTag) dyStringPrintf(content, "&nbsp;'''%s'''", extraTag); dyStringPrintf(content, "\n\n%s<BR>\n", comments); /* might want to recreate the header if it has gone missing */ /* decide on whether adding comments to existing text, or starting a * new article from scratch. * This function could be extended to actually checking the current * contents to see if the "Category:" or "created:" lines have been * removed, and then restore them. */ if (!(wpTextbox1->curVal && (strlen(wpTextbox1->curVal) > 2))) { boolean recreateHeader = FALSE; char position[128]; char *newPos; char *userSignature; /* In the case where this is a restoration of the header lines, * may be a different creator than this user adding comments. * So, get the header line correct to represent the actual creator. */ if (sameWord(userName, item->owner)) userSignature = cloneString("~~~~"); else { struct dyString *tt = newDyString(1024); dyStringPrintf(tt, "[[User:%s|%s]] ", item->owner, item->owner); dyStringPrintf(tt, "%s", item->creationDate); userSignature = dyStringCannibalize(&tt); recreateHeader = TRUE; } safef(position, 128, "%s:%d-%d", seqName, winStart+1, winEnd); newPos = addCommasToPos(database, position); if (extraHeader) { dyStringPrintf(content, "%s\n%s\n", category, extraHeader); } else { dyStringPrintf(content, "%s\n" "[http://%s/cgi-bin/hgTracks?db=%s&wikiTrack=pack&position=%s:%d-%d %s %s]" "&nbsp;&nbsp;<B>'%s'</B>&nbsp;&nbsp;", category, cfgOptionDefault(CFG_WIKI_BROWSER, DEFAULT_BROWSER), database, seqName, winStart+1, winEnd, database, newPos, item->name); } dyStringPrintf(content, "''created: %s''", userSignature); if (extraTag) dyStringPrintf(content, "&nbsp;'''%s'''", extraTag); } /* append previous content, if any */ if (wpTextbox1->curVal && (strlen(wpTextbox1->curVal) > 2)) { char *rawText = fetchWikiRawText(item->descriptionKey); dyStringPrintf(content, "\n\n%s", rawText); } else { dyStringPrintf(content, "\n\n%s", NO_ITEM_COMMENT_SUPPLIED); } htmlCloneFormVarSet(currentEditForm, strippedEditForm, "wpTextbox1", content->string); htmlCloneFormVarSet(currentEditForm, strippedEditForm, "wpSummary", ""); htmlCloneFormVarSet(currentEditForm, strippedEditForm, "wpSection", ""); htmlCloneFormVarSet(currentEditForm, strippedEditForm, "wpMinoredit", "1"); /* htmlCloneFormVarSet(currentEditForm, strippedEditForm, "wpSave", "Save page"); */ htmlCloneFormVarSet(currentEditForm, strippedEditForm, "wpEdittime", NULL); htmlCloneFormVarSet(currentEditForm, strippedEditForm, "wpEditToken", NULL); htmlPageSetVar(page,currentEditForm, "wpTextbox1", content->string); htmlPageSetVar(page,currentEditForm, "wpSummary", ""); htmlPageSetVar(page,currentEditForm, "wpSection", ""); htmlPageSetVar(page,currentEditForm, "wpMinoredit", "1"); htmlPageSetVar(page,currentEditForm, "wpSave", "Save page"); char newUrl[1024]; char *wikiHost = wikiLinkHost(); /* fake out htmlPageFromForm since it doesn't understand the colon : */ safef(newUrl, ArraySize(newUrl), "http://%s%s", wikiHost, currentEditForm->action); freeMem(wikiHost); /* something, somewhere encoded the & into &amp; which does not work */ char *fixedString = replaceChars(newUrl, "&amp;", "&"); currentEditForm->action = cloneString(fixedString); strippedEditForm->action = cloneString(fixedString); struct htmlPage *editPage = htmlPageFromForm(page,strippedEditForm,"submit", "Submit"); freeMem(fixedString); if (NULL == editPage) errAbort("prefixComments: the edit is failing ?"); freeDyString(&content); } /* void prefixComments() */ void addDescription(struct wikiTrack *item, char *userName, char *seqName, int winStart, int winEnd, struct cart *cart, char *database, char *extraHeader, char *extraTag, char *category) /* add description to the end of an existing wiki item */ { char *newComments = cartNonemptyString(cart, NEW_ITEM_COMMENT); struct dyString *content = newDyString(1024); /* was nothing changed in the add comments entry box ? */ if (sameWord(ADD_ITEM_COMMENT_DEFAULT,newComments)) return; struct htmlPage *page = fetchEditPage(item->descriptionKey); /* create a stripped down edit form, we don't want all the variables */ struct htmlForm *strippedEditForm; AllocVar(strippedEditForm); struct htmlForm *currentEditForm = htmlFormGet(page,"editform"); if (NULL == currentEditForm) errAbort("addDescription: can not get editform ? (wiki login confused ?)"); strippedEditForm->name = cloneString(currentEditForm->name); /* the lower case "post" in the editform does not work ? */ /*strippedEditForm->method = cloneString(currentEditForm->method);*/ strippedEditForm->method = cloneString("POST"); strippedEditForm->startTag = currentEditForm->startTag; strippedEditForm->endTag = currentEditForm->endTag; /* fetch any current page contents in the edit form to continue them */ struct htmlFormVar *wpTextbox1 = htmlPageGetVar(page, currentEditForm, "wpTextbox1"); /* decide on whether adding comments to existing text, or starting a * new article from scratch. * This function could be extended to actually checking the current * contents to see if the "Category:" or "created:" lines have been * removed, and then restore them. */ if (wpTextbox1->curVal && (strlen(wpTextbox1->curVal) > 2)) { char *rawText = fetchWikiRawText(item->descriptionKey); dyStringPrintf(content, "%s\n\n''comments added: ~~~~''", rawText); if (extraTag) dyStringPrintf(content, "&nbsp;'''%s'''\n\n", extraTag); else dyStringPrintf(content, "\n\n"); } else { boolean recreateHeader = FALSE; char position[128]; char *newPos; char *userSignature; /* In the case where this is a restoration of the header lines, * may be a different creator than this user adding comments. * So, get the header line correct to represent the actual creator. */ if (sameWord(userName, item->owner)) userSignature = cloneString("~~~~"); else { struct dyString *tt = newDyString(1024); dyStringPrintf(tt, "[[User:%s|%s]] ", item->owner, item->owner); dyStringPrintf(tt, "%s", item->creationDate); userSignature = dyStringCannibalize(&tt); recreateHeader = TRUE; } safef(position, 128, "%s:%d-%d", seqName, winStart+1, winEnd); newPos = addCommasToPos(database, position); if (extraHeader) { dyStringPrintf(content, "%s\n%s\n", category, extraHeader); } else { dyStringPrintf(content, "%s\n" "[http://%s/cgi-bin/hgTracks?db=%s&wikiTrack=pack&position=%s:%d-%d %s %s]" "&nbsp;&nbsp;<B>'%s'</B>&nbsp;&nbsp;", category, cfgOptionDefault(CFG_WIKI_BROWSER, DEFAULT_BROWSER), database, seqName, winStart+1, winEnd, database, newPos, item->name); } dyStringPrintf(content, "''created: %s''", userSignature); if (extraTag) dyStringPrintf(content, "&nbsp;'''%s'''", extraTag); dyStringPrintf(content, "\n\n"); if (recreateHeader) { dyStringPrintf(content, "''comments added: ~~~~''"); if (extraTag) dyStringPrintf(content, "&nbsp;'''%s'''\n\n", extraTag); else dyStringPrintf(content, "\n\n"); } } if (sameWord(NEW_ITEM_COMMENT_DEFAULT,newComments)) dyStringPrintf(content, "%s\n\n", NO_ITEM_COMMENT_SUPPLIED); else dyStringPrintf(content, "%s\n\n", newComments); htmlCloneFormVarSet(currentEditForm, strippedEditForm, "wpTextbox1", content->string); htmlCloneFormVarSet(currentEditForm, strippedEditForm, "wpSummary", ""); htmlCloneFormVarSet(currentEditForm, strippedEditForm, "wpSection", ""); htmlCloneFormVarSet(currentEditForm, strippedEditForm, "wpMinoredit", "1"); /* htmlCloneFormVarSet(currentEditForm, strippedEditForm, "wpSave", "Save page"); */ htmlCloneFormVarSet(currentEditForm, strippedEditForm, "wpEdittime", NULL); htmlCloneFormVarSet(currentEditForm, strippedEditForm, "wpEditToken", NULL); htmlPageSetVar(page,currentEditForm, "wpTextbox1", content->string); htmlPageSetVar(page,currentEditForm, "wpSummary", ""); htmlPageSetVar(page,currentEditForm, "wpSection", ""); htmlPageSetVar(page,currentEditForm, "wpMinoredit", "1"); htmlPageSetVar(page,currentEditForm, "wpSave", "Save page"); char newUrl[1024]; char *wikiHost = wikiLinkHost(); /* fake out htmlPageFromForm since it doesn't understand the colon : */ safef(newUrl, ArraySize(newUrl), "http://%s%s", wikiHost, currentEditForm->action); freeMem(wikiHost); /* something, somewhere encoded the & into &amp; which does not work */ char *fixedString = replaceChars(newUrl, "&amp;", "&"); currentEditForm->action = cloneString(fixedString); strippedEditForm->action = cloneString(fixedString); struct htmlPage *editPage = htmlPageFromForm(page,strippedEditForm,"submit", "Submit"); freeMem(fixedString); if (NULL == editPage) errAbort("addDescription: the edit is failing ?"); freeDyString(&content); } /* void addDescription() */ char *encodedReturnUrl(char *(*hgUrl)()) /* Return a CGI-encoded URL with hgsid. Free when done. * The given function hgUrl() will construct the actual cgi binary URL */ { char retBuf[1024]; safef(retBuf, sizeof(retBuf), "http://%s/%s", cgiServerName(), (*hgUrl)()); return cgiEncode(retBuf); } boolean emailVerified(boolean showMessage) /* TRUE indicates email has been verified for this wiki user */ { struct htmlPage *page = fetchEditPage(TEST_EMAIL_VERIFIED); char *verifyEmail = stringIn(EMAIL_NEEDS_TO_BE_VERIFIED, page->fullText); /* sometimes the genome browser thinks the user is logged in, but the * wiki doesn't think so. So, verify that an editform exists * within the edit page to confirm edit is OK. */ struct htmlForm *currentEditForm = htmlFormGet(page,"editform"); htmlPageFree(&page); if ((currentEditForm != NULL) && (verifyEmail == NULL)) return TRUE; else { if (showMessage) { hPrintf("<P>%s annotations. %s " "<A HREF=\"%s/index.php/Special:Preferences\" " "TARGET=_blank>user preferences.</A></P>\n", EMAIL_NEEDS_TO_BE_VERIFIED, USER_PREFERENCES_MESSAGE, cfgOptionDefault(CFG_WIKI_URL, NULL)); } return FALSE; } } boolean isWikiEditor(char *userName) /* check if user name is on list of editors */ { boolean editor = FALSE; if (userName) { char *editors = cfgOptionDefault(CFG_WIKI_EDITORS, NULL); if (editors) { char *cloneEditors = cloneString(editors); int i; int wordCount = chopByChar(cloneEditors, ',', NULL, 0); char **words = (char **)needMem((size_t)(wordCount * sizeof(char *))); chopByChar(cloneEditors, ',', words, wordCount); for (i = 0; i < wordCount; ++i) { if (sameWord(userName, words[i])) { editor = TRUE; break; } } freeMem(cloneEditors); } } return editor; } char *wikiUrl(struct wikiTrack *item) /* construct a URL to the wiki page for the specified item free the returned string when done with it. */ { char *siteUrl = cfgOptionDefault(CFG_WIKI_URL, NULL); struct dyString *itemUrl = dyStringNew(64); dyStringPrintf(itemUrl, "%s/index.php/%s TARGET=_blank", siteUrl, item->descriptionKey); return dyStringCannibalize(&itemUrl); }
30.704053
236
0.694079
[ "render" ]
b1882c60dc563a7d69aa75f8d97451cd94e69c34
2,305
h
C
yingying_delphi/Delphicpp_v8.4.2_Linux/src/dplt/ddm/view/MultiView.h
caixiuhong/Develop-MCCE
31df6d22b8aac9a10c1e5c7809913b63ba83d23b
[ "MIT" ]
null
null
null
yingying_delphi/Delphicpp_v8.4.2_Linux/src/dplt/ddm/view/MultiView.h
caixiuhong/Develop-MCCE
31df6d22b8aac9a10c1e5c7809913b63ba83d23b
[ "MIT" ]
36
2019-06-03T20:30:45.000Z
2020-04-17T19:17:26.000Z
yingying_delphi/Delphicpp_v8.4.2_Linux/src/dplt/ddm/view/MultiView.h
caixiuhong/Develop-MCCE
31df6d22b8aac9a10c1e5c7809913b63ba83d23b
[ "MIT" ]
6
2019-06-03T16:56:43.000Z
2020-01-09T03:32:31.000Z
#ifndef DDM__VIEW__MULTI_VIEW_H__INCLUDED #define DDM__VIEW__MULTI_VIEW_H__INCLUDED #include "../../ddm/Types.h" #include "../../ddm/Dimensional.h" #include "../../ddm/Cartesian.h" #include <vector> namespace ddm { /** * Multidimensional view. * * Extends concepts outlined in the TS: * * "Multidimensional bounds, index and array_view" * * OpenSTD document number M3851 * http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n3851.pdf * * For a related implementation in C++14, see: * * - https://github.com/Microsoft/GSL/blob/master/gsl/multi_span * * \par Terminology: * * \b Multidimensional View Properties * * - ndim: number of dimensions in the view's origin domain * - rank: number of view dimensions * - size: total number of elements * - shape: extents ordered by dimension * - offset: base indices ordered by dimension * - bounds: tuples of first and final index in all dimensions d as * (offset(d), offset(d) + shape(d)) * * In each dimension: * * - extent: number of elements in the dimension, consequently same as * the size of its range * - stride: number of elements in a slice of the dimension * * \b Modifying Operations on Multidimensional Views * * - reshape: change extents of rectangular view such that rank and size * are unchanged. * - resize: change size of rectangular view, rank is unchanged * - sub: create sub-view from index range * - section: sub-view with same rank * - slice: sub-view with lower rank * - intersect: intersection of two or more multidimensional rectangular * views; the resulting rectangular view could also be * obtained from a sequence of resize operations * * \b Access Operations on Multidimensional Views * * C-style access: * * slice at offset 2 in first dimension and sub-range [3,5) in * second dimension: * * \code * nview[2][range(3,5)] * // same as: * sub<0>(2, sub<1>(3,5, nview)) * \endcode * * Specifying unchanged dimensions of sub-views: * * \code * nview[2]*[4] * // same as: * sub<0>(2, sub<2>(4. nview)) * \endcode * */ template <dim_t NDim> class MultiView { public: }; } // namespace ddm #endif // DDM__VIEW__MULTI_VIEW_H__INCLUDED
25.32967
74
0.659002
[ "shape", "vector" ]
b1a278aab6a1588ba92ca9c438b49a5626a41004
2,453
h
C
SourceCode/Chapter05/SocialSharingDemo/SocialSharingDemo/Pods/TwitterCore/iOS/TwitterCore.framework/PrivateHeaders/TWTRNetworkingPipelinePackage.h
CoderDream/Intermediate-iOS-12-Projramming-with-Swift
868b80bac32eaeb46365b72a49757a3f1e763f59
[ "MIT" ]
null
null
null
SourceCode/Chapter05/SocialSharingDemo/SocialSharingDemo/Pods/TwitterCore/iOS/TwitterCore.framework/PrivateHeaders/TWTRNetworkingPipelinePackage.h
CoderDream/Intermediate-iOS-12-Projramming-with-Swift
868b80bac32eaeb46365b72a49757a3f1e763f59
[ "MIT" ]
null
null
null
SourceCode/Chapter05/SocialSharingDemo/SocialSharingDemo/Pods/TwitterCore/iOS/TwitterCore.framework/PrivateHeaders/TWTRNetworkingPipelinePackage.h
CoderDream/Intermediate-iOS-12-Projramming-with-Swift
868b80bac32eaeb46365b72a49757a3f1e763f59
[ "MIT" ]
null
null
null
/* * Copyright (C) 2017 Twitter, Inc. * * 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. * */ #import <TwitterCore/TWTRSessionStore.h> #import "TWTRNetworkingPipeline.h" NS_ASSUME_NONNULL_BEGIN @interface TWTRNetworkingPipelinePackage : NSObject <NSCopying> /** * The URL request object that will be executed by this package. */ @property (nonatomic, copy, readonly) NSURLRequest *request; /** * The session store that will be used by the package to provide session information. */ @property (nonatomic, readonly) id<TWTRSessionStore> sessionStore; /** * The userID associated with this package or nil to signify that * the guest session should be used. */ @property (nonatomic, copy, readonly, nullable) NSString *userID; /** The calback block to execute when the request is finished or fails. */ @property (nonatomic, copy, readonly, nullable) TWTRNetworkingPipelineCallback callback; /** A counter to track the attempts (with retries) of the request operation associated with the this package. It can be useful to avoid retrying a request indefinitely (stop after certain threshold). It starts with 1 */ @property (nonatomic, readonly) NSInteger attemptCounter; /** * A UUI associated with this package. */ @property (nonatomic, readonly) NSUUID *UUID; - (instancetype)initWithRequest:(NSURLRequest *)request sessionStore:(id<TWTRSessionStore>)sessionStore userID:(nullable NSString *)userID completion:(nullable TWTRNetworkingPipelineCallback)callback NS_DESIGNATED_INITIALIZER; + (instancetype)packageWithRequest:(NSURLRequest *)request sessionStore:(id<TWTRSessionStore>)sessionStore userID:(nullable NSString *)userID completion:(nullable TWTRNetworkingPipelineCallback)callback; /* Create a copy of current package instance with attemptCounter being added by one. current package object remain unchanged. */ - (instancetype)copyForRetry; - (instancetype)init NS_UNAVAILABLE; @end NS_ASSUME_NONNULL_END
34.549296
226
0.774154
[ "object" ]
b1a2e43229654626c108b1dcc47aab2643bf9e7a
29,293
h
C
src/CbirPicsom.h
aalto-cbir/PicSOM
b8d8d1db070c0134034f9ae90233e2e8d0504c26
[ "Apache-2.0" ]
6
2015-11-11T10:57:45.000Z
2019-06-10T19:02:55.000Z
src/CbirPicsom.h
aalto-cbir/PicSOM
b8d8d1db070c0134034f9ae90233e2e8d0504c26
[ "Apache-2.0" ]
1
2018-03-22T12:58:48.000Z
2018-03-22T12:58:48.000Z
src/CbirPicsom.h
aalto-cbir/PicSOM
b8d8d1db070c0134034f9ae90233e2e8d0504c26
[ "Apache-2.0" ]
null
null
null
// -*- C++ -*- $Id: CbirPicsom.h,v 2.30 2009/12/09 11:55:41 jorma Exp $ // // Copyright 1998-2009 PicSOM Development Group <picsom@cis.hut.fi> // Helsinki University of Technology // P.O.BOX 5400, FI-02015 TKK, FINLAND // #ifndef _CBIRPICSOM_H_ #define _CBIRPICSOM_H_ #include <CbirStageBased.h> using namespace std; namespace picsom { /// static const string CbirPicsom_h_vcid = "@(#)$Id: CbirPicsom.h,v 2.30 2009/12/09 11:55:41 jorma Exp $"; typedef map<pair<string,string>,float> classaugment_t; typedef map<pair<string,string>,float>::iterator classaugment_iter_t; /** An picsom of CBIR algorithm implementation derived from the abstract CbirAlgorithm class. Copy CbirPicsom.h to CbirYourMethod.h and CbirPicsom.C to CbirYourMethod.C and edit them as you wish. */ class CbirPicsom : public CbirStageBased { public: /** */ class QueryData : public CbirStageBased::QueryData { /// friend class CbirPicsom; public: /// poison QueryData() { abort(); } /// QueryData(const CbirAlgorithm *a, const Query *q) : CbirStageBased::QueryData(a, q), seed(123), _sa_limit_per_map_units(0), _sa_limit_total_units(0), _sa_limit_per_map_images(0), _sa_permapnewobjects(0), bordercompensation(true), negative_weight(1.0), matrixcount_xx(1), calculate_entropy_force(false), entropymatrix(-1), limitrelevance(false) {} /// virtual CbirAlgorithm::QueryData *Copy(const Query *q) const { QueryData *copy = new QueryData(*this); copy->SetQuery(q); copy->CopyIndexData(); return copy; } /// Dumps seenobject. void DumpSeen(bool n = false) const { DumpList(seenobject, "SEEN", n); } /// Dumps combinedimage. void DumpCombined() const { DumpList(combinedimage, "COMBINED"); } /// Dumps uniqueimage. void DumpUnique(bool n = false) const { DumpList(uniqueimage,"UNIQUE",n);} /// Dumps newobject. void DumpNew(bool n = false) const { DumpList(newobject, "NEW", n); } /// Dumps permapnewobject. void DumpNew(int m, int l, bool n = false) const { DumpList(PerMapNewObject(m, l), "NEW", n, IndexFullName(m), m, l); } /// Dumps vqunit list void DumpVQUnits(int m, int l, bool n = false) const { if (IsTsSomAndLevelOK(m, l)) DumpList(PerMapVQUnit(m, l), "VQUNITS", n, IndexFullName(m), m, l, MapEvenAlien(m,l).Width()); else cout << "VQUNITS (" << m << "," << l << ") not available" << endl; } /// Shows selected vqunit/image lists. void ShowUnitAndObjectLists(bool = true, bool = true, bool = false, bool = true, bool = true, bool = true, bool = false, bool = true, bool = false) const; /// simple::FloatMatrix& Hits(size_t i, size_t j, size_t k) { return *IndexDataTSSOM(i).GetHits(j, k); } /// const simple::FloatMatrix& Hits(size_t i, size_t j, size_t k) const { return ((CbirPicsom::QueryData*)this)->Hits(i, j, k); } /// simple::FloatMatrix& Convolved(size_t i, size_t j, size_t k) { return *IndexDataTSSOM(i).GetConvolved(j, k); } /// const simple::FloatMatrix& Convolved(size_t i, size_t j, size_t k) const { return ((CbirPicsom::QueryData*)this)->Convolved(i, j, k); } /// const simple::FloatMatrix& Convolved(const string& n, size_t j, size_t k) const { int i = IndexShortNameIndex(n); if (i<0) ShowError("CbirPicsom::QueryData::Convolved() : IndexShortNameIndex("+ n+") failed"); return Convolved(i, j, k); } /// Access to TSSOM::State::vqulist. VQUnitList& PerMapVQUnit(int i, int j) { return IndexDataTSSOM(i).vqulist[j]; } /// const-const version of the one above. const VQUnitList& PerMapVQUnit(int i, int j) const { return ((QueryData*)this)->PerMapVQUnit(i, j); } /// Sets convtype. void ConvType(int m, const string& t) { if (m==-1) _sa_default_convtype = t; else _sa_tssom_convtype[m] = t; } /// Returns convtype. const string& ConvType(int m) const { if (m==-1) return _sa_default_convtype; map<int,string>::const_iterator i = _sa_tssom_convtype.find(m); return i!=_sa_tssom_convtype.end() ? i->second : _sa_default_convtype; } /// Sets weight. void Weight(int m, float v) { // wordInverse(m).BinaryWeight(v); IndexData(m).Weight(v); } /// Returns weight. float Weight(int m) const { // return IsInverseIndex(m)?wordInverse(m).BinaryWeight():1.0; return IndexData(m).Weight(); } /// virtual bool RemoveDuplicates(); /// A simple TSSOM weighting implementation. bool ValueOrNaN(float, bool); /// A simple TSSOM weighting implementation. bool TsSomWeightValue(bool); /// bool TsSomWeightValueAndDistances(bool); /// A simple TSSOM weighting implementation. bool EntropyNpolynomial(const string&); /// A simple TSSOM weighting implementation. bool EntropyNleaveOutWorst(const string&); /// void SetMapWeightsDebugInfo(); /// IntVector& Division(int i, int j, int d = 0) { return TsSom(i).Division(j, d); } /// const IntVector& Division(int i, int j, int d = 0) const { return TsSom(i).Division(j, d); } /// Access to value of matrixcount. void SetMatrixCount(size_t c) { matrixcount_xx = c; } /// Access to value of matrixcount. size_t GetMatrixCount() const { return matrixcount_xx; } /// Access to value of matrixcount. size_t GetMatrixCount(size_t i) const { return IsTsSom(i) ? IndexDataTSSOM(i).MatrixCount() :0; } /// Marks objects from seenobjects to all ts-soms and levels. bool PlaceSeenOnMap(bool norm=true,bool limit=false) { for (size_t m=0; m<Nindices(); m++) for (int l=0; l<Nlevels(m); l++) PlaceSeenOnMap(m, l, norm, limit); return true; } /// Marks objects from seenobjects to map of given ts-som and level. bool PlaceSeenOnMap(int, int, bool=true,bool=false); /// Gives the weighting vector for BMU div levels. const vector<float>& DivMultiplierVector(int, int); /// Gives the weighting vector for BMU div levels. const vector<float>& DivHistoryVector(int, int); /// bool BernoulliMAP(int, int); /// Marks objects from seenobjects to map of given ts-som and level. bool PlaceSeenOnMapOneMap(int, int, bool=true); /// Marks objects from seenobjects to map of given ts-som and level. bool PlaceSeenOnMapThreeMaps(int, int, bool=true,bool=false); /// Marks objects from seenobjects to map of given ts-som and level. bool PlaceSeenOnMapOneMapSmoothedFraction(int, int); /// A helper routine for the three above. bool CountPositivesAndNegatives(const IntVector&, int&, int&, bool, bool=true) const; /// A helper routine for the three above. bool SumPositivesAndNegatives(const IntVector&, const Index::State&, double&, double&, bool) const; /// A helper utlity for the PlaceSeenOnMap*() methods. void SetSizeOrZero(simple::FloatMatrix& hts, const TreeSOM& ts) { hts.SizeOrZero(ts.Height(), ts.Width()); if (!hts.Size()) ShowError("Matrix size set to 0x0"); } /// Returns true if Index::State aspects intersect with Object aspects. bool AspectsMatch(const Index::State&, const Object&, double&, double&) const; /// Returns true if aspects are used. bool UsingAspects() const; /// Returns comma-seprated list of aspects for given feature. string IndexAspects(size_t i) const { list<string> s; for (vector<string>::const_iterator j=IndexData(i).aspects.begin(); j!=IndexData(i).aspects.end(); j++) s.push_back("\""+*j+"\""); return CommaJoin(s); } /// virtual void SetClassAugmentValue(const float value, const string& classname="", const string& mapname="") { if (debug_classify) cout << "Running CbirPicsom::QueryData::SetClassAugmentValue() : " << classname << (mapname.empty()?"":",") << mapname << ") = " << value << endl; classaugment[pair<string,string>(classname,mapname)] = value; } /// Returns a convolution mask vector. const FloatVector *ConvolutionVector(const string&, int); /// Creates a brand new convolution mask vector. static FloatVector *CreateConvolutionVector(const string&, double, double); /// Searches for ConvolutionVector name and pointer. static bool ConvolutionVectorNameAndFunc(const string&, string&, //double (*&)(double,double,double) ConvolutionFunction&); /// Splits and joins ConvolutionVector name parts. static string ConvolutionVectorName(const string&, int, string&, float&, float&); /// Splits ConvolutionVector name parts. static ConvolutionFunction ConvolutionVectorFunc(const string&, int, float&, float&); /// Extracts ConvolutionVector parameters. static string ConvolutionVectorParam(const char*, int, float&, float&); /// Prepares things for convolution mask creation. static bool ConvolutionPrepare(const string&, float&, float&); /// Generates point response value. static double PointVectorValue(double, double, double); /// Generates values for half of a 1D triangle mask. static double TriangleVectorValue(double, double, double); /// Generates values for half of a 1D Gaussian mask. static double GaussianVectorValue(double, double, double); /// Generates values for half of a 1D difference-of-gaussians mask. static double DoGVectorValue(double, double, double); /// Generates values for half of a 1D rectangular mask. static double RectangleVectorValue(double, double, double); /// Generates values for half of a 1D rectangular mask. static double ExponentialVectorValue(double, double, double); /// Generates values for half of a 1D Hann mask. static double HannVectorValue(double, double, double); /// bool Convolve(); /// bool Convolve(int, int, int); /// bool ConvolveOneDimMask(int, int, int, const FloatVector&); /// bool ConvolveNbrRank(const string &,int, int, int) { ShowError("ConvolveNbrRank() not implemented yet"); return false; } /// bool ConvolveRatio(const string &,int, int, int) { ShowError("ConvolveRatio() not implemented yet"); return false; } /// bool ConvolveUmatrix(const string&, int, int, int) { ShowError("ConvolveUmatrix() not implemented yet"); return false; } /// size_t NumberOfScoreValues() const { size_t s = 0; for (size_t i=0; i<Nindices(); i++) s += IndexStaticData(i).NumberOfScoreValues(); return s; } /// int ScoreValueIndex(size_t ii, size_t jj) const { size_t s = 0; for (size_t i=0; i<Nindices(); i++) { size_t j = IndexStaticData(i).NumberOfScoreValues(); if (i==ii) return jj>=j ? -1 : int(s+jj); s += j; } return -1; } /// One argument interface to permapnewobject. ObjectList& PerMapNewObject(int ii) { // this might be slow... size_t i = (size_t)ii; for (size_t m=0; m<Nindices(); m++) if (i<IndexData(m).objlist.size()) return IndexData(m).objlist[i]; else i -= IndexData(m).objlist.size(); static ObjectList empty; return empty; } /// const-const version of the one above. const ObjectList& PerMapNewObject(int i) const { return ((QueryData*)this)->PerMapNewObject(i); } /// ObjectList& PerMapNewObject(int i, int j) { return IndexData(i).objlist[j]; } /// const ObjectList& PerMapNewObject(int i, int j) const { return ((QueryData*)this)->PerMapNewObject(i, j); } /// const IntVector& BackReference(int i, int l, int j) const { if (!IndexIndexOK(i)) { ShowError("CbirPicsom::QueryData::BackReference(i, l, j): i not OK"); const IntVector *emptyptr = NULL; return *emptyptr; } return TsSom(i).BackReference(l, j); } /// void PerMapObjects(int i) { _sa_permapnewobjects = i; } /// int PerMapObjects() const { return _sa_permapnewobjects; } /// Gets file name prefix for score dumps. string ScoreFile() { return scorefile; } /// Sets file name prefix for score dumps. void ScoreFile(const string& n) { scorefile = n; } /// write access to watch set static void Watchset(const IntVector& w) { watchset = w;} /// write access to watch set static void Watchset(const vector<size_t>& w) { watchset.Length(w.size()); for (size_t i = 0; i<w.size(); i++) watchset[i] = w[i]; } /// float ClassWeight(int) const; /// Dumps out hits&convolved matrices in various forms. bool MapSnapshots(int, int, const string& xs=string("")) const; void MapImageName(const string& n) { mapimagename = n; } /// gets the above mentioned prefix const string &MapImageName() const {return mapimagename;} /// Sets hits&convolved matrices dump file name prefix for matlab. void MapMatlabName(const string& n) { mapmatlabname = n; } /// Sets hits&convolved matrices dump file name prefix for dat files. void MapDatName(const string& n) { mapdatname = n; } /// Calling this with true forces enytropy calculations. void CalculateEntropy(bool f) { calculate_entropy_force = f; if (f && GetMatrixCount()==1) { WarnOnce("Setting calculate_entropy_force implies matrixcount=3"); SetMatrixCount(3); } } /// True if forced or set_map_weights stage requires it. bool CalculateEntropy() const { if (calculate_entropy_force) return true; cbir_function f = StageFunction(stage_set_map_weights); return f==func_entropy_n_polynomial || f==func_entropy_n_leave_out_worst; } /// Actual routine to call the different types of entropy. bool DoEntropyCalculation() { size_t kdefault = GetMatrixCount()==3 ? 1 : 0; size_t k = entropymatrix==-1 ? kdefault : entropymatrix; if (k>=GetMatrixCount()) k = kdefault; for (size_t m=0; m<Nindices(); m++) for (int l=0; l<Nlevels(m); l++) if (!DoEntropyCalculation(m, l, k)) return false; return true; } /// Actual routine to call the different types of entropy. bool DoEntropyCalculation(int, int, int); protected: /// int seed; /// Convolution type. string _sa_default_convtype; /// Convolution type. map<int,string> _sa_tssom_convtype; /// New CBIR stage limit for XXX. int _sa_limit_per_map_units; /// New CBIR stage limit for XXX. int _sa_limit_total_units; /// New CBIR stage limit for XXX. int _sa_limit_per_map_images; /// Maximum number of images to be found on each map. int _sa_permapnewobjects; /// Turns off border compensation in ConvolveOneDimMask() /// if false bool bordercompensation; /// float negative_weight; /// classaugment_t classaugment; /// Number of matrices created for each TS-SOM level. 1 or 3 is typical. size_t matrixcount_xx; /// True if one wants to see entropy values besides TS-SOMs on the browser. bool calculate_entropy_force; /// Index of matrix that is used for entropy calculation. -1 is default. int entropymatrix; /// Set of images to be marked positive by ground truth. map<string,pair<string,float> > positive; /// Set of images to be marked negative by ground truth. map<string,pair<string,float> > negative; /// Set to true if zero values after convolutions are not problem. static bool zero_matrices_allowed; /// static hitstype_t hitstype; static bool store_selfinfluence; /// storage for self-influence values of seen images map<int,vector<float> > selfinfluence; /// vector<vector<vector<float> > > location_selfinfluence; /// causes PlaceSeenOnMapPicSOMthreeMaps() to limit the /// relevance values originating from a single map unit bool limitrelevance; /// Combination factor for relevance combination between objects static float comb_factor; /// Combination factor for positive/negative relevance in Hits() /// used only if hitstype==posneg_lc static float hit_comb_factor; /// Name prefix for writing convolved map s. string mapimagename; /// Name prefix for writing convolved map s. string mapmatlabname; /// Name prefix for writing convolved map s. string mapdatname; /// Name prefix for writing score components string scorefile; static IntVector watchset; /// list<pair<ground_truth,float> > classweight; }; // class CbirPicsom::QueryData /// A utility routine for the virtual methods. static CbirPicsom::QueryData *CastData(CbirAlgorithm::QueryData *qd) { CbirPicsom::QueryData *qde = static_cast<CbirPicsom::QueryData*>(qd); if (!qde) { ShowError("CbirPicsom::QueryData pointer conversion failed"); abort(); } return qde; } /// virtual cbir_stage StageInitialSet(CbirStageBased::QueryData*, cbir_function, const string&, size_t) const; /// virtual cbir_stage StageRunPerMap(CbirStageBased::QueryData*, cbir_function, const string&, size_t) const; /// virtual cbir_stage StageSetMapWeights(CbirStageBased::QueryData*, cbir_function, const string&, size_t) const; /// virtual cbir_stage StageCombineUnitLists(CbirStageBased::QueryData*, cbir_function, const string&, size_t) const; /// virtual cbir_stage StageExtractObjects(CbirStageBased::QueryData*, cbir_function, const string&, size_t) const; /// virtual cbir_stage StageRemoveDuplicates(CbirStageBased::QueryData*, cbir_function, const string&, size_t) const; /// virtual cbir_stage StageProcessObjects(CbirStageBased::QueryData*, cbir_function, const string&, size_t) const; /// Common per-map-level iterator. virtual bool ForAllMapLevels(CbirPicsom::QueryData*, bool (CbirPicsom::*foo)(CbirPicsom::QueryData*, const string&,int,int,bool) const, const string&, bool botonly=false) const; /// Gives the number of levels in a map. int Nlevels(CbirPicsom::QueryData *qd, int m) const { return qd->IsTsSom(m) ? qd->Nlevels(m) : 1; } /// Gives the number of levels in a map. int NlevelsEvenAlien(CbirPicsom::QueryData *qd, int m) const { return qd->IsTsSom(m) ? qd->NlevelsEvenAlien(m) : 1; } #if 0 // ifdef QUERY_USE_PTHREADS struct map_level_pthread_data { pthread_t pthread; bool thread_set; Query *query; bool (Query::*f)(const string&,int,int,bool); const string *args; int map; int level; bool botonly; }; /// Common per-map-level iterator. bool ForAllMapLevelsPthread(bool (CbirPicsom::*foo)(const string&,int,int,bool), const string&, bool); /// static void *ForAllMapLevelsPthread(void*); #endif // QUERY_USE_PTHREADS /// Part of PicSOM that is run for each separate map. virtual bool PerMap(CbirPicsom::QueryData*, const string&, int, int, bool) const; /// bool DoClassModelAugmentation(CbirPicsom::QueryData*, int, int, int) const; /// set<string> GetAugmentClasses(CbirPicsom::QueryData*, const string&) const; /// float GetClassAugmentValue(CbirPicsom::QueryData*, const string&, const string&) const; /// void CreateAllClassModels(CbirPicsom::QueryData*) const; /// void PerMapNonBernoulli(CbirPicsom::QueryData*, const string&, int i, int j, bool &ok) const; /// void PerMapSelfInfluence(CbirPicsom::QueryData*, int i, int j) const; /// Returns the set of best vq units from a map level. /// Used by the PicSOM algorithm. VQUnitList BestVQUnits(CbirPicsom::QueryData*, int, int) const; /// Calculate binary features scores. bool SimpleBinaryFeatureScores(int) const { ShowError("SimpleBinaryFeatureScores() not implemented yet"); return false; } /// Returns precalculated scores. bool SimplePreCalculatedScores(int) const { ShowError("SimplePreCalculatedScores() not implemented yet"); return false; } /// Returns SVM scores. bool SimpleSvmScores(int) const { ShowError("SimpleSvmScores() not implemented yet"); return false; } /// Part of PicSOM that is run after best units have been found. virtual bool ForUnits(CbirPicsom::QueryData*, const string&, int, int, bool) const; /// Selects the candidate images based on binary classes/features /// in the ForUnitsPicSOM() stage. ObjectList SelectObjectsByBinaryFeatureScores(int, int, int) const { ShowError("SelectObjectsByBinaryFeatureScores() not implemented yet"); static ObjectList empty; return empty; } /// Selects the candidate images based on precalculated scores /// in the ForUnitsPicSOM() stage. ObjectList SelectObjectsByPreCalculatedScores(int, int, int) const { ShowError("SelectObjectsByPreCalculatedScores() not implemented yet"); static ObjectList empty; return empty; } /// Selects the candidate images based on SVM scores /// in the ForUnitsPicSOM() stage. ObjectList SelectObjectsBySvmScores(int, int, int) const { ShowError("SelectObjectsBySvmScores() not implemented yet"); static ObjectList empty; return empty; } /// Returns the set of potential new question images from a map level. /// Used by the PicSOM algorithm. ObjectList SelectObjectsFromVQUnits(CbirPicsom::QueryData*, double, const VQUnitList&, const TreeSOM&, bool, int, int) const; /// was Query::ProcessObjectsPicSOMBottom() virtual bool ProcessObjects(CbirPicsom::QueryData*, const string&) const; /// Calculates the binary feature score of image idx. double BinaryFeatureScoreForObject(int /*map*/, int /*idx*/) const { ShowError("BinaryFeatureScoreForObject() not implemented yet"); return -1.0; } /// Returns a precalculated score of image idx. double PreCalcultedScoreForObject(int /*map*/, int /*idx*/) const { ShowError("PreCalcultedScoreForObject() not implemented yet"); return -1.0; } class scorefile_pointers { public: scorefile_pointers() { fp = fp_comp = fp_posneg = NULL; } bool close() { if (fp) fclose(fp); if (fp_comp) fclose(fp_comp); if (fp_posneg) fclose(fp_posneg); return true; } FILE *fp; FILE *fp_comp; FILE *fp_posneg; }; bool OpenScoreFiles(CbirPicsom::QueryData*, scorefile_pointers &fp) const; bool WriteScoreFiles(const scorefile_pointers &fp,const string &lbl, int idx, float val, const vector<float> &cvals, const vector<float> &posnegvals) const; /// class picsom_bottom_score_options_t { public: picsom_bottom_score_options_t(){ mul=add=zero=rho=ratioscore=smoothed_fraction=relevancemodulation = maxofsubs=geomsumsubs=sublinearrank=storesubscores=posonly= no_propagation=filedump_ttypecheck=equalise_subobject_count=false; } picsom_bottom_score_options_t(bool){ picsom_bottom_score_options_t(); } bool mul; bool add; bool zero; bool rho; bool ratioscore; bool smoothed_fraction; bool relevancemodulation; bool maxofsubs; bool geomsumsubs; bool sublinearrank; bool storesubscores; bool posonly; bool no_propagation; bool filedump_ttypecheck; bool equalise_subobject_count; }; /// picsom_bottom_score_options_t ParseBottomOptions(CbirPicsom::QueryData*, const string &arg) const; /// parses comma-separated argument list to a vector of key-value pairs static list<pair<string,string> > SplitArgs(const string &arg); /// actual score calculating function for the above stage fcn float PicSOMBottomScore(CbirPicsom::QueryData*, int ,const picsom_bottom_score_options_t &, FloatVector *,Object *img=NULL, vector<float> *cvals=NULL, vector<float> *posnegvals=NULL) const; double DetermineCountBias() const { // determine the histogram count bias based on the // concolution kernel // bias = 0.5*sum _{kernel} / |support_kernel|; // currently a placeholder that always returns the value // for a triangle-8 convolution mask: // bias = [(K*K+3K+1)/((K+1)(2K+1))]^2 | K=8 return 0.5*7921.0/23409.0; } double *MLEstimateMapWeights(const vector<vector<float> >& /*scores*/, size_t /*negatives*/) const { ShowError("MLEstimateMapWeights() not implemented yet"); return NULL; } void ml_calculate_h(const vector<vector<float> > &scores, const double *theta, double *tgt) const; float ml_calculate_h(const vector<float> &score, const double *theta) const; /// bool PropagateBySegmentHierarchy() const { ShowError("PropagateBySegmentHierarchy() not implemented yet"); return false; } /// Calculates the theoretical maximum entropy for given matrix size. static double MaximumEntropy(const simple::FloatMatrix&); /// Calculates the theoretical entropy increase due to the convolution; static double ConvolutionEntropy(const FloatVector*); /** */ class IndexData : public CbirStageBased::IndexData { }; // classCbirPicsom::IndexData /// Poisoned constructor. CbirPicsom() : CbirStageBased() {} /// This does not need to do anything else but call the base class /// constructor. If the class has any non-trivial data members /// then they might be initialized here. CbirPicsom(DataBase*, const string&); /// This constructor just creates the "factory" instance of the class. CbirPicsom(bool) : CbirStageBased(false) {} /// Does not need to be defined. virtual ~CbirPicsom() {} /// This method creates the true usable instance. virtual CbirAlgorithm *Create(DataBase *db, const string& s) const { return new CbirPicsom(db, s); } /// This method creates the query-specific data structures. virtual CbirAlgorithm::QueryData *CreateQueryData(const CbirAlgorithm *a, const Query *q) const { return new QueryData(a, q); } /// Name of the algorithm. Needs to be defined. virtual string BaseName() const { return "picsomx"; } /// A bit longer name. Needs to be defined. virtual string LongName() const { return "picsom algorithm"; } /// Short description of the algorithm. Needs to be defined. virtual string Description() const { return "This is a picsom algorithm."; } /// Query-independent specifiers are appended to BaseName(). virtual string FullName() const { return BaseName()+(bottom?"_bottom":"")+(weighted?"_weighted":""); } /// Virtual method that returns a list of parameter specifications. virtual const list<parameter>& Parameters() const; /// Initialization with query instance and arguments from /// algorithm=picsom(arguments) . Does not need to be defined. virtual bool Initialize(const Query*, const string&, CbirAlgorithm::QueryData*&) const; /// Something can be done when features have been specified. Does /// not need to be defined. virtual bool AddIndex(CbirAlgorithm::QueryData*, Index::State*) const; /// Does not need to be defined if the algorithm does not have any /// tunable parameters of its own. virtual bool Interpret(CbirAlgorithm::QueryData *qd, const string& key, const string& value, int& res) const; /// This method implements the actual CBIR algorithm. Needs to be /// defined. virtual ObjectList CbirRound(CbirAlgorithm::QueryData*, const ObjectList&, size_t) const; /// virtual cbir_function StageDefault(cbir_stage stage, bool warn) const; /// Selects initial images among images on top levels. bool TopLevelsByEntropy() const { return false; } protected: /// bool bottom; /// bool weighted; }; // class CbirPicsom } // namespace picsom #endif // _CBIRPICSOM_H_
31.329412
87
0.642406
[ "object", "vector" ]
b1a8846e8275a36cfc950658dba3930cb1e75cdd
2,461
h
C
src/media/audio/drivers/test/test_base.h
dahlia-os/fuchsia-pine64-pinephone
57aace6f0b0bd75306426c98ab9eb3ff4524a61d
[ "BSD-3-Clause" ]
14
2020-10-25T05:48:36.000Z
2021-09-20T02:46:20.000Z
src/media/audio/drivers/test/test_base.h
JokeZhang/fuchsia
d6e9dea8dca7a1c8fa89d03e131367e284b30d23
[ "BSD-3-Clause" ]
1
2022-01-14T23:38:40.000Z
2022-01-14T23:38:40.000Z
src/media/audio/drivers/test/test_base.h
JokeZhang/fuchsia
d6e9dea8dca7a1c8fa89d03e131367e284b30d23
[ "BSD-3-Clause" ]
4
2020-12-28T17:04:45.000Z
2022-03-12T03:20:44.000Z
// Copyright 2020 The Fuchsia Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef SRC_MEDIA_AUDIO_DRIVERS_TEST_TEST_BASE_H_ #define SRC_MEDIA_AUDIO_DRIVERS_TEST_TEST_BASE_H_ #include <fuchsia/hardware/audio/cpp/fidl.h> #include <fuchsia/media/cpp/fidl.h> #include <zircon/device/audio.h> #include "src/lib/fsl/io/device_watcher.h" #include "src/media/audio/lib/test/message_transceiver.h" #include "src/media/audio/lib/test/test_fixture.h" namespace media::audio::drivers::test { enum DeviceType : uint16_t { Input = 0, Output = 1 }; class TestBase : public media::audio::test::TestFixture, public testing::WithParamInterface<DeviceType> { public: static bool test_admin_functions_; static void SetUpTestSuite(); static std::string DeviceTypeToString(const testing::TestParamInfo<TestBase::ParamType>& info); protected: void SetUp() override; void TearDown() override; void EnumerateDevices(); void AddDevice(int dir_fd, const std::string& name); void set_device_type(DeviceType device_type) { device_type_ = device_type; } DeviceType device_type() const { return device_type_; } bool no_devices_found() const { return no_devices_found_[device_type()]; } // "Basic" (stream-config channel) tests and "Admin" (ring-buffer channel) tests both need to know // the supported formats, so this is implemented in the shared base class. void RequestFormats(); void HandleGetFormatsResponse(const audio_stream_cmd_get_formats_resp_t& response); bool received_get_formats() const { return received_get_formats_; } const std::vector<fuchsia::hardware::audio::PcmSupportedFormats>& pcm_formats() const { return pcm_formats_; } const fidl::InterfacePtr<fuchsia::hardware::audio::StreamConfig>& stream_config() { return stream_config_; } private: // for DeviceType::Input and DeviceType::Output static bool no_devices_found_[2]; DeviceType device_type_; std::vector<std::unique_ptr<fsl::DeviceWatcher>> watchers_; bool stream_config_ready_ = false; fidl::InterfacePtr<fuchsia::hardware::audio::StreamConfig> stream_config_; std::vector<zx::unowned_channel> stream_channels_; std::vector<fuchsia::hardware::audio::PcmSupportedFormats> pcm_formats_; bool received_get_formats_ = false; }; } // namespace media::audio::drivers::test #endif // SRC_MEDIA_AUDIO_DRIVERS_TEST_TEST_BASE_H_
35.666667
100
0.764323
[ "vector" ]
b1abc3069d755d745e8c0756d871a5968e197fc0
887
h
C
vital/applets/config_explorer.h
willdunklin/kwiver
7642af7cc9c8727f85b322331164569665bae224
[ "BSD-3-Clause" ]
null
null
null
vital/applets/config_explorer.h
willdunklin/kwiver
7642af7cc9c8727f85b322331164569665bae224
[ "BSD-3-Clause" ]
null
null
null
vital/applets/config_explorer.h
willdunklin/kwiver
7642af7cc9c8727f85b322331164569665bae224
[ "BSD-3-Clause" ]
null
null
null
// This file is part of KWIVER, and is distributed under the // OSI-approved BSD 3-Clause License. See top-level LICENSE file or // https://github.com/Kitware/kwiver/blob/master/LICENSE for details. #ifndef KWIVER_TOOL_CONFIG_EXPLORER_H #define KWIVER_TOOL_CONFIG_EXPLORER_H #include <vital/applets/kwiver_applet.h> #include <string> #include <vector> namespace kwiver { namespace tools { class config_explorer : public kwiver_applet { public: config_explorer(); PLUGIN_INFO( "explore-config", "Explore configuration loading process.\n\n" "This program assists in debugging config loading problems. It loads a " "configuration and displays the contents or displays the search path."); int run() override; void add_command_options() override; }; // end of class } } // end namespace #endif // KWIVER_TOOL_CONFIG_EXPLORER_H
25.342857
87
0.729425
[ "vector" ]
b1aea22e7e9cd2287d684668274167bc0400b1fa
2,984
h
C
src/http_server.h
trungams/http-server
4e12bed96fc3e510fbcb751d1ae4848c57a296ae
[ "MIT" ]
6
2020-08-20T06:59:04.000Z
2022-03-29T01:32:18.000Z
src/http_server.h
trungams/http-server
4e12bed96fc3e510fbcb751d1ae4848c57a296ae
[ "MIT" ]
null
null
null
src/http_server.h
trungams/http-server
4e12bed96fc3e510fbcb751d1ae4848c57a296ae
[ "MIT" ]
1
2022-03-28T23:42:15.000Z
2022-03-28T23:42:15.000Z
// Defines the HTTP server object with some constants and structs // useful for request handling and improving performance #ifndef HTTP_SERVER_H_ #define HTTP_SERVER_H_ #include <sys/epoll.h> #include <sys/types.h> #include <sys/socket.h> #include <chrono> #include <functional> #include <map> #include <string> #include <thread> #include <utility> #include "http_message.h" #include "uri.h" namespace simple_http_server { // Maximum size of an HTTP message is limited by how much bytes // we can read or send via socket each time constexpr size_t kMaxBufferSize = 4096; struct EventData { EventData() : fd(0), length(0), cursor(0), buffer() {} int fd; size_t length; size_t cursor; char buffer[kMaxBufferSize]; }; // A request handler should expect a request as argument and returns a response using HttpRequestHandler_t = std::function<HttpResponse(const HttpRequest&)>; // The server consists of: // - 1 main thread // - 1 listener thread that is responsible for accepting new connections // - Possibly many threads that process HTTP messages and communicate with clients via socket. // The number of workers is defined by a constant class HttpServer { public: explicit HttpServer(const std::string& host, std::uint16_t port); ~HttpServer() = default; HttpServer() = default; HttpServer(HttpServer&&) = default; HttpServer& operator=(HttpServer&&) = default; void Start(); void Stop(); void RegisterHttpRequestHandler(const std::string& path, HttpMethod method, const HttpRequestHandler_t callback) { Uri uri(path); request_handlers_[uri].insert(std::make_pair(method, std::move(callback))); } void RegisterHttpRequestHandler(const Uri& uri, HttpMethod method, const HttpRequestHandler_t callback) { request_handlers_[uri].insert(std::make_pair(method, std::move(callback))); } std::string host() const { return host_; } std::uint16_t port() const { return port_; } bool running() const { return running_; } private: static constexpr int kBacklogSize = 1000; static constexpr int kMaxConnections = 10000; static constexpr int kMaxEvents = 10000; static constexpr int kThreadPoolSize = 5; std::string host_; std::uint16_t port_; int sock_fd_; bool running_; std::thread listener_thread_; std::thread worker_threads_[kThreadPoolSize]; int worker_epoll_fd_[kThreadPoolSize]; epoll_event worker_events_[kThreadPoolSize][kMaxEvents]; std::map<Uri, std::map<HttpMethod, HttpRequestHandler_t>> request_handlers_; void CreateSocket(); void SetUpEpoll(); void Listen(); void ProcessEvents(int worker_id); void HandleEpollEvent(int epoll_fd, EventData *event, std::uint32_t events); void HandleHttpData(const EventData& request, EventData *response); HttpResponse HandleHttpRequest(const HttpRequest& request); void control_epoll_event(int epoll_fd, int op, int fd, std::uint32_t events = 0, void *data = nullptr); }; } // namespace simple_http_server #endif // HTTP_SERVER_H_
30.762887
116
0.747989
[ "object" ]
b1afce94e9d86c9110bf8bcef2c264a5aa1f0a9f
3,317
h
C
src/python/include/Tangential_complex_interface.h
m0baxter/gudhi-devel
6e14ef1f31e09f3875316440303450ff870d9881
[ "MIT" ]
146
2019-03-15T14:10:31.000Z
2022-03-23T21:14:52.000Z
src/python/include/Tangential_complex_interface.h
m0baxter/gudhi-devel
6e14ef1f31e09f3875316440303450ff870d9881
[ "MIT" ]
398
2019-03-07T14:55:22.000Z
2022-03-31T14:50:40.000Z
src/python/include/Tangential_complex_interface.h
m0baxter/gudhi-devel
6e14ef1f31e09f3875316440303450ff870d9881
[ "MIT" ]
51
2019-03-08T15:58:48.000Z
2022-03-14T10:23:23.000Z
/* This file is part of the Gudhi Library - https://gudhi.inria.fr/ - which is released under MIT. * See file LICENSE or go to https://gudhi.inria.fr/licensing/ for full license details. * Author(s): Vincent Rouvreau * * Copyright (C) 2016 Inria * * Modification(s): * - YYYY/MM Author: Description of the modification */ #ifndef INCLUDE_TANGENTIAL_COMPLEX_INTERFACE_H_ #define INCLUDE_TANGENTIAL_COMPLEX_INTERFACE_H_ #include <gudhi/Simplex_tree.h> #include <gudhi/Tangential_complex.h> #include <gudhi/Points_off_io.h> #include <CGAL/Epick_d.h> #include "Simplex_tree_interface.h" #include <vector> #include <utility> // std::pair #include <iostream> #include <string> namespace Gudhi { namespace tangential_complex { class Tangential_complex_interface { using Dynamic_kernel = CGAL::Epick_d< CGAL::Dynamic_dimension_tag >; using Point_d = Dynamic_kernel::Point_d; using TC = Tangential_complex<Dynamic_kernel, CGAL::Dynamic_dimension_tag, CGAL::Parallel_tag>; public: Tangential_complex_interface(int intrisic_dim, const std::vector<std::vector<double>>& points) { Dynamic_kernel k; tangential_complex_ = new TC(points, intrisic_dim, k); } Tangential_complex_interface(int intrisic_dim, const std::string& off_file_name, bool from_file = true) { Dynamic_kernel k; Gudhi::Points_off_reader<Point_d> off_reader(off_file_name); std::vector<Point_d> points = off_reader.get_point_cloud(); tangential_complex_ = new TC(points, intrisic_dim, k); } ~Tangential_complex_interface() { delete tangential_complex_; } void compute_tangential_complex() { tangential_complex_->compute_tangential_complex(); num_inconsistencies_ = tangential_complex_->number_of_inconsistent_simplices(); } std::vector<double> get_point(unsigned vh) { std::vector<double> vd; if (vh < tangential_complex_->number_of_vertices()) { Point_d ph = tangential_complex_->get_point(vh); for (auto coord = ph.cartesian_begin(); coord < ph.cartesian_end(); coord++) vd.push_back(*coord); } return vd; } unsigned number_of_vertices() { return tangential_complex_->number_of_vertices(); } unsigned number_of_simplices() { return num_inconsistencies_.num_simplices; } unsigned number_of_inconsistent_simplices() { return num_inconsistencies_.num_inconsistent_simplices; } unsigned number_of_inconsistent_stars() { return num_inconsistencies_.num_inconsistent_stars; } void fix_inconsistencies_using_perturbation(double max_perturb, double time_limit) { tangential_complex_->fix_inconsistencies_using_perturbation(max_perturb, time_limit); num_inconsistencies_ = tangential_complex_->number_of_inconsistent_simplices(); } void create_simplex_tree(Simplex_tree<>* simplex_tree) { tangential_complex_->create_complex<Gudhi::Simplex_tree<Gudhi::Simplex_tree_options_full_featured>>(*simplex_tree); } void set_max_squared_edge_length(double max_squared_edge_length) { tangential_complex_->set_max_squared_edge_length(max_squared_edge_length); } private: TC* tangential_complex_; TC::Num_inconsistencies num_inconsistencies_; }; } // namespace tangential_complex } // namespace Gudhi #endif // INCLUDE_TANGENTIAL_COMPLEX_INTERFACE_H_
30.431193
119
0.758818
[ "vector" ]
b1b015b7f5e650b60ff05b51bcbed0554abc7da0
4,625
h
C
src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.h
Zone-Emu/ZoneEmuCataclysm
6277efff6cb5adfe8b7a718bf376e81609fa9a6c
[ "OpenSSL" ]
1
2019-03-23T19:32:57.000Z
2019-03-23T19:32:57.000Z
src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.h
Zone-Emu/ZoneEmuCataclysm
6277efff6cb5adfe8b7a718bf376e81609fa9a6c
[ "OpenSSL" ]
null
null
null
src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.h
Zone-Emu/ZoneEmuCataclysm
6277efff6cb5adfe8b7a718bf376e81609fa9a6c
[ "OpenSSL" ]
null
null
null
/* * Copyright (C) 2005 - 2012 MaNGOS <http://www.getmangos.com/> * * Copyright (C) 2008 - 2012 Trinity <http://www.trinitycore.org/> * * Copyright (C) 2010 - 2012 ProjectSkyfire <http://www.projectskyfire.org/> * * Copyright (C) 2011 - 2012 ArkCORE <http://www.arkania.net/> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef ARKCORE_WAYPOINTMOVEMENTGENERATOR_H #define ARKCORE_WAYPOINTMOVEMENTGENERATOR_H /** @page PathMovementGenerator is used to generate movements * of waypoints and flight paths. Each serves the purpose * of generate activities so that it generates updated * packets for the players. */ #include "MovementGenerator.h" #include "DestinationHolder.h" #include "WaypointManager.h" #include "Path.h" #include "Traveller.h" #include "Player.h" #include <vector> #include <set> #define FLIGHT_TRAVEL_UPDATE 100 #define STOP_TIME_FOR_PLAYER 3 * MINUTE * IN_MILLISECONDS // 3 Minutes #define TIMEDIFF_NEXT_WP 250 template<class T, class P> class PathMovementBase { public: PathMovementBase() : i_currentNode(0) { } virtual ~PathMovementBase() { } ; bool MovementInProgress(void) const { return i_currentNode < i_path->size(); } void LoadPath(T &); void ReloadPath(T &); uint32 GetCurrentNode() const { return i_currentNode; } bool GetDestination(float& x, float& y, float& z) const { i_destinationHolder.GetDestination(x, y, z); return true; } bool GetPosition(float& x, float& y, float& z) const { i_destinationHolder.GetLocationNowNoMicroMovement(x, y, z); return true; } protected: uint32 i_currentNode; DestinationHolder<Traveller<T> > i_destinationHolder; P i_path; }; template<class T> class WaypointMovementGenerator: public MovementGeneratorMedium<T, WaypointMovementGenerator<T> > , public PathMovementBase<T, WaypointPath const*> { public: WaypointMovementGenerator(uint32 _path_id = 0, bool _repeating = true) : node(NULL), path_id(_path_id), i_nextMoveTime(0), repeating( _repeating), StopedByPlayer(false) { } void Initialize(T &); void Finalize(T &); void MovementInform(T &); void InitTraveller(T &, const WaypointData &); void GeneratePathId(T &); void Reset(T &unit); bool Update(T &, const uint32 &); bool GetDestination(float &x, float &y, float &z) const; MovementGeneratorType GetMovementGeneratorType() { return WAYPOINT_MOTION_TYPE; } private: WaypointData *node; uint32 path_id; TimeTrackerSmall i_nextMoveTime; WaypointPath const* waypoints; bool repeating, StopedByPlayer; }; /** FlightPathMovementGenerator generates movement of the player for the paths * and hence generates ground and activities for the player. */ class FlightPathMovementGenerator: public MovementGeneratorMedium<Player, FlightPathMovementGenerator> , public PathMovementBase<Player, TaxiPathNodeList const*> { public: explicit FlightPathMovementGenerator(TaxiPathNodeList const& pathnodes, uint32 startNode = 0) { i_path = &pathnodes; i_currentNode = startNode; } void Initialize(Player &); void Reset(Player & /*u*/) { } ; void Finalize(Player &); bool Update(Player &, const uint32 &); MovementGeneratorType GetMovementGeneratorType() { return FLIGHT_MOTION_TYPE; } TaxiPathNodeList const& GetPath() { return *i_path; } uint32 GetPathAtMapEnd() const; bool HasArrived() const { return (i_currentNode >= i_path->size()); } void SetCurrentNodeAfterTeleport(); void SkipCurrentNode() { ++i_currentNode; } void DoEventIfAny(Player& player, TaxiPathNodeEntry const& node, bool departure); bool GetDestination(float& x, float& y, float& z) const { return PathMovementBase<Player, TaxiPathNodeList const*>::GetDestination( x, y, z); } void PreloadEndGrid(); void InitEndGridInfo(); private: // storage for preloading the flightmaster grid at end // before reaching final waypoint uint32 m_endMapId; uint32 m_preloadTargetNode; float m_endGridX; float m_endGridY; }; #endif
27.694611
81
0.742703
[ "vector" ]
b1b08786117e59f7bd2b4e332f1699f18cbd1e6a
4,754
h
C
Editor/VEX/XTools/fbxtoogre/Inc/vertex.h
devxkh/FrankE
72faca02759b54aaec842831f3c7a051e7cf5335
[ "MIT" ]
11
2017-01-17T15:02:25.000Z
2020-11-27T16:54:42.000Z
Editor/VEX/XTools/fbxtoogre/Inc/vertex.h
devxkh/FrankE
72faca02759b54aaec842831f3c7a051e7cf5335
[ "MIT" ]
9
2016-10-23T20:15:38.000Z
2018-02-06T11:23:17.000Z
Editor/VEX/XTools/fbxtoogre/Inc/vertex.h
devxkh/FrankE
72faca02759b54aaec842831f3c7a051e7cf5335
[ "MIT" ]
2
2019-08-29T10:23:51.000Z
2020-04-03T06:08:34.000Z
//////////////////////////////////////////////////////////////////////////////// // vertex.h // Author : Francesco Giordana // Start Date : January 13, 2005 // Copyright : (C) 2006 by Francesco Giordana // Email : fra.giordana@tiscali.it //////////////////////////////////////////////////////////////////////////////// // Port to 3D Studio Max - Modified original version // Author : Doug Perkowski - OC3 Entertainment, Inc. // Start Date : December 10th, 2007 //////////////////////////////////////////////////////////////////////////////// // Port to FBX - Modified original version // Author : Doug Perkowski - OC3 Entertainment, Inc. // Start Date : January 8th, 2012 //////////////////////////////////////////////////////////////////////////////// /********************************************************************************* * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU Lesser General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * **********************************************************************************/ #ifndef _VERTEX_H #define _VERTEX_H /***** structure for uvsets info *****/ typedef struct uvsettag { short size; //number of coordinates (between 1 and 3) } uvset; /***** structure for texture coordinates *****/ typedef struct texcoordstag { float u, v, w; //texture coordinates } texcoord; /***** structure for vertex bone assignements *****/ typedef struct vbatag { float weight; //weight int jointIdx; //index of associated joint } vba; /* typedef struct Point3tag { double x, y, z; } Point3; */ class Point3 { public: //constructor Point3(){x=0;y=0;z=0;} Point3(double xi, double yi, double zi){x=xi;y=yi;z=zi;} ~Point3(){} double x, y, z; void Normalize(){ double l = sqrt(x*x + y*y + z*z); x= x/l; y= y/l; z= z/l; } }; class BoundingBox { public: BoundingBox(){min = Point3(); max = Point3(); bIsFirst = true;} void merge(const Point3& p) { if( bIsFirst ) { min = p; max = p; bIsFirst = false; } else { min.x = std::min(p.x, min.x); min.y = std::min(p.y, min.y); min.z = std::min(p.z, min.z); max.x = std::max(p.x, max.x); max.y = std::max(p.y, max.y); max.z = std::max(p.z, max.z); } } void clear() { bIsFirst = true; } bool isEmpty() { return getBiggestAxis() < PRECISION; } double getBiggestAxis() { double maxAxis = std::max(max.x - min.x, max.y - min.y); return std::max(maxAxis, max.z - min.z); } Point3 min,max; private: bool bIsFirst; }; /***** structure for vertex data *****/ typedef struct vertextag { double x, y, z; //vertex coordinates Point3 n; //vertex normal (Doug Perkowski - 11/16/2007 - modified to replace Maya-specific MVector) float r,g,b,a; //vertex colour std::vector<texcoord> texcoords; //vertex texture coordinates std::vector<vba> vbas; //vertex bone assignements long index; //vertex index in the maya mesh to which this vertex refers } vertex; /***** structure for vertex info *****/ // used to hold indices to access MFnMesh data typedef struct vertexInfotag { int pointIdx; //index to points list (position) int normalIdx; //index to normals list float r,g,b,a; //colour std::vector<float> u; //u texture coordinates std::vector<float> v; //v texture coordinates std::vector<float> vba; //vertex bone assignements std::vector<int> jointIds; //ids of joints affecting this vertex int next; //index of next vertex with same position } vertexInfo; /***** structure for face info *****/ typedef struct facetag { long v[3]; //vertex indices } face; /***** array of face infos *****/ typedef std::vector<face> faceArray; #endif
33.478873
113
0.458141
[ "mesh", "vector", "3d" ]
b1b4eb3c46c4dac28e820f86b71ab2df59694003
3,145
h
C
olp-cpp-sdk-dataservice-write/include/olp/dataservice/write/model/StartBatchRequest.h
forslund/here-data-sdk-cpp
6226950ef2543281e027b2a458fcff0c71e2f0b2
[ "Apache-2.0" ]
15
2020-07-29T07:19:08.000Z
2022-01-14T09:48:36.000Z
olp-cpp-sdk-dataservice-write/include/olp/dataservice/write/model/StartBatchRequest.h
forslund/here-data-sdk-cpp
6226950ef2543281e027b2a458fcff0c71e2f0b2
[ "Apache-2.0" ]
444
2020-05-14T15:13:23.000Z
2022-03-30T15:53:18.000Z
olp-cpp-sdk-dataservice-write/include/olp/dataservice/write/model/StartBatchRequest.h
forslund/here-data-sdk-cpp
6226950ef2543281e027b2a458fcff0c71e2f0b2
[ "Apache-2.0" ]
21
2020-05-14T15:32:28.000Z
2022-03-15T13:52:33.000Z
/* * Copyright (C) 2019-2021 HERE Europe B.V. * * 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. * * SPDX-License-Identifier: Apache-2.0 * License-Filename: LICENSE */ #pragma once #include <string> #include <utility> #include <vector> #include <boost/optional.hpp> #include <olp/dataservice/write/DataServiceWriteApi.h> #include <olp/dataservice/write/generated/model/VersionDependency.h> namespace olp { namespace dataservice { namespace write { namespace model { /** * @brief StartBatchRequest is use to start a versioned batch operation. */ class DATASERVICE_WRITE_API StartBatchRequest { public: StartBatchRequest() = default; /** * @brief set the layers used in this batch operation * @param layers layer id's to be used * @return reference to this object */ inline StartBatchRequest& WithLayers(std::vector<std::string> layers) { layers_ = std::move(layers); return *this; } /** * @brief get the layers used in this batch operation * @return collection of layers in boost::optional */ inline const boost::optional<std::vector<std::string>>& GetLayers() const { return layers_; } /** * @brief set the version dependencies used in this batch operation * @param versionDependencies collection of VersionDependencies * @return reference to this object */ inline StartBatchRequest& WithVersionDependencies( std::vector<VersionDependency> versionDependencies) { versionDependencies_ = std::move(versionDependencies); return *this; } /** * @brief gets the VersionDependencies of this batch operation * @return boost::optional holding the collection of VersionDependencies */ inline const boost::optional<std::vector<VersionDependency>>& GetVersionDependencies() const { return versionDependencies_; } /** * @return Billing Tag previously set. */ inline const boost::optional<std::string>& GetBillingTag() const { return billing_tag_; } /** * @param billing_tag An optional free-form tag which is used for grouping * billing records together. If supplied, it must be between 4 - 16 * characters, contain only alpha/numeric ASCII characters [A-Za-z0-9]. * @note Optional. */ inline StartBatchRequest& WithBillingTag(std::string billing_tag) { billing_tag_ = std::move(billing_tag); return *this; } private: boost::optional<std::vector<std::string>> layers_; boost::optional<std::vector<VersionDependency>> versionDependencies_; boost::optional<std::string> billing_tag_; }; } // namespace model } // namespace write } // namespace dataservice } // namespace olp
28.853211
77
0.718919
[ "object", "vector", "model" ]
b1bb48e91c9e0fc55791fca9b7c672dc6e3a0758
10,472
h
C
ZEGL/include/fontstash/gl3fontstash.h
Zammalad/ZEGL
4887babc94ec20cfe782637c303008f6958ca4dc
[ "Apache-2.0" ]
null
null
null
ZEGL/include/fontstash/gl3fontstash.h
Zammalad/ZEGL
4887babc94ec20cfe782637c303008f6958ca4dc
[ "Apache-2.0" ]
null
null
null
ZEGL/include/fontstash/gl3fontstash.h
Zammalad/ZEGL
4887babc94ec20cfe782637c303008f6958ca4dc
[ "Apache-2.0" ]
null
null
null
// // Copyright (c) 2009-2013 Mikko Mononen memon@inside.org // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would be // appreciated but is not required. // 2. Altered source versions must be plainly marked as such, and must not be // misrepresented as being the original software. // 3. This notice may not be removed or altered from any source distribution. // // Using VAO and VBO for OpenGL 3+ compatibility if GLFONTSTASH_IMPLEMENTATION is defined // glfonsProjection() must be called to set a projection matrix as GL_PROJECTION is deprecated in OGL 3. // // gl3fonsProjection() has been changed to take additional params for screen width and height to // calculate a top left projection matrix #ifndef GLFONTSTASH_H #define GLFONTSTASH_H FONScontext* gl3fonsCreate(int width, int height, int flags); void gl3fonsDelete(FONScontext* ctx); void gl3fonsProjection(FONScontext* ctx, GLfloat *mat, int screenWidth, int screenHeight); unsigned int gl3fonsRGBA(unsigned char r, unsigned char g, unsigned char b, unsigned char a); #endif #ifdef GLFONTSTASH_IMPLEMENTATION struct GLFONScontext { GLuint tex; GLuint vao; // Vertex Array Object GLuint vbo; // Vertex Buffer Object GLuint shader; // Shader program GLfloat projMat[16]; // Projection matrix GLuint texture_uniform; // Uniform for texture sampler GLuint projMat_uniform; // Uniform for projection matrix int width, height; }; typedef struct GLFONScontext GLFONScontext; char vertexShaderText[] = "#version 330\r\n\ \r\n\ uniform mat4 projMat;\r\n\ \r\n\ layout(location = 0) in vec2 vert;\r\n\ layout(location = 1) in vec2 coord;\r\n\ layout(location = 2) in vec4 color;\r\n\ \r\n\ out vec2 T;\r\n\ out vec4 C;\r\n\ \r\n\ void main() {\r\n\ gl_Position = projMat * vec4(vert.x,vert.y, 1.0, 1.0);\r\n\ T = coord;\r\n\ C = color;\r\n\ }"; char fragmentShaderText[] = "#version 330\r\n\ \r\n\ out vec4 Color;\r\n\ \r\n\ in vec2 T;\r\n\ in vec4 C;\r\n\ \r\n\ uniform sampler2D texture0;\r\n\ \r\n\ void main() {\r\n\ Color = C;\r\n\ Color.a = texture(texture0, T).r;\r\n\ }"; static GLuint shader() { GLint compiled = 0; GLint linked = 0; const GLchar* stringptrs[1]; // Create the shaders GLuint vertexShader = glCreateShader(GL_VERTEX_SHADER); GLuint fragmentShader = glCreateShader(GL_FRAGMENT_SHADER); // Load and compile the vertex shader stringptrs[0] = vertexShaderText; glShaderSource(vertexShader, 1, stringptrs, 0); glCompileShader(vertexShader); // Check compile status glGetShaderiv(vertexShader, GL_COMPILE_STATUS, &compiled); if (!compiled) { GLint len = 0; glGetShaderiv(vertexShader, GL_INFO_LOG_LENGTH , &len); if (len > 1) { GLchar* compiler_log = (GLchar*)malloc(len); glGetShaderInfoLog(vertexShader, len, 0, compiler_log); free (compiler_log); } return 0; } // Load and compile the fragment shader stringptrs[0] = fragmentShaderText; glShaderSource(fragmentShader, 1, stringptrs, 0); glCompileShader(fragmentShader); // Check compile status glGetShaderiv(fragmentShader, GL_COMPILE_STATUS, &compiled); if (!compiled) { GLint len = 0; glGetShaderiv(fragmentShader, GL_INFO_LOG_LENGTH , &len); if (len > 1) { GLchar* compiler_log = (GLchar*)malloc(len); glGetShaderInfoLog(fragmentShader, len, 0, compiler_log); free (compiler_log); } return 0; } // Setup and link shader program GLuint programID = glCreateProgram(); glAttachShader(programID, vertexShader); glAttachShader(programID, fragmentShader); glLinkProgram(programID); glGetProgramiv(programID, GL_LINK_STATUS, &linked); if (!linked) { GLint len = 0; glGetProgramiv(programID, GL_INFO_LOG_LENGTH , &len); if (len > 1) { GLchar* compiler_log = (GLchar*)malloc(len); glGetProgramInfoLog(programID, len, 0, compiler_log); free (compiler_log); } return 0; } // Cleanup glDeleteShader(vertexShader); glDeleteShader(fragmentShader); return programID; } static int gl3fons__renderCreate(void* userPtr, int width, int height) { GLFONScontext* gl = (GLFONScontext*)userPtr; // Create may be called multiple times, delete existing texture. if (gl->tex != 0) { glDeleteTextures(1, &gl->tex); gl->tex = 0; } glGenTextures(1, &gl->tex); if (!gl->tex) { return 0; } // Create shader if (gl->shader != 0) { glDeleteProgram(gl->shader); gl->shader = 0; } gl->shader = shader(); if (!gl->shader) { return 0; } // Get uniforms gl->texture_uniform = glGetUniformLocation(gl->shader, "texture0"); gl->projMat_uniform = glGetUniformLocation(gl->shader, "projMat"); // Setup projection matrix as an identity matrix for (int i = 0; i < 16; i++) { gl->projMat[i] = 0.0; } gl->projMat[0] = 1.0; gl->projMat[5] = 1.0; gl->projMat[10] = 1.0; gl->projMat[15] = 1.0; // Create VAO if (gl->vao != 0) { glDeleteVertexArrays(1, &gl->vao); gl->vao = 0; } glGenVertexArrays(1, &gl->vao); if (!gl->vao) { return 0; } // Create VBO if (gl->vbo != 0) { glDeleteBuffers(1, &gl->vbo); gl->vbo = 0; } glGenBuffers(1, &gl->vbo); if (!gl->vbo) { return 0; } gl->width = width; gl->height = height; glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D, gl->tex); glTexImage2D(GL_TEXTURE_2D, 0, GL_RED, gl->width, gl->height, 0, GL_RED, GL_UNSIGNED_BYTE, 0); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); return 1; } static int gl3fons__renderResize(void* userPtr, int width, int height) { // Reuse create to resize. return gl3fons__renderCreate(userPtr, width, height); } static void gl3fons__renderUpdate(void* userPtr, int* rect, const unsigned char* data) { GLFONScontext* gl = (GLFONScontext*)userPtr; if (gl->tex == 0) { return; } int w = rect[2] - rect[0]; int h = rect[3] - rect[1]; glPushClientAttrib(GL_CLIENT_PIXEL_STORE_BIT); glBindTexture(GL_TEXTURE_2D, gl->tex); glPixelStorei(GL_UNPACK_ALIGNMENT,1); glPixelStorei(GL_UNPACK_ROW_LENGTH, gl->width); glPixelStorei(GL_UNPACK_SKIP_PIXELS, rect[0]); glPixelStorei(GL_UNPACK_SKIP_ROWS, rect[1]); glTexSubImage2D(GL_TEXTURE_2D, 0, rect[0], rect[1], w, h, GL_RED,GL_UNSIGNED_BYTE, data); glPopClientAttrib(); } static void gl3fons__renderDraw(void* userPtr, const float* verts, const float* tcoords, const unsigned int* colors, int nverts) { GLFONScontext* gl = (GLFONScontext*)userPtr; if (gl->tex == 0 || gl->shader == 0 || gl->vao == 0 || gl->vbo == 0) { return; } glEnable(GL_TEXTURE_2D); // Init shader glUseProgram(gl->shader); // Init texture glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D, gl->tex); glUniform1i(gl->texture_uniform, 0); // Init projection matrix glUniformMatrix4fv(gl->projMat_uniform, 1, false, gl->projMat); // Bind vao glBindVertexArray(gl->vao); // Setup buffer glBindBuffer(GL_ARRAY_BUFFER, gl->vbo); glBufferData(GL_ARRAY_BUFFER, (2 * sizeof(float) * 2 * nverts) + (sizeof(int) * nverts), NULL, GL_STATIC_DRAW); glBufferSubData(GL_ARRAY_BUFFER, 0, sizeof(float) * 2 * nverts , verts); glBufferSubData(GL_ARRAY_BUFFER, sizeof(float) * 2 * nverts, sizeof(float) * 2 * nverts , tcoords); glBufferSubData(GL_ARRAY_BUFFER, 2 * sizeof(float) * 2 * nverts, sizeof(int) * nverts, colors); // Setup attributes glEnableVertexAttribArray(0); glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 0, 0); glEnableVertexAttribArray(1); glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, sizeof(float) * 2, (void *) (sizeof(float) * 2 * nverts)); glEnableVertexAttribArray(2); glVertexAttribPointer(2, 4, GL_UNSIGNED_BYTE, GL_TRUE, sizeof(int), (void *) (2 * sizeof(float) * 2 * nverts)); glDrawArrays(GL_TRIANGLES, 0, nverts); glBindBuffer(GL_ARRAY_BUFFER, 0); glBindVertexArray(0); glUseProgram(0); } static void gl3fons__renderDelete(void* userPtr) { GLFONScontext* gl = (GLFONScontext*)userPtr; if (gl->tex != 0) { glDeleteTextures(1, &gl->tex); gl->tex = 0; } gl->texture_uniform = 0; gl->projMat_uniform = 0; if (gl->shader != 0) { glDeleteProgram(gl->shader); gl->shader = 0; } if (gl->vao != 0) { glDeleteVertexArrays(1, &gl->vao); gl->vao = 0; } if (gl->vbo != 0) { glDeleteBuffers(1, &gl->vbo); gl->vbo = 0; } free(gl); } FONScontext* gl3fonsCreate(int width, int height, int flags) { FONSparams params; GLFONScontext* gl; gl = (GLFONScontext*)malloc(sizeof(GLFONScontext)); if (gl == NULL) { goto error; } memset(gl, 0, sizeof(GLFONScontext)); memset(&params, 0, sizeof(params)); params.width = width; params.height = height; params.flags = (unsigned char)flags; params.renderCreate = gl3fons__renderCreate; params.renderResize = gl3fons__renderResize; params.renderUpdate = gl3fons__renderUpdate; params.renderDraw = gl3fons__renderDraw; params.renderDelete = gl3fons__renderDelete; params.userPtr = gl; return fonsCreateInternal(&params); error: if (gl != NULL) free(gl); return NULL; } void gl3fonsDelete(FONScontext* ctx) { fonsDeleteInternal(ctx); } // Keeping in mind that in OpenGL 0,0 is the bottom left corner of your screen but for text // it makes more sense for 0,0 to be the top left this would calculate a usable projection matrix: // memset(mat, 0, 16 * sizeof(GLfloat)); // mat[0] = 2.0 / screenwidth; // mat[5] = -2.0 / screenheight; // mat[10] = 2.0; // mat[12] = -1.0; // mat[13] = 1.0; // mat[14] = -1.0; // mat[15] = 1.0; void gl3fonsProjection(FONScontext* ctx, GLfloat *mat, int screenWidth, int screenHeight) { mat[0] = 2.0f / screenWidth; mat[5] = -2.0f / screenHeight; mat[10] = 2.0f; mat[12] = -1.0f; mat[13] = 1.0f; mat[14] = -1.0f; mat[15] = 1.0f; GLFONScontext* gl = (GLFONScontext*)(ctx->params.userPtr); for (int i = 0; i < 16; i++) { gl->projMat[i] = mat[i]; } } unsigned int gl3fonsRGBA(unsigned char r, unsigned char g, unsigned char b, unsigned char a) { return (r) | (g << 8) | (b << 16) | (a << 24); } #endif
25.294686
128
0.694328
[ "object" ]
b1bf76714b1aa86815ca3e70a7763a981ef75966
2,438
h
C
src/server.h
mtbrobotanist/nxudp
a737d07f6a2987d6371d28c7e5cc0c4f8ecc4b09
[ "MIT" ]
null
null
null
src/server.h
mtbrobotanist/nxudp
a737d07f6a2987d6371d28c7e5cc0c4f8ecc4b09
[ "MIT" ]
null
null
null
src/server.h
mtbrobotanist/nxudp
a737d07f6a2987d6371d28c7e5cc0c4f8ecc4b09
[ "MIT" ]
null
null
null
//+ // Created by n8 on 3/16/18. // #ifndef NX_UDP_SERVER_H #define NX_UDP_SERVER_H #include <chrono> #include <unordered_map> #include <asio.hpp> #include "int_buffer.h" #include "export.h" namespace nxudp { /// This class is responsible for waiting for input on a socket, parsing the timeout, and constructing timed sessions. /// when a timed session expires, it sends a reponse back to the client that initiated the timed session. class NXUDP_API server { const std::string _RESPONSE = "DONE"; public: /// The Constructor for the server object. /// @param[in] io - the asio::io_context object required to run the server's socket. server(asio::io_context& io); virtual ~server(); private: struct client_session { /// The endpoint of the client that started the session. Written to by socket.async_recieve_from(). asio::ip::udp::endpoint client_endpoint; /// The buffer written to by socket.async_receive_from(). int_buffer timeout_buffer; /// The timer used to countdown to a response. std::unique_ptr<asio::steady_timer> timer; }; /// A helper function to parse the given buffer to a integer timeout value. /// @param[in] buffer - the buffer whose contents to convert to an integer. /// @param[in] size_t bytes_transferred, the number of bytes transferred transferred into @param buffer. /// @param[out] out_timeout - a reference to an integer that will contain the timeout value. /// @returns bool - the result of the conversion. true, if successful, false otherwise. bool parse_timeout(int_buffer &buffer, size_t bytes_transferred, int &out_timeout); /// The function that calls async_receive_from() on the socket, specifying async_receive_callback() as the future function. void start_receive(); /// Executed when the server receives a timeout from a client. /// @param[in] session - the session to start. void start_session(std::unique_ptr<client_session> session); /// Executed after response is sent to the client. void end_session(client_session* session); private: asio::io_context& _io; asio::ip::udp::socket _socket; /// The set of active client_waiter objects. // std::unordered_set<std::shared_ptr<timed_session>> _sessions; std::unordered_map<client_session*, std::unique_ptr<client_session>> _sessions; }; }// namespace nxudp #endif //NX_UDP_SERVER_H
34.338028
127
0.712059
[ "object" ]
b1c6278d70b1ed0940e69986ef66865171f44b4b
5,266
h
C
src/BinaryStar.h
SimonStevenson/COMPAS
2bd8d42dddb6d1cac365a94a65b74ad9c540b0bc
[ "MIT" ]
1
2021-02-15T18:41:49.000Z
2021-02-15T18:41:49.000Z
src/BinaryStar.h
SimonStevenson/COMPAS
2bd8d42dddb6d1cac365a94a65b74ad9c540b0bc
[ "MIT" ]
null
null
null
src/BinaryStar.h
SimonStevenson/COMPAS
2bd8d42dddb6d1cac365a94a65b74ad9c540b0bc
[ "MIT" ]
null
null
null
#ifndef __BinaryStar_h__ #define __BinaryStar_h__ #include "constants.h" #include "typedefs.h" #include "AIS.h" #include "BaseBinaryStar.h" class AIS; class BaseBinaryStar; class BinaryStar { public: /* Constructors * * Parameter p_Id is optional, and is only included so that comparison tests can * be run against the legacy Compas code. If a fixed random seed is being used * (program option) the legacy code effectivley adds the loop index of the binary * (from COMPASBinary() in main.cpp) to the user-specified fixed random seed so * that each binary has a repeatable random seed. * * Notes: the legacy code doesn't actually use the loop index - it uses a generated * object id that is the same as the loop index. The new code also assigns objects * object ids, but the ids are assigned to all objects, not just binary stars, so * the ids generated in the new code won't match the legacy code ids - hence the * need to use the loop index here. The parameter is optional - if no comparison * testing against the legacy code is required, the p_Id parameter can be let default * (in which case it is not used to generate the random seed - the generated object * id is used instead). */ BinaryStar(const AIS &p_AIS, const long int p_Id = -1l); BinaryStar(const AIS &p_AIS, const double p_Mass1, const double p_Mass2, const double p_Metallicity1, const double p_Metallicity2, const double p_SemiMajorAxis, const double p_Eccentricity, const KickParameters p_KickParameters1, const KickParameters p_KickParameters2, const long int p_Id = -1l); // Copy constructor BinaryStar(const BinaryStar& p_Star) { m_ObjectId = globalObjectId++; // get unique object id (don't copy source) m_ObjectType = OBJECT_TYPE::BINARY_STAR; // can only copy from BINARY_STAR m_BinaryStar = new BaseBinaryStar(*(p_Star.m_BinaryStar)); // copy underlying BaseBinaryStar m_SaveBinaryStar = new BaseBinaryStar(*(p_Star.m_SaveBinaryStar)); // copy underlying Saved BaseBinaryStar } // Assignment overload BinaryStar& operator = (const BinaryStar& p_Star) { if (this != &p_Star) { // make sure we're not not copying ourselves... m_ObjectId = globalObjectId++; // get unique object id (don't copy source) m_ObjectType = OBJECT_TYPE::BINARY_CONSTITUENT_STAR; // can only copy from BINARY_CONSTITUENT_STAR delete m_BinaryStar; // delete existing m_BinaryStar = new BaseBinaryStar(*(p_Star.m_BinaryStar)); // copy underlying BaseBinaryStar delete m_SaveBinaryStar; // delete existing m_SaveBinaryStar = new BaseBinaryStar(*(p_Star.m_SaveBinaryStar)); // copy underlying Saved BaseBinaryStar } return *this; } virtual ~BinaryStar() { delete m_BinaryStar; delete m_SaveBinaryStar; } // object identifiers - all classes have these OBJECT_ID ObjectId() const { return m_ObjectId; } OBJECT_TYPE ObjectType() const { return m_ObjectType; } STELLAR_TYPE StellarType() const { return m_StellarType; } // member functions long int Id() { return m_BinaryStar->Id(); } EVOLUTION_STATUS Evolve() { return m_BinaryStar->Evolve(); } bool RevertState(); void SaveState(); STELLAR_TYPE Star1InitialType() { return m_BinaryStar->InitialStellarType1(); } STELLAR_TYPE Star1Type() { return m_BinaryStar->StellarType1(); } STELLAR_TYPE Star2InitialType() { return m_BinaryStar->InitialStellarType2(); } STELLAR_TYPE Star2Type() { return m_BinaryStar->StellarType2(); } private: BinaryStar() { } OBJECT_ID m_ObjectId; // Instantiated object's unique object id OBJECT_TYPE m_ObjectType; // Instantiated object's object type STELLAR_TYPE m_StellarType; // Stellar type defined in Hurley et al. 2000 BaseBinaryStar *m_BinaryStar; // Pointer to current binary star BaseBinaryStar *m_SaveBinaryStar; // Pointer to saved binary star }; #endif // __BinaryStar_h__
45.791304
143
0.548234
[ "object" ]
b1cb79b0640a10b743d14b65a0e3f19e36a17cc4
471
h
C
SMT/STP/ExecutionContext.h
vorpal-research/borealis
247ca1bb26690e2d605ffc57785151e86dccd5bb
[ "MIT" ]
null
null
null
SMT/STP/ExecutionContext.h
vorpal-research/borealis
247ca1bb26690e2d605ffc57785151e86dccd5bb
[ "MIT" ]
null
null
null
SMT/STP/ExecutionContext.h
vorpal-research/borealis
247ca1bb26690e2d605ffc57785151e86dccd5bb
[ "MIT" ]
1
2019-09-02T12:56:27.000Z
2019-09-02T12:56:27.000Z
/* * ExecutionContext.h * * Created on: Jun 15, 2016 * Author: belyaev */ #ifndef STP_EXECUTIONCONTEXT_H_ #define STP_EXECUTIONCONTEXT_H_ #include <unordered_map> #include <unordered_set> #include <vector> #include "SMT/STP/STPEngine.h" #include "SMT/STP/ExprFactory.h" #include "Util/split_join.hpp" #define NAMESPACE stp_ #define BACKEND STP #include "SMT/ExecutionContext.stub.h" #undef NAMESPACE #undef BACKEND #endif /* STP_EXECUTIONCONTEXT_H_ */
16.241379
38
0.745223
[ "vector" ]
b1cba5d7109ffcdbb6570e703cf0b38a249259cd
2,574
h
C
Modules/MitkExt/Interactions/mitkPointInteractor.h
rfloca/MITK
b7dcb830dc36a5d3011b9828c3d71e496d3936ad
[ "BSD-3-Clause" ]
null
null
null
Modules/MitkExt/Interactions/mitkPointInteractor.h
rfloca/MITK
b7dcb830dc36a5d3011b9828c3d71e496d3936ad
[ "BSD-3-Clause" ]
null
null
null
Modules/MitkExt/Interactions/mitkPointInteractor.h
rfloca/MITK
b7dcb830dc36a5d3011b9828c3d71e496d3936ad
[ "BSD-3-Clause" ]
null
null
null
/*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #ifndef MITKPOINTINTERACTOR_H_HEADER_INCLUDED #define MITKPOINTINTERACTOR_H_HEADER_INCLUDED #include "mitkCommon.h" #include "MitkExtExports.h" #include <mitkInteractor.h> #include <mitkVector.h> namespace mitk { class DataNode; //##Documentation //## @brief Interaction with a point //## //## Interact with a point: set point, select point, move point and remove point //## All Set-operations are done through the method "ExecuteAction". //## the identificationnumber of this point is set by this points and evalued from an empty place in the DataStructure //## @ingroup Interaction class MitkExt_EXPORT PointInteractor : public Interactor { public: mitkClassMacro(PointInteractor, Interactor); mitkNewMacro2Param(Self, const char*, DataNode*); //##Documentation //## @brief Sets the amount of precision void SetPrecision(unsigned int precision); //##Documentation //## @brief derived from mitk::Interactor; calculates Jurisdiction according to points //## //## standard method can not be used, since it doesn't calculate in points, only in BoundingBox of Points virtual float CanHandleEvent(StateEvent const* stateEvent) const; protected: //##Documentation //##@brief Constructor PointInteractor(const char * type, DataNode* dataNode); //##Documentation //##@brief Destructor virtual ~PointInteractor(); //##Documentation //## @brief select the point on the given position virtual void SelectPoint(int position); //##Documentation //## @brief unselect all points that exist in mesh virtual void DeselectAllPoints(); //##Documentation //## @brief Executes Actions virtual bool ExecuteAction(Action* action, mitk::StateEvent const* stateEvent); private: //##Documentation //## @brief to calculate a direction vector from last point and actual point Point3D m_LastPoint; //##Documentation //## @brief to store a position unsigned int m_LastPosition; }; } #endif /* MITKPOINTINTERACTOR_H_HEADER_INCLUDED */
28.921348
120
0.68648
[ "mesh", "vector" ]
b1ce49295c0d3edc20a35e877b409b1302196919
1,177
h
C
BSManagedDocument+VerifyModelResources.h
jerrykrinock/CategoriesObjC
b3c461c77a736c76c7d88515d62c7aa2f244d2a0
[ "Apache-2.0" ]
85
2015-01-04T06:15:20.000Z
2021-10-09T05:27:42.000Z
BSManagedDocument+VerifyModelResources.h
jerrykrinock/CategoriesObjC
b3c461c77a736c76c7d88515d62c7aa2f244d2a0
[ "Apache-2.0" ]
1
2017-09-03T07:45:38.000Z
2017-09-03T13:25:14.000Z
BSManagedDocument+VerifyModelResources.h
jerrykrinock/CategoriesObjC
b3c461c77a736c76c7d88515d62c7aa2f244d2a0
[ "Apache-2.0" ]
16
2015-01-19T16:31:43.000Z
2019-09-15T03:19:52.000Z
#import <Cocoa/Cocoa.h> #import "BSManagedDocument.h" /* BSManagedDocument is a open source replacement for NSPersistentDocument. It is recommended for any Core Data document-based app. https://github.com/jerrykrinock/BSManagedDocument */ extern NSString* SSYPersistentDocumentVerifyModelResourcesErrorDomain ; #define SSYPersistentDocumentVerifyModelResourcesErrorBadResource 252856 @interface BSManagedDocument (VerifyModelResources) /*! @brief Verifies that the data model resources in the app package are not overly corrupt, so that we get a good error message instead of inexplicable puke from Core Data. @details This method was added after I received a crash report from a user, and asked Apple to decode it for me, DTS Incident 275744748. The crash was not reproducible. @param error_p If this method returns NO, upon return, will point to an error object in domain SSYPersistentDocumentVerifyModelResourcesErrorDomain with code SSYPersistentDocumentVerifyModelResourcesErrorBadResource that explains the error. @result YES if the model resources are OK, otherwise NO. */ - (BOOL)verifyModelResourcesError_p:(NSError**)error_p ; @end
36.78125
76
0.806287
[ "object", "model" ]
b1cf0c55c8b3354b0017244a962f5fbf82b4ff91
108,266
h
C
opensearch/include/alibabacloud/opensearch/OpenSearchClient.h
aliyun/aliyun-openapi-cpp-sdk
0cf5861ece17dfb0bb251f13bf3fbdb39c0c6e36
[ "Apache-2.0" ]
89
2018-02-02T03:54:39.000Z
2021-12-13T01:32:55.000Z
opensearch/include/alibabacloud/opensearch/OpenSearchClient.h
aliyun/aliyun-openapi-cpp-sdk
0cf5861ece17dfb0bb251f13bf3fbdb39c0c6e36
[ "Apache-2.0" ]
89
2018-03-14T07:44:54.000Z
2021-11-26T07:43:25.000Z
opensearch/include/alibabacloud/opensearch/OpenSearchClient.h
aliyun/aliyun-openapi-cpp-sdk
0cf5861ece17dfb0bb251f13bf3fbdb39c0c6e36
[ "Apache-2.0" ]
69
2018-01-22T09:45:52.000Z
2022-03-28T07:58:38.000Z
/* * Copyright 2009-2017 Alibaba Cloud All rights reserved. * * 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. */ #ifndef ALIBABACLOUD_OPENSEARCH_OPENSEARCHCLIENT_H_ #define ALIBABACLOUD_OPENSEARCH_OPENSEARCHCLIENT_H_ #include <future> #include <alibabacloud/core/AsyncCallerContext.h> #include <alibabacloud/core/EndpointProvider.h> #include <alibabacloud/core/RoaServiceClient.h> #include "OpenSearchExport.h" #include "model/CompileSortScriptRequest.h" #include "model/CompileSortScriptResult.h" #include "model/CreateABTestExperimentRequest.h" #include "model/CreateABTestExperimentResult.h" #include "model/CreateABTestGroupRequest.h" #include "model/CreateABTestGroupResult.h" #include "model/CreateABTestSceneRequest.h" #include "model/CreateABTestSceneResult.h" #include "model/CreateAppRequest.h" #include "model/CreateAppResult.h" #include "model/CreateAppGroupRequest.h" #include "model/CreateAppGroupResult.h" #include "model/CreateDataCollectionRequest.h" #include "model/CreateDataCollectionResult.h" #include "model/CreateFirstRankRequest.h" #include "model/CreateFirstRankResult.h" #include "model/CreateInterventionDictionaryRequest.h" #include "model/CreateInterventionDictionaryResult.h" #include "model/CreateModelRequest.h" #include "model/CreateModelResult.h" #include "model/CreateQueryProcessorRequest.h" #include "model/CreateQueryProcessorResult.h" #include "model/CreateScheduledTaskRequest.h" #include "model/CreateScheduledTaskResult.h" #include "model/CreateSecondRankRequest.h" #include "model/CreateSecondRankResult.h" #include "model/CreateSortScriptRequest.h" #include "model/CreateSortScriptResult.h" #include "model/CreateUserAnalyzerRequest.h" #include "model/CreateUserAnalyzerResult.h" #include "model/DeleteABTestExperimentRequest.h" #include "model/DeleteABTestExperimentResult.h" #include "model/DeleteABTestGroupRequest.h" #include "model/DeleteABTestGroupResult.h" #include "model/DeleteABTestSceneRequest.h" #include "model/DeleteABTestSceneResult.h" #include "model/DeleteModelRequest.h" #include "model/DeleteModelResult.h" #include "model/DeleteSortScriptRequest.h" #include "model/DeleteSortScriptResult.h" #include "model/DeleteSortScriptFileRequest.h" #include "model/DeleteSortScriptFileResult.h" #include "model/DescribeABTestExperimentRequest.h" #include "model/DescribeABTestExperimentResult.h" #include "model/DescribeABTestGroupRequest.h" #include "model/DescribeABTestGroupResult.h" #include "model/DescribeABTestSceneRequest.h" #include "model/DescribeABTestSceneResult.h" #include "model/DescribeAppRequest.h" #include "model/DescribeAppResult.h" #include "model/DescribeAppGroupRequest.h" #include "model/DescribeAppGroupResult.h" #include "model/DescribeAppGroupDataReportRequest.h" #include "model/DescribeAppGroupDataReportResult.h" #include "model/DescribeAppStatisticsRequest.h" #include "model/DescribeAppStatisticsResult.h" #include "model/DescribeAppsRequest.h" #include "model/DescribeAppsResult.h" #include "model/DescribeDataCollctionRequest.h" #include "model/DescribeDataCollctionResult.h" #include "model/DescribeFirstRankRequest.h" #include "model/DescribeFirstRankResult.h" #include "model/DescribeInterventionDictionaryRequest.h" #include "model/DescribeInterventionDictionaryResult.h" #include "model/DescribeModelRequest.h" #include "model/DescribeModelResult.h" #include "model/DescribeQueryProcessorRequest.h" #include "model/DescribeQueryProcessorResult.h" #include "model/DescribeRegionRequest.h" #include "model/DescribeRegionResult.h" #include "model/DescribeRegionsRequest.h" #include "model/DescribeRegionsResult.h" #include "model/DescribeScheduledTaskRequest.h" #include "model/DescribeScheduledTaskResult.h" #include "model/DescribeSecondRankRequest.h" #include "model/DescribeSecondRankResult.h" #include "model/DescribeSlowQueryStatusRequest.h" #include "model/DescribeSlowQueryStatusResult.h" #include "model/DescribeUserAnalyzerRequest.h" #include "model/DescribeUserAnalyzerResult.h" #include "model/DisableSlowQueryRequest.h" #include "model/DisableSlowQueryResult.h" #include "model/EnableSlowQueryRequest.h" #include "model/EnableSlowQueryResult.h" #include "model/GenerateMergedTableRequest.h" #include "model/GenerateMergedTableResult.h" #include "model/GetDomainRequest.h" #include "model/GetDomainResult.h" #include "model/GetModelProgressRequest.h" #include "model/GetModelProgressResult.h" #include "model/GetModelReportRequest.h" #include "model/GetModelReportResult.h" #include "model/GetScriptFileNamesRequest.h" #include "model/GetScriptFileNamesResult.h" #include "model/GetSortScriptRequest.h" #include "model/GetSortScriptResult.h" #include "model/GetSortScriptFileRequest.h" #include "model/GetSortScriptFileResult.h" #include "model/GetValidationErrorRequest.h" #include "model/GetValidationErrorResult.h" #include "model/GetValidationReportRequest.h" #include "model/GetValidationReportResult.h" #include "model/ListABTestExperimentsRequest.h" #include "model/ListABTestExperimentsResult.h" #include "model/ListABTestFixedFlowDividersRequest.h" #include "model/ListABTestFixedFlowDividersResult.h" #include "model/ListABTestGroupsRequest.h" #include "model/ListABTestGroupsResult.h" #include "model/ListABTestMetricsRequest.h" #include "model/ListABTestMetricsResult.h" #include "model/ListABTestScenesRequest.h" #include "model/ListABTestScenesResult.h" #include "model/ListAppGroupErrorsRequest.h" #include "model/ListAppGroupErrorsResult.h" #include "model/ListAppGroupMetricsRequest.h" #include "model/ListAppGroupMetricsResult.h" #include "model/ListAppGroupsRequest.h" #include "model/ListAppGroupsResult.h" #include "model/ListAppsRequest.h" #include "model/ListAppsResult.h" #include "model/ListDataCollectionsRequest.h" #include "model/ListDataCollectionsResult.h" #include "model/ListDataSourceTableFieldsRequest.h" #include "model/ListDataSourceTableFieldsResult.h" #include "model/ListDataSourceTablesRequest.h" #include "model/ListDataSourceTablesResult.h" #include "model/ListDeployedAlgorithmModelsRequest.h" #include "model/ListDeployedAlgorithmModelsResult.h" #include "model/ListFirstRanksRequest.h" #include "model/ListFirstRanksResult.h" #include "model/ListInterventionDictionariesRequest.h" #include "model/ListInterventionDictionariesResult.h" #include "model/ListInterventionDictionaryEntriesRequest.h" #include "model/ListInterventionDictionaryEntriesResult.h" #include "model/ListInterventionDictionaryNerResultsRequest.h" #include "model/ListInterventionDictionaryNerResultsResult.h" #include "model/ListInterventionDictionaryRelatedEntitiesRequest.h" #include "model/ListInterventionDictionaryRelatedEntitiesResult.h" #include "model/ListModelsRequest.h" #include "model/ListModelsResult.h" #include "model/ListQueryProcessorNersRequest.h" #include "model/ListQueryProcessorNersResult.h" #include "model/ListQueryProcessorsRequest.h" #include "model/ListQueryProcessorsResult.h" #include "model/ListQuotaReviewTasksRequest.h" #include "model/ListQuotaReviewTasksResult.h" #include "model/ListRamRolesRequest.h" #include "model/ListRamRolesResult.h" #include "model/ListScheduledTasksRequest.h" #include "model/ListScheduledTasksResult.h" #include "model/ListSecondRanksRequest.h" #include "model/ListSecondRanksResult.h" #include "model/ListSlowQueryCategoriesRequest.h" #include "model/ListSlowQueryCategoriesResult.h" #include "model/ListSlowQueryQueriesRequest.h" #include "model/ListSlowQueryQueriesResult.h" #include "model/ListSortExpressionsRequest.h" #include "model/ListSortExpressionsResult.h" #include "model/ListSortScriptsRequest.h" #include "model/ListSortScriptsResult.h" #include "model/ListStatisticLogsRequest.h" #include "model/ListStatisticLogsResult.h" #include "model/ListStatisticReportRequest.h" #include "model/ListStatisticReportResult.h" #include "model/ListUserAnalyzerEntriesRequest.h" #include "model/ListUserAnalyzerEntriesResult.h" #include "model/ListUserAnalyzersRequest.h" #include "model/ListUserAnalyzersResult.h" #include "model/ModifyAppGroupRequest.h" #include "model/ModifyAppGroupResult.h" #include "model/ModifyAppGroupQuotaRequest.h" #include "model/ModifyAppGroupQuotaResult.h" #include "model/ModifyFirstRankRequest.h" #include "model/ModifyFirstRankResult.h" #include "model/ModifyModelRequest.h" #include "model/ModifyModelResult.h" #include "model/ModifyQueryProcessorRequest.h" #include "model/ModifyQueryProcessorResult.h" #include "model/ModifyScheduledTaskRequest.h" #include "model/ModifyScheduledTaskResult.h" #include "model/ModifySecondRankRequest.h" #include "model/ModifySecondRankResult.h" #include "model/PreviewModelRequest.h" #include "model/PreviewModelResult.h" #include "model/PushInterventionDictionaryEntriesRequest.h" #include "model/PushInterventionDictionaryEntriesResult.h" #include "model/PushUserAnalyzerEntriesRequest.h" #include "model/PushUserAnalyzerEntriesResult.h" #include "model/RankPreviewQueryRequest.h" #include "model/RankPreviewQueryResult.h" #include "model/ReleaseSortScriptRequest.h" #include "model/ReleaseSortScriptResult.h" #include "model/RemoveAppRequest.h" #include "model/RemoveAppResult.h" #include "model/RemoveAppGroupRequest.h" #include "model/RemoveAppGroupResult.h" #include "model/RemoveDataCollectionRequest.h" #include "model/RemoveDataCollectionResult.h" #include "model/RemoveFirstRankRequest.h" #include "model/RemoveFirstRankResult.h" #include "model/RemoveInterventionDictionaryRequest.h" #include "model/RemoveInterventionDictionaryResult.h" #include "model/RemoveQueryProcessorRequest.h" #include "model/RemoveQueryProcessorResult.h" #include "model/RemoveScheduledTaskRequest.h" #include "model/RemoveScheduledTaskResult.h" #include "model/RemoveSecondRankRequest.h" #include "model/RemoveSecondRankResult.h" #include "model/RemoveUserAnalyzerRequest.h" #include "model/RemoveUserAnalyzerResult.h" #include "model/RenewAppGroupRequest.h" #include "model/RenewAppGroupResult.h" #include "model/ReplaceAppGroupCommodityCodeRequest.h" #include "model/ReplaceAppGroupCommodityCodeResult.h" #include "model/SaveSortScriptFileRequest.h" #include "model/SaveSortScriptFileResult.h" #include "model/StartSlowQueryAnalyzerRequest.h" #include "model/StartSlowQueryAnalyzerResult.h" #include "model/TrainModelRequest.h" #include "model/TrainModelResult.h" #include "model/UpdateABTestExperimentRequest.h" #include "model/UpdateABTestExperimentResult.h" #include "model/UpdateABTestFixedFlowDividersRequest.h" #include "model/UpdateABTestFixedFlowDividersResult.h" #include "model/UpdateABTestGroupRequest.h" #include "model/UpdateABTestGroupResult.h" #include "model/UpdateABTestSceneRequest.h" #include "model/UpdateABTestSceneResult.h" #include "model/UpdateFetchFieldsRequest.h" #include "model/UpdateFetchFieldsResult.h" #include "model/UpdateSortScriptRequest.h" #include "model/UpdateSortScriptResult.h" #include "model/UpdateSummariesRequest.h" #include "model/UpdateSummariesResult.h" namespace AlibabaCloud { namespace OpenSearch { class ALIBABACLOUD_OPENSEARCH_EXPORT OpenSearchClient : public RoaServiceClient { public: typedef Outcome<Error, Model::CompileSortScriptResult> CompileSortScriptOutcome; typedef std::future<CompileSortScriptOutcome> CompileSortScriptOutcomeCallable; typedef std::function<void(const OpenSearchClient*, const Model::CompileSortScriptRequest&, const CompileSortScriptOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> CompileSortScriptAsyncHandler; typedef Outcome<Error, Model::CreateABTestExperimentResult> CreateABTestExperimentOutcome; typedef std::future<CreateABTestExperimentOutcome> CreateABTestExperimentOutcomeCallable; typedef std::function<void(const OpenSearchClient*, const Model::CreateABTestExperimentRequest&, const CreateABTestExperimentOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> CreateABTestExperimentAsyncHandler; typedef Outcome<Error, Model::CreateABTestGroupResult> CreateABTestGroupOutcome; typedef std::future<CreateABTestGroupOutcome> CreateABTestGroupOutcomeCallable; typedef std::function<void(const OpenSearchClient*, const Model::CreateABTestGroupRequest&, const CreateABTestGroupOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> CreateABTestGroupAsyncHandler; typedef Outcome<Error, Model::CreateABTestSceneResult> CreateABTestSceneOutcome; typedef std::future<CreateABTestSceneOutcome> CreateABTestSceneOutcomeCallable; typedef std::function<void(const OpenSearchClient*, const Model::CreateABTestSceneRequest&, const CreateABTestSceneOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> CreateABTestSceneAsyncHandler; typedef Outcome<Error, Model::CreateAppResult> CreateAppOutcome; typedef std::future<CreateAppOutcome> CreateAppOutcomeCallable; typedef std::function<void(const OpenSearchClient*, const Model::CreateAppRequest&, const CreateAppOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> CreateAppAsyncHandler; typedef Outcome<Error, Model::CreateAppGroupResult> CreateAppGroupOutcome; typedef std::future<CreateAppGroupOutcome> CreateAppGroupOutcomeCallable; typedef std::function<void(const OpenSearchClient*, const Model::CreateAppGroupRequest&, const CreateAppGroupOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> CreateAppGroupAsyncHandler; typedef Outcome<Error, Model::CreateDataCollectionResult> CreateDataCollectionOutcome; typedef std::future<CreateDataCollectionOutcome> CreateDataCollectionOutcomeCallable; typedef std::function<void(const OpenSearchClient*, const Model::CreateDataCollectionRequest&, const CreateDataCollectionOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> CreateDataCollectionAsyncHandler; typedef Outcome<Error, Model::CreateFirstRankResult> CreateFirstRankOutcome; typedef std::future<CreateFirstRankOutcome> CreateFirstRankOutcomeCallable; typedef std::function<void(const OpenSearchClient*, const Model::CreateFirstRankRequest&, const CreateFirstRankOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> CreateFirstRankAsyncHandler; typedef Outcome<Error, Model::CreateInterventionDictionaryResult> CreateInterventionDictionaryOutcome; typedef std::future<CreateInterventionDictionaryOutcome> CreateInterventionDictionaryOutcomeCallable; typedef std::function<void(const OpenSearchClient*, const Model::CreateInterventionDictionaryRequest&, const CreateInterventionDictionaryOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> CreateInterventionDictionaryAsyncHandler; typedef Outcome<Error, Model::CreateModelResult> CreateModelOutcome; typedef std::future<CreateModelOutcome> CreateModelOutcomeCallable; typedef std::function<void(const OpenSearchClient*, const Model::CreateModelRequest&, const CreateModelOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> CreateModelAsyncHandler; typedef Outcome<Error, Model::CreateQueryProcessorResult> CreateQueryProcessorOutcome; typedef std::future<CreateQueryProcessorOutcome> CreateQueryProcessorOutcomeCallable; typedef std::function<void(const OpenSearchClient*, const Model::CreateQueryProcessorRequest&, const CreateQueryProcessorOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> CreateQueryProcessorAsyncHandler; typedef Outcome<Error, Model::CreateScheduledTaskResult> CreateScheduledTaskOutcome; typedef std::future<CreateScheduledTaskOutcome> CreateScheduledTaskOutcomeCallable; typedef std::function<void(const OpenSearchClient*, const Model::CreateScheduledTaskRequest&, const CreateScheduledTaskOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> CreateScheduledTaskAsyncHandler; typedef Outcome<Error, Model::CreateSecondRankResult> CreateSecondRankOutcome; typedef std::future<CreateSecondRankOutcome> CreateSecondRankOutcomeCallable; typedef std::function<void(const OpenSearchClient*, const Model::CreateSecondRankRequest&, const CreateSecondRankOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> CreateSecondRankAsyncHandler; typedef Outcome<Error, Model::CreateSortScriptResult> CreateSortScriptOutcome; typedef std::future<CreateSortScriptOutcome> CreateSortScriptOutcomeCallable; typedef std::function<void(const OpenSearchClient*, const Model::CreateSortScriptRequest&, const CreateSortScriptOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> CreateSortScriptAsyncHandler; typedef Outcome<Error, Model::CreateUserAnalyzerResult> CreateUserAnalyzerOutcome; typedef std::future<CreateUserAnalyzerOutcome> CreateUserAnalyzerOutcomeCallable; typedef std::function<void(const OpenSearchClient*, const Model::CreateUserAnalyzerRequest&, const CreateUserAnalyzerOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> CreateUserAnalyzerAsyncHandler; typedef Outcome<Error, Model::DeleteABTestExperimentResult> DeleteABTestExperimentOutcome; typedef std::future<DeleteABTestExperimentOutcome> DeleteABTestExperimentOutcomeCallable; typedef std::function<void(const OpenSearchClient*, const Model::DeleteABTestExperimentRequest&, const DeleteABTestExperimentOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> DeleteABTestExperimentAsyncHandler; typedef Outcome<Error, Model::DeleteABTestGroupResult> DeleteABTestGroupOutcome; typedef std::future<DeleteABTestGroupOutcome> DeleteABTestGroupOutcomeCallable; typedef std::function<void(const OpenSearchClient*, const Model::DeleteABTestGroupRequest&, const DeleteABTestGroupOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> DeleteABTestGroupAsyncHandler; typedef Outcome<Error, Model::DeleteABTestSceneResult> DeleteABTestSceneOutcome; typedef std::future<DeleteABTestSceneOutcome> DeleteABTestSceneOutcomeCallable; typedef std::function<void(const OpenSearchClient*, const Model::DeleteABTestSceneRequest&, const DeleteABTestSceneOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> DeleteABTestSceneAsyncHandler; typedef Outcome<Error, Model::DeleteModelResult> DeleteModelOutcome; typedef std::future<DeleteModelOutcome> DeleteModelOutcomeCallable; typedef std::function<void(const OpenSearchClient*, const Model::DeleteModelRequest&, const DeleteModelOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> DeleteModelAsyncHandler; typedef Outcome<Error, Model::DeleteSortScriptResult> DeleteSortScriptOutcome; typedef std::future<DeleteSortScriptOutcome> DeleteSortScriptOutcomeCallable; typedef std::function<void(const OpenSearchClient*, const Model::DeleteSortScriptRequest&, const DeleteSortScriptOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> DeleteSortScriptAsyncHandler; typedef Outcome<Error, Model::DeleteSortScriptFileResult> DeleteSortScriptFileOutcome; typedef std::future<DeleteSortScriptFileOutcome> DeleteSortScriptFileOutcomeCallable; typedef std::function<void(const OpenSearchClient*, const Model::DeleteSortScriptFileRequest&, const DeleteSortScriptFileOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> DeleteSortScriptFileAsyncHandler; typedef Outcome<Error, Model::DescribeABTestExperimentResult> DescribeABTestExperimentOutcome; typedef std::future<DescribeABTestExperimentOutcome> DescribeABTestExperimentOutcomeCallable; typedef std::function<void(const OpenSearchClient*, const Model::DescribeABTestExperimentRequest&, const DescribeABTestExperimentOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> DescribeABTestExperimentAsyncHandler; typedef Outcome<Error, Model::DescribeABTestGroupResult> DescribeABTestGroupOutcome; typedef std::future<DescribeABTestGroupOutcome> DescribeABTestGroupOutcomeCallable; typedef std::function<void(const OpenSearchClient*, const Model::DescribeABTestGroupRequest&, const DescribeABTestGroupOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> DescribeABTestGroupAsyncHandler; typedef Outcome<Error, Model::DescribeABTestSceneResult> DescribeABTestSceneOutcome; typedef std::future<DescribeABTestSceneOutcome> DescribeABTestSceneOutcomeCallable; typedef std::function<void(const OpenSearchClient*, const Model::DescribeABTestSceneRequest&, const DescribeABTestSceneOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> DescribeABTestSceneAsyncHandler; typedef Outcome<Error, Model::DescribeAppResult> DescribeAppOutcome; typedef std::future<DescribeAppOutcome> DescribeAppOutcomeCallable; typedef std::function<void(const OpenSearchClient*, const Model::DescribeAppRequest&, const DescribeAppOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> DescribeAppAsyncHandler; typedef Outcome<Error, Model::DescribeAppGroupResult> DescribeAppGroupOutcome; typedef std::future<DescribeAppGroupOutcome> DescribeAppGroupOutcomeCallable; typedef std::function<void(const OpenSearchClient*, const Model::DescribeAppGroupRequest&, const DescribeAppGroupOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> DescribeAppGroupAsyncHandler; typedef Outcome<Error, Model::DescribeAppGroupDataReportResult> DescribeAppGroupDataReportOutcome; typedef std::future<DescribeAppGroupDataReportOutcome> DescribeAppGroupDataReportOutcomeCallable; typedef std::function<void(const OpenSearchClient*, const Model::DescribeAppGroupDataReportRequest&, const DescribeAppGroupDataReportOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> DescribeAppGroupDataReportAsyncHandler; typedef Outcome<Error, Model::DescribeAppStatisticsResult> DescribeAppStatisticsOutcome; typedef std::future<DescribeAppStatisticsOutcome> DescribeAppStatisticsOutcomeCallable; typedef std::function<void(const OpenSearchClient*, const Model::DescribeAppStatisticsRequest&, const DescribeAppStatisticsOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> DescribeAppStatisticsAsyncHandler; typedef Outcome<Error, Model::DescribeAppsResult> DescribeAppsOutcome; typedef std::future<DescribeAppsOutcome> DescribeAppsOutcomeCallable; typedef std::function<void(const OpenSearchClient*, const Model::DescribeAppsRequest&, const DescribeAppsOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> DescribeAppsAsyncHandler; typedef Outcome<Error, Model::DescribeDataCollctionResult> DescribeDataCollctionOutcome; typedef std::future<DescribeDataCollctionOutcome> DescribeDataCollctionOutcomeCallable; typedef std::function<void(const OpenSearchClient*, const Model::DescribeDataCollctionRequest&, const DescribeDataCollctionOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> DescribeDataCollctionAsyncHandler; typedef Outcome<Error, Model::DescribeFirstRankResult> DescribeFirstRankOutcome; typedef std::future<DescribeFirstRankOutcome> DescribeFirstRankOutcomeCallable; typedef std::function<void(const OpenSearchClient*, const Model::DescribeFirstRankRequest&, const DescribeFirstRankOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> DescribeFirstRankAsyncHandler; typedef Outcome<Error, Model::DescribeInterventionDictionaryResult> DescribeInterventionDictionaryOutcome; typedef std::future<DescribeInterventionDictionaryOutcome> DescribeInterventionDictionaryOutcomeCallable; typedef std::function<void(const OpenSearchClient*, const Model::DescribeInterventionDictionaryRequest&, const DescribeInterventionDictionaryOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> DescribeInterventionDictionaryAsyncHandler; typedef Outcome<Error, Model::DescribeModelResult> DescribeModelOutcome; typedef std::future<DescribeModelOutcome> DescribeModelOutcomeCallable; typedef std::function<void(const OpenSearchClient*, const Model::DescribeModelRequest&, const DescribeModelOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> DescribeModelAsyncHandler; typedef Outcome<Error, Model::DescribeQueryProcessorResult> DescribeQueryProcessorOutcome; typedef std::future<DescribeQueryProcessorOutcome> DescribeQueryProcessorOutcomeCallable; typedef std::function<void(const OpenSearchClient*, const Model::DescribeQueryProcessorRequest&, const DescribeQueryProcessorOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> DescribeQueryProcessorAsyncHandler; typedef Outcome<Error, Model::DescribeRegionResult> DescribeRegionOutcome; typedef std::future<DescribeRegionOutcome> DescribeRegionOutcomeCallable; typedef std::function<void(const OpenSearchClient*, const Model::DescribeRegionRequest&, const DescribeRegionOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> DescribeRegionAsyncHandler; typedef Outcome<Error, Model::DescribeRegionsResult> DescribeRegionsOutcome; typedef std::future<DescribeRegionsOutcome> DescribeRegionsOutcomeCallable; typedef std::function<void(const OpenSearchClient*, const Model::DescribeRegionsRequest&, const DescribeRegionsOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> DescribeRegionsAsyncHandler; typedef Outcome<Error, Model::DescribeScheduledTaskResult> DescribeScheduledTaskOutcome; typedef std::future<DescribeScheduledTaskOutcome> DescribeScheduledTaskOutcomeCallable; typedef std::function<void(const OpenSearchClient*, const Model::DescribeScheduledTaskRequest&, const DescribeScheduledTaskOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> DescribeScheduledTaskAsyncHandler; typedef Outcome<Error, Model::DescribeSecondRankResult> DescribeSecondRankOutcome; typedef std::future<DescribeSecondRankOutcome> DescribeSecondRankOutcomeCallable; typedef std::function<void(const OpenSearchClient*, const Model::DescribeSecondRankRequest&, const DescribeSecondRankOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> DescribeSecondRankAsyncHandler; typedef Outcome<Error, Model::DescribeSlowQueryStatusResult> DescribeSlowQueryStatusOutcome; typedef std::future<DescribeSlowQueryStatusOutcome> DescribeSlowQueryStatusOutcomeCallable; typedef std::function<void(const OpenSearchClient*, const Model::DescribeSlowQueryStatusRequest&, const DescribeSlowQueryStatusOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> DescribeSlowQueryStatusAsyncHandler; typedef Outcome<Error, Model::DescribeUserAnalyzerResult> DescribeUserAnalyzerOutcome; typedef std::future<DescribeUserAnalyzerOutcome> DescribeUserAnalyzerOutcomeCallable; typedef std::function<void(const OpenSearchClient*, const Model::DescribeUserAnalyzerRequest&, const DescribeUserAnalyzerOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> DescribeUserAnalyzerAsyncHandler; typedef Outcome<Error, Model::DisableSlowQueryResult> DisableSlowQueryOutcome; typedef std::future<DisableSlowQueryOutcome> DisableSlowQueryOutcomeCallable; typedef std::function<void(const OpenSearchClient*, const Model::DisableSlowQueryRequest&, const DisableSlowQueryOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> DisableSlowQueryAsyncHandler; typedef Outcome<Error, Model::EnableSlowQueryResult> EnableSlowQueryOutcome; typedef std::future<EnableSlowQueryOutcome> EnableSlowQueryOutcomeCallable; typedef std::function<void(const OpenSearchClient*, const Model::EnableSlowQueryRequest&, const EnableSlowQueryOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> EnableSlowQueryAsyncHandler; typedef Outcome<Error, Model::GenerateMergedTableResult> GenerateMergedTableOutcome; typedef std::future<GenerateMergedTableOutcome> GenerateMergedTableOutcomeCallable; typedef std::function<void(const OpenSearchClient*, const Model::GenerateMergedTableRequest&, const GenerateMergedTableOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> GenerateMergedTableAsyncHandler; typedef Outcome<Error, Model::GetDomainResult> GetDomainOutcome; typedef std::future<GetDomainOutcome> GetDomainOutcomeCallable; typedef std::function<void(const OpenSearchClient*, const Model::GetDomainRequest&, const GetDomainOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> GetDomainAsyncHandler; typedef Outcome<Error, Model::GetModelProgressResult> GetModelProgressOutcome; typedef std::future<GetModelProgressOutcome> GetModelProgressOutcomeCallable; typedef std::function<void(const OpenSearchClient*, const Model::GetModelProgressRequest&, const GetModelProgressOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> GetModelProgressAsyncHandler; typedef Outcome<Error, Model::GetModelReportResult> GetModelReportOutcome; typedef std::future<GetModelReportOutcome> GetModelReportOutcomeCallable; typedef std::function<void(const OpenSearchClient*, const Model::GetModelReportRequest&, const GetModelReportOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> GetModelReportAsyncHandler; typedef Outcome<Error, Model::GetScriptFileNamesResult> GetScriptFileNamesOutcome; typedef std::future<GetScriptFileNamesOutcome> GetScriptFileNamesOutcomeCallable; typedef std::function<void(const OpenSearchClient*, const Model::GetScriptFileNamesRequest&, const GetScriptFileNamesOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> GetScriptFileNamesAsyncHandler; typedef Outcome<Error, Model::GetSortScriptResult> GetSortScriptOutcome; typedef std::future<GetSortScriptOutcome> GetSortScriptOutcomeCallable; typedef std::function<void(const OpenSearchClient*, const Model::GetSortScriptRequest&, const GetSortScriptOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> GetSortScriptAsyncHandler; typedef Outcome<Error, Model::GetSortScriptFileResult> GetSortScriptFileOutcome; typedef std::future<GetSortScriptFileOutcome> GetSortScriptFileOutcomeCallable; typedef std::function<void(const OpenSearchClient*, const Model::GetSortScriptFileRequest&, const GetSortScriptFileOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> GetSortScriptFileAsyncHandler; typedef Outcome<Error, Model::GetValidationErrorResult> GetValidationErrorOutcome; typedef std::future<GetValidationErrorOutcome> GetValidationErrorOutcomeCallable; typedef std::function<void(const OpenSearchClient*, const Model::GetValidationErrorRequest&, const GetValidationErrorOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> GetValidationErrorAsyncHandler; typedef Outcome<Error, Model::GetValidationReportResult> GetValidationReportOutcome; typedef std::future<GetValidationReportOutcome> GetValidationReportOutcomeCallable; typedef std::function<void(const OpenSearchClient*, const Model::GetValidationReportRequest&, const GetValidationReportOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> GetValidationReportAsyncHandler; typedef Outcome<Error, Model::ListABTestExperimentsResult> ListABTestExperimentsOutcome; typedef std::future<ListABTestExperimentsOutcome> ListABTestExperimentsOutcomeCallable; typedef std::function<void(const OpenSearchClient*, const Model::ListABTestExperimentsRequest&, const ListABTestExperimentsOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> ListABTestExperimentsAsyncHandler; typedef Outcome<Error, Model::ListABTestFixedFlowDividersResult> ListABTestFixedFlowDividersOutcome; typedef std::future<ListABTestFixedFlowDividersOutcome> ListABTestFixedFlowDividersOutcomeCallable; typedef std::function<void(const OpenSearchClient*, const Model::ListABTestFixedFlowDividersRequest&, const ListABTestFixedFlowDividersOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> ListABTestFixedFlowDividersAsyncHandler; typedef Outcome<Error, Model::ListABTestGroupsResult> ListABTestGroupsOutcome; typedef std::future<ListABTestGroupsOutcome> ListABTestGroupsOutcomeCallable; typedef std::function<void(const OpenSearchClient*, const Model::ListABTestGroupsRequest&, const ListABTestGroupsOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> ListABTestGroupsAsyncHandler; typedef Outcome<Error, Model::ListABTestMetricsResult> ListABTestMetricsOutcome; typedef std::future<ListABTestMetricsOutcome> ListABTestMetricsOutcomeCallable; typedef std::function<void(const OpenSearchClient*, const Model::ListABTestMetricsRequest&, const ListABTestMetricsOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> ListABTestMetricsAsyncHandler; typedef Outcome<Error, Model::ListABTestScenesResult> ListABTestScenesOutcome; typedef std::future<ListABTestScenesOutcome> ListABTestScenesOutcomeCallable; typedef std::function<void(const OpenSearchClient*, const Model::ListABTestScenesRequest&, const ListABTestScenesOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> ListABTestScenesAsyncHandler; typedef Outcome<Error, Model::ListAppGroupErrorsResult> ListAppGroupErrorsOutcome; typedef std::future<ListAppGroupErrorsOutcome> ListAppGroupErrorsOutcomeCallable; typedef std::function<void(const OpenSearchClient*, const Model::ListAppGroupErrorsRequest&, const ListAppGroupErrorsOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> ListAppGroupErrorsAsyncHandler; typedef Outcome<Error, Model::ListAppGroupMetricsResult> ListAppGroupMetricsOutcome; typedef std::future<ListAppGroupMetricsOutcome> ListAppGroupMetricsOutcomeCallable; typedef std::function<void(const OpenSearchClient*, const Model::ListAppGroupMetricsRequest&, const ListAppGroupMetricsOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> ListAppGroupMetricsAsyncHandler; typedef Outcome<Error, Model::ListAppGroupsResult> ListAppGroupsOutcome; typedef std::future<ListAppGroupsOutcome> ListAppGroupsOutcomeCallable; typedef std::function<void(const OpenSearchClient*, const Model::ListAppGroupsRequest&, const ListAppGroupsOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> ListAppGroupsAsyncHandler; typedef Outcome<Error, Model::ListAppsResult> ListAppsOutcome; typedef std::future<ListAppsOutcome> ListAppsOutcomeCallable; typedef std::function<void(const OpenSearchClient*, const Model::ListAppsRequest&, const ListAppsOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> ListAppsAsyncHandler; typedef Outcome<Error, Model::ListDataCollectionsResult> ListDataCollectionsOutcome; typedef std::future<ListDataCollectionsOutcome> ListDataCollectionsOutcomeCallable; typedef std::function<void(const OpenSearchClient*, const Model::ListDataCollectionsRequest&, const ListDataCollectionsOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> ListDataCollectionsAsyncHandler; typedef Outcome<Error, Model::ListDataSourceTableFieldsResult> ListDataSourceTableFieldsOutcome; typedef std::future<ListDataSourceTableFieldsOutcome> ListDataSourceTableFieldsOutcomeCallable; typedef std::function<void(const OpenSearchClient*, const Model::ListDataSourceTableFieldsRequest&, const ListDataSourceTableFieldsOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> ListDataSourceTableFieldsAsyncHandler; typedef Outcome<Error, Model::ListDataSourceTablesResult> ListDataSourceTablesOutcome; typedef std::future<ListDataSourceTablesOutcome> ListDataSourceTablesOutcomeCallable; typedef std::function<void(const OpenSearchClient*, const Model::ListDataSourceTablesRequest&, const ListDataSourceTablesOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> ListDataSourceTablesAsyncHandler; typedef Outcome<Error, Model::ListDeployedAlgorithmModelsResult> ListDeployedAlgorithmModelsOutcome; typedef std::future<ListDeployedAlgorithmModelsOutcome> ListDeployedAlgorithmModelsOutcomeCallable; typedef std::function<void(const OpenSearchClient*, const Model::ListDeployedAlgorithmModelsRequest&, const ListDeployedAlgorithmModelsOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> ListDeployedAlgorithmModelsAsyncHandler; typedef Outcome<Error, Model::ListFirstRanksResult> ListFirstRanksOutcome; typedef std::future<ListFirstRanksOutcome> ListFirstRanksOutcomeCallable; typedef std::function<void(const OpenSearchClient*, const Model::ListFirstRanksRequest&, const ListFirstRanksOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> ListFirstRanksAsyncHandler; typedef Outcome<Error, Model::ListInterventionDictionariesResult> ListInterventionDictionariesOutcome; typedef std::future<ListInterventionDictionariesOutcome> ListInterventionDictionariesOutcomeCallable; typedef std::function<void(const OpenSearchClient*, const Model::ListInterventionDictionariesRequest&, const ListInterventionDictionariesOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> ListInterventionDictionariesAsyncHandler; typedef Outcome<Error, Model::ListInterventionDictionaryEntriesResult> ListInterventionDictionaryEntriesOutcome; typedef std::future<ListInterventionDictionaryEntriesOutcome> ListInterventionDictionaryEntriesOutcomeCallable; typedef std::function<void(const OpenSearchClient*, const Model::ListInterventionDictionaryEntriesRequest&, const ListInterventionDictionaryEntriesOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> ListInterventionDictionaryEntriesAsyncHandler; typedef Outcome<Error, Model::ListInterventionDictionaryNerResultsResult> ListInterventionDictionaryNerResultsOutcome; typedef std::future<ListInterventionDictionaryNerResultsOutcome> ListInterventionDictionaryNerResultsOutcomeCallable; typedef std::function<void(const OpenSearchClient*, const Model::ListInterventionDictionaryNerResultsRequest&, const ListInterventionDictionaryNerResultsOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> ListInterventionDictionaryNerResultsAsyncHandler; typedef Outcome<Error, Model::ListInterventionDictionaryRelatedEntitiesResult> ListInterventionDictionaryRelatedEntitiesOutcome; typedef std::future<ListInterventionDictionaryRelatedEntitiesOutcome> ListInterventionDictionaryRelatedEntitiesOutcomeCallable; typedef std::function<void(const OpenSearchClient*, const Model::ListInterventionDictionaryRelatedEntitiesRequest&, const ListInterventionDictionaryRelatedEntitiesOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> ListInterventionDictionaryRelatedEntitiesAsyncHandler; typedef Outcome<Error, Model::ListModelsResult> ListModelsOutcome; typedef std::future<ListModelsOutcome> ListModelsOutcomeCallable; typedef std::function<void(const OpenSearchClient*, const Model::ListModelsRequest&, const ListModelsOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> ListModelsAsyncHandler; typedef Outcome<Error, Model::ListQueryProcessorNersResult> ListQueryProcessorNersOutcome; typedef std::future<ListQueryProcessorNersOutcome> ListQueryProcessorNersOutcomeCallable; typedef std::function<void(const OpenSearchClient*, const Model::ListQueryProcessorNersRequest&, const ListQueryProcessorNersOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> ListQueryProcessorNersAsyncHandler; typedef Outcome<Error, Model::ListQueryProcessorsResult> ListQueryProcessorsOutcome; typedef std::future<ListQueryProcessorsOutcome> ListQueryProcessorsOutcomeCallable; typedef std::function<void(const OpenSearchClient*, const Model::ListQueryProcessorsRequest&, const ListQueryProcessorsOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> ListQueryProcessorsAsyncHandler; typedef Outcome<Error, Model::ListQuotaReviewTasksResult> ListQuotaReviewTasksOutcome; typedef std::future<ListQuotaReviewTasksOutcome> ListQuotaReviewTasksOutcomeCallable; typedef std::function<void(const OpenSearchClient*, const Model::ListQuotaReviewTasksRequest&, const ListQuotaReviewTasksOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> ListQuotaReviewTasksAsyncHandler; typedef Outcome<Error, Model::ListRamRolesResult> ListRamRolesOutcome; typedef std::future<ListRamRolesOutcome> ListRamRolesOutcomeCallable; typedef std::function<void(const OpenSearchClient*, const Model::ListRamRolesRequest&, const ListRamRolesOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> ListRamRolesAsyncHandler; typedef Outcome<Error, Model::ListScheduledTasksResult> ListScheduledTasksOutcome; typedef std::future<ListScheduledTasksOutcome> ListScheduledTasksOutcomeCallable; typedef std::function<void(const OpenSearchClient*, const Model::ListScheduledTasksRequest&, const ListScheduledTasksOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> ListScheduledTasksAsyncHandler; typedef Outcome<Error, Model::ListSecondRanksResult> ListSecondRanksOutcome; typedef std::future<ListSecondRanksOutcome> ListSecondRanksOutcomeCallable; typedef std::function<void(const OpenSearchClient*, const Model::ListSecondRanksRequest&, const ListSecondRanksOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> ListSecondRanksAsyncHandler; typedef Outcome<Error, Model::ListSlowQueryCategoriesResult> ListSlowQueryCategoriesOutcome; typedef std::future<ListSlowQueryCategoriesOutcome> ListSlowQueryCategoriesOutcomeCallable; typedef std::function<void(const OpenSearchClient*, const Model::ListSlowQueryCategoriesRequest&, const ListSlowQueryCategoriesOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> ListSlowQueryCategoriesAsyncHandler; typedef Outcome<Error, Model::ListSlowQueryQueriesResult> ListSlowQueryQueriesOutcome; typedef std::future<ListSlowQueryQueriesOutcome> ListSlowQueryQueriesOutcomeCallable; typedef std::function<void(const OpenSearchClient*, const Model::ListSlowQueryQueriesRequest&, const ListSlowQueryQueriesOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> ListSlowQueryQueriesAsyncHandler; typedef Outcome<Error, Model::ListSortExpressionsResult> ListSortExpressionsOutcome; typedef std::future<ListSortExpressionsOutcome> ListSortExpressionsOutcomeCallable; typedef std::function<void(const OpenSearchClient*, const Model::ListSortExpressionsRequest&, const ListSortExpressionsOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> ListSortExpressionsAsyncHandler; typedef Outcome<Error, Model::ListSortScriptsResult> ListSortScriptsOutcome; typedef std::future<ListSortScriptsOutcome> ListSortScriptsOutcomeCallable; typedef std::function<void(const OpenSearchClient*, const Model::ListSortScriptsRequest&, const ListSortScriptsOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> ListSortScriptsAsyncHandler; typedef Outcome<Error, Model::ListStatisticLogsResult> ListStatisticLogsOutcome; typedef std::future<ListStatisticLogsOutcome> ListStatisticLogsOutcomeCallable; typedef std::function<void(const OpenSearchClient*, const Model::ListStatisticLogsRequest&, const ListStatisticLogsOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> ListStatisticLogsAsyncHandler; typedef Outcome<Error, Model::ListStatisticReportResult> ListStatisticReportOutcome; typedef std::future<ListStatisticReportOutcome> ListStatisticReportOutcomeCallable; typedef std::function<void(const OpenSearchClient*, const Model::ListStatisticReportRequest&, const ListStatisticReportOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> ListStatisticReportAsyncHandler; typedef Outcome<Error, Model::ListUserAnalyzerEntriesResult> ListUserAnalyzerEntriesOutcome; typedef std::future<ListUserAnalyzerEntriesOutcome> ListUserAnalyzerEntriesOutcomeCallable; typedef std::function<void(const OpenSearchClient*, const Model::ListUserAnalyzerEntriesRequest&, const ListUserAnalyzerEntriesOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> ListUserAnalyzerEntriesAsyncHandler; typedef Outcome<Error, Model::ListUserAnalyzersResult> ListUserAnalyzersOutcome; typedef std::future<ListUserAnalyzersOutcome> ListUserAnalyzersOutcomeCallable; typedef std::function<void(const OpenSearchClient*, const Model::ListUserAnalyzersRequest&, const ListUserAnalyzersOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> ListUserAnalyzersAsyncHandler; typedef Outcome<Error, Model::ModifyAppGroupResult> ModifyAppGroupOutcome; typedef std::future<ModifyAppGroupOutcome> ModifyAppGroupOutcomeCallable; typedef std::function<void(const OpenSearchClient*, const Model::ModifyAppGroupRequest&, const ModifyAppGroupOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> ModifyAppGroupAsyncHandler; typedef Outcome<Error, Model::ModifyAppGroupQuotaResult> ModifyAppGroupQuotaOutcome; typedef std::future<ModifyAppGroupQuotaOutcome> ModifyAppGroupQuotaOutcomeCallable; typedef std::function<void(const OpenSearchClient*, const Model::ModifyAppGroupQuotaRequest&, const ModifyAppGroupQuotaOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> ModifyAppGroupQuotaAsyncHandler; typedef Outcome<Error, Model::ModifyFirstRankResult> ModifyFirstRankOutcome; typedef std::future<ModifyFirstRankOutcome> ModifyFirstRankOutcomeCallable; typedef std::function<void(const OpenSearchClient*, const Model::ModifyFirstRankRequest&, const ModifyFirstRankOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> ModifyFirstRankAsyncHandler; typedef Outcome<Error, Model::ModifyModelResult> ModifyModelOutcome; typedef std::future<ModifyModelOutcome> ModifyModelOutcomeCallable; typedef std::function<void(const OpenSearchClient*, const Model::ModifyModelRequest&, const ModifyModelOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> ModifyModelAsyncHandler; typedef Outcome<Error, Model::ModifyQueryProcessorResult> ModifyQueryProcessorOutcome; typedef std::future<ModifyQueryProcessorOutcome> ModifyQueryProcessorOutcomeCallable; typedef std::function<void(const OpenSearchClient*, const Model::ModifyQueryProcessorRequest&, const ModifyQueryProcessorOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> ModifyQueryProcessorAsyncHandler; typedef Outcome<Error, Model::ModifyScheduledTaskResult> ModifyScheduledTaskOutcome; typedef std::future<ModifyScheduledTaskOutcome> ModifyScheduledTaskOutcomeCallable; typedef std::function<void(const OpenSearchClient*, const Model::ModifyScheduledTaskRequest&, const ModifyScheduledTaskOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> ModifyScheduledTaskAsyncHandler; typedef Outcome<Error, Model::ModifySecondRankResult> ModifySecondRankOutcome; typedef std::future<ModifySecondRankOutcome> ModifySecondRankOutcomeCallable; typedef std::function<void(const OpenSearchClient*, const Model::ModifySecondRankRequest&, const ModifySecondRankOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> ModifySecondRankAsyncHandler; typedef Outcome<Error, Model::PreviewModelResult> PreviewModelOutcome; typedef std::future<PreviewModelOutcome> PreviewModelOutcomeCallable; typedef std::function<void(const OpenSearchClient*, const Model::PreviewModelRequest&, const PreviewModelOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> PreviewModelAsyncHandler; typedef Outcome<Error, Model::PushInterventionDictionaryEntriesResult> PushInterventionDictionaryEntriesOutcome; typedef std::future<PushInterventionDictionaryEntriesOutcome> PushInterventionDictionaryEntriesOutcomeCallable; typedef std::function<void(const OpenSearchClient*, const Model::PushInterventionDictionaryEntriesRequest&, const PushInterventionDictionaryEntriesOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> PushInterventionDictionaryEntriesAsyncHandler; typedef Outcome<Error, Model::PushUserAnalyzerEntriesResult> PushUserAnalyzerEntriesOutcome; typedef std::future<PushUserAnalyzerEntriesOutcome> PushUserAnalyzerEntriesOutcomeCallable; typedef std::function<void(const OpenSearchClient*, const Model::PushUserAnalyzerEntriesRequest&, const PushUserAnalyzerEntriesOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> PushUserAnalyzerEntriesAsyncHandler; typedef Outcome<Error, Model::RankPreviewQueryResult> RankPreviewQueryOutcome; typedef std::future<RankPreviewQueryOutcome> RankPreviewQueryOutcomeCallable; typedef std::function<void(const OpenSearchClient*, const Model::RankPreviewQueryRequest&, const RankPreviewQueryOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> RankPreviewQueryAsyncHandler; typedef Outcome<Error, Model::ReleaseSortScriptResult> ReleaseSortScriptOutcome; typedef std::future<ReleaseSortScriptOutcome> ReleaseSortScriptOutcomeCallable; typedef std::function<void(const OpenSearchClient*, const Model::ReleaseSortScriptRequest&, const ReleaseSortScriptOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> ReleaseSortScriptAsyncHandler; typedef Outcome<Error, Model::RemoveAppResult> RemoveAppOutcome; typedef std::future<RemoveAppOutcome> RemoveAppOutcomeCallable; typedef std::function<void(const OpenSearchClient*, const Model::RemoveAppRequest&, const RemoveAppOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> RemoveAppAsyncHandler; typedef Outcome<Error, Model::RemoveAppGroupResult> RemoveAppGroupOutcome; typedef std::future<RemoveAppGroupOutcome> RemoveAppGroupOutcomeCallable; typedef std::function<void(const OpenSearchClient*, const Model::RemoveAppGroupRequest&, const RemoveAppGroupOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> RemoveAppGroupAsyncHandler; typedef Outcome<Error, Model::RemoveDataCollectionResult> RemoveDataCollectionOutcome; typedef std::future<RemoveDataCollectionOutcome> RemoveDataCollectionOutcomeCallable; typedef std::function<void(const OpenSearchClient*, const Model::RemoveDataCollectionRequest&, const RemoveDataCollectionOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> RemoveDataCollectionAsyncHandler; typedef Outcome<Error, Model::RemoveFirstRankResult> RemoveFirstRankOutcome; typedef std::future<RemoveFirstRankOutcome> RemoveFirstRankOutcomeCallable; typedef std::function<void(const OpenSearchClient*, const Model::RemoveFirstRankRequest&, const RemoveFirstRankOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> RemoveFirstRankAsyncHandler; typedef Outcome<Error, Model::RemoveInterventionDictionaryResult> RemoveInterventionDictionaryOutcome; typedef std::future<RemoveInterventionDictionaryOutcome> RemoveInterventionDictionaryOutcomeCallable; typedef std::function<void(const OpenSearchClient*, const Model::RemoveInterventionDictionaryRequest&, const RemoveInterventionDictionaryOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> RemoveInterventionDictionaryAsyncHandler; typedef Outcome<Error, Model::RemoveQueryProcessorResult> RemoveQueryProcessorOutcome; typedef std::future<RemoveQueryProcessorOutcome> RemoveQueryProcessorOutcomeCallable; typedef std::function<void(const OpenSearchClient*, const Model::RemoveQueryProcessorRequest&, const RemoveQueryProcessorOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> RemoveQueryProcessorAsyncHandler; typedef Outcome<Error, Model::RemoveScheduledTaskResult> RemoveScheduledTaskOutcome; typedef std::future<RemoveScheduledTaskOutcome> RemoveScheduledTaskOutcomeCallable; typedef std::function<void(const OpenSearchClient*, const Model::RemoveScheduledTaskRequest&, const RemoveScheduledTaskOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> RemoveScheduledTaskAsyncHandler; typedef Outcome<Error, Model::RemoveSecondRankResult> RemoveSecondRankOutcome; typedef std::future<RemoveSecondRankOutcome> RemoveSecondRankOutcomeCallable; typedef std::function<void(const OpenSearchClient*, const Model::RemoveSecondRankRequest&, const RemoveSecondRankOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> RemoveSecondRankAsyncHandler; typedef Outcome<Error, Model::RemoveUserAnalyzerResult> RemoveUserAnalyzerOutcome; typedef std::future<RemoveUserAnalyzerOutcome> RemoveUserAnalyzerOutcomeCallable; typedef std::function<void(const OpenSearchClient*, const Model::RemoveUserAnalyzerRequest&, const RemoveUserAnalyzerOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> RemoveUserAnalyzerAsyncHandler; typedef Outcome<Error, Model::RenewAppGroupResult> RenewAppGroupOutcome; typedef std::future<RenewAppGroupOutcome> RenewAppGroupOutcomeCallable; typedef std::function<void(const OpenSearchClient*, const Model::RenewAppGroupRequest&, const RenewAppGroupOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> RenewAppGroupAsyncHandler; typedef Outcome<Error, Model::ReplaceAppGroupCommodityCodeResult> ReplaceAppGroupCommodityCodeOutcome; typedef std::future<ReplaceAppGroupCommodityCodeOutcome> ReplaceAppGroupCommodityCodeOutcomeCallable; typedef std::function<void(const OpenSearchClient*, const Model::ReplaceAppGroupCommodityCodeRequest&, const ReplaceAppGroupCommodityCodeOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> ReplaceAppGroupCommodityCodeAsyncHandler; typedef Outcome<Error, Model::SaveSortScriptFileResult> SaveSortScriptFileOutcome; typedef std::future<SaveSortScriptFileOutcome> SaveSortScriptFileOutcomeCallable; typedef std::function<void(const OpenSearchClient*, const Model::SaveSortScriptFileRequest&, const SaveSortScriptFileOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> SaveSortScriptFileAsyncHandler; typedef Outcome<Error, Model::StartSlowQueryAnalyzerResult> StartSlowQueryAnalyzerOutcome; typedef std::future<StartSlowQueryAnalyzerOutcome> StartSlowQueryAnalyzerOutcomeCallable; typedef std::function<void(const OpenSearchClient*, const Model::StartSlowQueryAnalyzerRequest&, const StartSlowQueryAnalyzerOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> StartSlowQueryAnalyzerAsyncHandler; typedef Outcome<Error, Model::TrainModelResult> TrainModelOutcome; typedef std::future<TrainModelOutcome> TrainModelOutcomeCallable; typedef std::function<void(const OpenSearchClient*, const Model::TrainModelRequest&, const TrainModelOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> TrainModelAsyncHandler; typedef Outcome<Error, Model::UpdateABTestExperimentResult> UpdateABTestExperimentOutcome; typedef std::future<UpdateABTestExperimentOutcome> UpdateABTestExperimentOutcomeCallable; typedef std::function<void(const OpenSearchClient*, const Model::UpdateABTestExperimentRequest&, const UpdateABTestExperimentOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> UpdateABTestExperimentAsyncHandler; typedef Outcome<Error, Model::UpdateABTestFixedFlowDividersResult> UpdateABTestFixedFlowDividersOutcome; typedef std::future<UpdateABTestFixedFlowDividersOutcome> UpdateABTestFixedFlowDividersOutcomeCallable; typedef std::function<void(const OpenSearchClient*, const Model::UpdateABTestFixedFlowDividersRequest&, const UpdateABTestFixedFlowDividersOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> UpdateABTestFixedFlowDividersAsyncHandler; typedef Outcome<Error, Model::UpdateABTestGroupResult> UpdateABTestGroupOutcome; typedef std::future<UpdateABTestGroupOutcome> UpdateABTestGroupOutcomeCallable; typedef std::function<void(const OpenSearchClient*, const Model::UpdateABTestGroupRequest&, const UpdateABTestGroupOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> UpdateABTestGroupAsyncHandler; typedef Outcome<Error, Model::UpdateABTestSceneResult> UpdateABTestSceneOutcome; typedef std::future<UpdateABTestSceneOutcome> UpdateABTestSceneOutcomeCallable; typedef std::function<void(const OpenSearchClient*, const Model::UpdateABTestSceneRequest&, const UpdateABTestSceneOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> UpdateABTestSceneAsyncHandler; typedef Outcome<Error, Model::UpdateFetchFieldsResult> UpdateFetchFieldsOutcome; typedef std::future<UpdateFetchFieldsOutcome> UpdateFetchFieldsOutcomeCallable; typedef std::function<void(const OpenSearchClient*, const Model::UpdateFetchFieldsRequest&, const UpdateFetchFieldsOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> UpdateFetchFieldsAsyncHandler; typedef Outcome<Error, Model::UpdateSortScriptResult> UpdateSortScriptOutcome; typedef std::future<UpdateSortScriptOutcome> UpdateSortScriptOutcomeCallable; typedef std::function<void(const OpenSearchClient*, const Model::UpdateSortScriptRequest&, const UpdateSortScriptOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> UpdateSortScriptAsyncHandler; typedef Outcome<Error, Model::UpdateSummariesResult> UpdateSummariesOutcome; typedef std::future<UpdateSummariesOutcome> UpdateSummariesOutcomeCallable; typedef std::function<void(const OpenSearchClient*, const Model::UpdateSummariesRequest&, const UpdateSummariesOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> UpdateSummariesAsyncHandler; OpenSearchClient(const Credentials &credentials, const ClientConfiguration &configuration); OpenSearchClient(const std::shared_ptr<CredentialsProvider> &credentialsProvider, const ClientConfiguration &configuration); OpenSearchClient(const std::string &accessKeyId, const std::string &accessKeySecret, const ClientConfiguration &configuration); ~OpenSearchClient(); CompileSortScriptOutcome compileSortScript(const Model::CompileSortScriptRequest &request)const; void compileSortScriptAsync(const Model::CompileSortScriptRequest& request, const CompileSortScriptAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const; CompileSortScriptOutcomeCallable compileSortScriptCallable(const Model::CompileSortScriptRequest& request) const; CreateABTestExperimentOutcome createABTestExperiment(const Model::CreateABTestExperimentRequest &request)const; void createABTestExperimentAsync(const Model::CreateABTestExperimentRequest& request, const CreateABTestExperimentAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const; CreateABTestExperimentOutcomeCallable createABTestExperimentCallable(const Model::CreateABTestExperimentRequest& request) const; CreateABTestGroupOutcome createABTestGroup(const Model::CreateABTestGroupRequest &request)const; void createABTestGroupAsync(const Model::CreateABTestGroupRequest& request, const CreateABTestGroupAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const; CreateABTestGroupOutcomeCallable createABTestGroupCallable(const Model::CreateABTestGroupRequest& request) const; CreateABTestSceneOutcome createABTestScene(const Model::CreateABTestSceneRequest &request)const; void createABTestSceneAsync(const Model::CreateABTestSceneRequest& request, const CreateABTestSceneAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const; CreateABTestSceneOutcomeCallable createABTestSceneCallable(const Model::CreateABTestSceneRequest& request) const; CreateAppOutcome createApp(const Model::CreateAppRequest &request)const; void createAppAsync(const Model::CreateAppRequest& request, const CreateAppAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const; CreateAppOutcomeCallable createAppCallable(const Model::CreateAppRequest& request) const; CreateAppGroupOutcome createAppGroup(const Model::CreateAppGroupRequest &request)const; void createAppGroupAsync(const Model::CreateAppGroupRequest& request, const CreateAppGroupAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const; CreateAppGroupOutcomeCallable createAppGroupCallable(const Model::CreateAppGroupRequest& request) const; CreateDataCollectionOutcome createDataCollection(const Model::CreateDataCollectionRequest &request)const; void createDataCollectionAsync(const Model::CreateDataCollectionRequest& request, const CreateDataCollectionAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const; CreateDataCollectionOutcomeCallable createDataCollectionCallable(const Model::CreateDataCollectionRequest& request) const; CreateFirstRankOutcome createFirstRank(const Model::CreateFirstRankRequest &request)const; void createFirstRankAsync(const Model::CreateFirstRankRequest& request, const CreateFirstRankAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const; CreateFirstRankOutcomeCallable createFirstRankCallable(const Model::CreateFirstRankRequest& request) const; CreateInterventionDictionaryOutcome createInterventionDictionary(const Model::CreateInterventionDictionaryRequest &request)const; void createInterventionDictionaryAsync(const Model::CreateInterventionDictionaryRequest& request, const CreateInterventionDictionaryAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const; CreateInterventionDictionaryOutcomeCallable createInterventionDictionaryCallable(const Model::CreateInterventionDictionaryRequest& request) const; CreateModelOutcome createModel(const Model::CreateModelRequest &request)const; void createModelAsync(const Model::CreateModelRequest& request, const CreateModelAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const; CreateModelOutcomeCallable createModelCallable(const Model::CreateModelRequest& request) const; CreateQueryProcessorOutcome createQueryProcessor(const Model::CreateQueryProcessorRequest &request)const; void createQueryProcessorAsync(const Model::CreateQueryProcessorRequest& request, const CreateQueryProcessorAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const; CreateQueryProcessorOutcomeCallable createQueryProcessorCallable(const Model::CreateQueryProcessorRequest& request) const; CreateScheduledTaskOutcome createScheduledTask(const Model::CreateScheduledTaskRequest &request)const; void createScheduledTaskAsync(const Model::CreateScheduledTaskRequest& request, const CreateScheduledTaskAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const; CreateScheduledTaskOutcomeCallable createScheduledTaskCallable(const Model::CreateScheduledTaskRequest& request) const; CreateSecondRankOutcome createSecondRank(const Model::CreateSecondRankRequest &request)const; void createSecondRankAsync(const Model::CreateSecondRankRequest& request, const CreateSecondRankAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const; CreateSecondRankOutcomeCallable createSecondRankCallable(const Model::CreateSecondRankRequest& request) const; CreateSortScriptOutcome createSortScript(const Model::CreateSortScriptRequest &request)const; void createSortScriptAsync(const Model::CreateSortScriptRequest& request, const CreateSortScriptAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const; CreateSortScriptOutcomeCallable createSortScriptCallable(const Model::CreateSortScriptRequest& request) const; CreateUserAnalyzerOutcome createUserAnalyzer(const Model::CreateUserAnalyzerRequest &request)const; void createUserAnalyzerAsync(const Model::CreateUserAnalyzerRequest& request, const CreateUserAnalyzerAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const; CreateUserAnalyzerOutcomeCallable createUserAnalyzerCallable(const Model::CreateUserAnalyzerRequest& request) const; DeleteABTestExperimentOutcome deleteABTestExperiment(const Model::DeleteABTestExperimentRequest &request)const; void deleteABTestExperimentAsync(const Model::DeleteABTestExperimentRequest& request, const DeleteABTestExperimentAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const; DeleteABTestExperimentOutcomeCallable deleteABTestExperimentCallable(const Model::DeleteABTestExperimentRequest& request) const; DeleteABTestGroupOutcome deleteABTestGroup(const Model::DeleteABTestGroupRequest &request)const; void deleteABTestGroupAsync(const Model::DeleteABTestGroupRequest& request, const DeleteABTestGroupAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const; DeleteABTestGroupOutcomeCallable deleteABTestGroupCallable(const Model::DeleteABTestGroupRequest& request) const; DeleteABTestSceneOutcome deleteABTestScene(const Model::DeleteABTestSceneRequest &request)const; void deleteABTestSceneAsync(const Model::DeleteABTestSceneRequest& request, const DeleteABTestSceneAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const; DeleteABTestSceneOutcomeCallable deleteABTestSceneCallable(const Model::DeleteABTestSceneRequest& request) const; DeleteModelOutcome deleteModel(const Model::DeleteModelRequest &request)const; void deleteModelAsync(const Model::DeleteModelRequest& request, const DeleteModelAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const; DeleteModelOutcomeCallable deleteModelCallable(const Model::DeleteModelRequest& request) const; DeleteSortScriptOutcome deleteSortScript(const Model::DeleteSortScriptRequest &request)const; void deleteSortScriptAsync(const Model::DeleteSortScriptRequest& request, const DeleteSortScriptAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const; DeleteSortScriptOutcomeCallable deleteSortScriptCallable(const Model::DeleteSortScriptRequest& request) const; DeleteSortScriptFileOutcome deleteSortScriptFile(const Model::DeleteSortScriptFileRequest &request)const; void deleteSortScriptFileAsync(const Model::DeleteSortScriptFileRequest& request, const DeleteSortScriptFileAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const; DeleteSortScriptFileOutcomeCallable deleteSortScriptFileCallable(const Model::DeleteSortScriptFileRequest& request) const; DescribeABTestExperimentOutcome describeABTestExperiment(const Model::DescribeABTestExperimentRequest &request)const; void describeABTestExperimentAsync(const Model::DescribeABTestExperimentRequest& request, const DescribeABTestExperimentAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const; DescribeABTestExperimentOutcomeCallable describeABTestExperimentCallable(const Model::DescribeABTestExperimentRequest& request) const; DescribeABTestGroupOutcome describeABTestGroup(const Model::DescribeABTestGroupRequest &request)const; void describeABTestGroupAsync(const Model::DescribeABTestGroupRequest& request, const DescribeABTestGroupAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const; DescribeABTestGroupOutcomeCallable describeABTestGroupCallable(const Model::DescribeABTestGroupRequest& request) const; DescribeABTestSceneOutcome describeABTestScene(const Model::DescribeABTestSceneRequest &request)const; void describeABTestSceneAsync(const Model::DescribeABTestSceneRequest& request, const DescribeABTestSceneAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const; DescribeABTestSceneOutcomeCallable describeABTestSceneCallable(const Model::DescribeABTestSceneRequest& request) const; DescribeAppOutcome describeApp(const Model::DescribeAppRequest &request)const; void describeAppAsync(const Model::DescribeAppRequest& request, const DescribeAppAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const; DescribeAppOutcomeCallable describeAppCallable(const Model::DescribeAppRequest& request) const; DescribeAppGroupOutcome describeAppGroup(const Model::DescribeAppGroupRequest &request)const; void describeAppGroupAsync(const Model::DescribeAppGroupRequest& request, const DescribeAppGroupAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const; DescribeAppGroupOutcomeCallable describeAppGroupCallable(const Model::DescribeAppGroupRequest& request) const; DescribeAppGroupDataReportOutcome describeAppGroupDataReport(const Model::DescribeAppGroupDataReportRequest &request)const; void describeAppGroupDataReportAsync(const Model::DescribeAppGroupDataReportRequest& request, const DescribeAppGroupDataReportAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const; DescribeAppGroupDataReportOutcomeCallable describeAppGroupDataReportCallable(const Model::DescribeAppGroupDataReportRequest& request) const; DescribeAppStatisticsOutcome describeAppStatistics(const Model::DescribeAppStatisticsRequest &request)const; void describeAppStatisticsAsync(const Model::DescribeAppStatisticsRequest& request, const DescribeAppStatisticsAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const; DescribeAppStatisticsOutcomeCallable describeAppStatisticsCallable(const Model::DescribeAppStatisticsRequest& request) const; DescribeAppsOutcome describeApps(const Model::DescribeAppsRequest &request)const; void describeAppsAsync(const Model::DescribeAppsRequest& request, const DescribeAppsAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const; DescribeAppsOutcomeCallable describeAppsCallable(const Model::DescribeAppsRequest& request) const; DescribeDataCollctionOutcome describeDataCollction(const Model::DescribeDataCollctionRequest &request)const; void describeDataCollctionAsync(const Model::DescribeDataCollctionRequest& request, const DescribeDataCollctionAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const; DescribeDataCollctionOutcomeCallable describeDataCollctionCallable(const Model::DescribeDataCollctionRequest& request) const; DescribeFirstRankOutcome describeFirstRank(const Model::DescribeFirstRankRequest &request)const; void describeFirstRankAsync(const Model::DescribeFirstRankRequest& request, const DescribeFirstRankAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const; DescribeFirstRankOutcomeCallable describeFirstRankCallable(const Model::DescribeFirstRankRequest& request) const; DescribeInterventionDictionaryOutcome describeInterventionDictionary(const Model::DescribeInterventionDictionaryRequest &request)const; void describeInterventionDictionaryAsync(const Model::DescribeInterventionDictionaryRequest& request, const DescribeInterventionDictionaryAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const; DescribeInterventionDictionaryOutcomeCallable describeInterventionDictionaryCallable(const Model::DescribeInterventionDictionaryRequest& request) const; DescribeModelOutcome describeModel(const Model::DescribeModelRequest &request)const; void describeModelAsync(const Model::DescribeModelRequest& request, const DescribeModelAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const; DescribeModelOutcomeCallable describeModelCallable(const Model::DescribeModelRequest& request) const; DescribeQueryProcessorOutcome describeQueryProcessor(const Model::DescribeQueryProcessorRequest &request)const; void describeQueryProcessorAsync(const Model::DescribeQueryProcessorRequest& request, const DescribeQueryProcessorAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const; DescribeQueryProcessorOutcomeCallable describeQueryProcessorCallable(const Model::DescribeQueryProcessorRequest& request) const; DescribeRegionOutcome describeRegion(const Model::DescribeRegionRequest &request)const; void describeRegionAsync(const Model::DescribeRegionRequest& request, const DescribeRegionAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const; DescribeRegionOutcomeCallable describeRegionCallable(const Model::DescribeRegionRequest& request) const; DescribeRegionsOutcome describeRegions(const Model::DescribeRegionsRequest &request)const; void describeRegionsAsync(const Model::DescribeRegionsRequest& request, const DescribeRegionsAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const; DescribeRegionsOutcomeCallable describeRegionsCallable(const Model::DescribeRegionsRequest& request) const; DescribeScheduledTaskOutcome describeScheduledTask(const Model::DescribeScheduledTaskRequest &request)const; void describeScheduledTaskAsync(const Model::DescribeScheduledTaskRequest& request, const DescribeScheduledTaskAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const; DescribeScheduledTaskOutcomeCallable describeScheduledTaskCallable(const Model::DescribeScheduledTaskRequest& request) const; DescribeSecondRankOutcome describeSecondRank(const Model::DescribeSecondRankRequest &request)const; void describeSecondRankAsync(const Model::DescribeSecondRankRequest& request, const DescribeSecondRankAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const; DescribeSecondRankOutcomeCallable describeSecondRankCallable(const Model::DescribeSecondRankRequest& request) const; DescribeSlowQueryStatusOutcome describeSlowQueryStatus(const Model::DescribeSlowQueryStatusRequest &request)const; void describeSlowQueryStatusAsync(const Model::DescribeSlowQueryStatusRequest& request, const DescribeSlowQueryStatusAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const; DescribeSlowQueryStatusOutcomeCallable describeSlowQueryStatusCallable(const Model::DescribeSlowQueryStatusRequest& request) const; DescribeUserAnalyzerOutcome describeUserAnalyzer(const Model::DescribeUserAnalyzerRequest &request)const; void describeUserAnalyzerAsync(const Model::DescribeUserAnalyzerRequest& request, const DescribeUserAnalyzerAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const; DescribeUserAnalyzerOutcomeCallable describeUserAnalyzerCallable(const Model::DescribeUserAnalyzerRequest& request) const; DisableSlowQueryOutcome disableSlowQuery(const Model::DisableSlowQueryRequest &request)const; void disableSlowQueryAsync(const Model::DisableSlowQueryRequest& request, const DisableSlowQueryAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const; DisableSlowQueryOutcomeCallable disableSlowQueryCallable(const Model::DisableSlowQueryRequest& request) const; EnableSlowQueryOutcome enableSlowQuery(const Model::EnableSlowQueryRequest &request)const; void enableSlowQueryAsync(const Model::EnableSlowQueryRequest& request, const EnableSlowQueryAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const; EnableSlowQueryOutcomeCallable enableSlowQueryCallable(const Model::EnableSlowQueryRequest& request) const; GenerateMergedTableOutcome generateMergedTable(const Model::GenerateMergedTableRequest &request)const; void generateMergedTableAsync(const Model::GenerateMergedTableRequest& request, const GenerateMergedTableAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const; GenerateMergedTableOutcomeCallable generateMergedTableCallable(const Model::GenerateMergedTableRequest& request) const; GetDomainOutcome getDomain(const Model::GetDomainRequest &request)const; void getDomainAsync(const Model::GetDomainRequest& request, const GetDomainAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const; GetDomainOutcomeCallable getDomainCallable(const Model::GetDomainRequest& request) const; GetModelProgressOutcome getModelProgress(const Model::GetModelProgressRequest &request)const; void getModelProgressAsync(const Model::GetModelProgressRequest& request, const GetModelProgressAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const; GetModelProgressOutcomeCallable getModelProgressCallable(const Model::GetModelProgressRequest& request) const; GetModelReportOutcome getModelReport(const Model::GetModelReportRequest &request)const; void getModelReportAsync(const Model::GetModelReportRequest& request, const GetModelReportAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const; GetModelReportOutcomeCallable getModelReportCallable(const Model::GetModelReportRequest& request) const; GetScriptFileNamesOutcome getScriptFileNames(const Model::GetScriptFileNamesRequest &request)const; void getScriptFileNamesAsync(const Model::GetScriptFileNamesRequest& request, const GetScriptFileNamesAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const; GetScriptFileNamesOutcomeCallable getScriptFileNamesCallable(const Model::GetScriptFileNamesRequest& request) const; GetSortScriptOutcome getSortScript(const Model::GetSortScriptRequest &request)const; void getSortScriptAsync(const Model::GetSortScriptRequest& request, const GetSortScriptAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const; GetSortScriptOutcomeCallable getSortScriptCallable(const Model::GetSortScriptRequest& request) const; GetSortScriptFileOutcome getSortScriptFile(const Model::GetSortScriptFileRequest &request)const; void getSortScriptFileAsync(const Model::GetSortScriptFileRequest& request, const GetSortScriptFileAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const; GetSortScriptFileOutcomeCallable getSortScriptFileCallable(const Model::GetSortScriptFileRequest& request) const; GetValidationErrorOutcome getValidationError(const Model::GetValidationErrorRequest &request)const; void getValidationErrorAsync(const Model::GetValidationErrorRequest& request, const GetValidationErrorAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const; GetValidationErrorOutcomeCallable getValidationErrorCallable(const Model::GetValidationErrorRequest& request) const; GetValidationReportOutcome getValidationReport(const Model::GetValidationReportRequest &request)const; void getValidationReportAsync(const Model::GetValidationReportRequest& request, const GetValidationReportAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const; GetValidationReportOutcomeCallable getValidationReportCallable(const Model::GetValidationReportRequest& request) const; ListABTestExperimentsOutcome listABTestExperiments(const Model::ListABTestExperimentsRequest &request)const; void listABTestExperimentsAsync(const Model::ListABTestExperimentsRequest& request, const ListABTestExperimentsAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const; ListABTestExperimentsOutcomeCallable listABTestExperimentsCallable(const Model::ListABTestExperimentsRequest& request) const; ListABTestFixedFlowDividersOutcome listABTestFixedFlowDividers(const Model::ListABTestFixedFlowDividersRequest &request)const; void listABTestFixedFlowDividersAsync(const Model::ListABTestFixedFlowDividersRequest& request, const ListABTestFixedFlowDividersAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const; ListABTestFixedFlowDividersOutcomeCallable listABTestFixedFlowDividersCallable(const Model::ListABTestFixedFlowDividersRequest& request) const; ListABTestGroupsOutcome listABTestGroups(const Model::ListABTestGroupsRequest &request)const; void listABTestGroupsAsync(const Model::ListABTestGroupsRequest& request, const ListABTestGroupsAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const; ListABTestGroupsOutcomeCallable listABTestGroupsCallable(const Model::ListABTestGroupsRequest& request) const; ListABTestMetricsOutcome listABTestMetrics(const Model::ListABTestMetricsRequest &request)const; void listABTestMetricsAsync(const Model::ListABTestMetricsRequest& request, const ListABTestMetricsAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const; ListABTestMetricsOutcomeCallable listABTestMetricsCallable(const Model::ListABTestMetricsRequest& request) const; ListABTestScenesOutcome listABTestScenes(const Model::ListABTestScenesRequest &request)const; void listABTestScenesAsync(const Model::ListABTestScenesRequest& request, const ListABTestScenesAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const; ListABTestScenesOutcomeCallable listABTestScenesCallable(const Model::ListABTestScenesRequest& request) const; ListAppGroupErrorsOutcome listAppGroupErrors(const Model::ListAppGroupErrorsRequest &request)const; void listAppGroupErrorsAsync(const Model::ListAppGroupErrorsRequest& request, const ListAppGroupErrorsAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const; ListAppGroupErrorsOutcomeCallable listAppGroupErrorsCallable(const Model::ListAppGroupErrorsRequest& request) const; ListAppGroupMetricsOutcome listAppGroupMetrics(const Model::ListAppGroupMetricsRequest &request)const; void listAppGroupMetricsAsync(const Model::ListAppGroupMetricsRequest& request, const ListAppGroupMetricsAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const; ListAppGroupMetricsOutcomeCallable listAppGroupMetricsCallable(const Model::ListAppGroupMetricsRequest& request) const; ListAppGroupsOutcome listAppGroups(const Model::ListAppGroupsRequest &request)const; void listAppGroupsAsync(const Model::ListAppGroupsRequest& request, const ListAppGroupsAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const; ListAppGroupsOutcomeCallable listAppGroupsCallable(const Model::ListAppGroupsRequest& request) const; ListAppsOutcome listApps(const Model::ListAppsRequest &request)const; void listAppsAsync(const Model::ListAppsRequest& request, const ListAppsAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const; ListAppsOutcomeCallable listAppsCallable(const Model::ListAppsRequest& request) const; ListDataCollectionsOutcome listDataCollections(const Model::ListDataCollectionsRequest &request)const; void listDataCollectionsAsync(const Model::ListDataCollectionsRequest& request, const ListDataCollectionsAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const; ListDataCollectionsOutcomeCallable listDataCollectionsCallable(const Model::ListDataCollectionsRequest& request) const; ListDataSourceTableFieldsOutcome listDataSourceTableFields(const Model::ListDataSourceTableFieldsRequest &request)const; void listDataSourceTableFieldsAsync(const Model::ListDataSourceTableFieldsRequest& request, const ListDataSourceTableFieldsAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const; ListDataSourceTableFieldsOutcomeCallable listDataSourceTableFieldsCallable(const Model::ListDataSourceTableFieldsRequest& request) const; ListDataSourceTablesOutcome listDataSourceTables(const Model::ListDataSourceTablesRequest &request)const; void listDataSourceTablesAsync(const Model::ListDataSourceTablesRequest& request, const ListDataSourceTablesAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const; ListDataSourceTablesOutcomeCallable listDataSourceTablesCallable(const Model::ListDataSourceTablesRequest& request) const; ListDeployedAlgorithmModelsOutcome listDeployedAlgorithmModels(const Model::ListDeployedAlgorithmModelsRequest &request)const; void listDeployedAlgorithmModelsAsync(const Model::ListDeployedAlgorithmModelsRequest& request, const ListDeployedAlgorithmModelsAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const; ListDeployedAlgorithmModelsOutcomeCallable listDeployedAlgorithmModelsCallable(const Model::ListDeployedAlgorithmModelsRequest& request) const; ListFirstRanksOutcome listFirstRanks(const Model::ListFirstRanksRequest &request)const; void listFirstRanksAsync(const Model::ListFirstRanksRequest& request, const ListFirstRanksAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const; ListFirstRanksOutcomeCallable listFirstRanksCallable(const Model::ListFirstRanksRequest& request) const; ListInterventionDictionariesOutcome listInterventionDictionaries(const Model::ListInterventionDictionariesRequest &request)const; void listInterventionDictionariesAsync(const Model::ListInterventionDictionariesRequest& request, const ListInterventionDictionariesAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const; ListInterventionDictionariesOutcomeCallable listInterventionDictionariesCallable(const Model::ListInterventionDictionariesRequest& request) const; ListInterventionDictionaryEntriesOutcome listInterventionDictionaryEntries(const Model::ListInterventionDictionaryEntriesRequest &request)const; void listInterventionDictionaryEntriesAsync(const Model::ListInterventionDictionaryEntriesRequest& request, const ListInterventionDictionaryEntriesAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const; ListInterventionDictionaryEntriesOutcomeCallable listInterventionDictionaryEntriesCallable(const Model::ListInterventionDictionaryEntriesRequest& request) const; ListInterventionDictionaryNerResultsOutcome listInterventionDictionaryNerResults(const Model::ListInterventionDictionaryNerResultsRequest &request)const; void listInterventionDictionaryNerResultsAsync(const Model::ListInterventionDictionaryNerResultsRequest& request, const ListInterventionDictionaryNerResultsAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const; ListInterventionDictionaryNerResultsOutcomeCallable listInterventionDictionaryNerResultsCallable(const Model::ListInterventionDictionaryNerResultsRequest& request) const; ListInterventionDictionaryRelatedEntitiesOutcome listInterventionDictionaryRelatedEntities(const Model::ListInterventionDictionaryRelatedEntitiesRequest &request)const; void listInterventionDictionaryRelatedEntitiesAsync(const Model::ListInterventionDictionaryRelatedEntitiesRequest& request, const ListInterventionDictionaryRelatedEntitiesAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const; ListInterventionDictionaryRelatedEntitiesOutcomeCallable listInterventionDictionaryRelatedEntitiesCallable(const Model::ListInterventionDictionaryRelatedEntitiesRequest& request) const; ListModelsOutcome listModels(const Model::ListModelsRequest &request)const; void listModelsAsync(const Model::ListModelsRequest& request, const ListModelsAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const; ListModelsOutcomeCallable listModelsCallable(const Model::ListModelsRequest& request) const; ListQueryProcessorNersOutcome listQueryProcessorNers(const Model::ListQueryProcessorNersRequest &request)const; void listQueryProcessorNersAsync(const Model::ListQueryProcessorNersRequest& request, const ListQueryProcessorNersAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const; ListQueryProcessorNersOutcomeCallable listQueryProcessorNersCallable(const Model::ListQueryProcessorNersRequest& request) const; ListQueryProcessorsOutcome listQueryProcessors(const Model::ListQueryProcessorsRequest &request)const; void listQueryProcessorsAsync(const Model::ListQueryProcessorsRequest& request, const ListQueryProcessorsAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const; ListQueryProcessorsOutcomeCallable listQueryProcessorsCallable(const Model::ListQueryProcessorsRequest& request) const; ListQuotaReviewTasksOutcome listQuotaReviewTasks(const Model::ListQuotaReviewTasksRequest &request)const; void listQuotaReviewTasksAsync(const Model::ListQuotaReviewTasksRequest& request, const ListQuotaReviewTasksAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const; ListQuotaReviewTasksOutcomeCallable listQuotaReviewTasksCallable(const Model::ListQuotaReviewTasksRequest& request) const; ListRamRolesOutcome listRamRoles(const Model::ListRamRolesRequest &request)const; void listRamRolesAsync(const Model::ListRamRolesRequest& request, const ListRamRolesAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const; ListRamRolesOutcomeCallable listRamRolesCallable(const Model::ListRamRolesRequest& request) const; ListScheduledTasksOutcome listScheduledTasks(const Model::ListScheduledTasksRequest &request)const; void listScheduledTasksAsync(const Model::ListScheduledTasksRequest& request, const ListScheduledTasksAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const; ListScheduledTasksOutcomeCallable listScheduledTasksCallable(const Model::ListScheduledTasksRequest& request) const; ListSecondRanksOutcome listSecondRanks(const Model::ListSecondRanksRequest &request)const; void listSecondRanksAsync(const Model::ListSecondRanksRequest& request, const ListSecondRanksAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const; ListSecondRanksOutcomeCallable listSecondRanksCallable(const Model::ListSecondRanksRequest& request) const; ListSlowQueryCategoriesOutcome listSlowQueryCategories(const Model::ListSlowQueryCategoriesRequest &request)const; void listSlowQueryCategoriesAsync(const Model::ListSlowQueryCategoriesRequest& request, const ListSlowQueryCategoriesAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const; ListSlowQueryCategoriesOutcomeCallable listSlowQueryCategoriesCallable(const Model::ListSlowQueryCategoriesRequest& request) const; ListSlowQueryQueriesOutcome listSlowQueryQueries(const Model::ListSlowQueryQueriesRequest &request)const; void listSlowQueryQueriesAsync(const Model::ListSlowQueryQueriesRequest& request, const ListSlowQueryQueriesAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const; ListSlowQueryQueriesOutcomeCallable listSlowQueryQueriesCallable(const Model::ListSlowQueryQueriesRequest& request) const; ListSortExpressionsOutcome listSortExpressions(const Model::ListSortExpressionsRequest &request)const; void listSortExpressionsAsync(const Model::ListSortExpressionsRequest& request, const ListSortExpressionsAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const; ListSortExpressionsOutcomeCallable listSortExpressionsCallable(const Model::ListSortExpressionsRequest& request) const; ListSortScriptsOutcome listSortScripts(const Model::ListSortScriptsRequest &request)const; void listSortScriptsAsync(const Model::ListSortScriptsRequest& request, const ListSortScriptsAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const; ListSortScriptsOutcomeCallable listSortScriptsCallable(const Model::ListSortScriptsRequest& request) const; ListStatisticLogsOutcome listStatisticLogs(const Model::ListStatisticLogsRequest &request)const; void listStatisticLogsAsync(const Model::ListStatisticLogsRequest& request, const ListStatisticLogsAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const; ListStatisticLogsOutcomeCallable listStatisticLogsCallable(const Model::ListStatisticLogsRequest& request) const; ListStatisticReportOutcome listStatisticReport(const Model::ListStatisticReportRequest &request)const; void listStatisticReportAsync(const Model::ListStatisticReportRequest& request, const ListStatisticReportAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const; ListStatisticReportOutcomeCallable listStatisticReportCallable(const Model::ListStatisticReportRequest& request) const; ListUserAnalyzerEntriesOutcome listUserAnalyzerEntries(const Model::ListUserAnalyzerEntriesRequest &request)const; void listUserAnalyzerEntriesAsync(const Model::ListUserAnalyzerEntriesRequest& request, const ListUserAnalyzerEntriesAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const; ListUserAnalyzerEntriesOutcomeCallable listUserAnalyzerEntriesCallable(const Model::ListUserAnalyzerEntriesRequest& request) const; ListUserAnalyzersOutcome listUserAnalyzers(const Model::ListUserAnalyzersRequest &request)const; void listUserAnalyzersAsync(const Model::ListUserAnalyzersRequest& request, const ListUserAnalyzersAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const; ListUserAnalyzersOutcomeCallable listUserAnalyzersCallable(const Model::ListUserAnalyzersRequest& request) const; ModifyAppGroupOutcome modifyAppGroup(const Model::ModifyAppGroupRequest &request)const; void modifyAppGroupAsync(const Model::ModifyAppGroupRequest& request, const ModifyAppGroupAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const; ModifyAppGroupOutcomeCallable modifyAppGroupCallable(const Model::ModifyAppGroupRequest& request) const; ModifyAppGroupQuotaOutcome modifyAppGroupQuota(const Model::ModifyAppGroupQuotaRequest &request)const; void modifyAppGroupQuotaAsync(const Model::ModifyAppGroupQuotaRequest& request, const ModifyAppGroupQuotaAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const; ModifyAppGroupQuotaOutcomeCallable modifyAppGroupQuotaCallable(const Model::ModifyAppGroupQuotaRequest& request) const; ModifyFirstRankOutcome modifyFirstRank(const Model::ModifyFirstRankRequest &request)const; void modifyFirstRankAsync(const Model::ModifyFirstRankRequest& request, const ModifyFirstRankAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const; ModifyFirstRankOutcomeCallable modifyFirstRankCallable(const Model::ModifyFirstRankRequest& request) const; ModifyModelOutcome modifyModel(const Model::ModifyModelRequest &request)const; void modifyModelAsync(const Model::ModifyModelRequest& request, const ModifyModelAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const; ModifyModelOutcomeCallable modifyModelCallable(const Model::ModifyModelRequest& request) const; ModifyQueryProcessorOutcome modifyQueryProcessor(const Model::ModifyQueryProcessorRequest &request)const; void modifyQueryProcessorAsync(const Model::ModifyQueryProcessorRequest& request, const ModifyQueryProcessorAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const; ModifyQueryProcessorOutcomeCallable modifyQueryProcessorCallable(const Model::ModifyQueryProcessorRequest& request) const; ModifyScheduledTaskOutcome modifyScheduledTask(const Model::ModifyScheduledTaskRequest &request)const; void modifyScheduledTaskAsync(const Model::ModifyScheduledTaskRequest& request, const ModifyScheduledTaskAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const; ModifyScheduledTaskOutcomeCallable modifyScheduledTaskCallable(const Model::ModifyScheduledTaskRequest& request) const; ModifySecondRankOutcome modifySecondRank(const Model::ModifySecondRankRequest &request)const; void modifySecondRankAsync(const Model::ModifySecondRankRequest& request, const ModifySecondRankAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const; ModifySecondRankOutcomeCallable modifySecondRankCallable(const Model::ModifySecondRankRequest& request) const; PreviewModelOutcome previewModel(const Model::PreviewModelRequest &request)const; void previewModelAsync(const Model::PreviewModelRequest& request, const PreviewModelAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const; PreviewModelOutcomeCallable previewModelCallable(const Model::PreviewModelRequest& request) const; PushInterventionDictionaryEntriesOutcome pushInterventionDictionaryEntries(const Model::PushInterventionDictionaryEntriesRequest &request)const; void pushInterventionDictionaryEntriesAsync(const Model::PushInterventionDictionaryEntriesRequest& request, const PushInterventionDictionaryEntriesAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const; PushInterventionDictionaryEntriesOutcomeCallable pushInterventionDictionaryEntriesCallable(const Model::PushInterventionDictionaryEntriesRequest& request) const; PushUserAnalyzerEntriesOutcome pushUserAnalyzerEntries(const Model::PushUserAnalyzerEntriesRequest &request)const; void pushUserAnalyzerEntriesAsync(const Model::PushUserAnalyzerEntriesRequest& request, const PushUserAnalyzerEntriesAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const; PushUserAnalyzerEntriesOutcomeCallable pushUserAnalyzerEntriesCallable(const Model::PushUserAnalyzerEntriesRequest& request) const; RankPreviewQueryOutcome rankPreviewQuery(const Model::RankPreviewQueryRequest &request)const; void rankPreviewQueryAsync(const Model::RankPreviewQueryRequest& request, const RankPreviewQueryAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const; RankPreviewQueryOutcomeCallable rankPreviewQueryCallable(const Model::RankPreviewQueryRequest& request) const; ReleaseSortScriptOutcome releaseSortScript(const Model::ReleaseSortScriptRequest &request)const; void releaseSortScriptAsync(const Model::ReleaseSortScriptRequest& request, const ReleaseSortScriptAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const; ReleaseSortScriptOutcomeCallable releaseSortScriptCallable(const Model::ReleaseSortScriptRequest& request) const; RemoveAppOutcome removeApp(const Model::RemoveAppRequest &request)const; void removeAppAsync(const Model::RemoveAppRequest& request, const RemoveAppAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const; RemoveAppOutcomeCallable removeAppCallable(const Model::RemoveAppRequest& request) const; RemoveAppGroupOutcome removeAppGroup(const Model::RemoveAppGroupRequest &request)const; void removeAppGroupAsync(const Model::RemoveAppGroupRequest& request, const RemoveAppGroupAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const; RemoveAppGroupOutcomeCallable removeAppGroupCallable(const Model::RemoveAppGroupRequest& request) const; RemoveDataCollectionOutcome removeDataCollection(const Model::RemoveDataCollectionRequest &request)const; void removeDataCollectionAsync(const Model::RemoveDataCollectionRequest& request, const RemoveDataCollectionAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const; RemoveDataCollectionOutcomeCallable removeDataCollectionCallable(const Model::RemoveDataCollectionRequest& request) const; RemoveFirstRankOutcome removeFirstRank(const Model::RemoveFirstRankRequest &request)const; void removeFirstRankAsync(const Model::RemoveFirstRankRequest& request, const RemoveFirstRankAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const; RemoveFirstRankOutcomeCallable removeFirstRankCallable(const Model::RemoveFirstRankRequest& request) const; RemoveInterventionDictionaryOutcome removeInterventionDictionary(const Model::RemoveInterventionDictionaryRequest &request)const; void removeInterventionDictionaryAsync(const Model::RemoveInterventionDictionaryRequest& request, const RemoveInterventionDictionaryAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const; RemoveInterventionDictionaryOutcomeCallable removeInterventionDictionaryCallable(const Model::RemoveInterventionDictionaryRequest& request) const; RemoveQueryProcessorOutcome removeQueryProcessor(const Model::RemoveQueryProcessorRequest &request)const; void removeQueryProcessorAsync(const Model::RemoveQueryProcessorRequest& request, const RemoveQueryProcessorAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const; RemoveQueryProcessorOutcomeCallable removeQueryProcessorCallable(const Model::RemoveQueryProcessorRequest& request) const; RemoveScheduledTaskOutcome removeScheduledTask(const Model::RemoveScheduledTaskRequest &request)const; void removeScheduledTaskAsync(const Model::RemoveScheduledTaskRequest& request, const RemoveScheduledTaskAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const; RemoveScheduledTaskOutcomeCallable removeScheduledTaskCallable(const Model::RemoveScheduledTaskRequest& request) const; RemoveSecondRankOutcome removeSecondRank(const Model::RemoveSecondRankRequest &request)const; void removeSecondRankAsync(const Model::RemoveSecondRankRequest& request, const RemoveSecondRankAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const; RemoveSecondRankOutcomeCallable removeSecondRankCallable(const Model::RemoveSecondRankRequest& request) const; RemoveUserAnalyzerOutcome removeUserAnalyzer(const Model::RemoveUserAnalyzerRequest &request)const; void removeUserAnalyzerAsync(const Model::RemoveUserAnalyzerRequest& request, const RemoveUserAnalyzerAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const; RemoveUserAnalyzerOutcomeCallable removeUserAnalyzerCallable(const Model::RemoveUserAnalyzerRequest& request) const; RenewAppGroupOutcome renewAppGroup(const Model::RenewAppGroupRequest &request)const; void renewAppGroupAsync(const Model::RenewAppGroupRequest& request, const RenewAppGroupAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const; RenewAppGroupOutcomeCallable renewAppGroupCallable(const Model::RenewAppGroupRequest& request) const; ReplaceAppGroupCommodityCodeOutcome replaceAppGroupCommodityCode(const Model::ReplaceAppGroupCommodityCodeRequest &request)const; void replaceAppGroupCommodityCodeAsync(const Model::ReplaceAppGroupCommodityCodeRequest& request, const ReplaceAppGroupCommodityCodeAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const; ReplaceAppGroupCommodityCodeOutcomeCallable replaceAppGroupCommodityCodeCallable(const Model::ReplaceAppGroupCommodityCodeRequest& request) const; SaveSortScriptFileOutcome saveSortScriptFile(const Model::SaveSortScriptFileRequest &request)const; void saveSortScriptFileAsync(const Model::SaveSortScriptFileRequest& request, const SaveSortScriptFileAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const; SaveSortScriptFileOutcomeCallable saveSortScriptFileCallable(const Model::SaveSortScriptFileRequest& request) const; StartSlowQueryAnalyzerOutcome startSlowQueryAnalyzer(const Model::StartSlowQueryAnalyzerRequest &request)const; void startSlowQueryAnalyzerAsync(const Model::StartSlowQueryAnalyzerRequest& request, const StartSlowQueryAnalyzerAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const; StartSlowQueryAnalyzerOutcomeCallable startSlowQueryAnalyzerCallable(const Model::StartSlowQueryAnalyzerRequest& request) const; TrainModelOutcome trainModel(const Model::TrainModelRequest &request)const; void trainModelAsync(const Model::TrainModelRequest& request, const TrainModelAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const; TrainModelOutcomeCallable trainModelCallable(const Model::TrainModelRequest& request) const; UpdateABTestExperimentOutcome updateABTestExperiment(const Model::UpdateABTestExperimentRequest &request)const; void updateABTestExperimentAsync(const Model::UpdateABTestExperimentRequest& request, const UpdateABTestExperimentAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const; UpdateABTestExperimentOutcomeCallable updateABTestExperimentCallable(const Model::UpdateABTestExperimentRequest& request) const; UpdateABTestFixedFlowDividersOutcome updateABTestFixedFlowDividers(const Model::UpdateABTestFixedFlowDividersRequest &request)const; void updateABTestFixedFlowDividersAsync(const Model::UpdateABTestFixedFlowDividersRequest& request, const UpdateABTestFixedFlowDividersAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const; UpdateABTestFixedFlowDividersOutcomeCallable updateABTestFixedFlowDividersCallable(const Model::UpdateABTestFixedFlowDividersRequest& request) const; UpdateABTestGroupOutcome updateABTestGroup(const Model::UpdateABTestGroupRequest &request)const; void updateABTestGroupAsync(const Model::UpdateABTestGroupRequest& request, const UpdateABTestGroupAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const; UpdateABTestGroupOutcomeCallable updateABTestGroupCallable(const Model::UpdateABTestGroupRequest& request) const; UpdateABTestSceneOutcome updateABTestScene(const Model::UpdateABTestSceneRequest &request)const; void updateABTestSceneAsync(const Model::UpdateABTestSceneRequest& request, const UpdateABTestSceneAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const; UpdateABTestSceneOutcomeCallable updateABTestSceneCallable(const Model::UpdateABTestSceneRequest& request) const; UpdateFetchFieldsOutcome updateFetchFields(const Model::UpdateFetchFieldsRequest &request)const; void updateFetchFieldsAsync(const Model::UpdateFetchFieldsRequest& request, const UpdateFetchFieldsAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const; UpdateFetchFieldsOutcomeCallable updateFetchFieldsCallable(const Model::UpdateFetchFieldsRequest& request) const; UpdateSortScriptOutcome updateSortScript(const Model::UpdateSortScriptRequest &request)const; void updateSortScriptAsync(const Model::UpdateSortScriptRequest& request, const UpdateSortScriptAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const; UpdateSortScriptOutcomeCallable updateSortScriptCallable(const Model::UpdateSortScriptRequest& request) const; UpdateSummariesOutcome updateSummaries(const Model::UpdateSummariesRequest &request)const; void updateSummariesAsync(const Model::UpdateSummariesRequest& request, const UpdateSummariesAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const; UpdateSummariesOutcomeCallable updateSummariesCallable(const Model::UpdateSummariesRequest& request) const; private: std::shared_ptr<EndpointProvider> endpointProvider_; }; } } #endif // !ALIBABACLOUD_OPENSEARCH_OPENSEARCHCLIENT_H_
110.138352
282
0.850987
[ "model" ]
b1de0ef28395a6b993afa90f8b54376bb52855dc
4,656
h
C
limbo/algorithms/MaxIndependentSet.h
RedFantom/limbo
8d3e0d484a809fb4b3ff8aa72fd972d16cdab405
[ "MIT" ]
74
2017-10-19T03:10:52.000Z
2022-03-28T17:51:54.000Z
limbo/algorithms/MaxIndependentSet.h
RedFantom/limbo
8d3e0d484a809fb4b3ff8aa72fd972d16cdab405
[ "MIT" ]
3
2017-12-06T01:49:21.000Z
2020-06-22T00:08:12.000Z
limbo/algorithms/MaxIndependentSet.h
RedFantom/limbo
8d3e0d484a809fb4b3ff8aa72fd972d16cdab405
[ "MIT" ]
26
2017-11-07T10:32:54.000Z
2021-10-02T02:22:37.000Z
/** * @file MaxIndependentSet.h * @brief solve maximum independent sets with maximum cliques * * The maximum independent set of a graph is the maximum clique of its complement graph. * * @author Yibo Lin * @date Feb 2015 */ #ifndef LIMBO_ALGORITHMS_MAXINDEPENDENTSET_H #define LIMBO_ALGORITHMS_MAXINDEPENDENTSET_H #include <deque> #include <boost/graph/bron_kerbosch_all_cliques.hpp> #include <limbo/algorithms/GraphUtility.h> namespace limbo { namespace algorithms { /// @class limbo::algorithms::MaxIndependentSetByMaxClique /// a tag for solving maximum independent sets with maximum cliques struct MaxIndependentSetByMaxClique { /// @class limbo::algorithms::MaxIndependentSetByMaxClique::clique_visitor_type /// @brief callback for boost::bron_kerbosch_all_cliques /// @tparam GraphType graph type /// @tparam MisVisitorType a function object for visiting each independent set. /// Refer to @ref limbo::algorithms::coloring::LawlerChromaticNumber::mis_visitor_type for example. template <typename GraphType, typename MisVisitorType> struct clique_visitor_type { /// @nowarn typedef GraphType graph_type; typedef MisVisitorType mis_visitor_type; typedef typename boost::graph_traits<graph_type>::vertex_descriptor vertex_descriptor_type; typedef std::map<vertex_descriptor_type, vertex_descriptor_type> map_type; /// @endnowarn MisVisitorType& mis_visitor; ///< bind mis visitor map_type& mCompG2G; ///< bind vertex mapping from complement graph to original graph /// constructor /// @param mv visitor of maximum independent set /// @param mCG2G mapping from complement graph to original graph clique_visitor_type(mis_visitor_type& mv, map_type& mCG2G) : mis_visitor(mv), mCompG2G(mCG2G) {} /// copy constructor /// @param rhs a clique_visitor_type object clique_visitor_type(clique_visitor_type const& rhs) : mis_visitor(rhs.mis_visitor), mCompG2G(rhs.mCompG2G) {} /// @tparam CliqueType container type for vertices of a clique /// @param c clique vertices in complement graph /// @param cg complement graph template <typename CliqueType> void clique(CliqueType const& c, graph_type const& cg) { // convert to vertices in original graph typedef CliqueType clique_type; clique_type is; // for debug if (boost::num_vertices(cg) > 0) assert(!c.empty()); for (typename clique_type::const_iterator it = c.begin(); it != c.end(); ++it) is.push_back(mCompG2G[*it]); mis_visitor.mis(is); } }; }; /// generic function to calculate maximum independent sets with different algorithms /// @tparam GraphType graph type /// @tparam VisitorType type of maximum independent set visitor /// @tparam AlgorithmType algorithm type /// @param g graph /// @param vis once an independent set is found, callback vis.mis(MisType const&) will be called. /// In this way, user can choose to store all the independent sets or process one by one. /// Refer to @ref limbo::algorithms::coloring::LawlerChromaticNumber::mis_visitor_type for example. template <typename GraphType, typename VisitorType, typename AlgorithmType> inline void max_independent_set(GraphType const& g, VisitorType vis, AlgorithmType const&); /// A maximum independent set of a graph g is also a maximum clique of its complement graph. /// This function searches maximum cliques of the complement graph to get maximum independent sets /// @tparam GraphType graph type /// @tparam VisitorType type of maximum independent set visitor /// @param g graph /// @param vis once an independent set is found, callback vis.mis(MisType const&) will be called. /// In this way, user can choose to store all the independent sets or process one by one. /// Refer to @ref limbo::algorithms::coloring::LawlerChromaticNumber::mis_visitor_type for example. template <typename GraphType, typename MisVisitorType> inline void max_independent_set(GraphType const& g, MisVisitorType vis, MaxIndependentSetByMaxClique const&) { typedef typename boost::graph_traits<GraphType>::vertex_descriptor vertex_descriptor_type; GraphType cg; // complement graph std::map<vertex_descriptor_type, vertex_descriptor_type> mCompG2G; // mapping from vertices in complement graph to original graph // calculate complement graph limbo::algorithms::complement_graph(g, cg, mCompG2G); // search for all cliques with at least 1 vertex boost::bron_kerbosch_all_cliques(cg, MaxIndependentSetByMaxClique::clique_visitor_type<GraphType, MisVisitorType>(vis, mCompG2G), 1); } } // namespace algorithms } // namespace limbo #endif
42.327273
134
0.753436
[ "object" ]
b1e07fe503572ccbf95bdb15e07be64d9003820d
880
h
C
samples Apple/3 Metal Advanced/MPSPathTracingSample/MPSPathTracingSample/Scene.h
jsrousseau/Cinder-Metal
01b939b714a460f1efbcd92385f4be51c163696f
[ "MIT" ]
3
2020-06-05T03:44:25.000Z
2020-06-21T17:09:37.000Z
MPSPathTracingSample/Scene.h
FactorialN/Metal-Kabuterimon
53fc1d156cba39effda1f774d902c49088147e30
[ "MIT" ]
null
null
null
MPSPathTracingSample/Scene.h
FactorialN/Metal-Kabuterimon
53fc1d156cba39effda1f774d902c49088147e30
[ "MIT" ]
null
null
null
/* See LICENSE folder for this sample’s licensing information. Abstract: Header for scene creation functions */ #ifndef Scene_h #define Scene_h #include <vector> #include <simd/simd.h> extern std::vector<vector_float3> vertices; extern std::vector<vector_float3> normals; extern std::vector<vector_float3> colors; extern std::vector<uint32_t> masks; #define FACE_MASK_NONE 0 #define FACE_MASK_NEGATIVE_X (1 << 0) #define FACE_MASK_POSITIVE_X (1 << 1) #define FACE_MASK_NEGATIVE_Y (1 << 2) #define FACE_MASK_POSITIVE_Y (1 << 3) #define FACE_MASK_NEGATIVE_Z (1 << 4) #define FACE_MASK_POSITIVE_Z (1 << 5) #define FACE_MASK_ALL ((1 << 6) - 1) void createCube(unsigned int faceMask, vector_float3 color, matrix_float4x4 transform, bool inwardNormals, unsigned int triangleMask); #endif /* Scene_h */
25.142857
59
0.698864
[ "vector", "transform" ]
07ef0a5cdc574730d148785741c8dfdd27d13645
576
h
C
verilator/perifericos/plic_y_pcr.h
OscarEMoreno/V-Algol
94d4145f793cb6bab27b5aec8856be3599d6148c
[ "MIT" ]
null
null
null
verilator/perifericos/plic_y_pcr.h
OscarEMoreno/V-Algol
94d4145f793cb6bab27b5aec8856be3599d6148c
[ "MIT" ]
null
null
null
verilator/perifericos/plic_y_pcr.h
OscarEMoreno/V-Algol
94d4145f793cb6bab27b5aec8856be3599d6148c
[ "MIT" ]
null
null
null
//file: exit peripheral, used to indicate end of simulation. #include <vector> #include <string> #include <cstdint> class PLIC_PCR{ public: PLIC_PCR(const uint32_t interrupt); void sim( uint32_t &wbs_addr_i, const uint32_t wbs_dat_i, const uint8_t wbs_sel_i, const uint8_t wbs_cyc_i, const uint8_t wbs_stb_i, const uint8_t wbs_we_i, uint32_t &wbs_data_o, uint8_t &wbs_ack_o, uint8_t &wbs_err_o, uint32_t &xinterrupts_i, uint8_t &eip, uint8_t &sip, uint8_t &tip); private: };
24
94
0.649306
[ "vector" ]
07f006b5176c8d7373cf1c23de9d443677421bc3
11,583
h
C
inc/hipc.h
dbolcsfoldi/node-native-fork
7079e9f349f276a5ef4bfc5b8b7d973dbfe204e6
[ "MIT" ]
null
null
null
inc/hipc.h
dbolcsfoldi/node-native-fork
7079e9f349f276a5ef4bfc5b8b7d973dbfe204e6
[ "MIT" ]
null
null
null
inc/hipc.h
dbolcsfoldi/node-native-fork
7079e9f349f276a5ef4bfc5b8b7d973dbfe204e6
[ "MIT" ]
1
2018-07-30T10:24:01.000Z
2018-07-30T10:24:01.000Z
/** MIT License Copyright (c) 2018 David Bolcsfoldi Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef __HEADER_IPC_H__ #define __HEADER_IPC_H__ #include <functional> #include <vector> #include <string> #include <algorithm> #include <sstream> #include <cassert> #include <cstdio> #include <uv.h> #include <json-c/json.h> namespace hipc { template <typename ...Args> class Event; template <typename ...Args> class Listener { public: void Remove() { owner_.RemoveListener(*this); } bool operator ==(const Listener<Args...> &to) const { return (id_ == to.id_); } bool operator !=(const Listener<Args...> &to) const { return (id_ != to.id_); } Listener(const Listener<Args...> &from) : owner_(from.owner_), id_(from.id_), fun_(from.fun_) {} Listener(Event<Args...> &owner, uint64_t id, std::function<void(Args...)> fun) : owner_(owner), id_(id), fun_(fun) {} private: Event<Args...> owner_; uint64_t id_; std::function<void(Args...)> fun_; friend class Event<Args...>; }; template <typename ...Args> class Event { public: Event() : id_(0) {} ~Event() {} Listener<Args...> On(const std::function<void(Args...)> &handler) { Listener<Args...> listener(*this, ++id_, handler); on_.push_back(listener); return listener; } Listener<Args...> Once(const std::function<void(Args...)> &handler) { Listener<Args...> listener(*this, ++id_, handler); once_.push_back(listener); return listener; } void RemoveListener(const Listener<Args...> &listener) { auto onceFound = std::find(once_.begin(), once_.end(), listener); if (onceFound != once_.end()) { once_.erase(onceFound); } auto onFound = std::find(on_.begin(), on_.end(), listener); if (onFound != on_.end()) { on_.erase(onFound); } } void RemoveAllListeners(void) { once_.clear(); on_.clear(); } void Emit(Args... args) { for (auto listener : once_) { listener.fun_(args...); } once_.clear(); for (auto listener : on_) { listener.fun_(args...); } } std::vector<Listener<Args...>> Listeners() const { std::vector<Listener<Args...>> listeners = on_; listeners.insert(listeners.end(), once_.begin(), once_.end()); return listeners; } private: std::vector<Listener<Args...>> on_; std::vector<Listener<Args...>> once_; mutable uint64_t id_; }; class Error { public: Error() : error_(0) {} Error(int err) : error_(err) {} void setError(int err) { error_ = err; } int error() const { return error_; } operator bool () const { return (error_ == 0); } private: int error_; }; struct WriteRequest { uv_buf_t buf; uv_write_t req; WriteRequest(const void *base, size_t len) { void *data = malloc(len); memcpy(data, base, len); buf.base = static_cast<char *>(data); buf.len = len; } WriteRequest(const WriteRequest &from) = delete; WriteRequest(WriteRequest &&from) = default; ~WriteRequest() { free(buf.base); } WriteRequest & operator =(const WriteRequest &from) = default; bool operator ==(uv_write_t *r) { return &req == r; } }; static bool to_int(const char *str, int *i) { if (!str) { return false; } char *end = nullptr; *i = strtoul(str, &end, 10); return (errno == EINVAL); } static const std::string kInternalPrefix = "NODE_"; static const std::string kNodeChannelFd = "NODE_CHANNEL_FD"; static const std::string kNodeHandle = "NODE_HANDLE"; static const std::string kNodeHandleAck = "NODE_HANDLE_ACK"; static const std::string kNodeHandleNack = "NODE_HANDLE_NACK"; class IPC { public: IPC() : node_fd_(-1), tokener_(json_tokener_new()) { if (to_int(getenv(kNodeChannelFd.c_str()), &node_fd_)) { node_fd_ = -1; } } ~IPC() { if (node_fd_ >= 0 && !uv_is_closing(reinterpret_cast<uv_handle_t *>(&handle_))) { uv_read_stop(reinterpret_cast<uv_stream_t *>(&handle_)); uv_close(reinterpret_cast<uv_handle_t *>(&handle_), IPC::onClose); } if (sendHandle_) { uv_close(reinterpret_cast<uv_handle_t *>(sendHandle_), IPC::closeSendHandle); sendHandle_ = nullptr; } uv_loop_close(uv_default_loop()); json_tokener_free(tokener_); } void Send(struct json_object *json) { const char *str = json_object_to_json_string_ext(json, JSON_C_TO_STRING_PLAIN); pendingRequests_.emplace_back(reinterpret_cast<const void *>(str), strlen(str)); sendImpl(pendingRequests_.back()); } void Send(const std::string &json) { pendingRequests_.emplace_back(reinterpret_cast<const void *>(json.c_str()), json.length()); sendImpl(pendingRequests_.back()); } int Run() { if (node_fd_ < 0) { return UV_EBADF; } uv_pipe_init(uv_default_loop(), &handle_, true); handle_.data = this; uv_pipe_open(&handle_, node_fd_); uv_read_start(reinterpret_cast<uv_stream_t *>(&handle_), IPC::onAlloc, IPC::onRead); return uv_run(uv_default_loop(), UV_RUN_DEFAULT); } private: static void onAlloc(uv_handle_t *handle, size_t suggested_size, uv_buf_t* buf) { buf->base = reinterpret_cast<char *>(malloc(suggested_size)); buf->len = suggested_size; } bool isInternalMessage(struct json_object *json) { struct json_object *cmd = nullptr; if (json_object_object_get_ex(json, "cmd", &cmd) && json_object_is_type(cmd, json_type_string)) { std::string cmdStr(json_object_get_string(cmd)); return cmdStr.substr(0, kInternalPrefix.length()) == kInternalPrefix; } return false; } uv_stream_t * makeHandle(uv_handle_type type) { switch (type) { case UV_NAMED_PIPE: { uv_pipe_t *p = new uv_pipe_t; uv_pipe_init(uv_default_loop(), p, 1); return reinterpret_cast<uv_stream_t *>(p); } case UV_TCP: { uv_tcp_t *t = new uv_tcp_t; uv_tcp_init(uv_default_loop(), t); return reinterpret_cast<uv_stream_t *>(t); } default: return nullptr; } } void handleInternalMessage(struct json_object *json) { struct json_object *cmd = nullptr; assert(json_object_object_get_ex(json, "cmd", &cmd)); assert(json_object_is_type(cmd, json_type_string)); std::string cmdStr(json_object_get_string(cmd)); if (cmdStr == kNodeHandle && uv_pipe_pending_count(&handle_) > 0) { uv_handle_type type = uv_pipe_pending_type(&handle_); uv_stream_t *handle = makeHandle(type); if (!handle || uv_accept(reinterpret_cast<uv_stream_t *>(&handle_), handle) < 0) { sendCmd(kNodeHandleNack); } else { sendHandle_ = handle; sendCmd(kNodeHandleAck); struct json_object *msg = nullptr; if (json_object_object_get_ex(json, "msg", &msg)) { handleMessage(msg); } } } } void handleMessage(struct json_object *json) { if (isInternalMessage(json)) { handleInternalMessage(json); } else { message.Emit(json, sendHandle_); sendHandle_ = nullptr; } } void onReadImpl(uv_stream_t *stream, ssize_t nread, const uv_buf_t *buf) { if (nread < 0) { uv_read_stop(stream); uv_close(reinterpret_cast<uv_handle_t *>(stream), IPC::onClose); if (nread != UV_EOF) { error.Emit(Error(nread)); } return; } str_.write(buf->base, nread); for (std::string line; std::getline(str_, line); ) { json_tokener_reset(tokener_); struct json_object *json = json_tokener_parse(line.c_str()); if (!json) { continue; } handleMessage(json); json_object_put(json); } } static void onRead(uv_stream_t *stream, ssize_t nread, const uv_buf_t *buf) { IPC *ipc = static_cast<IPC *>(stream->data); ipc->onReadImpl(stream, nread, buf); } static void onClose(uv_handle_t *handle) { IPC *ipc = static_cast<IPC *>(handle->data); ipc->disconnect.Emit(); } void onWriteImpl(uv_write_t *req, int status) { auto found = std::find(pendingRequests_.begin(), pendingRequests_.end(), req); assert(found != pendingRequests_.end()); pendingRequests_.erase(found); Error err(status); if (!err) { error.Emit(err); } } static void onWrite(uv_write_t *req, int status) { IPC *ipc = reinterpret_cast<IPC *>(req->handle->data); ipc->onWriteImpl(req, status); } void sendCmd(const std::string &cmd) { struct json_object *obj = json_object_new_object(); json_object_object_add(obj, "cmd", json_object_new_string(cmd.c_str())); Send(obj); json_object_put(obj); } void sendImpl(WriteRequest &req) { static char new_line[1] = { '\n' }; uv_buf_t bufs[2] = { { .base = req.buf.base, .len = req.buf.len }, { .base = new_line, .len = 1 } }; Error err(uv_write(&req.req, reinterpret_cast<uv_stream_t *>(&handle_), bufs, 2, IPC::onWrite)); if (!err) { error.Emit(err); } } static void closeSendHandle(uv_handle_t *handle) { delete handle; } public: Event<> disconnect; Event<struct json_object *, uv_stream_t *> message; Event<Error> error; private: int node_fd_; struct json_tokener *tokener_; uv_pipe_t handle_; std::stringstream str_; std::vector<WriteRequest> pendingRequests_; uv_stream_t *sendHandle_; }; } #endif // __HEADER_IPC_H__
28.114078
99
0.587413
[ "vector" ]
58031c6aaf153234abc9eca25d174f0bbf6026f0
12,467
h
C
src/appleseed.shaders/include/appleseed/color/as_color_helpers.h
oktomus/appleseed
067d2ed3483d97ed58058efbe418299e9dc8ca4f
[ "MIT" ]
1,907
2015-01-04T00:13:22.000Z
2022-03-30T15:14:00.000Z
src/appleseed.shaders/include/appleseed/color/as_color_helpers.h
oktomus/appleseed
067d2ed3483d97ed58058efbe418299e9dc8ca4f
[ "MIT" ]
1,196
2015-01-04T10:50:01.000Z
2022-03-04T09:18:22.000Z
src/appleseed.shaders/include/appleseed/color/as_color_helpers.h
oktomus/appleseed
067d2ed3483d97ed58058efbe418299e9dc8ca4f
[ "MIT" ]
373
2015-01-06T10:08:53.000Z
2022-03-12T10:25:57.000Z
// // This source file is part of appleseed. // Visit https://appleseedhq.net/ for additional information and resources. // // This software is released under the MIT license. // // Copyright (c) 2016-2018 Luis Barrancos, The appleseedhq Organization // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // #pragma once #include "appleseed/color/as_chromatic_adaptation.h" #include "appleseed/color/as_colorimetry.h" #include "appleseed/color/as_color_transforms.h" #include "appleseed/color/as_transfer_functions.h" #include "appleseed/maya/as_maya_cms_syncolor_idt.h" #ifndef NCOMPS #define NCOMPS 3 #endif // // The luminance coefficients Y are provided by the RGB<>XYZ matrices, which // depend on the CIE xy chromaticity coordinates of the RGB primaries and // of the whitepoint W. Versions are provided, where chromatic adaptation // takes place if the working/rendering space has a different whitepoint than // the whitepoint of the used RGBW standard. This used the Bradford CAT, // since this seems to be the most used adaptation transform. // float as_luminance_D65(color in_C, string colorspace) { color coeffs; if (colorspace == "Rec.601") { coeffs = color(REC601_D65_LUMINANCE_COEFFS); } else if (colorspace == "Rec.709" || colorspace == "sRGB" || colorspace == "sRGB/Rec.709") { coeffs = color(REC709_D65_LUMINANCE_COEFFS); } else if (colorspace == "AdobeRGB") { coeffs = color(ADOBERGB_D65_LUMINANCE_COEFFS); } else if (colorspace == "Rec.2020") { coeffs = color(REC2020_D65_LUMINANCE_COEFFS); } else if (colorspace == "ACES") { coeffs = color(ACES_D65_LUMINANCE_COEFFS); } else if (colorspace == "ACEScg") { coeffs = color(ACESCG_D65_LUMINANCE_COEFFS); } else if (colorspace == "DCI-P3") { coeffs = color(DCIP3_D65_LUMINANCE_COEFFS); } else { coeffs = color(0); } return coeffs[0] * in_C[0] + coeffs[1] * in_C[1] + coeffs[2] * in_C[2]; } float as_luminance_D60(color in_C, string colorspace) { color coeffs; if (colorspace == "Rec.601") { coeffs = color(REC601_D60_LUMINANCE_COEFFS); } else if (colorspace == "Rec.709" || colorspace == "sRGB" || colorspace == "sRGB/Rec.709") { coeffs = color(REC709_D60_LUMINANCE_COEFFS); } else if (colorspace == "AdobeRGB") { coeffs = color(ADOBERGB_D60_LUMINANCE_COEFFS); } else if (colorspace == "Rec.2020") { coeffs = color(REC2020_D60_LUMINANCE_COEFFS); } else if (colorspace == "ACES") { coeffs = color(ACES_D60_LUMINANCE_COEFFS); } else if (colorspace == "ACEScg") { coeffs = color(ACESCG_D60_LUMINANCE_COEFFS); } else if (colorspace == "DCI-P3") { coeffs = color(DCIP3_D60_LUMINANCE_COEFFS); } else { coeffs = color(0); } return coeffs[0] * in_C[0] + coeffs[1] * in_C[1] + coeffs[2] * in_C[2]; } float as_luminance_DCI(color in_C, string colorspace) { color coeffs; if (colorspace == "Rec.601") { coeffs = color(REC601_DCI_LUMINANCE_COEFFS); } else if (colorspace == "Rec.709" || colorspace == "sRGB" || colorspace == "sRGB/Rec.709") { coeffs = color(REC709_DCI_LUMINANCE_COEFFS); } else if (colorspace == "AdobeRGB") { coeffs = color(ADOBERGB_DCI_LUMINANCE_COEFFS); } else if (colorspace == "Rec.2020") { coeffs = color(REC2020_DCI_LUMINANCE_COEFFS); } else if (colorspace == "ACES") { coeffs = color(ACES_DCI_LUMINANCE_COEFFS); } else if (colorspace == "ACEScg") { coeffs = color(ACESCG_DCI_LUMINANCE_COEFFS); } else if (colorspace == "DCI-P3") { coeffs = color(DCIP3_DCI_LUMINANCE_COEFFS); } else { coeffs = color(0); } return coeffs[0] * in_C[0] + coeffs[1] * in_C[1] + coeffs[2] * in_C[2]; } float as_luminance(color in_C, string colorspace, string illuminant) { float Y; if (illuminant == "D60") { Y = as_luminance_D60(in_C, colorspace); } else if (illuminant == "D65") { Y = as_luminance_D65(in_C, colorspace); } else if (illuminant == "DCI") { Y = as_luminance_DCI(in_C, colorspace); } else { Y = 0.0; } return Y; } float as_luminance(color in_C, string colorspace) { color coeffs; // assuming input color is in "colorspace" working space if (colorspace == "Rec.601") { coeffs = color(REC601_D65_LUMINANCE_COEFFS); } else if (colorspace == "Rec.709" || colorspace == "sRGB" || colorspace == "sRGB/Rec.709") { coeffs = color(REC709_D65_LUMINANCE_COEFFS); } else if (colorspace == "AdobeRGB") { coeffs = color(ADOBERGB_D65_LUMINANCE_COEFFS); } else if (colorspace == "Rec.2020") { coeffs = color(REC2020_D65_LUMINANCE_COEFFS); } else if (colorspace == "ACES") { coeffs = color(ACES_D60_LUMINANCE_COEFFS); } else if (colorspace == "ACEScg") { coeffs = color(ACESCG_D60_LUMINANCE_COEFFS); } else if (colorspace == "DCI-P3") { coeffs = color(DCIP3_DCI_LUMINANCE_COEFFS); } else { coeffs = color(0); #ifdef DEBUG string shadername = ""; getattribute("shader:shadername", shadername); warning("[DEBUG]: Invalid working space specified in %s, %s:%d\n", shadername, __FILE__, __LINE__); #endif } return coeffs[0] * in_C[0] + coeffs[1] * in_C[1] + coeffs[2] * in_C[2]; } void initialize_RGBW_primaries( string RGB_primaries, string illuminant, float R_CIExy[2], float G_CIExy[2], float B_CIExy[2], float W_CIExy[2], output vector RGBW_CIExyz[4]) { if (RGB_primaries == "Rec.601") { RGBW_CIExyz[0] = REC601_CHROMATICITIES_Rxyz; RGBW_CIExyz[1] = REC601_CHROMATICITIES_Gxyz; RGBW_CIExyz[2] = REC601_CHROMATICITIES_Bxyz; } else if (RGB_primaries == "Rec.709" || RGB_primaries == "sRGB" || RGB_primaries == "sRGB/Rec.709") { RGBW_CIExyz[0] = REC709_CHROMATICITIES_Rxyz; RGBW_CIExyz[1] = REC709_CHROMATICITIES_Gxyz; RGBW_CIExyz[2] = REC709_CHROMATICITIES_Bxyz; } else if (RGB_primaries == "AdobeRGB") { RGBW_CIExyz[0] = ADOBERGB98_CHROMATICITIES_Rxyz; RGBW_CIExyz[1] = ADOBERGB98_CHROMATICITIES_Gxyz; RGBW_CIExyz[2] = ADOBERGB98_CHROMATICITIES_Bxyz; } else if (RGB_primaries == "Rec.2020") { RGBW_CIExyz[0] = REC2020_CHROMATICITIES_Rxyz; RGBW_CIExyz[1] = REC2020_CHROMATICITIES_Gxyz; RGBW_CIExyz[2] = REC2020_CHROMATICITIES_Bxyz; } else if (RGB_primaries == "DCI-P3") { RGBW_CIExyz[0] = DCIP3_CHROMATICITIES_Rxyz; RGBW_CIExyz[1] = DCIP3_CHROMATICITIES_Gxyz; RGBW_CIExyz[2] = DCIP3_CHROMATICITIES_Bxyz; } else if (RGB_primaries == "ACES") { RGBW_CIExyz[0] = ACES_AP0_CHROMATICITIES_Rxyz; RGBW_CIExyz[1] = ACES_AP0_CHROMATICITIES_Gxyz; RGBW_CIExyz[2] = ACES_AP0_CHROMATICITIES_Bxyz; } else if (RGB_primaries == "ACEScg") { RGBW_CIExyz[0] = ACESCG_AP1_CHROMATICITIES_Rxyz; RGBW_CIExyz[1] = ACESCG_AP1_CHROMATICITIES_Gxyz; RGBW_CIExyz[2] = ACESCG_AP1_CHROMATICITIES_Bxyz; } else if (RGB_primaries == "custom") { RGBW_CIExyz[0] = transform_CIExy_to_CIExyz(R_CIExy); RGBW_CIExyz[1] = transform_CIExy_to_CIExyz(G_CIExy); RGBW_CIExyz[2] = transform_CIExy_to_CIExyz(B_CIExy); } else { RGBW_CIExyz[0] = RGBW_CIExyz[1] = RGBW_CIExyz[2] = RGBW_CIExyz[3] = 0.0; } RGBW_CIExyz[3] = get_illuminant_CIExyz(illuminant, W_CIExy); } void initialize_RGB_primaries( string RGB_primaries, output vector RGB_CIExyz[3]) { if (RGB_primaries == "Rec.601") { RGB_CIExyz[0] = REC601_CHROMATICITIES_Rxyz; RGB_CIExyz[1] = REC601_CHROMATICITIES_Gxyz; RGB_CIExyz[2] = REC601_CHROMATICITIES_Bxyz; } else if (RGB_primaries == "Rec.709" || RGB_primaries == "sRGB" || RGB_primaries == "sRGB/Rec.709") { RGB_CIExyz[0] = REC709_CHROMATICITIES_Rxyz; RGB_CIExyz[1] = REC709_CHROMATICITIES_Gxyz; RGB_CIExyz[2] = REC709_CHROMATICITIES_Bxyz; } else if (RGB_primaries == "AdobeRGB") { RGB_CIExyz[0] = ADOBERGB98_CHROMATICITIES_Rxyz; RGB_CIExyz[1] = ADOBERGB98_CHROMATICITIES_Gxyz; RGB_CIExyz[2] = ADOBERGB98_CHROMATICITIES_Bxyz; } else if (RGB_primaries == "Rec.2020") { RGB_CIExyz[0] = REC2020_CHROMATICITIES_Rxyz; RGB_CIExyz[1] = REC2020_CHROMATICITIES_Gxyz; RGB_CIExyz[2] = REC2020_CHROMATICITIES_Bxyz; } else if (RGB_primaries == "DCI-P3") { RGB_CIExyz[0] = DCIP3_CHROMATICITIES_Rxyz; RGB_CIExyz[1] = DCIP3_CHROMATICITIES_Gxyz; RGB_CIExyz[2] = DCIP3_CHROMATICITIES_Bxyz; } else if (RGB_primaries == "ACES") { RGB_CIExyz[0] = ACES_AP0_CHROMATICITIES_Rxyz; RGB_CIExyz[1] = ACES_AP0_CHROMATICITIES_Gxyz; RGB_CIExyz[2] = ACES_AP0_CHROMATICITIES_Bxyz; } else if (RGB_primaries == "ACEScg") { RGB_CIExyz[0] = ACESCG_AP1_CHROMATICITIES_Rxyz; RGB_CIExyz[1] = ACESCG_AP1_CHROMATICITIES_Gxyz; RGB_CIExyz[2] = ACESCG_AP1_CHROMATICITIES_Bxyz; } else { RGB_CIExyz[0] = RGB_CIExyz[1] = RGB_CIExyz[2] = 0.0; } } color apply_color_management( color input, string eotf, string rgb_primaries, string workingspace_rgb_primaries) { color scene_linear_cms; if (eotf == "Raw") { scene_linear_cms = input; } else if (eotf == "sRGB") { scene_linear_cms = sRGB_EOTF(input); } else if (eotf == "Rec.709") { scene_linear_cms = Rec709_EOTF(input); } else if (eotf == "Gamma 2.2") { scene_linear_cms = gamma_CCTF(input, 2.2); } else if (eotf == "Gamma 2.4") { scene_linear_cms = gamma_CCTF(input, 2.4); } else if (eotf == "Gamma 2.6 (DCI)") { scene_linear_cms = gamma_CCTF(input, DCIP3_GAMMA); } else if (eotf == "Rec.1886") { scene_linear_cms = Rec1886_EOTF(input); } else if (eotf == "Rec.2020") { scene_linear_cms = Rec2020_EOTF(input); } else { #ifdef DEBUG string shadername = ""; getattribute("shader:shadername", shadername); warning("[WARNING]: Unknown OETF mode %s, in %s, %s:%d\n", eotf, shadername, __FILE__, __LINE__); #endif return color(0); } // We're assuming the ingested material is in [0,1] range, if not, // we need to check the extension (*.hdr, *.exr), and bitdepth, and // transform to a log representation, before applying a xform, then // expanding it back. if (rgb_primaries != "Raw" && rgb_primaries != workingspace_rgb_primaries) { scene_linear_cms = transform_colorspace_to_workingspace( scene_linear_cms, rgb_primaries, workingspace_rgb_primaries); } return scene_linear_cms; }
28.725806
80
0.62894
[ "vector", "transform" ]
5810c418706a367565ea8b44a3948d37b0755316
4,086
h
C
source/bundles/index/IndexTaskService.h
izenecloud/sf1r-lite
8de9aa83c38c9cd05a80b216579552e89609f136
[ "Apache-2.0" ]
77
2015-02-12T20:59:20.000Z
2022-03-05T18:40:49.000Z
source/bundles/index/IndexTaskService.h
fytzzh/sf1r-lite
8de9aa83c38c9cd05a80b216579552e89609f136
[ "Apache-2.0" ]
1
2017-04-28T08:55:47.000Z
2017-07-10T10:10:53.000Z
source/bundles/index/IndexTaskService.h
fytzzh/sf1r-lite
8de9aa83c38c9cd05a80b216579552e89609f136
[ "Apache-2.0" ]
33
2015-01-05T03:03:05.000Z
2022-02-06T04:22:46.000Z
#ifndef INDEX_BUNDLE_TASK_SERVICE_H #define INDEX_BUNDLE_TASK_SERVICE_H #include "IndexBundleConfiguration.h" #include <node-manager/sharding/ShardingStrategy.h> #include <aggregator-manager/IndexAggregator.h> #include <directory-manager/DirectoryRotator.h> #include <common/Status.h> #include <common/ScdParser.h> #include <util/driver/Value.h> #include <util/osgi/IService.h> #include <boost/shared_ptr.hpp> namespace sf1r { using izenelib::ir::idmanager::IDManager; class IndexWorker; class DocumentManager; class ScdSharder; class IndexTaskService : public ::izenelib::osgi::IService { public: enum ShardingType { DefaultShard = 0, // disable sending request to sharding node DisableForwardToShard, // disable sending to sharding node and disable sharding SCD on local. // (This means local node will index all of the docs in the given SCD files.) LocalOnly, }; IndexTaskService(IndexBundleConfiguration* bundleConfig); ~IndexTaskService(); bool index(unsigned int numdoc, std::string scd_dir, int disable_sharding_type); bool index(boost::shared_ptr<DocumentManager>& documentManager, int64_t timestamp); bool reindex_from_scd(const std::vector<std::string>& scdlist, int64_t timestamp); bool optimizeIndex(); bool createDocument(const ::izenelib::driver::Value& documentValue); bool updateDocument(const ::izenelib::driver::Value& documentValue); bool updateDocumentInplace(const ::izenelib::driver::Value& request); bool destroyDocument(const ::izenelib::driver::Value& documentValue); bool getIndexStatus(Status& status); bool isAutoRebuild(); std::string getScdDir(bool rebuild) const; izenelib::util::UString::EncodingType getEncode() const; CollectionPath& getCollectionPath() const; boost::shared_ptr<DocumentManager> getDocumentManager() const; void flush(); bool isNeedSharding(); bool HookDistributeRequestForIndex(); const std::vector<shardid_t>& getShardidListForSearch(); bool addNewShardingNodes(const std::vector<shardid_t>& new_sharding_nodes); bool removeShardingNodes(const std::vector<shardid_t>& remove_sharding_nodes); boost::shared_ptr<ShardingStrategy> getShardingStrategy() { return sharding_strategy_; } bool generateMigrateSCD(const std::map<shardid_t, std::vector<vnodeid_t> >& scd_list, std::map<shardid_t, std::string>& generated_insert_scds, std::map<shardid_t, std::string>& generated_del_scds); std::string getShardingMapDir(); bool isNeedDoLocal(); private: bool SendRequestToSharding(uint32_t shardid); bool distributedIndex_(unsigned int numdoc, std::string scd_dir); bool distributedIndexImpl_( unsigned int numdoc, const std::string& collectionName, const std::string& masterScdPath); bool createScdSharder( boost::shared_ptr<ScdSharder>& scdSharder); void updateShardingConfig(const std::vector<shardid_t>& new_sharding_nodes, bool removing = false); bool indexShardingNodes(const std::map<shardid_t, std::vector<std::string> >& generated_migrate_scds); bool doMigrateWork(bool removing, const std::map<vnodeid_t, std::pair<shardid_t, shardid_t> >& migrate_data_list, const std::vector<shardid_t>& migrate_nodes, const std::string& map_file, const std::vector<shardid_t>& current_sharding_map); private: std::string service_; IndexBundleConfiguration* bundleConfig_; boost::shared_ptr<IndexAggregator> indexAggregator_; boost::shared_ptr<IndexWorker> indexWorker_; boost::shared_ptr<ShardingStrategy> sharding_strategy_; boost::shared_ptr<ScdSharder> scdSharder_; std::string sharding_map_dir_; friend class IndexWorkerController; friend class CollectionTaskScheduler; friend class IndexBundleActivator; friend class ProductBundleActivator; }; } #endif
32.688
107
0.716104
[ "vector" ]
581c80342a25e3b9b5e1b03d470e03e781bd0098
1,014
h
C
AGL/SceneRoot.h
wolfprint3d/AlphaGL
d47ed65b529bfb13775de0599499951c8feabbf1
[ "MIT" ]
2
2018-12-19T11:40:16.000Z
2018-12-19T14:15:12.000Z
AGL/SceneRoot.h
wolfprint3d/AlphaGL
d47ed65b529bfb13775de0599499951c8feabbf1
[ "MIT" ]
null
null
null
AGL/SceneRoot.h
wolfprint3d/AlphaGL
d47ed65b529bfb13775de0599499951c8feabbf1
[ "MIT" ]
2
2018-10-18T11:49:04.000Z
2019-12-02T22:35:05.000Z
#pragma once #include "SceneNode.h" #include "Actor.h" // purely for convenience #include "Camera.h" namespace AGL { ///////////////////////////////////////////////////////////////////////////////// /** * @brief Root node of the scenegraph */ class AGL_API SceneRoot : public SceneNode { public: static constexpr SceneNodeType NodeType = SN_RootNode; Color3 BackgroundColor = Color3::White(); /** * The default camera is always created in the scene */ Camera* Camera; /** * Parent camera arm for easily rotating the camera around objects */ SceneNode* CameraArm; explicit SceneRoot(GLCore& core, string sceneName); void Update(float deltaTime) override; void Render(); private: void Render(const Matrix4& parentWorld, const Matrix4& viewProjection) override; }; ///////////////////////////////////////////////////////////////////////////////// }
24.142857
88
0.510848
[ "render" ]
58205c374b00748594fb1dae47f7d35c4252ca81
4,302
h
C
ios/versioned-react-native/ABI40_0_0/ReactNative/ReactCommon/yoga/yoga/ABI40_0_0Yoga-internal.h
ahmadtech199/expo
b35f4713789b48c8ba72d7abe7089e5dfa031c41
[ "Apache-2.0", "MIT" ]
1
2021-06-06T23:56:04.000Z
2021-06-06T23:56:04.000Z
ios/versioned-react-native/ABI40_0_0/ReactNative/ReactCommon/yoga/yoga/ABI40_0_0Yoga-internal.h
ahmadtech199/expo
b35f4713789b48c8ba72d7abe7089e5dfa031c41
[ "Apache-2.0", "MIT" ]
1
2021-02-05T11:31:30.000Z
2021-02-05T12:47:50.000Z
ios/versioned-react-native/ABI40_0_0/ReactNative/ReactCommon/yoga/yoga/ABI40_0_0Yoga-internal.h
ahmadtech199/expo
b35f4713789b48c8ba72d7abe7089e5dfa031c41
[ "Apache-2.0", "MIT" ]
2
2020-10-12T10:58:46.000Z
2021-07-02T10:15:22.000Z
/* * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ #pragma once #include <algorithm> #include <array> #include <cmath> #include <vector> #include "ABI40_0_0CompactValue.h" #include "ABI40_0_0Yoga.h" using ABI40_0_0YGVector = std::vector<ABI40_0_0YGNodeRef>; ABI40_0_0YG_EXTERN_C_BEGIN void ABI40_0_0YGNodeCalculateLayoutWithContext( ABI40_0_0YGNodeRef node, float availableWidth, float availableHeight, ABI40_0_0YGDirection ownerDirection, void* layoutContext); ABI40_0_0YG_EXTERN_C_END namespace ABI40_0_0facebook { namespace yoga { inline bool isUndefined(float value) { return std::isnan(value); } } // namespace yoga } // namespace ABI40_0_0facebook using namespace ABI40_0_0facebook; extern const std::array<ABI40_0_0YGEdge, 4> trailing; extern const std::array<ABI40_0_0YGEdge, 4> leading; extern const ABI40_0_0YGValue ABI40_0_0YGValueUndefined; extern const ABI40_0_0YGValue ABI40_0_0YGValueAuto; extern const ABI40_0_0YGValue ABI40_0_0YGValueZero; struct ABI40_0_0YGCachedMeasurement { float availableWidth; float availableHeight; ABI40_0_0YGMeasureMode widthMeasureMode; ABI40_0_0YGMeasureMode heightMeasureMode; float computedWidth; float computedHeight; ABI40_0_0YGCachedMeasurement() : availableWidth(0), availableHeight(0), widthMeasureMode((ABI40_0_0YGMeasureMode) -1), heightMeasureMode((ABI40_0_0YGMeasureMode) -1), computedWidth(-1), computedHeight(-1) {} bool operator==(ABI40_0_0YGCachedMeasurement measurement) const { bool isEqual = widthMeasureMode == measurement.widthMeasureMode && heightMeasureMode == measurement.heightMeasureMode; if (!yoga::isUndefined(availableWidth) || !yoga::isUndefined(measurement.availableWidth)) { isEqual = isEqual && availableWidth == measurement.availableWidth; } if (!yoga::isUndefined(availableHeight) || !yoga::isUndefined(measurement.availableHeight)) { isEqual = isEqual && availableHeight == measurement.availableHeight; } if (!yoga::isUndefined(computedWidth) || !yoga::isUndefined(measurement.computedWidth)) { isEqual = isEqual && computedWidth == measurement.computedWidth; } if (!yoga::isUndefined(computedHeight) || !yoga::isUndefined(measurement.computedHeight)) { isEqual = isEqual && computedHeight == measurement.computedHeight; } return isEqual; } }; // This value was chosen based on empirical data: // 98% of analyzed layouts require less than 8 entries. #define ABI40_0_0YG_MAX_CACHED_RESULT_COUNT 8 namespace ABI40_0_0facebook { namespace yoga { namespace detail { template <size_t Size> class Values { private: std::array<CompactValue, Size> values_; public: Values() = default; explicit Values(const ABI40_0_0YGValue& defaultValue) noexcept { values_.fill(defaultValue); } const CompactValue& operator[](size_t i) const noexcept { return values_[i]; } CompactValue& operator[](size_t i) noexcept { return values_[i]; } template <size_t I> ABI40_0_0YGValue get() const noexcept { return std::get<I>(values_); } template <size_t I> void set(ABI40_0_0YGValue& value) noexcept { std::get<I>(values_) = value; } template <size_t I> void set(ABI40_0_0YGValue&& value) noexcept { set<I>(value); } bool operator==(const Values& other) const noexcept { for (size_t i = 0; i < Size; ++i) { if (values_[i] != other.values_[i]) { return false; } } return true; } Values& operator=(const Values& other) = default; }; } // namespace detail } // namespace yoga } // namespace ABI40_0_0facebook static const float kDefaultFlexGrow = 0.0f; static const float kDefaultFlexShrink = 0.0f; static const float kWebDefaultFlexShrink = 1.0f; extern bool ABI40_0_0YGFloatsEqual(const float a, const float b); extern ABI40_0_0facebook::yoga::detail::CompactValue ABI40_0_0YGComputedEdgeValue( const ABI40_0_0facebook::yoga::detail::Values< ABI40_0_0facebook::yoga::enums::count<ABI40_0_0YGEdge>()>& edges, ABI40_0_0YGEdge edge, ABI40_0_0facebook::yoga::detail::CompactValue defaultValue);
28.302632
82
0.73152
[ "vector" ]
5828e4255d7ed783b680624e244d50d052e3ef26
3,027
h
C
PathExplorer/MRML/vtkMRMLPathPlannerTrajectoryNode.h
cpinter/SlicerIGT
85265b6f70c1e499d4996e21854581683a874b89
[ "BSD-3-Clause" ]
1
2019-07-10T02:43:48.000Z
2019-07-10T02:43:48.000Z
PathExplorer/MRML/vtkMRMLPathPlannerTrajectoryNode.h
rprueckl/SlicerIGT
00ff9bf070d538d5c713bfc375f544ee4e8033bc
[ "BSD-3-Clause" ]
null
null
null
PathExplorer/MRML/vtkMRMLPathPlannerTrajectoryNode.h
rprueckl/SlicerIGT
00ff9bf070d538d5c713bfc375f544ee4e8033bc
[ "BSD-3-Clause" ]
null
null
null
/*============================================================================== Program: 3D Slicer Portions (c) Copyright Brigham and Women's Hospital (BWH) All Rights Reserved. See COPYRIGHT.txt or http://www.slicer.org/copyright/copyright.txt for details. 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. This file was originally developed by Laurent Chauvin, Brigham and Women's Hospital. The project was supported by grants 5P01CA067165, 5R01CA124377, 5R01CA138586, 2R44DE019322, 7R01CA124377, 5R42CA137886, 8P41EB015898 ==============================================================================*/ #ifndef __vtkMRMLPathPlannerTrajectoryNode_h #define __vtkMRMLPathPlannerTrajectoryNode_h #include "vtkSlicerPathExplorerModuleMRMLExport.h" #include "vtkMRMLAnnotationHierarchyNode.h" class vtkMRMLNode; class vtkMRMLScene; class vtkMRMLAnnotationFiducialNode; class vtkMRMLAnnotationRulerNode; class VTK_SLICER_PATHEXPLORER_MODULE_MRML_EXPORT vtkMRMLPathPlannerTrajectoryNode : public vtkMRMLAnnotationHierarchyNode { public: static vtkMRMLPathPlannerTrajectoryNode *New(); vtkTypeMacro(vtkMRMLPathPlannerTrajectoryNode, vtkMRMLAnnotationHierarchyNode); //-------------------------------------------------------------------------- // MRMLNode methods //-------------------------------------------------------------------------- virtual vtkMRMLNode* CreateNodeInstance(); // Description: // Get node XML tag name (like Volume, Model) virtual const char* GetNodeTagName() {return "PathPlannerTrajectory";}; virtual const char* GetIcon() {return ":/Icons/PathPlannerTrajectory.png";}; // Description: // Read node attributes from XML file virtual void ReadXMLAttributes( const char** atts); // Description: // Write this node's information to a MRML file in XML format. virtual void WriteXML(ostream& of, int indent); virtual void UpdateScene(vtkMRMLScene *scene); // Description: // Copy the node's attributes to this object virtual void Copy(vtkMRMLNode *node); // Description: // alternative method to propagate events generated in Display nodes virtual void ProcessMRMLEvents ( vtkObject * /*caller*/, unsigned long /*event*/, void * /*callData*/ ); protected: vtkMRMLPathPlannerTrajectoryNode(); ~vtkMRMLPathPlannerTrajectoryNode(); vtkMRMLPathPlannerTrajectoryNode(const vtkMRMLPathPlannerTrajectoryNode&); void operator=(const vtkMRMLPathPlannerTrajectoryNode&); typedef std::pair<vtkMRMLAnnotationFiducialNode*, vtkMRMLAnnotationFiducialNode*> FiducialPair; typedef std::map<FiducialPair, vtkMRMLAnnotationRulerNode*> FiducialRuler; FiducialRuler RulerList; }; #endif
36.035714
122
0.68814
[ "object", "model", "3d" ]
582cfa96990ec98b9246aac16924d3b5818ecd96
6,839
h
C
plugins/gui/include/gui/module_model/module_item.h
emsec/HAL
608e801896e1b5254b28ce0f29d4d898b81b0f77
[ "MIT" ]
407
2019-04-26T10:45:52.000Z
2022-03-31T15:52:30.000Z
plugins/gui/include/gui/module_model/module_item.h
emsec/HAL
608e801896e1b5254b28ce0f29d4d898b81b0f77
[ "MIT" ]
219
2019-04-29T16:42:01.000Z
2022-03-11T22:57:41.000Z
plugins/gui/include/gui/module_model/module_item.h
emsec/HAL
608e801896e1b5254b28ce0f29d4d898b81b0f77
[ "MIT" ]
53
2019-05-02T21:23:35.000Z
2022-03-11T19:46:05.000Z
// MIT License // // Copyright (c) 2019 Ruhr University Bochum, Chair for Embedded Security. All Rights reserved. // Copyright (c) 2021 Max Planck Institute for Security and Privacy. All Rights reserved. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in all // copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. #pragma once #include "hal_core/defines.h" #include <QColor> #include <QList> #include <QString> #include <QVariant> namespace hal { /** * @ingroup gui * @brief An item in the ModuleModel. * * The ModuleItem is one item in the ModuleModel item model. It represents one module of the netlist. */ class ModuleItem { public: /** * Constructor. * * @param id - The id of the module this item represents */ ModuleItem(const u32 id); /** * Appends a child ModuleItem to this ModuleItem. * * @param row - The index of the childs of this ModuleItem the new child should be moved to * @param child - The new child to be inserted */ void insertChild(int row, ModuleItem* child); /** * Removes a child ModuleItem from this ModuleItem. * * @param child - The child to remove */ void removeChild(ModuleItem* child); /** * Inserts a child ModuleItem at the end of the children list of this ModuleItem. * * @param child - The child to be appended */ void appendChild(ModuleItem* child); /** * Given a set of ModuleItems (in a map [id]->[ModuleItem]) this function adds each ModuleItem of this set as * a new children if its underlying module is a submodule (child) of the underlying module of this ModuleItem. * * @param moduleMap - A map [id]->[ModuleItem] of children candidates */ void appendExistingChildIfAny(const QMap<u32,ModuleItem*>& moduleMap); /** * Inserts a child ModuleItem at the beginning of the children list of this ModuleItem. * * @param child - The child to be prepended */ void prependChild(ModuleItem* child); /** * Gets the parent ModuleItem of this ModuleItem. * * @returns the parent ModuleItem */ ModuleItem* parent(); /** * Get the child ModuleItem at a certain position in the children list of this ModuleItem. * * @param row - The position in the children list of this ModuleItem * @returns then children ModuleItem at the specified position in the children list */ ModuleItem* child(int row); /** * Gets the parent ModuleItem of this ModuleItem. * * @returns the parent ModuleItem. Returns a constant ModuleItem pointer */ const ModuleItem* constParent() const; /** * Get the child ModuleItem at a certain position in the children list of this ModuleItem. * * @param row - The position in the children list of this ModuleItem * @returns then children ModuleItem at the specified position in the children list. * Returns a constant ModuleItem pointer */ const ModuleItem* constChild(int row) const; /** * Gets the current amount of children of this ModuleItem * * @returns the amount of children */ int childCount() const; /** * Gets the data of this item model item i.e. the name of this ModuleItem if column=1. * * @param column - The column to get the data for * @returns the data in the specified column of this ModuleItem */ QVariant data(int column) const; /** * Gets the index of this ModuleItem in the list of children ModuleItems of its parent. * * @returns the index in the parents ModuleItem children list */ int row() const; /** * Gets the name of the module this ModuleItem represents. * * @returns the modules name */ QString name() const; /** * Gets the id of the module this ModuleItem represents. * * @returns the module id */ u32 id() const; /** * Gets the color of the module this ModuleItem represents. * * @returns the module color */ QColor color() const; /** * Checks if this ModuleItem is currently highlighted. * * @returns <b>true</b> iff this ModuleItem is currently highlighted. */ bool highlighted() const; /** * Sets the parent ModuleItem of this ModuleItem. * * @param parent - The new parent */ void setParent(ModuleItem* parent); /** * Sets the name of this ModuleItem (not the underlying module). * * @param name - The new name */ void set_name(const QString& name); /** * Sets the color of the module this ModuleItem represents. * * @param color - The new color */ void setColor(const QColor& color); /** * Marks/Unmarks this ModuleItem as highlighted. * * @param highlighted - <b>true</b> if the ModuleItem should be marked as highlighted. * <b>false</b> if the ModuleItem should be marked as NOT highlighted. */ void setHighlighted(const bool highlighted); private: ModuleItem* mParent; QList<ModuleItem*> mChildItems; u32 mId; QString mName; QColor mColor; bool mHighlighted; }; }
32.722488
118
0.599795
[ "model" ]
583203e1c5bc8492317fd76bdbf84fd1a8bc2f1f
445
h
C
loadFile.h
jdavidrcamacho/cppRandom
2d19a0d4ab581c36c05f514d9c2abf7b84562fdf
[ "MIT" ]
null
null
null
loadFile.h
jdavidrcamacho/cppRandom
2d19a0d4ab581c36c05f514d9c2abf7b84562fdf
[ "MIT" ]
null
null
null
loadFile.h
jdavidrcamacho/cppRandom
2d19a0d4ab581c36c05f514d9c2abf7b84562fdf
[ "MIT" ]
null
null
null
// loadFile.h file #include <iostream> #include <fstream> #include <tuple> #include <vector> #include <string> #ifndef loadFile_H #define loadFile_H using namespace std; //std::vector<float> loadData(const std::string filename); std::tuple<std::vector<float>, std::vector<float> , std::vector<float>> loadData(const std::string filename); std::vector<float> t, y, yerr; std::vector<float> result; float element1, element2, element3; #endif
21.190476
109
0.734831
[ "vector" ]
5832e45870d575ae1752e1c24872289d71f13f10
2,728
h
C
Plugins/Renderer/gl_light.h
anchurcn/MetaHookSv
8408f57d5abb2109285ed9f7897e3a0776e51c87
[ "MIT" ]
31
2021-01-20T08:12:48.000Z
2022-03-29T16:47:50.000Z
Plugins/Renderer/gl_light.h
anchurcn/MetaHookSv
8408f57d5abb2109285ed9f7897e3a0776e51c87
[ "MIT" ]
118
2021-02-04T17:57:48.000Z
2022-03-31T13:03:21.000Z
Plugins/Renderer/gl_light.h
anchurcn/MetaHookSv
8408f57d5abb2109285ed9f7897e3a0776e51c87
[ "MIT" ]
13
2021-01-21T01:43:19.000Z
2022-03-15T04:51:19.000Z
#pragma once typedef struct light_dynamic_s { int type; vec3_t origin; float color[3]; float distance; float ambient; float diffuse; float specular; float specularpow; }light_dynamic_t; extern std::vector<light_dynamic_t> g_DynamicLights; extern cvar_t *r_light_dynamic; extern cvar_t *r_light_debug; extern MapConVar *r_flashlight_ambient; extern MapConVar *r_flashlight_diffuse; extern MapConVar *r_flashlight_specular; extern MapConVar *r_flashlight_specularpow; extern MapConVar *r_dynlight_ambient; extern MapConVar *r_dynlight_diffuse; extern MapConVar *r_dynlight_specular; extern MapConVar *r_dynlight_specularpow; extern cvar_t *r_ssr; extern MapConVar *r_ssr_ray_step; extern MapConVar *r_ssr_iter_count; extern MapConVar *r_ssr_distance_bias; extern MapConVar *r_ssr_exponential_step; extern MapConVar *r_ssr_adaptive_step; extern MapConVar *r_ssr_binary_search; extern MapConVar *r_ssr_fade; extern bool drawgbuffer; typedef struct { int program; int u_lightdir; int u_lightpos; int u_lightcolor; int u_lightcone; int u_lightradius; int u_lightambient; int u_lightdiffuse; int u_lightspecular; int u_lightspecularpow; int u_modelmatrix; }dlight_program_t; typedef struct { int program; int u_ssrRayStep; int u_ssrIterCount; int u_ssrDistanceBias; int u_ssrFade; }dfinal_program_t; void R_InitLight(void); void R_ShutdownLight(void); bool R_BeginRenderGBuffer(void); void R_EndRenderGBuffer(void); void R_SetGBufferMask(int mask); void R_SetGBufferBlend(int blendsrc, int blenddst); void R_SaveDLightProgramStates(void); void R_SaveDFinalProgramStates(void); void R_LoadDLightProgramStates(void); void R_LoadDFinalProgramStates(void); #define GBUFFER_INDEX_DIFFUSE 0 #define GBUFFER_INDEX_LIGHTMAP 1 #define GBUFFER_INDEX_WORLDNORM 2 #define GBUFFER_INDEX_SPECULAR 3 #define GBUFFER_INDEX_ADDITIVE 4 #define GBUFFER_INDEX_MAX 5 #define GBUFFER_MASK_DIFFUSE (1<<GBUFFER_INDEX_DIFFUSE) #define GBUFFER_MASK_LIGHTMAP (1<<GBUFFER_INDEX_LIGHTMAP) #define GBUFFER_MASK_WORLDNORM (1<<GBUFFER_INDEX_WORLDNORM) #define GBUFFER_MASK_SPECULAR (1<<GBUFFER_INDEX_SPECULAR) #define GBUFFER_MASK_ADDITIVE (1<<GBUFFER_INDEX_ADDITIVE) #define GBUFFER_MASK_ALL (GBUFFER_MASK_DIFFUSE | GBUFFER_MASK_LIGHTMAP | GBUFFER_MASK_WORLDNORM | GBUFFER_MASK_SPECULAR | GBUFFER_MASK_ADDITIVE) #define DLIGHT_SPOT_ENABLED 1 #define DLIGHT_POINT_ENABLED 2 #define DLIGHT_VOLUME_ENABLED 4 #define DFINAL_LINEAR_FOG_ENABLED 1 #define DFINAL_EXP2_FOG_ENABLED 2 #define DFINAL_SSR_ENABLED 4 #define DFINAL_SSR_ADAPTIVE_STEP_ENABLED 8 #define DFINAL_SSR_EXPONENTIAL_STEP_ENABLED 0x10 #define DFINAL_SSR_BINARY_SEARCH_ENABLED 0x20 #define DLIGHT_POINT 0 #define DLIGHT_SPOT 1
27.009901
146
0.831012
[ "vector" ]
5834638e10f8e78c9af9cbec15748a9e01591255
27,080
h
C
Example/Pods/Headers/Public/Mapbox-iOS-SDK@sputnik/RMMapView.h
sputnik-ru/sputnik-maps-ios-sdk
32596b97d470b298f998cc1548956c15424b0eaa
[ "MIT" ]
1
2016-07-19T08:55:59.000Z
2016-07-19T08:55:59.000Z
Example/Pods/Headers/Public/Mapbox-iOS-SDK@sputnik/RMMapView.h
sputnik-ru/sputnik-maps-ios-sdk
32596b97d470b298f998cc1548956c15424b0eaa
[ "MIT" ]
null
null
null
Example/Pods/Headers/Public/Mapbox-iOS-SDK@sputnik/RMMapView.h
sputnik-ru/sputnik-maps-ios-sdk
32596b97d470b298f998cc1548956c15424b0eaa
[ "MIT" ]
null
null
null
// // RMMapView.h // // Copyright (c) 2008-2013, Route-Me Contributors // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are met: // // * Redistributions of source code must retain the above copyright notice, this // list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above copyright notice, // this list of conditions and the following disclaimer in the documentation // and/or other materials provided with the distribution. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // POSSIBILITY OF SUCH DAMAGE. #import <UIKit/UIKit.h> #import <CoreGraphics/CGGeometry.h> #import "RMGlobalConstants.h" #import "RMFoundation.h" #import "RMMapViewDelegate.h" #import "RMTile.h" #import "RMProjection.h" #import "RMMapOverlayView.h" #import "RMMapTiledLayerView.h" #import "RMMapScrollView.h" #import "RMTileSourcesContainer.h" @class RMProjection; @class RMFractalTileProjection; @class RMTileCache; @class RMMapLayer; @class RMMapTiledLayerView; @class RMMapScrollView; @class RMMarker; @class RMAnnotation; @class RMQuadTree; @class RMUserLocation; // constants for the scrollview deceleration mode typedef enum : NSUInteger { RMMapDecelerationNormal = 0, RMMapDecelerationFast = 1, // default RMMapDecelerationOff = 2 } RMMapDecelerationMode; /** An RMMapView object provides an embeddable map interface, similar to the one provided by Apple's MapKit. You use this class to display map information and to manipulate the map contents from your application. You can center the map on a given coordinate, specify the size of the area you want to display, and annotate the map with custom information. * * @warning Please note that you are responsible for getting permission to use the map data, and for ensuring your use adheres to the relevant terms of use. */ @interface RMMapView : UIView /** @name Accessing the Delegate */ /** The receiver's delegate. * * A map view sends messages to its delegate regarding the loading of map data and changes in the portion of the map being displayed. The delegate also manages the annotation layers used to highlight points of interest on the map. * * The delegate should implement the methods of the RMMapViewDelegate protocol. */ @property (nonatomic, weak) IBOutlet id <RMMapViewDelegate>delegate; #pragma mark - View properties /** @name Configuring Map Behavior */ /** A Boolean value that determines whether the user may scroll around the map. * * This property controls only user interactions with the map. If you set the value of this property to `NO`, you may still change the map location programmatically. * * The default value of this property is `YES`. */ @property (nonatomic, assign) BOOL draggingEnabled; /** A Boolean value that determines whether the map view bounces past the edge of content and back again and whether it animates the content scaling when the scaling exceeds the maximum or minimum limits. * * If the value of this property is `YES`, the map view bounces when it encounters a boundary of the content or when zooming exceeds either the maximum or minimum limits for scaling. Bouncing visually indicates that scrolling or zooming has reached an edge of the content. If the value is `NO`, scrolling and zooming stop immediately at the content boundary without bouncing. * * The default value is `NO`. */ @property (nonatomic, assign) BOOL bouncingEnabled; /** A Boolean value that determines whether double-tap zooms of the map always zoom on the center of the map, or whether they zoom on the center of the double-tap gesture. The default value is `NO`, which zooms on the gesture. */ @property (nonatomic, assign) BOOL zoomingInPivotsAroundCenter; /** A custom deceleration mode for the map view for drag operations. Set to `RMMapDecelerationOff` to disable map drag deceleration. The default value is `RMMapDecelerationFast`. */ @property (nonatomic, assign) RMMapDecelerationMode decelerationMode; @property (nonatomic, assign) double metersPerPixel; @property (nonatomic, readonly) double scaledMetersPerPixel; @property (nonatomic, readonly) double scaleDenominator; // The denominator in a cartographic scale like 1/24000, 1/50000, 1/2000000. @property (nonatomic, readonly) float screenScale; /** @name Supporting Retina Displays */ /** A Boolean value that adjusts the display of map tile images for retina-capable screens. * * If set to `YES`, the map tiles are drawn at double size, typically 512 pixels square instead of 256 pixels, in order to compensate for smaller features and to make them more legible. If tiles designed for retina devices are used, this value should be set to `NO` in order to display these tiles at the proper size. The default value is `NO`. */ @property (nonatomic, assign) BOOL adjustTilesForRetinaDisplay; @property (nonatomic, readonly) float adjustedZoomForRetinaDisplay; // takes adjustTilesForRetinaDisplay and screen scale into account /** @name Attributing Map Data */ /** Whether to hide map data attribution for the map view. * * If this is set to NO, a small disclosure button will be added to the lower-right of the map view, allowing the user to tap it to display a modal view showing map data attribution info. The modal presentation uses a page curl animation to reveal the attribution info under the map view. * * The default value is NO, meaning that attribution info will be shown. Please ensure that the terms & conditions of any map data used in your application are satisfied before setting this value to YES. */ @property (nonatomic, assign) BOOL hideAttribution; /** @name Fine-Tuning the Map Appearance */ /** Take missing tiles from lower-numbered zoom levels, up to a given number of zoom levels. This can be used in order to increase perceived tile load performance or to allow zooming in beyond levels supported natively by a given tile source. Defaults to 1. */ @property (nonatomic, assign) NSUInteger missingTilesDepth; /** A custom, static view to use behind the map tiles. The default behavior is to use grid imagery that moves with map panning like MapKit. */ @property (nonatomic, strong) UIView *backgroundView; /** A custom image to use behind the map tiles. The default behavior is to show the default `backgroundView` and not a static image. * * @param backgroundImage The image to use. */ - (void)setBackgroundImage:(UIImage *)backgroundImage; /** A Boolean value indicating whether to draw tile borders and z/x/y numbers on tile images for debugging purposes. Defaults to `NO`. */ @property (nonatomic, assign) BOOL debugTiles; /** A Boolean value indicating whether to show a small logo in the corner of the map view. Defaults to `YES`. */ @property (nonatomic, assign) BOOL showLogoBug; #pragma mark - Initializers /** @name Initializing a Map View */ /** Initialize a map view with a given frame. A default watermarked Mapbox map tile source will be used. * * @param frame The frame with which to initialize the map view. * @return An initialized map view, or `nil` if the map view was unable to be initialized. */ - (id)initWithFrame:(CGRect)frame; /** Initialize a map view with a given frame and tile source. * @param frame The frame with which to initialize the map view. * @param newTilesource The tile source to use for the map tiles. * @return An initialized map view, or `nil` if the map view was unable to be initialized. */ - (id)initWithFrame:(CGRect)frame andTilesource:(id <RMTileSource>)newTilesource; /** Designated initializer. Initialize a map view. * @param frame The map view's frame. * @param newTilesource A tile source to use for the map tiles. * @param initialCenterCoordinate The starting map center coordinate. * @param initialTileSourceZoomLevel The starting map zoom level, clamped to the zoom levels supported by the tile source(s). * @param initialTileSourceMaxZoomLevel The maximum zoom level allowed by the map view, clamped to the zoom levels supported by the tile source(s). * @param initialTileSourceMinZoomLevel The minimum zoom level allowed by the map view, clamped to the zoom levels supported by the tile source(s). * @param backgroundImage A custom background image to use behind the map instead of the default gridded tile background that moves with the map. * @return An initialized map view, or `nil` if a map view was unable to be initialized. */ - (id)initWithFrame:(CGRect)frame andTilesource:(id <RMTileSource>)newTilesource centerCoordinate:(CLLocationCoordinate2D)initialCenterCoordinate zoomLevel:(float)initialTileSourceZoomLevel maxZoomLevel:(float)initialTileSourceMaxZoomLevel minZoomLevel:(float)initialTileSourceMinZoomLevel backgroundImage:(UIImage *)backgroundImage; - (void)setFrame:(CGRect)frame; + (UIImage *)resourceImageNamed:(NSString *)imageName; + (NSString *)pathForBundleResourceNamed:(NSString *)name ofType:(NSString *)extension; #pragma mark - Movement /** @name Panning the Map */ /** The center coordinate of the map view. */ @property (nonatomic, assign) CLLocationCoordinate2D centerCoordinate; /** The center point of the map represented as a projected point. */ @property (nonatomic, assign) RMProjectedPoint centerProjectedPoint; /** Set the map center to a given coordinate. * @param coordinate A coordinate to set as the map center. * @param animated Whether to animate the change to the map center. */ - (void)setCenterCoordinate:(CLLocationCoordinate2D)coordinate animated:(BOOL)animated; /** Set the map center to a given projected point. * @param aPoint A projected point to set as the map center. * @param animated Whether to animate the change to the map center. */ - (void)setCenterProjectedPoint:(RMProjectedPoint)aPoint animated:(BOOL)animated; /** Move the map center by a given delta. * @param delta A `CGSize` by which to move the map center. */ - (void)moveBy:(CGSize)delta; #pragma mark - Zoom /** @name Zooming the Map */ // minimum and maximum zoom number allowed for the view. #minZoom and #maxZoom must be within the limits of #tileSource but can be stricter; they are clamped to tilesource limits (minZoom, maxZoom) if needed. /** The current zoom level of the map. */ @property (nonatomic, assign) float zoom; /** The minimum zoom level of the map, clamped to the range supported by the tile source(s). */ @property (nonatomic, assign) float minZoom; /** The maximum zoom level of the map, clamped to the range supported by the tile source(s). */ @property (nonatomic, assign) float maxZoom; @property (nonatomic, assign) float tileSourcesZoom; @property (nonatomic, assign) float tileSourcesMinZoom; @property (nonatomic, assign) float tileSourcesMaxZoom; @property (nonatomic, assign) RMProjectedRect projectedBounds; @property (nonatomic, readonly) RMProjectedPoint projectedOrigin; @property (nonatomic, readonly) RMProjectedSize projectedViewSize; // recenter the map on #boundsRect, expressed in projected meters - (void)setProjectedBounds:(RMProjectedRect)boundsRect animated:(BOOL)animated; /** Set zoom level, optionally with an animation. * @param newZoom The desired zoom level. * @param animated Whether to animate the map change. */ - (void)setZoom:(float)newZoom animated:(BOOL)animated; /** Set both zoom level and center coordinate at the same time, optionally with an animation. * @param newZoom The desired zoom level. * @param newCenter The desired center coordinate. * @param animated Whether to animate the map change. */ - (void)setZoom:(float)newZoom atCoordinate:(CLLocationCoordinate2D)newCenter animated:(BOOL)animated; /** Zoom the map by a given factor near a certain point. * @param zoomFactor The factor by which to zoom the map. * @param center The point at which to zoom the map. * @param animated Whether to animate the zoom. */ - (void)zoomByFactor:(float)zoomFactor near:(CGPoint)center animated:(BOOL)animated; /** Zoom the map in at the next integral zoom level near a certain point. * @param pivot The point at which to zoom the map. * @param animated Whether to animate the zoom. */ - (void)zoomInToNextNativeZoomAt:(CGPoint)pivot animated:(BOOL)animated; /** Zoom the map out at the next integral zoom level near a certain point. * @param pivot The point at which to zoom the map. * @param animated Whether to animate the zoom. */ - (void)zoomOutToNextNativeZoomAt:(CGPoint)pivot animated:(BOOL)animated; /** Zoom the map to a given latitude and longitude bounds. * @param southWest The southwest point to zoom to. * @param northEast The northeast point to zoom to. * @param animated Whether to animate the zoom. */ - (void)zoomWithLatitudeLongitudeBoundsSouthWest:(CLLocationCoordinate2D)southWest northEast:(CLLocationCoordinate2D)northEast animated:(BOOL)animated; - (float)nextNativeZoomFactor; - (float)previousNativeZoomFactor; - (void)setMetersPerPixel:(double)newMetersPerPixel animated:(BOOL)animated; #pragma mark - Bounds /** @name Querying the Map Bounds */ /** The smallest bounding box containing the entire map view. */ - (RMSphericalTrapezium)latitudeLongitudeBoundingBox; /** The smallest bounding box containing a rectangular region of the map view. * @param rect A rectangular region. */ - (RMSphericalTrapezium)latitudeLongitudeBoundingBoxFor:(CGRect) rect; - (BOOL)tileSourceBoundsContainProjectedPoint:(RMProjectedPoint)point; /** @name Constraining the Map */ /** Contrain zooming and panning of the map view to a given coordinate boundary. * @param southWest The southwest point to constrain to. * @param northEast The northeast point to constrain to. */ - (void)setConstraintsSouthWest:(CLLocationCoordinate2D)southWest northEast:(CLLocationCoordinate2D)northEast; - (void)setProjectedConstraintsSouthWest:(RMProjectedPoint)southWest northEast:(RMProjectedPoint)northEast; #pragma mark - Snapshots /** @name Capturing Snapshots of the Map View */ /** Take a snapshot of the map view. * * By default, the overlay containing any visible annotations is also captured. * @return An image depicting the map view. */ - (UIImage *)takeSnapshot; /** Take a snapshot of the map view. * @param includeOverlay Whether to include the overlay containing any visible annotations. * @return An image depicting the map view. */ - (UIImage *)takeSnapshotAndIncludeOverlay:(BOOL)includeOverlay; #pragma mark - Annotations /** @name Annotating the Map */ /** The annotations currently added to the map. Includes user location annotations, if any. */ @property (nonatomic, weak, readonly) NSArray *annotations; /** The annotations currently visible on the map. May include annotations currently shown in clusters. */ @property (nonatomic, weak, readonly) NSArray *visibleAnnotations; /** Add an annotation to the map. * @param annotation The annotation to add. */ - (void)addAnnotation:(RMAnnotation *)annotation; /** Add one or more annotations to the map. * @param annotations An array containing the annotations to add to the map. */ - (void)addAnnotations:(NSArray *)annotations; /** Remove an annotation from the map. * @param annotation The annotation to remove. */ - (void)removeAnnotation:(RMAnnotation *)annotation; /** Remove one or more annotations from the map. * @param annotations An array containing the annotations to remove from the map. */ - (void)removeAnnotations:(NSArray *)annotations; /** Remove all annotations from the map. This does not remove user location annotations, if any. */ - (void)removeAllAnnotations; /** The relative map position for a given annotation. * @param annotation The annotation for which to return the current position. * @return The screen position of the annotation. */ - (CGPoint)mapPositionForAnnotation:(RMAnnotation *)annotation; /** Selects the specified annotation and displays a callout view for it. * * If the specified annotation is not onscreen, and therefore does not have an associated annotation layer, this method has no effect. * @param annotation The annotation object to select. * @param animated If `YES`, the callout view is animated into position. */ - (void)selectAnnotation:(RMAnnotation *)annotation animated:(BOOL)animated; /** Deselects the specified annotation and hides its callout view. * @param annotation The annotation object to deselect. * @param animated If `YES`, the callout view is animated offscreen. */ - (void)deselectAnnotation:(RMAnnotation *)annotation animated:(BOOL)animated; /** The annotation that is currently selected. */ @property (nonatomic, strong) RMAnnotation *selectedAnnotation; #pragma mark - TileSources @property (nonatomic, strong) RMQuadTree *quadTree; /** @name Configuring Annotation Clustering */ /** Whether to enable clustering of map point annotations. Defaults to `NO`. */ @property (nonatomic, assign) BOOL clusteringEnabled; /** Whether to order markers on the z-axis according to increasing y-position. Defaults to `YES`. * * @warning This property has been deprecated in favor of [RMMapViewDelegate annotationSortingComparatorForMapView:]. */ @property (nonatomic, assign) BOOL orderMarkersByYPosition DEPRECATED_MSG_ATTRIBUTE("use -[RMMapViewDelegate annotationSortingComparatorForMapView:] for annotation sorting"); /** Whether to position cluster markers at the weighted center of the points they represent. If `YES`, position clusters in weighted fashion. If `NO`, position them on a rectangular grid. Defaults to `YES`. */ @property (nonatomic, assign) BOOL positionClusterMarkersAtTheGravityCenter; /** Whether to order cluster markers above non-clustered markers. Defaults to `YES`. * * @warning This property has been deprecated in favor of [RMMapViewDelegate annotationSortingComparatorForMapView:]. */ @property (nonatomic, assign) BOOL orderClusterMarkersAboveOthers DEPRECATED_MSG_ATTRIBUTE("use -[RMMapViewDelegate annotationSortingComparatorForMapView:] for annotation sorting"); @property (nonatomic, assign) CGSize clusterMarkerSize; @property (nonatomic, assign) CGSize clusterAreaSize; @property (nonatomic, weak, readonly) RMTileSourcesContainer *tileSourcesContainer; /** @name Managing Tile Sources */ /** The first tile source of a map view, ordered from bottom to top. */ @property (nonatomic, strong) id <RMTileSource> tileSource; /** All of the tile sources for a map view, ordered bottom to top. */ @property (nonatomic, strong) NSArray *tileSources; /** Add a tile source to a map view above the current tile sources. * @param tileSource The tile source to add. */ - (void)addTileSource:(id <RMTileSource>)tileSource; /** Add a tile source to a map view at a given index. * @param tileSource The tile source to add. * @param index The index at which to add the tile source. A value of zero adds the tile source below all other tile sources. */ - (void)addTileSource:(id<RMTileSource>)tileSource atIndex:(NSUInteger)index; /** Remove a tile source from the map view. * @param tileSource The tile source to remove. */ - (void)removeTileSource:(id <RMTileSource>)tileSource; /** Remove the tile source at a given index from the map view. * @param index The index of the tile source to remove. */ - (void)removeTileSourceAtIndex:(NSUInteger)index; /** Move the tile source at one index to another index. * @param fromIndex The index of the tile source to move. * @param toIndex The destination index for the tile source. */ - (void)moveTileSourceAtIndex:(NSUInteger)fromIndex toIndex:(NSUInteger)toIndex; /** Hide or show a tile source. * @param isHidden A Boolean indicating whether to hide the tile source or not. * @param tileSource The tile source to hide or show. */ - (void)setHidden:(BOOL)isHidden forTileSource:(id <RMTileSource>)tileSource; /** Hide or show a tile source at a given index. * @param isHidden A Boolean indicating whether to hide the tile source or not. * @param index The index of the tile source to hide or show. */ - (void)setHidden:(BOOL)isHidden forTileSourceAtIndex:(NSUInteger)index; /** Change a tile source's alpha value. * @param alpha The desired alpha value. * @param tileSource The tile source to change. */ - (void)setAlpha:(CGFloat)alpha forTileSource:(id <RMTileSource>)tileSource; /** Change the alpha value of a tile source at a given index. * @param alpha The desired alpha value. * @param index The index of the tile source to change. */ - (void)setAlpha:(CGFloat)alpha forTileSourceAtIndex:(NSUInteger)index; /** Reload the tiles for a given tile source. * @param tileSource The tile source to reload. */ - (void)reloadTileSource:(id <RMTileSource>)tileSource; /** Reload the tiles for a tile source at a given index. * @param index The index of the tile source to reload. */ - (void)reloadTileSourceAtIndex:(NSUInteger)index; #pragma mark - Cache /** @name Managing Tile Caching Behavior */ /** The tile cache for the map view, typically composed of both an in-memory RMMemoryCache and a disk-based RMDatabaseCache. */ @property (nonatomic, strong) RMTileCache *tileCache; /** Clear all tile images from the caching system. */ -(void)removeAllCachedImages; #pragma mark - Conversions // projections to convert from latitude/longitude to meters, from projected meters to tile coordinates @property (nonatomic, weak, readonly) RMProjection *projection; @property (nonatomic, weak, readonly) id <RMMercatorToTileProjection> mercatorToTileProjection; /** @name Converting Map Coordinates */ /** Convert a projected point to a screen location. * @param projectedPoint The projected point to convert. * @return The equivalent screen location. */ - (CGPoint)projectedPointToPixel:(RMProjectedPoint)projectedPoint; /** Convert a coordinate to a screen location. * @param coordinate The coordinate to convert. * @return The equivalent screen location. */ - (CGPoint)coordinateToPixel:(CLLocationCoordinate2D)coordinate; /** Convert a screen location to a projected point. * @param pixelCoordinate A screen location to convert. * @return The equivalent projected point. */ - (RMProjectedPoint)pixelToProjectedPoint:(CGPoint)pixelCoordinate; /** Convert a screen location to a coordinate. * @param pixelCoordinate A screen location to convert. * @return The equivalent coordinate. */ - (CLLocationCoordinate2D)pixelToCoordinate:(CGPoint)pixelCoordinate; /** Convert a coordiante to a projected point. * @param coordinate A coordinate to convert. * @return The equivalent projected point. */ - (RMProjectedPoint)coordinateToProjectedPoint:(CLLocationCoordinate2D)coordinate; /** Convert a projected point to a coordinate. * @param projectedPoint A projected point to convert. * @return The equivalent coordinate. */ - (CLLocationCoordinate2D)projectedPointToCoordinate:(RMProjectedPoint)projectedPoint; - (RMProjectedSize)viewSizeToProjectedSize:(CGSize)screenSize; - (CGSize)projectedSizeToViewSize:(RMProjectedSize)projectedSize; - (CLLocationCoordinate2D)normalizeCoordinate:(CLLocationCoordinate2D)coordinate; - (RMTile)tileWithCoordinate:(CLLocationCoordinate2D)coordinate andZoom:(int)zoom; /** Return the bounding box for a given map tile. * @param aTile A map tile. * @return The bounding box for the tile in the current projection. */ - (RMSphericalTrapezium)latitudeLongitudeBoundingBoxForTile:(RMTile)aTile; #pragma mark - #pragma mark User Location /** @name Tracking the User Location */ /** A Boolean value indicating whether the map may display the user location. * * This property does not indicate whether the user’s position is actually visible on the map, only whether the map view is allowed to display it. To determine whether the user’s position is visible, use the userLocationVisible property. The default value of this property is `NO`. * * Setting this property to `YES` causes the map view to use the Core Location framework to find the current location. As long as this property is `YES`, the map view continues to track the user’s location and update it periodically. * * On iOS 8 and above, your app must specify a value for `NSLocationWhenInUseUsageDescription` in its `Info.plist` to satisfy the requirements of the underlying Core Location framework when enabling this property. */ @property (nonatomic, assign) BOOL showsUserLocation; /** The annotation object representing the user’s current location. (read-only) */ @property (nonatomic, readonly) RMUserLocation *userLocation; /** A Boolean value indicating whether the device’s current location is visible in the map view. (read-only) * * This property uses the horizontal accuracy of the current location to determine whether the user’s location is visible. Thus, this property is `YES` if the specific coordinate is offscreen but the rectangle surrounding that coordinate (and defined by the horizontal accuracy value) is partially onscreen. * * If the user’s location cannot be determined, this property contains the value `NO`. */ @property (nonatomic, readonly, getter=isUserLocationVisible) BOOL userLocationVisible; /** The mode used to track the user location. */ @property (nonatomic, assign) RMUserTrackingMode userTrackingMode; /** Whether the map view should display a heading calibration alert when necessary. The default value is `YES`. */ @property (nonatomic, assign) BOOL displayHeadingCalibration; /** Set the mode used to track the user location. * * Setting the tracking mode to `RMUserTrackingModeFollow` or `RMUserTrackingModeFollowWithHeading` causes the map view to center the map on that location and begin tracking the user’s location. If the map is zoomed out, the map view automatically zooms in on the user’s location, effectively changing the current visible region. * * On iOS 8 and above, your app must specify a value for `NSLocationWhenInUseUsageDescription` in its `Info.plist` to satisfy the requirements of the underlying Core Location framework when tracking the user location. * * @param mode The mode used to track the user location. * @param animated Whether changes to the map center or rotation should be animated when the mode is changed. */ - (void)setUserTrackingMode:(RMUserTrackingMode)mode animated:(BOOL)animated; @end
50.522388
376
0.767799
[ "object" ]
5836a9fb1f54f85e9024a4415273e759175a4574
2,466
h
C
client/src/packet_reader.h
satyamedh/craftassist
d97cbc14bc25149d3ef41737231ab9f3cb7e392a
[ "MIT" ]
1
2019-10-04T02:09:58.000Z
2019-10-04T02:09:58.000Z
client/src/packet_reader.h
satyamedh/craftassist
d97cbc14bc25149d3ef41737231ab9f3cb7e392a
[ "MIT" ]
null
null
null
client/src/packet_reader.h
satyamedh/craftassist
d97cbc14bc25149d3ef41737231ab9f3cb7e392a
[ "MIT" ]
1
2020-03-29T20:04:11.000Z
2020-03-29T20:04:11.000Z
// Copyright (c) Facebook, Inc. and its affiliates. #pragma once #include <set> #include <string> #include <thread> #include <utility> #include <vector> #include "encoder.h" #include "event.h" #include "types.h" class PacketReader { public: PacketReader() {} PacketReader(int sock, EventHandler* eventHandler); std::thread startThread(); private: int readPacket(); int varintFromStream(long* v); void bufferExactly(uint8_t* buf, unsigned long n); uint8_t next(); uint8_t peek(); void skip(unsigned long n); void skipRest(); std::vector<uint8_t> next(unsigned long n); uint64_t readBigEndian(int n); // Decode types long readVarint(); std::string readString(); uint8_t readByte() { return next(); } bool readBool() { return next() != 0; } uint16_t readUint16() { return readBigEndian(2); } int16_t readInt16() { return readBigEndian(2); } uint32_t readUint32() { return readBigEndian(4); } int32_t readInt32() { return readBigEndian(4); } uint64_t readUint64() { return readBigEndian(8); } int64_t readInt64() { return readBigEndian(8); } float readFloat(); double readDouble(); float readAngle() { return (float)readByte() * 360 / 256; } std::string readUuid(); BlockPos readPosition(); Pos readDeltaPos(); Block readBlock(); std::string readChat(); Slot readSlot(); // Packets void setCompression(); void loginSuccess(); void keepAlive(); void joinGame(); void spawnPosition(); void chunkData(); void playerPositionAndLook(); void blockChange(); void multiBlockChange(); void chatMessage(); void playerListItem(); void spawnPlayer(); void entityRelativeMove(); void entityLookAndRelativeMove(); void entityTeleport(); void openWindow(); void windowItems(); void setSlot(); void entityLook(); void entityHeadLook(); void serverDifficulty(); void spawnMob(); void updateHealth(); void confirmTransaction(); void entityEquipment(); // Packet subcomponents (helpers) ChunkSectionBlocks chunkSectionBlocks(); std::vector<std::pair<std::string, std::string>> playerListItemsAddPlayer(int n); // Fields int socket_; EventHandler* eventHandler_; std::vector<uint8_t> data_; std::set<int> ignoredPids_; size_t data_off_ = 0; int threshold_ = 0; bool inPlayState_ = false; // false=login, true=play state }; class ExitGracefully : std::runtime_error { public: ExitGracefully(char const* what) : runtime_error(what) {} };
25.163265
83
0.699108
[ "vector" ]
5838d973b33fa88de53968e2ab9d643dc6345834
4,119
h
C
Gems/AtomLyIntegration/CommonFeatures/Code/Source/Material/EditorMaterialModelUvNameMapInspector.h
cypherdotXd/o3de
bb90c4ddfe2d495e9c00ebf1e2650c6d603a5676
[ "Apache-2.0", "MIT" ]
11
2021-07-08T09:58:26.000Z
2022-03-17T17:59:26.000Z
Gems/AtomLyIntegration/CommonFeatures/Code/Source/Material/EditorMaterialModelUvNameMapInspector.h
RoddieKieley/o3de
e804fd2a4241b039a42d9fa54eaae17dc94a7a92
[ "Apache-2.0", "MIT" ]
29
2021-07-06T19:33:52.000Z
2022-03-22T10:27:49.000Z
Gems/AtomLyIntegration/CommonFeatures/Code/Source/Material/EditorMaterialModelUvNameMapInspector.h
RoddieKieley/o3de
e804fd2a4241b039a42d9fa54eaae17dc94a7a92
[ "Apache-2.0", "MIT" ]
4
2021-07-06T19:24:43.000Z
2022-03-31T12:42:27.000Z
/* * Copyright (c) Contributors to the Open 3D Engine Project. * For complete copyright and license terms please see the LICENSE at the root of this distribution. * * SPDX-License-Identifier: Apache-2.0 OR MIT * */ #pragma once #if !defined(Q_MOC_RUN) #include <AzCore/std/string/string.h> #include <AzCore/std/containers/vector.h> #include <AzCore/Asset/AssetCommon.h> #include <Atom/Feature/Material/MaterialAssignment.h> #include <Atom/RPI.Edit/Material/MaterialSourceData.h> #include <Atom/RPI.Edit/Material/MaterialTypeSourceData.h> #include <Atom/RPI.Reflect/Material/MaterialAsset.h> #include <AzCore/std/containers/unordered_map.h> #include <AzToolsFramework/UI/PropertyEditor/PropertyEditorAPI_Internals.h> #include <AtomToolsFramework/DynamicProperty/DynamicPropertyGroup.h> #include <AtomToolsFramework/Inspector/InspectorWidget.h> #endif namespace AZ { namespace Render { namespace EditorMaterialComponentInspector { using MaterialModelUvOverrideMapChangedCallBack = AZStd::function<void(const RPI::MaterialModelUvOverrideMap&)>; class MaterialModelUvNameMapInspector : public AtomToolsFramework::InspectorWidget , public AzToolsFramework::IPropertyEditorNotify { Q_OBJECT public: AZ_CLASS_ALLOCATOR(MaterialModelUvNameMapInspector, AZ::SystemAllocator, 0); explicit MaterialModelUvNameMapInspector( const AZ::Data::AssetId& assetId, const RPI::MaterialModelUvOverrideMap& matModUvOverrides, const AZStd::unordered_set<AZ::Name>& modelUvNames, MaterialModelUvOverrideMapChangedCallBack matModUvOverrideMapChangedCallBack, QWidget* parent = nullptr ); ~MaterialModelUvNameMapInspector() override; //! AtomToolsFramework::InspectorRequestBus::Handler overrides... void Reset() override; void Populate(); void SetUvNameMap(const RPI::MaterialModelUvOverrideMap& matModUvPairs); private: //! AzToolsFramework::IPropertyEditorNotify overrides... void BeforePropertyModified(AzToolsFramework::InstanceDataNode* pNode) override; void AfterPropertyModified(AzToolsFramework::InstanceDataNode* pNode) override; void SetPropertyEditingActive([[maybe_unused]] AzToolsFramework::InstanceDataNode* pNode) override {} void SetPropertyEditingComplete(AzToolsFramework::InstanceDataNode* pNode) override; void SealUndoStack() override {} void RequestPropertyContextMenu([[maybe_unused]] AzToolsFramework::InstanceDataNode*, const QPoint&) override {} void PropertySelectionChanged([[maybe_unused]] AzToolsFramework::InstanceDataNode*, bool) override {} void ResetModelUvNameIndices(); void SetModelUvNames(const AZStd::unordered_set<AZ::Name>& modelUvNames); RPI::MaterialModelUvOverrideMap m_matModUvOverrides; AZStd::vector<uint32_t> m_modelUvNameIndices; //! Used to index enum values and translate to UV pairs. RPI::MaterialUvNameMap m_materialUvNames; AZStd::vector<AZStd::string> m_modelUvNames; //! Used as enum values. MaterialModelUvOverrideMapChangedCallBack m_matModUvOverrideMapChangedCallBack; AtomToolsFramework::DynamicPropertyGroup m_group; const AtomToolsFramework::DynamicProperty* m_activeProperty = nullptr; }; bool OpenInspectorDialog( const AZ::Data::AssetId& assetId, const RPI::MaterialModelUvOverrideMap& matModUvOverrides, const AZStd::unordered_set<AZ::Name>& modelUvNames, MaterialModelUvOverrideMapChangedCallBack matModUvOverrideMapChangedCallBack); } // namespace EditorMaterialComponentInspector } // namespace Render } // namespace AZ
45.263736
128
0.682204
[ "render", "vector", "3d" ]
583cda3b1d4dbc30044d434a2f5814d57f1c534c
140,111
c
C
raspberry/nfc_deamon/SW369321/NxpNfcRdLib/comps/phalMfNtag42XDna/src/Sw/phalMfNtag42XDna_Sw_Int.c
ccruzp/drs-netatmo
87d178364dbc8c1e7259a9d7d202c9f1c86b6d2f
[ "MIT" ]
2
2019-11-08T12:45:38.000Z
2019-11-09T16:31:12.000Z
raspberry/nfc_deamon/SW369321/NxpNfcRdLib/comps/phalMfNtag42XDna/src/Sw/phalMfNtag42XDna_Sw_Int.c
ccruzp/drs-netatmo
87d178364dbc8c1e7259a9d7d202c9f1c86b6d2f
[ "MIT" ]
null
null
null
raspberry/nfc_deamon/SW369321/NxpNfcRdLib/comps/phalMfNtag42XDna/src/Sw/phalMfNtag42XDna_Sw_Int.c
ccruzp/drs-netatmo
87d178364dbc8c1e7259a9d7d202c9f1c86b6d2f
[ "MIT" ]
2
2019-11-07T21:56:59.000Z
2019-11-08T02:20:59.000Z
/* * Copyright 2016-2019, NXP * * All rights are reserved. Reproduction in whole or in part is * prohibited without the written consent of the copyright owner. * NXP reserves the right to make changes without notice at any time. * NXP makes no warranty, expressed, implied or statutory, including but * not limited to any implied warranty of merchantability or fitness for any *particular purpose, or that the use will not infringe any third party patent, * copyright or trademark. NXP must not be liable for any loss or damage * arising from its use. */ #include <ph_Status.h> #include <phpalMifare.h> #include <phpalI14443p4.h> #include <ph_RefDefs.h> #include <ph_TypeDefs.h> #include <phTools.h> #include <string.h> #ifdef NXPBUILD__PH_CRYPTOSYM #include <phCryptoSym.h> #include <phCryptoRng.h> #endif /* NXPBUILD__PH_CRYPTOSYM */ #include <phKeyStore.h> #include <phTMIUtils.h> #include <phalVca.h> #ifdef NXPBUILD__PHAL_MFNTAG42XDNA_SW #include "../phalMfNtag42XDna_Int.h" #include "phalMfNtag42XDna_Sw_Int.h" phStatus_t phalMfNtag42XDna_Sw_Int_GetData(phalMfNtag42XDna_Sw_DataParams_t * pDataParams, uint8_t * pSendBuff, uint16_t wCmdLen, uint8_t ** pResponse, uint16_t * pRxlen) { uint8_t PH_MEMLOC_REM * pRecv; phStatus_t PH_MEMLOC_REM statusTmp = 0; uint8_t PH_MEMLOC_REM bStatusByte = 0xFF; uint8_t PH_MEMLOC_REM bCmdBuff[10]; uint16_t PH_MEMLOC_REM wNextPos = 0; uint16_t PH_MEMLOC_REM wRxBufferSize = 0; uint8_t PH_MEMLOC_REM bBackupBytes[3]; uint8_t PH_MEMLOC_REM pApdu[5] = { PHAL_MFNTAG42XDNA_WRAPPEDAPDU_CLA, 0x00, PHAL_MFNTAG42XDNA_WRAPPEDAPDU_P1, PHAL_MFNTAG42XDNA_WRAPPEDAPDU_P2, 0x00 }; uint8_t PH_MEMLOC_REM bBackUpByte; uint8_t PH_MEMLOC_REM bBackUpByte1; uint16_t PH_MEMLOC_REM wBackUpLen; uint16_t PH_MEMLOC_REM wTmp = 0; /* Status and two other bytes to be backed up before getting new frame of data */ memset(bBackupBytes, 0x00, 3); /* PRQA S 3200 */ PH_CHECK_SUCCESS_FCT(statusTmp, phhalHw_GetConfig( pDataParams->pHalDataParams, PHHAL_HW_CONFIG_RXBUFFER_STARTPOS, &wTmp )); if (wCmdLen > PHAL_MFNTAG42XDNA_MAXWRAPPEDAPDU_SIZE) { return PH_ADD_COMPCODE_FIXED(PH_ERR_BUFFER_OVERFLOW, PH_COMP_AL_MFNTAG42XDNA); } pApdu[1] = pSendBuff[0]; /* Desfire command code. */ /* Encode APDU Length*/ pApdu[4]= (uint8_t)wCmdLen - 1; /* Set APDU Length. */ statusTmp = phpalMifare_ExchangeL4( pDataParams->pPalMifareDataParams, pApdu[4] == 0x00 ? PH_EXCHANGE_DEFAULT : PH_EXCHANGE_BUFFER_FIRST, pApdu, PHAL_MFNTAG42XDNA_WRAP_HDR_LEN, &pRecv, pRxlen ); if ((pApdu[4] != 0x00) && (statusTmp == PH_ERR_SUCCESS)) { PH_CHECK_SUCCESS_FCT(statusTmp, phpalMifare_ExchangeL4( pDataParams->pPalMifareDataParams, PH_EXCHANGE_BUFFER_CONT, &pSendBuff[1], wCmdLen - 1, &pRecv, pRxlen )); statusTmp = phpalMifare_ExchangeL4( pDataParams->pPalMifareDataParams, PH_EXCHANGE_BUFFER_LAST, &pApdu[2], 0x01, &pRecv, pRxlen ); } /* To handle the case where the card returns only status 91 and returns AF in the next frame */ if ((statusTmp & PH_ERR_MASK) == PH_ERR_SUCCESS_CHAINING) { if (*pRxlen == 2) { /* AF should always be accompanied by data. Otherwise it is a protocol error */ return PH_ADD_COMPCODE_FIXED(PH_ERR_PROTOCOL_ERROR, PH_COMP_AL_MFNTAG42XDNA); } /* One more status byte to read from DesFire */ bBackUpByte = pRecv[0]; bBackUpByte1 = pRecv[1]; wBackUpLen = *pRxlen; PH_CHECK_SUCCESS_FCT(statusTmp, phpalMifare_ExchangeL4( pDataParams->pPalMifareDataParams, PH_EXCHANGE_RXCHAINING, &pApdu[2], 0x01, &pRecv, pRxlen )); /* Received length can be one or two Ex: 0x91 0xAF */ if (*pRxlen == 2) { pRecv[wBackUpLen] = pRecv[0]; pRecv[wBackUpLen + 1] = pRecv[1]; bStatusByte = pRecv[1]; } else if (*pRxlen == 1) { bStatusByte = pRecv[0]; pRecv[wBackUpLen] = bStatusByte; } else { return PH_ADD_COMPCODE_FIXED(PH_ERR_PROTOCOL_ERROR, PH_COMP_AL_MFNTAG42XDNA); } *pRxlen = wBackUpLen + *pRxlen; /* Set back the backed up bytes */ pRecv[0] = bBackUpByte; pRecv[1] = bBackUpByte1; } else { if (statusTmp != PH_ERR_SUCCESS) { return statusTmp; } } /* Storing the original pointer */ *pResponse = pRecv; /* Status is 0xAF or 0x00? */ if (*pRxlen > 0x0000) { bStatusByte = (*pResponse)[(*pRxlen) - 1]; } if (bStatusByte == PHAL_MFNTAG42XDNA_RESP_ADDITIONAL_FRAME) { if (*pRxlen == 2) { /* AF should always be accompanied by data. Otherwise it is a protocol error */ return PH_ADD_COMPCODE_FIXED(PH_ERR_PROTOCOL_ERROR, PH_COMP_AL_MFNTAG42XDNA); } /* Next position will ensure overwriting on the SW1SW2 received from previous command */ wNextPos = (*pRxlen) - 2; memcpy(bBackupBytes, &(*pResponse)[wNextPos - 3], 3); /* PRQA S 3200 */ PH_CHECK_SUCCESS_FCT(statusTmp,phhalHw_GetConfig( pDataParams->pHalDataParams, PHHAL_HW_CONFIG_RXBUFFER_BUFSIZE, &wRxBufferSize )); } while (bStatusByte == PHAL_MFNTAG42XDNA_RESP_ADDITIONAL_FRAME) { if ((*pRxlen == 2)) { /* AF should always be accompanied by data. Otherwise it is a protocol error */ return PH_ADD_COMPCODE_FIXED(PH_ERR_PROTOCOL_ERROR, PH_COMP_AL_MFNTAG42XDNA); } if (wNextPos + PHAL_MFNTAG42XDNA_MAX_FRAME_SIZE >= wRxBufferSize) { /* Return 0xAF and let the caller recall the function with option = PH_EXCHANGE_RXCHAINING */ /* Return the data accumulated till now and its length */ (*pRxlen) -= 2; return PH_ADD_COMPCODE_FIXED(PH_ERR_SUCCESS_CHAINING, PH_COMP_AL_MFNTAG42XDNA); } PH_CHECK_SUCCESS_FCT(statusTmp, phhalHw_SetConfig(pDataParams->pHalDataParams, PHHAL_HW_CONFIG_RXBUFFER_STARTPOS, wNextPos )); bCmdBuff[0] = PHAL_MFNTAG42XDNA_RESP_ADDITIONAL_FRAME; wCmdLen = 1; pApdu[1] = bCmdBuff[0]; /* Desfire command code. */ /* Encode APDU Length*/ pApdu[4]= (uint8_t)wCmdLen - 1; /* Set APDU Length. */ statusTmp = phpalMifare_ExchangeL4( pDataParams->pPalMifareDataParams, pApdu[4] == 0x00 ? PH_EXCHANGE_DEFAULT : PH_EXCHANGE_BUFFER_FIRST, pApdu, PHAL_MFNTAG42XDNA_WRAP_HDR_LEN, &pRecv, pRxlen ); if ((pApdu[4] != 0x00) && (statusTmp == PH_ERR_SUCCESS)) { PH_CHECK_SUCCESS_FCT(statusTmp, phpalMifare_ExchangeL4( pDataParams->pPalMifareDataParams, PH_EXCHANGE_BUFFER_CONT, bCmdBuff, wCmdLen, &pRecv, pRxlen )); bCmdBuff[0] = 0x00; /* Le */ statusTmp = phpalMifare_ExchangeL4( pDataParams->pPalMifareDataParams, PH_EXCHANGE_BUFFER_LAST, bCmdBuff, 0x01, &pRecv, pRxlen ); } /* To handle the case where the card returns only status 91 and returns AF in the next frame */ if ((statusTmp & PH_ERR_MASK) == PH_ERR_SUCCESS_CHAINING) { /* One or two more status bytes to read from DesFire */ bBackUpByte = pRecv[0]; bBackUpByte1 = pRecv[1]; wBackUpLen = *pRxlen; PH_CHECK_SUCCESS_FCT(statusTmp, phpalMifare_ExchangeL4( pDataParams->pPalMifareDataParams, PH_EXCHANGE_RXCHAINING, &pApdu[2], 0x01, &pRecv, pRxlen )); /* Received length can be one or two Ex: 0x91 0xAF */ if (*pRxlen == 2) { pRecv[wBackUpLen] = pRecv[0]; pRecv[wBackUpLen + 1] = pRecv[1]; bStatusByte = pRecv[1]; } else if (*pRxlen == 1) { bStatusByte = pRecv[0]; pRecv[wBackUpLen] = bStatusByte; } else { return PH_ADD_COMPCODE_FIXED(PH_ERR_PROTOCOL_ERROR, PH_COMP_AL_MFNTAG42XDNA); } *pRxlen = wBackUpLen + *pRxlen; /* Set back the backed up bytes */ pRecv[0] = bBackUpByte; pRecv[1] = bBackUpByte1; } else { if (statusTmp != PH_ERR_SUCCESS) { return statusTmp; } } bStatusByte = (*pResponse)[(*pRxlen) - 1]; /* Putback the backed up bytes */ memcpy(&(*pResponse)[wNextPos - 3], bBackupBytes, 3); /* PRQA S 3200 */ wNextPos = (*pRxlen) - 2; memcpy(bBackupBytes, &(*pResponse)[wNextPos - 3], 3); /* PRQA S 3200 */ } (*pRxlen) -= 2; return phalMfNtag42XDna_Int_ComputeErrorResponse(pDataParams, bStatusByte); } phStatus_t phalMfNtag42XDna_Sw_Int_ISOGetData(phalMfNtag42XDna_Sw_DataParams_t * pDataParams, uint8_t * pSendBuff, uint16_t wCmdLen, uint8_t ** pResponse, uint16_t * pRxlen) { uint8_t PH_MEMLOC_REM * pRecv; phStatus_t PH_MEMLOC_REM statusTmp = 0; phStatus_t PH_MEMLOC_REM status = 0; uint8_t PH_MEMLOC_REM bCmdBuff[10]; uint8_t PH_MEMLOC_REM bApduLen = 4; /* Initializing with 4 since Length of the Data(Lc) starts from 4th element of pApdu[] */ uint16_t PH_MEMLOC_REM wNextPos = 0; uint16_t PH_MEMLOC_REM wRxBufferSize = 0; uint8_t PH_MEMLOC_REM bBackupBytes[3]; uint8_t PH_MEMLOC_REM pApdu[7] = { PHAL_MFNTAG42XDNA_WRAPPEDAPDU_CLA, 0x00, PHAL_MFNTAG42XDNA_WRAPPEDAPDU_P1, PHAL_MFNTAG42XDNA_WRAPPEDAPDU_P2, 0x00,/* Extended Length Apdu */ 0x00, 0x00 }; uint8_t PH_MEMLOC_REM bLe[2] = { 0x00, 0x00 }; uint8_t PH_MEMLOC_REM bExtendedLenApdu = 0; uint16_t PH_MEMLOC_REM wFSD = 0; uint16_t PH_MEMLOC_REM wFSC = 0; uint16_t PH_MEMLOC_REM wTmp = 0; uint16_t pValue; /* Status and two other bytes to be backed up before getting new frame of data */ memset(bBackupBytes, 0x00, 3); /* PRQA S 3200 */ PH_CHECK_SUCCESS_FCT(statusTmp, phhalHw_GetConfig( pDataParams->pHalDataParams, PHHAL_HW_CONFIG_RXBUFFER_STARTPOS, &wTmp )); /* 0xAF is just an indication that this is a call to the function to get remaining data */ if (pSendBuff[0] != PHAL_MFNTAG42XDNA_RESP_ADDITIONAL_FRAME) { /* Check for permissible CmdBuff size */ if (wCmdLen > PHAL_MFNTAG42XDNA_MAXWRAPPEDAPDU_SIZE) { return PH_ADD_COMPCODE_FIXED(PH_ERR_BUFFER_OVERFLOW, PH_COMP_AL_MFNTAG42XDNA); } pApdu[1] = pSendBuff[0]; /* Desfire command code. */ switch(pApdu[1]) { case PHAL_MFNTAG42XDNA_CMD_READ_DATA: case PHAL_MFNTAG42XDNA_CMD_READ_DATA_ISO: /* Get the format value(Whether to use short APDU or extended APDU */ PH_CHECK_SUCCESS_FCT(statusTmp, phalMfNtag42XDna_GetConfig(pDataParams, PHAL_MFNTAG42XDNA_SHORT_LENGTH_APDU, &pValue)); /* To Note: Short APDU will be used, * 1. when user force the 'length' to be sent as short APDU in case of BIG ISO. * 2. When the data to read is not BIG ISO(less than 256 bytes). */ if(pValue & 0x0001) { /* Encode 'Length' in Short APDU format */ pApdu[bApduLen++]= (uint8_t)wCmdLen - 1; /* Set APDU Length. */ } else { /* Encode 'Length' in extended Length format */ bExtendedLenApdu = 0x01; pApdu[bApduLen++] = 0x00; pApdu[bApduLen++] = 0x00; pApdu[bApduLen++] = (uint8_t)wCmdLen - 1; /* Set APDU Length. */ } break; default: /* Rest other commands, retain existing implementation which is Short APDU */ pApdu[bApduLen++]= (uint8_t)wCmdLen - 1; /* Set APDU Length. */ break; } statusTmp = phpalMifare_ExchangeL4( pDataParams->pPalMifareDataParams, pApdu[bApduLen-1] == 0x00 ? PH_EXCHANGE_DEFAULT : PH_EXCHANGE_BUFFER_FIRST, pApdu, bApduLen, &pRecv, pRxlen ); /* Check if pApdu[4] is valid in case of Short APDU or * Check if pAdpu[6] is valid in case of Extended APDU */ if (((pApdu[4] != 0x00) && (statusTmp == PH_ERR_SUCCESS)) || ((bExtendedLenApdu && (pApdu[6] != 0x00)) && (statusTmp == PH_ERR_SUCCESS))) { PH_CHECK_SUCCESS_FCT(statusTmp, phpalMifare_ExchangeL4( pDataParams->pPalMifareDataParams, PH_EXCHANGE_BUFFER_CONT, &pSendBuff[1], wCmdLen - 1, &pRecv, pRxlen )); PH_CHECK_SUCCESS_FCT(status,phpalMifare_ExchangeL4( pDataParams->pPalMifareDataParams, PH_EXCHANGE_BUFFER_LAST, bLe, bExtendedLenApdu ? 0x02 : 0x01, &pRecv, pRxlen )); } } else { /* Send this on L4 */ status = phpalMifare_ExchangeL4( pDataParams->pPalMifareDataParams, PH_EXCHANGE_RXCHAINING, pSendBuff, wCmdLen, &pRecv, pRxlen ); } if ((status != PH_ERR_SUCCESS) && ((status & PH_ERR_MASK) != PH_ERR_SUCCESS_CHAINING)) { return status; } /* Storing the original pointer */ *pResponse = pRecv; if (status == PH_ERR_SUCCESS_CHAINING) { /* Next position will ensure overwriting on the SW1SW2 received from previous command */ wNextPos = (*pRxlen) - 2; memcpy(bBackupBytes, &(*pResponse)[wNextPos - 3], 3); /* PRQA S 3200 */ PH_CHECK_SUCCESS_FCT(statusTmp,phhalHw_GetConfig( pDataParams->pHalDataParams, PHHAL_HW_CONFIG_RXBUFFER_BUFSIZE, &wRxBufferSize )); } while ((status & PH_ERR_MASK) == PH_ERR_SUCCESS_CHAINING) { /* Get the Frame length */ PH_CHECK_SUCCESS_FCT(statusTmp, phalMfNtag42XDna_Sw_Int_GetFrameLength( pDataParams, &wFSD, &wFSC )); if (wFSD > wFSC) { if (wNextPos + wFSC >= wRxBufferSize) { /* Return Chaining and let the caller recall the function with option = PH_EXCHANGE_RXCHAINING */ /* Return the data accumulated till now and its length */ if((pSendBuff[0] != PHAL_MFNTAG42XDNA_RESP_ADDITIONAL_FRAME) && (!pDataParams->bWrappedMode)) { (*pRxlen) -= 1; (*pResponse)++; } return PH_ADD_COMPCODE_FIXED(PH_ERR_SUCCESS_CHAINING, PH_COMP_AL_MFNTAG42XDNA); } } else { if (wNextPos + wFSD >= wRxBufferSize) { /* Return Chaining and let the caller recall the function with option = PH_EXCHANGE_RXCHAINING */ /* Return the data accumulated till now and its length */ (*pRxlen) -= 2; return PH_ADD_COMPCODE_FIXED(PH_ERR_SUCCESS_CHAINING, PH_COMP_AL_MFNTAG42XDNA); } } PH_CHECK_SUCCESS_FCT(statusTmp, phhalHw_SetConfig( pDataParams->pHalDataParams, PHHAL_HW_CONFIG_RXBUFFER_STARTPOS, wNextPos )); /* Send this on L4 */ status = phpalMifare_ExchangeL4( pDataParams->pPalMifareDataParams, PH_EXCHANGE_RXCHAINING, bCmdBuff, wCmdLen, &pRecv, pRxlen ); /* Update wNextPos */ /* Putback the backed up bytes */ memcpy(&(*pResponse)[wNextPos - 3], bBackupBytes, 3); /* PRQA S 3200 */ /* Update the Buffer Position */ wNextPos = (*pRxlen) - 2; /* Backup 3 bytes. The nxt frame will overwrite these */ memcpy(bBackupBytes, &(*pResponse)[wNextPos - 3], 3); /* PRQA S 3200 */ } /* Status is 0x00? */ statusTmp = pRecv[(*pRxlen) - 1]; (*pRxlen) -= 2; return phalMfNtag42XDna_Int_ComputeErrorResponse(pDataParams, statusTmp); } phStatus_t phalMfNtag42XDna_Sw_Int_ReadData_Plain(phalMfNtag42XDna_Sw_DataParams_t * pDataParams, uint8_t bOption, uint8_t * bCmdBuff, uint16_t wCmdLen, uint8_t ** ppRxdata, uint16_t * pRxdataLen) { uint16_t PH_MEMLOC_REM status = 0; uint16_t PH_MEMLOC_REM wRxlen = 0; uint8_t PH_MEMLOC_REM * pRecv; uint8_t PH_MEMLOC_REM bWorkBuffer[32]; #ifdef NXPBUILD__PH_CRYPTOSYM uint16_t PH_MEMLOC_REM statusTmp = 0; uint8_t PH_MEMLOC_REM bCMAC[PH_CRYPTOSYM_AES_BLOCK_SIZE]; uint8_t PH_MEMLOC_REM bCMacCard[8]; uint8_t PH_MEMLOC_REM bMacLen = 0; uint8_t PH_MEMLOC_REM bIvLen = 0; uint16_t PH_MEMLOC_REM wTmp = 0; #endif /* NXPBUILD__PH_CRYPTOSYM */ uint16_t PH_MEMLOC_REM wWorkBufferLen = 0; memset(bWorkBuffer, 0x00, 32); /* PRQA S 3200 */ #ifdef NXPBUILD__PH_CRYPTOSYM memset(bCMAC, 0x00, PH_CRYPTOSYM_AES_BLOCK_SIZE); /* PRQA S 3200 */ memset(bCMacCard, 0x00, 8); /* PRQA S 3200 */ #endif /* NXPBUILD__PH_CRYPTOSYM */ /* Copy the bCmdBuff data to the bWorkBuff */ memcpy(bWorkBuffer, bCmdBuff, wCmdLen); /* PRQA S 3200 */ wWorkBufferLen = wCmdLen; #ifdef NXPBUILD__PH_CRYPTOSYM if (pDataParams->bAuthMode == PHAL_MFNTAG42XDNA_AUTHENTICATEEV2) { bIvLen = PH_CRYPTOSYM_AES_BLOCK_SIZE; } if(bCmdBuff[0] != PHAL_MFNTAG42XDNA_RESP_ADDITIONAL_FRAME) { /* Check for 0xAF added above to ensure that we dont update the IV or calculate CMAC for cases where in the application has called this API with bOption = PH_EXCHANGE_RXCHAINING */ if ((pDataParams->bAuthMode == PHAL_MFNTAG42XDNA_AUTHENTICATEEV2)&& ((bOption & 0xF0U) == PHAL_MFNTAG42XDNA_COMMUNICATION_MACD)) { memset(pDataParams->bIv, 0x00, bIvLen); /* PRQA S 3200 */ wWorkBufferLen = 0; bWorkBuffer[wWorkBufferLen++] = bCmdBuff[0]; /* Add CmdCtr and TI for MAC calculation */ bWorkBuffer[wWorkBufferLen++] = (uint8_t)(pDataParams->wCmdCtr); bWorkBuffer[wWorkBufferLen++] = (uint8_t)(pDataParams->wCmdCtr >> 8); memcpy(&bWorkBuffer[wWorkBufferLen], pDataParams->bTi, PHAL_MFNTAG42XDNA_SIZE_TI); /* PRQA S 3200 */ wWorkBufferLen += PHAL_MFNTAG42XDNA_SIZE_TI; /* Assumed here that a read-like commands cannot in any case have cmd+header+data > 24 bytes */ if (wCmdLen > 1) { memcpy(&bWorkBuffer[wWorkBufferLen], &bCmdBuff[1], (wCmdLen - 1)); /* PRQA S 3200 */ wWorkBufferLen += (wCmdLen - 1); } /* Load Iv */ PH_CHECK_SUCCESS_FCT(statusTmp, phCryptoSym_LoadIv( pDataParams->pCryptoDataParamsMac, pDataParams->bIv, bIvLen )); /* Calculate MAC */ PH_CHECK_SUCCESS_FCT(statusTmp, phCryptoSym_CalculateMac( pDataParams->pCryptoDataParamsMac, (PH_CRYPTOSYM_MAC_MODE_CMAC), bWorkBuffer, wWorkBufferLen, bCMAC, &bMacLen )); /* Truncate the MAC generated */ phalMfNtag42XDna_Sw_Int_TruncateMac(bCMAC); /* Get the original command in the work buffer. */ memcpy(bWorkBuffer, bCmdBuff, wCmdLen); /* PRQA S 3200 */ /* Append MAC for EV2 mode. */ memcpy(&bWorkBuffer[wCmdLen], bCMAC, PHAL_MFNTAG42XDNA_TRUNCATED_MAC_SIZE); /* PRQA S 3200 */ wWorkBufferLen = wCmdLen + PHAL_MFNTAG42XDNA_TRUNCATED_MAC_SIZE; } else { /*Do Nothing. This is for PRQA compliance */ } } #endif /* NXPBUILD__PH_CRYPTOSYM */ if (bOption & PHAL_MFNTAG42XDNA_ISO_CHAINING_MODE) { status = phalMfNtag42XDna_Sw_Int_ISOGetData( pDataParams, bWorkBuffer, wWorkBufferLen, &pRecv, &wRxlen ); } else { /* Send the command */ status = phalMfNtag42XDna_Sw_Int_GetData( pDataParams, bWorkBuffer, wWorkBufferLen, &pRecv, &wRxlen ); } if (((status & PH_ERR_MASK) != PH_ERR_SUCCESS) && ((status & PH_ERR_MASK) != PH_ERR_SUCCESS_CHAINING)) { #ifdef NXPBUILD__PH_CRYPTOSYM /* Reset authentication status */ if (pDataParams->bAuthMode == PHAL_MFNTAG42XDNA_AUTHENTICATEEV2) { phalMfNtag42XDna_Sw_Int_ResetAuthStatus(pDataParams); } /* Set the length pointer with valid value. Otherwise there will be an error in AL while logging. (Access violation in addess 0xccccccc) */ *pRxdataLen = wRxlen; *ppRxdata = pRecv ; /* Component code is already added by GetData */ #endif /* NXPBUILD__PH_CRYPTOSYM */ return status; } if ((pDataParams->bAuthMode == PHAL_MFNTAG42XDNA_AUTHENTICATEEV2) && (bCmdBuff[0] != PHAL_MFNTAG42XDNA_RESP_ADDITIONAL_FRAME)) { /* Increment the command counter. This increments irrespective of * Plain mode or MAC mode. Ensuring here that it is incremented * only for the case where the user has called this for the first * time i.e., without PH_EXCHANGE_RXCHAINING option */ pDataParams->wCmdCtr++; } #ifdef NXPBUILD__PH_CRYPTOSYM if ((pDataParams->bAuthMode == PHAL_MFNTAG42XDNA_AUTHENTICATEEV2) && ((bOption & 0xF0U) == PHAL_MFNTAG42XDNA_COMMUNICATION_MACD)) { if (bCmdBuff[0] != PHAL_MFNTAG42XDNA_RESP_ADDITIONAL_FRAME) { PH_CHECK_SUCCESS_FCT(statusTmp, phCryptoSym_LoadIv( pDataParams->pCryptoDataParamsMac, pDataParams->bIv, bIvLen )); pDataParams->bNoUnprocBytes = 0; /* Return code */ pDataParams->pUnprocByteBuff[pDataParams->bNoUnprocBytes++] = 0x00; /* Lower byte of CmdCtr */ pDataParams->pUnprocByteBuff[pDataParams->bNoUnprocBytes++] = (uint8_t)(pDataParams->wCmdCtr); /* Higher byte of CmdCtr */ pDataParams->pUnprocByteBuff[pDataParams->bNoUnprocBytes++] = (uint8_t)(pDataParams->wCmdCtr >> 8); /* TI */ memcpy(&pDataParams->pUnprocByteBuff[pDataParams->bNoUnprocBytes], pDataParams->bTi, PHAL_MFNTAG42XDNA_SIZE_TI); /* PRQA S 3200 */ pDataParams->bNoUnprocBytes += PHAL_MFNTAG42XDNA_SIZE_TI; } if ((status & PH_ERR_MASK) == PH_ERR_SUCCESS) { memcpy(bCMacCard, &pRecv[wRxlen - 8], 8); /* PRQA S 3200 */ wRxlen -= 8; /* If receieved data is not multiple of block size */ wTmp = (PH_CRYPTOSYM_AES_BLOCK_SIZE - pDataParams->bNoUnprocBytes); if(wTmp >= wRxlen) { wTmp = wRxlen; } memcpy(&pDataParams->pUnprocByteBuff[pDataParams->bNoUnprocBytes], pRecv, wTmp); /* PRQA S 3200 */ pDataParams->bNoUnprocBytes += (uint8_t)wTmp; if (wTmp == wRxlen) { /* Conclude the CMAC calculation. */ PH_CHECK_SUCCESS_FCT(statusTmp, phCryptoSym_CalculateMac( pDataParams->pCryptoDataParamsMac, (PH_CRYPTOSYM_MAC_MODE_CMAC | PH_EXCHANGE_BUFFER_LAST), pDataParams->pUnprocByteBuff, (pDataParams->bNoUnprocBytes), bCMAC, &bMacLen )); } else { /* First send the 16 byte block for cmac calculation */ PH_CHECK_SUCCESS_FCT(statusTmp, phCryptoSym_CalculateMac( pDataParams->pCryptoDataParamsMac, (PH_CRYPTOSYM_MAC_MODE_CMAC | PH_EXCHANGE_BUFFER_CONT), pDataParams->pUnprocByteBuff, (pDataParams->bNoUnprocBytes), bCMAC, &bMacLen )); /* Send rest of the received data */ PH_CHECK_SUCCESS_FCT(statusTmp, phCryptoSym_CalculateMac( pDataParams->pCryptoDataParamsMac, (PH_CRYPTOSYM_MAC_MODE_CMAC | PH_EXCHANGE_BUFFER_LAST), &pRecv[wTmp], wRxlen - wTmp, bCMAC, &bMacLen )); } /* Since end of response is reached reset the pDataParams bNoUnprocBytes member to 0 */ pDataParams->bNoUnprocBytes = 0; /* Truncate the MAC generated */ phalMfNtag42XDna_Sw_Int_TruncateMac(bCMAC); /* Compare the CMAC received and Calculated MAC */ if (memcmp(bCMAC, bCMacCard, 8) != 0) { /* CMAC validation failed */ return PH_ADD_COMPCODE_FIXED(PH_ERR_INTEGRITY_ERROR, PH_COMP_AL_MFNTAG42XDNA); } } else { /* Handling of chaining. */ /* Include the left over data for CMAC calculation */ wTmp = (PH_CRYPTOSYM_AES_BLOCK_SIZE - pDataParams->bNoUnprocBytes); memcpy(&pDataParams->pUnprocByteBuff[pDataParams->bNoUnprocBytes], pRecv, wTmp); /* PRQA S 3200 */ pDataParams->bNoUnprocBytes += (uint8_t)wTmp; /* Start MAC calculation with one full block size data */ PH_CHECK_SUCCESS_FCT(statusTmp, phCryptoSym_CalculateMac( pDataParams->pCryptoDataParamsMac, (PH_CRYPTOSYM_MAC_MODE_CMAC | PH_EXCHANGE_BUFFER_CONT), pDataParams->pUnprocByteBuff, (pDataParams->bNoUnprocBytes), bCMAC, &bMacLen )); PH_CHECK_SUCCESS_FCT(statusTmp, phCryptoSym_CalculateMac( pDataParams->pCryptoDataParamsMac, (PH_CRYPTOSYM_MAC_MODE_CMAC | PH_EXCHANGE_BUFFER_CONT), &pRecv[wTmp], ((wRxlen - wTmp)/PH_CRYPTOSYM_AES_BLOCK_SIZE) * PH_CRYPTOSYM_AES_BLOCK_SIZE, bCMAC, &bMacLen )); /* Remaining bytes */ wTmp = (wRxlen - wTmp) % PH_CRYPTOSYM_AES_BLOCK_SIZE; /* Update the UnprocByteBuffer with bytes not used for mac calculation */ memcpy(pDataParams->pUnprocByteBuff, &pRecv[wRxlen - wTmp], wTmp); /* PRQA S 3200 */ pDataParams->bNoUnprocBytes = (uint8_t)wTmp; } } else { /* Do Nothing. For PRQA Compliance.*/ bIvLen = 0x00; } #endif /* NXPBUILD__PH_CRYPTOSYM */ *ppRxdata = pRecv; *pRxdataLen = wRxlen; if ((status & PH_ERR_MASK) == PH_ERR_SUCCESS_CHAINING) { return PH_ADD_COMPCODE_FIXED(PH_ERR_SUCCESS_CHAINING, PH_COMP_AL_MFNTAG42XDNA);; } return PH_ERR_SUCCESS; } #ifdef NXPBUILD__PH_CRYPTOSYM phStatus_t phalMfNtag42XDna_Sw_Int_ReadData_Enc(phalMfNtag42XDna_Sw_DataParams_t * UNALIGNED pDataParams, uint8_t bOption, uint8_t * bCmdBuff, uint16_t wCmdLen, uint8_t ** ppRxdata, uint16_t * pRxdataLen) { uint16_t PH_MEMLOC_REM status; uint16_t PH_MEMLOC_REM statusTmp; uint16_t PH_MEMLOC_REM wRxlen; uint8_t PH_MEMLOC_REM bCMAC[PH_CRYPTOSYM_AES_BLOCK_SIZE]; uint8_t PH_MEMLOC_REM bMacLen; uint8_t PH_MEMLOC_REM bIvLen = 0; uint8_t PH_MEMLOC_REM * pRecv; uint8_t PH_MEMLOC_REM bWorkBuffer[32]; uint16_t PH_MEMLOC_REM wWorkBufferLen; uint8_t PH_MEMLOC_REM bCMacCard[8]; uint16_t PH_MEMLOC_REM wTmp = 0; /* Copy the bCmdBuff data to the bWorkBuff */ memcpy(bWorkBuffer, bCmdBuff, wCmdLen); /* PRQA S 3200 */ wWorkBufferLen = wCmdLen; if (pDataParams->bAuthMode == PHAL_MFNTAG42XDNA_AUTHENTICATEEV2) { bIvLen = PH_CRYPTOSYM_AES_BLOCK_SIZE; } else { #ifdef RDR_LIB_PARAM_CHECK return PH_ADD_COMPCODE_FIXED(PH_ERR_AUTH_ERROR, PH_COMP_AL_MFNTAG42XDNA); #endif } if ((pDataParams->bAuthMode == PHAL_MFNTAG42XDNA_AUTHENTICATEEV2) && (bCmdBuff[0] != PHAL_MFNTAG42XDNA_RESP_ADDITIONAL_FRAME)) { memset(pDataParams->bIv, 0x00, bIvLen); /* PRQA S 3200 */ wWorkBufferLen = 0; bWorkBuffer[wWorkBufferLen++] = bCmdBuff[0]; /* Add CmdCtr and TI for MAC calculation */ bWorkBuffer[wWorkBufferLen++] = (uint8_t)(pDataParams->wCmdCtr); bWorkBuffer[wWorkBufferLen++] = (uint8_t)(pDataParams->wCmdCtr >> 8); memcpy(&bWorkBuffer[wWorkBufferLen], pDataParams->bTi, PHAL_MFNTAG42XDNA_SIZE_TI); /* PRQA S 3200 */ wWorkBufferLen += PHAL_MFNTAG42XDNA_SIZE_TI; if (wCmdLen > 1) { memcpy(&bWorkBuffer[wWorkBufferLen], &bCmdBuff[1], (wCmdLen - 1)); /* PRQA S 3200 */ wWorkBufferLen += (wCmdLen - 1); } /* Load Iv */ PH_CHECK_SUCCESS_FCT(statusTmp, phCryptoSym_LoadIv( pDataParams->pCryptoDataParamsMac, pDataParams->bIv, bIvLen )); /* Calculate MAC */ PH_CHECK_SUCCESS_FCT(statusTmp, phCryptoSym_CalculateMac( pDataParams->pCryptoDataParamsMac, PH_CRYPTOSYM_MAC_MODE_CMAC, bWorkBuffer, wWorkBufferLen, bCMAC, &bMacLen )); /* Truncate the MAC generated */ phalMfNtag42XDna_Sw_Int_TruncateMac(bCMAC); /* Get the original command in the work buffer. */ memcpy(bWorkBuffer, bCmdBuff, wCmdLen); /* PRQA S 3200 */ /* Append MAC for EV2 mode. */ memcpy(&bWorkBuffer[wCmdLen], bCMAC, PHAL_MFNTAG42XDNA_TRUNCATED_MAC_SIZE); /* PRQA S 3200 */ wWorkBufferLen = wCmdLen + PHAL_MFNTAG42XDNA_TRUNCATED_MAC_SIZE; } else { /*Do Nothing. This is for PRQA compliance */ } if (bOption & PHAL_MFNTAG42XDNA_ISO_CHAINING_MODE) { /* Send the command */ status = phalMfNtag42XDna_Sw_Int_ISOGetData( pDataParams, bWorkBuffer, wWorkBufferLen, &pRecv, &wRxlen ); } else { /* Send the command */ status = phalMfNtag42XDna_Sw_Int_GetData( pDataParams, bWorkBuffer, wWorkBufferLen, &pRecv, &wRxlen ); } if (((status & PH_ERR_MASK) != PH_ERR_SUCCESS) && ((status & PH_ERR_MASK) != PH_ERR_SUCCESS_CHAINING)) { /* Reset authentication status */ if (pDataParams->bAuthMode == PHAL_MFNTAG42XDNA_AUTHENTICATEEV2) { phalMfNtag42XDna_Sw_Int_ResetAuthStatus(pDataParams); } /* Set the length pointer with valid value. Otherwise there will be an error in AL while logging. (Access violation in addess 0xccccccc) */ *pRxdataLen = wRxlen; *ppRxdata = pRecv ; return status; } if (pDataParams->bAuthMode == PHAL_MFNTAG42XDNA_AUTHENTICATEEV2) { if (bCmdBuff[0] != PHAL_MFNTAG42XDNA_RESP_ADDITIONAL_FRAME) { /* Increment the command counter */ pDataParams->wCmdCtr++; pDataParams->bNoUnprocBytes = 0; /* Return code */ if(bCmdBuff[0] == PHAL_MFNTAG42XDNA_CMD_READ_SIG) pDataParams->pUnprocByteBuff[pDataParams->bNoUnprocBytes++] = 0x90; else pDataParams->pUnprocByteBuff[pDataParams->bNoUnprocBytes++] = 0x00; /* Lower byte of CmdCtr */ pDataParams->pUnprocByteBuff[pDataParams->bNoUnprocBytes++] = (uint8_t)(pDataParams->wCmdCtr); /* Higher byte of CmdCtr */ pDataParams->pUnprocByteBuff[pDataParams->bNoUnprocBytes++] = (uint8_t)(pDataParams->wCmdCtr >> 8); /* TI */ memcpy(&pDataParams->pUnprocByteBuff[pDataParams->bNoUnprocBytes], pDataParams->bTi, PHAL_MFNTAG42XDNA_SIZE_TI); /* PRQA S 3200 */ pDataParams->bNoUnprocBytes += PHAL_MFNTAG42XDNA_SIZE_TI; { /* the IV is constructed by encrypting with KeyID.SesAuthENCKey according to the ECB mode * As ECB encription doesnot use IV during the encription so we need not backup/ update with zero IV*/ PH_CHECK_SUCCESS_FCT(statusTmp, phalMfNtag42XDna_Sw_Int_ComputeIv(PH_ON, pDataParams->bTi, pDataParams->wCmdCtr, pDataParams->bIv )); /* Encrypt IV */ PH_CHECK_SUCCESS_FCT(statusTmp, phCryptoSym_Encrypt( pDataParams->pCryptoDataParamsEnc, PH_CRYPTOSYM_CIPHER_MODE_ECB, pDataParams->bIv, bIvLen, pDataParams->bIv )); PH_CHECK_SUCCESS_FCT(statusTmp, phCryptoSym_LoadIv( pDataParams->pCryptoDataParamsEnc, pDataParams->bIv, bIvLen )); /* Handling of chaining. */ memset(pDataParams->bIv, 0x00, bIvLen); /* PRQA S 3200 */ /* Load IV */ PH_CHECK_SUCCESS_FCT(statusTmp, phCryptoSym_LoadIv( pDataParams->pCryptoDataParamsMac, pDataParams->bIv, bIvLen )); } } if ((status & PH_ERR_MASK) == PH_ERR_SUCCESS) { memcpy(bCMacCard, &pRecv[wRxlen - 8], 8); /* PRQA S 3200 */ wRxlen -= 8; /* If receieved data is not multiple of block size */ wTmp = (PH_CRYPTOSYM_AES_BLOCK_SIZE - pDataParams->bNoUnprocBytes); if(wTmp >= wRxlen) { wTmp = wRxlen; } memcpy(&pDataParams->pUnprocByteBuff[pDataParams->bNoUnprocBytes], pRecv, wTmp); /* PRQA S 3200 */ pDataParams->bNoUnprocBytes += (uint8_t)wTmp; if (wTmp == wRxlen) { /* Conclude the CMAC calculation. */ PH_CHECK_SUCCESS_FCT(statusTmp, phCryptoSym_CalculateMac( pDataParams->pCryptoDataParamsMac, (PH_CRYPTOSYM_MAC_MODE_CMAC | PH_EXCHANGE_BUFFER_LAST), pDataParams->pUnprocByteBuff, (pDataParams->bNoUnprocBytes), bCMAC, &bMacLen )); } else { /* First send the 16 byte block for CMAC calculation */ PH_CHECK_SUCCESS_FCT(statusTmp, phCryptoSym_CalculateMac( pDataParams->pCryptoDataParamsMac, (PH_CRYPTOSYM_MAC_MODE_CMAC | PH_EXCHANGE_BUFFER_CONT), pDataParams->pUnprocByteBuff, (pDataParams->bNoUnprocBytes), bCMAC, &bMacLen )); /* Send rest of the received data */ PH_CHECK_SUCCESS_FCT(statusTmp, phCryptoSym_CalculateMac( pDataParams->pCryptoDataParamsMac, (PH_CRYPTOSYM_MAC_MODE_CMAC | PH_EXCHANGE_BUFFER_LAST), &pRecv[wTmp], wRxlen - wTmp, bCMAC, &bMacLen )); } /* Since end of response is reached reset the pDataParams bNoUnprocBytes member to 0 */ pDataParams->bNoUnprocBytes = 0; /* Truncate the MAC generated */ phalMfNtag42XDna_Sw_Int_TruncateMac(bCMAC); /* Compare the CMAC received and Calculated MAC */ if (memcmp(bCMAC, bCMacCard, 8) != 0) { /* CMAC validation failed */ return PH_ADD_COMPCODE_FIXED(PH_ERR_INTEGRITY_ERROR, PH_COMP_AL_MFNTAG42XDNA); } /* the IV is constructed by encrypting with KeyID.SesAuthENCKey according to the ECB mode * As ECB encription doesnot use IV during the encription so we need not backup/ update with zero IV * This logic is applicable only in case of Non LRP Crypto Method */ { PH_CHECK_SUCCESS_FCT(statusTmp, phalMfNtag42XDna_Sw_Int_ComputeIv(PH_ON, pDataParams->bTi, pDataParams->wCmdCtr, pDataParams->bIv )); /* Encrypt IV */ PH_CHECK_SUCCESS_FCT(statusTmp, phCryptoSym_Encrypt( pDataParams->pCryptoDataParamsEnc, PH_CRYPTOSYM_CIPHER_MODE_ECB, pDataParams->bIv, bIvLen, pDataParams->bIv )); PH_CHECK_SUCCESS_FCT(statusTmp, phCryptoSym_LoadIv( pDataParams->pCryptoDataParamsEnc, pDataParams->bIv, bIvLen )); } /* Decrypt the received Encrypted buffer */ PH_CHECK_SUCCESS_FCT(statusTmp, phCryptoSym_Decrypt( pDataParams->pCryptoDataParamsEnc, (PH_CRYPTOSYM_CIPHER_MODE_CBC), pRecv, wRxlen, pRecv )); PH_CHECK_SUCCESS_FCT(statusTmp, phCryptoSym_RemovePadding( PH_CRYPTOSYM_PADDING_MODE_2, pRecv, wRxlen, bIvLen, wRxlen, pRecv, &wRxlen )); } else { /* Include the left over data for CMAC calculation */ wTmp = (PH_CRYPTOSYM_AES_BLOCK_SIZE - pDataParams->bNoUnprocBytes); memcpy(&pDataParams->pUnprocByteBuff[pDataParams->bNoUnprocBytes], pRecv, wTmp); /* PRQA S 3200 */ pDataParams->bNoUnprocBytes += (uint8_t)wTmp; /* Start MAC calculation with one full block size data */ PH_CHECK_SUCCESS_FCT(statusTmp, phCryptoSym_CalculateMac( pDataParams->pCryptoDataParamsMac, (PH_CRYPTOSYM_MAC_MODE_CMAC | PH_EXCHANGE_BUFFER_CONT), pDataParams->pUnprocByteBuff, (pDataParams->bNoUnprocBytes), bCMAC, &bMacLen )); PH_CHECK_SUCCESS_FCT(statusTmp, phCryptoSym_CalculateMac( pDataParams->pCryptoDataParamsMac, (PH_CRYPTOSYM_MAC_MODE_CMAC | PH_EXCHANGE_BUFFER_CONT), &pRecv[wTmp], ((wRxlen - wTmp)/PH_CRYPTOSYM_AES_BLOCK_SIZE) * PH_CRYPTOSYM_AES_BLOCK_SIZE, bCMAC, &bMacLen )); /* Remaining bytes */ wTmp = (wRxlen - wTmp) % PH_CRYPTOSYM_AES_BLOCK_SIZE; /* Update the UnprocByteBuffer with bytes not used for mac calculation */ memcpy(pDataParams->pUnprocByteBuff, &pRecv[wRxlen - wTmp], wTmp); /* PRQA S 3200 */ pDataParams->bNoUnprocBytes = (uint8_t)wTmp; /* Decrypt */ PH_CHECK_SUCCESS_FCT(statusTmp, phCryptoSym_Decrypt( pDataParams->pCryptoDataParamsEnc, (PH_CRYPTOSYM_CIPHER_MODE_CBC), pRecv, wRxlen, pRecv )); } } *ppRxdata = pRecv; *pRxdataLen = wRxlen; return status; } phStatus_t phalMfNtag42XDna_Sw_Int_Write_Enc(phalMfNtag42XDna_Sw_DataParams_t * pDataParams, uint8_t bIns, uint8_t * bCmdBuff, uint16_t wCmdLen, uint8_t bPaddingOption, uint8_t bCommOption, uint8_t * pData, uint16_t wDataLen) { phStatus_t PH_MEMLOC_REM statusTmp = 0; uint16_t PH_MEMLOC_REM status = 0; uint16_t PH_MEMLOC_REM wRxlen = 0; uint16_t PH_MEMLOC_REM wTmp = 0; uint8_t PH_MEMLOC_REM bCMAC[PH_CRYPTOSYM_AES_BLOCK_SIZE]; uint8_t PH_MEMLOC_REM bWorkBuffer[32]; uint16_t PH_MEMLOC_REM wWorkBufferLen = 0; uint8_t PH_MEMLOC_REM bCMacCard[8]; uint8_t PH_MEMLOC_REM pResp[16]; uint8_t PH_MEMLOC_REM bMacLen = 0; uint8_t PH_MEMLOC_REM bIvLen = 0; uint16_t PH_MEMLOC_REM wFrameLen = 0; uint16_t PH_MEMLOC_REM wTotalLen = 0; uint16_t PH_MEMLOC_REM wLastChunkLen = 0; uint16_t PH_MEMLOC_REM wDataLen1 = 0; uint16_t PH_MEMLOC_REM wNumDataBlocks = 0; uint8_t PH_MEMLOC_REM bLastChunk[32]; uint16_t PH_MEMLOC_REM wCommMode = PH_EXCHANGE_BUFFER_CONT; uint8_t PH_MEMLOC_REM *pRecv = NULL; uint8_t PH_MEMLOC_REM pApdu[5] = { PHAL_MFNTAG42XDNA_WRAPPEDAPDU_CLA, 0x00, PHAL_MFNTAG42XDNA_WRAPPEDAPDU_P1, PHAL_MFNTAG42XDNA_WRAPPEDAPDU_P2, 0x00 }; uint16_t PH_MEMLOC_REM wFSD = 0; uint16_t PH_MEMLOC_REM wFSC = 0; uint8_t PH_MEMLOC_REM bIvBackup[16]; uint16_t PH_MEMLOC_REM wApduLen = 0; memset(bWorkBuffer, 0x00, 20); /* PRQA S 3200 */ memset(bCMacCard, 0x00, 8); /* PRQA S 3200 */ memset(bCMAC, 0x00, PH_CRYPTOSYM_AES_BLOCK_SIZE); /* PRQA S 3200 */ memset(bLastChunk, 0x00, 32); /* PRQA S 3200 */ #ifdef RDR_LIB_PARAM_CHECK if (pDataParams->bAuthMode == PHAL_MFNTAG42XDNA_NOT_AUTHENTICATED) { return PH_ADD_COMPCODE_FIXED(PH_ERR_AUTH_ERROR, PH_COMP_AL_MFNTAG42XDNA); } #endif if (pDataParams->bAuthMode == PHAL_MFNTAG42XDNA_AUTHENTICATEEV2) { bIvLen = PH_CRYPTOSYM_AES_BLOCK_SIZE; /* Encrypt the CmdData with KsesAuthENC, If required padding needs to be done */ /* the IV is constructed by encrypting with KeyID.SesAuthENCKey according to the ECB mode * As ECB encription doesnot use IV during the encription so we need not backup/ update with zero IV*/ /* encrypt only Cmd data with KsesauthEnc */ if (bCmdBuff[0] != PHAL_MFNTAG42XDNA_RESP_ADDITIONAL_FRAME) { PH_CHECK_SUCCESS_FCT(statusTmp, phalMfNtag42XDna_Sw_Int_ComputeIv(PH_OFF, pDataParams->bTi, pDataParams->wCmdCtr, pDataParams->bIv )); /* Encrypt IV */ PH_CHECK_SUCCESS_FCT(statusTmp, phCryptoSym_Encrypt( pDataParams->pCryptoDataParamsEnc, PH_CRYPTOSYM_CIPHER_MODE_ECB, pDataParams->bIv, bIvLen, pDataParams->bIv )); wCommMode = PH_EXCHANGE_BUFFER_FIRST; /* Load Iv */ PH_CHECK_SUCCESS_FCT(statusTmp, phCryptoSym_LoadIv( pDataParams->pCryptoDataParamsEnc, pDataParams->bIv, bIvLen )); wNumDataBlocks = (wDataLen / bIvLen); if (wNumDataBlocks > 0) { /* Encrypt these blocks. Encrypted data put back on pData */ PH_CHECK_SUCCESS_FCT(statusTmp, phCryptoSym_Encrypt( pDataParams->pCryptoDataParamsEnc, (PH_CRYPTOSYM_CIPHER_MODE_CBC | wCommMode), pData, wNumDataBlocks * bIvLen, pData )); /* Update the data index this hold the data encrypted */ wDataLen1 = wNumDataBlocks * bIvLen; /* Update the IV */ memcpy(pDataParams->bIv, &pData[(wNumDataBlocks * bIvLen) - bIvLen], bIvLen); /* PRQA S 3200 */ } } if((bCommOption & PHAL_MFNTAG42XDNA_MAC_DATA_INCOMPLETE) != PHAL_MFNTAG42XDNA_MAC_DATA_INCOMPLETE) { /*check for remaining bytes if present*/ if (wDataLen - wDataLen1) { /* Prepare the last frame of data */ memcpy(bLastChunk, &pData[wDataLen1], wDataLen - wDataLen1); /* PRQA S 3200 */ /* Has a last frame */ wLastChunkLen = wDataLen - wDataLen1; } bPaddingOption = PH_CRYPTOSYM_PADDING_MODE_2; /* Apply padding */ PH_CHECK_SUCCESS_FCT(statusTmp, phCryptoSym_ApplyPadding( PH_CRYPTOSYM_PADDING_MODE_2, bLastChunk, wLastChunkLen, 16, sizeof(bLastChunk), bLastChunk, &wLastChunkLen )); /* Load Iv */ PH_CHECK_SUCCESS_FCT(statusTmp, phCryptoSym_LoadIv( pDataParams->pCryptoDataParamsEnc, pDataParams->bIv, bIvLen )); /* Encrypt the last frame*/ PH_CHECK_SUCCESS_FCT(statusTmp,phCryptoSym_Encrypt( pDataParams->pCryptoDataParamsEnc, PH_CRYPTOSYM_CIPHER_MODE_CBC | (((wDataLen1 == 0)&&(bCmdBuff[0] != PHAL_MFNTAG42XDNA_RESP_ADDITIONAL_FRAME)) ? PH_EXCHANGE_DEFAULT : PH_EXCHANGE_BUFFER_LAST), bLastChunk, wLastChunkLen, bLastChunk )); } /* size of encrypted data */ wTotalLen = wDataLen1 + wLastChunkLen; if (bCmdBuff[0] != PHAL_MFNTAG42XDNA_RESP_ADDITIONAL_FRAME) { /* back up encryption IV */ memcpy(bIvBackup, pDataParams->bIv, bIvLen); /* PRQA S 3200 */ /* set Iv value for CMAC caluclation*/ memset(pDataParams->bIv, 0x00, bIvLen); /* PRQA S 3200 */ pDataParams->bNoUnprocBytes = 0; /* Load Iv */ PH_CHECK_SUCCESS_FCT(statusTmp, phCryptoSym_LoadIv( pDataParams->pCryptoDataParamsMac, pDataParams->bIv, bIvLen )); /* copy original encrypted IV */ memcpy( pDataParams->bIv,bIvBackup, bIvLen); /* PRQA S 3200 */ /* Calculate MAC on Cmd || wCmdCtr || TI || CmdHeader || CmdData */ bWorkBuffer[wWorkBufferLen++] = bCmdBuff[0]; bWorkBuffer[wWorkBufferLen++] = (uint8_t)(pDataParams->wCmdCtr); bWorkBuffer[wWorkBufferLen++] = (uint8_t)(pDataParams->wCmdCtr >> 8); memcpy(&bWorkBuffer[wWorkBufferLen], pDataParams->bTi, PHAL_MFNTAG42XDNA_SIZE_TI); /* PRQA S 3200 */ wWorkBufferLen += PHAL_MFNTAG42XDNA_SIZE_TI; } else { memcpy(bWorkBuffer, pDataParams->pUnprocByteBuff, pDataParams->bNoUnprocBytes); /* PRQA S 3200 */ wWorkBufferLen = pDataParams->bNoUnprocBytes; pDataParams->bNoUnprocBytes = 0; } /* Check for presence of command header */ if (wCmdLen > 1) { /* Calculate the total length of data for MAC calculation */ wTmp = ((wCmdLen - 1) + (wWorkBufferLen)); /* Since bWorkbuffer can accomodate 32 bytes, check for buffer overflow */ if (wTmp > 32) { memcpy(&bWorkBuffer[wWorkBufferLen], &bCmdBuff[1], (32 - wWorkBufferLen)); /* PRQA S 3200 */ /* Calculate CMAC */ PH_CHECK_SUCCESS_FCT(statusTmp, phCryptoSym_CalculateMac( pDataParams->pCryptoDataParamsMac, PH_CRYPTOSYM_MAC_MODE_CMAC | PH_EXCHANGE_BUFFER_FIRST, bWorkBuffer, 32, bCMAC, &bMacLen )); /* Copy the remaining bCmdBuff into bWorkBuffer */ memcpy(bWorkBuffer, &bCmdBuff[(32 - wWorkBufferLen) + 1], (wTmp - 32)); /* PRQA S 3200 */ wWorkBufferLen = (wTmp - 32); wCommMode = PH_EXCHANGE_BUFFER_CONT; } else { memcpy(&bWorkBuffer[wWorkBufferLen], &bCmdBuff[1], (wCmdLen - 1)); /* PRQA S 3200 */ wWorkBufferLen += (wCmdLen - 1); } } /* calculate the MAC value for encrypted CmdData */ if (wDataLen1) { if((wTmp < 32) && ((bCmdBuff[0] != PHAL_MFNTAG42XDNA_RESP_ADDITIONAL_FRAME))) { wCommMode = PH_EXCHANGE_BUFFER_FIRST; } /* check for remaining number of data to make multiple of IV length */ wTmp = (PH_CRYPTOSYM_AES_BLOCK_SIZE - (wWorkBufferLen % PH_CRYPTOSYM_AES_BLOCK_SIZE)); memcpy(&bWorkBuffer[wWorkBufferLen], pData, wTmp); /* PRQA S 3200 */ PH_CHECK_SUCCESS_FCT(statusTmp, phCryptoSym_CalculateMac( pDataParams->pCryptoDataParamsMac, (PH_CRYPTOSYM_MAC_MODE_CMAC | wCommMode), bWorkBuffer, wWorkBufferLen + wTmp, bCMAC, &bMacLen )); if((wDataLen1 - wTmp) > PH_CRYPTOSYM_AES_BLOCK_SIZE ) { PH_CHECK_SUCCESS_FCT(statusTmp, phCryptoSym_CalculateMac( pDataParams->pCryptoDataParamsMac, (PH_CRYPTOSYM_MAC_MODE_CMAC | PH_EXCHANGE_BUFFER_CONT), &pData[wTmp], (((wDataLen1 - wTmp) / PH_CRYPTOSYM_AES_BLOCK_SIZE) * PH_CRYPTOSYM_AES_BLOCK_SIZE), bCMAC, &bMacLen )); } wCommMode = PH_EXCHANGE_BUFFER_LAST; /* copy reaming data present in pdata */ wWorkBufferLen = ((wDataLen1 - wTmp) % PH_CRYPTOSYM_AES_BLOCK_SIZE); memcpy(bWorkBuffer, &pData[wDataLen1 - wWorkBufferLen], wWorkBufferLen); /* PRQA S 3200 */ } /* if Last packet of data is sent */ if ((bCommOption & PHAL_MFNTAG42XDNA_MAC_DATA_INCOMPLETE) != PHAL_MFNTAG42XDNA_MAC_DATA_INCOMPLETE) { /* copy remaing data to work buffer */ wTmp = wWorkBufferLen + wLastChunkLen; if(wTmp < 32) { memcpy(&bWorkBuffer[wWorkBufferLen], &bLastChunk[0], wLastChunkLen); /* PRQA S 3200 */ PH_CHECK_SUCCESS_FCT(statusTmp, phCryptoSym_CalculateMac( pDataParams->pCryptoDataParamsMac, (PH_CRYPTOSYM_MAC_MODE_CMAC | PH_EXCHANGE_BUFFER_LAST), bWorkBuffer, wTmp, bCMAC, &bMacLen )); } else { wTmp = 32 - wWorkBufferLen; memcpy(&bWorkBuffer[wWorkBufferLen], bLastChunk, wTmp); /* PRQA S 3200 */ PH_CHECK_SUCCESS_FCT(statusTmp, phCryptoSym_CalculateMac( pDataParams->pCryptoDataParamsMac, (PH_CRYPTOSYM_MAC_MODE_CMAC | PH_EXCHANGE_BUFFER_CONT), bWorkBuffer, 32, bCMAC, &bMacLen )); /* this If condition is added to suppress QAC warning */ if(wLastChunkLen > 0 ) { PH_CHECK_SUCCESS_FCT(statusTmp, phCryptoSym_CalculateMac( pDataParams->pCryptoDataParamsMac, (PH_CRYPTOSYM_MAC_MODE_CMAC | PH_EXCHANGE_BUFFER_LAST), &bLastChunk[wTmp], wLastChunkLen - wTmp, bCMAC, &bMacLen )); } } /* Truncate the MAC generated */ phalMfNtag42XDna_Sw_Int_TruncateMac(bCMAC); memcpy(&bLastChunk[wLastChunkLen], bCMAC, 8); /* PRQA S 3200 */ wLastChunkLen += 8; } else { /* calculate CMAC for if data is multiple of IV */ if(wWorkBufferLen > PH_CRYPTOSYM_AES_BLOCK_SIZE ) { PH_CHECK_SUCCESS_FCT(statusTmp, phCryptoSym_CalculateMac( pDataParams->pCryptoDataParamsMac, (PH_CRYPTOSYM_MAC_MODE_CMAC | PH_EXCHANGE_BUFFER_CONT), bWorkBuffer, ((wWorkBufferLen / PH_CRYPTOSYM_AES_BLOCK_SIZE) * PH_CRYPTOSYM_AES_BLOCK_SIZE), bCMAC, &bMacLen )); } else { /* copy reaming data present in pdata */ pDataParams->bNoUnprocBytes =(uint8_t) (wWorkBufferLen % PH_CRYPTOSYM_AES_BLOCK_SIZE); memcpy(pDataParams->pUnprocByteBuff, bWorkBuffer, pDataParams->bNoUnprocBytes); /* PRQA S 3200 */ } } /* Update Total Length */ wTotalLen = wDataLen1 + wLastChunkLen; } /* At this point have proper data to be transmitted in the * buffer provided by the user. * wTotalLength should have the total length to be transmitted * First Frame: Cmd+Params+Data * wTotalLength -= wDataLen; while (wTotalLength) { Break the data into chunks of maxdata size and transmit. For ISO wrapped mode, max of 55 bytes can be sent in one frame. For native mode, max of 60 bytes can be sent in one frame. } */ /* First copy the cmd+params+data(upto 52 bytes) and transmit * Next put AF+upto 59 bytes of data and transmit. * Continue till all data in Pdata is transferred, lastly include * the contents of bLastChunk also */ if(bIns != PHAL_MFNTAG42XDNA_ISO_CHAINING_MODE) { wFrameLen = PHAL_MFNTAG42XDNA_MAXWRAPPEDAPDU_SIZE; } else { /* Get the Frame length */ PH_CHECK_SUCCESS_FCT(statusTmp, phalMfNtag42XDna_Sw_Int_GetFrameLength( pDataParams, &wFSD, &wFSC )); wFrameLen = wFSC - 9; } wTmp = wTotalLen; /* Force the date to enter into this loop if it is LRP mode */ if (wTmp <= (wFrameLen - wCmdLen)) { wApduLen = ((wCmdLen == 0x01 ) && (bIns == PHAL_MFNTAG42XDNA_ISO_CHAINING_MODE ))? 0 : PHAL_MFNTAG42XDNA_WRAP_HDR_LEN; wCmdLen = ((wCmdLen == 0x01 ) && (bIns == PHAL_MFNTAG42XDNA_ISO_CHAINING_MODE ))? 0 : wCmdLen; /* Send in one shot */ pApdu[1] = bCmdBuff[0]; /* Desfire cmd code in INS */ if(wCmdLen > 0) { pApdu[4] = (uint8_t)(wCmdLen + wTotalLen) - 0x01u; } PH_CHECK_SUCCESS_FCT(statusTmp, phpalMifare_ExchangeL4( pDataParams->pPalMifareDataParams, PH_EXCHANGE_BUFFER_FIRST | (((bIns == PHAL_MFNTAG42XDNA_ISO_CHAINING_MODE) && (bCommOption & PHAL_MFNTAG42XDNA_MAC_DATA_INCOMPLETE)) ? PH_EXCHANGE_TXCHAINING : 0), pApdu, wApduLen, &pRecv, &wRxlen)); if( wCmdLen > 0) { PH_CHECK_SUCCESS_FCT(statusTmp, phpalMifare_ExchangeL4( pDataParams->pPalMifareDataParams, PH_EXCHANGE_BUFFER_CONT | (((bIns == PHAL_MFNTAG42XDNA_ISO_CHAINING_MODE) && (bCommOption & PHAL_MFNTAG42XDNA_MAC_DATA_INCOMPLETE)) ? PH_EXCHANGE_TXCHAINING : 0), &bCmdBuff[1], wCmdLen - 1, &pRecv, &wRxlen)); } PH_CHECK_SUCCESS_FCT(statusTmp, phpalMifare_ExchangeL4( pDataParams->pPalMifareDataParams, PH_EXCHANGE_BUFFER_CONT | (((bIns == PHAL_MFNTAG42XDNA_ISO_CHAINING_MODE) && (bCommOption & PHAL_MFNTAG42XDNA_MAC_DATA_INCOMPLETE)) ? PH_EXCHANGE_TXCHAINING : 0), pData, wDataLen1, &pRecv, &wRxlen)); if (wLastChunkLen != 0x0000) { PH_CHECK_SUCCESS_FCT(statusTmp, phpalMifare_ExchangeL4( pDataParams->pPalMifareDataParams, PH_EXCHANGE_BUFFER_CONT | (((bIns == PHAL_MFNTAG42XDNA_ISO_CHAINING_MODE) && (bCommOption & PHAL_MFNTAG42XDNA_MAC_DATA_INCOMPLETE)) ? PH_EXCHANGE_TXCHAINING : 0), bLastChunk, wLastChunkLen, &pRecv, &wRxlen)); } /* Le byte */ PH_CHECK_SUCCESS_FCT(statusTmp, phpalMifare_ExchangeL4( pDataParams->pPalMifareDataParams, PH_EXCHANGE_BUFFER_LAST | (((bIns == PHAL_MFNTAG42XDNA_ISO_CHAINING_MODE) && (bCommOption & PHAL_MFNTAG42XDNA_MAC_DATA_INCOMPLETE)) ? PH_EXCHANGE_TXCHAINING : 0), &pApdu[2], (uint16_t)((pDataParams->dwPayLoadLen > 0xFE ) && (bIns == PHAL_MFNTAG42XDNA_ISO_CHAINING_MODE ))? 0x02U : 0x01U, &pRecv, &wRxlen)); status = (uint8_t)pRecv[wRxlen - 1]; wRxlen -= 2; if (status != PH_ERR_SUCCESS) { /* Reset authentication status */ if (pDataParams->bAuthMode == PHAL_MFNTAG42XDNA_AUTHENTICATEEV2) { phalMfNtag42XDna_Sw_Int_ResetAuthStatus(pDataParams); } return phalMfNtag42XDna_Int_ComputeErrorResponse(pDataParams, (uint8_t)status); } /* At this point, Handle the SetConfiguration command if LRP Mode is to be enabled. * In Desfire Lite, In set configuration command, for enabling LRP secure messaging type, * clearing the authenticate state at the end of the command processing is done. * Hence command response will be in PLAIN mode which shall be handled */ if((pApdu[1] == PHAL_MFNTAG42XDNA_CMD_SET_CONFIG) && (pDataParams->bCryptoMethod == PH_CRYPTOSYM_CONFIG_LRP)) { /* Since ERROR handling is already done, just return SUCCESS */ return PH_ERR_SUCCESS; } memcpy(pResp, pRecv, wRxlen); /* PRQA S 3200 */ } else { if(wDataLen1 > 0x0200) { statusTmp = phalMfNtag42XDna_Sw_Int_SendDataAndAddDataToPICC( pDataParams, bIns, bCmdBuff, wCmdLen, pData, wDataLen1, bLastChunk, wLastChunkLen, pResp, &wRxlen ); } else { statusTmp = phalMfNtag42XDna_Sw_Int_SendDataToPICC( pDataParams, bIns, (bCommOption & PHAL_MFNTAG42XDNA_MAC_DATA_INCOMPLETE), bCmdBuff, wCmdLen, pData, wDataLen1, bLastChunk, wLastChunkLen, pResp, &wRxlen ); } if ((statusTmp & PH_ERR_MASK) == PHAL_MFNTAG42XDNA_RESP_CHAINING) { return statusTmp; } if ((statusTmp & PH_ERR_MASK) != PH_ERR_SUCCESS && (statusTmp & PH_ERR_MASK) != PH_ERR_SUCCESS_CHAINING) { /* Reset authentication status */ if (pDataParams->bAuthMode == PHAL_MFNTAG42XDNA_AUTHENTICATEEV2) { phalMfNtag42XDna_Sw_Int_ResetAuthStatus(pDataParams); } return statusTmp; } } if (pDataParams->bAuthMode == PHAL_MFNTAG42XDNA_AUTHENTICATEEV2) { /* Increment the command counter */ pDataParams->wCmdCtr++; if (wRxlen < 8 ) /* If no CMAC received */ { return PH_ADD_COMPCODE_FIXED(PH_ERR_PROTOCOL_ERROR, PH_COMP_AL_MFNTAG42XDNA); } memset(pDataParams->bIv, 0x00, bIvLen); /* PRQA S 3200 */ /* Load IV */ PH_CHECK_SUCCESS_FCT(statusTmp, phCryptoSym_LoadIv( pDataParams->pCryptoDataParamsMac, pDataParams->bIv, bIvLen )); /* copy CMAC received from card*/ memcpy(bCMacCard, &pResp[wRxlen - 8], 8); /* PRQA S 3200 */ wRxlen -= 8; /* * Calculate MAC on RC || wCmdCtr || TI || RespData */ pDataParams->bNoUnprocBytes = 0x00; pDataParams->pUnprocByteBuff[pDataParams->bNoUnprocBytes++] = 0x00; pDataParams->pUnprocByteBuff[pDataParams->bNoUnprocBytes++] = (uint8_t)(pDataParams->wCmdCtr); pDataParams->pUnprocByteBuff[pDataParams->bNoUnprocBytes++] = (uint8_t)(pDataParams->wCmdCtr >> 8); memcpy(&pDataParams->pUnprocByteBuff[pDataParams->bNoUnprocBytes], pDataParams->bTi, PHAL_MFNTAG42XDNA_SIZE_TI); /* PRQA S 3200 */ pDataParams->bNoUnprocBytes += PHAL_MFNTAG42XDNA_SIZE_TI; /*Required ?*/ memcpy(&pDataParams->pUnprocByteBuff[pDataParams->bNoUnprocBytes], pResp, wRxlen); /* PRQA S 3200 */ pDataParams->bNoUnprocBytes += (uint8_t)wRxlen; /* verify the MAC */ PH_CHECK_SUCCESS_FCT(statusTmp, phCryptoSym_CalculateMac( pDataParams->pCryptoDataParamsMac, (PH_CRYPTOSYM_MAC_MODE_CMAC | PH_EXCHANGE_DEFAULT), pDataParams->pUnprocByteBuff, pDataParams->bNoUnprocBytes, bCMAC, &bMacLen )); /* Truncate the MAC generated */ phalMfNtag42XDna_Sw_Int_TruncateMac(bCMAC); if (memcmp(bCMacCard, bCMAC, 8) != 0) { phalMfNtag42XDna_Sw_Int_ResetAuthStatus(pDataParams); return PH_ADD_COMPCODE_FIXED(PH_ERR_INTEGRITY_ERROR, PH_COMP_AL_MFNTAG42XDNA); } } else { /*Do Nothing. This is for PRQA compliance */ } return PH_ERR_SUCCESS; } #endif /* NXPBUILD__PH_CRYPTOSYM */ phStatus_t phalMfNtag42XDna_Sw_Int_Write_Plain(phalMfNtag42XDna_Sw_DataParams_t * pDataParams, uint8_t bIns, uint8_t * bCmdBuff, uint16_t wCmdLen, uint8_t bCommOption, uint8_t * pData, uint16_t wDataLen) { phStatus_t PH_MEMLOC_REM statusTmp = 0; uint16_t PH_MEMLOC_REM status = 0; uint16_t PH_MEMLOC_REM wRxlen = 0; uint8_t PH_MEMLOC_REM bWorkBuffer[32]; uint16_t PH_MEMLOC_REM wFrameLen = 0; uint16_t PH_MEMLOC_REM wTotalLen = 0; uint16_t PH_MEMLOC_REM wTmp = 0; uint8_t PH_MEMLOC_REM *pRecv = NULL; uint8_t PH_MEMLOC_REM pApdu[5] = { PHAL_MFNTAG42XDNA_WRAPPEDAPDU_CLA, 0x00, PHAL_MFNTAG42XDNA_WRAPPEDAPDU_P1, PHAL_MFNTAG42XDNA_WRAPPEDAPDU_P2, 0x00 }; #ifdef NXPBUILD__PH_CRYPTOSYM uint8_t PH_MEMLOC_REM bCMAC[PH_CRYPTOSYM_AES_BLOCK_SIZE]; #endif /* NXPBUILD__PH_CRYPTOSYM */ uint8_t PH_MEMLOC_REM bCMacCard[8]; uint8_t PH_MEMLOC_REM bMacLen = 0; uint8_t PH_MEMLOC_REM bIvLen = 0; uint16_t PH_MEMLOC_REM wWorkBufferLen = 0; uint16_t PH_MEMLOC_REM wFSD = 0; uint16_t PH_MEMLOC_REM wFSC = 0; uint16_t PH_MEMLOC_REM wApduLen = 0; #ifdef NXPBUILD__PH_CRYPTOSYM memset(bCMAC, 0x00, PH_CRYPTOSYM_AES_BLOCK_SIZE); /* PRQA S 3200 */ memset(bCMacCard, 0x00, 8); /* PRQA S 3200 */ #endif /* NXPBUILD__PH_CRYPTOSYM */ memset(bWorkBuffer, 0x00, 32); /* PRQA S 3200 */ #ifdef NXPBUILD__PH_CRYPTOSYM if (pDataParams->bAuthMode == PHAL_MFNTAG42XDNA_AUTHENTICATEEV2) { bIvLen = PH_CRYPTOSYM_AES_BLOCK_SIZE; } #endif /* NXPBUILD__PH_CRYPTOSYM */ if ((pDataParams->bAuthMode == PHAL_MFNTAG42XDNA_AUTHENTICATEEV2) && ((bCommOption & 0xF0U) == PHAL_MFNTAG42XDNA_COMMUNICATION_MACD)) { if ((bCmdBuff[0] != PHAL_MFNTAG42XDNA_RESP_ADDITIONAL_FRAME)) { memset(pDataParams->bIv, 0x00, bIvLen); /* PRQA S 3200 */ pDataParams->bNoUnprocBytes = 0; #ifdef NXPBUILD__PH_CRYPTOSYM /* Load Iv */ PH_CHECK_SUCCESS_FCT(statusTmp, phCryptoSym_LoadIv( pDataParams->pCryptoDataParamsMac, pDataParams->bIv, bIvLen )); #endif /* NXPBUILD__PH_CRYPTOSYM */ /* Calculate MAC on Cmd || wCmdCtr || TI || CmdHeader || CmdData */ bWorkBuffer[wWorkBufferLen++] = bCmdBuff[0]; bWorkBuffer[wWorkBufferLen++] = (uint8_t)(pDataParams->wCmdCtr); bWorkBuffer[wWorkBufferLen++] = (uint8_t)(pDataParams->wCmdCtr >> 8); memcpy(&bWorkBuffer[wWorkBufferLen], pDataParams->bTi, PHAL_MFNTAG42XDNA_SIZE_TI); /* PRQA S 3200 */ wWorkBufferLen += PHAL_MFNTAG42XDNA_SIZE_TI; } else { memcpy(bWorkBuffer, pDataParams->pUnprocByteBuff, pDataParams->bNoUnprocBytes); /* PRQA S 3200 */ wWorkBufferLen = pDataParams->bNoUnprocBytes; pDataParams->bNoUnprocBytes = 0; } /* Check for presence of command header */ if (wCmdLen > 1) { /* Calculate the total length of data for MAC calculation */ wTmp = ((wCmdLen - 1) + (wWorkBufferLen)); /* Since bWorkbuffer can accomodate 32 bytes, check for buffer overflow */ if (wTmp > 32) { memcpy(&bWorkBuffer[wWorkBufferLen], &bCmdBuff[1], (32 - wWorkBufferLen)); /* PRQA S 3200 */ #ifdef NXPBUILD__PH_CRYPTOSYM /* Calculate CMAC */ PH_CHECK_SUCCESS_FCT(statusTmp, phCryptoSym_CalculateMac( pDataParams->pCryptoDataParamsMac, PH_CRYPTOSYM_MAC_MODE_CMAC | PH_EXCHANGE_BUFFER_CONT, bWorkBuffer, 32, bCMAC, &bMacLen )); #endif /* NXPBUILD__PH_CRYPTOSYM */ /* Copy the remaining bCmdBuff into bWorkBuffer */ memcpy(bWorkBuffer, &bCmdBuff[(32 - wWorkBufferLen) + 1], (wTmp - 32)); /* PRQA S 3200 */ wWorkBufferLen = (wTmp - 32); } else { memcpy(&bWorkBuffer[wWorkBufferLen], &bCmdBuff[1], (wCmdLen - 1)); /* PRQA S 3200 */ wWorkBufferLen += (wCmdLen - 1); } } #ifdef NXPBUILD__PH_CRYPTOSYM if ((bCommOption & PHAL_MFNTAG42XDNA_MAC_DATA_INCOMPLETE) != PHAL_MFNTAG42XDNA_MAC_DATA_INCOMPLETE) { if (!(wDataLen)) { /* Calculate CMAC in one shot */ PH_CHECK_SUCCESS_FCT(statusTmp, phCryptoSym_CalculateMac( pDataParams->pCryptoDataParamsMac, (PH_CRYPTOSYM_MAC_MODE_CMAC | ((wTmp > 32) ? PH_EXCHANGE_BUFFER_LAST : PH_EXCHANGE_DEFAULT)), bWorkBuffer, wWorkBufferLen, bCMAC, &bMacLen )); } else { wTmp = (PH_CRYPTOSYM_AES_BLOCK_SIZE - (wWorkBufferLen % PH_CRYPTOSYM_AES_BLOCK_SIZE)); if (wDataLen < wTmp) { wTmp = wDataLen; } memcpy(&bWorkBuffer[wWorkBufferLen], pData, wTmp); /* PRQA S 3200 */ PH_CHECK_SUCCESS_FCT(statusTmp, phCryptoSym_CalculateMac( pDataParams->pCryptoDataParamsMac, (PH_CRYPTOSYM_MAC_MODE_CMAC | ((wTmp == wDataLen) ? PH_EXCHANGE_BUFFER_LAST : PH_EXCHANGE_BUFFER_CONT)), bWorkBuffer, wWorkBufferLen + wTmp, bCMAC, &bMacLen )); if (wTmp != wDataLen) { PH_CHECK_SUCCESS_FCT(statusTmp, phCryptoSym_CalculateMac( pDataParams->pCryptoDataParamsMac, PH_CRYPTOSYM_MAC_MODE_CMAC | PH_EXCHANGE_BUFFER_LAST, &pData[wTmp], wDataLen - wTmp, bCMAC, &bMacLen )); } } /* Truncate the MAC generated */ phalMfNtag42XDna_Sw_Int_TruncateMac(bCMAC); bMacLen = 8; } else { if (!(wDataLen)) { if(((wWorkBufferLen / PH_CRYPTOSYM_AES_BLOCK_SIZE) * PH_CRYPTOSYM_AES_BLOCK_SIZE) != 0U) { /* Calculate CMAC */ PH_CHECK_SUCCESS_FCT(statusTmp, phCryptoSym_CalculateMac( pDataParams->pCryptoDataParamsMac, (PH_CRYPTOSYM_MAC_MODE_CMAC | PH_EXCHANGE_BUFFER_CONT), bWorkBuffer, ((wWorkBufferLen / PH_CRYPTOSYM_AES_BLOCK_SIZE) * PH_CRYPTOSYM_AES_BLOCK_SIZE), bCMAC, &bMacLen )); } pDataParams->bNoUnprocBytes =(uint8_t) (wWorkBufferLen % PH_CRYPTOSYM_AES_BLOCK_SIZE); memcpy(pDataParams->pUnprocByteBuff, &bWorkBuffer[wWorkBufferLen - pDataParams->bNoUnprocBytes], pDataParams->bNoUnprocBytes); /* PRQA S 3200 */ } else { wTmp = (PH_CRYPTOSYM_AES_BLOCK_SIZE - (wWorkBufferLen % PH_CRYPTOSYM_AES_BLOCK_SIZE)); if (wDataLen < wTmp) { wTmp = wDataLen; pDataParams->bNoUnprocBytes = (uint8_t)(wTmp % PH_CRYPTOSYM_AES_BLOCK_SIZE); memcpy(pDataParams->pUnprocByteBuff, &pData[wTmp - pDataParams->bNoUnprocBytes], pDataParams->bNoUnprocBytes); /* PRQA S 3200 */ } memcpy(&bWorkBuffer[wWorkBufferLen], pData, (wTmp - pDataParams->bNoUnprocBytes)); /* PRQA S 3200 */ PH_CHECK_SUCCESS_FCT(statusTmp, phCryptoSym_CalculateMac( pDataParams->pCryptoDataParamsMac, (PH_CRYPTOSYM_MAC_MODE_CMAC | PH_EXCHANGE_BUFFER_CONT), bWorkBuffer, (wWorkBufferLen + (wTmp - pDataParams->bNoUnprocBytes)), bCMAC, &bMacLen )); if (wTmp != wDataLen) { PH_CHECK_SUCCESS_FCT(statusTmp, phCryptoSym_CalculateMac( pDataParams->pCryptoDataParamsMac, PH_CRYPTOSYM_MAC_MODE_CMAC | PH_EXCHANGE_BUFFER_CONT, &pData[wTmp], (((wDataLen - wTmp) / PH_CRYPTOSYM_AES_BLOCK_SIZE) * PH_CRYPTOSYM_AES_BLOCK_SIZE), bCMAC, &bMacLen )); pDataParams->bNoUnprocBytes = (uint8_t)((wDataLen - wTmp) % PH_CRYPTOSYM_AES_BLOCK_SIZE); memcpy(pDataParams->pUnprocByteBuff, &pData[wDataLen - pDataParams->bNoUnprocBytes], pDataParams->bNoUnprocBytes); /* PRQA S 3200 */ } } } #endif /* NXPBUILD__PH_CRYPTOSYM */ if ((bCommOption & PHAL_MFNTAG42XDNA_MAC_DATA_INCOMPLETE) == PHAL_MFNTAG42XDNA_MAC_DATA_INCOMPLETE) { bMacLen = 0; } } else { /* Else statement due to else if above. */ bMacLen = 0; } /* Update wTotalLen = datalen + CMAClen*/ wTotalLen = wDataLen + bMacLen; if(bIns != PHAL_MFNTAG42XDNA_ISO_CHAINING_MODE) { wFrameLen = PHAL_MFNTAG42XDNA_MAXWRAPPEDAPDU_SIZE; } else { /* Get the Frame length */ PH_CHECK_SUCCESS_FCT(statusTmp, phalMfNtag42XDna_Sw_Int_GetFrameLength( pDataParams, &wFSD, &wFSC )); wFrameLen = wFSC - 9; } if (wTotalLen == 0x0000) { /* Single frame cmd without any data. Just send it */ status = phalMfNtag42XDna_ExchangeCmd( pDataParams, pDataParams->pPalMifareDataParams, pDataParams->bWrappedMode, bCmdBuff, wCmdLen, &pRecv, &wRxlen ); if (((status & PH_ERR_MASK) != PH_ERR_SUCCESS) && ((status & PH_ERR_MASK) != PH_ERR_SUCCESS_CHAINING)) { /* Reset authentication status */ if (pDataParams->bAuthMode == PHAL_MFNTAG42XDNA_AUTHENTICATEEV2) { phalMfNtag42XDna_Sw_Int_ResetAuthStatus(pDataParams); } return PH_ADD_COMPCODE(status, PH_COMP_AL_MFNTAG42XDNA); } if (wRxlen > 32) { return PH_ADD_COMPCODE_FIXED(PH_ERR_PROTOCOL_ERROR, PH_COMP_AL_MFNTAG42XDNA); } memcpy(bWorkBuffer, pRecv, wRxlen); /* PRQA S 3200 */ } else { if(bIns != PHAL_MFNTAG42XDNA_ISO_CHAINING_MODE) { wFrameLen = PHAL_MFNTAG42XDNA_MAXWRAPPEDAPDU_SIZE; } else { /* Get the Frame length */ PH_CHECK_SUCCESS_FCT(statusTmp, phalMfNtag42XDna_Sw_Int_GetFrameLength( pDataParams, &wFSD, &wFSC )); wFrameLen = wFSC - 9; } wTmp = wTotalLen; if (wTmp <= (wFrameLen - wCmdLen)) { wApduLen = ((wCmdLen == 0x01 ) && (bIns == PHAL_MFNTAG42XDNA_ISO_CHAINING_MODE ))? 0 : PHAL_MFNTAG42XDNA_WRAP_HDR_LEN; wCmdLen = ((wCmdLen == 0x01 ) && (bIns == PHAL_MFNTAG42XDNA_ISO_CHAINING_MODE ))? 0 : wCmdLen; /* Send in one shot */ if (pDataParams->bWrappedMode) { pApdu[1] = bCmdBuff[0]; /* Desfire cmd code in INS */ if(wCmdLen > 0) { pApdu[4] = (uint8_t)(wCmdLen + wTotalLen) - 0x01u; } PH_CHECK_SUCCESS_FCT(statusTmp, phpalMifare_ExchangeL4( pDataParams->pPalMifareDataParams, PH_EXCHANGE_BUFFER_FIRST | (((bIns == PHAL_MFNTAG42XDNA_ISO_CHAINING_MODE) && (bCommOption & PHAL_MFNTAG42XDNA_MAC_DATA_INCOMPLETE)) ? PH_EXCHANGE_TXCHAINING : 0), pApdu, wApduLen, &pRecv, &wRxlen)); if( wCmdLen > 0) { PH_CHECK_SUCCESS_FCT(statusTmp, phpalMifare_ExchangeL4( pDataParams->pPalMifareDataParams, PH_EXCHANGE_BUFFER_CONT | (((bIns == PHAL_MFNTAG42XDNA_ISO_CHAINING_MODE) && (bCommOption & PHAL_MFNTAG42XDNA_MAC_DATA_INCOMPLETE)) ? PH_EXCHANGE_TXCHAINING : 0), &bCmdBuff[1], wCmdLen - 1, &pRecv, &wRxlen)); } PH_CHECK_SUCCESS_FCT(statusTmp, phpalMifare_ExchangeL4( pDataParams->pPalMifareDataParams, PH_EXCHANGE_BUFFER_CONT | (((bIns == PHAL_MFNTAG42XDNA_ISO_CHAINING_MODE) && (bCommOption & PHAL_MFNTAG42XDNA_MAC_DATA_INCOMPLETE)) ? PH_EXCHANGE_TXCHAINING : 0), pData, wDataLen, &pRecv, &wRxlen)); #ifdef NXPBUILD__PH_CRYPTOSYM if (bMacLen != 0x0000) { PH_CHECK_SUCCESS_FCT(statusTmp, phpalMifare_ExchangeL4( pDataParams->pPalMifareDataParams, PH_EXCHANGE_BUFFER_CONT | (((bIns == PHAL_MFNTAG42XDNA_ISO_CHAINING_MODE) && (bCommOption & PHAL_MFNTAG42XDNA_MAC_DATA_INCOMPLETE)) ? PH_EXCHANGE_TXCHAINING : 0), bCMAC, bMacLen, &pRecv, &wRxlen)); } #endif /* NXPBUILD__PH_CRYPTOSYM */ /* Le byte */ PH_CHECK_SUCCESS_FCT(statusTmp, phpalMifare_ExchangeL4( pDataParams->pPalMifareDataParams, PH_EXCHANGE_BUFFER_LAST | (((bIns == PHAL_MFNTAG42XDNA_ISO_CHAINING_MODE) && (bCommOption & PHAL_MFNTAG42XDNA_MAC_DATA_INCOMPLETE)) ? PH_EXCHANGE_TXCHAINING : 0), &pApdu[2], (uint16_t)((pDataParams->dwPayLoadLen > 0xFE ) && (bIns == PHAL_MFNTAG42XDNA_ISO_CHAINING_MODE ))? 0x02U : 0x01U, &pRecv, &wRxlen)); status = pRecv[wRxlen - 1]; wRxlen -= 2; } if ((status != PH_ERR_SUCCESS) && ((status & PH_ERR_MASK) != PHAL_MFNTAG42XDNA_RESP_ADDITIONAL_FRAME)) { /* Reset authentication status */ if(pDataParams->bAuthMode == PHAL_MFNTAG42XDNA_AUTHENTICATEEV2) { phalMfNtag42XDna_Sw_Int_ResetAuthStatus(pDataParams); } return phalMfNtag42XDna_Int_ComputeErrorResponse(pDataParams, (uint8_t)status); } memcpy(bWorkBuffer, pRecv, wRxlen); /* PRQA S 3200 */ } else { #ifdef NXPBUILD__PH_CRYPTOSYM /* Send command and data. Chain data to PICC */ if(wDataLen > 0x0200) { statusTmp = phalMfNtag42XDna_Sw_Int_SendDataAndAddDataToPICC( pDataParams, bIns, bCmdBuff, wCmdLen, pData, wDataLen, bCMAC, bMacLen, bWorkBuffer, &wRxlen ); } else { statusTmp = phalMfNtag42XDna_Sw_Int_SendDataToPICC( pDataParams, bIns, (bCommOption & PHAL_MFNTAG42XDNA_MAC_DATA_INCOMPLETE), bCmdBuff, wCmdLen, pData, wDataLen, bCMAC, bMacLen, bWorkBuffer, &wRxlen ); } if ((statusTmp & PH_ERR_MASK) == PHAL_MFNTAG42XDNA_RESP_CHAINING) { return statusTmp; } if ((statusTmp & PH_ERR_MASK) != PH_ERR_SUCCESS && (statusTmp & PH_ERR_MASK) != PH_ERR_SUCCESS_CHAINING) { /* Reset authentication status */ if (pDataParams->bAuthMode == PHAL_MFNTAG42XDNA_AUTHENTICATEEV2) { phalMfNtag42XDna_Sw_Int_ResetAuthStatus(pDataParams); } return statusTmp; } #endif /* NXPBUILD__PH_CRYPTOSYM */ } } if ((status == PH_ERR_SUCCESS) && ((bCommOption & PHAL_MFNTAG42XDNA_AUTHENTICATE_RESET) == PHAL_MFNTAG42XDNA_AUTHENTICATE_RESET)) { /* Reset authentication status */ if (pDataParams->bAuthMode == PHAL_MFNTAG42XDNA_AUTHENTICATEEV2) { phalMfNtag42XDna_Sw_Int_ResetAuthStatus(pDataParams); } return PH_ERR_SUCCESS; } if (pDataParams->bAuthMode == PHAL_MFNTAG42XDNA_AUTHENTICATEEV2) { if ((status & PH_ERR_MASK) != PH_ERR_SUCCESS_CHAINING) /* if no chaining ongoing */ { if ((statusTmp & PH_ERR_MASK) == PH_ERR_SUCCESS) { /* Increment the command counter. * This increments irrespective of Plain mode or MAC mode. */ pDataParams->wCmdCtr++; } if ((bCommOption & 0xF0U) == PHAL_MFNTAG42XDNA_COMMUNICATION_MACD) { if (wRxlen < 8 ) /* If no CMAC received */ { return PH_ADD_COMPCODE_FIXED(PH_ERR_PROTOCOL_ERROR, PH_COMP_AL_MFNTAG42XDNA); } #ifdef NXPBUILD__PH_CRYPTOSYM if ((bCmdBuff[0] != PHAL_MFNTAG42XDNA_RESP_ADDITIONAL_FRAME)) { /* Load IV */ PH_CHECK_SUCCESS_FCT(statusTmp, phCryptoSym_LoadIv( pDataParams->pCryptoDataParamsMac, pDataParams->bIv, bIvLen )); } if ((statusTmp & PH_ERR_MASK) == PH_ERR_SUCCESS) { /* copy CMAC received from card*/ memcpy(bCMacCard, &bWorkBuffer[wRxlen - 8], 8); /* PRQA S 3200 */ wRxlen -= 8; /* * Calculate MAC on RC || wCmdCtr || TI || RespData * bWorkBuffer is used as receive buffer so pDataParams->pUnprocByteBuff is used */ pDataParams->bNoUnprocBytes = 0x00; pDataParams->pUnprocByteBuff[pDataParams->bNoUnprocBytes++] = 0x00; pDataParams->pUnprocByteBuff[pDataParams->bNoUnprocBytes++] = (uint8_t)(pDataParams->wCmdCtr); pDataParams->pUnprocByteBuff[pDataParams->bNoUnprocBytes++] = (uint8_t)(pDataParams->wCmdCtr >> 8); memcpy(&pDataParams->pUnprocByteBuff[pDataParams->bNoUnprocBytes], pDataParams->bTi, PHAL_MFNTAG42XDNA_SIZE_TI); /* PRQA S 3200 */ pDataParams->bNoUnprocBytes += PHAL_MFNTAG42XDNA_SIZE_TI; /* TBD:Required */ memcpy(&pDataParams->pUnprocByteBuff[pDataParams->bNoUnprocBytes], bWorkBuffer, wRxlen); /* PRQA S 3200 */ pDataParams->bNoUnprocBytes += (uint8_t)wRxlen; /* verify the MAC */ PH_CHECK_SUCCESS_FCT(statusTmp, phCryptoSym_CalculateMac( pDataParams->pCryptoDataParamsMac, (PH_CRYPTOSYM_MAC_MODE_CMAC | PH_EXCHANGE_DEFAULT), pDataParams->pUnprocByteBuff, pDataParams->bNoUnprocBytes, bCMAC, &bMacLen )); /* Truncate the MAC generated */ phalMfNtag42XDna_Sw_Int_TruncateMac(bCMAC); /* Compare the CMAC from card and CMAC calculated */ if (memcmp(bCMacCard, bCMAC, 8) != 0) { phalMfNtag42XDna_Sw_Int_ResetAuthStatus(pDataParams); return PH_ADD_COMPCODE_FIXED(PH_ERR_INTEGRITY_ERROR, PH_COMP_AL_MFNTAG42XDNA); } } #endif /* NXPBUILD__PH_CRYPTOSYM */ } } } else { /* Should not get more bytes than the status bytes in case of no authentication */ if (wRxlen > 0) { return PH_ADD_COMPCODE_FIXED(PH_ERR_PROTOCOL_ERROR, PH_COMP_AL_MFNTAG42XDNA); } } return PH_ERR_SUCCESS; } void phalMfNtag42XDna_Sw_Int_ResetAuthStatus(phalMfNtag42XDna_Sw_DataParams_t * pDataParams) { memset(pDataParams->bSesAuthENCKey, 0x00, sizeof(pDataParams->bSesAuthENCKey)); /* PRQA S 3200 */ memset(pDataParams->bSesAuthMACKey, 0x00, sizeof(pDataParams->bSesAuthMACKey)); /* PRQA S 3200 */ pDataParams->bKeyNo = 0xFF; memset(pDataParams->bIv, 0x00, sizeof(pDataParams->bIv)); /* PRQA S 3200 */ pDataParams->bAuthMode = PHAL_MFNTAG42XDNA_NOT_AUTHENTICATED; pDataParams->bCryptoMethod = 0xFF; pDataParams->wCmdCtr = 0; memset(pDataParams->bTi, 0x00, PHAL_MFNTAG42XDNA_SIZE_TI); /* PRQA S 3200 */ pDataParams->bNoUnprocBytes = 0; pDataParams->bLastBlockIndex = 0; } phStatus_t phalMfNtag42XDna_Sw_Int_SendDataToPICC(phalMfNtag42XDna_Sw_DataParams_t * pDataParams, uint8_t bIns, uint8_t bCommOption, uint8_t * pCmd, uint16_t wCmdLen, uint8_t * pData, uint16_t wDataLen, uint8_t * bLastChunk, uint16_t wLastChunkLen, uint8_t * pResp, uint16_t * pRespLen) { /* Utility function to send data to PICC if more then wFrameLen*/ phStatus_t PH_MEMLOC_REM statusTmp; uint8_t PH_MEMLOC_REM bStatusByte; uint16_t PH_MEMLOC_REM wIndexDataLen = 0; uint16_t PH_MEMLOC_REM wFrameLen; uint8_t PH_MEMLOC_REM pApdu[7] = { PHAL_MFNTAG42XDNA_WRAPPEDAPDU_CLA, 0x00, PHAL_MFNTAG42XDNA_WRAPPEDAPDU_P1, PHAL_MFNTAG42XDNA_WRAPPEDAPDU_P2, 0x00, 0x00, 0x00}; uint8_t PH_MEMLOC_REM * pRecv = NULL; uint8_t PH_MEMLOC_REM bExtended7816 = 0; uint8_t PH_MEMLOC_REM bCommOptionTmp; uint16_t PH_MEMLOC_REM wFSD = 0; uint16_t PH_MEMLOC_REM wFSC = 0; uint16_t PH_MEMLOC_REM wDataToBeSent = 0; uint16_t PH_MEMLOC_REM wCopyDataLen = 0; uint16_t PH_MEMLOC_REM wTmpDataLen = 0; uint16_t PH_MEMLOC_REM wCopyLastChunkLen = 0; uint16_t PH_MEMLOC_REM wTmpLastChunkLen = 0; uint16_t PH_MEMLOC_REM wIndexLastChunkLen = 0; uint16_t PH_MEMLOC_REM wApduHeaderLen = 0; uint16_t PH_MEMLOC_REM wLeFieldLen = 0; uint16_t PH_MEMLOC_REM wIndexCmdLen = 1; uint16_t PH_MEMLOC_REM wTmpData; uint16_t PH_MEMLOC_REM wTemLen = 0; if(bIns != PHAL_MFNTAG42XDNA_ISO_CHAINING_MODE) { wFrameLen = PHAL_MFNTAG42XDNA_MAXWRAPPEDAPDU_SIZE; wApduHeaderLen = PHAL_MFNTAG42XDNA_WRAP_HDR_LEN; } else { /* Get the Frame length */ PH_CHECK_SUCCESS_FCT(statusTmp, phalMfNtag42XDna_Sw_Int_GetFrameLength( pDataParams, &wFSD, &wFSC )); bExtended7816 = (uint8_t)(pDataParams->dwPayLoadLen > 0xFEU)? 1 : 0; /* if Lc is more then 0xFF, length of Lc should be 3 bytes */ wApduHeaderLen = PHAL_MFNTAG42XDNA_WRAP_HDR_LEN + (bExtended7816 ? 2 : 0); wFrameLen = wFSC - 4; } /* Send the data to PICC */ wTmpDataLen = wDataLen; wTmpLastChunkLen = wLastChunkLen; do { /* If Ins mode and wrapped mode are enable Le is sent with the last packet. So update Le when only last packet is sent */ wLeFieldLen = ((bIns == PHAL_MFNTAG42XDNA_ISO_CHAINING_MODE) && (pDataParams->bWrappedMode == 1)) ? 1 : 0; /* In case of wrapped mode, cmd byte is added as a part of Apdu Header. */ wIndexCmdLen = wApduHeaderLen ? 1: 0; /* this If condition is added to suppress QAC warning */ wTemLen = wCmdLen; if(wCmdLen > 0) { wTemLen = wCmdLen - wIndexCmdLen ; } /* If Ins mode and wrapped mode are enable Le is sent with the last packet */ if(pDataParams->bWrappedMode && (bIns == PHAL_MFNTAG42XDNA_ISO_CHAINING_MODE) && ((wTmpDataLen + wTmpLastChunkLen+ wTemLen) < wFrameLen)) { wLeFieldLen = 1 + bExtended7816 ; } if(wTmpDataLen > 0) { wCopyDataLen = (wTmpDataLen < (wFrameLen - (wTemLen + wApduHeaderLen)))? wTmpDataLen : (wFrameLen - (wTemLen + wApduHeaderLen)); } if(wTmpLastChunkLen > 0) { wTmpData = wTemLen + wCopyDataLen + wApduHeaderLen; wCopyLastChunkLen = (wTmpLastChunkLen < (wFrameLen - wTmpData))? wTmpLastChunkLen : (wFrameLen - wTmpData); } /* remaining data to be sent */ /* this If condition is added to suppress QAC warning */ wDataToBeSent = (wTmpDataLen - wCopyDataLen) + (wTmpLastChunkLen - wCopyLastChunkLen); wCmdLen = ((wCmdLen == 0x01 ) && (bIns == PHAL_MFNTAG42XDNA_ISO_CHAINING_MODE ))? 0 : wCmdLen; bCommOptionTmp = (uint8_t)(((!wDataToBeSent) && ( ! bCommOption )) ? 0 : 1); if (pDataParams->bWrappedMode) { pApdu[1] = pCmd[0]; /* Desfire cmd code in INS */ /* in case of ISO chaining mode, total length of data should be sent with the first frame*/ if(bExtended7816 && (bIns == PHAL_MFNTAG42XDNA_ISO_CHAINING_MODE)) { pDataParams->dwPayLoadLen = pDataParams->dwPayLoadLen +wTemLen ; pApdu[4] = (uint8_t)((pDataParams->dwPayLoadLen >> 16)& 0xFF); pApdu[5] = (uint8_t)((pDataParams->dwPayLoadLen >> 8)& 0xFF); pApdu[6] = (uint8_t) (pDataParams->dwPayLoadLen & 0xFF); } else { pApdu[4] = (uint8_t)(wTemLen + ((bIns == PHAL_MFNTAG42XDNA_ISO_CHAINING_MODE) ? pDataParams->dwPayLoadLen : (wCopyDataLen + wCopyLastChunkLen))); } wApduHeaderLen = ((bIns == PHAL_MFNTAG42XDNA_ISO_CHAINING_MODE) && (wTemLen == 0)) ? 0:wApduHeaderLen; PH_CHECK_SUCCESS_FCT(statusTmp, phpalMifare_ExchangeL4( pDataParams->pPalMifareDataParams, PH_EXCHANGE_BUFFER_FIRST | ((bIns == PHAL_MFNTAG42XDNA_ISO_CHAINING_MODE && bCommOptionTmp) ? PH_EXCHANGE_TXCHAINING : 0), pApdu, wApduHeaderLen, &pRecv, pRespLen)); PH_CHECK_SUCCESS_FCT(statusTmp, phpalMifare_ExchangeL4( pDataParams->pPalMifareDataParams, PH_EXCHANGE_BUFFER_CONT | ((bIns == PHAL_MFNTAG42XDNA_ISO_CHAINING_MODE && bCommOptionTmp) ? PH_EXCHANGE_TXCHAINING : 0), &pCmd[wIndexCmdLen], wTemLen, &pRecv, pRespLen)); PH_CHECK_SUCCESS_FCT(statusTmp, phpalMifare_ExchangeL4( pDataParams->pPalMifareDataParams, PH_EXCHANGE_BUFFER_CONT | ((bIns == PHAL_MFNTAG42XDNA_ISO_CHAINING_MODE && bCommOptionTmp) ? PH_EXCHANGE_TXCHAINING : 0), &pData[wIndexDataLen], wCopyDataLen, &pRecv, pRespLen)); /* send last chunk */ PH_CHECK_SUCCESS_FCT(statusTmp, phpalMifare_ExchangeL4( pDataParams->pPalMifareDataParams, PH_EXCHANGE_BUFFER_CONT | ((bIns == PHAL_MFNTAG42XDNA_ISO_CHAINING_MODE && bCommOptionTmp) ? PH_EXCHANGE_TXCHAINING : 0), &bLastChunk[wIndexLastChunkLen], wCopyLastChunkLen, &pRecv, pRespLen)); wLeFieldLen = ((bIns == PHAL_MFNTAG42XDNA_ISO_CHAINING_MODE) && bCommOptionTmp) ? 0 : wLeFieldLen; /* Le byte */ PH_CHECK_SUCCESS_FCT(statusTmp, phpalMifare_ExchangeL4( pDataParams->pPalMifareDataParams, PH_EXCHANGE_BUFFER_LAST | ((bIns == PHAL_MFNTAG42XDNA_ISO_CHAINING_MODE && bCommOptionTmp) ? PH_EXCHANGE_TXCHAINING : 0), &pApdu[2], wLeFieldLen, &pRecv, pRespLen)); } /* copy number of data sent */ wIndexDataLen += wCopyDataLen; wIndexLastChunkLen += wCopyLastChunkLen; /* copy the remaining data to be sent */ /* this If condition is added to suppress QAC warning */ if(wTmpDataLen > 0) { wTmpDataLen = wTmpDataLen - wCopyDataLen; } /* this If condition is added to suppress QAC warning */ if(wTmpLastChunkLen > 0) { wTmpLastChunkLen = wTmpLastChunkLen - wCopyLastChunkLen; } wCopyDataLen = 0; wCopyLastChunkLen = 0; /* in case of 14443-4 chaining R-block that indicates a positive acknowledge */ if(bIns == PHAL_MFNTAG42XDNA_ISO_CHAINING_MODE && bCommOptionTmp) { bStatusByte = (uint8_t)((pRecv[0] & 0xF0) == 0xA0) ? PHAL_MFNTAG42XDNA_RESP_ADDITIONAL_FRAME : PH_ERR_PROTOCOL_ERROR; } else { memcpy(pResp, pRecv, (*pRespLen) - 2); /* PRQA S 3200 */ bStatusByte = pRecv[(*pRespLen) - 1]; (*pRespLen) -= 2; } if ((bStatusByte != PHAL_MFNTAG42XDNA_RESP_ADDITIONAL_FRAME) && (bStatusByte != PH_ERR_SUCCESS)) { return phalMfNtag42XDna_Int_ComputeErrorResponse(pDataParams, bStatusByte); } /* Success returned even before writing all data? protocol error */ if ((bStatusByte == PH_ERR_SUCCESS) && (bCommOptionTmp != 0)) { return PH_ADD_COMPCODE_FIXED(PH_ERR_PROTOCOL_ERROR, PH_COMP_AL_MFNTAG42XDNA); } if(bStatusByte != 0x00) { pCmd[0] = PHAL_MFNTAG42XDNA_RESP_ADDITIONAL_FRAME; wCmdLen = (bIns == PHAL_MFNTAG42XDNA_ISO_CHAINING_MODE)? 0: 1; wApduHeaderLen = (bIns == PHAL_MFNTAG42XDNA_ISO_CHAINING_MODE)? 0: wApduHeaderLen; } }while(wDataToBeSent); return phalMfNtag42XDna_Int_ComputeErrorResponse(pDataParams, bStatusByte); } phStatus_t phalMfNtag42XDna_Sw_Int_SendDataAndAddDataToPICC(phalMfNtag42XDna_Sw_DataParams_t * pDataParams, uint8_t bIns, uint8_t * pCmd, uint16_t wCmdLen, uint8_t * pData, uint16_t wDataLen, uint8_t * pAddData, uint16_t wAddDataLen, uint8_t * pResp, uint16_t * pRespLen) { /* Utility function to send encrypted data to PICC as and when it is available from SAM */ phStatus_t PH_MEMLOC_REM statusTmp; uint8_t PH_MEMLOC_REM bStatusByte = 0; uint16_t PH_MEMLOC_REM wIndex = 0; uint16_t PH_MEMLOC_REM wDataLeft; uint16_t PH_MEMLOC_REM wFrameLen; uint8_t PH_MEMLOC_REM pApdu[7] = { PHAL_MFNTAG42XDNA_WRAPPEDAPDU_CLA, 0x00, PHAL_MFNTAG42XDNA_WRAPPEDAPDU_P1, PHAL_MFNTAG42XDNA_WRAPPEDAPDU_P2, 0x00, 0x00, 0x00 }; uint8_t PH_MEMLOC_REM pLe[2] = {0x00, 0x00}; uint8_t PH_MEMLOC_REM * pRecv; uint16_t PH_MEMLOC_REM wFSD = 0; uint16_t PH_MEMLOC_REM wFSC = 0; uint16_t PH_MEMLOC_REM wrappedApduHeaderLen = PHAL_MFNTAG42XDNA_WRAP_HDR_LEN; uint16_t PH_MEMLOC_REM wrappedApduTrailerLen = 1; uint8_t PH_MEMLOC_REM bIsExtended7816 = 0; uint16_t PH_MEMLOC_REM wHeaderIdx = 0; uint16_t PH_MEMLOC_REM wCmdIdx = 0; uint16_t PH_MEMLOC_REM wAddDataIdx = 0; uint16_t PH_MEMLOC_REM wTrailerIdx = 0; uint16_t PH_MEMLOC_REM wWrappedApduHeaderLenLeft = 0; uint16_t PH_MEMLOC_REM wWrappedApduTrailerLenLeft = 0; uint16_t PH_MEMLOC_REM wCmdLenLeft = 0; uint16_t PH_MEMLOC_REM wAddDataLenLeft = 0; uint16_t PH_MEMLOC_REM wAddDataLenTotal = 0; uint16_t PH_MEMLOC_REM wCmdLenTotal = 0; uint16_t PH_MEMLOC_REM wDataLenTotal = 0; uint16_t PH_MEMLOC_REM wMoreDataToTransmit = 0; if(bIns != PHAL_MFNTAG42XDNA_ISO_CHAINING_MODE_MAPPED) { if (pDataParams->bWrappedMode) { wFrameLen = PHAL_MFNTAG42XDNA_MAXDFAPDU_SIZE; } else { wFrameLen = PHAL_MFNTAG42XDNA_MAXDFAPDU_SIZE; } } else { /* Get the Frame length */ PH_CHECK_SUCCESS_FCT(statusTmp, phalMfNtag42XDna_Sw_Int_GetFrameLength( pDataParams, &wFSD, &wFSC )); if (pDataParams->bWrappedMode) { bIsExtended7816 = (uint8_t)((wCmdLen + wDataLen + wAddDataLen - 0x01u) > 255); wrappedApduHeaderLen += (bIsExtended7816 ? 2 : 0); wrappedApduTrailerLen += (bIsExtended7816 ? 1 : 0); } wFrameLen = wFSC - 4; } wWrappedApduHeaderLenLeft = wrappedApduHeaderLen; wCmdLenLeft = wCmdLenTotal = (pDataParams->bWrappedMode) ? ((wCmdLen > 0) ? wCmdLen - 1 : 0) : wCmdLen; /* subtract instruction byte */ wDataLeft = wDataLenTotal = wDataLen; wAddDataLenLeft = wAddDataLenTotal = wAddDataLen; wWrappedApduTrailerLenLeft = wrappedApduTrailerLen; do { if (pDataParams->bWrappedMode) { if(bIns == PHAL_MFNTAG42XDNA_ISO_CHAINING_MODE_MAPPED) { if(wWrappedApduHeaderLenLeft > 0) wrappedApduHeaderLen = (wFrameLen / wWrappedApduHeaderLenLeft) ? wWrappedApduHeaderLenLeft : wFrameLen % wWrappedApduHeaderLenLeft; else wrappedApduHeaderLen = 0; if(wCmdLenLeft > 0) wCmdLen = ((wFrameLen - wrappedApduHeaderLen) / wCmdLenLeft) ? wCmdLenLeft : (wFrameLen - wrappedApduHeaderLen) % wCmdLenLeft; else wCmdLen = 0; if(wDataLeft > 0) wDataLen = ((wFrameLen - wrappedApduHeaderLen - wCmdLen) / wDataLeft) ? wDataLeft : (wFrameLen - wrappedApduHeaderLen - wCmdLen) % wDataLeft; else wDataLen = 0; if(wAddDataLenLeft > 0) wAddDataLen = ((wFrameLen - wrappedApduHeaderLen - wCmdLen - wDataLen) / wAddDataLenLeft) ? wAddDataLenLeft : (wFrameLen - wrappedApduHeaderLen - wCmdLen - wDataLen) % wAddDataLenLeft; else wAddDataLen = 0; if(wWrappedApduTrailerLenLeft > 0) wrappedApduTrailerLen = ((wFrameLen - wrappedApduHeaderLen - wCmdLen - wDataLen - wAddDataLen) / wWrappedApduTrailerLenLeft) ? wWrappedApduTrailerLenLeft : ((wFrameLen - wrappedApduHeaderLen - wCmdLen - wDataLen - wAddDataLen) % wWrappedApduTrailerLenLeft); } else { if(wWrappedApduHeaderLenLeft > 0) wrappedApduHeaderLen = (wFrameLen / wWrappedApduHeaderLenLeft) ? wWrappedApduHeaderLenLeft : wFrameLen % wWrappedApduHeaderLenLeft; else wrappedApduHeaderLen = 0; if(wWrappedApduTrailerLenLeft > 0) wrappedApduTrailerLen = ((wFrameLen - wrappedApduHeaderLen) / wWrappedApduTrailerLenLeft) ? wWrappedApduTrailerLenLeft : ((wFrameLen - wrappedApduHeaderLen) % wWrappedApduTrailerLenLeft); else wrappedApduTrailerLen = 0; if(wCmdLenLeft > 0) wCmdLen = ((wFrameLen - wrappedApduHeaderLen - wrappedApduTrailerLen) / wCmdLenLeft) ? wCmdLenLeft : (wFrameLen - wrappedApduHeaderLen - wrappedApduTrailerLen) % wCmdLenLeft; else wCmdLen = 0; if(wDataLeft > 0) wDataLen = ((wFrameLen - wrappedApduHeaderLen - wrappedApduTrailerLen - wCmdLen) / wDataLeft) ? wDataLeft : (wFrameLen - wrappedApduHeaderLen - wrappedApduTrailerLen - wCmdLen) % wDataLeft; else wDataLen = 0; if(wAddDataLenLeft > 0) wAddDataLen = ((wFrameLen - wrappedApduHeaderLen - wrappedApduTrailerLen - wCmdLen - wDataLen) / wAddDataLenLeft) ? wAddDataLenLeft : (wFrameLen - wrappedApduHeaderLen - wrappedApduTrailerLen - wCmdLen - wDataLen) % wAddDataLenLeft; else wAddDataLen = 0; } pApdu[1] = pCmd[0]; /* Desfire cmd code in INS */ if(bIsExtended7816 && (bIns == PHAL_MFNTAG42XDNA_ISO_CHAINING_MODE_MAPPED)) { pApdu[6] = (uint8_t)(wCmdLenTotal + wDataLenTotal + wAddDataLenTotal); pApdu[5] = (uint8_t)((wCmdLenTotal + wDataLenTotal + wAddDataLenTotal)>>8); /*pApdu[4] = 0; */ } else pApdu[4] = (uint8_t)(wCmdLen + ((bIns == PHAL_MFNTAG42XDNA_ISO_CHAINING_MODE_MAPPED) ? wDataLenTotal + wAddDataLenTotal : wDataLen + wAddDataLen)); wMoreDataToTransmit = (wWrappedApduHeaderLenLeft - wrappedApduHeaderLen) + (wCmdLenLeft - wCmdLen) + (wDataLeft - wDataLen) + (wAddDataLenLeft - wAddDataLen) + (wWrappedApduTrailerLenLeft - wrappedApduTrailerLen); PH_CHECK_SUCCESS_FCT(statusTmp, phpalMifare_ExchangeL4( pDataParams->pPalMifareDataParams, PH_EXCHANGE_BUFFER_FIRST | ((bIns == PHAL_MFNTAG42XDNA_ISO_CHAINING_MODE_MAPPED && wMoreDataToTransmit) ? PH_EXCHANGE_TXCHAINING : 0), &pApdu[wHeaderIdx], wrappedApduHeaderLen, &pRecv, pRespLen)); PH_CHECK_SUCCESS_FCT(statusTmp, phpalMifare_ExchangeL4( pDataParams->pPalMifareDataParams, PH_EXCHANGE_BUFFER_CONT | ((bIns == PHAL_MFNTAG42XDNA_ISO_CHAINING_MODE_MAPPED && wMoreDataToTransmit) ? PH_EXCHANGE_TXCHAINING : 0), &pCmd[1 + wCmdIdx], wCmdLen, &pRecv, pRespLen)); PH_CHECK_SUCCESS_FCT(statusTmp, phpalMifare_ExchangeL4( pDataParams->pPalMifareDataParams, PH_EXCHANGE_BUFFER_CONT | ((bIns == PHAL_MFNTAG42XDNA_ISO_CHAINING_MODE_MAPPED && wMoreDataToTransmit) ? PH_EXCHANGE_TXCHAINING : 0), &pData[wIndex], wDataLen, &pRecv, pRespLen)); PH_CHECK_SUCCESS_FCT(statusTmp, phpalMifare_ExchangeL4( pDataParams->pPalMifareDataParams, PH_EXCHANGE_BUFFER_CONT | ((bIns == PHAL_MFNTAG42XDNA_ISO_CHAINING_MODE_MAPPED && wMoreDataToTransmit) ? PH_EXCHANGE_TXCHAINING : 0), &pAddData[wAddDataIdx], wAddDataLen, &pRecv, pRespLen)); /* Le byte */ PH_CHECK_SUCCESS_FCT(statusTmp, phpalMifare_ExchangeL4( pDataParams->pPalMifareDataParams, PH_EXCHANGE_BUFFER_LAST | ((bIns == PHAL_MFNTAG42XDNA_ISO_CHAINING_MODE_MAPPED && wMoreDataToTransmit) ? PH_EXCHANGE_TXCHAINING : 0), &pLe[wTrailerIdx], wrappedApduTrailerLen, &pRecv, pRespLen)); if(bIns == PHAL_MFNTAG42XDNA_ISO_CHAINING_MODE_MAPPED) { wHeaderIdx += wrappedApduHeaderLen; wWrappedApduHeaderLenLeft -= wrappedApduHeaderLen; wCmdIdx += wCmdLen; wCmdLenLeft -= wCmdLen; wTrailerIdx += wrappedApduTrailerLen; wWrappedApduTrailerLenLeft -= wrappedApduTrailerLen; } } else { if(wCmdLenLeft > 0) wCmdLen = ((wFrameLen) / wCmdLenLeft) ? wCmdLenLeft : (wFrameLen) % wCmdLenLeft; else wCmdLen = 0; if(wDataLeft > 0) wDataLen = ((wFrameLen - wCmdLen) / wDataLeft) ? wDataLeft : (wFrameLen - wCmdLen) % wDataLeft; else wDataLen = 0; if(wAddDataLenLeft > 0) wAddDataLen = ((wFrameLen - wCmdLen - wDataLen) / wAddDataLenLeft) ? wAddDataLenLeft : (wFrameLen - wCmdLen - wDataLen) % wAddDataLenLeft; else wAddDataLen = 0; wMoreDataToTransmit = (wCmdLenLeft - wCmdLen) + (wDataLeft - wDataLen) + (wAddDataLenLeft - wAddDataLen); PH_CHECK_SUCCESS_FCT(statusTmp, phpalMifare_ExchangeL4( pDataParams->pPalMifareDataParams, PH_EXCHANGE_BUFFER_FIRST | ((bIns == PHAL_MFNTAG42XDNA_ISO_CHAINING_MODE_MAPPED && wMoreDataToTransmit) ? PH_EXCHANGE_TXCHAINING : 0), &pCmd[wCmdIdx], wCmdLen, &pRecv, pRespLen)); PH_CHECK_SUCCESS_FCT(statusTmp, phpalMifare_ExchangeL4( pDataParams->pPalMifareDataParams, PH_EXCHANGE_BUFFER_CONT | ((bIns == PHAL_MFNTAG42XDNA_ISO_CHAINING_MODE_MAPPED && wMoreDataToTransmit) ? PH_EXCHANGE_TXCHAINING : 0), &pData[wIndex], wDataLen, &pRecv, pRespLen)); PH_CHECK_SUCCESS_FCT(statusTmp, phpalMifare_ExchangeL4( pDataParams->pPalMifareDataParams, PH_EXCHANGE_BUFFER_LAST | ((bIns == PHAL_MFNTAG42XDNA_ISO_CHAINING_MODE_MAPPED && wMoreDataToTransmit) ? PH_EXCHANGE_TXCHAINING : 0), &pAddData[wAddDataIdx], wAddDataLen, &pRecv, pRespLen)); wCmdIdx += wCmdLen; wCmdLenLeft -= wCmdLen; } wIndex += wDataLen; wDataLeft -= wDataLen; wAddDataIdx += wAddDataLen; wAddDataLenLeft -= wAddDataLen; /* in case of BIGISO, iso chaining is expected, and therefore R(ACK) block*/ if(bIns == PHAL_MFNTAG42XDNA_ISO_CHAINING_MODE_MAPPED && wMoreDataToTransmit) { /* in case of ACK */ if((pRecv[0] & 0xF0) == 0xA0) { continue; } } if (pDataParams->bWrappedMode) { if((*pRespLen)<2) { return PH_ADD_COMPCODE_FIXED(PH_ERR_PROTOCOL_ERROR, PH_COMP_AL_MFNTAG42XDNA); } memcpy(pResp, pRecv, (*pRespLen) - 2); /* PRQA S 3200 */ bStatusByte = pRecv[(*pRespLen) - 1]; (*pRespLen) -= 2; } else { if((*pRespLen)<1) { return PH_ADD_COMPCODE_FIXED(PH_ERR_PROTOCOL_ERROR, PH_COMP_AL_MFNTAG42XDNA); } memcpy(pResp, &pRecv[1], (*pRespLen) - 1); /* PRQA S 3200 */ bStatusByte = pRecv[0]; (*pRespLen) -= 1; } if ((bStatusByte != PHAL_MFNTAG42XDNA_RESP_ADDITIONAL_FRAME) && (bStatusByte != PH_ERR_SUCCESS)) { /* Reset authentication status */ if ((pDataParams->bAuthMode == PHAL_MFNTAG42XDNA_AUTHENTICATEISO) || (pDataParams->bAuthMode == PHAL_MFNTAG42XDNA_AUTHENTICATEAES)) { phalMfNtag42XDna_Sw_Int_ResetAuthStatus(pDataParams); } return phalMfNtag42XDna_Int_ComputeErrorResponse(pDataParams, bStatusByte); } /* Success returned even before writing all data? protocol error */ if ((bStatusByte == PH_ERR_SUCCESS) && (wDataLeft != 0)) { /* Reset authentication status */ if ((pDataParams->bAuthMode == PHAL_MFNTAG42XDNA_AUTHENTICATEISO) || (pDataParams->bAuthMode == PHAL_MFNTAG42XDNA_AUTHENTICATEAES)) { phalMfNtag42XDna_Sw_Int_ResetAuthStatus(pDataParams); } return PH_ADD_COMPCODE_FIXED(PH_ERR_PROTOCOL_ERROR, PH_COMP_AL_MFNTAG42XDNA); } if(bStatusByte != 0x00) { pCmd[0] = PHAL_MFNTAG42XDNA_RESP_ADDITIONAL_FRAME; wCmdIdx = 0; wCmdLenLeft = (pDataParams->bWrappedMode) ? 0 : 1; } } while(wMoreDataToTransmit); return phalMfNtag42XDna_Int_ComputeErrorResponse(pDataParams, bStatusByte); } phStatus_t phalMfNtag42XDna_Sw_Int_IsoRead(phalMfNtag42XDna_Sw_DataParams_t * pDataParams, uint16_t wOption, uint8_t * bCmdBuff, uint16_t wCmdLen, uint8_t ** ppRxBuffer, uint32_t * pBytesRead) { phStatus_t PH_MEMLOC_REM status; uint16_t PH_MEMLOC_REM statusTmp; uint16_t PH_MEMLOC_REM wRxBufferSize; uint32_t PH_MEMLOC_REM wNextPos; uint8_t PH_MEMLOC_REM *pRecv; uint8_t PH_MEMLOC_REM bBackupBytes[3]; #ifdef NXPBUILD__PH_CRYPTOSYM uint8_t PH_MEMLOC_REM bMacLenComputed = 0; uint8_t PH_MEMLOC_REM bCMacCard[8]; uint8_t PH_MEMLOC_REM bCMAC[16]; uint8_t PH_MEMLOC_REM bMacLen; uint8_t PH_MEMLOC_REM bIvLen; memset(bCMAC, 0, 16);/* PRQA S 3200 */ bIvLen = PH_CRYPTOSYM_DES_BLOCK_SIZE; if ( wOption == PH_EXCHANGE_DEFAULT ) { if(pDataParams->bAuthMode == PHAL_MFNTAG42XDNA_AUTHENTICATEEV2) { memset(pDataParams->bIv, 0x00, bIvLen); /* PRQA S 3200 */ } } #endif /* NXPBUILD__PH_CRYPTOSYM */ status = phpalMifare_ExchangeL4( pDataParams->pPalMifareDataParams, (wOption & PH_EXCHANGE_MODE_MASK), bCmdBuff, wCmdLen, ppRxBuffer, (uint16_t *)pBytesRead ); /* First put everything on the reader Rx buffer upto buffer size - 60 */ pRecv = *ppRxBuffer; if ((status != PH_ERR_SUCCESS) && ((status & PH_ERR_MASK) != PH_ERR_SUCCESS_CHAINING)) { #ifdef NXPBUILD__PH_CRYPTOSYM /* Authentication should be reset */ phalMfNtag42XDna_Sw_Int_ResetAuthStatus(pDataParams); #endif /* NXPBUILD__PH_CRYPTOSYM */ return status; } while ((status & PH_ERR_MASK) == PH_ERR_SUCCESS_CHAINING) { PH_CHECK_SUCCESS_FCT(statusTmp, phhalHw_GetConfig( pDataParams->pHalDataParams, PHHAL_HW_CONFIG_RXBUFFER_BUFSIZE, &wRxBufferSize )); wNextPos = *pBytesRead; memcpy(bBackupBytes, &pRecv[wNextPos - 3], 3); /* PRQA S 3200 */ if (wNextPos + PHAL_MFNTAG42XDNA_MAX_FRAME_SIZE >= wRxBufferSize) { /* Calculate partical cmac if authenticated and return PH_ERR_SUCCESS_CHAINING */ break; } PH_CHECK_SUCCESS_FCT(statusTmp, phhalHw_SetConfig( pDataParams->pHalDataParams, PHHAL_HW_CONFIG_RXBUFFER_STARTPOS, (uint16_t)wNextPos )); status = phpalMifare_ExchangeL4( pDataParams->pPalMifareDataParams, PH_EXCHANGE_RXCHAINING, bCmdBuff, wCmdLen, ppRxBuffer, (uint16_t *)pBytesRead ); /* Put back the backed up bytes */ memcpy(&pRecv[wNextPos - 3], bBackupBytes, 3); /* PRQA S 3200 */ if ((status != PH_ERR_SUCCESS) && ((status & PH_ERR_MASK) != PH_ERR_SUCCESS_CHAINING)) { #ifdef NXPBUILD__PH_CRYPTOSYM /* Authentication should be reset */ phalMfNtag42XDna_Sw_Int_ResetAuthStatus(pDataParams); #endif /* NXPBUILD__PH_CRYPTOSYM */ return status; } } /* The data is now in *ppRxBuffer, length = wRxlen */ #ifdef NXPBUILD__PH_CRYPTOSYM /* Size of MAC bytes */ bMacLen = 0x08; #endif /* NXPBUILD__PH_CRYPTOSYM */ if (status == PH_ERR_SUCCESS) { statusTmp = (*ppRxBuffer)[*pBytesRead - 2]; /* SW1 */ statusTmp = statusTmp << 8; /* Shift SW1 to MSB */ statusTmp |= (*ppRxBuffer)[*pBytesRead - 1]; /* SW2 */ if (pDataParams->bAuthMode == PHAL_MFNTAG42XDNA_NOT_AUTHENTICATED || (pDataParams->bAuthMode == PHAL_MFNTAG42XDNA_AUTHENTICATE && ((wOption & PH_EXCHANGE_CUSTOM_BITS_MASK) == PHAL_MFNTAG42XDNA_COMMUNICATION_PLAIN))) { *pBytesRead -= 2; return phalMfNtag42XDna_Int_ComputeErrorResponse(pDataParams, statusTmp); } statusTmp = phalMfNtag42XDna_Int_ComputeErrorResponse(pDataParams, statusTmp); if (statusTmp != PH_ERR_SUCCESS) { #ifdef NXPBUILD__PH_CRYPTOSYM /* Authentication should be reset */ phalMfNtag42XDna_Sw_Int_ResetAuthStatus(pDataParams); #endif /* NXPBUILD__PH_CRYPTOSYM */ return statusTmp; } #ifdef NXPBUILD__PH_CRYPTOSYM /* Verify MAC. Dont consider SW1SW2 as MAC bytes */ memcpy(bCMacCard, &(*ppRxBuffer)[*pBytesRead - ( bMacLen + 2)], bMacLen); /* PRQA S 3200 */ /* Subtract the MAC bytes */ *pBytesRead -= ( bMacLen + 2); (*ppRxBuffer)[(*pBytesRead)] = 0x00; if (memcmp(bCMAC, bCMacCard, bMacLen) != 0x00) { return PH_ADD_COMPCODE_FIXED(PH_ERR_INTEGRITY_ERROR, PH_COMP_AL_MFNTAG42XDNA); } if(pDataParams->bAuthMode == PHAL_MFNTAG42XDNA_AUTHENTICATEISO || pDataParams->bAuthMode == PHAL_MFNTAG42XDNA_AUTHENTICATEAES) { /* Update IV */ memcpy(pDataParams->bIv, bCMAC, bMacLenComputed); /* PRQA S 3200 */ } #endif /* NXPBUILD__PH_CRYPTOSYM */ } else { } return PH_ADD_COMPCODE((status & PH_ERR_MASK), PH_COMP_AL_MFNTAG42XDNA); } void phalMfNtag42XDna_Sw_Int_TruncateMac(uint8_t * pMac) { uint8_t PH_MEMLOC_REM bIndex; uint8_t PH_MEMLOC_REM bIndex2; for (bIndex = 1, bIndex2 = 0; bIndex < 16; bIndex += 2, bIndex2++) { pMac[bIndex2] = pMac[bIndex]; } } #ifdef NXPBUILD__PH_CRYPTOSYM phStatus_t phalMfNtag42XDna_Sw_Int_ComputeIv(uint8_t bIsResponse, uint8_t * pTi, uint16_t wCmdCtr, uint8_t * pIv) { uint8_t PH_MEMLOC_REM bIndex = 0; uint8_t PH_MEMLOC_REM bCmdCtrMsb = (uint8_t)(wCmdCtr >> 8); uint8_t PH_MEMLOC_REM bCmdCtrLsb = (uint8_t)(wCmdCtr & 0x00ff); memset(pIv, 0, PH_CRYPTOSYM_AES_BLOCK_SIZE); /* PRQA S 3200 */ /* parameter checking */ if ((pTi == NULL) || (pIv == NULL)) { return PH_ADD_COMPCODE_FIXED(PH_ERR_INTERNAL_ERROR, PH_COMP_AL_MFNTAG42XDNA); } if (bIsResponse) { /* Form the IV for RespData as 0x5A||0xA5||TI||CmdCtr||0x0000000000000000 */ pIv[bIndex++] = 0x5A; pIv[bIndex++] = 0xA5; } else { /* Form the IV for CmdData as 0xA5||0x5A||TI||CmdCtr||0x0000000000000000 */ pIv[bIndex++] = 0xA5; pIv[bIndex++] = 0x5A; } pIv[bIndex++] = pTi[0]; pIv[bIndex++] = pTi[1]; pIv[bIndex++] = pTi[2]; pIv[bIndex++] = pTi[3]; pIv[bIndex++] = bCmdCtrLsb; pIv[bIndex++] = bCmdCtrMsb; return PH_ERR_SUCCESS; } #endif /* NXPBUILD__PH_CRYPTOSYM */ phStatus_t phalMfNtag42XDna_Sw_Int_GetFrameLength(phalMfNtag42XDna_Sw_DataParams_t * pDataParams, uint16_t * pFSD, uint16_t * pFSC) { uint16_t PH_MEMLOC_REM statusTmp; uint16_t PH_MEMLOC_REM wTmp = 0; PH_CHECK_SUCCESS_FCT(statusTmp, phpalMifare_GetConfig( pDataParams->pPalMifareDataParams, PHPAL_I14443P4_CONFIG_FSI, &wTmp )); /* Get FSD */ switch((uint8_t)(wTmp >> 8)) { case 0: *pFSD = 16; break; case 1: *pFSD = 24; break; case 2: *pFSD = 32; break; case 3: *pFSD = 40; break; case 4: *pFSD = 48; break; case 5: *pFSD = 64; break; case 6: *pFSD = 96; break; case 7: *pFSD = 128; break; case 8: *pFSD = 256; break; default: break; } /* Get FSC */ switch((uint8_t)(wTmp)) { case 0: *pFSC = 16; break; case 1: *pFSC = 24; break; case 2: *pFSC = 32; break; case 3: *pFSC = 40; break; case 4: *pFSC = 48; break; case 5: *pFSC = 64; break; case 6: *pFSC = 96; break; case 7: *pFSC = 128; break; case 8: *pFSC = 256; break; default: break; } return PH_ERR_SUCCESS; } #ifdef NXPBUILD__PH_CRYPTOSYM phStatus_t phalMfNtag42XDna_Sw_Int_AuthenticateEv2(phalMfNtag42XDna_Sw_DataParams_t * pDataParams, uint8_t bAuthOption, uint16_t wOption, uint16_t wKeyNo, uint16_t wKeyVer, uint8_t bKeyNoCard, uint8_t * pDivInput, uint8_t bDivLen, uint8_t bLenPcdCapsIn, uint8_t *pPcdCapsIn, uint8_t *pPcdCapsOut, uint8_t *pPdCapsOut) { /* Validate parameters * bAuthOption should be either one(PHAL_MFNTAG42XDNA_AUTHFIRST_NON_LRP) or zero(PHAL_MFNTAG42XDNA_AUTHNONFIRST_NON_LRP). * wOption should be validated and interpreted similar to other authenticate * functions above. * Check that key referenced by wKeyNo and wKeyVer is an AES128 key else throw error (KEY_ERROR) * bKeyNoCard cannot be greater than 0xF. * if wOption != 0xFFFF then check for bDivLen. If bDivLen is zero, then ignore div input. * bLenPcdCapsIn <= 6 */ /* Form the command Cmd + bKeyNo + bLenPcdCapsIn + pPcdCapsIn * phpalMifare_ExchangeL4(cmdarray); * if response != 16+1, return PROTOCOL_ERROR and also first byte should be 0xAF * Load the AES 128 key specified by wKeyNo and wKeyVer in the cryptodataparams * Decrypt the RndB * Insert a seed. * Generate RndA * * Left rotate RndB to generate RndB` * Concatenate RndA||RndB` and encrypt this. * phpalMifare_ExchangeL4(EXCHANGE_Default, AF || Enc(RndA ||RndB`)); * if (bFirstAuth) then PD Caps and PCD Caps are returned. Not otherwise. * Verify RndA by decrypting the response. Store TI into the pDataParams. * As per 4.9.7, Generate SV1 and Sv2 * The session key generation is according to NIST SP 800-108 [14] in counter mode. * The pseudo random function PRF(key, message) applied during the key generation is the the CMAC algorithm * Encipher SV1 to generate EncSessionkey * Encipher SV2 to generate MACSessionKey. * Assign these in pDataParams. * Load EncSessionkey and MACSessionkey. */ uint8_t PH_MEMLOC_REM bRndA[PH_CRYPTOSYM_AES_BLOCK_SIZE]; uint8_t PH_MEMLOC_REM bRndB[PH_CRYPTOSYM_AES_BLOCK_SIZE+1]; phStatus_t PH_MEMLOC_REM statusTmp; uint8_t PH_MEMLOC_REM bKey[PH_CRYPTOSYM_AES128_KEY_SIZE]; uint16_t PH_MEMLOC_REM wKeyType; uint16_t PH_MEMLOC_REM wRxlen; uint8_t PH_MEMLOC_REM bCmdBuff[60U]; uint16_t PH_MEMLOC_REM status; uint16_t PH_MEMLOC_REM wCmdLen = 0; uint8_t PH_MEMLOC_REM bRndLen; uint8_t PH_MEMLOC_REM bIvLen; uint8_t PH_MEMLOC_REM bSV1[32]; uint8_t PH_MEMLOC_REM bTmp; uint8_t * PH_MEMLOC_REM pRecv; uint8_t PH_MEMLOC_REM bAppId[3] = {0x00, 0x00, 0x00}; uint8_t PH_MEMLOC_REM bMacLen; /* Set the current authentication status to NOT AUTHENTICATED i.e., invalid key number */ pDataParams->bKeyNo = 0xFF; #ifdef RDR_LIB_PARAM_CHECK if (bAuthOption > PHAL_MFNTAG42XDNA_AUTHFIRST_LRP) { return PH_ADD_COMPCODE_FIXED(PH_ERR_INVALID_PARAMETER, PH_COMP_AL_MFNTAG42XDNA); } /* Validate Card Key Number */ if(memcmp(pDataParams->pAid, bAppId, 3) == 0x00) { /* At PICC level, 1,2,3,4 are valid ones. 0 is excluded */ if((bKeyNoCard > PHAL_MFNTAG42XDNA_ORIGINALITY_KEY_LAST ) || (bKeyNoCard < PHAL_MFNTAG42XDNA_ORIGINALITY_KEY_FIRST)) { return PH_ADD_COMPCODE_FIXED(PH_ERR_INVALID_PARAMETER, PH_COMP_AL_MFNTAG42XDNA); } } else { /* At App level, 0,1,2,3,4 are valid ones. */ if((bKeyNoCard > PHAL_MFNTAG42XDNA_ORIGINALITY_KEY_LAST)) { return PH_ADD_COMPCODE_FIXED(PH_ERR_INVALID_PARAMETER, PH_COMP_AL_MFNTAG42XDNA); } } if ((wOption != PHAL_MFNTAG42XDNA_NO_DIVERSIFICATION) && (wOption != PH_CRYPTOSYM_DIV_MODE_DESFIRE) && (wOption != PH_CRYPTOSYM_DIV_MODE_MIFARE_PLUS)) { return PH_ADD_COMPCODE_FIXED(PH_ERR_INVALID_PARAMETER, PH_COMP_AL_MFNTAG42XDNA); } if ((wOption != PHAL_MFNTAG42XDNA_NO_DIVERSIFICATION) && (bDivLen > 31)) { return PH_ADD_COMPCODE_FIXED(PH_ERR_INVALID_PARAMETER, PH_COMP_AL_MFNTAG42XDNA); } if(bLenPcdCapsIn > 6) { return PH_ADD_COMPCODE_FIXED(PH_ERR_INVALID_PARAMETER, PH_COMP_AL_MFNTAG42XDNA); } #endif /* Get Key out of the key store object */ PH_CHECK_SUCCESS_FCT(statusTmp, phKeyStore_GetKey( pDataParams->pKeyStoreDataParams, wKeyNo, wKeyVer, PH_CRYPTOSYM_AES128_KEY_SIZE, bKey, &wKeyType )); /* Invalid key type at wKeyNo and wKeyVer */ if (wKeyType != PH_CRYPTOSYM_KEY_TYPE_AES128) { return PH_ADD_COMPCODE_FIXED(PH_ERR_KEY, PH_COMP_AL_MFNTAG42XDNA); } if ((wOption != PHAL_MFNTAG42XDNA_NO_DIVERSIFICATION) && (bDivLen != 0x00)) { /* Key is diversified and put back in bKey */ PH_CHECK_SUCCESS_FCT(statusTmp, phCryptoSym_DiversifyDirectKey( pDataParams->pCryptoDataParamsEnc, wOption, bKey, wKeyType, pDivInput, bDivLen, bKey )); } bRndLen = PH_CRYPTOSYM_AES_BLOCK_SIZE; bIvLen = PH_CRYPTOSYM_AES_BLOCK_SIZE; /* load key */ PH_CHECK_SUCCESS_FCT(statusTmp, phCryptoSym_LoadKeyDirect( pDataParams->pCryptoDataParamsEnc, bKey, wKeyType)); /* Send the cmd and receive the encrypted RndB */ if (bAuthOption == PHAL_MFNTAG42XDNA_AUTHFIRST_NON_LRP) { bCmdBuff[wCmdLen++] = PHAL_MFNTAG42XDNA_CMD_AUTHENTICATE_EV2_FIRST; } else { bCmdBuff[wCmdLen++] = PHAL_MFNTAG42XDNA_CMD_AUTHENTICATE_EV2_NON_FIRST; } bCmdBuff[wCmdLen++] = bKeyNoCard; /* key number card */ if (bAuthOption == PHAL_MFNTAG42XDNA_AUTHFIRST_NON_LRP) { /* Maximum frame size of card is 64 bytes, so the data should be of max 57 bytes */ bLenPcdCapsIn = (bLenPcdCapsIn > 57) ? 57 : bLenPcdCapsIn; bCmdBuff[wCmdLen++] = bLenPcdCapsIn; /* PCD Caps In length */ /* PCD Caps In */ memcpy(&bCmdBuff[wCmdLen], pPcdCapsIn, bLenPcdCapsIn); /* PRQA S 3200 */ wCmdLen += bLenPcdCapsIn; } status = phalMfNtag42XDna_ExchangeCmd( pDataParams, pDataParams->pPalMifareDataParams, pDataParams->bWrappedMode, bCmdBuff, wCmdLen, &pRecv, &wRxlen ); if ((status & PH_ERR_MASK) != PH_ERR_SUCCESS_CHAINING) { if (pDataParams->bAuthMode != PHAL_MFNTAG42XDNA_NOT_AUTHENTICATED) { phalMfNtag42XDna_Sw_Int_ResetAuthStatus(pDataParams); } if ((status & PH_ERR_MASK) == PH_ERR_SUCCESS) { return PH_ADD_COMPCODE_FIXED(PH_ERR_PROTOCOL_ERROR, PH_COMP_AL_MFNTAG42XDNA); } else { return status; } } if (wRxlen != bRndLen) { return PH_ADD_COMPCODE_FIXED(PH_ERR_PROTOCOL_ERROR, PH_COMP_AL_MFNTAG42XDNA); } /* Store the unencrypted RndB */ memcpy(bRndB, pRecv, bRndLen); /* PRQA S 3200 */ /* Load Zero IV */ memset(pDataParams->bIv, 0x00, bIvLen); /* PRQA S 3200 */ /* Load Iv.*/ PH_CHECK_SUCCESS_FCT(statusTmp, phCryptoSym_LoadIv( pDataParams->pCryptoDataParamsEnc, pDataParams->bIv, bIvLen)); /* Decrypt the RndB received from PICC */ PH_CHECK_SUCCESS_FCT(statusTmp, phCryptoSym_Decrypt( pDataParams->pCryptoDataParamsEnc, PH_CRYPTOSYM_CIPHER_MODE_CBC | PH_EXCHANGE_DEFAULT, bRndB, bRndLen, bRndB )); /* Generate RndA */ PH_CHECK_SUCCESS_FCT(statusTmp, phCryptoRng_Seed(pDataParams->pCryptoRngDataParams, bRndB, bRndLen)); PH_CHECK_SUCCESS_FCT(statusTmp, phCryptoRng_Rnd(pDataParams->pCryptoRngDataParams, bRndLen, bRndA)); /* Concat RndA and RndB' */ bCmdBuff[0] = PHAL_MFNTAG42XDNA_RESP_ADDITIONAL_FRAME; memcpy(&bCmdBuff[1], bRndA, bRndLen); /* PRQA S 3200 */ memcpy(&bCmdBuff[bRndLen + 1], &bRndB[1], bRndLen - 1); /* PRQA S 3200 */ bCmdBuff[2 * bRndLen] = bRndB[0]; /* RndB left shifted by 8 bits */ /* Load Iv */ PH_CHECK_SUCCESS_FCT(statusTmp, phCryptoSym_LoadIv( pDataParams->pCryptoDataParamsEnc, pDataParams->bIv, bIvLen)); /* Encrypt RndA + RndB' */ PH_CHECK_SUCCESS_FCT(statusTmp, phCryptoSym_Encrypt( pDataParams->pCryptoDataParamsEnc, PH_CRYPTOSYM_CIPHER_MODE_CBC | PH_EXCHANGE_DEFAULT, &bCmdBuff[1], 2 * bRndLen, &bCmdBuff[1] )); wCmdLen = 2 * bRndLen + 1; /* Get the encrypted TI || RndA' || PDCaps || PCDCaps into bWorkBuffer */ PH_CHECK_SUCCESS_FCT(status, phalMfNtag42XDna_ExchangeCmd( pDataParams, pDataParams->pPalMifareDataParams, pDataParams->bWrappedMode, bCmdBuff, wCmdLen, &pRecv, &wRxlen )); /* If First Auth, then 32 bytes of data is obtained after exchange */ if (bAuthOption == PHAL_MFNTAG42XDNA_AUTHFIRST_NON_LRP) { if (wRxlen != (2 * bRndLen)) { return PH_ADD_COMPCODE_FIXED(PH_ERR_PROTOCOL_ERROR, PH_COMP_AL_MFNTAG42XDNA); } /* Load IV */ PH_CHECK_SUCCESS_FCT(statusTmp, phCryptoSym_LoadIv( pDataParams->pCryptoDataParamsEnc, pDataParams->bIv, bIvLen)); /* Decrypt TI || RndA' || PDCaps || PCDCaps */ PH_CHECK_SUCCESS_FCT(statusTmp, phCryptoSym_Decrypt( pDataParams->pCryptoDataParamsEnc, PH_CRYPTOSYM_CIPHER_MODE_CBC | PH_EXCHANGE_DEFAULT, pRecv, wRxlen, bCmdBuff )); /* Checking the integrity of RndA */ bTmp = bCmdBuff[3]; /* Store temporarily TI[3] */ bCmdBuff[3] = bCmdBuff[19]; /* Rotate RndA` to get RndA */ /* Compare RndA and buff */ if (memcmp(&bCmdBuff[3], bRndA, PH_CRYPTOSYM_AES128_KEY_SIZE) != 0) { /* Authentication failed */ return PH_ADD_COMPCODE_FIXED(PH_ERR_AUTH_ERROR, PH_COMP_AL_MFNTAG42XDNA); } bCmdBuff[3] = bTmp; /* Restore TI[3] */ memcpy(pDataParams->bTi, &bCmdBuff[0], PHAL_MFNTAG42XDNA_SIZE_TI); /* PRQA S 3200 */ /* Store the Transaction Identifier */ memcpy(pPcdCapsOut, &bCmdBuff[26], 6); /* PRQA S 3200 */ /* Update pPcdCapsOut */ memcpy(pPdCapsOut, &bCmdBuff[20], 6); /* PRQA S 3200 */ /* Update pPdCapsOut */ } else { /* If Auth is Non First, then 16 bytes of data is expected */ if (wRxlen != bRndLen) { return PH_ADD_COMPCODE_FIXED(PH_ERR_PROTOCOL_ERROR, PH_COMP_AL_MFNTAG42XDNA); } /* Load IV */ PH_CHECK_SUCCESS_FCT(statusTmp, phCryptoSym_LoadIv( pDataParams->pCryptoDataParamsEnc, pDataParams->bIv, bIvLen)); /* Decrypt RndA'*/ PH_CHECK_SUCCESS_FCT(statusTmp, phCryptoSym_Decrypt( pDataParams->pCryptoDataParamsEnc, PH_CRYPTOSYM_CIPHER_MODE_CBC | PH_EXCHANGE_BUFFER_CONT, pRecv, bRndLen, &bCmdBuff[1] )); bCmdBuff[0] = bCmdBuff[bRndLen]; /* Rotate right to get back RndA */ /* Compare RndA and bCmdBuff */ if (memcmp(bCmdBuff, bRndA, bRndLen) != 0) { /* Authentication failed */ return PH_ADD_COMPCODE_FIXED(PH_ERR_AUTH_ERROR, PH_COMP_AL_MFNTAG42XDNA); } } /* In case of Originality Key - reset authentication state */ if((bKeyNoCard <= PHAL_MFNTAG42XDNA_ORIGINALITY_KEY_LAST) && (bKeyNoCard >= PHAL_MFNTAG42XDNA_ORIGINALITY_KEY_FIRST) && (memcmp(pDataParams->pAid, bAppId, 3) == 0x00)) { phalMfNtag42XDna_Sw_Int_ResetAuthStatus(pDataParams); return PH_ERR_SUCCESS; } /* Generate the session key SV1 * SV 1 = 0xA5||0x5A||0x00||0x01||0x00||0x80||RndA[15:14]||(RndA[13::8] XOR RndB[15::8])||RndB[7::0]||RndA[7::0] */ bSV1[0] = 0xA5; bSV1[1] = 0x5A; bSV1[2] = 0x00; bSV1[3] = 0x01; bSV1[4] = 0x00; bSV1[5] = 0x80; bSV1[6] = bRndA[0]; bSV1[7] = bRndA[1]; bSV1[8] = bRndA[2] ^ bRndB[0]; bSV1[9] = bRndA[3] ^ bRndB[1]; bSV1[10] = bRndA[4] ^ bRndB[2]; bSV1[11] = bRndA[5] ^ bRndB[3]; bSV1[12] = bRndA[6] ^ bRndB[4]; bSV1[13] = bRndA[7] ^ bRndB[5]; memcpy(&bSV1[14], &bRndB[6], 10); /* PRQA S 3200 */ memcpy(&bSV1[24], &bRndA[8], 8); /* PRQA S 3200 */ /* Load Zero IV */ memset(pDataParams->bIv, 0x00, bIvLen); /* PRQA S 3200 */ /* Load IV */ PH_CHECK_SUCCESS_FCT(statusTmp, phCryptoSym_LoadIv( pDataParams->pCryptoDataParamsEnc, pDataParams->bIv, bIvLen)); /* Start CMAC calculation */ PH_CHECK_SUCCESS_FCT(statusTmp, phCryptoSym_CalculateMac( pDataParams->pCryptoDataParamsEnc, (PH_CRYPTOSYM_MAC_MODE_CMAC | PH_EXCHANGE_DEFAULT), &bSV1[0], 32, pDataParams->bSesAuthENCKey, &bMacLen )); /* Generate the session key SV2 * SV 2 = 0x5A||0xA5||0x00||0x01||0x00||0x80||RndA[15:14]|| (RndA[13::8] XOR RndB[15::10])||RndB[9::0]||RndA[7::0] */ bSV1[0] = 0x5A; bSV1[1] = 0xA5; /* Load Zero IV */ memset(pDataParams->bIv, 0x00, bIvLen); /* PRQA S 3200 */ /* Load IV */ PH_CHECK_SUCCESS_FCT(statusTmp, phCryptoSym_LoadIv( pDataParams->pCryptoDataParamsEnc, pDataParams->bIv, bIvLen)); /* Calculate MAC for SV2 */ PH_CHECK_SUCCESS_FCT(statusTmp, phCryptoSym_CalculateMac( pDataParams->pCryptoDataParamsEnc, (PH_CRYPTOSYM_MAC_MODE_CMAC | PH_EXCHANGE_DEFAULT), &bSV1[0], 32, pDataParams->bSesAuthMACKey, &bMacLen )); /* Session key is generated */ if(bAuthOption == PHAL_MFNTAG42XDNA_AUTHFIRST_NON_LRP) { pDataParams->wCmdCtr = 0x00; } pDataParams->bAuthMode = PHAL_MFNTAG42XDNA_AUTHENTICATEEV2; pDataParams->bCryptoMethod = PH_CRYPTOSYM_KEY_TYPE_AES128; pDataParams->bKeyNo = bKeyNoCard; /* Load the ENC session key */ PH_CHECK_SUCCESS_FCT(statusTmp, phCryptoSym_LoadKeyDirect( pDataParams->pCryptoDataParamsEnc, pDataParams->bSesAuthENCKey, pDataParams->bCryptoMethod )); /* Load the MAC session key */ PH_CHECK_SUCCESS_FCT(statusTmp, phCryptoSym_LoadKeyDirect( pDataParams->pCryptoDataParamsMac, pDataParams->bSesAuthMACKey, pDataParams->bCryptoMethod )); /* Set the keep Iv ON */ return phCryptoSym_SetConfig( pDataParams->pCryptoDataParamsEnc, PH_CRYPTOSYM_CONFIG_KEEP_IV, PH_CRYPTOSYM_VALUE_KEEP_IV_ON ); } #endif /* NXPBUILD__PH_CRYPTOSYM */ phStatus_t phalMfNtag42XDna_Sw_Int_ComputeSDMIV(phalMfNtag42XDna_Sw_DataParams_t *pDataParams, uint8_t *pSessEncKey, uint8_t *pSDMReadCtr, uint8_t *pIV) { phStatus_t statusTmp = PH_ERR_SUCCESS; uint8_t PH_MEMLOC_REM bTmpIV[16] = {'\0'}; uint8_t PH_MEMLOC_REM bDataBuf[16] = {'\0'}; /* Validate the IP Parameters */ if(pSessEncKey == NULL || pSDMReadCtr == NULL) { return PH_ADD_COMPCODE_FIXED(PH_ERR_INVALID_PARAMETER, PH_COMP_AL_MFNTAG42XDNA); } /* Create a Back up of the current IV */ memcpy(bTmpIV, pDataParams->bIv, PH_CRYPTOSYM_AES_BLOCK_SIZE); /* Load zero to IV */ memset(pDataParams->bIv, 0x00, PH_CRYPTOSYM_AES_BLOCK_SIZE); /* Load Iv */ PH_CHECK_SUCCESS_FCT(statusTmp, phCryptoSym_LoadIv( pDataParams->pCryptoDataParamsEnc, pDataParams->bIv, PH_CRYPTOSYM_AES_BLOCK_SIZE )); /* load key */ PH_CHECK_SUCCESS_FCT(statusTmp, phCryptoSym_LoadKeyDirect( pDataParams->pCryptoDataParamsEnc, pSessEncKey, PH_CRYPTOSYM_KEY_TYPE_AES128)); /* Clear data buffer */ memset(bDataBuf, 0x00, PH_CRYPTOSYM_AES_BLOCK_SIZE); /* Prepare Data buffer to derive IV */ bDataBuf[0] = pSDMReadCtr[0]; bDataBuf[1] = pSDMReadCtr[1]; bDataBuf[2] = pSDMReadCtr[2]; /* Now Encrypt the data Buffer to derive IV */ PH_CHECK_SUCCESS_FCT(statusTmp, phCryptoSym_Encrypt( pDataParams->pCryptoDataParamsEnc, PH_CRYPTOSYM_CIPHER_MODE_CBC, bDataBuf, PH_CRYPTOSYM_AES_BLOCK_SIZE, bDataBuf )); memcpy(pIV, bDataBuf, PH_CRYPTOSYM_AES_BLOCK_SIZE); /* Restore the IV */ memcpy(pDataParams->bIv,bTmpIV, PH_CRYPTOSYM_AES_BLOCK_SIZE); /* Load Iv */ PH_CHECK_SUCCESS_FCT(statusTmp, phCryptoSym_LoadIv( pDataParams->pCryptoDataParamsEnc, pDataParams->bIv, PH_CRYPTOSYM_AES_BLOCK_SIZE )); return PH_ERR_SUCCESS; } phStatus_t phalMfNtag42XDna_Sw_Int_DecryptSDMData(phalMfNtag42XDna_Sw_DataParams_t *pDataParams, uint8_t *pSessEncKey, uint8_t *pIv, uint8_t wIvSize, uint8_t *pInputOutputData, uint16_t wInputDataLen) { phStatus_t statusTmp = PH_ERR_SUCCESS; uint16_t wAuthMode = 0x00; #ifndef NXPBUILD__PH_CRYPTOSYM_LRP PHAL_MFNTAG42XDNA_UNUSED_VARIABLE(wIvSize); #endif /* NXPBUILD__PH_CRYPTOSYM_LRP */ if(pSessEncKey == NULL || pIv == NULL) { return PH_ADD_COMPCODE_FIXED(PH_ERR_INVALID_PARAMETER, PH_COMP_AL_MFNTAG42XDNA); } PH_CHECK_SUCCESS_FCT(statusTmp, phCryptoSym_GetConfig( pDataParams->pCryptoDataParamsMac, PH_CRYPTOSYM_CONFIG_LRP, &wAuthMode )); /* Load the session ENC Key to Crypto Object */ PH_CHECK_SUCCESS_FCT(statusTmp, phCryptoSym_LoadKeyDirect( pDataParams->pCryptoDataParamsEnc, pSessEncKey, PH_CRYPTOSYM_KEY_TYPE_AES128)); { /* Load IV */ PH_CHECK_SUCCESS_FCT(statusTmp, phCryptoSym_LoadIv( pDataParams->pCryptoDataParamsEnc, pIv, PH_CRYPTOSYM_AES_BLOCK_SIZE )); /* Decrypt Data */ PH_CHECK_SUCCESS_FCT(statusTmp, phCryptoSym_Decrypt( pDataParams->pCryptoDataParamsEnc, PH_CRYPTOSYM_CIPHER_MODE_CBC | PH_EXCHANGE_DEFAULT, pInputOutputData, wInputDataLen, pInputOutputData )); } return PH_ERR_SUCCESS; } phStatus_t phalMfNtag42XDna_Sw_Int_GenerateSDMSessionKeysAES(phalMfNtag42XDna_Sw_DataParams_t *pDataParams, uint8_t bSdmOption, uint16_t wKeyNo, uint16_t wKeyVer, uint8_t *pSDMReadCtr, uint8_t * pVCUID, uint8_t bUidLen, uint8_t *pSessEncKey, uint8_t *pSessMacKey) { phStatus_t statusTmp = PH_ERR_SUCCESS; uint8_t PH_MEMLOC_REM bSV1[16] = {'\0'}; uint8_t PH_MEMLOC_REM bSV2[16] = {'\0'}; uint8_t PH_MEMLOC_REM bKey[16] = {'\0'}; uint8_t PH_MEMLOC_REM bCmdLenMac= 0; uint8_t PH_MEMLOC_REM bCmdLenEnc= 0; uint16_t PH_MEMLOC_REM wKeyType = 0x0000; uint8_t PH_MEMLOC_REM bTmpIV[16] = {'\0'}; uint8_t PH_MEMLOC_REM bMacLen = 0x00; /* Validate the Output Buffers */ if((pSessEncKey == NULL) || (pSessMacKey == NULL)) { return PH_ADD_COMPCODE_FIXED(PH_ERR_INVALID_PARAMETER, PH_COMP_AL_MFNTAG42XDNA); } /* Clear the session vector. */ memset(bSV1, 0x00, sizeof(bSV1)); /* PRQA S 3200 */ memset(bSV2, 0x00, sizeof(bSV2)); /* PRQA S 3200 */ /* Prepare SV1 & SV2 Buffer */ /* SV1 = 0xC3 || 0x3C || 0x00 || 0x01 || 0x00 || 0x80 ||VCUID || SDMReadCtr [||ZeroPadding]*/ /* SV2 = 0x3C || 0xC3 || 0x00 || 0x01 || 0x00 || 0x80 [||VCUID][||SDMReadCtr][||ZeroPadding]*/ bSV1[bCmdLenEnc++] = 0xC3; bSV1[bCmdLenEnc++] = 0x3C; bSV2[bCmdLenMac++] = 0x3C; bSV2[bCmdLenMac++] = 0xC3; bSV2[bCmdLenMac++] = bSV1[bCmdLenEnc++] = 0x00; bSV2[bCmdLenMac++] = bSV1[bCmdLenEnc++] = 0x01; bSV2[bCmdLenMac++] = bSV1[bCmdLenEnc++] = 0x00; bSV2[bCmdLenMac++] = bSV1[bCmdLenEnc++] = 0x80; if(pVCUID != NULL) { memcpy(&bSV1[bCmdLenEnc], pVCUID, bUidLen); /* PRQA S 3200 */ bCmdLenEnc += bUidLen; } if (pSDMReadCtr != NULL) { memcpy(&bSV1[bCmdLenEnc], pSDMReadCtr, 0x03); /* PRQA S 3200 */ bCmdLenEnc += 0x03; } /* Copy UID into SV - UID should not more then 7 byte in * this case else bSV array size needs to be changed */ if(bSdmOption & PHAL_MFNTAG42XDNA_VCUID_PRESENT) { /* If VCUID should be considered for MAC calcluation, and pUID is passed as NULL, throw error */ if(pVCUID != NULL) { memcpy(&bSV2[bCmdLenMac], pVCUID, bUidLen); /* PRQA S 3200 */ bCmdLenMac += bUidLen; } else { return PH_ADD_COMPCODE_FIXED(PH_ERR_INVALID_PARAMETER, PH_COMP_AL_MFNTAG42XDNA); } } if(bSdmOption & PHAL_MFNTAG42XDNA_RDCTR_PRESENT) { /* If SDMReadCounter should be considered for MAC calcluation, and pUID is passed as NULL, throw error */ if(pSDMReadCtr != NULL) { memcpy(&bSV2[bCmdLenMac], pSDMReadCtr, 0x03); /* PRQA S 3200 */ bCmdLenMac += 0x03; } else { return PH_ADD_COMPCODE_FIXED(PH_ERR_INVALID_PARAMETER, PH_COMP_AL_MFNTAG42XDNA); } } /* Now Get the Keys from SW Key Store */ PH_CHECK_SUCCESS_FCT(statusTmp, phKeyStore_GetKey( pDataParams->pKeyStoreDataParams, wKeyNo, wKeyVer, PH_CRYPTOSYM_AES128_KEY_SIZE, bKey, &wKeyType )); if (wKeyType != PH_CRYPTOSYM_KEY_TYPE_AES128) { return PH_ADD_COMPCODE_FIXED(PH_ERR_KEY, PH_COMP_AL_MFNTAG42XDNA); } /* load key */ PH_CHECK_SUCCESS_FCT(statusTmp, phCryptoSym_LoadKeyDirect( pDataParams->pCryptoDataParamsMac, bKey, wKeyType)); /* Create a Back up of the current IV */ memcpy(bTmpIV, pDataParams->bIv, PH_CRYPTOSYM_AES_BLOCK_SIZE); /* PRQA S 3200 */ /* Load zero to IV */ memset(pDataParams->bIv, 0x00, PH_CRYPTOSYM_AES_BLOCK_SIZE); /* PRQA S 3200 */ /* Load Iv */ PH_CHECK_SUCCESS_FCT(statusTmp, phCryptoSym_LoadIv( pDataParams->pCryptoDataParamsMac, pDataParams->bIv, PH_CRYPTOSYM_AES_BLOCK_SIZE )); /* MAC SV1 to obtain KSesSDMFileReadEnc */ PH_CHECK_SUCCESS_FCT(statusTmp, phCryptoSym_CalculateMac( pDataParams->pCryptoDataParamsMac, (PH_CRYPTOSYM_MAC_MODE_CMAC | PH_EXCHANGE_DEFAULT), bSV1, PH_CRYPTOSYM_AES_BLOCK_SIZE, bKey, &bMacLen )); /* Copy the session Enc Key */ memcpy(pSessEncKey, bKey, PH_CRYPTOSYM_AES_BLOCK_SIZE); /* PRQA S 3200 */ memset(bKey, 0x00, PH_CRYPTOSYM_AES_BLOCK_SIZE); /* PRQA S 3200 */ /* MAC SV2 to obtain KSesSDMFileReadMac */ PH_CHECK_SUCCESS_FCT(statusTmp, phCryptoSym_CalculateMac( pDataParams->pCryptoDataParamsMac, (PH_CRYPTOSYM_MAC_MODE_CMAC | PH_EXCHANGE_DEFAULT), bSV2, PH_CRYPTOSYM_AES_BLOCK_SIZE, bKey, &bMacLen )); /* Copy session Mac Key */ memcpy(pSessMacKey, bKey, PH_CRYPTOSYM_AES_BLOCK_SIZE); /* Reload Back up IV */ memcpy(pDataParams->bIv, bTmpIV, PH_CRYPTOSYM_AES_BLOCK_SIZE); /* Load Iv */ PH_CHECK_SUCCESS_FCT(statusTmp, phCryptoSym_LoadIv( pDataParams->pCryptoDataParamsMac, pDataParams->bIv, PH_CRYPTOSYM_AES_BLOCK_SIZE )); return PH_ERR_SUCCESS; } #endif /* NXPBUILD__PHAL_MFNTAG42XDNA_SW */
37.533083
196
0.581453
[ "object", "vector" ]
58436f3dee3489e6972d653ca6104346b6f762f1
16,845
h
C
TAO/TAO_IDL/include/utl_scope.h
cflowe/ACE
5ff60b41adbe1772372d1a43bcc1f2726ff8f810
[ "DOC" ]
36
2015-01-10T07:27:33.000Z
2022-03-07T03:32:08.000Z
TAO/TAO_IDL/include/utl_scope.h
cflowe/ACE
5ff60b41adbe1772372d1a43bcc1f2726ff8f810
[ "DOC" ]
2
2018-08-13T07:30:51.000Z
2019-02-25T03:04:31.000Z
TAO/TAO_IDL/include/utl_scope.h
cflowe/ACE
5ff60b41adbe1772372d1a43bcc1f2726ff8f810
[ "DOC" ]
38
2015-01-08T14:12:06.000Z
2022-01-19T08:33:00.000Z
// This may look like C, but it's really -*- C++ -*- // $Id: utl_scope.h 92204 2010-10-12 13:16:16Z sma $ /* COPYRIGHT Copyright 1992, 1993, 1994 Sun Microsystems, Inc. Printed in the United States of America. All Rights Reserved. This product is protected by copyright and distributed under the following license restricting its use. The Interface Definition Language Compiler Front End (CFE) is made available for your use provided that you include this license and copyright notice on all media and documentation and the software program in which this product is incorporated in whole or part. You may copy and extend functionality (but may not remove functionality) of the Interface Definition Language CFE without charge, but you are not authorized to license or distribute it to anyone else except as part of a product or program developed by you or with the express written consent of Sun Microsystems, Inc. ("Sun"). The names of Sun Microsystems, Inc. and any of its subsidiaries or affiliates may not be used in advertising or publicity pertaining to distribution of Interface Definition Language CFE as permitted herein. This license is effective until terminated by Sun for failure to comply with this license. Upon termination, you shall destroy or return all code and documentation for the Interface Definition Language CFE. INTERFACE DEFINITION LANGUAGE CFE IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE, NONINFRINGEMENT, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. INTERFACE DEFINITION LANGUAGE CFE IS PROVIDED WITH NO SUPPORT AND WITHOUT ANY OBLIGATION ON THE PART OF Sun OR ANY OF ITS SUBSIDIARIES OR AFFILIATES TO ASSIST IN ITS USE, CORRECTION, MODIFICATION OR ENHANCEMENT. SUN OR ANY OF ITS SUBSIDIARIES OR AFFILIATES SHALL HAVE NO LIABILITY WITH RESPECT TO THE INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY INTERFACE DEFINITION LANGUAGE CFE OR ANY PART THEREOF. IN NO EVENT WILL SUN OR ANY OF ITS SUBSIDIARIES OR AFFILIATES BE LIABLE FOR ANY LOST REVENUE OR PROFITS OR OTHER SPECIAL, INDIRECT AND CONSEQUENTIAL DAMAGES, EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. Use, duplication, or disclosure by the government is subject to restrictions as set forth in subparagraph (c)(1)(ii) of the Rights in Technical Data and Computer Software clause at DFARS 252.227-7013 and FAR 52.227-19. Sun, Sun Microsystems and the Sun logo are trademarks or registered trademarks of Sun Microsystems, Inc. SunSoft, Inc. 2550 Garcia Avenue Mountain View, California 94043 NOTE: SunOS, SunSoft, Sun, Solaris, Sun Microsystems or the Sun logo are trademarks or registered trademarks of Sun Microsystems, Inc. */ #ifndef _UTL_SCOPE_UTL_SCOPE_HH #define _UTL_SCOPE_UTL_SCOPE_HH // This is the base class for name scoping. Each entity which can // be directly contained in a naming scope has an add() function // defined for it. The functions defined on the base scoping class // all return FALSE. Each subclass of UTL_Scope should // define its own add() functions for those types which are legal // in that context. Then, for those types for which no local functions // have been defined the function on the base class will be called to // return FALSE. // // The "AST_" classes may redefine add() functions to implement any // name binding mechanisms needed for their own functionality. It is // the responsibility of those functions then to call the add() // function defined in the parent "AST_" class. #include "fe_utils.h" // This is for AIX w/IBM C++. class Identifier; class AST_PredefinedType; class AST_Module; class AST_Template_Module_Inst; class AST_Template_Module_Ref; class AST_Interface; class AST_InterfaceFwd; class AST_ValueBox; class AST_ValueType; class AST_ValueTypeFwd; class AST_EventType; class AST_EventTypeFwd; class AST_Component; class AST_ComponentFwd; class AST_Home; class AST_Constant; class AST_Exception; class AST_Attribute; class AST_Operation; class AST_Argument; class AST_Param_Holder; class AST_Union; class AST_UnionFwd; class AST_UnionBranch; class AST_Structure; class AST_StructureFwd; class AST_Field; class AST_Enum; class AST_EnumVal; class AST_Sequence; class AST_String; class AST_Typedef; class AST_Array; class AST_Native; class AST_Factory; class AST_Finder; class AST_PortType; class AST_Provides; class AST_Uses; class AST_Publishes; class AST_Emits; class AST_Consumes; class AST_Extended_Port; class AST_Mirror_Port; class AST_Connector; class UTL_StrList; class UTL_NameList; // Forward declaration of active iterator for UTL_Scope. class UTL_ScopeActiveIterator; class TAO_IDL_FE_Export UTL_Scope : public virtual COMMON_Base { // Friend class UTL_ScopeActiveIterator defines active iterator for // UTL_Scope. Definition follows below. friend class UTL_ScopeActiveIterator; public: // Enum to denote the kind of iteration desired. enum ScopeIterationKind { IK_both // Iterate through both decls and local types. , IK_decls // Iterate only through decls. , IK_localtypes // Iterate only through local types. }; // Operations. // Constructor(s). UTL_Scope (void); UTL_Scope (AST_Decl::NodeType nt); // Destructor. virtual ~UTL_Scope (void); // Data Accessors. AST_Decl::NodeType scope_node_type (void) { return pd_scope_node_type; } // Narrowing. DEF_NARROW_FROM_SCOPE(UTL_Scope); // AST Dumping. virtual void dump (ACE_OSTREAM_TYPE &o); // Other Operations. // Name Lookup Mechanism AST_Decl *lookup_by_name (UTL_ScopedName *, bool full_def_only = false, bool for_add = true); AST_Decl *lookup_by_name_r (UTL_ScopedName *, bool full_def_only); AST_Decl *lookup_by_name_r (UTL_ScopedName *, bool full_def_only, AST_Decl *&final_parent_decl); // Look up the Identifier * specified only in the local scope. AST_Decl *lookup_by_name_local (Identifier *, bool full_def_only = false); // Look up a predefined type by its ExprType. AST_Decl *lookup_primitive_type (AST_Expression::ExprType); // Look up one of the pseudo-object types. AST_Decl *lookup_pseudo (Identifier *); virtual AST_Decl *look_in_prev_mods_local (Identifier *e, bool ignore_fwd = false); // A no-op here, overridden for types like interface // (look_in_inherited), modules (look_in_prev_mods) etc. virtual AST_Decl *special_lookup (UTL_ScopedName *e, bool ful_def_only, AST_Decl *&final_parent_decl); // How many entries are used? virtual unsigned long nmembers (void); // If the Identifier string (from the scoped name which has been // already determined to be of length 1) matches a param, // create and return a param holder AST node, otherwise // return 0. static AST_Param_Holder *match_param (UTL_ScopedName *e); // Add to decls. Node represents a local declaration // The new decl e is inserted after ex if ex is not 0. // This one is public because the case of a reopened // module necessitates a call to this from // be_generator::create_module(). void add_to_scope (AST_Decl *e, AST_Decl *ex = 0); // Add to name_referenced identifier list. It's public because // a union needs to add its enum discriminator label names. void add_to_name_referenced (Identifier *id); // Accessors for the has_prefix_ member. bool has_prefix (void); void has_prefix (bool val); // Cleanup function. virtual void destroy (void); // Visiting. virtual int ast_accept (ast_visitor *visitor); protected: // UTL_Scope protected addition protocol. This protocol is // used from sub-classes of UTL_Scope to insert nodes directly // into the specified node table (either decls or local_types) // Additionally, UTL_Scope also maintains a record of what nodes // defined elsewhere were referenced in this scope. // Replace old_decl with new_decl. void replace_scope (AST_Decl *old_decl, AST_Decl *new_decl); // Replace old_decl with new_decl. void replace_referenced (AST_Decl *old_decl, AST_Decl *new_decl); // Add to referenced nodes set. // If ex is not 0 'e' will be inserted at the position // after ex, which is already in the list. void add_to_referenced (AST_Decl *e, bool recursive, Identifier *id, AST_Decl *ex = 0); // Add to local types. Node represents a local manifest type. void add_to_local_types (AST_Decl *e); // Has this node been referenced here already? virtual bool referenced (AST_Decl *e, Identifier *id = 0); // Look up a scoped name in the inherited list. virtual AST_Decl *look_in_inherited (UTL_ScopedName *, bool treat_as_ref); // Look up a scoped name in the supported interface list. virtual AST_Decl *look_in_supported (UTL_ScopedName *, bool treat_as_ref); // Lookup based on the local name. AST_Decl *lookup_for_add (AST_Decl *d); // Is there a (case-insensitive) clash between a local name // and an IDL keyword? int idl_keyword_clash (Identifier *e); // Checks for modules, or defns of forward declared struct or unions. bool redef_clash (AST_Decl::NodeType new_nt, AST_Decl::NodeType scope_elem_nt); void check_for_predef_seq (AST_Decl *d); // Set the appropriate *_seen_ flag if we are seeing a spec-defined // sequence of a basic type. protected: // Data. // What type is this node? This is a cache of the information // in AST_Decl const AST_Decl::NodeType pd_scope_node_type; // Storage for declarations in this scope. AST_Decl **pd_decls; // Store declarations long pd_decls_allocated; // How many allocated? long pd_decls_used; // How many used? // Storage for local manifest types in this scope. AST_Decl **pd_local_types; // Store types long pd_locals_allocated; // How many allocated? long pd_locals_used; // How many used? // Storage for referenced nodes in this scope. AST_Decl **pd_referenced; // Store references long pd_referenced_allocated; // How many allocated? long pd_referenced_used; // How many used? // Storage for identifiers used in this scope. CORBA 2.3 introduced // stricter rules for clashes during name resolution, and the information // in pd_referenced is not enough to catch them all. Identifier **pd_name_referenced; // Store name references long pd_name_referenced_allocated; // How many allocated? long pd_name_referenced_used; // How many used? // Have we seen a #pragma prefix declaration in this scope? bool has_prefix_; // Used in lookup of various CORBA pseudo objects, which also // determines generation of specific #include headers. enum WHICH_PSEUDO { PSEUDO_TYPECODE, PSEUDO_OBJECT, PSEUDO_VALUEBASE, PSEUDO_ABSTRACTBASE }; WHICH_PSEUDO which_pseudo_; public: /// Scope Management Protocol. /// Common code for most basic adding action. AST_Decl *fe_add_decl (AST_Decl *d); /// Specialized for types that reference another type. AST_Field *fe_add_ref_decl (AST_Field *d); template<typename DECL> DECL *fe_add_full_intf_decl (DECL *t); template<typename FULL_DECL> typename FULL_DECL::FWD_TYPE *fe_add_fwd_intf_decl ( typename FULL_DECL::FWD_TYPE *t); AST_Structure *fe_add_full_struct_type (AST_Structure *t); AST_StructureFwd *fe_add_fwd_struct_type (AST_StructureFwd *t); /// No-op base class version of the specialized adding actions. virtual AST_PredefinedType *fe_add_predefined_type ( AST_PredefinedType *t); virtual AST_Module *fe_add_module (AST_Module *m); virtual AST_Template_Module_Inst *fe_add_template_module_inst ( AST_Template_Module_Inst *m); virtual AST_Template_Module_Ref *fe_add_template_module_ref ( AST_Template_Module_Ref *m); virtual AST_Interface *fe_add_interface (AST_Interface *i); virtual AST_InterfaceFwd *fe_add_interface_fwd (AST_InterfaceFwd *i); virtual AST_ValueType *fe_add_valuetype (AST_ValueType *i); virtual AST_ValueTypeFwd *fe_add_valuetype_fwd (AST_ValueTypeFwd *i); virtual AST_EventType *fe_add_eventtype (AST_EventType *i); virtual AST_EventTypeFwd *fe_add_eventtype_fwd (AST_EventTypeFwd *i); virtual AST_Component *fe_add_component (AST_Component *i); virtual AST_ComponentFwd *fe_add_component_fwd (AST_ComponentFwd *i); virtual AST_Home *fe_add_home (AST_Home *i); virtual AST_Connector *fe_add_connector (AST_Connector *i); virtual AST_Constant *fe_add_constant (AST_Constant *i); virtual AST_Exception *fe_add_exception (AST_Exception *e); virtual AST_Attribute *fe_add_attribute (AST_Attribute *a); virtual AST_Operation *fe_add_operation (AST_Operation *o); virtual AST_Argument *fe_add_argument (AST_Argument *a); virtual AST_Union *fe_add_union (AST_Union *u); virtual AST_UnionFwd *fe_add_union_fwd (AST_UnionFwd *u); virtual AST_UnionBranch *fe_add_union_branch (AST_UnionBranch *b); virtual AST_Structure *fe_add_structure (AST_Structure *s); virtual AST_StructureFwd *fe_add_structure_fwd (AST_StructureFwd *s); virtual AST_Field *fe_add_field (AST_Field *f); virtual AST_Enum *fe_add_enum (AST_Enum *e); virtual AST_EnumVal *fe_add_enum_val (AST_EnumVal *v); virtual AST_Typedef *fe_add_typedef (AST_Typedef *t); virtual UTL_StrList *fe_add_context (UTL_StrList *c); virtual UTL_NameList *fe_add_exceptions (UTL_NameList *e); virtual AST_Sequence *fe_add_sequence (AST_Sequence *s); virtual AST_String *fe_add_string (AST_String *s); virtual AST_Array *fe_add_array (AST_Array *a); virtual AST_Native *fe_add_native (AST_Native *n); virtual AST_Factory *fe_add_factory (AST_Factory *f); virtual AST_Finder *fe_add_finder (AST_Finder *f); virtual AST_ValueBox *fe_add_valuebox (AST_ValueBox *vb); virtual AST_PortType *fe_add_porttype (AST_PortType *pt); virtual AST_Provides *fe_add_provides (AST_Provides *p); virtual AST_Uses *fe_add_uses (AST_Uses *p); virtual AST_Publishes *fe_add_publishes (AST_Publishes *p); virtual AST_Emits *fe_add_emits (AST_Emits *p); virtual AST_Consumes *fe_add_consumes (AST_Consumes *p); virtual AST_Extended_Port *fe_add_extended_port (AST_Extended_Port *ep); virtual AST_Mirror_Port *fe_add_mirror_port (AST_Mirror_Port *mp); protected: /// Quick check on the head of a name to see if it's global. bool is_global_name (Identifier *i); private: /// Checks called from fe_add_decl() specific to interfaces /// (and its subtypes) and operations respectively. bool inherited_op_attr_clash (AST_Decl *t); bool arg_specific_error (AST_Decl *t); /// Encapsulates the vagaries of adding fields vs decls to /// structs/unions vs other types. void smart_local_add (AST_Decl *t); /// Helper function for lookup_by_name(). Iterates doing local /// lookups of subsequent components of a scoped name. AST_Decl * iter_lookup_by_name_local (AST_Decl *d, UTL_ScopedName *e, bool full_def_only = false); }; // Active iterator for a UTL_Scope node class TAO_IDL_FE_Export UTL_ScopeActiveIterator { public: // Operations. // Constructor. UTL_ScopeActiveIterator (UTL_Scope *s, UTL_Scope::ScopeIterationKind ik); // Advance to next item. void next (void); // Get current item. AST_Decl *item (void); // Have we iterated over entire scope? bool is_done (void); // What kind of iterator is this? UTL_Scope::ScopeIterationKind iteration_kind (void); // What stage are we in with this iterator? UTL_Scope::ScopeIterationKind iteration_stage (void); private: // Scope to iterate over. UTL_Scope *iter_source; // What kind of iteration? UTL_Scope::ScopeIterationKind ik; // What stage? UTL_Scope::ScopeIterationKind stage; // What location in stage? long il; }; #if defined (ACE_TEMPLATES_REQUIRE_SOURCE) #include "utl_scope_T.cpp" #endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ #if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) #pragma implementation ("utl_scope_T.cpp") #endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ #endif // _UTL_SCOPE_UTL_SCOPE_HH
29.761484
75
0.726091
[ "object" ]
58438cfe3a7b76e7eab321d87747cd6188c6af43
9,467
h
C
ns3/ns-3.26/src/lte/model/ff-mac-common.h
Aedemon/clusim
7f09cdb79b5f02cf0fed1bd44842981941f29f32
[ "Apache-2.0" ]
13
2019-08-19T08:18:42.000Z
2021-12-18T10:40:00.000Z
ns3/ns-3.26/src/lte/model/ff-mac-common.h
Aedemon/clusim
7f09cdb79b5f02cf0fed1bd44842981941f29f32
[ "Apache-2.0" ]
3
2017-08-11T03:04:59.000Z
2017-09-11T14:01:14.000Z
ns3/ns-3.26/src/lte/model/ff-mac-common.h
Aedemon/clusim
7f09cdb79b5f02cf0fed1bd44842981941f29f32
[ "Apache-2.0" ]
5
2019-11-25T13:32:37.000Z
2021-08-13T01:19:24.000Z
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* * Copyright (c) 2011 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation; * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Author: Manuel Requena <manuel.requena@cttc.es> */ #ifndef FF_MAC_COMMON_H #define FF_MAC_COMMON_H #include <ns3/simple-ref-count.h> #include <ns3/ptr.h> #include <vector> /** * Constants. See section 4.4 */ #define MAX_SCHED_CFG_LIST 10 #define MAX_LC_LIST 10 #define MAX_RACH_LIST 30 #define MAX_DL_INFO_LIST 30 #define MAX_BUILD_DATA_LIST 30 #define MAX_BUILD_RAR_LIST 10 #define MAX_BUILD_BC_LIST 3 #define MAX_UL_INFO_LIST 30 #define MAX_DCI_LIST 30 #define MAX_PHICH_LIST 30 #define MAX_TB_LIST 2 #define MAX_RLC_PDU_LIST 30 #define MAX_NR_LCG 4 #define MAX_MBSFN_CONFIG 5 #define MAX_SI_MSG_LIST 32 #define MAX_SI_MSG_SIZE 65535 #define MAX_CQI_LIST 30 #define MAX_UE_SELECTED_SB 6 #define MAX_HL_SB 25 #define MAX_SINR_RB_LIST 100 #define MAX_SR_LIST 30 #define MAX_MAC_CE_LIST 30 namespace ns3 { enum Result_e { SUCCESS, FAILURE }; enum SetupRelease_e { setup, release }; enum CeBitmap_e { TA, DRX, CR }; enum NormalExtended_e { normal, extended }; /** * \brief See section 4.3.1 dlDciListElement */ struct DlDciListElement_s { uint16_t m_rnti; uint32_t m_rbBitmap; uint8_t m_rbShift; uint8_t m_resAlloc; std::vector <uint16_t> m_tbsSize; std::vector <uint8_t> m_mcs; std::vector <uint8_t> m_ndi; std::vector <uint8_t> m_rv; uint8_t m_cceIndex; uint8_t m_aggrLevel; uint8_t m_precodingInfo; enum Format_e { ONE, ONE_A, ONE_B, ONE_C, ONE_D, TWO, TWO_A, TWO_B } m_format; uint8_t m_tpc; uint8_t m_harqProcess; uint8_t m_dai; enum VrbFormat_e { VRB_DISTRIBUTED, VRB_LOCALIZED } m_vrbFormat; bool m_tbSwap; bool m_spsRelease; bool m_pdcchOrder; uint8_t m_preambleIndex; uint8_t m_prachMaskIndex; enum Ngap_e { GAP1, GAP2 } m_nGap; uint8_t m_tbsIdx; uint8_t m_dlPowerOffset; uint8_t m_pdcchPowerOffset; }; /** * \brief See section 4.3.2 ulDciListElement */ struct UlDciListElement_s { uint16_t m_rnti; uint8_t m_rbStart; uint8_t m_rbLen; uint16_t m_tbSize; uint8_t m_mcs; uint8_t m_ndi; uint8_t m_cceIndex; uint8_t m_aggrLevel; uint8_t m_ueTxAntennaSelection; bool m_hopping; uint8_t m_n2Dmrs; int8_t m_tpc; bool m_cqiRequest; uint8_t m_ulIndex; uint8_t m_dai; uint8_t m_freqHopping; int8_t m_pdcchPowerOffset; }; /** * \brief Base class for storing the values of vendor specific parameters */ struct VendorSpecificValue : public SimpleRefCount<VendorSpecificValue> { virtual ~VendorSpecificValue (); }; /** * \brief See section 4.3.3 vendorSpecifiListElement */ struct VendorSpecificListElement_s { uint32_t m_type; uint32_t m_length; Ptr<VendorSpecificValue> m_value; }; /** * \brief See section 4.3.4 logicalChannelConfigListElement */ struct LogicalChannelConfigListElement_s { uint8_t m_logicalChannelIdentity; uint8_t m_logicalChannelGroup; enum Direction_e { DIR_UL, DIR_DL, DIR_BOTH } m_direction; enum QosBearerType_e { QBT_NON_GBR, QBT_GBR } m_qosBearerType; uint8_t m_qci; uint64_t m_eRabMaximulBitrateUl; uint64_t m_eRabMaximulBitrateDl; uint64_t m_eRabGuaranteedBitrateUl; uint64_t m_eRabGuaranteedBitrateDl; }; /** * \brief See section 4.3.6 rachListElement */ struct RachListElement_s { uint16_t m_rnti; uint16_t m_estimatedSize; }; /** * \brief See section 4.3.7 phichListElement */ struct PhichListElement_s { uint16_t m_rnti; enum Phich_e { ACK, NACK } m_phich; }; /** * \brief See section 4.3.9 rlcPDU_ListElement */ struct RlcPduListElement_s { uint8_t m_logicalChannelIdentity; uint16_t m_size; }; /** * \brief See section 4.3.8 builDataListElement */ struct BuildDataListElement_s { uint16_t m_rnti; struct DlDciListElement_s m_dci; std::vector <enum CeBitmap_e> m_ceBitmap; std::vector < std::vector <struct RlcPduListElement_s> > m_rlcPduList; }; /** * \brief Substitutive structure for specifying BuildRarListElement_s::m_grant field */ struct UlGrant_s { uint16_t m_rnti; uint8_t m_rbStart; uint8_t m_rbLen; uint16_t m_tbSize; uint8_t m_mcs; bool m_hopping; int8_t m_tpc; bool m_cqiRequest; bool m_ulDelay; }; /** * \brief See section 4.3.10 buildRARListElement */ struct BuildRarListElement_s { uint16_t m_rnti; //uint32_t m_grant; // Substituted with type UlGrant_s UlGrant_s m_grant; struct DlDciListElement_s m_dci; }; /** * \brief See section 4.3.11 buildBroadcastListElement */ struct BuildBroadcastListElement_s { enum Type_e { BCCH, PCCH } m_type; uint8_t m_index; struct DlDciListElement_s m_dci; }; /** * \brief See section 4.3.12 ulInfoListElement */ struct UlInfoListElement_s { uint16_t m_rnti; std::vector <uint16_t> m_ulReception; enum ReceptionStatus_e { Ok, NotOk, NotValid } m_receptionStatus; uint8_t m_tpc; }; /** * \brief See section 4.3.13 srListElement */ struct SrListElement_s { uint16_t m_rnti; }; /** * \brief See section 4.3.15 macCEValue */ struct MacCeValue_u { uint8_t m_phr; uint8_t m_crnti; std::vector <uint8_t> m_bufferStatus; }; /** * \brief See section 4.3.14 macCEListElement */ struct MacCeListElement_s { uint16_t m_rnti; enum MacCeType_e { BSR, PHR, CRNTI } m_macCeType; struct MacCeValue_u m_macCeValue; }; /** * \brief See section 4.3.16 drxConfig */ struct DrxConfig_s { uint8_t m_onDurationTimer; uint16_t m_drxInactivityTimer; uint16_t m_drxRetransmissionTimer; uint16_t m_longDrxCycle; uint16_t m_longDrxCycleStartOffset; uint16_t m_shortDrxCycle; uint8_t m_drxShortCycleTimer; }; /** * \brief See section 4.3.17 spsConfig */ struct SpsConfig_s { uint16_t m_semiPersistSchedIntervalUl; uint16_t m_semiPersistSchedIntervalDl; uint8_t m_numberOfConfSpsProcesses; uint8_t m_n1PucchAnPersistentListSize; std::vector <uint16_t> m_n1PucchAnPersistentList; uint8_t m_implicitReleaseAfter; }; /** * \brief See section 4.3.18 srConfig */ struct SrConfig_s { enum SetupRelease_e m_action; uint8_t m_schedInterval; uint8_t m_dsrTransMax; }; /** * \brief See section 4.3.19 cqiConfig */ struct CqiConfig_s { enum SetupRelease_e m_action; uint16_t m_cqiSchedInterval; uint8_t m_riSchedInterval; }; /** * \brief See section 4.3.20 ueCapabilities */ struct UeCapabilities_s { bool m_halfDuplex; bool m_intraSfHopping; bool m_type2Sb1; uint8_t m_ueCategory; bool m_resAllocType1; }; /** * \brief See section 4.3.22 siMessageListElement */ struct SiMessageListElement_s { uint16_t m_periodicity; uint16_t m_length; }; /** * \brief See section 4.3.21 siConfiguration */ struct SiConfiguration_s { uint16_t m_sfn; uint16_t m_sib1Length; uint8_t m_siWindowLength; std::vector <struct SiMessageListElement_s> m_siMessageList; }; /** * \brief See section 4.3.23 dlInfoListElement */ struct DlInfoListElement_s { uint16_t m_rnti; uint8_t m_harqProcessId; enum HarqStatus_e { ACK, NACK, DTX }; std::vector <enum HarqStatus_e> m_harqStatus; }; /** * \brief See section 4.3.28 bwPart */ struct BwPart_s { uint8_t m_bwPartIndex; uint8_t m_sb; uint8_t m_cqi; }; /** * \brief See section 4.3.27 higherLayerSelected */ struct HigherLayerSelected_s { uint8_t m_sbPmi; std::vector <uint8_t> m_sbCqi; }; /** * \brief See section 4.3.26 ueSelected */ struct UeSelected_s { std::vector <uint8_t> m_sbList; uint8_t m_sbPmi; std::vector <uint8_t> m_sbCqi; }; /** * \brief See section 4.3.25 sbMeasResult */ struct SbMeasResult_s { struct UeSelected_s m_ueSelected; std::vector <struct HigherLayerSelected_s> m_higherLayerSelected; struct BwPart_s m_bwPart; }; /** * \brief See section 4.3.24 cqiListElement */ struct CqiListElement_s { uint16_t m_rnti; uint8_t m_ri; enum CqiType_e { P10, P11, P20, P21, A12, A22, A20, A30, A31 } m_cqiType; std::vector <uint8_t> m_wbCqi; uint8_t m_wbPmi; struct SbMeasResult_s m_sbMeasResult; }; /** * \brief See section 4.3.29 ulCQI */ struct UlCqi_s { std::vector <uint16_t> m_sinr; enum Type_e { SRS, PUSCH, PUCCH_1, PUCCH_2, PRACH } m_type; }; /** * \brief See section 4.3.30 pagingInfoListElement */ struct PagingInfoListElement_s { uint8_t m_pagingIndex; uint16_t m_pagingMessageSize; uint8_t m_pagingSubframe; }; } // namespace ns3 #endif /* FF_MAC_COMMON_H */
18.858566
84
0.704658
[ "vector" ]
5844f1e42ef713287b5bd6bf668045d96cba95ee
13,746
h
C
cpdp/include/tencentcloud/cpdp/v20190820/model/TranItem.h
li5ch/tencentcloud-sdk-cpp
12ebfd75a399ee2791f6ac1220a79ce8a9faf7c4
[ "Apache-2.0" ]
43
2019-08-14T08:14:12.000Z
2022-03-30T12:35:09.000Z
cpdp/include/tencentcloud/cpdp/v20190820/model/TranItem.h
li5ch/tencentcloud-sdk-cpp
12ebfd75a399ee2791f6ac1220a79ce8a9faf7c4
[ "Apache-2.0" ]
12
2019-07-15T10:44:59.000Z
2021-11-02T12:35:00.000Z
cpdp/include/tencentcloud/cpdp/v20190820/model/TranItem.h
li5ch/tencentcloud-sdk-cpp
12ebfd75a399ee2791f6ac1220a79ce8a9faf7c4
[ "Apache-2.0" ]
28
2019-07-12T09:06:22.000Z
2022-03-30T08:04:18.000Z
/* * Copyright (c) 2017-2019 THL A29 Limited, a Tencent company. All Rights Reserved. * * 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. */ #ifndef TENCENTCLOUD_CPDP_V20190820_MODEL_TRANITEM_H_ #define TENCENTCLOUD_CPDP_V20190820_MODEL_TRANITEM_H_ #include <string> #include <vector> #include <map> #include <tencentcloud/core/utils/rapidjson/document.h> #include <tencentcloud/core/utils/rapidjson/writer.h> #include <tencentcloud/core/utils/rapidjson/stringbuffer.h> #include <tencentcloud/core/AbstractModel.h> namespace TencentCloud { namespace Cpdp { namespace V20190820 { namespace Model { /** * 交易信息 */ class TranItem : public AbstractModel { public: TranItem(); ~TranItem() = default; void ToJsonObject(rapidjson::Value &value, rapidjson::Document::AllocatorType& allocator) const; CoreInternalOutcome Deserialize(const rapidjson::Value &value); /** * 获取STRING(50),资金汇总账号 注意:此字段可能返回 null,表示取不到有效值。 * @return FundSummaryAcctNo STRING(50),资金汇总账号 注意:此字段可能返回 null,表示取不到有效值。 */ std::string GetFundSummaryAcctNo() const; /** * 设置STRING(50),资金汇总账号 注意:此字段可能返回 null,表示取不到有效值。 * @param FundSummaryAcctNo STRING(50),资金汇总账号 注意:此字段可能返回 null,表示取不到有效值。 */ void SetFundSummaryAcctNo(const std::string& _fundSummaryAcctNo); /** * 判断参数 FundSummaryAcctNo 是否已赋值 * @return FundSummaryAcctNo 是否已赋值 */ bool FundSummaryAcctNoHasBeenSet() const; /** * 获取STRING(50),见证子账户的账号 注意:此字段可能返回 null,表示取不到有效值。 * @return SubAcctNo STRING(50),见证子账户的账号 注意:此字段可能返回 null,表示取不到有效值。 */ std::string GetSubAcctNo() const; /** * 设置STRING(50),见证子账户的账号 注意:此字段可能返回 null,表示取不到有效值。 * @param SubAcctNo STRING(50),见证子账户的账号 注意:此字段可能返回 null,表示取不到有效值。 */ void SetSubAcctNo(const std::string& _subAcctNo); /** * 判断参数 SubAcctNo 是否已赋值 * @return SubAcctNo 是否已赋值 */ bool SubAcctNoHasBeenSet() const; /** * 获取STRING(32),交易网会员代码 注意:此字段可能返回 null,表示取不到有效值。 * @return TranNetMemberCode STRING(32),交易网会员代码 注意:此字段可能返回 null,表示取不到有效值。 */ std::string GetTranNetMemberCode() const; /** * 设置STRING(32),交易网会员代码 注意:此字段可能返回 null,表示取不到有效值。 * @param TranNetMemberCode STRING(32),交易网会员代码 注意:此字段可能返回 null,表示取不到有效值。 */ void SetTranNetMemberCode(const std::string& _tranNetMemberCode); /** * 判断参数 TranNetMemberCode 是否已赋值 * @return TranNetMemberCode 是否已赋值 */ bool TranNetMemberCodeHasBeenSet() const; /** * 获取STRING(150),会员名称 注意:此字段可能返回 null,表示取不到有效值。 * @return MemberName STRING(150),会员名称 注意:此字段可能返回 null,表示取不到有效值。 */ std::string GetMemberName() const; /** * 设置STRING(150),会员名称 注意:此字段可能返回 null,表示取不到有效值。 * @param MemberName STRING(150),会员名称 注意:此字段可能返回 null,表示取不到有效值。 */ void SetMemberName(const std::string& _memberName); /** * 判断参数 MemberName 是否已赋值 * @return MemberName 是否已赋值 */ bool MemberNameHasBeenSet() const; /** * 获取STRING(5),会员证件类型(详情见“常见问题”) 注意:此字段可能返回 null,表示取不到有效值。 * @return MemberGlobalType STRING(5),会员证件类型(详情见“常见问题”) 注意:此字段可能返回 null,表示取不到有效值。 */ std::string GetMemberGlobalType() const; /** * 设置STRING(5),会员证件类型(详情见“常见问题”) 注意:此字段可能返回 null,表示取不到有效值。 * @param MemberGlobalType STRING(5),会员证件类型(详情见“常见问题”) 注意:此字段可能返回 null,表示取不到有效值。 */ void SetMemberGlobalType(const std::string& _memberGlobalType); /** * 判断参数 MemberGlobalType 是否已赋值 * @return MemberGlobalType 是否已赋值 */ bool MemberGlobalTypeHasBeenSet() const; /** * 获取STRING(32),会员证件号码 注意:此字段可能返回 null,表示取不到有效值。 * @return MemberGlobalId STRING(32),会员证件号码 注意:此字段可能返回 null,表示取不到有效值。 */ std::string GetMemberGlobalId() const; /** * 设置STRING(32),会员证件号码 注意:此字段可能返回 null,表示取不到有效值。 * @param MemberGlobalId STRING(32),会员证件号码 注意:此字段可能返回 null,表示取不到有效值。 */ void SetMemberGlobalId(const std::string& _memberGlobalId); /** * 判断参数 MemberGlobalId 是否已赋值 * @return MemberGlobalId 是否已赋值 */ bool MemberGlobalIdHasBeenSet() const; /** * 获取STRING(50),会员绑定账户的账号(提现的银行卡) 注意:此字段可能返回 null,表示取不到有效值。 * @return MemberAcctNo STRING(50),会员绑定账户的账号(提现的银行卡) 注意:此字段可能返回 null,表示取不到有效值。 */ std::string GetMemberAcctNo() const; /** * 设置STRING(50),会员绑定账户的账号(提现的银行卡) 注意:此字段可能返回 null,表示取不到有效值。 * @param MemberAcctNo STRING(50),会员绑定账户的账号(提现的银行卡) 注意:此字段可能返回 null,表示取不到有效值。 */ void SetMemberAcctNo(const std::string& _memberAcctNo); /** * 判断参数 MemberAcctNo 是否已赋值 * @return MemberAcctNo 是否已赋值 */ bool MemberAcctNoHasBeenSet() const; /** * 获取STRING(10),会员绑定账户的本他行类型(1: 本行; 2: 他行) 注意:此字段可能返回 null,表示取不到有效值。 * @return BankType STRING(10),会员绑定账户的本他行类型(1: 本行; 2: 他行) 注意:此字段可能返回 null,表示取不到有效值。 */ std::string GetBankType() const; /** * 设置STRING(10),会员绑定账户的本他行类型(1: 本行; 2: 他行) 注意:此字段可能返回 null,表示取不到有效值。 * @param BankType STRING(10),会员绑定账户的本他行类型(1: 本行; 2: 他行) 注意:此字段可能返回 null,表示取不到有效值。 */ void SetBankType(const std::string& _bankType); /** * 判断参数 BankType 是否已赋值 * @return BankType 是否已赋值 */ bool BankTypeHasBeenSet() const; /** * 获取STRING(150),会员绑定账户的开户行名称 注意:此字段可能返回 null,表示取不到有效值。 * @return AcctOpenBranchName STRING(150),会员绑定账户的开户行名称 注意:此字段可能返回 null,表示取不到有效值。 */ std::string GetAcctOpenBranchName() const; /** * 设置STRING(150),会员绑定账户的开户行名称 注意:此字段可能返回 null,表示取不到有效值。 * @param AcctOpenBranchName STRING(150),会员绑定账户的开户行名称 注意:此字段可能返回 null,表示取不到有效值。 */ void SetAcctOpenBranchName(const std::string& _acctOpenBranchName); /** * 判断参数 AcctOpenBranchName 是否已赋值 * @return AcctOpenBranchName 是否已赋值 */ bool AcctOpenBranchNameHasBeenSet() const; /** * 获取STRING(20),会员绑定账户的开户行的联行号 注意:此字段可能返回 null,表示取不到有效值。 * @return CnapsBranchId STRING(20),会员绑定账户的开户行的联行号 注意:此字段可能返回 null,表示取不到有效值。 */ std::string GetCnapsBranchId() const; /** * 设置STRING(20),会员绑定账户的开户行的联行号 注意:此字段可能返回 null,表示取不到有效值。 * @param CnapsBranchId STRING(20),会员绑定账户的开户行的联行号 注意:此字段可能返回 null,表示取不到有效值。 */ void SetCnapsBranchId(const std::string& _cnapsBranchId); /** * 判断参数 CnapsBranchId 是否已赋值 * @return CnapsBranchId 是否已赋值 */ bool CnapsBranchIdHasBeenSet() const; /** * 获取STRING(20),会员绑定账户的开户行的超级网银行号 注意:此字段可能返回 null,表示取不到有效值。 * @return EiconBankBranchId STRING(20),会员绑定账户的开户行的超级网银行号 注意:此字段可能返回 null,表示取不到有效值。 */ std::string GetEiconBankBranchId() const; /** * 设置STRING(20),会员绑定账户的开户行的超级网银行号 注意:此字段可能返回 null,表示取不到有效值。 * @param EiconBankBranchId STRING(20),会员绑定账户的开户行的超级网银行号 注意:此字段可能返回 null,表示取不到有效值。 */ void SetEiconBankBranchId(const std::string& _eiconBankBranchId); /** * 判断参数 EiconBankBranchId 是否已赋值 * @return EiconBankBranchId 是否已赋值 */ bool EiconBankBranchIdHasBeenSet() const; /** * 获取STRING(30),会员的手机号 注意:此字段可能返回 null,表示取不到有效值。 * @return Mobile STRING(30),会员的手机号 注意:此字段可能返回 null,表示取不到有效值。 */ std::string GetMobile() const; /** * 设置STRING(30),会员的手机号 注意:此字段可能返回 null,表示取不到有效值。 * @param Mobile STRING(30),会员的手机号 注意:此字段可能返回 null,表示取不到有效值。 */ void SetMobile(const std::string& _mobile); /** * 判断参数 Mobile 是否已赋值 * @return Mobile 是否已赋值 */ bool MobileHasBeenSet() const; private: /** * STRING(50),资金汇总账号 注意:此字段可能返回 null,表示取不到有效值。 */ std::string m_fundSummaryAcctNo; bool m_fundSummaryAcctNoHasBeenSet; /** * STRING(50),见证子账户的账号 注意:此字段可能返回 null,表示取不到有效值。 */ std::string m_subAcctNo; bool m_subAcctNoHasBeenSet; /** * STRING(32),交易网会员代码 注意:此字段可能返回 null,表示取不到有效值。 */ std::string m_tranNetMemberCode; bool m_tranNetMemberCodeHasBeenSet; /** * STRING(150),会员名称 注意:此字段可能返回 null,表示取不到有效值。 */ std::string m_memberName; bool m_memberNameHasBeenSet; /** * STRING(5),会员证件类型(详情见“常见问题”) 注意:此字段可能返回 null,表示取不到有效值。 */ std::string m_memberGlobalType; bool m_memberGlobalTypeHasBeenSet; /** * STRING(32),会员证件号码 注意:此字段可能返回 null,表示取不到有效值。 */ std::string m_memberGlobalId; bool m_memberGlobalIdHasBeenSet; /** * STRING(50),会员绑定账户的账号(提现的银行卡) 注意:此字段可能返回 null,表示取不到有效值。 */ std::string m_memberAcctNo; bool m_memberAcctNoHasBeenSet; /** * STRING(10),会员绑定账户的本他行类型(1: 本行; 2: 他行) 注意:此字段可能返回 null,表示取不到有效值。 */ std::string m_bankType; bool m_bankTypeHasBeenSet; /** * STRING(150),会员绑定账户的开户行名称 注意:此字段可能返回 null,表示取不到有效值。 */ std::string m_acctOpenBranchName; bool m_acctOpenBranchNameHasBeenSet; /** * STRING(20),会员绑定账户的开户行的联行号 注意:此字段可能返回 null,表示取不到有效值。 */ std::string m_cnapsBranchId; bool m_cnapsBranchIdHasBeenSet; /** * STRING(20),会员绑定账户的开户行的超级网银行号 注意:此字段可能返回 null,表示取不到有效值。 */ std::string m_eiconBankBranchId; bool m_eiconBankBranchIdHasBeenSet; /** * STRING(30),会员的手机号 注意:此字段可能返回 null,表示取不到有效值。 */ std::string m_mobile; bool m_mobileHasBeenSet; }; } } } } #endif // !TENCENTCLOUD_CPDP_V20190820_MODEL_TRANITEM_H_
33.857143
116
0.472865
[ "vector", "model" ]
3890253854ebd8b221339f1fe92f646315817c0a
821
h
C
ImageRecognition/Class/Components/AVCaptureManager/AVCaptureManager.h
liuyongjiesail/ImageRecognition
742d1f17d0709499b52e64b327666039e4a978e5
[ "MIT" ]
1
2018-12-27T03:31:31.000Z
2018-12-27T03:31:31.000Z
ImageRecognition/Class/Components/AVCaptureManager/AVCaptureManager.h
liuyongjiesail/ImageRecognition
742d1f17d0709499b52e64b327666039e4a978e5
[ "MIT" ]
null
null
null
ImageRecognition/Class/Components/AVCaptureManager/AVCaptureManager.h
liuyongjiesail/ImageRecognition
742d1f17d0709499b52e64b327666039e4a978e5
[ "MIT" ]
null
null
null
// // AVCaptureManager.h // DynamicPublic // // Created by 刘永杰 on 2017/7/28. // Copyright © 2017年 刘永杰. All rights reserved. // #import <Foundation/Foundation.h> #import <AVFoundation/AVFoundation.h> #import <UIKit/UIKit.h> typedef void(^Result)(id object); @interface AVCaptureManager : NSObject /** 单例对象 @return 摄像管理者 */ + (instancetype)sharedManager; /** 初始化设备session @param previewLayer 回调图层渲染 */ - (void)captureSessionPreviewLayer:(Result)previewLayer; /** 拍照 @param resultImage 回调图片 */ - (void)shootImage:(Result)resultImage; /** 对焦 @param point 触摸点 */ - (void)focusingAtPoint:(CGPoint)point; /** 切换前后摄像头 */ - (void)switchFrontAndBackCameras; /** 开始捕获图像 */ - (void)startRunning; /** 停止捕获图像 */ - (void)stopRunning; /** 是否允许访问相机 @return 是/否 */ - (BOOL)isCanUseCamera; @end
11.898551
56
0.677223
[ "object" ]
38908000aa1b4936ec161be399c7d621d5394e56
2,189
h
C
src/utils/photon_utils.h
ReillyBova/Global-Illumination
9657d34bbde926e8364337020e6d28016310ee45
[ "MIT" ]
33
2019-02-24T18:57:08.000Z
2022-02-28T09:43:19.000Z
src/utils/photon_utils.h
ReillyBova/Global-Illumination
9657d34bbde926e8364337020e6d28016310ee45
[ "MIT" ]
null
null
null
src/utils/photon_utils.h
ReillyBova/Global-Illumination
9657d34bbde926e8364337020e6d28016310ee45
[ "MIT" ]
5
2020-06-09T13:56:14.000Z
2021-12-21T09:17:39.000Z
//////////////////////////////////////////////////////////////////////// // Directives //////////////////////////////////////////////////////////////////////// #ifndef PHOTON_UTILS_INC #define PHOTON_UTILS_INC #include "../render.h" #include "../R3Graphics/R3Graphics.h" #include <vector> using namespace std; //////////////////////////////////////////////////////////////////////// // Storage Utils //////////////////////////////////////////////////////////////////////// // Flush local memory to global memory using dynamic memory and synchronization // primatives; returns 1 if successful; 0 otherwise int FlushPhotonStorage(vector<Photon>& local_photon_storage, Photon_Type map_type); // Store Photons locally in vector; if vector is full, safely copy to // global memory using sychronization (thread safe); uses dynamic memory void StorePhoton(RNRgb& photon, vector<Photon>& local_photon_storage, R3Vector& incident_vector, R3Point& point, Photon_Type map_type); //////////////////////////////////////////////////////////////////////// // Radiance Utils //////////////////////////////////////////////////////////////////////// // Sample the radiance at a point into the color from the provided photon map void EstimateRadiance(R3Point& point, R3Vector& normal, RNRgb& color, const R3Brdf *brdf, const R3Vector& exact_bounce, RNScalar cos_theta, R3Kdtree<Photon*>* photon_map, int estimate_size, RNScalar estimate_dist, Filter_Type filter); // Sample the radiance from the irradiance cache void EstimateCachedRadiance(R3Point& point, R3Vector& normal, RNRgb& color, const R3Brdf *brdf, const R3Vector& exact_bounce, RNScalar cos_theta, R3Kdtree<Photon*>* photon_map, RNScalar estimate_dist); // Roughly sample the irradiance at a point void EstimateIrradiance(R3Point& point, RNRgb& color, R3Kdtree<Photon*>* photon_map, int estimate_size, RNScalar estimate_dist); //////////////////////////////////////////////////////////////////////// // Efficiency Utils //////////////////////////////////////////////////////////////////////// // Build mapping from spherical coordinates to xyz coordinates for fast lookup void BuildDirectionLookupTable(void); #endif
40.537037
84
0.577433
[ "render", "vector" ]
3892f9dfdd51fb6df4dd8f4cc430d3d07c883ac8
23,773
h
C
internal/core/src/index/thirdparty/faiss/impl/ScalarQuantizerCodec_avx512.h
mfkiwl/milvus
c440b9e8a0dcb18bee52d58da303c37a97d20f94
[ "Apache-2.0" ]
10,504
2019-09-16T12:20:11.000Z
2022-03-31T15:07:56.000Z
internal/core/src/index/thirdparty/faiss/impl/ScalarQuantizerCodec_avx512.h
mfkiwl/milvus
c440b9e8a0dcb18bee52d58da303c37a97d20f94
[ "Apache-2.0" ]
13,389
2019-09-16T06:49:53.000Z
2022-03-31T18:01:24.000Z
internal/core/src/index/thirdparty/faiss/impl/ScalarQuantizerCodec_avx512.h
mfkiwl/milvus
c440b9e8a0dcb18bee52d58da303c37a97d20f94
[ "Apache-2.0" ]
1,792
2019-09-18T04:27:42.000Z
2022-03-31T14:37:20.000Z
/** * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ // -*- c++ -*- #pragma once #include <cstdio> #include <algorithm> #include <omp.h> #include <immintrin.h> #include <faiss/utils/utils.h> #include <faiss/impl/FaissAssert.h> #include <faiss/impl/ScalarQuantizer.h> #include <faiss/impl/ScalarQuantizerCodec_avx.h> #include <faiss/impl/ScalarQuantizerOp.h> namespace faiss { /******************************************************************* * ScalarQuantizer implementation * * The main source of complexity is to support combinations of 4 * variants without incurring runtime tests or virtual function calls: * * - 4 / 8 bits per code component * - uniform / non-uniform * - IP / L2 distance search * - scalar / AVX distance computation * * The appropriate Quantizer object is returned via select_quantizer * that hides the template mess. ********************************************************************/ /******************************************************************* * Codec: converts between values in [0, 1] and an index in a code * array. The "i" parameter is the vector component index (not byte * index). */ struct Codec8bit_avx512 : public Codec8bit_avx { static __m512 decode_16_components (const uint8_t *code, int i) { uint64_t c8 = *(uint64_t*)(code + i); __m256i c8lo = _mm256_cvtepu8_epi32 (_mm_set1_epi64x(c8)); c8 = *(uint64_t*)(code + i + 8); __m256i c8hi = _mm256_cvtepu8_epi32 (_mm_set1_epi64x(c8)); // __m256i i8 = _mm256_set_m128i(c4lo, c4hi); __m512i i16 = _mm512_castsi256_si512 (c8lo); i16 = _mm512_inserti32x8 (i16, c8hi, 1); __m512 f16 = _mm512_cvtepi32_ps (i16); __m512 half = _mm512_set1_ps (0.5f); f16 += half; __m512 one_255 = _mm512_set1_ps (1.f / 255.f); return f16 * one_255; } }; struct Codec4bit_avx512 : public Codec4bit_avx { static __m512 decode_16_components (const uint8_t *code, int i) { uint64_t c8 = *(uint64_t*)(code + (i >> 1)); uint64_t mask = 0x0f0f0f0f0f0f0f0f; uint64_t c8ev = c8 & mask; uint64_t c8od = (c8 >> 4) & mask; // the 8 lower bytes of c8 contain the values __m128i c16 = _mm_unpacklo_epi8 (_mm_set1_epi64x(c8ev), _mm_set1_epi64x(c8od)); __m256i c8lo = _mm256_cvtepu8_epi32 (c16); __m256i c8hi = _mm256_cvtepu8_epi32 (_mm_srli_si128(c16, 4)); __m512i i16 = _mm512_castsi256_si512 (c8lo); i16 = _mm512_inserti32x8 (i16, c8hi, 1); __m512 f16 = _mm512_cvtepi32_ps (i16); __m512 half = _mm512_set1_ps (0.5f); f16 += half; __m512 one_255 = _mm512_set1_ps (1.f / 15.f); return f16 * one_255; } }; struct Codec6bit_avx512 : public Codec6bit_avx { static __m512 decode_16_components (const uint8_t *code, int i) { return _mm512_set_ps (decode_component(code, i + 15), decode_component(code, i + 14), decode_component(code, i + 13), decode_component(code, i + 12), decode_component(code, i + 11), decode_component(code, i + 10), decode_component(code, i + 9), decode_component(code, i + 8), decode_component(code, i + 7), decode_component(code, i + 6), decode_component(code, i + 5), decode_component(code, i + 4), decode_component(code, i + 3), decode_component(code, i + 2), decode_component(code, i + 1), decode_component(code, i + 0)); } }; /******************************************************************* * Quantizer: normalizes scalar vector components, then passes them * through a codec *******************************************************************/ template<class Codec, bool uniform, int SIMD> struct QuantizerTemplate_avx512 {}; template<class Codec> struct QuantizerTemplate_avx512<Codec, true, 1> : public QuantizerTemplate_avx<Codec, true, 1> { QuantizerTemplate_avx512(size_t d, const std::vector<float> &trained) : QuantizerTemplate_avx<Codec, true, 1> (d, trained) {} }; template<class Codec> struct QuantizerTemplate_avx512<Codec, true, 8> : public QuantizerTemplate_avx<Codec, true, 8> { QuantizerTemplate_avx512 (size_t d, const std::vector<float> &trained) : QuantizerTemplate_avx<Codec, true, 8> (d, trained) {} }; template<class Codec> struct QuantizerTemplate_avx512<Codec, true, 16> : public QuantizerTemplate_avx<Codec, true, 8> { QuantizerTemplate_avx512 (size_t d, const std::vector<float> &trained) : QuantizerTemplate_avx<Codec, true, 8> (d, trained) {} __m512 reconstruct_16_components (const uint8_t * code, int i) const { __m512 xi = Codec::decode_16_components (code, i); return _mm512_set1_ps(this->vmin) + xi * _mm512_set1_ps (this->vdiff); } }; template<class Codec> struct QuantizerTemplate_avx512<Codec, false, 1> : public QuantizerTemplate_avx<Codec, false, 1> { QuantizerTemplate_avx512 (size_t d, const std::vector<float> &trained) : QuantizerTemplate_avx<Codec, false, 1> (d, trained) {} }; template<class Codec> struct QuantizerTemplate_avx512<Codec, false, 8> : public QuantizerTemplate_avx<Codec, false, 8> { QuantizerTemplate_avx512 (size_t d, const std::vector<float> &trained): QuantizerTemplate_avx<Codec, false, 8> (d, trained) {} }; template<class Codec> struct QuantizerTemplate_avx512<Codec, false, 16>: public QuantizerTemplate_avx<Codec, false, 8> { QuantizerTemplate_avx512 (size_t d, const std::vector<float> &trained): QuantizerTemplate_avx<Codec, false, 8> (d, trained) {} __m512 reconstruct_16_components (const uint8_t * code, int i) const { __m512 xi = Codec::decode_16_components (code, i); return _mm512_loadu_ps (this->vmin + i) + xi * _mm512_loadu_ps (this->vdiff + i); } }; /******************************************************************* * FP16 quantizer *******************************************************************/ template<int SIMDWIDTH> struct QuantizerFP16_avx512 {}; template<> struct QuantizerFP16_avx512<1> : public QuantizerFP16_avx<1> { QuantizerFP16_avx512(size_t d, const std::vector<float> &unused) : QuantizerFP16_avx<1> (d, unused) {} }; template<> struct QuantizerFP16_avx512<8> : public QuantizerFP16_avx<8> { QuantizerFP16_avx512 (size_t d, const std::vector<float> &trained) : QuantizerFP16_avx<8> (d, trained) {} }; template<> struct QuantizerFP16_avx512<16>: public QuantizerFP16_avx<8> { QuantizerFP16_avx512 (size_t d, const std::vector<float> &trained): QuantizerFP16_avx<8> (d, trained) {} __m512 reconstruct_16_components (const uint8_t * code, int i) const { __m256i codei = _mm256_loadu_si256 ((const __m256i*)(code + 2 * i)); return _mm512_cvtph_ps (codei); } }; /******************************************************************* * 8bit_direct quantizer *******************************************************************/ template<int SIMDWIDTH> struct Quantizer8bitDirect_avx512 {}; template<> struct Quantizer8bitDirect_avx512<1> : public Quantizer8bitDirect_avx<1> { Quantizer8bitDirect_avx512(size_t d, const std::vector<float> &unused) : Quantizer8bitDirect_avx<1> (d, unused) {} }; template<> struct Quantizer8bitDirect_avx512<8> : public Quantizer8bitDirect_avx<8> { Quantizer8bitDirect_avx512 (size_t d, const std::vector<float> &trained): Quantizer8bitDirect_avx<8> (d, trained) {} }; template<> struct Quantizer8bitDirect_avx512<16> : public Quantizer8bitDirect_avx<8> { Quantizer8bitDirect_avx512 (size_t d, const std::vector<float> &trained): Quantizer8bitDirect_avx<8> (d, trained) {} __m512 reconstruct_16_components (const uint8_t * code, int i) const { __m128i x8 = _mm_load_si128((__m128i*)(code + i)); // 16 * int8 __m512i y8 = _mm512_cvtepu8_epi32 (x8); // 16 * int32 return _mm512_cvtepi32_ps (y8); // 16 * float32 } }; template<int SIMDWIDTH> Quantizer *select_quantizer_1_avx512 (QuantizerType qtype, size_t d, const std::vector<float> & trained) { switch(qtype) { case QuantizerType::QT_8bit: return new QuantizerTemplate_avx512<Codec8bit_avx512, false, SIMDWIDTH>(d, trained); case QuantizerType::QT_6bit: return new QuantizerTemplate_avx512<Codec6bit_avx512, false, SIMDWIDTH>(d, trained); case QuantizerType::QT_4bit: return new QuantizerTemplate_avx512<Codec4bit_avx512, false, SIMDWIDTH>(d, trained); case QuantizerType::QT_8bit_uniform: return new QuantizerTemplate_avx512<Codec8bit_avx512, true, SIMDWIDTH>(d, trained); case QuantizerType::QT_4bit_uniform: return new QuantizerTemplate_avx512<Codec4bit_avx512, true, SIMDWIDTH>(d, trained); case QuantizerType::QT_fp16: return new QuantizerFP16_avx512<SIMDWIDTH>(d, trained); case QuantizerType::QT_8bit_direct: return new Quantizer8bitDirect_avx512<SIMDWIDTH>(d, trained); } FAISS_THROW_MSG ("unknown qtype"); } /******************************************************************* * Similarity: gets vector components and computes a similarity wrt. a * query vector stored in the object. The data fields just encapsulate * an accumulator. */ template<int SIMDWIDTH> struct SimilarityL2_avx512 {}; template<> struct SimilarityL2_avx512<1> : public SimilarityL2_avx<1> { static constexpr int simdwidth = 1; static constexpr MetricType metric_type = METRIC_L2; explicit SimilarityL2_avx512 (const float * y) : SimilarityL2_avx<1> (y) {} }; template<> struct SimilarityL2_avx512<8> : public SimilarityL2_avx<8> { static constexpr int simdwidth = 8; static constexpr MetricType metric_type = METRIC_L2; explicit SimilarityL2_avx512 (const float * y) : SimilarityL2_avx<8> (y) {} }; template<> struct SimilarityL2_avx512<16> { static constexpr int simdwidth = 16; static constexpr MetricType metric_type = METRIC_L2; const float *y, *yi; explicit SimilarityL2_avx512 (const float * y): y(y) {} __m512 accu16; void begin_16 () { accu16 = _mm512_setzero_ps(); yi = y; } void add_16_components (__m512 x) { __m512 yiv = _mm512_loadu_ps (yi); yi += 16; __m512 tmp = yiv - x; accu16 += tmp * tmp; } void add_16_components_2 (__m512 x, __m512 y) { __m512 tmp = y - x; accu16 += tmp * tmp; } float result_16 () { __m256 sum0 = _mm512_extractf32x8_ps(accu16, 1) + _mm512_extractf32x8_ps(accu16, 0); __m256 sum1 = _mm256_hadd_ps(sum0, sum0); __m256 sum2 = _mm256_hadd_ps(sum1, sum1); // now add the 0th and 4th component return _mm_cvtss_f32 (_mm256_castps256_ps128(sum2)) + _mm_cvtss_f32 (_mm256_extractf128_ps(sum2, 1)); } }; template<int SIMDWIDTH> struct SimilarityIP_avx512 {}; template<> struct SimilarityIP_avx512<1> : public SimilarityIP_avx<1> { static constexpr int simdwidth = 1; static constexpr MetricType metric_type = METRIC_INNER_PRODUCT; explicit SimilarityIP_avx512 (const float * y) : SimilarityIP_avx<1> (y) {} }; template<> struct SimilarityIP_avx512<8> : public SimilarityIP_avx<8> { static constexpr int simdwidth = 8; static constexpr MetricType metric_type = METRIC_INNER_PRODUCT; explicit SimilarityIP_avx512 (const float * y) : SimilarityIP_avx<8> (y) {} }; template<> struct SimilarityIP_avx512<16> { static constexpr int simdwidth = 16; static constexpr MetricType metric_type = METRIC_INNER_PRODUCT; const float *y, *yi; float accu; explicit SimilarityIP_avx512 (const float * y) : y (y) {} __m512 accu16; void begin_16 () { accu16 = _mm512_setzero_ps(); yi = y; } void add_16_components (__m512 x) { __m512 yiv = _mm512_loadu_ps (yi); yi += 16; accu16 += yiv * x; } void add_16_components_2 (__m512 x1, __m512 x2) { accu16 += x1 * x2; } float result_16 () { __m256 sum0 = _mm512_extractf32x8_ps(accu16, 1) + _mm512_extractf32x8_ps(accu16, 0); __m256 sum1 = _mm256_hadd_ps(sum0, sum0); __m256 sum2 = _mm256_hadd_ps(sum1, sum1); // now add the 0th and 4th component return _mm_cvtss_f32 (_mm256_castps256_ps128(sum2)) + _mm_cvtss_f32 (_mm256_extractf128_ps(sum2, 1)); } }; /******************************************************************* * DistanceComputer: combines a similarity and a quantizer to do * code-to-vector or code-to-code comparisons *******************************************************************/ template<class Quantizer, class Similarity, int SIMDWIDTH> struct DCTemplate_avx512 : SQDistanceComputer {}; template<class Quantizer, class Similarity> struct DCTemplate_avx512<Quantizer, Similarity, 1> : public DCTemplate_avx<Quantizer, Similarity, 1> { DCTemplate_avx512(size_t d, const std::vector<float> &trained) : DCTemplate_avx<Quantizer, Similarity, 1> (d, trained) {} }; template<class Quantizer, class Similarity> struct DCTemplate_avx512<Quantizer, Similarity, 8> : public DCTemplate_avx<Quantizer, Similarity, 8> { DCTemplate_avx512(size_t d, const std::vector<float> &trained) : DCTemplate_avx<Quantizer, Similarity, 8> (d, trained) {} }; template<class Quantizer, class Similarity> struct DCTemplate_avx512<Quantizer, Similarity, 16> : SQDistanceComputer { using Sim = Similarity; Quantizer quant; DCTemplate_avx512(size_t d, const std::vector<float> &trained): quant(d, trained) {} float compute_distance(const float* x, const uint8_t* code) const { Similarity sim(x); sim.begin_16(); for (size_t i = 0; i < quant.d; i += 16) { __m512 xi = quant.reconstruct_16_components(code, i); sim.add_16_components(xi); } return sim.result_16(); } float compute_code_distance(const uint8_t* code1, const uint8_t* code2) const { Similarity sim(nullptr); sim.begin_16(); for (size_t i = 0; i < quant.d; i += 16) { __m512 x1 = quant.reconstruct_16_components(code1, i); __m512 x2 = quant.reconstruct_16_components(code2, i); sim.add_16_components_2(x1, x2); } return sim.result_16(); } void set_query (const float *x) final { q = x; } /// compute distance of vector i to current query float operator () (idx_t i) final { return compute_distance (q, codes + i * code_size); } float symmetric_dis (idx_t i, idx_t j) override { return compute_code_distance (codes + i * code_size, codes + j * code_size); } float query_to_code (const uint8_t * code) const { return compute_distance (q, code); } }; /******************************************************************* * DistanceComputerByte: computes distances in the integer domain *******************************************************************/ template<class Similarity, int SIMDWIDTH> struct DistanceComputerByte_avx512 : SQDistanceComputer {}; template<class Similarity> struct DistanceComputerByte_avx512<Similarity, 1> : public DistanceComputerByte_avx<Similarity, 1> { DistanceComputerByte_avx512(int d, const std::vector<float> &unused) : DistanceComputerByte_avx<Similarity, 1> (d, unused) {} }; template<class Similarity> struct DistanceComputerByte_avx512<Similarity, 8> : public DistanceComputerByte_avx<Similarity, 8> { DistanceComputerByte_avx512(int d, const std::vector<float> &unused) : DistanceComputerByte_avx<Similarity, 8> (d, unused) {} }; template<class Similarity> struct DistanceComputerByte_avx512<Similarity, 16> : SQDistanceComputer { using Sim = Similarity; int d; std::vector<uint8_t> tmp; DistanceComputerByte_avx512(int d, const std::vector<float> &): d(d), tmp(d) {} int compute_code_distance(const uint8_t* code1, const uint8_t* code2) const { // __m256i accu = _mm256_setzero_ps (); __m512i accu = _mm512_setzero_si512 (); for (int i = 0; i < d; i += 32) { // load 32 bytes, convert to 16 uint16_t __m512i c1 = _mm512_cvtepu8_epi16 (_mm256_loadu_si256((__m256i*)(code1 + i))); __m512i c2 = _mm512_cvtepu8_epi16 (_mm256_loadu_si256((__m256i*)(code2 + i))); __m512i prod32; if (Sim::metric_type == METRIC_INNER_PRODUCT) { prod32 = _mm512_madd_epi16(c1, c2); } else { __m512i diff = _mm512_sub_epi16(c1, c2); prod32 = _mm512_madd_epi16(diff, diff); } accu = _mm512_add_epi32 (accu, prod32); } __m128i sum = _mm512_extracti32x4_epi32(accu, 0); sum = _mm_add_epi32 (sum, _mm512_extracti32x4_epi32(accu, 1)); sum = _mm_add_epi32 (sum, _mm512_extracti32x4_epi32(accu, 2)); sum = _mm_add_epi32 (sum, _mm512_extracti32x4_epi32(accu, 3)); sum = _mm_hadd_epi32 (sum, sum); sum = _mm_hadd_epi32 (sum, sum); return _mm_cvtsi128_si32 (sum); } void set_query (const float *x) final { /* for (int i = 0; i < d; i += 8) { __m256 xi = _mm256_loadu_ps (x + i); __m256i ci = _mm256_cvtps_epi32(xi); */ for (int i = 0; i < d; i++) { tmp[i] = int(x[i]); } } int compute_distance(const float* x, const uint8_t* code) { set_query(x); return compute_code_distance(tmp.data(), code); } /// compute distance of vector i to current query float operator () (idx_t i) final { return compute_distance (q, codes + i * code_size); } float symmetric_dis (idx_t i, idx_t j) override { return compute_code_distance (codes + i * code_size, codes + j * code_size); } float query_to_code (const uint8_t * code) const { return compute_code_distance (tmp.data(), code); } }; /******************************************************************* * select_distance_computer: runtime selection of template * specialization *******************************************************************/ template<class Sim> SQDistanceComputer *select_distance_computer_avx512 ( QuantizerType qtype, size_t d, const std::vector<float> & trained) { constexpr int SIMDWIDTH = Sim::simdwidth; switch(qtype) { case QuantizerType::QT_8bit_uniform: return new DCTemplate_avx512<QuantizerTemplate_avx512<Codec8bit_avx512, true, SIMDWIDTH>, Sim, SIMDWIDTH>(d, trained); case QuantizerType::QT_4bit_uniform: return new DCTemplate_avx512<QuantizerTemplate_avx512<Codec4bit_avx512, true, SIMDWIDTH>, Sim, SIMDWIDTH>(d, trained); case QuantizerType::QT_8bit: return new DCTemplate_avx512<QuantizerTemplate_avx512<Codec8bit_avx512, false, SIMDWIDTH>, Sim, SIMDWIDTH>(d, trained); case QuantizerType::QT_6bit: return new DCTemplate_avx512<QuantizerTemplate_avx512<Codec6bit_avx512, false, SIMDWIDTH>, Sim, SIMDWIDTH>(d, trained); case QuantizerType::QT_4bit: return new DCTemplate_avx512<QuantizerTemplate_avx512<Codec4bit_avx512, false, SIMDWIDTH>, Sim, SIMDWIDTH>(d, trained); case QuantizerType::QT_fp16: return new DCTemplate_avx512 <QuantizerFP16_avx512<SIMDWIDTH>, Sim, SIMDWIDTH>(d, trained); case QuantizerType::QT_8bit_direct: if (d % 16 == 0) { return new DistanceComputerByte_avx512<Sim, SIMDWIDTH>(d, trained); } else { return new DCTemplate_avx512 <Quantizer8bitDirect_avx512<SIMDWIDTH>, Sim, SIMDWIDTH>(d, trained); } } FAISS_THROW_MSG ("unknown qtype"); return nullptr; } template<class DCClass> InvertedListScanner* sel2_InvertedListScanner_avx512 ( const ScalarQuantizer *sq, const Index *quantizer, bool store_pairs, bool r) { return sel2_InvertedListScanner<DCClass> (sq, quantizer, store_pairs, r); } template<class Similarity, class Codec, bool uniform> InvertedListScanner* sel12_InvertedListScanner_avx512 ( const ScalarQuantizer *sq, const Index *quantizer, bool store_pairs, bool r) { constexpr int SIMDWIDTH = Similarity::simdwidth; using QuantizerClass = QuantizerTemplate_avx512<Codec, uniform, SIMDWIDTH>; using DCClass = DCTemplate_avx512<QuantizerClass, Similarity, SIMDWIDTH>; return sel2_InvertedListScanner_avx512<DCClass> (sq, quantizer, store_pairs, r); } template<class Similarity> InvertedListScanner* sel1_InvertedListScanner_avx512 ( const ScalarQuantizer *sq, const Index *quantizer, bool store_pairs, bool r) { constexpr int SIMDWIDTH = Similarity::simdwidth; switch(sq->qtype) { case QuantizerType::QT_8bit_uniform: return sel12_InvertedListScanner_avx512 <Similarity, Codec8bit_avx512, true>(sq, quantizer, store_pairs, r); case QuantizerType::QT_4bit_uniform: return sel12_InvertedListScanner_avx512 <Similarity, Codec4bit_avx512, true>(sq, quantizer, store_pairs, r); case QuantizerType::QT_8bit: return sel12_InvertedListScanner_avx512 <Similarity, Codec8bit_avx512, false>(sq, quantizer, store_pairs, r); case QuantizerType::QT_4bit: return sel12_InvertedListScanner_avx512 <Similarity, Codec4bit_avx512, false>(sq, quantizer, store_pairs, r); case QuantizerType::QT_6bit: return sel12_InvertedListScanner_avx512 <Similarity, Codec6bit_avx512, false>(sq, quantizer, store_pairs, r); case QuantizerType::QT_fp16: return sel2_InvertedListScanner_avx512 <DCTemplate_avx512<QuantizerFP16_avx512<SIMDWIDTH>, Similarity, SIMDWIDTH> > (sq, quantizer, store_pairs, r); case QuantizerType::QT_8bit_direct: if (sq->d % 16 == 0) { return sel2_InvertedListScanner_avx512 <DistanceComputerByte_avx512<Similarity, SIMDWIDTH> > (sq, quantizer, store_pairs, r); } else { return sel2_InvertedListScanner_avx512 <DCTemplate_avx512<Quantizer8bitDirect_avx512<SIMDWIDTH>, Similarity, SIMDWIDTH> > (sq, quantizer, store_pairs, r); } } FAISS_THROW_MSG ("unknown qtype"); return nullptr; } template<int SIMDWIDTH> InvertedListScanner* sel0_InvertedListScanner_avx512 ( MetricType mt, const ScalarQuantizer *sq, const Index *quantizer, bool store_pairs, bool by_residual) { if (mt == METRIC_L2) { return sel1_InvertedListScanner_avx512<SimilarityL2_avx512<SIMDWIDTH> > (sq, quantizer, store_pairs, by_residual); } else if (mt == METRIC_INNER_PRODUCT) { return sel1_InvertedListScanner_avx512<SimilarityIP_avx512<SIMDWIDTH> > (sq, quantizer, store_pairs, by_residual); } else { FAISS_THROW_MSG("unsupported metric type"); } } } // namespace faiss
35.910876
102
0.63244
[ "object", "vector" ]
3896db16594a0e77b206058585e26dce1b652726
3,870
h
C
editor/Session.h
minhvien5059/congnghe_Vietnam
06d6efce856ba369db340a2d834e003fe5a99fa0
[ "BSD-3-Clause" ]
40
2015-09-03T05:50:42.000Z
2022-02-25T10:00:01.000Z
editor/Session.h
minhvien5059/congnghe_Vietnam
06d6efce856ba369db340a2d834e003fe5a99fa0
[ "BSD-3-Clause" ]
1
2017-10-24T14:30:13.000Z
2017-11-07T02:14:10.000Z
editor/Session.h
minhvien5059/congnghe_Vietnam
06d6efce856ba369db340a2d834e003fe5a99fa0
[ "BSD-3-Clause" ]
7
2017-03-13T07:08:19.000Z
2021-06-01T01:06:05.000Z
/* Session.h from QTau http://github.com/qtau-devgroup/editor by digited, BSD license */ #ifndef SESSION_H #define SESSION_H #include "Utils.h" #include "NoteEvents.h" #include "utauloid/ust.h" #include <QMap> class qtauAudioSource; /** Work session that contains one voice setup (notes/lyrics/effects) and voicebank selection+setup to synthesize one song. */ class qtauSession : public qtauEventManager { Q_OBJECT public: explicit qtauSession(QObject *parent = 0); ~qtauSession(); bool loadUST(QString fileName); void setSynthesizedVocal(qtauAudioSource &s); void setBackgroundAudio (qtauAudioSource &s); QStringList ustStrings(bool selectionOnly = false); QByteArray ustBinary(); const ust& ustRef(); QString documentName() { return docName; } QString documentFile() { return filePath; } void setDocName(const QString &name); void setFilePath(const QString &fp); bool isSessionEmpty() const { return noteMap.isEmpty(); } /// returns true if doesn't contain any data bool isSessionModified() const { return isModified; } /// if has changes from last save/load void setModified(bool m); void setSaved(); // if doc was saved at this point EAudioPlayback playbackState() const { return playSt; } void setPlaybackState(EAudioPlayback state); typedef struct SVocalWaveSetup { qtauAudioSource *vocalWave; bool needsSynthesis; float volume; SVocalWaveSetup() : vocalWave(nullptr), needsSynthesis(true), volume(1.0) {} } VocalWaveSetup; typedef struct SMusicWaveSetup { qtauAudioSource *musicWave; qint64 offset; int tempo; float volume; SMusicWaveSetup() : musicWave(nullptr), offset(0), tempo(120), volume(1) {} } MusicWaveSetup; VocalWaveSetup& getVocal() { return vocal; } MusicWaveSetup& getMusic() { return music; } signals: void modifiedStatus(bool); /// if document is modified void undoStatus (bool); /// if can undo last stored action void redoStatus (bool); /// if can apply previously reverted action void dataReloaded(); /// when data is changed completely void playbackStateChanged(EAudioPlayback); void vocalSet(); // when session gets synthesized audio from score void musicSet(); // when user adds bg (off-vocal?) music to play with synthesized vocals // signals to controller void requestSynthesis(); // means synth & play void requestStartPlayback(); void requestPausePlayback(); void requestStopPlayback(); void requestResetPlayback(); void requestRepeatPlayback(); public slots: void onUIEvent(qtauEvent *); // received from UI void startPlayback(); void stopPlayback(); void resetPlayback(); void repeatPlayback(); void vocalWaveWasModified(); void musicWaveWasModified(); protected: bool parseUSTStrings(QStringList ustStrings); QString filePath; QString docName; bool isModified; bool hadSavePoint; // if was saved having a non-empty event stack VocalWaveSetup vocal; MusicWaveSetup music; QMap<qint64, ust_note> noteMap; // need to store copies until changing data structure to something better ust data; // TODO: nite vector inside is obviously unsuitable, needs changing to something else void applyEvent_NoteAdded (const qtauEvent_NoteAddition &event); void applyEvent_NoteMoved (const qtauEvent_NoteMove &event); void applyEvent_NoteResized(const qtauEvent_NoteResize &event); void applyEvent_NoteLyrics (const qtauEvent_NoteText &event); void applyEvent_NoteEffects(const qtauEvent_NoteEffect &event); bool processEvent(qtauEvent *) override; void stackChanged() override; EAudioPlayback playSt; }; #endif // SESSION_H
30.234375
109
0.701034
[ "vector" ]
389c0cf4c3ea379d9c3fee0a19c6d2a399da78ea
187
h
C
DSA/Cpp/test/dsa/lib/algo/sort/pch.h
JackieMa000/problems
c521558830a0bbf67f94109af92d7be4397d0a43
[ "BSD-3-Clause" ]
null
null
null
DSA/Cpp/test/dsa/lib/algo/sort/pch.h
JackieMa000/problems
c521558830a0bbf67f94109af92d7be4397d0a43
[ "BSD-3-Clause" ]
1
2020-10-23T04:06:56.000Z
2020-10-23T04:06:56.000Z
DSA/Cpp/test/dsa/lib/algo/sort/pch.h
JackieMa000/problems
c521558830a0bbf67f94109af92d7be4397d0a43
[ "BSD-3-Clause" ]
null
null
null
#ifndef DSA_TEST_DSA_LIB_ALGO_SORT_PCH_H_ #define DSA_TEST_DSA_LIB_ALGO_SORT_PCH_H_ #include <vector> #include <list> #include <forward_list> #endif //DSA_TEST_DSA_LIB_ALGO_SORT_PCH_H_
20.777778
42
0.850267
[ "vector" ]
389ea85a2bf08c748572ca136bb0f70b086d4853
7,919
c
C
src/lsm/c/sim_lsm/dynamics.c
nstepp/stepp-dissertation-code
ba93cb259135e3be795ed9abfdc4dbe0dc7a3951
[ "MIT" ]
null
null
null
src/lsm/c/sim_lsm/dynamics.c
nstepp/stepp-dissertation-code
ba93cb259135e3be795ed9abfdc4dbe0dc7a3951
[ "MIT" ]
null
null
null
src/lsm/c/sim_lsm/dynamics.c
nstepp/stepp-dissertation-code
ba93cb259135e3be795ed9abfdc4dbe0dc7a3951
[ "MIT" ]
null
null
null
/* $Id: dynamics.c 638 2010-11-22 04:24:21Z stepp $ * * Functions implementing different node dynamics. */ #include <stdlib.h> #include <string.h> #include <math.h> #include "config.h" #include "sparse_graph.h" #include "dynamics.h" dynstate_t *dynstate_init(int nstates, void *state_data) { dynstate_t *dynstate; dynstate = malloc(sizeof(dynstate_t)); if( !dynstate ) { fprintf(stderr, "dynstate_init: Could not allocate state container\n"); exit(1); } dynstate->nstates = nstates; dynstate->states = calloc(nstates, sizeof(double)); dynstate->dstates = calloc(nstates, sizeof(double)); if( !dynstate->states || !dynstate->dstates ) { fprintf(stderr, "dynstate_init: Could not allocate state vectors\n"); exit(1); } memset(dynstate->states, 0, nstates * sizeof(double)); memset(dynstate->dstates, 0, nstates * sizeof(double)); dynstate->rk4_states = rk4_init(nstates); dynstate->state_data = state_data; return dynstate; } void dynstate_free(dynstate_t *dynstate) { if( !dynstate ) { return; } if( dynstate->states ) { free(dynstate->states); dynstate->states = NULL; } if( dynstate->dstates ) { free(dynstate->dstates); dynstate->dstates = NULL; } rk4_free_states(dynstate->rk4_states); dynstate->rk4_states = NULL; free(dynstate); } void sim(config_t *config, sparse_graph_t *graph) { int i; double t, dt, sim_time; double params[5]; FILE *nout; dynstate_t *node_states, *input_states; decaysum_data_t decaysum_data; dt = config->dt; sim_time = config->time; nout = fopen(config->ts_filename, "w"); // Set up the node dynamics context decaysum_data.graph = graph; decaysum_data.input_nodes = config->input_nodes; decaysum_data.input_val = 0; node_states = dynstate_init(graph->num_nodes, &decaysum_data); // Chaotic spring parameters // Taken from Stepp, N. (2009). Exp. Brain Res. // alpha, beta, a, b, c params[0] = 100; params[1] = 0.3; params[2] = 0.1; params[3] = 0.1; //params[4] = 14.0; params[4] = 11.0; input_states = dynstate_init(STATES_CHAOTICSPRING, params); // Initial conditions for the input system // Taken from Stepp, N. (2009). Exp. Brain Res. input_states->states[0] = 1.0; input_states->states[1] = 0.0; input_states->states[2] = 19.0; input_states->states[3] = 3.432; input_states->states[4] = 20.9; // Output intial conditions. fprintf(nout, "%lf\t", 0.0); for( i=0; i<STATES_CHAOTICSPRING; i++ ) { fprintf(nout, "%lf\t", input_states->states[i]); } for( i=0; i<graph->num_nodes; i++ ) { fprintf(nout, "%lf\t", node_states->states[i]); } fprintf(nout, "\n"); for( t = dt; t < sim_time; t += dt ) { sim_step(t, config, graph, node_states, input_states); fprintf(nout, "%lf\t", t); for( i=0; i<STATES_CHAOTICSPRING; i++ ) { fprintf(nout, "%lf\t", input_states->states[i]); } for( i=0; i<graph->num_nodes; i++ ) { fprintf(nout, "%lf\t", node_states->states[i]); } fprintf(nout, "\n"); } dynstate_free(node_states); dynstate_free(input_states); fclose(nout); } void sim_step(double t, config_t *config, sparse_graph_t *graph, dynstate_t *node_states, dynstate_t *input_states) { decaysum_data_t *decaysum_data; // Input signal rk4_deriv(t, config->dt, chaoticspring_deriv, input_states); rk_step(input_states->states, input_states->nstates, config->dt, input_states->dstates, input_states->states); // Poke in the new input state decaysum_data = (decaysum_data_t *)(node_states->state_data); decaysum_data->input_val = input_states->states[0]; // calculate deltas for all nodes rk4_deriv(t, config->dt, decaysum_deriv, node_states); // Apply deltas rk_step(node_states->states, graph->num_nodes, config->dt, node_states->dstates, node_states->states); } // Fourth order Runge-Kutta Method. rk4_states_t *rk4_init(int nstates) { int i; rk4_states_t *rk4_states; double *space; rk4_states = malloc(sizeof(rk4_states_t)); if( !rk4_states->states ) { fprintf(stderr, "rk4_init: cannot allocate RK states\n"); exit(1); } // We are allocating everything at once to try our best to // be cache friendly space = calloc(5 * nstates, sizeof(double)); if( !space ) { fprintf(stderr, "rk4_init: cannot allocate RK state space\n"); exit(1); } memset(space, 0, 5 * nstates * sizeof(double)); rk4_states->states = space; for( i=0; i<4; i++ ) { rk4_states->k_states[i] = space + (i+1) * nstates; } return rk4_states; } void rk4_free_states(rk4_states_t *rk4_states) { if( !rk4_states ) { return; } if( rk4_states->states ) { free(rk4_states->states); rk4_states->states = NULL; } free(rk4_states); } // This computes the Runge-Kutta weighted average slope. void rk4_deriv(double t, double step, rk_deriv_t f, dynstate_t *dynstate) { int i, j, rk_coef[4] = {1, 2, 2, 1}; int nstates; double half_step = step/2; double *states, *dstates, *tmp_states; double **ks; void *data; if( !dynstate ) { fprintf(stderr, "rk4_deriv: null state info\n"); exit(1); } // Pre-fetch some state info tmp_states = dynstate->rk4_states->states; ks = dynstate->rk4_states->k_states; states = dynstate->states; dstates = dynstate->dstates; nstates = dynstate->nstates; data = dynstate->state_data; // Compute intermediate derivatives f(t, states, data, ks[0]); rk_step(states, nstates, half_step, ks[0], tmp_states); f(t + half_step, tmp_states, data, ks[1]); rk_step(states, nstates, half_step, ks[1], tmp_states); f(t + half_step, tmp_states, data, ks[2]); rk_step(states, nstates, step, ks[2], tmp_states); f(t + step, tmp_states, data, ks[3]); // Take the RK4 weighted average for( i=0; i<nstates; i++ ) { dstates[i] = 0; } for( i=0; i<4; i++ ) { for( j=0; j<nstates; j++) { dstates[j] += rk_coef[i] * ks[i][j]; } } for( i=0; i<nstates; i++ ) { dstates[i] /= 6.0; } } // Do the integration step given states and derivatives void rk_step(double *states, int nstates, double step, double *dstates, double *next_states) { int i; for( i=0; i<nstates; i++ ) { next_states[i] = states[i] + step * dstates[i]; } } /* * Derivative Functions * * Each derivative function takes * - time * - n element state vector * - m element parameter vector * and outputs an n element vector of derivatives. * * The signature of these functions must be * void deriv(double t, double *states, double *data, double *dstates) * * It is assumed that each derivative function knows n and m for itself. */ // Decay + Summation void decaysum_deriv(double t, double *states, void *data, double *dstates) { int i, nstates, input_nodes; double input_total, input_val, arc_weight; decaysum_data_t *decaysum_data; sparse_graph_t *graph; arc_t *arc; decaysum_data = (decaysum_data_t *)data; graph = decaysum_data->graph; nstates = graph->num_nodes; input_nodes = decaysum_data->input_nodes; input_val = decaysum_data->input_val; for( i=0; i<nstates; i++ ) { arc = graph->nodes[i].arcs; input_total = 0; while( arc ) { arc_weight = *(arc->state); input_total += arc_weight * states[arc->from_node->id]; arc = arc->next; } if( i < input_nodes ) { input_total += input_val; } dstates[i] = -1 * states[i] + tanh(input_total); } } // Chaotic spring function // Usual linear spring equations, except // with a stiffness given by the Roessler void chaoticspring_deriv(double t, double *states, void *data, double *dstates) { double x1, x2, x3, x4, x5; double a, b, c, alpha, beta; double *params = (double *)data; x1 = states[0]; x2 = states[1]; x3 = states[2]; x4 = states[3]; x5 = states[4]; alpha = params[0]; beta = params[1]; a = params[2]; b = params[3]; c = params[4]; dstates[0] = x2; #if 1 dstates[1] = M_2PI * (x3/alpha + beta); dstates[1] *= dstates[1]; dstates[1] *= -x1; #else dstates[1] = -x1; #endif dstates[2] = -x4 - x5; dstates[3] = x3 + a * x4; dstates[4] = b + x5 * (x3 - c); }
21.936288
115
0.671044
[ "vector" ]
38a31aab924fddd891fca1f72dc370a73a8cc05e
12,770
h
C
Utility/IteratorUtils.h
pocketgems/XLE2
82771e9ab1fc3b12927f1687bbe05d4f7dce8765
[ "MIT" ]
3
2018-05-17T08:39:39.000Z
2020-12-09T13:20:26.000Z
Utility/IteratorUtils.h
pocketgems/XLE2
82771e9ab1fc3b12927f1687bbe05d4f7dce8765
[ "MIT" ]
null
null
null
Utility/IteratorUtils.h
pocketgems/XLE2
82771e9ab1fc3b12927f1687bbe05d4f7dce8765
[ "MIT" ]
1
2021-11-14T08:50:15.000Z
2021-11-14T08:50:15.000Z
// Copyright 2015 XLGAMES Inc. // // Distributed under the MIT License (See // accompanying file "LICENSE" or the website // http://www.opensource.org/licenses/mit-license.php) #pragma once #include "PtrUtils.h" // for AsPointer #include <vector> #include <algorithm> #include <type_traits> // (for is_constructible) // support for missing "std::size" in earlier versions of visual studio STL #if !((STL_ACTIVE == STL_MSVC) && (_MSC_VER > 1800)) namespace std { template<typename ValueType, size_t N> /*constexpr*/ size_t size(ValueType (&c)[N]) { return N; } } #endif namespace Utility { // // This file contains some utilities for common STL operations. // Avoid adding too many utilities to this file, because it's included // in many places (including through Assets.h, which propagates through // a lot) // template <typename First, typename Second> class CompareFirst { public: inline bool operator()(const std::pair<First, Second>& lhs, const std::pair<First, Second>& rhs) const { return lhs.first < rhs.first; } inline bool operator()(const std::pair<First, Second>& lhs, const First& rhs) const { return lhs.first < rhs; } inline bool operator()(const First& lhs, const std::pair<First, Second>& rhs) const { return lhs < rhs.first; } }; template <typename First, typename Second> class CompareSecond { public: inline bool operator()(std::pair<First, Second>& lhs, std::pair<First, Second>& rhs) const { return lhs.second < rhs.second; } inline bool operator()(std::pair<First, Second>& lhs, Second& rhs) const { return lhs.second < rhs; } inline bool operator()(Second& lhs, std::pair<First, Second>& rhs) const { return lhs < rhs.second; } }; template <typename First, typename Second, typename Allocator> typename std::vector<std::pair<First, Second>, Allocator>::iterator LowerBound( std::vector<std::pair<First, Second>, Allocator>&v, First compareToFirst) { return std::lower_bound(v.begin(), v.end(), compareToFirst, CompareFirst<First, Second>()); } template <typename First, typename Second, typename Allocator> typename std::vector<std::pair<First, Second>, Allocator>::const_iterator LowerBound( const std::vector<std::pair<First, Second>, Allocator>&v, First compareToFirst) { return std::lower_bound(v.cbegin(), v.cend(), compareToFirst, CompareFirst<First, Second>()); } template <typename First, typename Second, typename Allocator> static typename std::vector<std::pair<First, Second>, Allocator>::iterator UpperBound( std::vector<std::pair<First, Second>, Allocator>&v, First compareToFirst) { return std::upper_bound(v.begin(), v.end(), compareToFirst, CompareFirst<First, Second>()); } template<typename FirstType, typename SecondType> std::pair<typename std::vector<std::pair<FirstType, SecondType> >::iterator, typename std::vector<std::pair<FirstType, SecondType> >::iterator> EqualRange(std::vector<std::pair<FirstType, SecondType> >& vector, FirstType searchKey) { return std::equal_range(vector.begin(), vector.end(), searchKey, CompareFirst<FirstType, SecondType>()); } template<typename FirstType, typename SecondType> std::pair<typename std::vector<std::pair<FirstType, SecondType> >::const_iterator, typename std::vector<std::pair<FirstType, SecondType> >::const_iterator> EqualRange(const std::vector<std::pair<FirstType, SecondType> >& vector, FirstType searchKey) { return std::equal_range(vector.cbegin(), vector.cend(), searchKey, CompareFirst<FirstType, SecondType>()); } template <typename Vector, typename Pred> typename Vector::iterator FindIf(Vector& v, Pred&& predicate) { return std::find_if(v.begin(), v.end(), std::forward<Pred>(predicate)); } template <typename Vector, typename Pred> typename Vector::const_iterator FindIf(const Vector& v, Pred&& predicate) { return std::find_if(v.cbegin(), v.cend(), std::forward<Pred>(predicate)); } template<typename SearchI, typename CompareI> SearchI FindFirstNotOf( SearchI searchStart, SearchI searchEnd, CompareI compareBegin, CompareI compareEnd) { auto i = searchStart; while (i != searchEnd && std::find(compareBegin, compareEnd, *i) != compareEnd) ++i; return i; } template<typename SearchI, typename CompareI> SearchI FindLastOf( SearchI searchStart, SearchI searchEnd, CompareI compareBegin, CompareI compareEnd) { if (searchStart == searchEnd) return searchEnd; auto i = searchEnd-1; while (i >= searchStart) { if (std::find(compareBegin, compareEnd, *i) != compareEnd) return i; --i; } return searchEnd; } template<typename SearchI, typename CompareI> SearchI FindLastOf( SearchI searchStart, SearchI searchEnd, CompareI compare) { if (searchStart == searchEnd) return searchEnd; auto i = searchEnd-1; while (i >= searchStart) { if (*i == compare) return i; --i; } return searchEnd; } namespace Internal { template<typename Iterator> inline size_t IteratorDifference(Iterator first, Iterator second) { return std::distance(first, second); } template<> inline size_t IteratorDifference(void* first, void* second) { return (size_t)PtrDiff(second, first); } template<> inline size_t IteratorDifference(const void* first, const void* second) { return (size_t)PtrDiff(second, first); } } template<typename Iterator> class IteratorRange : public std::pair<Iterator, Iterator> { public: Iterator begin() const { return this->first; } Iterator end() const { return this->second; } Iterator cbegin() const { return this->first; } Iterator cend() const { return this->second; } bool empty() const { return this->first == this->second; } size_t size() const { return Internal::IteratorDifference(this->first, this->second); } // operator[] is only available on iterator range for types other than void*/const void* template<typename I=Iterator> auto operator[](size_t index) const -> typename std::enable_if<!std::is_same<typename std::remove_const<I>::type, void*>::value, decltype(*std::declval<const I>())>::type { return this->first[index]; } #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wvoid-ptr-dereference" template<typename I=Iterator> auto data() const -> typename std::enable_if<!std::is_same<typename std::remove_const<I>::type, void*>::value, decltype(&(*std::declval<const I>()))>::type { return &(*this->first); } #pragma GCC diagnostic pop template<typename OtherIteratorType> IteratorRange<OtherIteratorType> Cast() const { return IteratorRange<OtherIteratorType>((OtherIteratorType)this->first, (OtherIteratorType)this->second); } IteratorRange() : std::pair<Iterator, Iterator>((Iterator)nullptr, (Iterator)nullptr) {} IteratorRange(Iterator f, Iterator s) : std::pair<Iterator, Iterator>(f, s) {} template< typename OtherIterator, typename std::enable_if< std::is_constructible<std::pair<Iterator, Iterator>, const std::pair<OtherIterator, OtherIterator>&>::value >::type* = nullptr> IteratorRange(const std::pair<OtherIterator, OtherIterator>& copyFrom) : std::pair<Iterator, Iterator>(copyFrom) {} template< typename OtherIterator, typename std::enable_if< std::is_constructible<std::pair<Iterator, Iterator>, const std::pair<OtherIterator, OtherIterator>&>::value >::type* = nullptr> IteratorRange& operator=(const std::pair<OtherIterator, OtherIterator>& copyFrom) { std::pair<Iterator, Iterator>::operator=(copyFrom); return *this; } }; template<typename Container> IteratorRange<const typename Container::value_type*> MakeIteratorRange(const Container& c) { return IteratorRange<const typename Container::value_type*>(AsPointer(c.cbegin()), AsPointer(c.cend())); } template<typename Container> IteratorRange<typename Container::value_type*> MakeIteratorRange(Container& c) { return IteratorRange<typename Container::value_type*>(AsPointer(c.begin()), AsPointer(c.end())); } template<typename Iterator> IteratorRange<Iterator> MakeIteratorRange(Iterator begin, Iterator end) { return IteratorRange<Iterator>(begin, end); } template<typename ArrayElement, int Count> IteratorRange<ArrayElement*> MakeIteratorRange(ArrayElement (&c)[Count]) { return IteratorRange<ArrayElement*>(&c[0], &c[Count]); } template<typename ArrayElement> IteratorRange<const ArrayElement*> MakeIteratorRange(std::initializer_list<ArrayElement> initializers) { return IteratorRange<const ArrayElement*>(initializers.begin(), initializers.end()); } template<typename Type> IteratorRange<void*> AsOpaqueIteratorRange(Type& object) { return MakeIteratorRange(&object, PtrAdd(&object, sizeof(Type))); } template<typename Type> IteratorRange<const void*> AsOpaqueIteratorRange(const Type& object) { return MakeIteratorRange(&object, PtrAdd(&object, sizeof(Type))); } #pragma warning(push) #pragma warning(disable:4789) // buffer '' of size 12 bytes will be overrun; 4 bytes will be written starting at offset 12 #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Warray-bounds" // array index 3 is past the end of the array (which contains 2 elements) /// We can initialize from anything that looks like a collection of unsigned values /// This is a simple way to get casting from XLEMath::UInt2 (etc) types without /// having to include XLEMath headers from here. /// Plus, it will also work with any other types that expose a stl collection type /// interface. template<typename Type, unsigned Count> class VectorPattern { public: Type _values[Count]; VectorPattern(Type x=0, Type y=0, Type z=0, Type w=0) { if (constant_expression<(Count > 0u)>::result()) _values[0] = x; if (constant_expression<(Count > 1u)>::result()) _values[1] = y; if (constant_expression<(Count > 2u)>::result()) _values[2] = z; if (constant_expression<(Count > 3u)>::result()) _values[3] = w; } template<int InitCount> VectorPattern(Type (&values)[InitCount]) { for (unsigned c=0; c<Count; ++c) { if (c < InitCount) _values[c] = values[c]; else _values[c] = (Type)0; } } Type operator[](unsigned index) const { return _values[index]; } Type& operator[](unsigned index) { return _values[index]; } template< typename Source, std::enable_if<std::is_assignable<Type, Source>::value>* = nullptr> VectorPattern(const Source& src) { auto size = std::size(src); unsigned c=0; for (; c<std::min(unsigned(size), Count); ++c) _values[c] = src[c]; for (; c<Count; ++c) _values[c] = 0; } }; #pragma GCC diagnostic pop #pragma warning(pop) template <typename Iterator> Iterator LowerBound2(IteratorRange<Iterator> v, decltype(std::declval<Iterator>()->first) compareToFirst) { return std::lower_bound(v.begin(), v.end(), compareToFirst, CompareFirst<decltype(std::declval<Iterator>()->first), decltype(std::declval<Iterator>()->second)>()); } } using namespace Utility;
43.435374
186
0.614174
[ "object", "vector" ]
38a5a89c8f9e3407fa54aab33fcb82c0f7c8a4ce
1,328
c
C
d/deku/open/old/cave_r7.c
Dbevan/SunderingShadows
6c15ec56cef43c36361899bae6dc08d0ee907304
[ "MIT" ]
13
2019-07-19T05:24:44.000Z
2021-11-18T04:08:19.000Z
d/deku/open/old/cave_r7.c
Dbevan/SunderingShadows
6c15ec56cef43c36361899bae6dc08d0ee907304
[ "MIT" ]
4
2021-03-15T18:56:39.000Z
2021-08-17T17:08:22.000Z
d/deku/open/old/cave_r7.c
Dbevan/SunderingShadows
6c15ec56cef43c36361899bae6dc08d0ee907304
[ "MIT" ]
13
2019-09-12T06:22:38.000Z
2022-01-31T01:15:12.000Z
#include <std.h> inherit "/d/deku/open/cave_r3i.c"; void create() { ::create(); set_long( @KAYLA You are getting deeper into Vexia's lair, the worst greenhag in the realm. The cave is carved through some areas of solid rock, sediment, and tree roots. The walls and ceilings are held together by brick, wooden beams, and mud-cement packing. The floors are uneven and covered with soft- packed dirt. There is another door hanging broken and only partially on its hinges to the west and stairs going east that lead into darkness. KAYLA ); set_exits(([ "down" : "/d/deku/open/cellar", "west" : "/d/deku/open/ogre_den", "south" : "/d/deku/open/kitchen" ] )); set_items(([ "door" : "The door is made of split oaken logs bound together with iron " "strips. It has a huge iron latch without a lock and is now useless." " You suspect the ogres don't care for doors much." ] )); } void init() { ::init(); add_action("west","west"); do_random_encounters(({"/d/deku/monster/ogre1"}),60,2); } int west() { write("%^ORANGE%^The door rattles noisily as you bump it moving past."); tell_room(ETP, "%^ORANGE%^The door rattles noisily as "+TPQCN+" bumps into " "it going westward.", TP); TP->move_player("/d/deku/open/ogre_den"); return 1; }
31.619048
80
0.658886
[ "solid" ]
38b614048cc7d0ad1e86d854cffe6274fcdb6b78
4,243
h
C
bitmap_i_o.h
NicholasWhit3/bitmap_i_o
555c757694cdf78c62654de4482ca64c6fec90bb
[ "MIT" ]
null
null
null
bitmap_i_o.h
NicholasWhit3/bitmap_i_o
555c757694cdf78c62654de4482ca64c6fec90bb
[ "MIT" ]
null
null
null
bitmap_i_o.h
NicholasWhit3/bitmap_i_o
555c757694cdf78c62654de4482ca64c6fec90bb
[ "MIT" ]
null
null
null
#ifndef BITMAP_I_O_H #define BITMAP_I_O_H #include <fstream> #include <iostream> #include <limits> #include <string> #include <vector> #include <cstring> class bitmap_i_o { public: bitmap_i_o(); bitmap_i_o(const std::string& fileName); enum channel_mode { rgb_mode = 0, bgr_mode = 1 }; template<typename T> void read_from_stream(std::ifstream& stream,T& t); template<typename T> void write_to_stream(std::ofstream& stream, const T& t); bool big_endian(); //direct order of bytes static bitmap_i_o* load_bitmap(std::string fileName); void create_bitmap(); unsigned short swap(const unsigned short& s); unsigned int swap (const unsigned int& s); std::size_t file_size(const std::string& fileName) const; char* row(unsigned int row_index) const; void save(const std::string& fileName); void print(); void clear(const unsigned char ch = 0x00); std::string fileName() const; void setFileName(const std::string &fileName); unsigned int width() const; void setWidth(unsigned int width); unsigned int height() const; void setHeight(unsigned int weight); std::vector<char> data() const; void setData(const std::vector<char> &data); unsigned int rowIncrement() const; void setRowIncrement(unsigned int rowIncrement); private: struct rgb_type { unsigned char red; unsigned char green; unsigned char blue; }; struct bitmap_file_header { unsigned short _type; unsigned int _size; unsigned short _reserved1; unsigned short _reserved2; unsigned int _offBits; unsigned int struct_size() const { return sizeof(_type ) + sizeof(_size) + sizeof(_reserved1) + sizeof(_reserved2) + sizeof(_offBits ) ; } void clear() { std::memset(this, 0x00, sizeof(bitmap_file_header)); } }; struct bitmap_information_header { unsigned int _size; unsigned int _width; unsigned int _height; unsigned short _planes; //number of Plane (=1) 2D/3D unsigned short _bitCount; unsigned int _compression; // 0 = BI_RGB no compression, 1 = BI_RLE8 8bit RLE encoding, 2 = BI_RLE4 4bit RLE encoding unsigned int _sizeImage; // = 0 if compression = 0 unsigned int _xPixelPerMeter; //horizontal unsigned int _yPixelPerMeter; //vertical unsigned int _clrUsed; unsigned int _clrImportant; unsigned int struct_size() const { return sizeof(_size ) + sizeof(_width ) + sizeof(_height ) + sizeof(_planes ) + sizeof(_bitCount ) + sizeof(_compression ) + sizeof(_sizeImage ) + sizeof(_xPixelPerMeter) + sizeof(_yPixelPerMeter) + sizeof(_clrUsed ) + sizeof(_clrImportant ) ; } void clear() { std::memset(this, 0x00, sizeof(bitmap_information_header)); } }; void read_bfh(std::ifstream& stream, bitmap_file_header& bfh); void write_bfh(std::ofstream& stream, bitmap_file_header& bfh); void read_bih(std::ifstream& stream, bitmap_information_header& bih); void write_bih(std::ofstream& stream, bitmap_information_header& bih); std::vector <char> _data; std::string _fileName; channel_mode _channel_mode; unsigned int _width; unsigned int _height; unsigned char _signature[2]; unsigned int _dataOffSet; //Raster Data unsigned int _bytesPerPixel; unsigned int _rowIncrement; //lines }; #endif // BITMAP_I_O_H
30.970803
138
0.553618
[ "vector", "3d" ]
38b72edd1759828bc859e66a425cb3926c698d69
3,806
h
C
usr/include/Poco/Net/RemoteSyslogListener.h
Roboy/roboy_controlled_node_fpga
dbba4eff19ed04469a6196ba368cea231cad539d
[ "BSD-3-Clause" ]
12
2020-02-10T12:55:41.000Z
2021-07-08T14:28:51.000Z
libs/poco/include/Poco/Net/RemoteSyslogListener.h
yingshixiaohu/SmileFile
96641a104e4c9d5cac887aeef617bdc1f51557b3
[ "MIT" ]
1
2018-12-28T21:11:50.000Z
2018-12-28T21:11:50.000Z
libs/poco/include/Poco/Net/RemoteSyslogListener.h
yingshixiaohu/SmileFile
96641a104e4c9d5cac887aeef617bdc1f51557b3
[ "MIT" ]
7
2020-02-09T12:20:21.000Z
2021-07-25T20:14:08.000Z
// // RemoteSyslogListener.h // // $Id: //poco/1.3/Net/include/Poco/Net/RemoteSyslogListener.h#1 $ // // Library: Net // Package: Logging // Module: RemoteSyslogListener // // Definition of the RemoteSyslogListener class. // // Copyright (c) 2007, Applied Informatics Software Engineering GmbH. // and Contributors. // // Permission is hereby granted, free of charge, to any person or organization // obtaining a copy of the software and accompanying documentation covered by // this license (the "Software") to use, reproduce, display, distribute, // execute, and transmit the Software, and to prepare derivative works of the // Software, and to permit third-parties to whom the Software is furnished to // do so, all subject to the following: // // The copyright notices in the Software and this entire statement, including // the above license grant, this restriction and the following disclaimer, // must be included in all copies of the Software, in whole or in part, and // all derivative works of the Software, unless such copies or derivative // works are solely in the form of machine-executable object code generated by // a source language processor. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT // SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. // #ifndef Net_RemoteSyslogListener_INCLUDED #define Net_RemoteSyslogListener_INCLUDED #include "Poco/Net/Net.h" #include "Poco/Thread.h" #include "Poco/SplitterChannel.h" #include "Poco/NotificationQueue.h" namespace Poco { namespace Net { class RemoteUDPListener; class SyslogParser; class Net_API RemoteSyslogListener: public Poco::SplitterChannel /// RemoteSyslogListener implents listening for syslog messages /// sent over UDP, according to the syslog Working Group Internet Draft: /// "The syslog Protocol" <http://www.ietf.org/internet-drafts/draft-ietf-syslog-protocol-17.txt>, /// and "Transmission of syslog messages over UDP" <http://www.ietf.org/internet-drafts/draft-ietf-syslog-transport-udp-07.txt>. /// /// In addition, RemoteSyslogListener also supports the "old" BSD syslog /// protocol, as described in RFC 3164. /// /// The RemoteSyslogListener is a subclass of Poco::SplitterChannel. /// Every received log message is sent to the channels registered /// with addChannel() or the "channel" property. { public: RemoteSyslogListener(); /// Creates the RemoteSyslogListener. RemoteSyslogListener(Poco::UInt16 port); /// Creates the RemoteSyslogListener. void setProperty(const std::string& name, const std::string& value); /// Sets the property with the given value. /// /// The following properties are supported: /// * port: The UDP port number where to listen for UDP. std::string getProperty(const std::string& name) const; /// Returns the value of the property with the given name. void open(); /// Starts the listener. void close(); /// Stops the listener. static void registerChannel(); /// Registers the channel with the global LoggingFactory. static const std::string PROP_PORT; protected: ~RemoteSyslogListener(); /// Destroys the RemoteSyslogListener. private: RemoteUDPListener* _pListener; SyslogParser* _pParser; Poco::Thread _listener; Poco::Thread _parser; Poco::NotificationQueue _queue; Poco::UInt16 _port; }; } } // namespace Poco::Net #endif // Net_RemoteSyslogListener_INCLUDED
33.095652
129
0.741986
[ "object" ]
38bc2721eedd6ec6602ff24ae32efe8bbb725b2e
2,105
h
C
third_party/cpuinfo/src/x86/api.h
obastemur/SVT-AV1
ec7ac87f7fbfb2bbe0637ce0639f52ab41f10bcc
[ "BSD-2-Clause" ]
399
2020-09-07T22:08:38.000Z
2022-03-29T21:49:52.000Z
third_party/cpuinfo/src/x86/api.h
obastemur/SVT-AV1
ec7ac87f7fbfb2bbe0637ce0639f52ab41f10bcc
[ "BSD-2-Clause" ]
210
2020-09-07T19:06:23.000Z
2022-03-26T00:35:26.000Z
third_party/cpuinfo/src/x86/api.h
EwoutH/SVT-AV1
dd6620592b533c7242302e6149b32b0ab9116643
[ "BSD-2-Clause" ]
71
2020-09-09T01:15:29.000Z
2022-03-28T22:09:56.000Z
#pragma once #include <stdbool.h> #include <stdint.h> #include <cpuinfo.h> #include <cpuinfo/common.h> struct cpuid_regs { uint32_t eax; uint32_t ebx; uint32_t ecx; uint32_t edx; }; struct cpuinfo_x86_cache { uint32_t size; uint32_t associativity; uint32_t sets; uint32_t partitions; uint32_t line_size; uint32_t flags; uint32_t apic_bits; }; struct cpuinfo_x86_caches { struct cpuinfo_trace_cache trace; struct cpuinfo_x86_cache l1i; struct cpuinfo_x86_cache l1d; struct cpuinfo_x86_cache l2; struct cpuinfo_x86_cache l3; struct cpuinfo_x86_cache l4; uint32_t prefetch_size; }; struct cpuinfo_x86_model_info { uint32_t model; uint32_t family; uint32_t base_model; uint32_t base_family; uint32_t stepping; uint32_t extended_model; uint32_t extended_family; uint32_t processor_type; }; struct cpuinfo_x86_topology { uint32_t apic_id; uint32_t thread_bits_offset; uint32_t thread_bits_length; uint32_t core_bits_offset; uint32_t core_bits_length; }; struct cpuinfo_x86_processor { uint32_t cpuid; enum cpuinfo_vendor vendor; enum cpuinfo_uarch uarch; #ifdef __linux__ int linux_id; #endif struct cpuinfo_x86_caches cache; struct { struct cpuinfo_tlb itlb_4KB; struct cpuinfo_tlb itlb_2MB; struct cpuinfo_tlb itlb_4MB; struct cpuinfo_tlb dtlb0_4KB; struct cpuinfo_tlb dtlb0_2MB; struct cpuinfo_tlb dtlb0_4MB; struct cpuinfo_tlb dtlb_4KB; struct cpuinfo_tlb dtlb_2MB; struct cpuinfo_tlb dtlb_4MB; struct cpuinfo_tlb dtlb_1GB; struct cpuinfo_tlb stlb2_4KB; struct cpuinfo_tlb stlb2_2MB; struct cpuinfo_tlb stlb2_1GB; } tlb; struct cpuinfo_x86_topology topology; char brand_string[CPUINFO_PACKAGE_NAME_MAX]; }; CPUINFO_INTERNAL void cpuinfo_x86_init_processor(struct cpuinfo_x86_processor* processor); CPUINFO_INTERNAL enum cpuinfo_vendor cpuinfo_x86_decode_vendor(uint32_t ebx, uint32_t ecx, uint32_t edx); CPUINFO_INTERNAL struct cpuinfo_x86_isa cpuinfo_x86_detect_isa( const struct cpuid_regs basic_info, const struct cpuid_regs extended_info, uint32_t max_base_index, uint32_t max_extended_index, enum cpuinfo_vendor vendor);
23.131868
105
0.814727
[ "model" ]
38d6301935a07b1ae387fce7f094d7c6aa98acb1
722
h
C
ToyBrowser/src/nodes/node.h
gosom/toy-browser-engine
7e6a4a0595dfc60d58e6e5dda3b3df5b70d7b470
[ "MIT" ]
1
2015-11-20T18:37:51.000Z
2015-11-20T18:37:51.000Z
ToyBrowser/src/nodes/node.h
gosom/toy-browser-engine
7e6a4a0595dfc60d58e6e5dda3b3df5b70d7b470
[ "MIT" ]
null
null
null
ToyBrowser/src/nodes/node.h
gosom/toy-browser-engine
7e6a4a0595dfc60d58e6e5dda3b3df5b70d7b470
[ "MIT" ]
null
null
null
#ifndef NODE_H #define NODE_H #include <vector> #include <memory> enum NodeType{ Element = 1, Text = 2 }; class Node; typedef std::vector<std::unique_ptr<Node>> NodeList; class Node { public: Node(); Node(NodeType _type); virtual ~Node(); NodeType getNodeType() const; Node const* getParentNode() const; bool hasChildNodes() const; const NodeList& getChildNodes(); virtual std::string getText() const = 0; void setParent(Node* node); void appendChild(std::unique_ptr<Node> node); void setTextNode(std::unique_ptr<Node> node); protected: NodeType _nodeType; Node* parentNode; NodeList childNodes; std::unique_ptr<Node> textNode; }; #endif // NODE_H
19
52
0.674515
[ "vector" ]
38d8580af35a6eadf4dca75cc01f53db8445180e
3,447
c
C
liblocust/src/ds/deque/ds.deque.c
GregoriusSwifter/locust
2337930c9338bd9060bd29e7de1dabaff8c87097
[ "MIT-feh", "MIT" ]
null
null
null
liblocust/src/ds/deque/ds.deque.c
GregoriusSwifter/locust
2337930c9338bd9060bd29e7de1dabaff8c87097
[ "MIT-feh", "MIT" ]
null
null
null
liblocust/src/ds/deque/ds.deque.c
GregoriusSwifter/locust
2337930c9338bd9060bd29e7de1dabaff8c87097
[ "MIT-feh", "MIT" ]
null
null
null
#ifndef DEQUE_H #include <locust/ds.deque.h> #endif META_FIELDS_DEF(deque) = { 4, { META_FIELD_DEF(deque, len, uint64), META_FIELD_DEF(deque, head, ptr), META_FIELD_DEF(deque, tail, ptr), META_FIELD_DEF(deque, items_desc, ptr), } }; META_DEF(deque); #ifndef MEM_H #include <locust/rt.mem.h> #endif #ifndef ATOMIC_H #include <locust/sched.atomic.h> #endif #ifndef DEBUG_H #include <locust/rt.debug.h> #endif nonnullfunc void deque_init(deque *self, const meta *type) { #if !nonnullfunc_on assert(self != nil); assert(type != nil); #endif self->items_desc = type; self->len = 0; // Set up a token object to always have at least 1 item in deque. // Allows us to not worry about null pointer head and tail ever. // Good for parallelism. self->head = self->tail = mem_get(sizeof(deque_node)+type->size); assert(self->head != nil); mem_set(self->head, sizeof(deque_node)+type->size, 0); } nonnullfunc void deque_deinit(deque *self) { #if !nonnullfunc_on assert(self != nil); #endif deque_node* curr = self->head; if (curr == nil) { return; } deque_node* next = curr->next; while (curr != nil) { mem_free(curr); curr = next; next = curr->next; } } nonnullfunc void deque_back_push(deque *self, const meta *type, ptr item) { #if !nonnullfunc_on assert(self != nil); assert(type != nil); assert(item != nil); #endif TYPE_CHECK(self->items_desc, type); deque_node *n = mem_get(sizeof(deque_node)+type->size); assert(n != nil); mem_copy(item, &n->content, type->size); n->next = nil; self->tail->next = n; self->tail = n; ++self->len; } nonnullfunc void deque_front_push(deque *self, const meta *type, ptr item) { #if !nonnullfunc_on assert(self != nil); assert(type != nil); assert(item != nil); #endif TYPE_CHECK(self->items_desc, type); deque_node *n = mem_get(sizeof(deque_node)+type->size); assert(n != nil); mem_copy(item, &n->content, type->size); n->next = nil; // the ->next Keeps the token object at the real head of the deque deque_node *head = atomic_swap(self->head->next, n); if (head) { n->next = head; } ++self->len; } nonnullfunc bool deque_front_pop(deque *self, const meta *type, ptr item) { #if !nonnullfunc_on assert(self != nil); assert(type != nil); assert(item != nil); #endif TYPE_CHECK(self->items_desc, type); deque_node* next = self->head->next; if (next) { self->head->next = next->next; if ((uintptr_t)self->tail == (uintptr_t)next) { self->tail = self->head; } mem_copy(&next->content, item, type->size); --self->len; mem_free(next); return true; } return false; } nonnullfunc bool deque_back_pop(deque *self, const meta *type, ptr item) { #if !nonnullfunc_on assert(self != nil); assert(type != nil); assert(item != nil); #endif TYPE_CHECK(self->items_desc, type); deque_node* tail = self->tail; deque_node* next = tail->next; if (next) { self->tail = next; mem_copy(&next->content, item, type->size); --self->len; mem_free(tail); return true; } return false; }
22.98
71
0.586307
[ "object" ]
38df27a9cdcfa8d1d5305b67f390feedca3ea712
1,404
h
C
ftsoftds_vc6/include/d_linesh.h
guarana-x/fwg
5a56dcb4caee5dca6744fca8e21b987b07106513
[ "MIT" ]
null
null
null
ftsoftds_vc6/include/d_linesh.h
guarana-x/fwg
5a56dcb4caee5dca6744fca8e21b987b07106513
[ "MIT" ]
null
null
null
ftsoftds_vc6/include/d_linesh.h
guarana-x/fwg
5a56dcb4caee5dca6744fca8e21b987b07106513
[ "MIT" ]
null
null
null
#ifndef LINESHAPE_CLASS #define LINESHAPE_CLASS #include "d_shape.h" // declaration of lineShape class with base class shape class lineShape: public shape { public: lineShape(double x = 0.0, double y = 0.0, double x2 = 0.0, double y2 = 0.0, shapeColor c = darkgray); // constructor. has arguments for base point, // the second point on the line and the color // line data access member functions double getEndX() const; double getEndY() const; void setEndPoint(double x, double y); // retrieve or set length of the second point virtual void draw(); // draw the line private: double endX, endY; // second point on the line }; lineShape::lineShape(double x, double y, double x2, double y2, shapeColor c): shape(x,y,c), endX(x2), endY(y2) {} double lineShape::getEndX() const { return endX; } double lineShape::getEndY() const { return endY; } // change the end point. must recompute length void lineShape::setEndPoint(double x, double y) { endX = x; endY = y; } void lineShape::draw() { EZDCOLORVAL old_color; old_color = ezdSetColor(color.convertToEzdColor()); shape_handle = ezdDrawLine(baseX, baseY, endX, endY); ezdSetColor(old_color); } #endif // LINESHAPE_CLASS
22.645161
63
0.613248
[ "shape" ]
38e1ec600e835379877d007447f7bd82aec7e6dd
362
h
C
src/file_utils/ignorefile.h
fredsson/cmakegen
ff06db45236220f44fb11ad8363a52d7fbbb82b9
[ "MIT" ]
1
2019-11-16T09:57:41.000Z
2019-11-16T09:57:41.000Z
src/file_utils/ignorefile.h
fredsson/cmakegen
ff06db45236220f44fb11ad8363a52d7fbbb82b9
[ "MIT" ]
17
2019-02-09T12:45:13.000Z
2021-11-14T15:13:21.000Z
src/file_utils/ignorefile.h
fredsson/cmakegen
ff06db45236220f44fb11ad8363a52d7fbbb82b9
[ "MIT" ]
null
null
null
#ifndef FILEUTILS_IGNOREFILE_H #define FILEUTILS_IGNOREFILE_H #include <string> #include <vector> namespace file_utils { class IgnoreFile { public: static IgnoreFile load(const std::string& fileName); IgnoreFile(std::vector<std::string> patterns); bool contains(const std::string& path) const; private: std::vector<std::string> patterns_; }; } #endif
19.052632
54
0.756906
[ "vector" ]
1663d5b4c0074cc91e8a880075218d917e3b4f35
5,388
h
C
Source/Engine/Core/RHI/D3D12/D3D12RaytracingShaderTable.h
KaiH0717/Kaguya
6bdcac77984e3d359ea2fabe926dd44a467dde68
[ "MIT" ]
176
2020-10-31T21:28:27.000Z
2022-01-22T12:15:38.000Z
Source/Engine/Core/RHI/D3D12/D3D12RaytracingShaderTable.h
KaiH0717/Kaguya
6bdcac77984e3d359ea2fabe926dd44a467dde68
[ "MIT" ]
null
null
null
Source/Engine/Core/RHI/D3D12/D3D12RaytracingShaderTable.h
KaiH0717/Kaguya
6bdcac77984e3d359ea2fabe926dd44a467dde68
[ "MIT" ]
9
2020-12-25T01:12:48.000Z
2022-01-13T16:28:43.000Z
#pragma once #include <vector> #include <Core/CoreDefines.h> #include "D3D12LinkedDevice.h" // ========== Miss shader table indexing ========== // Simple pointer arithmetic // MissShaderRecordAddress = D3D12_DISPATCH_RAYS_DESC.MissShaderTable.StartAddress + // D3D12_DISPATCH_RAYS_DESC.MissShaderTable.StrideInBytes * MissShaderIndex // // // ========== Hit group table indexing ========== // HitGroupRecordAddress = D3D12_DISPATCH_RAYS_DESC.HitGroupTable.StartAddress + // D3D12_DISPATCH_RAYS_DESC.HitGroupTable.StrideInBytes * HitGroupEntryIndex // // where HitGroupEntryIndex = // (RayContributionToHitGroupIndex + (MultiplierForGeometryContributionToHitGroupIndex * // GeometryContributionToHitGroupIndex) + D3D12_RAYTRACING_INSTANCE_DESC.InstanceContributionToHitGroupIndex) // // GeometryContributionToHitGroupIndex is a system generated index of geometry in BLAS (0,1,2,3..) // // This blog post is very useful for calculating sbt in various graphics APIs // https://www.willusher.io/graphics/2019/11/20/the-sbt-three-ways // RaytracingShaderRecord = {{Shader Identifier}, {RootArguments}} template<typename T> struct D3D12RaytracingShaderRecord { static_assert(std::is_trivially_copyable_v<T>, "typename T must be trivially copyable"); D3D12RaytracingShaderRecord() noexcept = default; D3D12RaytracingShaderRecord(const ShaderIdentifier& ShaderIdentifier, const T& RootArguments) noexcept : ShaderIdentifier(ShaderIdentifier) , RootArguments(RootArguments) { } ShaderIdentifier ShaderIdentifier; T RootArguments; }; template<> struct D3D12RaytracingShaderRecord<void> { D3D12RaytracingShaderRecord() noexcept = default; D3D12RaytracingShaderRecord(const ShaderIdentifier& ShaderIdentifier) noexcept : ShaderIdentifier(ShaderIdentifier) { } ShaderIdentifier ShaderIdentifier; }; class IRaytracingShaderTable { public: virtual ~IRaytracingShaderTable() = default; UINT GetNumShaderRecords() const { return NumShaderRecords; } virtual UINT64 GetTotalSizeInBytes() const = 0; virtual UINT64 GetSizeInBytes() const = 0; virtual UINT64 GetStrideInBytes() const = 0; virtual void Write(BYTE* Dst) const = 0; protected: UINT NumShaderRecords = 0; }; template<typename T> class D3D12RaytracingShaderTable : public IRaytracingShaderTable { public: using Record = D3D12RaytracingShaderRecord<T>; static constexpr UINT64 StrideInBytes = AlignUp<UINT64>(sizeof(Record), D3D12_RAYTRACING_SHADER_RECORD_BYTE_ALIGNMENT); D3D12RaytracingShaderTable(size_t NumShaderRecords) : ShaderRecords(NumShaderRecords) { } // Accounts for all shader records UINT64 GetTotalSizeInBytes() const override { UINT64 SizeInBytes = static_cast<UINT64>(ShaderRecords.size()) * GetStrideInBytes(); SizeInBytes = AlignUp<UINT64>(SizeInBytes, D3D12_RAYTRACING_SHADER_TABLE_BYTE_ALIGNMENT); return SizeInBytes; } // Accounts for filled shader records UINT64 GetSizeInBytes() const override { UINT64 SizeInBytes = static_cast<UINT64>(NumShaderRecords) * GetStrideInBytes(); SizeInBytes = AlignUp<UINT64>(SizeInBytes, D3D12_RAYTRACING_SHADER_TABLE_BYTE_ALIGNMENT); return SizeInBytes; } UINT64 GetStrideInBytes() const override { return StrideInBytes; } void Write(BYTE* Dst) const override { for (const auto& Record : ShaderRecords) { // Copy record data memcpy(Dst, &Record, sizeof(Record)); Dst += StrideInBytes; } } void Reset() { NumShaderRecords = 0; } void AddShaderRecord(const Record& Record) { ShaderRecords[NumShaderRecords++] = Record; } private: std::vector<Record> ShaderRecords; }; // Collection of RaytracingShaderTables class D3D12RaytracingShaderBindingTable { public: template<typename T> D3D12RaytracingShaderTable<T>* AddRayGenerationShaderTable(UINT NumRayGenerationShaders) { assert(RayGenerationShaderTable == nullptr); auto Table = new D3D12RaytracingShaderTable<T>(NumRayGenerationShaders); RayGenerationShaderTable = std::unique_ptr<IRaytracingShaderTable>(Table); return Table; } template<typename T> D3D12RaytracingShaderTable<T>* AddMissShaderTable(UINT NumMissShaders) { assert(MissShaderTable == nullptr); auto Table = new D3D12RaytracingShaderTable<T>(NumMissShaders); MissShaderTable = std::unique_ptr<IRaytracingShaderTable>(Table); return Table; } template<typename T> D3D12RaytracingShaderTable<T>* AddHitGroupShaderTable(UINT NumHitGroups) { assert(HitGroupShaderTable == nullptr); auto Table = new D3D12RaytracingShaderTable<T>(NumHitGroups); HitGroupShaderTable = std::unique_ptr<IRaytracingShaderTable>(Table); return Table; } // Call this after shader tables are added void Generate(D3D12LinkedDevice* Device); // Call this after shader records for the tables have been filled out to upload the records to GPU table void WriteToGpu(D3D12CommandContext& Context) const; [[nodiscard]] D3D12_DISPATCH_RAYS_DESC GetDesc(UINT RayGenerationShaderIndex, UINT BaseMissShaderIndex) const; private: std::unique_ptr<IRaytracingShaderTable> RayGenerationShaderTable; std::unique_ptr<IRaytracingShaderTable> MissShaderTable; std::unique_ptr<IRaytracingShaderTable> HitGroupShaderTable; UINT64 RayGenerationShaderTableOffset = 0; UINT64 MissShaderTableOffset = 0; UINT64 HitGroupShaderTableOffset = 0; UINT64 SizeInBytes = 0; D3D12Buffer SBTBuffer, SBTUploadBuffer; std::unique_ptr<BYTE[]> CpuData; };
30.613636
111
0.785264
[ "geometry", "vector" ]
16665a896813db551c431fe7bef6999648289a8a
306,483
h
C
mt/drivers/mt_wifi/src/mt_wifi/embedded/include/rtmp.h
guyezi/app
ee8ed6239793fd1a042c14f1e4b1dfac4d03943c
[ "MIT" ]
null
null
null
mt/drivers/mt_wifi/src/mt_wifi/embedded/include/rtmp.h
guyezi/app
ee8ed6239793fd1a042c14f1e4b1dfac4d03943c
[ "MIT" ]
null
null
null
mt/drivers/mt_wifi/src/mt_wifi/embedded/include/rtmp.h
guyezi/app
ee8ed6239793fd1a042c14f1e4b1dfac4d03943c
[ "MIT" ]
null
null
null
/* *************************************************************************** * Ralink Tech Inc. * 4F, No. 2 Technology 5th Rd. * Science-based Industrial Park * Hsin-chu, Taiwan, R.O.C. * * (c) Copyright 2002-2004, Ralink Technology, Inc. * * All rights reserved. Ralink's source code is an unpublished work and the * use of a copyright notice does not imply otherwise. This source code * contains confidential trade secret material of Ralink Tech. Any attemp * or participation in deciphering, decoding, reverse engineering or in any * way altering the source code is stricitly prohibited, unless the prior * written consent of Ralink Technology, Inc. is obtained. *************************************************************************** Module Name: rtmp.h Abstract: Miniport generic portion header file Revision History: Who When What -------- ---------- ---------------------------------------------- */ #ifndef __RTMP_H__ #define __RTMP_H__ #include "common/link_list.h" #include "common/module.h" #include "spectrum_def.h" #include "rtmp_dot11.h" #include "security/sec_cmm.h" #ifdef DOT11_SAE_SUPPORT #include "security/sae_cmm.h" #include "security/crypt_biginteger.h" #endif /* DOT11_SAE_SUPPORT */ #if defined(INTERNAL_CAPTURE_SUPPORT) || defined(WIFI_SPECTRUM_SUPPORT) #include "icap.h" #endif /* defined(INTERNAL_CAPTURE_SUPPORT) || defined(WIFI_SPECTRUM_SUPPORT) */ #ifdef CONFIG_AP_SUPPORT #include "ap_autoChSel_cmm.h" #endif /* CONFIG_AP_SUPPORT */ #include "wsc.h" #ifdef MAT_SUPPORT #include "mat.h" #endif /* MAT_SUPPORT */ #include "rtmp_chip.h" #ifdef DOT11R_FT_SUPPORT #include "ft_cmm.h" #endif /* DOT11R_FT_SUPPORT */ #ifdef DOT11K_RRM_SUPPORT #include "rrm_cmm.h" #endif /* DOT11K_RRM_SUPPORT */ #ifdef CLIENT_WDS #include "client_wds_cmm.h" #endif /* CLIENT_WDS */ #ifdef FTM_SUPPORT #include "ftm_cmm.h" #endif /* FTM_SUPPORT */ #ifdef RT_CFG80211_SUPPORT #include "cfg80211_cmm.h" #endif /* RT_CFG80211_SUPPORT */ #include "rate_ctrl/ra_ctrl.h" #ifdef MT_MAC #ifdef TXBF_SUPPORT #include "txbf/mt_txbf.h" #include "txbf/mt_txbf_cal.h" #endif #endif #ifdef ROUTING_TAB_SUPPORT #include "routing_tab.h" #endif /* ROUTING_TAB_SUPPORT */ #include "tr.h" /* vendor specific ie */ #include "vendor.h" struct _RTMP_RA_LEGACY_TB; typedef struct _RTMP_ADAPTER RTMP_ADAPTER; typedef struct _RTMP_ADAPTER *PRTMP_ADAPTER; typedef struct wifi_dev RTMP_WDEV; typedef struct wifi_dev *PRTMP_WDEV; typedef struct _STA_ADMIN_CONFIG STA_ADMIN_CONFIG; typedef struct _STA_ADMIN_CONFIG *PSTA_ADMIN_CONFIG; /* typedef struct _RTMP_CHIP_OP RTMP_CHIP_OP; */ /* typedef struct _RTMP_CHIP_CAP RTMP_CHIP_CAP; */ #ifdef BB_SOC #include "os/bb_soc.h" #endif #include "mcu/mcu.h" #ifdef CONFIG_ANDES_SUPPORT #include "mcu/andes_core.h" #endif #include "radar.h" #ifdef CARRIER_DETECTION_SUPPORT #include "cs.h" #endif /* CARRIER_DETECTION_SUPPORT */ #ifdef MT_DFS_SUPPORT #include "mt_rdm.h" /* Jelly20150322 */ #endif #ifdef LED_CONTROL_SUPPORT #include "rt_led.h" #endif /* LED_CONTROL_SUPPORT */ #ifdef CONFIG_ATE #include "ate.h" #endif #ifdef CONFIG_DOT11U_INTERWORKING #include "dot11u_interworking.h" #include "gas.h" #endif #ifdef CONFIG_DOT11V_WNM #include "dot11v_wnm.h" #include "wnm.h" #endif #ifdef CONFIG_HOTSPOT #include "hotspot.h" #endif #ifdef MBO_SUPPORT #include "mbo.h" #endif #ifdef COEX_SUPPORT #include "mcu/btcoex.h" #endif /* COEX_SUPPORT */ #include "hw_ctrl/cmm_asic.h" #include "hw_ctrl/cmm_chip.h" #include "rtmp_dmacb.h" #include "common/wifi_sys_info.h" #include "wifi_sys_notify.h" #ifdef BACKGROUND_SCAN_SUPPORT #include "bgnd_scan.h" #endif /* BACKGROUND_SCAN_SUPPORT */ #ifdef SMART_CARRIER_SENSE_SUPPORT #include "scs.h" #endif /* SMART_CARRIER_SENSE_SUPPORT */ #include "cmm_rvr_dbg.h" #ifdef REDUCE_TCP_ACK_SUPPORT #include "cmm_tcprack.h" #endif #include "wlan_config/config_export.h" #include "mgmt/be_export.h" #include "fsm/fsm_sync.h" #ifdef RED_SUPPORT #include "ra_ac_q_mgmt.h" #endif #ifdef FQ_SCH_SUPPORT #include "fq_qm.h" #endif #include "protocol/protection.h" /* TODO: shiang-6590, remove it after ATE fully re-organized! copy from rtmp_bbp.h */ /* Debug log color */ #define KNRM "\x1B[0m" #define KRED "\x1B[31m" #define KGRN "\x1B[32m" #define KYEL "\x1B[33m" #define KBLU "\x1B[34m" #define KMAG "\x1B[35m" #define KCYN "\x1B[36m" #define KWHT "\x1B[37m" #ifndef MAX_BBP_ID #ifdef RTMP_RBUS_SUPPORT /* TODO: for this definition, need to modify it!! */ /*#define MAX_BBP_ID 255 */ #define MAX_BBP_ID 200 #else #define MAX_BBP_ID 136 #endif /* RTMP_RBUS_SUPPORT */ #endif /* TODO: ---End */ #define NUM_OF_BITS_IN_BYTE 8 #define NUM_BITS_IN_ULONG 64 #define FW_OWN_POLLING_COUNTER 300 #define NON_DEFINED_BSSINFO_IDX 0xff #ifdef RTMP_UDMA_SUPPORT #define UDMA_PORT0 0 #define UDMA_PORT1 1 #endif /*RTMP_UDMA_SUPPORT*/ /*+++Used for merge MiniportMMRequest() and MiniportDataMMRequest() into one function */ #define MGMT_USE_QUEUE_FLAG 0x80 #define MGMT_USE_PS_FLAG 0x40 /*---Used for merge MiniportMMRequest() and MiniportDataMMRequest() into one function */ /* The number of channels for per-channel Tx power offset */ #define MAXSEQ (0xFFF) #define MAX_MCS_SET 16 /* From MCS 0 ~ MCS 15 */ #ifdef AIR_MONITOR #define MAX_NUM_OF_MONITOR_STA 16 #define MAX_NUM_OF_MONITOR_GROUP 8 /* (MAX_NUM_OF_MONITOR_STA/2) */ #define MONITOR_MUAR_BASE_INDEX 32 #define MAX_NUM_PER_GROUP 2 #endif /* AIR_MONITOR */ #define MAX_TXPOWER_ARRAY_SIZE 5 #define MAX_EEPROM_BUFFER_SIZE 1024 #define PS_RETRIEVE_TOKEN 0x76 #ifdef DSCP_PRI_SUPPORT #define DSCP_PRI_2G_MAP 0 #define DSCP_PRI_5G_MAP 1 #endif #define MAX_RXVB_BUFFER_IN_NORMAL 1024 extern unsigned char CISCO_OUI[]; extern UCHAR BaSizeArray[4]; extern UCHAR BROADCAST_ADDR[MAC_ADDR_LEN]; extern UCHAR ZERO_MAC_ADDR[MAC_ADDR_LEN]; extern char *CipherName[]; extern UCHAR SNAP_802_1H[6]; extern UCHAR SNAP_BRIDGE_TUNNEL[6]; extern UCHAR EAPOL[2]; extern UCHAR IPX[2]; extern UCHAR TPID[]; extern UCHAR APPLE_TALK[2]; extern UCHAR OfdmRateToRxwiMCS[]; extern UCHAR WMM_UP2AC_MAP[8]; extern unsigned char RateIdToMbps[]; extern USHORT RateIdTo500Kbps[]; extern UCHAR CipherSuiteWpaNoneTkip[]; extern UCHAR CipherSuiteWpaNoneTkipLen; extern UCHAR CipherSuiteWpaNoneAes[]; extern UCHAR CipherSuiteWpaNoneAesLen; extern UCHAR SsidIe; extern UCHAR SupRateIe; extern UCHAR ExtRateIe; #ifdef DOT11_N_SUPPORT extern UCHAR HtCapIe; extern UCHAR AddHtInfoIe; extern UCHAR NewExtChanIe; extern UCHAR BssCoexistIe; extern UCHAR ExtHtCapIe; #endif /* DOT11_N_SUPPORT */ extern UCHAR ExtCapIe; extern UCHAR ErpIe; extern UCHAR DsIe; extern UCHAR TimIe; extern UCHAR WpaIe; extern UCHAR Wpa2Ie; extern UCHAR IbssIe; extern UCHAR WapiIe; extern UCHAR WPA_OUI[]; extern UCHAR RSN_OUI[]; extern UCHAR WAPI_OUI[]; extern UCHAR WME_INFO_ELEM[]; extern UCHAR WME_PARM_ELEM[]; extern UCHAR RALINK_OUI[]; extern UCHAR PowerConstraintIE[]; #if defined(CONFIG_WIFI_PKT_FWD) || defined(CONFIG_WIFI_PKT_FWD_MODULE) extern struct wifi_fwd_func_table wf_drv_tbl; extern UCHAR wf_apcli_active_links; #endif #ifdef RANDOM_PKT_GEN extern INT32 RandomTxCtrl; extern UINT32 Qidmapping[16]; #endif #ifdef CSO_TEST_SUPPORT extern INT32 CsCtrl; #endif struct _RX_BLK; struct raw_rssi_info; typedef struct _UAPSD_INFO { BOOLEAN bAPSDCapable; } UAPSD_INFO; typedef union _CAPTURE_MODE_PACKET_BUFFER { struct { UINT32 BYTE0:8; UINT32 BYTE1:8; UINT32 BYTE2:8; UINT32 BYTE3:8; } field; UINT32 Value; } CAPTURE_MODE_PACKET_BUFFER; #ifdef APCLI_SUPPORT #ifdef APCLI_AUTO_CONNECT_SUPPORT typedef enum _APCLI_CONNECT_SCAN_TYPE { TRIGGER_SCAN_BY_USER = 0, TRIGGER_SCAN_BY_DRIVER = 1, } APCLI_CONNECT_SCAN_TYPE; #endif /* APCLI_AUTO_CONNECT_SUPPORT */ #ifdef WSC_AP_SUPPORT typedef enum _APCLI_WSC_SCAN_TYPE { TRIGGER_FULL_SCAN = 0, TRIGGER_PARTIAL_SCAN = 1 } APCLI_WSC_SCAN_TYPE; #endif /* WSC_AP_SUPPORT */ #endif /* APCLI_SUPPORT */ #define SET_FLAG_CONN_IN_PROG(_a, _b) OS_SET_BIT(_a, _b) #define RESET_FLAG_CONN_IN_PROG(_a, _b) OS_CLEAR_BIT(_a, _b) #ifdef AIR_MONITOR #define RULE_CTL BIT(0) #define RULE_CTL_OFFSET 0 #define RULE_MGT BIT(1) #define RULE_MGT_OFFSET 1 #define RULE_DATA BIT(2) #define RULE_DATA_OFFSET 2 #define RULE_A1 BIT(3) #define RULE_A1_OFFSET 3 #define RULE_A2 BIT(4) #define RULE_A2_OFFSET 4 #define DEFAULT_MNTR_RULE (RULE_MGT | RULE_DATA | RULE_A1 | RULE_A2) typedef enum _MNT_BAND_TYPE { MNT_BAND0 = 1, MNT_BAND1 = 2 } MNT_BAND_TYPE; typedef struct _MNT_MUAR_GROUP { BOOLEAN bValid; UCHAR Count; UCHAR Band; UCHAR MuarGroupBase; } MNT_MUAR_GROUP, *PMNT_MUAR_GROUP; typedef struct _MNT_STA_ENTRY { BOOLEAN bValid; UCHAR Band; UCHAR muar_idx; UCHAR muar_group_idx; ULONG Count; ULONG data_cnt; ULONG mgmt_cnt; ULONG cntl_cnt; UCHAR addr[MAC_ADDR_LEN]; RSSI_SAMPLE RssiSample; VOID *pMacEntry; } MNT_STA_ENTRY, *PMNT_STA_ENTRY; typedef struct _HEADER_802_11_4_ADDR { FRAME_CONTROL FC; USHORT Duration; USHORT SN; UCHAR FN; UCHAR Addr1[MAC_ADDR_LEN]; UCHAR Addr2[MAC_ADDR_LEN]; UCHAR Addr3[MAC_ADDR_LEN]; UCHAR Addr4[MAC_ADDR_LEN]; } HEADER_802_11_4_ADDR, *PHEADER_802_11_4_ADDR; typedef struct _AIR_RADIO_INFO { CHAR PHYMODE; CHAR STREAM; CHAR MCS; CHAR BW; CHAR ShortGI; ULONG RATE; CHAR RSSI[4]; UCHAR Channel; } AIR_RADIO_INFO, *PAIR_RADIO_INFO; typedef struct _AIR_RAW { AIR_RADIO_INFO wlan_radio_tap; HEADER_802_11_4_ADDR wlan_header; } AIR_RAW, *PAIR_RAW; #endif /* AIR_MONITOR */ typedef enum _ENUM_DBDC_MODE_T { ENUM_SingleBand = 0, ENUM_DBDC_2G5G = 1, ENUM_DBDC_5G5G = 2 } ENUM_DBDC_MODE; /* */ /* Macros for flag and ref count operations */ /* */ #define RTMP_SET_FLAG(_M, _F) ((_M)->Flags |= (_F)) #define RTMP_CLEAR_FLAG(_M, _F) ((_M)->Flags &= ~(_F)) #define RTMP_CLEAR_FLAGS(_M) ((_M)->Flags = 0) #define RTMP_TEST_FLAG(_M, _F) (((_M)->Flags & (_F)) != 0) #define RTMP_TEST_FLAGS(_M, _F) (((_M)->Flags & (_F)) == (_F)) /* Macro for power save flag. */ #define RTMP_SET_PSFLAG(_M, _F) ((_M)->PSFlags |= (_F)) #define RTMP_CLEAR_PSFLAG(_M, _F) ((_M)->PSFlags &= ~(_F)) #define RTMP_CLEAR_PSFLAGS(_M) ((_M)->PSFlags = 0) #define RTMP_TEST_PSFLAG(_M, _F) (((_M)->PSFlags & (_F)) != 0) #define RTMP_TEST_PSFLAGS(_M, _F) (((_M)->PSFlags & (_F)) == (_F)) #define OPSTATUS_SET_FLAG(_pAd, _F) ((_pAd)->CommonCfg.OpStatusFlags |= (_F)) #define OPSTATUS_CLEAR_FLAG(_pAd, _F) ((_pAd)->CommonCfg.OpStatusFlags &= ~(_F)) #define OPSTATUS_TEST_FLAG(_pAd, _F) (((_pAd)->CommonCfg.OpStatusFlags & (_F)) != 0) #define OPSTATUS_SET_FLAG_WDEV(_Wdev, _F) ((_Wdev)->OpStatusFlags |= (_F)) #define OPSTATUS_CLEAR_FLAG_WDEV(_Wdev, _F) ((_Wdev)->OpStatusFlags &= ~(_F)) #define OPSTATUS_TEST_FLAG_WDEV(_Wdev, _F) (((_Wdev)->OpStatusFlags & (_F)) != 0) #define OPSTATUS_EQUAL_FLAG_WDEV(_Wdev, _F) (((_Wdev)->OpStatusFlags & (_F)) == (_F)) #define WIFI_TEST_SET_FLAG(_pAd, _F) ((_pAd)->CommonCfg.WiFiTestFlags |= (_F)) #define WIFI_TEST_CLEAR_FLAG(_pAd, _F) ((_pAd)->CommonCfg.WiFiTestFlags &= ~(_F)) #define WIFI_TEST_CHECK_FLAG(_pAd, _F) (((_pAd)->CommonCfg.WiFiTestFlags & (_F)) != 0) #define CLIENT_STATUS_SET_FLAG(_pEntry, _F) ((_pEntry)->ClientStatusFlags |= (_F)) #define CLIENT_STATUS_CLEAR_FLAG(_pEntry, _F) ((_pEntry)->ClientStatusFlags &= ~(_F)) #define CLIENT_STATUS_TEST_FLAG(_pEntry, _F) (((_pEntry)->ClientStatusFlags & (_F)) != 0) #define CLIENT_CAP_SET_FLAG(_pEntry, _F) ((_pEntry)->cli_cap_flags |= (_F)) #define CLIENT_CAP_CLEAR_FLAG(_pEntry, _F) ((_pEntry)->cli_cap_flags &= ~(_F)) #define CLIENT_CAP_TEST_FLAG(_pEntry, _F) (((_pEntry)->cli_cap_flags & (_F)) != 0) #define RX_FILTER_SET_FLAG(_pAd, _F) ((_pAd)->CommonCfg.PacketFilter |= (_F)) #define RX_FILTER_CLEAR_FLAG(_pAd, _F) ((_pAd)->CommonCfg.PacketFilter &= ~(_F)) #define RX_FILTER_TEST_FLAG(_pAd, _F) (((_pAd)->CommonCfg.PacketFilter & (_F)) != 0) #define RTMP_SET_MORE_FLAG(_M, _F) ((_M)->MoreFlags |= (_F)) #define RTMP_TEST_MORE_FLAG(_M, _F) (((_M)->MoreFlags & (_F)) != 0) #define RTMP_CLEAR_MORE_FLAG(_M, _F) ((_M)->MoreFlags &= ~(_F)) #define SET_ASIC_CAP(_pAd, _caps) (hc_set_asic_cap(_pAd->hdev_ctrl, _caps)) #define IS_ASIC_CAP(_pAd, _caps) ((hc_get_asic_cap(_pAd->hdev_ctrl) & (_caps)) != 0) #define CLR_ASIC_CAP(_pAd, _caps) (hc_clear_asic_cap(_pAd->hdev_ctrl, _caps)) #define IS_HIF_TYPE(_pAd, _type) (hc_get_hif_type(_pAd->hdev_ctrl) == _type) #define GET_HIF_TYPE(_pAd) (hc_get_hif_type(_pAd->hdev_ctrl)) #define TX_FLAG_STOP_DEQUEUE (fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS | \ fRTMP_ADAPTER_HALT_IN_PROGRESS | \ fRTMP_ADAPTER_NIC_NOT_EXIST | \ fRTMP_ADAPTER_DISABLE_DEQUEUEPACKET) #define INC_RING_INDEX(_idx, _RingSize) \ { \ (_idx) = (_idx+1) % (_RingSize); \ } #define TR_ENQ_COUNT_INC(tr) \ { \ tr->enqCount++; \ } #define TR_ENQ_COUNT_DEC(tr) \ { \ tr->enqCount--; \ } #define TR_TOKEN_COUNT_INC(tr, qid) \ { \ tr->TokenCount[qid]++; \ } #define TR_TOKEN_COUNT_DEC(tr, qid) \ { \ tr->TokenCount[qid]--; \ } #define SQ_ENQ_PS_MAX 32 #define SQ_ENQ_PSQ_MAX 32 #define SQ_ENQ_PSQ_TOTAL_MAX 1024 #define SQ_ENQ_NORMAL_MAX (SQ_ENQ_RESERVE_PERAC * 4) #define SQ_ENQ_RESERVE_PERAC (2048) #ifdef USB_BULK_BUF_ALIGMENT #define CUR_WRITE_IDX_INC(_idx, _RingSize) \ { \ (_idx) = (_idx+1) % (_RingSize); \ } #endif /* USB_BULK_BUF_ALIGMENT */ /* Common fragment list structure - Identical to the scatter gather frag list structure */ #define NIC_MAX_PHYS_BUF_COUNT 8 typedef struct _RTMP_SCATTER_GATHER_ELEMENT { PVOID Address; ULONG Length; PULONG Reserved; } RTMP_SCATTER_GATHER_ELEMENT, *PRTMP_SCATTER_GATHER_ELEMENT; typedef struct _RTMP_SCATTER_GATHER_LIST { ULONG NumberOfElements; PULONG Reserved; RTMP_SCATTER_GATHER_ELEMENT Elements[NIC_MAX_PHYS_BUF_COUNT]; } RTMP_SCATTER_GATHER_LIST, *PRTMP_SCATTER_GATHER_LIST; typedef struct _MT_MIB_BUCKET_ONE_SEC { UCHAR Enabled[DBDC_BAND_NUM]; UINT32 ChannelBusyTime[DBDC_BAND_NUM]; /* Every second update once. */ UINT32 OBSSAirtime[DBDC_BAND_NUM]; UINT32 MyTxAirtime[DBDC_BAND_NUM]; UINT32 MyRxAirtime[DBDC_BAND_NUM]; UINT32 EDCCAtime[DBDC_BAND_NUM]; UINT32 PdCount[DBDC_BAND_NUM]; UINT32 MdrdyCount[DBDC_BAND_NUM]; } MT_MIB_BUCKET_ONE_SEC, *PMT_MIB_BUCKET_ONE_SEC; typedef struct _MT_MIB_BUCKET_MS { UCHAR CurIdx; UCHAR Enabled; UINT32 ChannelBusyTime[DBDC_BAND_NUM][2]; UINT32 OBSSAirtime[DBDC_BAND_NUM][2]; UINT32 MyTxAirtime[DBDC_BAND_NUM][2]; UINT32 MyRxAirtime[DBDC_BAND_NUM][2]; UINT32 EDCCAtime[DBDC_BAND_NUM][2]; UINT32 PdCount[DBDC_BAND_NUM][2]; UINT32 MdrdyCount[DBDC_BAND_NUM][2]; } MT_MIB_BUCKET_MS, *PMT_MIB_BUCKET_MS; /* Some utility macros */ #define GET_LNA_GAIN(_pAd) ((_pAd->LatchRfRegs.Channel <= 14) ? (_pAd->BLNAGain) : ((_pAd->LatchRfRegs.Channel <= 64) ? (_pAd->ALNAGain0) : ((_pAd->LatchRfRegs.Channel <= 128) ? (_pAd->ALNAGain1) : (_pAd->ALNAGain2)))) #define INC_COUNTER64(Val) (Val.QuadPart++) #define INFRA_ON(_p) (STA_STATUS_TEST_FLAG(_p, fSTA_STATUS_INFRA_ON)) #define ADHOC_ON(_p) (OPSTATUS_TEST_FLAG(_p, fOP_STATUS_ADHOC_ON)) #define MONITOR_ON(_p) (((_p)->monitor_ctrl.bMonitorOn) == TRUE) #define IDLE_ON(_pAd, _pStaCfg) (!INFRA_ON(_pStaCfg) && !ADHOC_ON(_pAd)) /* Check LEAP & CCKM flags */ #define LEAP_ON(_p) (((_p)->StaCfg[0].LeapAuthMode) == CISCO_AuthModeLEAP) #define LEAP_CCKM_ON(_p) ((((_p)->StaCfg[0].LeapAuthMode) == CISCO_AuthModeLEAP) && ((_p)->StaCfg[0].LeapAuthInfo.CCKM == TRUE)) /* if orginal Ethernet frame contains no LLC/SNAP, then an extra LLC/SNAP encap is required */ #define EXTRA_LLCSNAP_ENCAP_FROM_PKT_START(_pBufVA, _pExtraLlcSnapEncap) \ { \ if (((*(_pBufVA + 12) << 8) + *(_pBufVA + 13)) > 1500) { \ _pExtraLlcSnapEncap = SNAP_802_1H; \ if (NdisEqualMemory(IPX, _pBufVA + 12, 2) || \ NdisEqualMemory(APPLE_TALK, _pBufVA + 12, 2)) \ _pExtraLlcSnapEncap = SNAP_BRIDGE_TUNNEL; \ } else \ _pExtraLlcSnapEncap = NULL; \ } /* New Define for new Tx Path. */ #define EXTRA_LLCSNAP_ENCAP_FROM_PKT_OFFSET(_pBufVA, _pExtraLlcSnapEncap) \ { \ if (((*(_pBufVA) << 8) + *(_pBufVA + 1)) > 1500) { \ _pExtraLlcSnapEncap = SNAP_802_1H; \ if (NdisEqualMemory(IPX, _pBufVA, 2) || \ NdisEqualMemory(APPLE_TALK, _pBufVA, 2)) \ _pExtraLlcSnapEncap = SNAP_BRIDGE_TUNNEL; \ } else \ _pExtraLlcSnapEncap = NULL; \ } #define MAKE_802_3_HEADER(_buf, _pMac1, _pMac2, _pType) \ { \ NdisMoveMemory(_buf, _pMac1, MAC_ADDR_LEN); \ NdisMoveMemory((_buf + MAC_ADDR_LEN), _pMac2, MAC_ADDR_LEN); \ NdisMoveMemory((_buf + MAC_ADDR_LEN * 2), _pType, LENGTH_802_3_TYPE); \ } /* if pData has no LLC/SNAP (neither RFC1042 nor Bridge tunnel), keep it that way. else if the received frame is LLC/SNAP-encaped IPX or APPLETALK, preserve the LLC/SNAP field else remove the LLC/SNAP field from the result Ethernet frame Patch for WHQL only, which did not turn on Netbios but use IPX within its payload Note: _pData & _DataSize may be altered (remove 8-byte LLC/SNAP) by this MACRO _pRemovedLLCSNAP: pointer to removed LLC/SNAP; NULL is not removed */ #define CONVERT_TO_802_3(_p8023hdr, _pDA, _pSA, _pData, _DataSize, _pRemovedLLCSNAP) \ { \ char LLC_Len[2]; \ \ _pRemovedLLCSNAP = NULL; \ if (NdisEqualMemory(SNAP_802_1H, _pData, 6) || \ NdisEqualMemory(SNAP_BRIDGE_TUNNEL, _pData, 6)) { \ PUCHAR pProto = _pData + 6; \ \ if ((NdisEqualMemory(IPX, pProto, 2) || NdisEqualMemory(APPLE_TALK, pProto, 2)) && \ NdisEqualMemory(SNAP_802_1H, _pData, 6)) { \ LLC_Len[0] = (UCHAR)(_DataSize >> 8); \ LLC_Len[1] = (UCHAR)(_DataSize & (256 - 1)); \ MAKE_802_3_HEADER(_p8023hdr, _pDA, _pSA, LLC_Len); \ } else { \ MAKE_802_3_HEADER(_p8023hdr, _pDA, _pSA, pProto); \ _pRemovedLLCSNAP = _pData; \ _DataSize -= LENGTH_802_1_H; \ _pData += LENGTH_802_1_H; \ } \ } else { \ LLC_Len[0] = (UCHAR)(_DataSize >> 8); \ LLC_Len[1] = (UCHAR)(_DataSize & (256 - 1)); \ MAKE_802_3_HEADER(_p8023hdr, _pDA, _pSA, LLC_Len); \ } \ } /* Enqueue this frame to MLME engine We need to enqueue the whole frame because MLME need to pass data type information from 802.11 header */ #define REPORT_MGMT_FRAME_TO_MLME(_pAd, Wcid, _pFrame, _FrameSize, _Rssi0, _Rssi1, _Rssi2, _Rssi3, \ _MinSNR, _channel, _OpMode, _wdev, _RxPhyMode)\ do { \ struct raw_rssi_info _rssi_info;\ _rssi_info.raw_rssi[0] = _Rssi0;\ _rssi_info.raw_rssi[1] = _Rssi1;\ _rssi_info.raw_rssi[2] = _Rssi2;\ _rssi_info.raw_rssi[3] = _Rssi3;\ _rssi_info.raw_snr = _MinSNR;\ _rssi_info.Channel = _channel;\ MlmeEnqueueForRecv(_pAd, Wcid, &_rssi_info, _FrameSize, _pFrame, _OpMode, _wdev, _RxPhyMode); \ } while (0) #ifdef OUI_CHECK_SUPPORT enum { OUI_MGROUP_ACT_JOIN = 0, OUI_MGROUP_ACT_LEAVE = 1 }; #define MAC_OUI_EQUAL(pAddr1, pAddr2) RTMPEqualMemory((PVOID)(pAddr1), (PVOID)(pAddr2), 4) #endif /*OUI_CHECK_SUPPORT*/ #define IPV4_ADDR_EQUAL(pAddr1, pAddr2) RTMPEqualMemory((PVOID)(pAddr1), (PVOID)(pAddr2), 4) #define IPV6_ADDR_EQUAL(pAddr1, pAddr2) RTMPEqualMemory((PVOID)(pAddr1), (PVOID)(pAddr2), 16) #define MAC_ADDR_EQUAL(pAddr1, pAddr2) RTMPEqualMemory((PVOID)(pAddr1), (PVOID)(pAddr2), MAC_ADDR_LEN) #define SSID_EQUAL(ssid1, len1, ssid2, len2) ((len1 == len2) && (RTMPEqualMemory(ssid1, ssid2, len1))) #define ONE_SEC_2_US 0xF4240 #define OBSSAIRTIME_TH 60 #define RX_MIBTIME_CLR_OFFSET 31 #define RX_MIBTIME_EN_OFFSET 30 #define OBSS_OCCUPY_PERCENT_HIGH_TH 40 #define OBSS_OCCUPY_PERCENT_LOW_TH 40 #define EDCCA_OCCUPY_PERCENT_TH 40 #define My_OCCUPY_PERCENT 15 #define ALL_AIR_OCCUPY_PERCENT 90 #define TX_RATIO_TH 90 #define BAND0_SPE_IDX 0x18 #define BAND1_SPE_IDX 0x19 BOOLEAN MonitorRxRing(struct _RTMP_ADAPTER *pAd); BOOLEAN MonitorTxRing(struct _RTMP_ADAPTER *pAd); BOOLEAN MonitorRxPse(struct _RTMP_ADAPTER *pAd); /* Statistic counter structure */ typedef struct _COUNTER_802_3 { /* General Stats */ ULONG GoodTransmits; ULONG GoodReceives; ULONG TxErrors; ULONG RxErrors; ULONG RxNoBuffer; } COUNTER_802_3, *PCOUNTER_802_3; typedef struct _COUNTER_802_11 { ULONG Length; /* LARGE_INTEGER LastTransmittedFragmentCount; */ LARGE_INTEGER TransmittedFragmentCount; LARGE_INTEGER MulticastTransmittedFrameCount; LARGE_INTEGER FailedCount; LARGE_INTEGER RetryCount; LARGE_INTEGER MultipleRetryCount; LARGE_INTEGER RTSSuccessCount; LARGE_INTEGER RTSFailureCount; LARGE_INTEGER ACKFailureCount; LARGE_INTEGER FrameDuplicateCount; LARGE_INTEGER ReceivedFragmentCount; LARGE_INTEGER MulticastReceivedFrameCount; LARGE_INTEGER FCSErrorCount; LARGE_INTEGER TransmittedFrameCount; LARGE_INTEGER WEPUndecryptableCount; LARGE_INTEGER TransmitCountFrmOs; #ifdef OUI_CHECK_SUPPORT LARGE_INTEGER RxHWLookupWcidErrCount; #endif #ifdef MT_MAC LARGE_INTEGER TxAggRange1Count; LARGE_INTEGER TxAggRange2Count; LARGE_INTEGER TxAggRange3Count; LARGE_INTEGER TxAggRange4Count; /* for PER debug */ LARGE_INTEGER AmpduFailCount; LARGE_INTEGER AmpduSuccessCount; /* for PER debug */ LARGE_INTEGER CurrentBwTxCount; LARGE_INTEGER OtherBwTxCount; #endif /* MT_MAC */ } COUNTER_802_11, *PCOUNTER_802_11; typedef struct _COUNTER_RALINK { UINT32 OneSecStart; /* for one sec count clear use */ UINT32 OneSecBeaconSentCnt; UINT32 OneSecFalseCCACnt; /* CCA error count, for debug purpose, might move to global counter */ UINT32 OneSecRxFcsErrCnt; /* CRC error */ UINT32 OneSecRxOkCnt; /* RX without error */ UINT32 OneSecTxFailCount; UINT32 OneSecTxNoRetryOkCount; UINT32 OneSecTxRetryOkCount; UINT32 OneSecRxOkDataCnt; /* unicast-to-me DATA frame count */ UINT32 OneSecTransmittedByteCount; /* both successful and failure, used to calculate TX throughput */ ULONG *OneSecOsTxCount; ULONG *OneSecDmaDoneCount; UINT32 OneSecTxDoneCount; ULONG OneSecRxCount; UINT32 OneSecReceivedByteCount; UINT32 OneSecTxARalinkCnt; /* Tx Ralink Aggregation frame cnt */ UINT32 OneSecRxARalinkCnt; /* Rx Ralink Aggregation frame cnt */ UINT32 OneSecEnd; /* for one sec count clear use */ ULONG TransmittedByteCount; /* both successful and failure, used to calculate TX throughput */ ULONG ReceivedByteCount; /* both CRC okay and CRC error, used to calculate RX throughput */ ULONG BadCQIAutoRecoveryCount; ULONG PoorCQIRoamingCount; ULONG MgmtRingFullCount; ULONG RxCountSinceLastNULL; ULONG RxCount; ULONG KickTxCount; LARGE_INTEGER RealFcsErrCount; ULONG PendingNdisPacketCount; ULONG FalseCCACnt; /* CCA error count */ UINT32 LastOneSecTotalTxCount; /* OneSecTxNoRetryOkCount + OneSecTxRetryOkCount + OneSecTxFailCount */ UINT32 LastOneSecRxOkDataCnt; /* OneSecRxOkDataCnt */ ULONG DuplicateRcv; ULONG TxAggCount; ULONG TxNonAggCount; ULONG TxAgg1MPDUCount; ULONG TxAgg2MPDUCount; ULONG TxAgg3MPDUCount; ULONG TxAgg4MPDUCount; ULONG TxAgg5MPDUCount; ULONG TxAgg6MPDUCount; ULONG TxAgg7MPDUCount; ULONG TxAgg8MPDUCount; ULONG TxAgg9MPDUCount; ULONG TxAgg10MPDUCount; ULONG TxAgg11MPDUCount; ULONG TxAgg12MPDUCount; ULONG TxAgg13MPDUCount; ULONG TxAgg14MPDUCount; ULONG TxAgg15MPDUCount; ULONG TxAgg16MPDUCount; LARGE_INTEGER TxAMSDUCount; LARGE_INTEGER RxAMSDUCount; LARGE_INTEGER TransmittedAMPDUCount; LARGE_INTEGER TransmittedMPDUsInAMPDUCount; LARGE_INTEGER TransmittedOctetsInAMPDUCount; LARGE_INTEGER MPDUInReceivedAMPDUCount; ULONG PhyErrCnt; ULONG PlcpErrCnt; } COUNTER_RALINK, *PCOUNTER_RALINK; typedef struct _COUNTER_DRS { /* to record the each TX rate's quality. 0 is best, the bigger the worse. */ USHORT TxQuality[MAX_TX_RATE_INDEX + 1]; UCHAR PER[MAX_TX_RATE_INDEX + 1]; UCHAR TxRateUpPenalty; /* extra # of second penalty due to last unstable condition */ /*BOOLEAN fNoisyEnvironment; */ BOOLEAN fLastSecAccordingRSSI; UCHAR LastSecTxRateChangeAction; /* 0: no change, 1:rate UP, 2:rate down */ UCHAR LastTimeTxRateChangeAction; /*Keep last time value of LastSecTxRateChangeAction */ ULONG LastTxOkCount; } COUNTER_DRS, *PCOUNTER_DRS; #ifdef DOT11_N_SUPPORT #ifdef TXBF_SUPPORT typedef struct _COUNTER_TXBF { ULONG TxSuccessCount; ULONG TxRetryCount; ULONG TxFailCount; ULONG ETxSuccessCount; ULONG ETxRetryCount; ULONG ETxFailCount; ULONG ITxSuccessCount; ULONG ITxRetryCount; ULONG ITxFailCount; } COUNTER_TXBF; #endif /* TXBF_SUPPORT */ #endif /* DOT11_N_SUPPORT */ #ifdef STREAM_MODE_SUPPORT typedef struct _STREAM_MODE_ENTRY_ { #define STREAM_MODE_STATIC 1 USHORT flag; UCHAR macAddr[MAC_ADDR_LEN]; } STREAM_MODE_ENTRY; #endif /* STREAM_MODE_SUPPORT */ /* for Microwave oven */ #ifdef MICROWAVE_OVEN_SUPPORT typedef struct _MO_CFG_STRUCT { BOOLEAN bEnable; UINT8 nPeriod_Cnt; /* measurement period 100ms, mitigate the interference period 900 ms */ UINT16 nFalseCCACnt; UINT16 nFalseCCATh; /* default is 100 */ } MO_CFG_STRUCT, *PMO_CFG_STRUCT; #endif /* MICROWAVE_OVEN_SUPPORT */ /* TODO: need to integrate with MICROWAVE_OVEN_SUPPORT */ #ifdef DYNAMIC_VGA_SUPPORT /* for dynamic vga */ typedef struct _LNA_VGA_CTL_STRUCT { BOOLEAN bEnable; BOOLEAN bDyncVgaEnable; UINT8 nPeriod_Cnt; /* measurement period 100ms, mitigate the interference period 900 ms */ UINT16 nFalseCCACnt; UINT16 nFalseCCATh; /* default is 100 */ UINT16 nLowFalseCCATh; UCHAR agc_vga_init_0; UCHAR agc_vga_ori_0; /* the original vga gain initialized by firmware at start up */ UINT16 agc_0_vga_set1_2; UCHAR agc_vga_init_1; UCHAR agc_vga_ori_1; /* the original vga gain initialized by firmware at start up */ UINT16 agc_1_vga_set1_2; } LNA_VGA_CTL_STRUCT, *PLNA_VGA_CTL_STRUCT; #endif /* DYNAMIC_VGA_SUPPORT */ /*************************************************************************** * security key related data structure **************************************************************************/ /* structure to define WPA Group Key Rekey Interval */ typedef struct GNU_PACKED _RT_802_11_WPA_REKEY { ULONG ReKeyMethod; /* mechanism for rekeying: 0:disable, 1: time-based, 2: packet-based */ ULONG ReKeyInterval; /* time-based: seconds, packet-based: kilo-packets */ } RT_WPA_REKEY, *PRT_WPA_REKEY, RT_802_11_WPA_REKEY, *PRT_802_11_WPA_REKEY; typedef struct { UCHAR Addr[MAC_ADDR_LEN]; UCHAR ErrorCode[2]; /*00 01-Invalid authentication type */ /*00 02-Authentication timeout */ /*00 03-Challenge from AP failed */ /*00 04-Challenge to AP failed */ BOOLEAN Reported; } ROGUEAP_ENTRY, *PROGUEAP_ENTRY; typedef struct { UCHAR RogueApNr; ROGUEAP_ENTRY RogueApEntry[MAX_LEN_OF_BSS_TABLE]; } ROGUEAP_TABLE, *PROGUEAP_TABLE; /* * Fragment Frame structure */ typedef struct _FRAGMENT_FRAME { PNDIS_PACKET pFragPacket; ULONG RxSize; USHORT Sequence; USHORT LastFrag; ULONG Flags; /* Some extra frame information. bit 0: LLC presented */ BOOLEAN Header_802_3; } FRAGMENT_FRAME, *PFRAGMENT_FRAME; /* Tkip Key structure which RC4 key & MIC calculation */ typedef struct _TKIP_KEY_INFO { UINT nBytesInM; /* # bytes in M for MICKEY */ UINT32 IV16; UINT32 IV32; UINT32 K0; /* for MICKEY Low */ UINT32 K1; /* for MICKEY Hig */ UINT32 L; /* Current state for MICKEY */ UINT32 R; /* Current state for MICKEY */ UINT32 M; /* Message accumulator for MICKEY */ UCHAR RC4KEY[16]; UCHAR MIC[8]; } TKIP_KEY_INFO, *PTKIP_KEY_INFO; /* Private / Misc data, counters for driver internal use */ typedef struct __PRIVATE_STRUC { /* Tx ring full occurrance number */ UINT TxRingFullCnt; /* Tkip stuff */ TKIP_KEY_INFO Tx; TKIP_KEY_INFO Rx; } PRIVATE_STRUC, *PPRIVATE_STRUC; /*************************************************************************** * Channel and BBP related data structures **************************************************************************/ /* structure to tune BBP R66 (BBP TUNING) */ typedef struct _BBP_R66_TUNING { BOOLEAN bEnable; USHORT FalseCcaLowerThreshold; /* default 100 */ USHORT FalseCcaUpperThreshold; /* default 512 */ UCHAR R66Delta; UCHAR R66CurrentValue; BOOLEAN R66LowerUpperSelect; /*Before LinkUp, Used LowerBound or UpperBound as R66 value. */ } BBP_R66_TUNING, *PBBP_R66_TUNING; #ifdef DOT11_N_SUPPORT #ifdef DOT11N_DRAFT3 #define EFFECTED_CH_SECONDARY 0x1 #define EFFECTED_CH_PRIMARY 0x2 #define EFFECTED_CH_LEGACY 0x4 #endif /* DOT11N_DRAFT3 */ #endif /* DOT11_N_SUPPORT */ /* structure to store channel TX power */ typedef struct _CHANNEL_TX_POWER { USHORT RemainingTimeForUse; /*unit: sec */ UCHAR Channel; #ifdef DOT11N_DRAFT3 BOOLEAN bEffectedChannel; /* For BW 40 operating in 2.4GHz , the "effected channel" is the channel that is covered in 40Mhz. */ #endif /* DOT11N_DRAFT3 */ CHAR Power; CHAR Power2; UCHAR MaxTxPwr; UCHAR DfsReq; UCHAR RegulatoryDomain; /* Channel property: CHANNEL_DISABLED: The channel is disabled. CHANNEL_PASSIVE_SCAN: Only passive scanning is allowed. CHANNEL_NO_IBSS: IBSS is not allowed. CHANNEL_RADAR: Radar detection is required. CHANNEL_NO_FAT_ABOVE: Extension channel above this channel is not allowed. CHANNEL_NO_FAT_BELOW: Extension channel below this channel is not allowed. CHANNEL_40M_CAP: 40 BW channel group CHANNEL_80M_CAP: 800 BW channel group */ #define CHANNEL_DEFAULT_PROP 0x00 #define CHANNEL_DISABLED 0x01 /* no use */ #define CHANNEL_PASSIVE_SCAN 0x02 #define CHANNEL_NO_IBSS 0x04 #define CHANNEL_RADAR 0x08 #define CHANNEL_NO_FAT_ABOVE 0x10 #define CHANNEL_NO_FAT_BELOW 0x20 #define CHANNEL_40M_CAP 0x40 #define CHANNEL_80M_CAP 0x80 #define CHANNEL_160M_CAP 0x100 UINT Flags; } CHANNEL_TX_POWER, *PCHANNEL_TX_POWER; typedef enum { CH_LIST_STATE_NONE = 0, CH_LIST_STATE_DONE, } CH_LIST_STATE; typedef struct _CHANNEL_CTRL { CHANNEL_TX_POWER ChList[MAX_NUM_OF_CHANNELS]; /* list all supported channels for site survey */ UCHAR ChListNum; /* number of channel in ChannelList[] */ /* Channel Group*/ UCHAR ChGrpABandEn; UCHAR ChGrpABandChList[MAX_NUM_OF_CHANNELS]; UCHAR ChGrpABandChNum; CH_LIST_STATE ChListStat; /* State of channel list, 0: None, 1: Done */ } CHANNEL_CTRL, *PCHANNEL_CTRL; /* Channel list subset */ typedef struct _CHANNEL_LIST_SUB { UCHAR Channel; UCHAR IdxMap; /* Index mapping to original channel list */ } CHANNEL_LIST_SUB, *PCHANNEL_LIST_SUB; typedef struct _SOFT_RX_ANT_DIVERSITY_STRUCT { UCHAR EvaluatePeriod; /* 0:not evalute status, 1: evaluate status, 2: switching status */ UCHAR EvaluateStableCnt; UCHAR Pair1PrimaryRxAnt; /* 0:Ant-E1, 1:Ant-E2 */ UCHAR Pair1SecondaryRxAnt; /* 0:Ant-E1, 1:Ant-E2 */ SHORT Pair1LastAvgRssi; /* */ SHORT Pair2LastAvgRssi; /* */ ULONG RcvPktNumWhenEvaluate; BOOLEAN FirstPktArrivedWhenEvaluate; #ifdef CONFIG_AP_SUPPORT LONG Pair1AvgRssiGroup1[2]; LONG Pair1AvgRssiGroup2[2]; ULONG RcvPktNum[2]; #endif /* CONFIG_AP_SUPPORT */ } SOFT_RX_ANT_DIVERSITY, *PSOFT_RX_ANT_DIVERSITY; typedef enum _ABGBAND_STATE_ { UNKNOWN_BAND, BG_BAND, A_BAND, } ABGBAND_STATE; /*************************************************************************** * structure for MLME state machine **************************************************************************/ typedef struct _MLME_STRUCT { STATE_MACHINE_FUNC ActFunc[ACT_FUNC_SIZE]; /* Action */ STATE_MACHINE ActMachine; #ifdef WSC_INCLUDED STATE_MACHINE WscMachine; STATE_MACHINE_FUNC WscFunc[WSC_FUNC_SIZE]; #endif /* WSC_INCLUDED */ #ifdef CONFIG_HOTSPOT STATE_MACHINE HSCtrlMachine; STATE_MACHINE_FUNC HSCtrlFunc[GAS_FUNC_SIZE]; #endif #ifdef CONFIG_DOT11U_INTERWORKING STATE_MACHINE GASMachine; STATE_MACHINE_FUNC GASFunc[GAS_FUNC_SIZE]; #endif #ifdef DOT11K_RRM_SUPPORT #ifdef CONFIG_11KV_API_SUPPORT STATE_MACHINE BCNMachine; STATE_MACHINE_FUNC BCNFunc[BCN_FUNC_SIZE]; STATE_MACHINE NRMachine; STATE_MACHINE_FUNC NRFunc[NR_FUNC_SIZE]; #endif #endif #ifdef CONFIG_DOT11V_WNM STATE_MACHINE BTMMachine; STATE_MACHINE_FUNC BTMFunc[BTM_FUNC_SIZE]; STATE_MACHINE WNMNotifyMachine; STATE_MACHINE_FUNC WNMNotifyFunc[WNM_NOTIFY_FUNC_SIZE]; #endif #ifdef CONFIG_AP_SUPPORT /* AP state machines */ STATE_MACHINE ApAssocMachine; STATE_MACHINE ApAuthMachine; STATE_MACHINE ApSyncMachine; STATE_MACHINE_FUNC ApAssocFunc[AP_ASSOC_FUNC_SIZE]; /* STATE_MACHINE_FUNC ApDlsFunc[DLS_FUNC_SIZE]; */ STATE_MACHINE_FUNC ApAuthFunc[AP_AUTH_FUNC_SIZE]; STATE_MACHINE_FUNC ApSyncFunc[AP_SYNC_FUNC_SIZE]; #ifdef APCLI_SUPPORT STATE_MACHINE ApCliAuthMachine; STATE_MACHINE ApCliAssocMachine; STATE_MACHINE ApCliCtrlMachine; STATE_MACHINE ApCliSyncMachine; STATE_MACHINE ApCliWpaPskMachine; STATE_MACHINE_FUNC ApCliAuthFunc[APCLI_AUTH_FUNC_SIZE]; STATE_MACHINE_FUNC ApCliAssocFunc[APCLI_ASSOC_FUNC_SIZE]; STATE_MACHINE_FUNC ApCliCtrlFunc[APCLI_CTRL_FUNC_SIZE]; STATE_MACHINE_FUNC ApCliSyncFunc[APCLI_SYNC_FUNC_SIZE]; #endif /* APCLI_SUPPORT */ ULONG ChannelQuality; /* 0..100, Channel Quality Indication for Roaming */ #endif /* CONFIG_AP_SUPPORT */ #ifdef WDS_SUPPORT STATE_MACHINE WdsMachine; STATE_MACHINE_FUNC WdsFunc[WDS_FUNC_SIZE]; #endif /* common WPA state machine */ STATE_MACHINE WpaMachine; STATE_MACHINE_FUNC WpaFunc[WPA_FUNC_SIZE]; ULONG Now32; /* latch the value of NdisGetSystemUpTime() */ ULONG LastSendNULLpsmTime; BOOLEAN bRunning; BOOLEAN suspend; NDIS_SPIN_LOCK TaskLock; MLME_QUEUE Queue; /*used for record jiffies than define as ULONG*/ ULONG ShiftReg; #ifdef BT_COEXISTENCE_SUPPORT RALINK_TIMER_STRUCT MiscDetectTimer; #endif /* BT_COEXISTENCE_SUPPORT */ RALINK_TIMER_STRUCT PeriodicTimer; RALINK_TIMER_STRUCT APSDPeriodicTimer; RALINK_TIMER_STRUCT LinkUpTimer; #ifdef RTMP_MAC_PCI UCHAR bPsPollTimerRunning; RALINK_TIMER_STRUCT PsPollTimer; RALINK_TIMER_STRUCT RadioOnOffTimer; #endif /* RTMP_MAC_PCI */ ULONG PeriodicRound; ULONG GPIORound; ULONG OneSecPeriodicRound; UCHAR RealRxPath; BOOLEAN bLowThroughput; BOOLEAN bEnableAutoAntennaCheck; RALINK_TIMER_STRUCT RxAntEvalTimer; #ifdef CONFIG_MULTI_CHANNEL BOOLEAN bStartMcc; BOOLEAN bpkt_dbg; UINT32 channel_1st_staytime; UINT32 channel_2nd_staytime; UINT32 switch_idle_time; UINT32 null_frame_count; UINT32 channel_1st_bw; UINT32 channel_2nd_bw; UINT32 channel_1st_primary_ch; UINT32 channel_2nd_primary_ch; UINT32 channel_1st_center_ch; UINT32 channel_2nd_center_ch; ULONG BeaconNow32; /* latch the value of NdisGetSystemUpTime() */ #endif /* CONFIG_MULTI_CHANNEL */ BOOLEAN bStartScc; struct notify_entry wsys_ne; } MLME_STRUCT, *PMLME_STRUCT; #ifdef DOT11_N_SUPPORT /*************************************************************************** * 802.11 N related data structures **************************************************************************/ struct reordering_mpdu; struct reordering_list { struct reordering_mpdu *next; struct reordering_mpdu *tail; int qlen; }; struct reordering_mpdu { struct reordering_mpdu *next; struct reordering_list AmsduList; PNDIS_PACKET pPacket; /* coverted to 802.3 frame */ int Sequence; /* sequence number of MPDU */ BOOLEAN bAMSDU; UCHAR OpMode; }; struct reordering_mpdu_pool { PVOID mem; NDIS_SPIN_LOCK lock; struct reordering_list freelist; }; typedef enum _REC_BLOCKACK_STATUS { Recipient_NONE = 0, Recipient_USED, Recipient_HandleRes, Recipient_Initialization, Recipient_Established } REC_BLOCKACK_STATUS, *PREC_BLOCKACK_STATUS; typedef enum _ORI_BLOCKACK_STATUS { Originator_NONE = 0, Originator_USED, Originator_WaitRes, Originator_Done } ORI_BLOCKACK_STATUS, *PORI_BLOCKACK_STATUS; typedef struct _BA_ORI_ENTRY { UCHAR Wcid; UCHAR TID; UCHAR BAWinSize; UCHAR Token; UCHAR amsdu_cap; /* Sequence is to fill every outgoing QoS DATA frame's sequence field in 802.11 header. */ USHORT Sequence; USHORT TimeOutValue; ORI_BLOCKACK_STATUS ORI_BA_Status; RALINK_TIMER_STRUCT ORIBATimer; PVOID pAdapter; } BA_ORI_ENTRY, *PBA_ORI_ENTRY; typedef struct _BA_REC_ENTRY { BOOLEAN check_amsdu_miss ____cacheline_aligned; UINT8 PreviousAmsduState; UINT16 PreviousSN; UINT16 PreviousReorderCase; REC_BLOCKACK_STATUS REC_BA_Status; USHORT LastIndSeq; NDIS_SPIN_LOCK RxReRingLock; /* Rx Ring spinlock */ UCHAR BAWinSize; /* 7.3.1.14. each buffer is capable of holding a max AMSDU or MSDU. */ ULONG LastIndSeqAtTimer; ULONG nDropPacket; struct reordering_list list; struct reordering_mpdu *CurMpdu; #define STEP_ONE 0 #define REPEAT 1 #define OLDPKT 2 #define WITHIN 3 #define SURPASS 4 UCHAR Wcid; UCHAR TID; USHORT TimeOutValue; RALINK_TIMER_STRUCT RECBATimer; PVOID pAdapter; } BA_REC_ENTRY, *PBA_REC_ENTRY; typedef struct { ULONG numAsRecipient; /* I am recipient of numAsRecipient clients. These client are in the BARecEntry[] */ ULONG numAsOriginator; /* I am originator of numAsOriginator clients. These clients are in the BAOriEntry[] */ ULONG numDoneOriginator; /* count Done Originator sessions */ BA_ORI_ENTRY BAOriEntry[MAX_LEN_OF_BA_ORI_TABLE]; BA_REC_ENTRY BARecEntry[MAX_LEN_OF_BA_REC_TABLE]; BOOLEAN ba_timeout_check; #define BA_TIMEOUT_BITMAP_LEN (MAX_LEN_OF_BA_REC_TABLE/32) UINT32 ba_timeout_bitmap[BA_TIMEOUT_BITMAP_LEN]; } BA_TABLE, *PBA_TABLE; /*For QureyBATableOID use; */ typedef struct GNU_PACKED _OID_BA_REC_ENTRY { UCHAR MACAddr[MAC_ADDR_LEN]; UCHAR BaBitmap; /* if (BaBitmap&(1<<TID)), this session with{MACAddr, TID}exists, so read BufSize[TID] for BufferSize */ UCHAR rsv; UCHAR BufSize[8]; REC_BLOCKACK_STATUS REC_BA_Status[8]; } OID_BA_REC_ENTRY, *POID_BA_REC_ENTRY; /*For QureyBATableOID use; */ typedef struct GNU_PACKED _OID_BA_ORI_ENTRY { UCHAR MACAddr[MAC_ADDR_LEN]; UCHAR BaBitmap; /* if (BaBitmap&(1<<TID)), this session with{MACAddr, TID}exists, so read BufSize[TID] for BufferSize, read ORI_BA_Status[TID] for status */ UCHAR rsv; UCHAR BufSize[8]; ORI_BLOCKACK_STATUS ORI_BA_Status[8]; } OID_BA_ORI_ENTRY, *POID_BA_ORI_ENTRY; typedef struct _QUERYBA_TABLE { OID_BA_ORI_ENTRY BAOriEntry[32]; OID_BA_REC_ENTRY BARecEntry[32]; UCHAR OriNum; /* Number of below BAOriEntry */ UCHAR RecNum; /* Number of below BARecEntry */ } QUERYBA_TABLE, *PQUERYBA_TABLE; typedef union _BACAP_STRUC { #ifdef RT_BIG_ENDIAN struct { UINT32:4; UINT32 b2040CoexistScanSup:1; /*As Sta, support do 2040 coexistence scan for AP. As Ap, support monitor trigger event to check if can use BW 40MHz. */ UINT32 bHtAdhoc:1; /* adhoc can use ht rate. */ UINT32 MMPSmode:2; /* MIMO power save more, 0:static, 1:dynamic, 2:rsv, 3:mimo enable */ UINT32 AmsduSize:1; /* 0:3839, 1:7935 bytes. UINT MSDUSizeToBytes[] = { 3839, 7935}; */ UINT32 AmsduEnable:1; /*Enable AMSDU transmisstion */ UINT32 rsv1:3; UINT32 Policy:2; /* 0: DELAY_BA 1:IMMED_BA (//BA Policy subfiled value in ADDBA frame) 2:BA-not use */ UINT32 AutoBA:1; /* automatically BA */ UINT32 TxBAWinLimit:8; UINT32 RxBAWinLimit:8; } field; #else struct { UINT32 RxBAWinLimit:8; UINT32 TxBAWinLimit:8; UINT32 AutoBA:1; /* automatically BA */ UINT32 Policy:2; /* 0: DELAY_BA 1:IMMED_BA (//BA Policy subfiled value in ADDBA frame) 2:BA-not use */ UINT32 rsv1:3; UINT32 AmsduEnable:1; /*Enable AMSDU transmisstion */ UINT32 AmsduSize:1; /* 0:3839, 1:7935 bytes. UINT MSDUSizeToBytes[] = { 3839, 7935}; */ UINT32 MMPSmode:2; /* MIMO power save more, 0:static, 1:dynamic, 2:rsv, 3:mimo enable */ UINT32 bHtAdhoc:1; /* adhoc can use ht rate. */ UINT32 b2040CoexistScanSup:1; /*As Sta, support do 2040 coexistence scan for AP. As Ap, support monitor trigger event to check if can use BW 40MHz. */ UINT32:4; } field; #endif UINT32 word; } BACAP_STRUC, *PBACAP_STRUC; typedef struct { BOOLEAN IsRecipient; UCHAR MACAddr[MAC_ADDR_LEN]; UCHAR TID; UCHAR nMSDU; USHORT TimeOut; BOOLEAN bAllTid; /* If True, delete all TID for BA sessions with this MACaddr. */ } OID_ADD_BA_ENTRY, *POID_ADD_BA_ENTRY; #define WLAN_MAX_NUM_OF_TIM ((MAX_LEN_OF_MAC_TABLE >> 3) + 1) /* /8 + 1 */ enum BCN_TX_STATE { BCN_TX_UNINIT = 0, BCN_TX_IDLE = 1, BCN_TX_WRITE_TO_DMA = 2, BCN_TX_DMA_DONE = 3 }; typedef enum { PHY_IDLE = 0, PHY_INUSE = 1, PHY_RADIOOFF = 2, } PHY_STATUS; #ifdef MT_MAC typedef struct _TIM_BUF_STRUCT { BOOLEAN bTimSntReq; /* used in if beacon send or stop */ UCHAR TimBufIdx; PNDIS_PACKET TimPkt; /* PNDIS_PACKET TimPkt2; */ } TIM_BUF_STRUC; INT wdev_tim_buf_init(RTMP_ADAPTER *pAd, TIM_BUF_STRUC *tim_info); #endif typedef struct _BCN_BUF_STRUCT { BOOLEAN bBcnSntReq; /* used in if beacon send or stop */ enum BCN_TX_STATE bcn_state; /* Make sure if no packet pending in the Hardware */ PNDIS_PACKET BeaconPkt; UCHAR cap_ie_pos; struct wifi_dev *pWdev;/* point to associated wdev.*/ UCHAR TimBitmaps[WLAN_MAX_NUM_OF_TIM]; UINT16 TimIELocationInBeacon; #ifdef MT_MAC TIM_BUF_STRUC tim_buf; UCHAR TimIELocationInTim; #endif /* MT_MAC */ UINT16 CsaIELocationInBeacon; NDIS_SPIN_LOCK BcnContentLock; UCHAR BcnUpdateMethod; } BCN_BUF_STRUC; #ifdef DOT11N_DRAFT3 typedef enum _BSS2040COEXIST_FLAG { BSS_2040_COEXIST_DISABLE = 0, BSS_2040_COEXIST_TIMER_FIRED = 1, BSS_2040_COEXIST_INFO_SYNC = 2, BSS_2040_COEXIST_INFO_NOTIFY = 4, } BSS2040COEXIST_FLAG; typedef struct _BssCoexChRange_ { UCHAR primaryCh; UCHAR secondaryCh; UCHAR effectChStart; UCHAR effectChEnd; } BSS_COEX_CH_RANGE; #endif /* DOT11N_DRAFT3 */ #define IS_VHT_STA(_pMacEntry) (_pMacEntry->MaxHTPhyMode.field.MODE == MODE_VHT) #define IS_HT_STA(_pMacEntry) \ (_pMacEntry->MaxHTPhyMode.field.MODE >= MODE_HTMIX) #define IS_HT_RATE(_pMacEntry) \ (_pMacEntry->HTPhyMode.field.MODE >= MODE_HTMIX) #ifdef DOT11_VHT_AC #define IS_VHT_RATE(_pMacEntry) \ (_pMacEntry->HTPhyMode.field.MODE == MODE_VHT) #endif #define PEER_IS_HT_RATE(_pMacEntry) \ (_pMacEntry->HTPhyMode.field.MODE >= MODE_HTMIX) #endif /* DOT11_N_SUPPORT */ /*This structure is for all 802.11n card InterOptibilityTest action. Reset all Num every n second. (Details see MLMEPeriodic) */ typedef struct _IOT_STRUC { BOOLEAN bRTSLongProtOn; } IOT_STRUC; /* This is the registry setting for 802.11n transmit setting. Used in advanced page. */ typedef union _REG_TRANSMIT_SETTING { #ifdef RT_BIG_ENDIAN struct { UINT32 rsv:13; UINT32 EXTCHA:2; UINT32 HTMODE:1; UINT32 TRANSNO:2; UINT32 STBC:1; /*SPACE */ UINT32 ShortGI:1; UINT32 TxBF:1; /* 3*3 */ UINT32 ITxBfEn:1; UINT32 rsv0:10; /*UINT32 MCS:7; // MCS */ /*UINT32 PhyMode:4; */ } field; #else struct { /*UINT32 PhyMode:4; */ /*UINT32 MCS:7; // MCS */ UINT32 rsv0:10; UINT32 ITxBfEn:1; UINT32 TxBF:1; UINT32 ShortGI:1; UINT32 STBC:1; /*SPACE */ UINT32 TRANSNO:2; UINT32 HTMODE:1; UINT32 EXTCHA:2; UINT32 rsv:13; } field; #endif UINT32 word; } REG_TRANSMIT_SETTING; typedef union _DESIRED_TRANSMIT_SETTING { #ifdef RT_BIG_ENDIAN struct { USHORT rsv:2; USHORT FixedTxMode:3; /* If MCS isn't AUTO, fix rate in CCK, OFDM, HT or VHT mode. */ USHORT PhyMode:4; USHORT MCS:7; /* MCS */ } field; #else struct { USHORT MCS:7; USHORT PhyMode:4; USHORT FixedTxMode:3; USHORT rsv:2; } field; #endif USHORT word; } DESIRED_TRANSMIT_SETTING; struct hw_setting { CHAR lan_gain; }; /** @ingroup wifi_dev_system */ enum WDEV_TYPE { WDEV_TYPE_AP = (1 << 0), WDEV_TYPE_STA = (1 << 1), WDEV_TYPE_ADHOC = (1 << 2), WDEV_TYPE_WDS = (1 << 3), WDEV_TYPE_MESH = (1 << 4), WDEV_TYPE_GO = (1 << 5), WDEV_TYPE_GC = (1 << 6), WDEV_TYPE_APCLI = (1 << 7), WDEV_TYPE_REPEATER = (1 << 8), WDEV_TYPE_P2P_DEVICE = (1 << 9), WDEV_TYPE_TDLS = (1 << 10), }; #define WDEV_WITH_BCN_ABILITY(_wdev) (((_wdev)->wdev_type == WDEV_TYPE_AP) || \ ((_wdev)->wdev_type == WDEV_TYPE_GO) || \ ((_wdev)->wdev_type == WDEV_TYPE_MESH)) enum BSS_INFO_DRIVER_MAINTIAN_STATE { BSS_INFO_INIT = 0, BSS_INFO_SEND_ENABLE = 1, BSS_INFO_SEND_DISABLE = 2, }; enum MSDU_FORBID_REASON { MSDU_FORBID_CONNECTION_NOT_READY = 0, MSDU_FORBID_CHANNEL_MISMATCH = 1, }; #define FLG_IS_OUTPUT 1 #define FLAG_IS_INPUT 0 #define MSDU_FORBID_SET(_wdev, _reason) (OS_SET_BIT(_reason, &((_wdev)->forbid_data_tx))) #define MSDU_FORBID_CLEAR(_wdev, _reason) (OS_CLEAR_BIT(_reason, &((_wdev)->forbid_data_tx))) typedef struct _RX_TA_TID_SEQ_MAPPING { UINT8 RxDWlanIdx; UINT8 MuarIdx; UINT16 TID_SEQ[8]; UINT8 LatestTID; } RX_TA_TID_SEQ_MAPPING, *PRX_TA_TID_SEQ_MAPPING; typedef struct _RX_TRACKING_T { RX_TA_TID_SEQ_MAPPING LastRxWlanIdx; UINT32 TriggerNum; } RX_TRACKING_T, *PRX_TRACKING_T; struct _TX_BLK; /** * @send_mlme_pkt: TX mlme pakcet en-queue pre handle that will call enq_data_pkt/enq_mgmt_pkt depend on which queue type that enqueue to * @send_data_pkt: TX data packet en-queue (TX sw queue) pre handle * @fp_send_data_pkt: TX data packet en-queue (TX sw queue) pre handle for fast path * @tx_pkt_allowed: early check for allow unicast/multicast packet to send or not * @fp_tx_pkt_allowed: early check for allow unicast/multicast packet to send or not for fast path * @tx_pkt_handle: TX data per packet handle * @fill_offload_tx_blk: fill tx_blk information to build 802.11 header and hw descriptor header for txd offload frame * @fill_non_offload_tx_blk: fill tx_blk information to build 802.11 header and hw descriptor header for non-txd offload frame * @legacy_tx: build tx_blk, 802.11 header if not enable header translation and txd header then kick out to HIF * @ampdu_tx: same as legacy_tx except that can do cache operation (802.11 header cache) * @frag_tx: fragment TX data packet according to fragment threshold, fragment do not support header translation, so need to build 802.11 header * @amsdu_tx: aggrgation msdu packet into a-msdu packet * @mlme_mgmtq_tx: build tx_blk, and txd header and kick out to HIF for MLME frame that dequeue from management sw queue * @mlme_dataq_tx: build tx_blk, and txd header and kick out to HIF for MLME frame that dequeue from data sw queue * @ate_tx: build tx_blk, and txd header and kick out to HIF for ATE frames * @ieee_802_11_data_tx: build 802.11 header * @ieee_802_3_data_tx: for header translation disable case, do not need build 802.11 header any more * @rx_pkt_allowed: early check for allow unicast/multicast packet to receive or not * @ieee_802_11_data_rx: per 802.11 data packet handle (build RX_BLK, process 802.11 header nad indicate to TCP layer or forward to other STA) * @ieee_802_3_data_rx: per 802.3 data packet handle (build RX_BLK and indicate to TCP layer or forward to other STA) * @ieee_802_11_ctl_rx: per 802.11 control packet handle (receive control frame and en-queue to MLME state machine) * @rx_pkt_forward: per 802.3 data packet forward handing * @find_cipher_algorithm: find encrypt key and decide cipher alogorithm * @detect_wmm_traffic: detect wmm traffic for purpose that determine if turn off txop or not */ struct wifi_dev_ops { /* TX */ INT (*send_data_pkt)(struct _RTMP_ADAPTER *pAd, struct wifi_dev *wdev, PNDIS_PACKET pkt) ____cacheline_aligned; INT (*fp_send_data_pkt)(struct _RTMP_ADAPTER *pAd, struct wifi_dev *wdev, PNDIS_PACKET pkt); INT (*send_mlme_pkt)(struct _RTMP_ADAPTER *pAd, PNDIS_PACKET pkt, struct wifi_dev *wdev, UCHAR q_idx, BOOLEAN is_data_queue); INT (*tx_pkt_allowed)(struct _RTMP_ADAPTER *pAd, struct wifi_dev *wdev, PNDIS_PACKET pkt); INT (*fp_tx_pkt_allowed)(struct _RTMP_ADAPTER *pAd, struct wifi_dev *wdev, PNDIS_PACKET pkt); INT (*tx_pkt_handle)(struct _RTMP_ADAPTER *pAd, struct wifi_dev *wdev, struct _TX_BLK *tx_blk); INT (*legacy_tx)(struct _RTMP_ADAPTER *pAd, struct wifi_dev *wdev, struct _TX_BLK *tx_blk); INT (*ampdu_tx)(struct _RTMP_ADAPTER *pAd, struct wifi_dev *wdev, struct _TX_BLK *tx_blk); INT (*amsdu_tx)(struct _RTMP_ADAPTER *pAd, struct wifi_dev *wdev, struct _TX_BLK *tx_blk); INT (*frag_tx)(struct _RTMP_ADAPTER *pAd, struct wifi_dev *wdev, struct _TX_BLK *tx_blk); INT (*mlme_mgmtq_tx)(struct _RTMP_ADAPTER *pAd, struct wifi_dev *wdev, struct _TX_BLK *tx_blk); INT (*mlme_dataq_tx)(struct _RTMP_ADAPTER *pAd, struct wifi_dev *wdev, struct _TX_BLK *tx_blk); INT (*ate_tx)(struct _RTMP_ADAPTER *pAd, struct wifi_dev *wdev, struct _TX_BLK *tx_blk); BOOLEAN (*fill_offload_tx_blk)(struct _RTMP_ADAPTER *pAd, struct wifi_dev *wdev, struct _TX_BLK *tx_blk); BOOLEAN (*fill_non_offload_tx_blk)(struct _RTMP_ADAPTER *pAd, struct wifi_dev *wdev, struct _TX_BLK *tx_blk); VOID (*ieee_802_11_data_tx)(struct _RTMP_ADAPTER *pAd, struct wifi_dev *wdev, struct _TX_BLK *tx_blk); VOID (*ieee_802_3_data_tx)(struct _RTMP_ADAPTER *pAd, struct wifi_dev *wdev, struct _TX_BLK *tx_blk); /* RX */ INT (*rx_pkt_allowed)(struct _RTMP_ADAPTER *pAd, struct wifi_dev *wdev, struct _RX_BLK *rx_blk) ____cacheline_aligned; INT (*rx_pkt_hdr_chk)(struct _RTMP_ADAPTER *pAd, struct wifi_dev *wdev, struct _RX_BLK *rx_blk); INT (*rx_ps_handle)(struct _RTMP_ADAPTER *pAd, struct wifi_dev *wdev, struct _RX_BLK *rx_blk); INT (*ieee_802_11_data_rx)(struct _RTMP_ADAPTER *pAd, struct wifi_dev *wdev, struct _RX_BLK *rx_blk, struct _MAC_TABLE_ENTRY *entry); INT (*ieee_802_3_data_rx)(struct _RTMP_ADAPTER *pAd, struct wifi_dev *wdev, struct _RX_BLK *rx_blk, struct _MAC_TABLE_ENTRY *entry); INT (*ieee_802_11_mgmt_rx)(struct _RTMP_ADAPTER *pAd, struct wifi_dev *wdev, struct _RX_BLK *rx_blk); INT (*ieee_802_11_ctl_rx)(struct _RTMP_ADAPTER *pAd, struct wifi_dev *wdev, struct _RX_BLK *rx_blk); INT (*rx_pkt_foward)(struct _RTMP_ADAPTER *pAd, struct wifi_dev *wdev, PNDIS_PACKET pkt); VOID (*find_cipher_algorithm)(struct _RTMP_ADAPTER *pAd, struct wifi_dev *wdev, struct _TX_BLK *tx_blk); VOID (*detect_wmm_traffic)(struct _RTMP_ADAPTER *pAd, struct wifi_dev *wdev, UCHAR up, UCHAR flg_is_output); /* General */ INT (*open)(struct wifi_dev *wdev) ____cacheline_aligned; INT (*close)(struct wifi_dev *wdev); INT (*linkup)(struct wifi_dev *wdev, struct _MAC_TABLE_ENTRY *entry); INT (*linkdown)(struct wifi_dev *wdev); INT (*conn_act)(struct wifi_dev *wdev, struct _MAC_TABLE_ENTRY *entry); INT (*disconn_act)(struct wifi_dev *wdev, struct _MAC_TABLE_ENTRY *entry); VOID (*mac_entry_lookup)(RTMP_ADAPTER *pAd, UCHAR *pAddr, struct wifi_dev *wdev, struct _MAC_TABLE_ENTRY **entry); }; struct conn_sta_info { UINT16 nonerp_sta_cnt; UINT16 nongf_sta_cnt; UINT16 ht_bw20_sta_cnt; }; /** * @wdev_idx: index refer from pAd->wdev_list[] * @func_idx: index refer to func_dev which pointer to * @tr_tb_idx: index refer to BSS which this device belong to * @wdev_ops: wifi device operation */ struct wifi_dev { PNET_DEV if_dev; VOID *func_dev; VOID *sys_handle; CHAR wdev_idx; /* index refer from pAd->wdev_list[] */ CHAR BssIdx; CHAR func_idx; /* index refer to func_dev which pointer to */ CHAR func_type; /*Indicator to func type*/ UCHAR tr_tb_idx; /* index refer to BSS which this device belong */ UINT32 wdev_type; UCHAR PhyMode; UCHAR channel; UCHAR if_addr[MAC_ADDR_LEN]; UCHAR bssid[MAC_ADDR_LEN]; UCHAR hw_bssid_idx; BOOLEAN if_up_down_state; /* security segment */ struct _SECURITY_CONFIG SecConfig; UCHAR PortSecured; #ifdef DOT11R_FT_SUPPORT FT_CFG FtCfg; #endif /* DOT11R_FT_SUPPORT */ /* transmit segment */ ULONG forbid_data_tx; /* Use long, becasue we want to do atomic bit operation */ BOOLEAN IgmpSnoopEnable; /* Only enabled for AP/WDS mode */ RT_PHY_INFO DesiredHtPhyInfo; DESIRED_TRANSMIT_SETTING DesiredTransmitSetting; /* Desired transmit setting. this is for reading registry setting only. not useful. */ BOOLEAN bAutoTxRateSwitch; HTTRANSMIT_SETTING HTPhyMode, MaxHTPhyMode, MinHTPhyMode; /* For transmit phy setting in TXWI. */ /* 802.11 protocol related characters */ BOOLEAN bWmmCapable; /* 0:disable WMM, 1:enable WMM */ UCHAR EdcaIdx; /*mapping edca parameter to CommonCfg.APEdca[EdcaIdx]*/ /* UAPSD information: such as enable or disable, do not remove */ UAPSD_INFO UapsdInfo; /* for protocol layer using */ UINT32 protection; /* tx burst */ UINT32 prio_bitmap; UINT16 txop_level[MAX_PRIO_NUM]; /* VLAN related */ BOOLEAN bVLAN_Tag; USHORT VLAN_VID; USHORT VLAN_Priority; struct wifi_dev_ops *wdev_ops; /* last received packet's SNR for each antenna */ UCHAR LastSNR0; UCHAR LastSNR1; RSSI_SAMPLE RssiSample; ULONG NumOfAvgRssiSample; BOOLEAN bLinkUpDone; BOOLEAN bGotEapolPkt; struct _RX_BLK *pEapolPktFromAP; /* 7636 psm */ USHORT Psm; /* power management mode (PWR_ACTIVE|PWR_SAVE), Please use this value to replace pAd->StaCfg[0].Psm in the future*/ BOOLEAN bBeaconLost; BOOLEAN bTriggerRoaming; UINT8 ucDtimPeriod; UINT8 ucBeaconPeriod; UINT8 OmacIdx; #if defined(RT_CFG80211_SUPPORT) || defined(HOSTAPD_SUPPORT) NDIS_HOSTAPD_STATUS Hostapd; BOOLEAN IsCFG1xWdev; #endif UINT8 csa_count; BCN_BUF_STRUC bcn_buf; struct _BSS_INFO_ARGUMENT_T bss_info_argument; struct _DEV_INFO_CTRL_T DevInfo; VOID *pHObj; BOOLEAN fgRadioOnRequest; #ifdef MT_MAC RX_TRACKING_T rx_tracking; #endif BOOLEAN fAnyStationPeekTpBound; struct dev_rate_info rate; /*wlan profile, use for configuration part.*/ void *wpf_cfg; /*wlan profile, use for operating configurion, update by wcfg & mlme*/ void *wpf_op; /* struct conn_sta_info conn_sta; */ /* struct protection_cfg prot_cfg; */ /* Flag migrate from pAd partially */ UINT32 OpStatusFlags; BOOLEAN bAllowBeaconing; /* Device opened and ready for beaconing */ #ifdef DOT11K_RRM_SUPPORT RRM_CONFIG RrmCfg; #endif /* DOT11K_RRM_SUPPORT */ #ifdef MBO_SUPPORT MBO_CTRL MboCtrl; #endif /* MBO_SUPPORT */ /* NEW FSM Segment */ SCAN_INFO ScanInfo; VOID *sync_fsm_ops; #ifdef WSC_INCLUDED /* WPS segment */ WSC_LV_INFO WscIEBeacon; WSC_LV_INFO WscIEProbeResp; WSC_CTRL WscControl; WSC_SECURITY_MODE WscSecurityMode; #endif /* WSC_INCLUDED */ #ifdef BAND_STEERING #ifdef CONFIG_AP_SUPPORT BOOLEAN bInfReady; #endif /* CONFIG_AP_SUPPORT */ #endif /* BAND_STEERING */ BOOLEAN is_marvell_ap; BOOLEAN is_atheros_ap; VOID *pDot11_H; VIE_CTRL vie_ctrl[VIE_FRM_TYPE_MAX]; }; struct greenap_ctrl { /* capability of rreenap */ BOOLEAN cap; /* greenap_allow=TRUE only when AP or AP+AP case */ BOOLEAN allow; /* suspend greenap operation ex. when do AP backdround scan */ UINT32 suspend; NDIS_SPIN_LOCK lock; }; struct greenap_on_off_ctrl { UINT8 band_idx; BOOLEAN reduce_core_power; }; typedef struct _PWR_MGMT_STRUCT_ { USHORT Psm; /* power management mode (PWR_ACTIVE|PWR_SAVE), Please use this value to replace pAd->StaCfg[0].Psm in the future*/ BOOLEAN bBeaconLost; BOOLEAN bTriggerRoaming; BOOLEAN bEnterPsmNull; UINT8 ucDtimPeriod; UINT8 ucBeaconPeriod; /* Usign this wcid instead of pEntry->wcid for race condition. ex STA in PS --> BCN lost --> Linkdown --> Exit h/w LP with pEntry->wcid (pEntry might be NULL at this moment)*/ UCHAR ucWcid; BOOLEAN bDoze; } PWR_MGMT_STRUCT, *PPWR_MGMT_STRUCT; /*************************************************************************** * Multiple SSID related data structures **************************************************************************/ #define WLAN_CT_TIM_BCMC_OFFSET 0 /* unit: 32B */ /* clear bcmc TIM bit */ #define WLAN_MR_TIM_BCMC_CLEAR(apidx) \ (pAd->ApCfg.MBSSID[apidx].wdev.bcn_buf.TimBitmaps[WLAN_CT_TIM_BCMC_OFFSET] &= ~NUM_BIT8[0]) /* set bcmc TIM bit */ #define WLAN_MR_TIM_BCMC_SET(apidx) \ (pAd->ApCfg.MBSSID[apidx].wdev.bcn_buf.TimBitmaps[WLAN_CT_TIM_BCMC_OFFSET] |= NUM_BIT8[0]) #define WLAN_MR_TIM_BCMC_GET(apidx) \ (pAd->ApCfg.MBSSID[apidx].wdev.bcn_buf.TimBitmaps[WLAN_CT_TIM_BCMC_OFFSET] & NUM_BIT8[0]) /* clear a station PS TIM bit */ #define WLAN_MR_TIM_BIT_CLEAR(ad_p, apidx, _aid) \ { UCHAR tim_offset = _aid >> 3; \ UCHAR bit_offset = _aid & 0x7; \ ad_p->ApCfg.MBSSID[apidx].wdev.bcn_buf.TimBitmaps[tim_offset] &= (~NUM_BIT8[bit_offset]); } /* set a station PS TIM bit */ #define WLAN_MR_TIM_BIT_SET(ad_p, apidx, _aid) \ { UCHAR tim_offset = _aid >> 3; \ UCHAR bit_offset = _aid & 0x7; \ ad_p->ApCfg.MBSSID[apidx].wdev.bcn_buf.TimBitmaps[tim_offset] |= NUM_BIT8[bit_offset]; } #ifdef CONFIG_AP_SUPPORT #ifdef MT_MAC #define MAX_TIME_RECORD 5 #endif typedef struct _BSS_STRUCT { struct wifi_dev wdev; INT mbss_idx; #ifdef HOSTAPD_SUPPORT NDIS_HOSTAPD_STATUS Hostapd; BOOLEAN HostapdWPS; #endif CHAR Ssid[MAX_LEN_OF_SSID+1]; UCHAR SsidLen; BOOLEAN bHideSsid; USHORT CapabilityInfo; UCHAR MaxStaNum; /* Limit the STA connection number per BSS */ UCHAR StaCount; UINT16 StationKeepAliveTime; /* unit: second */ /* Security segment */ UCHAR RSNIE_Len[2]; UCHAR RSN_IE[2][MAX_LEN_OF_RSNIE]; /* WPA */ UCHAR GMK[32]; UCHAR PSK[65]; UCHAR PMK[LEN_MAX_PMK]; UCHAR GTK[32]; UCHAR GNonce[32]; NDIS_802_11_PRIVACY_FILTER PrivacyFilter; /* for Group Rekey, AP ONLY */ RT_WPA_REKEY WPAREKEY; ULONG REKEYCOUNTER; RALINK_TIMER_STRUCT REKEYTimer; UCHAR REKEYTimerRunning; UINT8 RekeyCountDown; /* For PMK Cache using, AP ONLY */ ULONG PMKCachePeriod; /* unit : jiffies */ /* Transmitting segment */ UCHAR TxRate; /* RATE_1, RATE_2, RATE_5_5, RATE_11, ... */ UCHAR DesiredRates[MAX_LEN_OF_SUPPORTED_RATES]; /* OID_802_11_DESIRED_RATES */ UCHAR DesiredRatesIndex; UCHAR MaxTxRate; /* RATE_1, RATE_2, RATE_5_5, RATE_11 */ /* Statistics segment */ /*MBSS_STATISTICS MbssStat;*/ ULONG TxCount; ULONG RxCount; ULONG ReceivedByteCount; ULONG TransmittedByteCount; ULONG RxErrorCount; ULONG RxDropCount; ULONG TxErrorCount; ULONG TxDropCount; ULONG ucPktsTx; ULONG ucPktsRx; ULONG mcPktsTx; ULONG mcPktsRx; ULONG bcPktsTx; ULONG bcPktsRx; UCHAR BANClass3Data; ULONG IsolateInterStaTraffic; RT_802_11_ACL AccessControlList; /* EDCA QoS */ /*BOOLEAN bWmmCapable;*/ /* 0:disable WMM, 1:enable WMM */ BOOLEAN bDLSCapable; /* 0:disable DLS, 1:enable DLS */ /* Why need the parameter: 2009/09/22 1. iwpriv ra0 set WmmCapable=0 2. iwpriv ra0 set WirelessMode=9 3. iwpriv ra0 set WirelessMode=0 4. iwpriv ra0 set SSID=SampleAP After the 4 commands, WMM is still enabled. So we need the parameter to recover WMM Capable flag. No the problem in station mode. */ BOOLEAN bWmmCapableOrg; /* origin Wmm Capable in non-11n mode */ /* ` WPS segment */ WSC_LV_INFO WscIEBeacon; WSC_LV_INFO WscIEProbeResp; #ifdef WSC_AP_SUPPORT WSC_CTRL WscControl; WSC_SECURITY_MODE WscSecurityMode; #endif /* WSC_AP_SUPPORT */ #ifdef IDS_SUPPORT UINT32 RcvdConflictSsidCount; UINT32 RcvdSpoofedAssocRespCount; UINT32 RcvdSpoofedReassocRespCount; UINT32 RcvdSpoofedProbeRespCount; UINT32 RcvdSpoofedBeaconCount; UINT32 RcvdSpoofedDisassocCount; UINT32 RcvdSpoofedAuthCount; UINT32 RcvdSpoofedDeauthCount; UINT32 RcvdSpoofedUnknownMgmtCount; UINT32 RcvdReplayAttackCount; CHAR RssiOfRcvdConflictSsid; CHAR RssiOfRcvdSpoofedAssocResp; CHAR RssiOfRcvdSpoofedReassocResp; CHAR RssiOfRcvdSpoofedProbeResp; CHAR RssiOfRcvdSpoofedBeacon; CHAR RssiOfRcvdSpoofedDisassoc; CHAR RssiOfRcvdSpoofedAuth; CHAR RssiOfRcvdSpoofedDeauth; CHAR RssiOfRcvdSpoofedUnknownMgmt; CHAR RssiOfRcvdReplayAttack; #endif /* IDS_SUPPORT */ /* YF@20120417: Avoid connecting to AP in Poor Env, value 0 fOr disable. */ CHAR AssocReqRssiThreshold; CHAR RssiLowForStaKickOut; #ifdef CONFIG_DOT11U_INTERWORKING GAS_CTRL GASCtrl; #endif #ifdef CONFIG_HOTSPOT HOTSPOT_CTRL HotSpotCtrl; #endif #ifdef CONFIG_DOT11V_WNM WNM_CTRL WNMCtrl; #endif #ifdef SPECIFIC_TX_POWER_SUPPORT CHAR TxPwrAdj; #endif /* SPECIFIC_TX_POWER_SUPPORT */ #ifdef RT_CFG80211_SUPPORT /* Extra IEs for (Re)Association Response provided by wpa_supplicant. E.g, WPS & P2P & WFD...etc */ UCHAR AssocRespExtraIe[512]; UINT32 AssocRespExtraIeLen; #endif /* RT_CFG80211_SUPPORT */ #ifdef MT_MAC ULONG WriteBcnDoneTime[MAX_TIME_RECORD]; ULONG BcnDmaDoneTime[MAX_TIME_RECORD]; UCHAR bcn_not_idle_time; UINT32 bcn_recovery_num; ULONG TXS_TSF[MAX_TIME_RECORD]; ULONG TXS_SN[MAX_TIME_RECORD]; UCHAR timer_loop; #endif /* MT_MAC */ #ifdef ROUTING_TAB_SUPPORT BOOLEAN bRoutingTabInit; UINT32 RoutingTabFlag; NDIS_SPIN_LOCK RoutingTabLock; ROUTING_ENTRY *pRoutingEntryPool; LIST_HEADER RoutingEntryFreeList; LIST_HEADER RoutingTab[ROUTING_HASH_TAB_SIZE]; #endif /* ROUTING_TAB_SUPPORT */ #ifdef WAPP_SUPPORT UCHAR ESPI_AC_BE[3]; UCHAR ESPI_AC_BK[3]; UCHAR ESPI_AC_VO[3]; UCHAR ESPI_AC_VI[3]; #endif struct conn_sta_info conn_sta; } BSS_STRUCT; #endif /* CONFIG_AP_SUPPORT */ /* configuration common to OPMODE_AP as well as OPMODE_STA */ typedef struct _COMMON_CONFIG { BOOLEAN bCountryFlag; UCHAR CountryCode[4]; #ifdef EXT_BUILD_CHANNEL_LIST UCHAR Geography; UCHAR DfsType; PUCHAR pChDesp; #endif /* EXT_BUILD_CHANNEL_LIST */ PUCHAR pChDesc2G; PUCHAR pChDesc5G; UCHAR CountryRegion; /* Enum of country region, 0:FCC, 1:IC, 2:ETSI, 3:SPAIN, 4:France, 5:MKK, 6:MKK1, 7:Israel */ UCHAR CountryRegionForABand; /* Enum of country region for A band */ UCHAR cfg_wmode; UCHAR SavedPhyMode; USHORT Dsifs; /* in units of usec */ ULONG PacketFilter; /* Packet filter for receiving */ /* UINT8 RegulatoryClass[MAX_NUM_OF_REGULATORY_CLASS]; *//* unify to using get_regulatory_class from driver table */ USHORT BeaconPeriod; /* Channel Group*/ UCHAR ChGrpEn; UCHAR ChGrpChannelList[MAX_NUM_OF_CHANNELS]; UCHAR ChGrpChannelNum; UCHAR ExpectedACKRate[MAX_LEN_OF_SUPPORTED_RATES]; ULONG BasicRateBitmap; /* backup basic ratebitmap */ ULONG BasicRateBitmapOld; /* backup basic ratebitmap */ BOOLEAN bInServicePeriod; UCHAR EtherTrafficBand; UCHAR WfFwdDisabled; BOOLEAN bAPSDAC_BE; BOOLEAN bAPSDAC_BK; BOOLEAN bAPSDAC_VI; BOOLEAN bAPSDAC_VO; #if defined(DOT11Z_TDLS_SUPPORT) || defined(CFG_TDLS_SUPPORT) BOOLEAN TDLS_bAPSDAC_BE; BOOLEAN TDLS_bAPSDAC_BK; BOOLEAN TDLS_bAPSDAC_VI; BOOLEAN TDLS_bAPSDAC_VO; UCHAR TDLS_MaxSPLength; #endif /* defined(DOT11Z_TDLS_SUPPORT) || defined(CFG_TDLS_SUPPORT) */ /* because TSPEC can modify the APSD flag, we need to keep the APSD flag requested in association stage from the station; we need to recover the APSD flag after the TSPEC is deleted. */ BOOLEAN bACMAPSDBackup[4]; /* for delivery-enabled & trigger-enabled both */ BOOLEAN bACMAPSDTr[4]; /* no use */ UCHAR MaxSPLength; BOOLEAN bNeedSendTriggerFrame; BOOLEAN bAPSDForcePowerSave; /* Force power save mode, should only use in APSD-STAUT */ ULONG TriggerTimerCount; REG_TRANSMIT_SETTING RegTransmitSetting; /*registry transmit setting. this is for reading registry setting only. not useful. */ UCHAR TxRate; /* Same value to fill in TXD. TxRate is 6-bit */ UCHAR MaxTxRate; /* RATE_1, RATE_2, RATE_5_5, RATE_11 */ UCHAR TxRateIndex; /* Tx rate index in Rate Switch Table */ UCHAR MinTxRate; /* RATE_1, RATE_2, RATE_5_5, RATE_11 */ UCHAR RtsRate; /* RATE_xxx */ UCHAR MlmeRate; /* RATE_xxx, used to send MLME frames */ UCHAR BasicMlmeRate; /* Default Rate for sending MLME frames */ UCHAR TxPower; /* in unit of mW */ UINT8 ucTxPowerPercentage[DBDC_BAND_NUM]; /* 0~100 % */ UCHAR PowerUpenable[DBDC_BAND_NUM]; CHAR cPowerUpCckOfdm[DBDC_BAND_NUM][POWER_UP_CATEGORY_RATE_NUM]; CHAR cPowerUpHt20[DBDC_BAND_NUM][POWER_UP_CATEGORY_RATE_NUM]; CHAR cPowerUpHt40[DBDC_BAND_NUM][POWER_UP_CATEGORY_RATE_NUM]; CHAR cPowerUpVht20[DBDC_BAND_NUM][POWER_UP_CATEGORY_RATE_NUM]; CHAR cPowerUpVht40[DBDC_BAND_NUM][POWER_UP_CATEGORY_RATE_NUM]; CHAR cPowerUpVht80[DBDC_BAND_NUM][POWER_UP_CATEGORY_RATE_NUM]; CHAR cPowerUpVht160[DBDC_BAND_NUM][POWER_UP_CATEGORY_RATE_NUM]; UCHAR SKUenable[DBDC_BAND_NUM]; UCHAR SKUTableIdx; CHAR cTxPowerCompBackup[DBDC_BAND_NUM][SKU_TABLE_SIZE][SKU_TX_SPATIAL_STREAM_NUM]; UCHAR PERCENTAGEenable[DBDC_BAND_NUM]; UCHAR BFBACKOFFenable[DBDC_BAND_NUM]; UINT8 CCKTxStream[DBDC_BAND_NUM]; UCHAR ucEDCCACtrl[DBDC_BAND_NUM]; #if defined(RLM_CAL_CACHE_SUPPORT) || defined(PRE_CAL_TRX_SET2_SUPPORT) UCHAR CalCacheApply; #endif /* defined(RLM_CAL_CACHE_SUPPORT) || defined(PRE_CAL_TRX_SET2_SUPPORT) */ UINT8 ThermalRecalMode; UINT8 ucTxPowerDefault[DBDC_BAND_NUM]; /* keep for TxPowerPercentage */ UINT8 PwrConstraint; #ifdef DOT11_N_SUPPORT BACAP_STRUC BACapability; /* NO USE = 0XFF ; IMMED_BA =1 ; DELAY_BA=0 */ BACAP_STRUC REGBACapability; /* NO USE = 0XFF ; IMMED_BA =1 ; DELAY_BA=0 */ #endif /* DOT11_N_SUPPORT */ BOOLEAN dbdc_mode; ENUM_DBDC_MODE eDBDC_mode; #ifdef DOT11_VHT_AC BOOLEAN force_vht; UCHAR vht_cent_ch; UCHAR vht_cent_ch2; UCHAR vht_mcs_cap; UCHAR vht_nss_cap; USHORT vht_tx_hrate; USHORT vht_rx_hrate; BOOLEAN ht20_forbid; BOOLEAN g_band_256_qam; #ifdef VHT_MU_MIMO BOOLEAN vht_mu_mimo; #endif /* VHT_MU_MIMO */ #endif /* DOT11_VHT_AC */ IOT_STRUC IOTestParm; /* 802.11n InterOpbility Test Parameter; */ ULONG TxPreamble; /* Rt802_11PreambleLong, Rt802_11PreambleShort, Rt802_11PreambleAuto */ BOOLEAN bUseZeroToDisableFragment; /* Microsoft use 0 as disable */ ULONG UseBGProtection; /* 0: auto, 1: always use, 2: always not use */ BOOLEAN bUseShortSlotTime; /* 0: disable, 1 - use short slot (9us) */ BOOLEAN bEnableTxBurst; /* 1: enble TX PACKET BURST (when BA is established or AP is not a legacy WMM AP), 0: disable TX PACKET BURST */ BOOLEAN bAggregationCapable; /* 1: enable TX aggregation when the peer supports it */ BOOLEAN bPiggyBackCapable; /* 1: enable TX piggy-back according MAC's version */ BOOLEAN bIEEE80211H; /* 1: enable IEEE802.11h spec. */ UCHAR RDDurRegion; /* Region of radar detection */ ULONG DisableOLBCDetect; /* 0: enable OLBC detect; 1 disable OLBC detect */ #ifdef TPC_SUPPORT BOOLEAN b80211TPC; #endif /* TPC_SUPPORT */ #ifdef DOT11_N_SUPPORT BOOLEAN bRdg; #endif /* DOT11_N_SUPPORT */ QOS_CAPABILITY_PARM APQosCapability; /* QOS capability of the current associated AP */ EDCA_PARM APEdcaParm[WMM_NUM]; /* EDCA parameters of the current associated AP */ QBSS_LOAD_PARM APQbssLoad; /* QBSS load of the current associated AP */ UCHAR AckPolicy[WMM_NUM_OF_AC]; /* ACK policy of the specified AC. see ACK_xxx */ /* a bitmap of BOOLEAN flags. each bit represent an operation status of a particular */ /* BOOLEAN control, either ON or OFF. These flags should always be accessed via */ /* OPSTATUS_TEST_FLAG(), OPSTATUS_SET_FLAG(), OP_STATUS_CLEAR_FLAG() macros. */ /* see fOP_STATUS_xxx in RTMP_DEF.C for detail bit definition */ ULONG OpStatusFlags; BOOLEAN NdisRadioStateOff; /*For HCT 12.0, set this flag to TRUE instead of called MlmeRadioOff. */ ABGBAND_STATE BandState; /* For setting BBP used on B/G or A mode. */ #ifdef MT_DFS_SUPPORT DFS_PARAM DfsParameter; #endif #ifdef CARRIER_DETECTION_SUPPORT CARRIER_DETECTION_STRUCT CarrierDetect; #endif /* CARRIER_DETECTION_SUPPORT */ #ifdef DOT11_N_SUPPORT /* HT */ HT_CAPABILITY_IE HtCapability; /*This IE is used with channel switch announcement element when changing to a new 40MHz. */ /*This IE is included in channel switch ammouncement frames 7.4.1.5, beacons, probe Rsp. */ NEW_EXT_CHAN_IE NewExtChanOffset; /*7.3.2.20A, 1 if extension channel is above the control channel, 3 if below, 0 if not present */ EXT_CAP_INFO_ELEMENT ExtCapIE; /* this is the extened capibility IE appreed in MGMT frames. Doesn't need to update once set in Init. */ #ifdef DOT11N_DRAFT3 BOOLEAN bBssCoexEnable; /* Following two paramters now only used for the initial scan operation. the AP only do bandwidth fallback when BssCoexApCnt > BssCoexApCntThr By default, the "BssCoexApCntThr" is set as 0 in "UserCfgInit()". */ UCHAR BssCoexApCntThr; UCHAR BssCoexApCnt; UCHAR Bss2040CoexistFlag; /* bit 0: bBssCoexistTimerRunning, bit 1: NeedSyncAddHtInfo. */ RALINK_TIMER_STRUCT Bss2040CoexistTimer; UCHAR Bss2040NeedFallBack; /* 1: Need Fall back to 20MHz */ /*This IE is used for 20/40 BSS Coexistence. */ BSS_2040_COEXIST_IE BSS2040CoexistInfo; USHORT Dot11OBssScanPassiveDwell; /* Unit : TU. 5~1000 */ USHORT Dot11OBssScanActiveDwell; /* Unit : TU. 10~1000 */ USHORT Dot11BssWidthTriggerScanInt; /* Unit : Second */ USHORT Dot11OBssScanPassiveTotalPerChannel; /* Unit : TU. 200~10000 */ USHORT Dot11OBssScanActiveTotalPerChannel; /* Unit : TU. 20~10000 */ USHORT Dot11BssWidthChanTranDelayFactor; USHORT Dot11OBssScanActivityThre; /* Unit : percentage */ ULONG Dot11BssWidthChanTranDelay; /* multiple of (Dot11BssWidthTriggerScanInt * Dot11BssWidthChanTranDelayFactor) */ ULONG CountDownCtr; /* CountDown Counter from (Dot11BssWidthTriggerScanInt * Dot11BssWidthChanTranDelayFactor) */ BSS_2040_COEXIST_IE LastBSSCoexist2040; BSS_2040_COEXIST_IE BSSCoexist2040; TRIGGER_EVENT_TAB TriggerEventTab; UCHAR ChannelListIdx; BOOLEAN bOverlapScanning; BOOLEAN bBssCoexNotify; #endif /* DOT11N_DRAFT3 */ BOOLEAN bSeOff; UINT8 ucAntennaIndex; BOOLEAN bMIMOPSEnable; BOOLEAN bBADecline; BOOLEAN bDisableReordering; BOOLEAN bForty_Mhz_Intolerant; BOOLEAN bExtChannelSwitchAnnouncement; BOOLEAN bRcvBSSWidthTriggerEvents; ULONG LastRcvBSSWidthTriggerEventsTime; UCHAR TxBASize; BOOLEAN bRalinkBurstMode; UINT32 RestoreBurstMode; #endif /* DOT11_N_SUPPORT */ #ifdef DOT11_VHT_AC UINT32 cfg_vht; VHT_CAP_INFO vht_info; VHT_CAP_IE vht_cap_ie; BOOLEAN bNonVhtDisallow; /* Disallow non-VHT connection */ #endif /* DOT11_VHT_AC */ #ifdef SYSTEM_LOG_SUPPORT /* Enable wireless event */ BOOLEAN bWirelessEvent; #endif /* SYSTEM_LOG_SUPPORT */ BOOLEAN bWiFiTest; /* Enable this parameter for WiFi test */ /* Tx & Rx Stream number selection */ UCHAR TxStream; UCHAR RxStream; /* transmit phy mode, trasmit rate for Multicast. */ /* #ifdef MCAST_RATE_SPECIFIC UCHAR McastTransmitMcs; UCHAR McastTransmitPhyMode; #endif // MCAST_RATE_SPECIFIC */ BOOLEAN bHardwareRadio; /* Hardware controlled Radio enabled */ #ifdef WSC_INCLUDED /* WSC hardware push button function 0811 */ UINT8 WscHdrPshBtnCheckCount; #endif /* WSC_INCLUDED */ NDIS_SPIN_LOCK MeasureReqTabLock; PMEASURE_REQ_TAB pMeasureReqTab; NDIS_SPIN_LOCK TpcReqTabLock; PTPC_REQ_TAB pTpcReqTab; /* transmit phy mode, trasmit rate for Multicast. */ #ifdef MCAST_RATE_SPECIFIC HTTRANSMIT_SETTING MCastPhyMode; HTTRANSMIT_SETTING MCastPhyMode_5G; #endif /* MCAST_RATE_SPECIFIC */ #ifdef RTMP_RBUS_SUPPORT ULONG CID; ULONG CN; #endif /* RTMP_RBUS_SUPPORT */ BOOLEAN HT_DisallowTKIP; /* Restrict the encryption type in 11n HT mode */ #ifdef DOT11K_RRM_SUPPORT BOOLEAN VoPwrConstraintTest; #endif /* DOT11K_RRM_SUPPORT */ BOOLEAN HT_Disable; /* 1: disable HT function; 0: enable HT function */ #if defined(NEW_RATE_ADAPT_SUPPORT) || defined(RATE_ADAPT_AGBS_SUPPORT) USHORT lowTrafficThrd; /* Threshold for reverting to default MCS when traffic is low */ SHORT TrainUpRuleRSSI; /* If TrainUpRule=2 then use Hybrid rule when RSSI < TrainUpRuleRSSI */ USHORT TrainUpLowThrd; /* QuickDRS Hybrid train up low threshold */ USHORT TrainUpHighThrd; /* QuickDRS Hybrid train up high threshold */ BOOLEAN TrainUpRule; /* QuickDRS train up criterion: 0=>Throughput, 1=>PER, 2=> Throughput & PER */ #endif /* defined(NEW_RATE_ADAPT_SUPPORT) || defined(RATE_ADAPT_AGBS_SUPPORT) */ #ifdef STREAM_MODE_SUPPORT #define STREAM_MODE_STA_NUM 4 UCHAR StreamMode; /* 0=disabled, 1=enable for 1SS, 2=enable for 2SS, 3=enable for 1,2SS */ UCHAR StreamModeMac[STREAM_MODE_STA_NUM][MAC_ADDR_LEN]; UINT16 StreamModeMCS; /* Bit map for enabling Stream Mode based on MCS */ #endif /* STREAM_MODE_SUPPORT */ #ifdef DOT11_N_SUPPORT #ifdef TXBF_SUPPORT ULONG ITxBfTimeout; ULONG ETxBfTimeout; ULONG ETxBfEnCond; /* Enable sending of sounding and beamforming */ ULONG MUTxRxEnable; /* Enable MUTxRxEnable */ BOOLEAN ETxBfNoncompress; /* Force non-compressed Sounding Response */ BOOLEAN ETxBfIncapable; /* Report Incapable of BF in TX BF Capabilities */ #ifdef TXBF_DYNAMIC_DISABLE UINT_8 ucAutoSoundingCtrl; /* Initial AutoSoundingCtrl for rStaRecBf */ #endif /* TXBF_DYNAMIC_DISABLE */ #endif /* TXBF_SUPPORT */ #endif /* DOT11_N_SUPPORT */ #ifdef RTMP_MAC_PCI BOOLEAN bPCIeBus; /* The adapter runs over PCIe bus */ #endif /* RTMP_MAC_PCI */ #ifdef WSC_INCLUDED BOOLEAN WscPBCOverlap; WSC_STA_PBC_PROBE_INFO WscStaPbcProbeInfo; #endif /* WSC_INCLUDED */ #ifdef CONFIG_ZTE_RADIO_ONOFF BOOLEAN bRadioEnable; #endif /* CONFIG_ZTE_RADIO_ONOFF */ #ifdef MICROWAVE_OVEN_SUPPORT MO_CFG_STRUCT MO_Cfg; /* data structure for mitigating microwave interference */ #endif /* MICROWAVE_OVEN_SUPPORT */ /* TODO: need to integrate with MICROWAVE_OVEN_SUPPORT */ #ifdef DYNAMIC_VGA_SUPPORT LNA_VGA_CTL_STRUCT lna_vga_ctl; #endif /* DYNAMIC_VGA_SUPPORT */ #ifdef RTMP_UDMA_SUPPORT BOOLEAN bUdmaFlag; UCHAR UdmaPortNum; #endif/*RTMP_UDMA_SUPPORT*/ BOOLEAN bStopReadTemperature; /* avoid race condition between FW/driver */ BOOLEAN bTXRX_RXV_ON; BOOLEAN ManualTxop; ULONG ManualTxopThreshold; UCHAR ManualTxopUpBound; UCHAR ManualTxopLowBound; #ifdef REDUCE_TCP_ACK_SUPPORT UINT32 ReduceAckEnable; UINT32 ReduceAckProbability; UINT32 ReduceAckTimeout; UINT32 ReduceAckCnxTimeout; #endif #ifdef WHNAT_SUPPORT BOOLEAN whnat_en; #endif /*WHNAT_SUPPORT*/ } COMMON_CONFIG, *PCOMMON_CONFIG; #ifdef CFG_TDLS_SUPPORT typedef struct _CFG_TDLS_STRUCT { /* For TPK handshake */ UCHAR ANonce[32]; /* Generated in Message 1, random variable */ UCHAR SNonce[32]; /* Generated in Message 2, random variable */ ULONG KeyLifetime; /* Use type= 'Key Lifetime Interval' unit: Seconds, min lifetime = 300 seconds */ UCHAR TPK[LEN_PMK]; /* TPK-KCK(16 bytes) for MIC + TPK-TP (16 bytes) for data */ UCHAR TPKName[LEN_PMK_NAME]; BOOLEAN IneedKey; BOOLEAN bCfgTDLSCapable; /* 0:disable TDLS, 1:enable TDLS ; using supplicant sm */ BOOLEAN TdlsChSwitchSupp; BOOLEAN TdlsPsmSupp; UINT8 TdlsLinkCount; UINT8 TdlsDialogToken; CFG_TDLS_ENTRY TDLSEntry[MAX_NUM_OF_CFG_TDLS_ENTRY]; /* Channel Switch */ UCHAR CHSWPeerMacAddr[MAC_ADDR_LEN]; BOOLEAN bDoingPeriodChannelSwitch; BOOLEAN IamInOffChannel; USHORT ChSwitchTime; USHORT ChSwitchTimeout; UINT BaseChannelStayTime; UINT OffChannelStayTime; RALINK_TIMER_STRUCT BaseChannelSwitchTimer; /* Use to channel switch */ USHORT BaseChannel; USHORT BaseChannelBW; USHORT OrigTargetOffChannel; USHORT TargetOffChannel; USHORT TargetOffChannelBW; USHORT TargetOffChannelExt; BOOLEAN bChannelSwitchInitiator; BOOLEAN IsentCHSW; } CFG_TDLS_STRUCT, *PCFG_TDLS_STRUCT; #endif /* CFG_TDLS_SUPPORT */ #ifdef RTMP_RBUS_SUPPORT #ifdef VIDEO_TURBINE_SUPPORT /* Video Mode related configuration */ typedef struct _AP_VIDEO_CONFIG { BOOLEAN Enable; BOOLEAN ClassifierEnable; BOOLEAN HighTxMode; UCHAR TxPwr; BOOLEAN VideoMCSEnable; UCHAR VideoMCS; UCHAR TxBASize; BOOLEAN TxLifeTimeMode; /* 1: Packet Life Time mode, 0: Retry Limit mode */ UCHAR TxLifeTime; UINT16 TxRetryLimit; } AP_VIDEO_STRUCT, *PAP_VIDEO_STRUCT; #endif /* VIDEO_TURBINE_SUPPORT */ #endif /* RTMP_RBUS_SUPPORT */ #ifdef CONFIG_AP_SUPPORT /*************************************************************************** * AP related data structures **************************************************************************/ /* AUTH-RSP State Machine Aux data structure */ typedef struct _AP_MLME_AUX { UCHAR Addr[MAC_ADDR_LEN]; USHORT Alg; CHAR Challenge[CIPHER_TEXT_LEN]; } AP_MLME_AUX, *PAP_MLME_AUX; #endif /* CONFIG_AP_SUPPORT */ typedef struct _STA_TR_ENTRY { UINT32 EntryType; struct wifi_dev *wdev; UCHAR wcid; /* func_tb_idx used to indicate following index: in ApCfg.ApCliTab in pAd->MeshTab in WdsTab.MacTab */ UCHAR func_tb_idx; UCHAR Addr[MAC_ADDR_LEN]; /* Tx Info */ USHORT NonQosDataSeq; USHORT TxSeq[NUM_OF_TID]; QUEUE_HEADER tx_queue[WMM_QUE_NUM]; QUEUE_HEADER ps_queue; UINT enqCount; UINT TokenCount[WMM_QUE_NUM]; INT ps_qbitmap; UCHAR ps_state; UCHAR retrieve_start_state; UCHAR token_enq_all_fail; BOOLEAN tx_pend_for_agg[WMM_QUE_NUM]; NDIS_SPIN_LOCK txq_lock[WMM_QUE_NUM]; NDIS_SPIN_LOCK ps_queue_lock; NDIS_SPIN_LOCK ps_sync_lock; UINT deq_cnt; UINT deq_bytes; ULONG PsQIdleCount; BOOLEAN enq_cap; BOOLEAN deq_cap; /* STA status */ UCHAR bssid[MAC_ADDR_LEN]; BOOLEAN bIAmBadAtheros; /* Flag if this is Atheros chip that has IOT problem. We need to turn on RTS/CTS protection. */ BOOLEAN isCached; UCHAR PortSecured; UCHAR PsMode; UCHAR FlgPsModeIsWakeForAWhile; /* wake up for a while until a condition */ BOOLEAN LockEntryTx; /* TRUE = block to WDS Entry traffic, FALSE = not. */ UCHAR CurrTxRate; #ifdef VENDOR_FEATURE1_SUPPORT /* total 128B, use UINT32 to avoid alignment problem */ UINT32 HeaderBuf[32]; /* (total 128B) TempBuffer for TX_INFO + TX_WI + 802.11 Header + padding + AMSDU SubHeader + LLC/SNAP */ UCHAR HdrPadLen; /* padding length*/ UCHAR MpduHeaderLen; /* 802.11 header + LLC/SNAP not including padding */ UCHAR wifi_hdr_len; /* 802.11 header */ UINT16 Protocol; #endif /* VENDOR_FEATURE1_SUPPORT */ #ifdef DOT11_N_SUPPORT UINT32 CachedBuf[16]; /* UINT (4 bytes) for alignment */ USHORT RXBAbitmap; /* fill to on-chip RXWI_BA_BITMASK in 8.1.3RX attribute entry format */ USHORT TXBAbitmap; /* This bitmap as originator, only keep in software used to mark AMPDU bit in TXWI */ USHORT tx_amsdu_bitmap; USHORT TXAutoBAbitmap; USHORT BADeclineBitmap; USHORT BARecWcidArray[NUM_OF_TID]; /* The mapping wcid of recipient session. if RXBAbitmap bit is masked */ USHORT BAOriWcidArray[NUM_OF_TID]; /* The mapping wcid of originator session. if TXBAbitmap bit is masked */ USHORT BAOriSequence[NUM_OF_TID]; /* The mapping wcid of originator session. if TXBAbitmap bit is masked */ UCHAR MpduDensity; UCHAR MaxRAmpduFactor; UCHAR AMsduSize; UCHAR MmpsMode; /* MIMO power save mode. */ #endif /* DOT11_N_SUPPORT */ #ifdef CONFIG_AP_SUPPORT #ifdef MAC_REPEATER_SUPPORT BOOLEAN bReptCli; BOOLEAN bReptEthCli; UCHAR MatchReptCliIdx; UCHAR ReptCliAddr[MAC_ADDR_LEN]; ULONG ReptCliIdleCount; #endif /* MAC_REPEATER_SUPPORT */ #endif /* CONFIG_AP_SUPPORT */ #ifdef TXBF_SUPPORT UCHAR TxSndgType; NDIS_SPIN_LOCK TxSndgLock; /* ETxBF */ UCHAR bfState; UCHAR sndgMcs; UCHAR sndgBW; UCHAR sndg0Mcs; INT sndg0Snr0, sndg0Snr1, sndg0Snr2; #ifdef ETXBF_EN_COND3_SUPPORT UCHAR bestMethod; UCHAR sndgRateIdx; UCHAR bf0Mcs, sndg0RateIdx, bf0RateIdx; UCHAR sndg1Mcs, bf1Mcs, sndg1RateIdx, bf1RateIdx; INT sndg1Snr0, sndg1Snr1, sndg1Snr2; #endif /* ETXBF_EN_COND3_SUPPORT */ UCHAR noSndgCnt; UCHAR eTxBfEnCond; UCHAR noSndgCntThrd, ndpSndgStreams; UCHAR iTxBfEn; RALINK_TIMER_STRUCT eTxBfProbeTimer; BOOLEAN phyETxBf; /* True=>Set ETxBF bit in PHY rate */ BOOLEAN phyITxBf; /* True=>Set ITxBF bit in PHY rate */ UCHAR lastNonBfRate; /* Last good non-BF rate */ BOOLEAN lastRatePhyTxBf; /* For Quick Check. True if last rate was BF */ USHORT BfTxQuality[MAX_TX_RATE_INDEX + 1]; /* Beamformed TX Quality */ COUNTER_TXBF TxBFCounters; /* TxBF Statistics */ UINT LastETxCount; /* Used to compute %BF statistics */ UINT LastITxCount; UINT LastTxCount; #endif /* TXBF_SUPPORT */ #ifdef VHT_TXBF_SUPPORT UINT8 snd_dialog_token; #ifdef SOFT_SOUNDING BOOLEAN snd_reqired; HTTRANSMIT_SETTING snd_rate; #endif /* SOFT_SOUNDING */ #endif /* VHT_TXBF_SUPPORT */ /* Statistics related parameters */ UINT32 ContinueTxFailCnt; ULONG TimeStamp_toTxRing; ULONG NoDataIdleCount; #ifdef CONFIG_AP_SUPPORT LARGE_INTEGER TxPackets; LARGE_INTEGER RxPackets; ULONG TxBytes; ULONG RxBytes; #endif /* CONFIG_AP_SUPPORT */ ULONG one_sec_tx_pkts; ULONG avg_tx_pkts; UINT8 previous_amsdu_state[NUM_OF_UP]; INT previous_sn[NUM_OF_UP]; INT cacheSn[NUM_OF_UP]; #ifdef MT_SDIO_ADAPTIVE_TC_RESOURCE_CTRL #if TC_PAGE_BASED_DEMAND INT32 TotalPageCount[WMM_QUE_NUM]; #endif #endif /* Used to ignore consecutive PS poll. set: when we get a PS poll. clear: when a PS data is sent or two period passed. */ UINT8 PsDeQWaitCnt; UINT8 OmacIdx; struct _STA_REC_CTRL_T StaRec; #ifdef DBG_AMSDU #define TIME_SLOT_NUMS 10 UINT32 amsdu_1; UINT32 amsdu_1_rec[TIME_SLOT_NUMS]; UINT32 amsdu_2; UINT32 amsdu_2_rec[TIME_SLOT_NUMS]; UINT32 amsdu_3; UINT32 amsdu_3_rec[TIME_SLOT_NUMS]; UINT32 amsdu_4; UINT32 amsdu_4_rec[TIME_SLOT_NUMS]; #endif UINT16 token_cnt; #ifdef FQ_SCH_SUPPORT struct fq_stainfo_type fq_sta_rec; #endif } STA_TR_ENTRY; typedef struct _MAC_TABLE_ENTRY { UINT32 EntryType; UINT32 EntryState; struct wifi_dev *wdev; PVOID pAd; struct _MAC_TABLE_ENTRY *pNext; /* A bitmap of BOOLEAN flags. each bit represent an operation status of a particular BOOLEAN control, either ON or OFF. These flags should always be accessed via CLIENT_STATUS_TEST_FLAG(), CLIENT_STATUS_SET_FLAG(), CLIENT_STATUS_CLEAR_FLAG() macros. see fOP_STATUS_xxx in RTMP_DEF.C for detail bit definition. fCLIENT_STATUS_AMSDU_INUSED */ ULONG ClientStatusFlags; ULONG cli_cap_flags; HTTRANSMIT_SETTING HTPhyMode, MaxHTPhyMode; /* For transmit phy setting in TXWI. */ HTTRANSMIT_SETTING MinHTPhyMode; /* wcid: tr_tb_idx: func_tb_idx used to indicate following index: in ApCfg.ApCliTab in pAd->MeshTab in WdsTab.MacTab apidx: should remove this */ UCHAR wcid; UCHAR tr_tb_idx; UCHAR func_tb_idx; UCHAR apidx; /* MBSS number */ BOOLEAN isRalink; BOOLEAN bIAmBadAtheros; /* Flag if this is Atheros chip that has IOT problem. We need to turn on RTS/CTS protection. */ #ifdef MBO_SUPPORT BOOLEAN bIndicateNPC; BOOLEAN bIndicateCDC; MBO_STA_CH_PREF_CDC_INFO MboStaInfoNPC; MBO_STA_CH_PREF_CDC_INFO MboStaInfoCDC; #endif /* MBO_SUPPORT */ UCHAR Addr[MAC_ADDR_LEN]; #ifdef CONFIG_AP_SUPPORT BSS_STRUCT *pMbss; #ifdef APCLI_SUPPORT PVOID pApCli; #ifdef ROAMING_ENHANCE_SUPPORT BOOLEAN bRoamingRefreshDone; #endif /* ROAMING_ENHANCE_SUPPORT */ #endif /* APCLI_SUPPORT */ #endif /* CONFIG_AP_SUPPORT */ /* STATE MACHINE Status */ USHORT Aid; /* in range 1~2007, with bit 14~15 = b'11, e.g., 0xc001~0xc7d7 */ SST Sst; AUTH_STATE AuthState; /* for SHARED KEY authentication state machine used only */ /* Rx status related parameters */ RSSI_SAMPLE RssiSample; UINT32 LastTxRate; UINT32 LastRxRate; SHORT freqOffset; /* Last RXWI FOFFSET */ SHORT freqOffsetValid; /* Set when freqOffset field has been updated */ #ifdef AIR_MONITOR UCHAR mnt_idx[BAND_NUM]; UCHAR mnt_band; #endif /* AIR_MONITOR */ /* WPA/WPA2 4-way database */ UCHAR EnqueueEapolStartTimerRunning; /* Enqueue EAPoL-Start for triggering EAP SM */ struct _SECURITY_CONFIG SecConfig; UCHAR RSNIE_Len; UCHAR RSN_IE[MAX_LEN_OF_RSNIE]; UCHAR CMTimerRunning; NDIS_802_11_PRIVACY_FILTER PrivacyFilter; /* PrivacyFilter enum for 802.1X */ UCHAR bssid[MAC_ADDR_LEN]; BOOLEAN IsReassocSta; /* Indicate whether this is a reassociation procedure */ ULONG NoDataIdleCount; ULONG AssocDeadLine; UINT16 StationKeepAliveCount; /* unit: second */ USHORT CapabilityInfo; UCHAR PsMode; UCHAR FlgPsModeIsWakeForAWhile; /* wake up for a while until a condition */ UCHAR VirtualTimeout; /* peer power save virtual timeout */ #ifdef WDS_SUPPORT BOOLEAN LockEntryTx; /* TRUE = block to WDS Entry traffic, FALSE = not. */ #endif /* WDS_SUPPORT */ #ifdef CONFIG_AP_SUPPORT #ifdef MAC_REPEATER_SUPPORT BOOLEAN bReptCli; BOOLEAN bReptEthCli; BOOLEAN bReptEthBridgeCli; UCHAR MatchReptCliIdx; UCHAR ReptCliAddr[MAC_ADDR_LEN]; ULONG ReptCliIdleCount; #endif /* MAC_REPEATER_SUPPORT */ #endif /* CONFIG_AP_SUPPORT */ UINT32 StaConnectTime; /* the live time of this station since associated with AP */ UINT32 StaIdleTimeout; /* idle timeout per entry */ #ifdef UAPSD_SUPPORT /* these UAPSD states are used on the fly */ /* 0:AC_BK, 1:AC_BE, 2:AC_VI, 3:AC_VO */ BOOLEAN bAPSDCapablePerAC[4]; /* for trigger-enabled */ BOOLEAN bAPSDDeliverEnabledPerAC[4]; /* for delivery-enabled */ UCHAR MaxSPLength; BOOLEAN bAPSDAllAC; /* 1: all AC are delivery-enabled U-APSD */ QUEUE_HEADER UAPSDQueue[WMM_NUM_OF_AC]; /* queue for each U-APSD */ USHORT UAPSDQIdleCount; /* U-APSD queue timeout */ PQUEUE_ENTRY pUAPSDEOSPFrame; /* the last U-APSD frame */ USHORT UAPSDTxNum; /* total U-APSD frame number */ BOOLEAN bAPSDFlagEOSPOK; /* 1: EOSP frame is tx by ASIC */ BOOLEAN bAPSDFlagSPStart; /* 1: SP is started */ /* need to use unsigned long, because time parameters in OS is defined as unsigned long */ unsigned long UAPSDTimeStampLast; /* unit: 1000000/OS_HZ */ BOOLEAN bAPSDFlagSpRoughUse; /* 1: use rough SP (default: accurate) */ /* we will set the flag when PS-poll frame is received and clear it when statistics handle. if the flag is set when PS-poll frame is received then calling statistics handler to clear it. */ BOOLEAN bAPSDFlagLegacySent; /* 1: Legacy PS sent but yet statistics handle */ #endif /* UAPSD_SUPPORT */ #ifdef STREAM_MODE_SUPPORT UINT32 StreamModeMACReg; /* MAC reg used to control stream mode for this client. 0=>No stream mode */ #endif /* STREAM_MODE_SUPPORT */ UINT FIFOCount; UINT DebugFIFOCount; UINT DebugTxCount; #ifdef DOT11_N_SUPPORT USHORT NoBADataCountDown; #endif /* DOT11_N_SUPPORT */ /* ==================================================== */ enum RATE_ADAPT_ALG rateAlg; /* TODO: shiang-usw, use following parameters to replace "RateLen/MaxSupportedRate" */ UCHAR RateLen; UCHAR MaxSupportedRate; BOOLEAN bAutoTxRateSwitch; UCHAR CurrTxRate; UCHAR CurrTxRateIndex; UCHAR lastRateIdx; UCHAR *pTable; /* Pointer to this entry's Tx Rate Table */ #ifdef NEW_RATE_ADAPT_SUPPORT UCHAR lowTrafficCount; UCHAR fewPktsCnt; BOOLEAN perThrdAdj; UCHAR mcsGroup;/* the mcs group to be tried */ #endif /* NEW_RATE_ADAPT_SUPPORT */ #ifdef AGS_SUPPORT AGS_CONTROL AGSCtrl; /* AGS control */ #endif /* AGS_SUPPORT */ /* to record the each TX rate's quality. 0 is best, the bigger the worse. */ USHORT TxQuality[MAX_TX_RATE_INDEX + 1]; BOOLEAN fLastSecAccordingRSSI; UCHAR LastSecTxRateChangeAction; /* 0: no change, 1:rate UP, 2:rate down */ CHAR LastTimeTxRateChangeAction; /* Keep last time value of LastSecTxRateChangeAction */ ULONG LastTxOkCount; /* TxSuccess count in last Rate Adaptation interval */ UCHAR LastTxPER; /* Tx PER in last Rate Adaptation interval */ UCHAR PER[MAX_TX_RATE_INDEX + 1]; UINT32 CurrTxRateStableTime; /* # of second in current TX rate */ UCHAR TxRateUpPenalty; /* extra # of second penalty due to last unstable condition */ BOOLEAN fgGband256QAMSupport; UCHAR SupportRateMode; /* 1: CCK 2:OFDM 4: HT, 8:VHT */ UINT8 SupportCCKMCS; UINT8 SupportOFDMMCS; #ifdef DOT11_N_SUPPORT UINT32 SupportHTMCS; #ifdef DOT11_VHT_AC UINT16 SupportVHTMCS1SS; UINT16 SupportVHTMCS2SS; UINT16 SupportVHTMCS3SS; UINT16 SupportVHTMCS4SS; #endif /* DOT11_VHT_AC */ #endif /* DOT11_N_SUPPORT */ #ifdef PEER_DELBA_TX_ADAPT BOOLEAN bPeerDelBaTxAdaptEn; #endif /* PEER_DELBA_TX_ADAPT */ #ifdef MFB_SUPPORT UCHAR lastLegalMfb; /* last legal mfb which is used to set rate */ BOOLEAN isMfbChanged; /* purpose: true when mfb has changed but the new mfb is not adopted for Tx */ struct _RTMP_RA_LEGACY_TB *LegalMfbRS; BOOLEAN fLastChangeAccordingMfb; NDIS_SPIN_LOCK fLastChangeAccordingMfbLock; /* Tx MRQ */ BOOLEAN toTxMrq; UCHAR msiToTx, mrqCnt; /*mrqCnt is used to count down the inverted-BF mrq to be sent */ /* Rx mfb */ UCHAR pendingMfsi; /* Tx MFB */ BOOLEAN toTxMfb; UCHAR mfbToTx; UCHAR mfb0, mfb1; #endif /* MFB_SUPPORT */ #ifdef TXBF_SUPPORT UCHAR TxSndgType; NDIS_SPIN_LOCK TxSndgLock; /* ETxBF */ UCHAR bfState; UCHAR sndgMcs; UCHAR sndgBW; UCHAR sndg0Mcs; INT sndg0Snr0, sndg0Snr1, sndg0Snr2; #ifdef ETXBF_EN_COND3_SUPPORT UCHAR bestMethod; UCHAR sndgRateIdx; UCHAR bf0Mcs, sndg0RateIdx, bf0RateIdx; UCHAR sndg1Mcs, bf1Mcs, sndg1RateIdx, bf1RateIdx; INT sndg1Snr0, sndg1Snr1, sndg1Snr2; #endif /* ETXBF_EN_COND3_SUPPORT */ UCHAR noSndgCnt; UCHAR eTxBfEnCond; UCHAR noSndgCntThrd, ndpSndgStreams; UCHAR iTxBfEn; RALINK_TIMER_STRUCT eTxBfProbeTimer; BOOLEAN phyETxBf; /* True=>Set ETxBF bit in PHY rate */ BOOLEAN phyITxBf; /* True=>Set ITxBF bit in PHY rate */ UCHAR lastNonBfRate; /* Last good non-BF rate */ BOOLEAN lastRatePhyTxBf; /* For Quick Check. True if last rate was BF */ USHORT BfTxQuality[MAX_TX_RATE_INDEX + 1]; /* Beamformed TX Quality */ COUNTER_TXBF TxBFCounters; /* TxBF Statistics */ UINT LastETxCount; /* Used to compute %BF statistics */ UINT LastITxCount; UINT LastTxCount; #ifdef MT_MAC VENDOR_BF_SETTING rStaBfRecVendorUpdate; TXBF_PFMU_STA_INFO rStaRecBf; #endif #endif /* TXBF_SUPPORT */ #ifdef VHT_TXBF_SUPPORT UINT8 snd_dialog_token; #ifdef SOFT_SOUNDING BOOLEAN snd_reqired; HTTRANSMIT_SETTING snd_rate; #endif /* SOFT_SOUNDING */ #endif /* VHT_TXBF_SUPPORT */ UINT32 OneSecTxNoRetryOkCount; UINT32 OneSecTxRetryOkCount; UINT32 OneSecTxFailCount; UINT32 OneSecRxLGICount; /* unicast-to-me Long GI count */ UINT32 OneSecRxSGICount; /* unicast-to-me Short GI count */ UINT32 ContinueTxFailCnt; ULONG TimeStamp_toTxRing; /*==================================================== */ EXT_CAP_INFO_ELEMENT ext_cap; struct _vendor_ie_cap vendor_ie; #ifdef DOT11_N_SUPPORT HT_CAPABILITY_IE HTCapability; USHORT RXBAbitmap; /* fill to on-chip RXWI_BA_BITMASK in 8.1.3RX attribute entry format */ USHORT TXBAbitmap; /* This bitmap as originator, only keep in software used to mark AMPDU bit in TXWI */ USHORT tx_amsdu_bitmap; USHORT TXAutoBAbitmap; USHORT BADeclineBitmap; USHORT BARecWcidArray[NUM_OF_TID]; /* The mapping wcid of recipient session. if RXBAbitmap bit is masked */ USHORT BAOriWcidArray[NUM_OF_TID]; /* The mapping wcid of originator session. if TXBAbitmap bit is masked */ USHORT BAOriSequence[NUM_OF_TID]; /* The mapping wcid of originator session. if TXBAbitmap bit is masked */ UCHAR MpduDensity; UCHAR MaxRAmpduFactor; UCHAR AMsduSize; UINT32 amsdu_limit_len; UINT32 amsdu_limit_len_adjust; UCHAR MmpsMode; /* MIMO power save mode. */ #ifdef DOT11N_DRAFT3 UCHAR BSS2040CoexistenceMgmtSupport; BOOLEAN bForty_Mhz_Intolerant; #endif /* DOT11N_DRAFT3 */ #ifdef DOT11_VHT_AC VHT_CAP_IE vht_cap_ie; /* only take effect if ext_cap.operating_mode_notification = 1 */ BOOLEAN force_op_mode; OPERATING_MODE operating_mode; #endif /* DOT11_VHT_AC */ #endif /* DOT11_N_SUPPORT */ #ifdef CONFIG_DOT11V_WNM UCHAR BssTransitionManmtSupport; #endif /* CONFIG_DOT11V_WNM */ BOOLEAN bWscCapable; UCHAR Receive_EapolStart_EapRspId; UINT32 TXMCSExpected[MAX_MCS_SET]; UINT32 TXMCSSuccessful[MAX_MCS_SET]; UINT32 TXMCSFailed[MAX_MCS_SET]; UINT32 TXMCSAutoFallBack[MAX_MCS_SET][MAX_MCS_SET]; #ifdef DOT11R_FT_SUPPORT FT_MDIE_INFO MdIeInfo; FT_FTIE_INFO FtIeInfo; UINT8 InitialMDIE[5]; UINT8 InitialFTIE[256]; UINT InitialFTIE_Len; UCHAR FT_PMK_R0[32]; UCHAR FT_PMK_R0_NAME[16]; UCHAR FT_PMK_R1[32]; UCHAR FT_PMK_R1_NAME[16]; UCHAR PTK_NAME[16]; UCHAR FT_UCipher[4]; UCHAR FT_Akm[4]; UCHAR FT_PTK[LEN_MAX_PTK]; /* 512 bits max, KCK(16)+KEK(16)+TK(32) */ UCHAR FT_Status; UCHAR FT_R1kh_CacheMiss_Times; #ifdef R1KH_HARD_RETRY UCHAR FT_R1kh_CacheMiss_Hard; RTMP_OS_COMPLETION ack_r1kh; #endif /* R1KH_HARD_RETRY */ #endif /* DOT11R_FT_SUPPORT */ #ifdef DOT11K_RRM_SUPPORT RRM_EN_CAP_IE RrmEnCap; #endif /* DOT11K_RRM_SUPPORT */ #ifdef CONFIG_AP_SUPPORT LARGE_INTEGER TxPackets; LARGE_INTEGER RxPackets; ULONG TxBytes; ULONG RxBytes; #endif /* CONFIG_AP_SUPPORT */ ULONG OneSecTxBytes; ULONG OneSecRxBytes; ULONG AvgTxBytes; ULONG AvgRxBytes; ULONG one_sec_tx_pkts; ULONG avg_tx_pkts; ULONG one_sec_tx_succ_pkts; #if defined(DOT11Z_TDLS_SUPPORT) || defined(CFG_TDLS_SUPPORT) UINT16 TdlsTxFailCount; UINT32 TdlsKeyLifeTimeCount; UCHAR MatchTdlsEntryIdx; /* indicate the index in pAd->StaCfg[0].DLSEntry */ #endif /* defined(DOT11Z_TDLS_SUPPORT) || defined(CFG_TDLS_SUPPORT) // */ #ifdef SMART_ANTENNA UINT32 saLstTxNoRtyCnt; UINT32 saLstTxRtyCnt; UINT32 saLstTxFailCnt; UCHAR *pRateTable; UCHAR orgTxRateCol; CHAR baseAvgRSSI[3]; INT32 curRSSI[3]; INT32 cntRSSI[3]; INT32 rssi_zero_cnt[3]; INT32 sumSNR[3]; INT32 cntSNR[3]; INT32 sumPreSNR[3]; INT32 cntPreSNR[3]; CHAR avgRssi[3]; CHAR prevAvgRssi[3]; CHAR avgSNR[3]; CHAR avgPreSNR[3]; CHAR curAvgRSSI[3]; UINT32 hwTxSucCnt; UINT32 hwTxRtyCnt; ULONG calcTime; UINT32 saTxCnt; UINT32 saRxCnt; ULONG mcsUsage[33]; ULONG curMcsApplyTime; CHAR mcsInUse; VOID *pTrainEntry; #endif /* SMART_ANTENNA */ ULONG ChannelQuality; /* 0..100, Channel Quality Indication for Roaming */ #ifdef CONFIG_HOTSPOT_R2 UCHAR IsWNMReqValid; UCHAR QosMapSupport; UCHAR DscpExceptionCount; USHORT DscpRange[8]; USHORT DscpException[21]; struct wnm_req_data *ReqData; struct _sta_hs_info hs_info; UCHAR OSEN_IE_Len; UCHAR OSEN_IE[MAX_LEN_OF_RSNIE]; #endif /* CONFIG_HOTSPOT_R2 */ #if defined(CONFIG_HOTSPOT_R2) || defined(CONFIG_DOT11V_WNM) UCHAR IsBTMReqValid; UCHAR IsKeep; UINT16 BTMDisassocCount; BOOLEAN bBSSMantSTASupport; struct btm_req_data *ReqbtmData; #endif BOOLEAN bACMBit[WMM_NUM_OF_AC]; RA_ENTRY_INFO_T RaEntry; RA_INTERNAL_INFO_T RaInternal; UINT32 ConnectionType; #ifdef RACTRL_FW_OFFLOAD_SUPPORT UINT8 TxStatRspCnt; UINT32 TotalTxSuccessCnt; /* Accumulated Tx success count from N9 (WTBL) */ #endif #ifdef HTC_DECRYPT_IOT UINT32 HTC_ICVErrCnt; /* keep the ICV Error cnt of HTC Rx Cnt */ UCHAR HTC_AAD_OM_Force; /* when reach the threshold, force set the WTBL.DW2.AAD_OM to 1 */ UINT32 HTC_AAD_OM_CountDown; /* settling time (1 count 1 second) for start count HTC_ICVErrCnt */ UCHAR HTC_AAD_OM_Freeze; /* Treat the entry's AAD_OM setting is correct now */ #endif /* HTC_DECRYPT_IOT */ #ifdef PN_UC_REPLAY_DETECTION_SUPPORT UINT64 CCMP_UC_PN[NUM_OF_TID]; #endif /* PN_UC_REPLAY_DETECTION_SUPPORT */ UINT64 CCMP_BC_PN[4]; BOOLEAN Init_CCMP_BC_PN_Passed[4]; BOOLEAN AllowUpdateRSC; } MAC_TABLE_ENTRY, *PMAC_TABLE_ENTRY; typedef enum _MAC_ENT_STATUS_ { /* fAnyStationInPsm */ MAC_TB_ANY_PSM = 0x1, /* fAnyStationBadAtheros Check if any Station is atheros 802.11n Chip. We need to use RTS/CTS with Atheros 802,.11n chip. */ MAC_TB_ANY_ATH = 0x2, /* fAnyTxOPForceDisable Check if it is necessary to disable BE TxOP */ MAC_TB_FORCE_TxOP = 0x4, /* fAllStationAsRalink Check if all stations are ralink-chipset */ MAC_TB_ALL_RALINK = 0x8, /* fAnyStationIsLegacy Check if I use legacy rate to transmit to my BSS Station */ MAC_TB_ANY_LEGACY = 0x10, /* fAnyStationNonGF Check if any Station can't support GF */ MAC_TB_ANY_NON_GF = 0x20, /* fAnyStation20Only */ MAC_TB_ANY_HT20 = 0x40, /* fAnyStationMIMOPSDynamic Check if any Station is MIMO Dynamic */ MAC_TB_ANY_MIMO_DYNAMIC = 0x80, /* fAnyBASession Check if there is BA session. Force turn on RTS/CTS */ MAC_TB_ANY_BA = 0x100, /* fAnyStaFortyIntolerant */ MAC_TB_ANY_40_INTOlERANT = 0x200, /* fAllStationGainGoodMCS Check if all stations more than MCS threshold */ MAC_TB_ALL_GOOD_MCS = 0x400, /* fAnyStationIsHT Check if still has any station set the Intolerant bit on! */ MAC_TB_ANY_HT = 0x800, /* fAnyWapiStation */ MAC_TB_ANY_WAPI = 0x1000, } MAC_ENT_STATUS; #define BAND_NUM_MAX 2 typedef struct _MAC_TABLE { MAC_TABLE_ENTRY * Hash[HASH_TABLE_SIZE]; MAC_TABLE_ENTRY Content[MAX_LEN_OF_MAC_TABLE]; STA_TR_ENTRY tr_entry[MAX_LEN_OF_TR_TABLE]; /* Be care in mgmt_entrytb.c MacTableReset() will NdisZeroMemory(&pAd->MacTab.Size, sizeof(MAC_TABLE)-offsetof(MAC_TABLE, Size)); above need to be backup, klock's warnnig @118489 should be mark as not an issue. */ UINT16 Size; QUEUE_HEADER McastPsQueue; ULONG PsQIdleCount; MAC_ENT_STATUS sta_status; BOOLEAN fAnyStationInPsm; BOOLEAN fAnyStationBadAtheros; /* Check if any Station is atheros 802.11n Chip. We need to use RTS/CTS with Atheros 802,.11n chip. */ BOOLEAN fAnyTxOPForceDisable; /* Check if it is necessary to disable BE TxOP */ BOOLEAN fAllStationAsRalink[2]; /* Check if all stations are ralink-chipset */ BOOLEAN fCurrentStaBw40; /* Check if only one STA w/ BW40 */ #ifdef DOT11_N_SUPPORT BOOLEAN fAnyStationIsLegacy; /* Check if I use legacy rate to transmit to my BSS Station/ */ BOOLEAN fAnyStationNonGF; /* Check if any Station can't support GF. */ BOOLEAN fAnyStation20Only; /* Check if any Station can't support GF. */ BOOLEAN fAnyStationMIMOPSDynamic; /* Check if any Station is MIMO Dynamic */ BOOLEAN fAnyBASession; /* Check if there is BA session. Force turn on RTS/CTS */ BOOLEAN fAnyStaFortyIntolerant; /* Check if still has any station set the Intolerant bit on! */ BOOLEAN fAllStationGainGoodMCS; /* Check if all stations more than MCS threshold */ #endif /* DOT11_N_SUPPORT */ USHORT MsduLifeTime; /* life time for PS packet */ #ifdef OUI_CHECK_SUPPORT UCHAR oui_mgroup_cnt; UINT32 repeater_wcid_error_cnt; UINT32 repeater_bm_wcid_error_cnt; #endif /*OUI_CHECK_SUPPORT*/ } MAC_TABLE, *PMAC_TABLE; typedef struct _MONITOR_STRUCT { struct wifi_dev wdev; INT CurrentMonitorMode; BOOLEAN bMonitorInitiated; BOOLEAN bMonitorOn; } MONITOR_STRUCT; #ifdef CONFIG_AP_SUPPORT /*************************************************************************** * AP WDS related data structures **************************************************************************/ #ifdef WDS_SUPPORT typedef struct _WDS_COUNTER { LARGE_INTEGER ReceivedFragmentCount; LARGE_INTEGER TransmittedFragmentCount; ULONG ReceivedByteCount; ULONG TransmittedByteCount; ULONG RxErrorCount; ULONG TxErrors; LARGE_INTEGER MulticastReceivedFrameCount; ULONG RxNoBuffer; } WDS_COUNTER, *PWDS_COUNTER; typedef struct _WDS_ENTRY { BOOLEAN Valid; UCHAR Addr[MAC_ADDR_LEN]; ULONG NoDataIdleCount; struct _WDS_ENTRY *pNext; } WDS_ENTRY, *PWDS_ENTRY; typedef struct _RT_802_11_WDS_ENTRY { struct wifi_dev wdev; UCHAR Valid; UCHAR PeerWdsAddr[MAC_ADDR_LEN]; UCHAR MacTabMatchWCID; /* ASIC */ UCHAR KeyIdx; CIPHER_KEY WdsKey; UCHAR PhyOpMode; WDS_COUNTER WdsCounter; } RT_802_11_WDS_ENTRY, *PRT_802_11_WDS_ENTRY; typedef struct _WDS_TABLE { UCHAR Mode; UINT Size; NDIS_SPIN_LOCK WdsTabLock; BOOLEAN flg_wds_init; RT_802_11_WDS_ENTRY WdsEntry[MAX_WDS_ENTRY]; } WDS_TABLE, *PWDS_TABLE; #endif /* WDS_SUPPORT */ #ifdef MAC_REPEATER_SUPPORT #define MAX_IGNORE_AS_REPEATER_ENTRY_NUM 32 typedef struct _MBSS_TO_CLI_LINK_MAP_T { struct wifi_dev *mbss_wdev; struct wifi_dev *cli_link_wdev; } MBSS_TO_CLI_LINK_MAP_T; /* * ------------------------NOTE!!!!-------------------------- * This structure must keep sync with partner driver. * if new member will be added, it's better to append to end. * ---------------------------------------------------------- */ typedef struct _REPEATER_CLIENT_ENTRY { /*BOOLEAN bValid;*/ BOOLEAN CliEnable; BOOLEAN CliValid; BOOLEAN bEthCli; UCHAR MatchApCliIdx; UCHAR MatchLinkIdx; UCHAR MacTabWCID; UCHAR CliConnectState; /* 0: disconnect 1: connecting 2: connected */ ULONG CtrlCurrState; ULONG SyncCurrState; ULONG AuthCurrState; ULONG AssocCurrState; RALINK_TIMER_STRUCT ApCliAssocTimer, ApCliAuthTimer; USHORT AuthReqCnt; USHORT AssocReqCnt; ULONG CliTriggerTime; /* For WPA countermeasures */ ULONG LastMicErrorTime; /* record last MIC error time */ BOOLEAN bBlockAssoc; /* Block associate attempt for 60 seconds after counter measure occurred. */ UCHAR OriginalAddress[MAC_ADDR_LEN]; UCHAR CurrentAddress[MAC_ADDR_LEN]; PVOID pAd; struct _REPEATER_CLIENT_ENTRY *pNext; ULONG Disconnect_Sub_Reason; ULONG LinkDownReason; BSS_INFO_ARGUMENT_T bss_info_argument; RTMP_OS_COMPLETION free_ack; UCHAR BandIdx; /*link on which Apcli link bandidx.*/ RALINK_TIMER_STRUCT ReptCliResetTimer; struct wifi_dev *wdev; /*pointer to the linking Apcli interface wdev. */ #ifdef FAST_EAPOL_WAR BOOLEAN pre_entry_alloc; #endif /* FAST_EAPOL_WAR */ } REPEATER_CLIENT_ENTRY, *PREPEATER_CLIENT_ENTRY; typedef struct _REPEATER_CLIENT_ENTRY_MAP { PREPEATER_CLIENT_ENTRY pReptCliEntry; struct _REPEATER_CLIENT_ENTRY_MAP *pNext; } REPEATER_CLIENT_ENTRY_MAP, *PREPEATER_CLIENT_ENTRY_MAP; typedef struct _INVAILD_TRIGGER_MAC_ENTRY { UCHAR MacAddr[MAC_ADDR_LEN]; UCHAR entry_idx; BOOLEAN bInsert; struct _INVAILD_TRIGGER_MAC_ENTRY *pNext; } INVAILD_TRIGGER_MAC_ENTRY, *PINVAILD_TRIGGER_MAC_ENTRY; typedef struct _REPEATER_CTRL_STRUCT { INVAILD_TRIGGER_MAC_ENTRY IgnoreAsRepeaterEntry[MAX_IGNORE_AS_REPEATER_ENTRY_NUM]; INVAILD_TRIGGER_MAC_ENTRY * IgnoreAsRepeaterHash[HASH_TABLE_SIZE]; UCHAR IgnoreAsRepeaterEntrySize; } REPEATER_CTRL_STRUCT, *PREPEATER_CTRL_STRUCT; #endif /* MAC_REPEATER_SUPPORT */ typedef struct _REPEATER_ADAPTER_DATA_TABLE { bool Enabled; void *EntryLock; void **CliHash; void **MapHash; void *Wdev_ifAddr; void *Wdev_ifAddr_DBDC; } REPEATER_ADAPTER_DATA_TABLE; /*************************************************************************** * AP APCLI related data structures **************************************************************************/ typedef struct _APCLI_STRUCT { struct wifi_dev wdev; BOOLEAN ApCliInit; /* Set it as 1 if ApCli is initialized */ BOOLEAN Enable; /* Set it as 1 if the apcli interface was configured to "1" or by iwpriv cmd "ApCliEnable" */ BOOLEAN Valid; /* Set it as 1 if the apcli interface associated success to remote AP. */ #ifdef FAST_EAPOL_WAR BOOLEAN pre_entry_alloc; #endif /* FAST_EAPOL_WAR */ MLME_AUX MlmeAux; /* temporary settings used during MLME state machine */ UCHAR MacTabWCID; /*WCID value, which point to the entry of ASIC Mac table. */ UCHAR SsidLen; CHAR Ssid[MAX_LEN_OF_SSID]; #ifdef APCLI_CONNECTION_TRIAL UCHAR TrialCh; /* the channel that Apcli interface will try to connect the rootap locates */ RALINK_TIMER_STRUCT TrialConnectTimer; RALINK_TIMER_STRUCT TrialConnectPhase2Timer; RALINK_TIMER_STRUCT TrialConnectRetryTimer; MAC_TABLE_ENTRY oldRootAP; USHORT NewRootApRetryCnt; #endif /* APCLI_CONNECTION_TRIAL */ UCHAR ifIndex; PVOID pAd; UCHAR CfgSsidLen; CHAR CfgSsid[MAX_LEN_OF_SSID]; UCHAR CfgApCliBssid[MAC_ADDR_LEN]; ULONG ApCliRcvBeaconTime_MlmeEnqueueForRecv; ULONG ApCliRcvBeaconTime_MlmeEnqueueForRecv_2; ULONG ApCliRcvBeaconTime; ULONG ApCliLinkUpTime; USHORT ApCliBeaconPeriod; ULONG CtrlCurrState; ULONG SyncCurrState; ULONG AuthCurrState; ULONG AssocCurrState; ULONG WpaPskCurrState; ULONG LinkDownReason; ULONG Disconnect_Sub_Reason; #ifdef APCLI_AUTO_CONNECT_SUPPORT USHORT ProbeReqCnt; BOOLEAN AutoConnectFlag; #endif /* APCLI_AUTO_CONNECT_SUPPORT */ USHORT AuthReqCnt; USHORT AssocReqCnt; UCHAR MpduDensity; BOOLEAN bPeerExist; /* TRUE if we hear Root AP's beacon */ /* Security segment */ /* Add to support different cipher suite for WPA2/WPA mode */ NDIS_802_11_ENCRYPTION_STATUS GroupCipher; /* Multicast cipher suite */ NDIS_802_11_ENCRYPTION_STATUS PairCipher; /* Unicast cipher suite */ BOOLEAN bMixCipher; /* Indicate current Pair & Group use different cipher suites */ USHORT RsnCapability; UCHAR PSK[100]; /* reserve PSK key material */ UCHAR PSKLen; UCHAR PMK[LEN_MAX_PMK]; /* WPA PSK mode PMK */ UCHAR GTK[32]; /* GTK from authenticator */ /* store RSN_IE built by driver */ UCHAR RSN_IE[MAX_LEN_OF_RSNIE]; /* The content saved here should be convert to little-endian format. */ UCHAR RSNIE_Len; /* For WPA countermeasures */ ULONG LastMicErrorTime; /* record last MIC error time */ ULONG MicErrCnt; /* Should be 0, 1, 2, then reset to zero (after disassoiciation). */ BOOLEAN bBlockAssoc; /* Block associate attempt for 60 seconds after counter measure occurred. */ /* For WPA-PSK supplicant state */ UCHAR ReplayCounter[LEN_KEY_DESC_REPLAY]; UCHAR SNonce[32]; /* SNonce for WPA-PSK */ UCHAR GNonce[32]; /* GNonce for WPA-PSK from authenticator */ /* WPS segment */ #ifdef WSC_AP_SUPPORT WSC_CTRL WscControl; #endif /* WSC_AP_SUPPORT */ /* Transmitting segment */ UCHAR RxMcsSet[16]; PSPOLL_FRAME PsPollFrame; HEADER_802_11 NullFrame; RTMP_OS_COMPLETION ifdown_complete; RTMP_OS_COMPLETION linkdown_complete; BOOLEAN need_wait; /*MBSS_STATISTICS MbssStat;*/ ULONG TxCount; ULONG RxCount; ULONG ReceivedByteCount; ULONG TransmittedByteCount; ULONG RxErrorCount; ULONG RxDropCount; ULONG OneSecTxBytes; ULONG OneSecRxBytes; #ifdef APCLI_CERT_SUPPORT BOOLEAN NeedFallback; #endif /* APCLI_CERT_SUPPORT */ ULONG TxErrorCount; ULONG TxDropCount; ULONG ucPktsTx; ULONG ucPktsRx; ULONG mcPktsTx; ULONG mcPktsRx; ULONG bcPktsTx; ULONG bcPktsRx; UINT8 dync_txop_histogram[5]; #ifdef CON_WPS UINT ConWpsApCliModeScanDoneStatus; #endif /* CON_WPS */ } APCLI_STRUCT, *PAPCLI_STRUCT; typedef struct _AP_ADMIN_CONFIG { USHORT CapabilityInfo; /* Multiple SSID */ UCHAR BssidNum; UCHAR MacMask; BSS_STRUCT MBSSID[HW_BEACON_MAX_NUM]; ULONG IsolateInterStaTrafficBTNBSSID; #ifdef APCLI_SUPPORT UCHAR ApCliInfRunned; /* Number of ApClient interface which was running. value from 0 to MAX_APCLI_INTERFACE */ UINT8 ApCliNum; BOOLEAN FlgApCliIsUapsdInfoUpdated; APCLI_STRUCT ApCliTab[MAX_APCLI_NUM]; /*AP-client */ #ifdef APCLI_AUTO_CONNECT_SUPPORT APCLI_CONNECT_SCAN_TYPE ApCliAutoConnectType[MAX_APCLI_NUM]; /* 0 : User Trigger SCAN Mode, 1 : Driver Trigger SCAN Mode, this is for Sigma DUT test , Peer AP may change BSSID, but SSID is the same */ BOOLEAN ApCliAutoConnectRunning[MAX_APCLI_NUM]; BOOLEAN ApCliAutoConnectChannelSwitching; UINT8 ApCliAutoBWAdjustCnt[MAX_APCLI_NUM]; #ifdef BT_APCLI_SUPPORT BOOLEAN ApCliAutoBWBTSupport; #endif #endif /* APCLI_AUTO_CONNECT_SUPPORT */ BOOLEAN bPartialScanEnable[MAX_APCLI_NUM]; BOOLEAN bPartialScanning[MAX_APCLI_NUM]; ULONG ApCliIssueScanTime[MAX_APCLI_NUM]; #ifdef ROAMING_ENHANCE_SUPPORT BOOLEAN bRoamingEnhance; #endif /* ROAMING_ENHANCE_SUPPORT */ #endif /* APCLI_SUPPORT */ struct wifi_dev *ScanReqwdev; #ifdef MAC_REPEATER_SUPPORT BOOLEAN bMACRepeaterEn; UCHAR MACRepeaterOuiMode; UINT8 EthApCliIdx; UCHAR RepeaterCliSize; NDIS_SPIN_LOCK ReptCliEntryLock; REPEATER_CLIENT_ENTRY * ReptCliHash[HASH_TABLE_SIZE]; REPEATER_CLIENT_ENTRY_MAP * ReptMapHash[HASH_TABLE_SIZE]; UCHAR BridgeAddress[MAC_ADDR_LEN]; REPEATER_CTRL_STRUCT ReptControl; NDIS_SPIN_LOCK CliLinkMapLock; MBSS_TO_CLI_LINK_MAP_T MbssToCliLinkMap[HW_BEACON_MAX_NUM]; REPEATER_CLIENT_ENTRY *pRepeaterCliPool; REPEATER_CLIENT_ENTRY_MAP *pRepeaterCliMapPool; #endif /* MAC_REPEATER_SUPPORT */ /* for wpa */ RALINK_TIMER_STRUCT CounterMeasureTimer; UCHAR CMTimerRunning; UCHAR BANClass3Data; LARGE_INTEGER aMICFailTime; LARGE_INTEGER PrevaMICFailTime; ULONG MICFailureCounter; NDIS_AP_802_11_PMKID PMKIDCache; RSSI_SAMPLE RssiSample; ULONG NumOfAvgRssiSample; BOOLEAN bAutoChannelAtBootup; /* 0: disable, 1: enable */ ChannelSel_Alg AutoChannelAlg; /* Alg for selecting Channel */ #ifdef AP_SCAN_SUPPORT UINT32 ACSCheckTime[DBDC_BAND_NUM]; /* Periodic timer to trigger Auto Channel Selection (unit: second) */ UINT32 ACSCheckCount[DBDC_BAND_NUM]; /* if ACSCheckCount > ACSCheckTime, then do ACS check */ #endif /* AP_SCAN_SUPPORT */ BOOLEAN bAvoidDfsChannel; /* 0: disable, 1: enable */ BOOLEAN bIsolateInterStaTraffic; BOOLEAN bHideSsid; /* temporary latch for Auto channel selection */ ULONG ApCnt; /* max RSSI during Auto Channel Selection period */ UCHAR AutoChannel_Channel; /* channel number during Auto Channel Selection */ UCHAR current_channel_index; /* current index of channel list */ UCHAR AutoChannelSkipListNum; /* number of rejected channel list */ UCHAR AutoChannelSkipList[10]; UCHAR DtimCount; /* 0.. DtimPeriod-1 */ UCHAR DtimPeriod; /* default = 3 */ UCHAR ErpIeContent; ULONG LastOLBCDetectTime; ULONG LastNoneHTOLBCDetectTime; ULONG LastScanTime; /* Record last scan time for issue BSSID_SCAN_LIST */ RALINK_TIMER_STRUCT ApQuickResponeForRateUpTimer; BOOLEAN ApQuickResponeForRateUpTimerRunning; #ifdef IDS_SUPPORT /* intrusion detection parameter */ BOOLEAN IdsEnable; UINT32 AuthFloodThreshold; /* Authentication frame flood threshold */ UINT32 AssocReqFloodThreshold; /* Association request frame flood threshold */ UINT32 ReassocReqFloodThreshold; /* Re-association request frame flood threshold */ UINT32 ProbeReqFloodThreshold; /* Probe request frame flood threshold */ UINT32 DisassocFloodThreshold; /* Disassociation frame flood threshold */ UINT32 DeauthFloodThreshold; /* Deauthentication frame flood threshold */ UINT32 EapReqFloodThreshold; /* EAP request frame flood threshold */ UINT32 DataFloodThreshold; /* Malicious data frame flood threshold */ UINT32 RcvdAuthCount; UINT32 RcvdAssocReqCount; UINT32 RcvdReassocReqCount; UINT32 RcvdProbeReqCount; UINT32 RcvdDisassocCount; UINT32 RcvdDeauthCount; UINT32 RcvdEapReqCount; UINT32 RcvdMaliciousDataCount; /* Data Frame DDOS */ RALINK_TIMER_STRUCT IDSTimer; BOOLEAN IDSTimerRunning; #endif /* IDS_SUPPORT */ /* Indicate the maximum idle timeout */ UINT32 StaIdleTimeout; ULONG EntryLifeCheck; #ifdef IGMP_SNOOP_SUPPORT BOOLEAN IgmpSnoopEnable[DBDC_BAND_NUM]; /* 0: disable, 1: enable. */ #endif /* IGMP_SNOOP_SUPPORT */ #ifdef DOT11R_FT_SUPPORT FT_TAB FtTab; #endif /* DOT11R_FT_SUPPORT */ #ifdef CLIENT_WDS NDIS_SPIN_LOCK CliWdsTabLock; PCLIWDS_PROXY_ENTRY pCliWdsEntryPool; LIST_HEADER CliWdsEntryFreeList; LIST_HEADER CliWdsProxyTb[CLIWDS_HASH_TAB_SIZE]; #endif /* CLIENT_WDS */ UCHAR EntryClientCount; #ifdef MT_MAC UINT32 ext_mbss_enable_bitmap; UINT32 ext_mbss_tttt_enable_bitmap; #endif /*MT_MAC*/ #ifdef BAND_STEERING BOOLEAN BandSteering; UINT8 BndStrgBssIdx[HW_BEACON_MAX_NUM]; BND_STRG_CLI_TABLE BndStrgTable[DBDC_BAND_NUM]; UINT32 BndStrgHeartbeatCount; UINT32 BndStrgHeartbeatMonitor; UINT32 BndStrgHeartbeatNoChange; #endif /* BAND_STEERING */ #ifdef VENDOR_FEATURE7_SUPPORT UINT16 BSSEnabled; /* each bit stands for a BSS */ UCHAR rts_retry_cnt; /* RTS Retry Cnt */ UCHAR tx_retry_cnt; /* TX Retry Cnt */ #endif #ifdef CONFIG_HOTSPOT_R2 QOS_MAP_TABLE_T HsQosMapTable[MAX_QOS_MAP_TABLE_SIZE]; #endif /* CONFIG_HOTSPOT_R2 */ #ifdef CON_WPS UINT ConWpsApCliMode; /* means get profile from rootAp by 2G, 5G perferred or AUTO */ BOOLEAN ConWpsApCliStatus; /* status of Received the EAPOL-FAIL */ BOOLEAN ConWpsApCliDisableSetting; BOOLEAN ConWpsApDisableSetting; BOOLEAN ConWpsApCliDisabled; RALINK_TIMER_STRUCT ConWpsApCliBandMonitorTimer; BOOLEAN ConWpsMonitorTimerRunning; UINT ConWpsApcliAutoPreferIface; #endif /* CON_WPS */ #ifdef GREENAP_SUPPORT struct greenap_ctrl greenap; #endif /* GREENAP_SUPPORT */ #ifdef DOT11K_RRM_SUPPORT #ifdef CONFIG_11KV_API_SUPPORT BOOLEAN HandleNRReqbyUplayer; #endif #endif } AP_ADMIN_CONFIG; #if defined(MT7615) || defined(MT7622) || defined(P18) || defined(MT7663) #ifdef CONFIG_AP_SUPPORT typedef struct _BCN_CHECK_INFO_STRUC { UINT32 nobcncnt0; /* nobcn accumulative cnt for band 0 */ UINT32 prebcncnt0; /* previous 2.5s bcn cnt for band 0 */ UINT32 totalbcncnt0; /* total bcn cnt for band 0 */ UINT32 nobcncnt1; /* nobcn accumulative cnt for band 1 */ UINT32 prebcncnt1; /* previous 2.5s bcn cnt for band 1 */ UINT32 totalbcncnt1; /* total bcn cnt for band 1 */ } BCN_CHECK_INFO_STRUC, *PBCN_CHECK_INFO_STRUC; #endif #endif #ifdef IGMP_SNOOP_SUPPORT typedef enum _IGMP_GROUP_TYPE { MODE_IS_INCLUDE = 1, MODE_IS_EXCLUDE, CHANGE_TO_INCLUDE_MODE, CHANGE_TO_EXCLUDE_MODE, ALLOW_NEW_SOURCES, BLOCK_OLD_SOURCES } IgmpGroupType; typedef enum _MULTICAST_FILTER_ENTRY_TYPE { MCAT_FILTER_STATIC = 0, MCAT_FILTER_DYNAMIC, } MulticastFilterEntryType; typedef struct _MEMBER_ENTRY { struct _MEMBER_ENTRY *pNext; UCHAR Addr[MAC_ADDR_LEN]; /* USHORT Aid; */ } MEMBER_ENTRY, *PMEMBER_ENTRY; typedef struct _MULTICAST_FILTER_TABLE_ENTRY { BOOLEAN Valid; MulticastFilterEntryType type; /* 0: static, 1: dynamic. */ ULONG lastTime; PNET_DEV net_dev; UCHAR Addr[MAC_ADDR_LEN]; LIST_HEADER MemberList; struct _MULTICAST_FILTER_TABLE_ENTRY *pNext; } MULTICAST_FILTER_TABLE_ENTRY, *PMULTICAST_FILTER_TABLE_ENTRY; typedef struct _MULTICAST_FILTER_TABLE { UCHAR Size; PMULTICAST_FILTER_TABLE_ENTRY Hash[MAX_LEN_OF_MULTICAST_FILTER_HASH_TABLE]; MULTICAST_FILTER_TABLE_ENTRY Content[MAX_LEN_OF_MULTICAST_FILTER_TABLE]; NDIS_SPIN_LOCK MulticastFilterTabLock; NDIS_SPIN_LOCK FreeMemberPoolTabLock; MEMBER_ENTRY freeMemberPool[FREE_MEMBER_POOL_SIZE]; LIST_HEADER freeEntryList; } MULTICAST_FILTER_TABLE, *PMULTICAST_FILTER_TABLE; #endif /* IGMP_SNOOP_SUPPORT */ #ifdef DOT11_N_SUPPORT #ifdef GREENAP_SUPPORT typedef enum _RT_GREEN_AP_LEVEL { GREENAP_11BGN_STAS = 0, GREENAP_ONLY_11BG_STAS, GREENAP_WITHOUT_ANY_STAS_CONNECT } RT_GREEN_AP_LEVEL; typedef enum _GREEN_AP_SUSPEND_REASON { AP_BACKGROUND_SCAN = (1 << 0), } GREEN_AP_SUSPEND_REASON; #endif /* GREENAP_SUPPORT */ #endif /* DOT11_N_SUPPORT */ /* ----------- end of AP ---------------------------- */ #endif /* CONFIG_AP_SUPPORT */ #ifdef BLOCK_NET_IF typedef struct _BLOCK_QUEUE_ENTRY { BOOLEAN SwTxQueueBlockFlag; LIST_HEADER NetIfList; } BLOCK_QUEUE_ENTRY, *PBLOCK_QUEUE_ENTRY; #endif /* BLOCK_NET_IF */ struct wificonf { BOOLEAN bShortGI; BOOLEAN bGreenField; }; typedef struct _RTMP_DEV_INFO_ { UCHAR chipName[16]; RTMP_INF_TYPE infType; } RTMP_DEV_INFO; #ifdef DBG_DIAGNOSE #define MAX_VHT_MCS_SET 20 /* for 1ss~ 2ss with MCS0~9 */ #define DIAGNOSE_TIME 10 /* 10 sec */ struct dbg_diag_info { USHORT TxDataCnt[WMM_NUM_OF_AC]; /* Tx total data count */ USHORT TxFailCnt; USHORT RxDataCnt; /* Rx Total Data count. */ USHORT RxCrcErrCnt; #ifdef DBG_TXQ_DEPTH /* TxSwQ length in scale of 0, 1, 2, 3, 4, 5, 6, 7, >=8 */ USHORT TxSWQueCnt[WMM_NUM_OF_AC][9]; UINT32 enq_fall_cnt[WMM_NUM_OF_AC]; UINT32 deq_fail_no_resource_cnt[WMM_NUM_OF_AC]; UINT32 deq_called; UINT32 deq_round; UINT32 deq_cnt[9]; #endif /* DBG_TXQ_DEPTH */ #ifdef DBG_TX_AGG_CNT USHORT TxAggCnt; USHORT TxNonAggCnt; /* TxDMA APMDU Aggregation count in range from 0 to 15, in setp of 1. */ USHORT TxAMPDUCnt[16]; #endif /* DBG_TX_AGG_CNT */ }; typedef enum { DIAG_COND_ALL = 0, DIAG_COND_TXQ_DEPTH = 4, } DIAG_COND_STATUS; typedef struct _RtmpDiagStrcut_ { /* Diagnosis Related element */ BOOLEAN inited; UCHAR wcid; UCHAR qIdx; UCHAR ArrayStartIdx; UCHAR ArrayCurIdx; UINT32 diag_cond; struct dbg_diag_info diag_info[DIAGNOSE_TIME]; } RtmpDiagStruct; #endif /* DBG_DIAGNOSE */ /* */ /* The entry of transmit power control over MAC */ /* */ typedef struct _TX_POWER_CONTROL_OVER_MAC_ENTRY { USHORT MACRegisterOffset; /* MAC register offset */ ULONG RegisterValue; /* Register value */ } TX_POWER_CONTROL_OVER_MAC_ENTRY, *PTX_POWER_CONTROL_OVER_MAC_ENTRY; /* */ /* The maximum registers of transmit power control */ /* */ #define MAX_TX_PWR_CONTROL_OVER_MAC_REGISTERS 5 /* */ /* The configuration of the transmit power control over MAC */ /* */ typedef struct _CONFIGURATION_OF_TX_POWER_CONTROL_OVER_MAC { UCHAR NumOfEntries; /* Number of entries */ TX_POWER_CONTROL_OVER_MAC_ENTRY TxPwrCtrlOverMAC[MAX_TX_PWR_CONTROL_OVER_MAC_REGISTERS]; } CONFIGURATION_OF_TX_POWER_CONTROL_OVER_MAC, *PCONFIGURATION_OF_TX_POWER_CONTROL_OVER_MAC; /* */ /* The extension of the transmit power control over MAC */ /* */ typedef struct _TX_POWER_CONTROL_EXT_OVER_MAC { struct { ULONG TxPwrCfg0; /* MAC 0x1314 */ ULONG TxPwrCfg0Ext; /* MAC 0x1390 */ ULONG TxPwrCfg1; /* MAC 0x1318 */ ULONG TxPwrCfg1Ext; /* MAC 0x1394 */ ULONG TxPwrCfg2; /* MAC 0x131C */ ULONG TxPwrCfg2Ext; /* MAC 0x1398 */ ULONG TxPwrCfg3; /* MAC 0x1320 */ ULONG TxPwrCfg3Ext; /* MAC 0x139C */ ULONG TxPwrCfg4; /* MAC 0x1324 */ ULONG TxPwrCfg4Ext; /* MAC 0x13A0 */ ULONG TxPwrCfg5; /* MAC 0x1384 */ ULONG TxPwrCfg6; /* MAC 0x1388 */ ULONG TxPwrCfg7; /* MAC 0x13D4 */ ULONG TxPwrCfg8; /* MAC 0x13D8 */ ULONG TxPwrCfg9; /* MAC 0x13DC */ } BW20Over2Dot4G; struct { ULONG TxPwrCfg0; /* MAC 0x1314 */ ULONG TxPwrCfg0Ext; /* MAC 0x1390 */ ULONG TxPwrCfg1; /* MAC 0x1318 */ ULONG TxPwrCfg1Ext; /* MAC 0x1394 */ ULONG TxPwrCfg2; /* MAC 0x131C */ ULONG TxPwrCfg2Ext; /* MAC 0x1398 */ ULONG TxPwrCfg3; /* MAC 0x1320 */ ULONG TxPwrCfg3Ext; /* MAC 0x139C */ ULONG TxPwrCfg4; /* MAC 0x1324 */ ULONG TxPwrCfg4Ext; /* MAC 0x13A0 */ ULONG TxPwrCfg5; /* MAC 0x1384 */ ULONG TxPwrCfg6; /* MAC 0x1388 */ ULONG TxPwrCfg7; /* MAC 0x13D4 */ ULONG TxPwrCfg8; /* MAC 0x13D8 */ ULONG TxPwrCfg9; /* MAC 0x13DC */ } BW40Over2Dot4G; struct { ULONG TxPwrCfg0; /* MAC 0x1314 */ ULONG TxPwrCfg0Ext; /* MAC 0x1390 */ ULONG TxPwrCfg1; /* MAC 0x1318 */ ULONG TxPwrCfg1Ext; /* MAC 0x1394 */ ULONG TxPwrCfg2; /* MAC 0x131C */ ULONG TxPwrCfg2Ext; /* MAC 0x1398 */ ULONG TxPwrCfg3; /* MAC 0x1320 */ ULONG TxPwrCfg3Ext; /* MAC 0x139C */ ULONG TxPwrCfg4; /* MAC 0x1324 */ ULONG TxPwrCfg4Ext; /* MAC 0x13A0 */ ULONG TxPwrCfg5; /* MAC 0x1384 */ ULONG TxPwrCfg6; /* MAC 0x1388 */ ULONG TxPwrCfg7; /* MAC 0x13D4 */ ULONG TxPwrCfg8; /* MAC 0x13D8 */ ULONG TxPwrCfg9; /* MAC 0x13DC */ } BW20Over5G; struct { ULONG TxPwrCfg0; /* MAC 0x1314 */ ULONG TxPwrCfg0Ext; /* MAC 0x1390 */ ULONG TxPwrCfg1; /* MAC 0x1318 */ ULONG TxPwrCfg1Ext; /* MAC 0x1394 */ ULONG TxPwrCfg2; /* MAC 0x131C */ ULONG TxPwrCfg2Ext; /* MAC 0x1398 */ ULONG TxPwrCfg3; /* MAC 0x1320 */ ULONG TxPwrCfg3Ext; /* MAC 0x139C */ ULONG TxPwrCfg4; /* MAC 0x1324 */ ULONG TxPwrCfg4Ext; /* MAC 0x13A0 */ ULONG TxPwrCfg5; /* MAC 0x1384 */ ULONG TxPwrCfg6; /* MAC 0x1388 */ ULONG TxPwrCfg7; /* MAC 0x13D4 */ ULONG TxPwrCfg8; /* MAC 0x13D8 */ ULONG TxPwrCfg9; /* MAC 0x13DC */ } BW40Over5G; } TX_POWER_CONTROL_EXT_OVER_MAC, *PTX_POWER_CONTROL_EXT_OVER_MAC; /* For Wake on Wireless LAN */ #if (defined(WOW_SUPPORT) && defined(RTMP_MAC_USB)) || defined(NEW_WOW_SUPPORT) || defined(MT_WOW_SUPPORT) typedef struct _WOW_CFG_STRUCT { BOOLEAN bEnable; /* Enable WOW function*/ BOOLEAN bWOWFirmware; /* Enable WOW function, trigger to reload WOW-support firmware */ BOOLEAN bInBand; /* use in-band signal to wakeup system */ BOOLEAN bWowIfDownSupport; UINT8 nSelectedGPIO; /* Side band signal to wake up system */ UINT8 nDelay; /* Delay number is multiple of 3 secs, and it used to postpone the WOW function */ UINT32 nHoldTime; /* GPIO pulse hold time, unit: 1us, 0 means hold forever.*/ BOOLEAN bWoWRunning; /* WOW function is working */ UINT8 nWakeupInterface; /* PCI:0 USB:1 GPIO:2 */ UINT8 IPAddress[16]; /* Used for ARP response */ UINT8 bGPIOHighLow; /* 0: low to high, 1: high to low */ } WOW_CFG_STRUCT, *PWOW_CFG_STRUCT; typedef enum { WOW_GPIO_LOW_TO_HIGH, WOW_GPIO_HIGH_TO_LOW } WOW_GPIO_HIGH_LOW_T; typedef enum { WOW_GPIO_OOTPUT_DISABLE = 0, WOW_GPIO_OUTPUT_ENABLE = 1, } WOW_GPIO_OUTPUT_ENABLE_T; typedef enum { WOW_GPIO_OUTPUT_LEVEL_LOW = 0, WOW_GPIO_OUTPUT_LEVEL_HIGH = 1, } WOW_GPIO_OUTPUT_LEVEL_T; typedef enum { WOW_GPIO_WAKEUP_LEVEL_LOW = 0, WOW_GPIO_WAKEUP_LEVEL_HIGH = 1, } WOW_GPIO_WAKEUP_LEVEL_T; #define WOW_GPIO_LOW_TO_HIGH_PARAMETER ((WOW_GPIO_OUTPUT_ENABLE << 0) | \ (WOW_GPIO_OUTPUT_LEVEL_LOW << 1) | (WOW_GPIO_WAKEUP_LEVEL_HIGH << 2)) #define WOW_GPIO_HIGH_TO_LOW_PARAMETER ((WOW_GPIO_OUTPUT_ENABLE << 0) | \ (WOW_GPIO_OUTPUT_LEVEL_HIGH << 1) | (WOW_GPIO_WAKEUP_LEVEL_LOW << 2)); typedef enum { WOW_PKT_TO_HOST, WOW_PKT_TO_ANDES } WOW_PKT_FLOW_T; typedef enum { WOW_WAKEUP_BY_PCIE, WOW_WAKEUP_BY_USB, WOW_WAKEUP_BY_GPIO } WOW_WAKEUP_METHOD_T; typedef enum { WOW_ENABLE = 1, WOW_TRAFFIC = 3, WOW_WAKEUP = 4 } WOW_FEATURE_T; typedef enum { WOW_MASK_CFG = 1, WOW_SEC_CFG, WOW_INFRA_CFG, WOW_P2P_CFG, } WOW_CONFIG_T; enum { WOW_MAGIC_PKT, WOW_BITMAP, WOW_IPV4_TCP_SYNC, WOW_IPV6_TCP_SYNC }; typedef struct NEW_WOW_MASK_CFG_STRUCT { UINT32 Config_Type; UINT32 Function_Enable; UINT32 Detect_Mask; UINT32 Event_Mask; } NEW_WOW_MASK_CFG_STRUCT, PNEW_WOW_MASK_CFG_STRUCT; typedef struct NEW_WOW_SEC_CFG_STRUCT { UINT32 Config_Type; UINT32 WPA_Ver; UCHAR PTK[64]; UCHAR R_COUNTER[8]; UCHAR Key_Id; UCHAR Cipher_Alg; UCHAR WCID; UCHAR Group_Cipher; } NEW_WOW_SEC_CFG_STRUCT, PNEW_WOW_SEC_CFG_STRUCT; typedef struct NEW_WOW_INFRA_CFG_STRUCT { UINT32 Config_Type; UCHAR STA_MAC[6]; UCHAR AP_MAC[6]; UINT32 AP_Status; } NEW_WOW_INFRA_CFG_STRUCT, PNEW_WOW_INFRA_CFG_STRUCT; typedef struct _NEW_WOW_P2P_CFG_STRUCT { UINT32 Config_Type; UCHAR GO_MAC[6]; UCHAR CLI_MAC[6]; UINT32 P2P_Status; } NEW_WOW_P2P_CFG_STRUCT, *PNEW_WOW_P2P_CFG_STRUCT; typedef struct _NEW_WOW_PARAM_STRUCT { UINT32 Parameter; UINT32 Value; } NEW_WOW_PARAM_STRUCT, *PNEW_WOW_PARAM_STRUCT; #endif /* (defined(WOW_SUPPORT) && defined(RTMP_MAC_USB)) || defined(NEW_WOW_SUPPORT) || defined(MT_WOW_SUPPORT) */ /* Packet drop reason code */ typedef enum { PKT_ATE_ON = 1 << 8, PKT_RADAR_ON = 2 << 8, PKT_RRM_QUIET = 3 << 8, PKT_TX_STOP = 4 << 8, PKT_TX_JAM = 5 << 8, PKT_NETDEV_DOWN = 6 < 8, PKT_NETDEV_NO_MATCH = 7 << 8, PKT_NOT_ALLOW_SEND = 8 << 8, PKT_INVALID_DST = 9 << 8, PKT_INVALID_SRC = 10 << 8, PKT_INVALID_PKT_DATA = 11 << 8, PKT_INVALID_PKT_LEN = 12 << 8, PKT_INVALID_ETH_TYPE = 13 << 8, PKT_INVALID_TXBLK_INFO = 14 << 8, PKT_INVALID_SW_ENCRYPT = 15 << 8, PKT_INVALID_PKT_TYPE = 16 << 8, PKT_INVALID_PKT_MIC = 17 << 8, PKT_PORT_NOT_SECURE = 18 << 8, PKT_TSPEC_NO_MATCH = 19 << 8, PKT_NO_ASSOCED_STA = 20 << 8, PKT_INVALID_MAC_ENTRY = 21 << 8, PKT_TX_QUE_FULL = 22 << 8, PKT_TX_QUE_ADJUST = 23 << 8, PKT_PS_QUE_TIMEOUT = 24 << 8, PKT_PS_QUE_CLEAN = 25 << 8, PKT_MCAST_PS_QUE_FULL = 26 << 8, PKT_UCAST_PS_QUE_FULL = 27 << 8, PKT_RX_EAPOL_SANITY_FAIL = 28 << 8, PKT_RX_NOT_TO_KERNEL = 29 << 8, PKT_RX_MESH_SIG_FAIL = 30 << 8, PKT_APCLI_FAIL = 31 << 8, PKT_ZERO_DATA = 32 << 8, PKT_SW_DECRYPT_FAIL = 33 << 8, PKT_TX_SW_ENC_FAIL = 34 << 8, PKT_ACM_FAIL = 35 << 8, PKT_IGMP_GRP_FAIL = 36 << 8, PKT_MGMT_FAIL = 37 << 8, PKT_AMPDU_OUT_ORDER = 38 << 8, PKT_UAPSD_EOSP = 39 << 8, PKT_UAPSD_Q_FULL = 40 << 8, PKT_DRO_REASON_MAX = 41, } PKT_DROP_REASON; /* Packet drop Direction code */ typedef enum { PKT_TX = 0, PKT_RX = 1 << 31, } PKT_DROP_DIECTION; #ifdef SMART_ANTENNA /* 1. The combination of all possible training patterns = txNss : the maxima antennas used for transmission, e.g., for 3*3 device, the txNss = 3 When user try to select the antenna, they shall use following format to do the selection iwpriv ra0 set sa_ant=1,5 => it means user try to use PinHeader 1 and pinHeader 5 as the tx antenna 2. The Training sequence used for smart antenna traing pTrainSeq: is a sequence used to do antenna selection. the time of one round for the antenna selection training: totalTime = maxAntTry */ #define SA_TX_NSS_MAX_NUM 3 #define SA_DBG_LOG_MAX_CNT 10 #define SA_ENTRY_MAX_NUM 1 #define SA_DEFAULT_TX_CNT 100 #define SA_DEFAULT_TX_NSS 2 #define SA_DEFAULT_MCS_BOUND 23 #define SA_DEFAULT_MSC 5 #define SA_DEFAULT_CHK_PERIOD 200 /* 400 */ #define SA_DEFAULT_ANT_TRIAL 1 #define SA_DEFAULT_RSSI_VAR 8 /* 5 */ #define SA_DEFAULT_RSSI_THRESHOLD -80 typedef enum _RTMP_SA_OP_MODE_ { SA_MODE_NONE = 0, SA_MODE_MANUAL = 1, SA_MODE_ONESHOT = 2, SA_MODE_AUTO = 3, } RTMP_SA_OP_MODE; typedef enum _RTMP_SA_STA_RULE_ { SA_STA_BY_DEFAULT = 0, /* first in or static assign */ SA_STA_BY_RSSI = 1, } RTMP_SA_STA_RULE; typedef struct _RTMP_SA_AGSP_MAP_ { UINT8 hdrPin; UINT32 regOffset;/* The GPIO address */ UINT32 gpioBit; /* the bit field in the regOffset */ } RTMP_SA_AGSP_MAP; typedef struct _RTMP_SA_TRAIN_LOG_ELEMENT_ { UINT32 antPattern; UINT32 patternOffset; UCHAR antWeight; UCHAR candWeight; ULONG srtTime; ULONG endTime; UINT32 txMcs; UINT32 txCnt; /* txNoRtyCnt + RtyOkCnt + FailCnt */ UINT32 txNoRtyCnt; UINT32 txRtyCnt; /* RtyOkCnt + FailCnt */ UINT32 txRtyFailCnt; /* FailCnt */ UINT32 PER; /* (txRtyCnt * 100) / txCnt */ UINT32 rxCnt; INT32 sumRSSI[SA_TX_NSS_MAX_NUM]; UINT32 cntRSSI[SA_TX_NSS_MAX_NUM]; INT32 avgRSSI[SA_TX_NSS_MAX_NUM]; INT32 sumSNR[SA_TX_NSS_MAX_NUM]; UINT32 cntSNR[SA_TX_NSS_MAX_NUM]; INT32 avgSNR[SA_TX_NSS_MAX_NUM]; INT32 sumPreSNR[SA_TX_NSS_MAX_NUM]; UINT32 cntPreSNR[SA_TX_NSS_MAX_NUM]; #ifdef SA_DBG UINT32 rssiDist[SA_TX_NSS_MAX_NUM][33]; UINT32 SNRDist[SA_TX_NSS_MAX_NUM][33]; UINT32 preSNRDist[SA_TX_NSS_MAX_NUM][33]; UINT32 txMcsDist[MAX_MCS_SET]; /* the txMcs distruction cnt; */ UINT32 rxMcsDist[MAX_MCS_SET]; /* the rxMcs distruction cnt; */ #endif /* SA_DBG // */ } RTMP_SA_TRAIN_LOG_ELEMENT; typedef struct _RTMP_SA_TRAIN_LOG_ { UINT32 antPattern; int lastRnd; int firstRnd; RTMP_SA_TRAIN_LOG_ELEMENT record[SA_DBG_LOG_MAX_CNT]; } RTMP_SA_TRAIN_LOG; typedef struct _RTMP_SA_TRAIN_SEQ_ { UINT32 antPattern; RTMP_SA_AGSP_MAP *pAgspEntry; } RTMP_SA_TRAIN_SEQ; /* For SmartAntenna auto training mode, it's a three-stages loop state machine 1. Initial stage (first time) do fully scan for all antenna patterns 2. Confirm stage (second time) do fully scan for all antenna patterns if Initial stage and confirm stage results are the same => goto Monitor stage else => goto confirm stage 3. Monitor stage (third and following) Only do RSSI monitoring. if | CurrentRSSI - previousRSSI| <= 5 => stay in Monitor stage else => go to initial stage */ typedef enum { SA_INVALID_STAGE = 0, SA_INIT_STAGE = 1, SA_CONFIRM_STAGE = 2, SA_MONITOR_STAGE = 3, } RTMP_SA_TRAIN_STAGE; #define ANT_WEIGHT_SCAN_ALL 0xf0 #define ANT_WEIGHT_SCAN_AVG 0x70 #define ANT_WEIGHT_SCAN_ONE 0x10 #define ANT_WEIGHT_CAND_HIGH 0x01 #define ANT_WEIGHT_CAND_AVG 0x02 #define ANT_WEIGHT_CAND_LOW 0x03 #define ANT_WEIGHT_CAND_INIT 0xff #define ANT_SELECT_FIRST 0x01 #define ANT_SELECT_IGNORE_BASE 0x02 #define ANT_SELECT_BASE 0x04 typedef struct _RTMP_SA_TRAINING_PARAM_ { RTMP_SA_TRAIN_LOG_ELEMENT *pTrainInfo; UCHAR macAddr[MAC_ADDR_LEN]; BOOLEAN bStatic; /* Indicate if this entry assigned by user or by driver itself */ MAC_TABLE_ENTRY *pMacEntry; /* Indicate the info */ RTMP_SA_TRAIN_LOG_ELEMENT antBaseInfo; UINT32 curAntPattern; /* indicate current antenna pattern used for transmission */ UINT32 patternOffset; /* Indicate the offset of the antPattern compare to the pSAParam->pTrainSeq; */ RTMP_SA_TRAIN_LOG_ELEMENT *pCurTrainInfo; UINT32 canAntPattern; /* The best candidate until now! */ RTMP_SA_TRAIN_LOG_ELEMENT *pCanTrainInfo; RTMP_SA_TRAIN_STAGE trainStage; UINT32 ant_init_stage; UINT32 ant_confirm_stage; ULONG time_to_start; /* in units of system Clk */ UCHAR mcsStableCnt; UCHAR trainWeight; BOOLEAN bTraining; /* set as TRUE when trianing procedure is on-going */ BOOLEAN bLastRnd; #ifdef SA_TRAIN_SBS BOOLEAN bRoundDone; #endif /* SA_TRAIN_SBS // */ #ifdef SA_LUMP_SUM UINT32 sumTxCnt; UINT32 sumTxRtyCnt; UINT32 sumTxFailCnt; #endif /* SA_LUMP_SUM // */ } RTMP_SA_TRAINING_PARAM; typedef struct _SMART_ANTENNA_STRUCT_ { RTMP_SA_OP_MODE saMode; /* 1 = manually, 2= one shot , 3 =auto learn */ /* Number of antennas used for the transmission in the same time. */ UCHAR txNss; /* Mcs Stable Count, define the requirements for trigger the Antenna switch algorithm, 0~254: valid count. 255: reserved value */ UCHAR saMsc; /* MCS upper bound for SmartAntenna adaptive tunning. */ UCHAR saMcsBound; /* The maximum number of antenna pattern in one testing period */ UCHAR maxAntTry; /* condition for sa training */ UINT32 trainCond; /* used for method 3 */ /* Method for Antenna candidate selection */ UINT32 candMethod; /* the delay time(in seconds) before do the antenna switching training procedures */ UINT32 trainDelay; /* Time period of simple the data info for a specific antenna period. */ INT32 chkPeriod; /* RSSI variance threshod for training procedures */ UCHAR rssiVar; /* threshold value used for select target training entry */ CHAR rssiThreshold; /* condition to check if need to skip the confirm stage when run in auto mode */ BOOLEAN bSkipConfStage; /* indicate if any station associate/disassociate to us and need to re-do the training procedure */ BOOLEAN bStaChange; /* indicate if the Rssi variance is larger than threshold for sa training */ BOOLEAN bRssiChange; /* the antenna header pin and gpio mapping */ RTMP_SA_AGSP_MAP *agsp; INT32 agspCnt; /* Training sequence of antenna pattern used to do simpling. 0x0: indicate the end of the sequence. */ UINT32 *pTrainSeq; RTMP_SA_TRAIN_LOG_ELEMENT *pTrainMem; /* Total length of the training sequence, not include the terminator. */ int trainSeqCnt; RALINK_TIMER_STRUCT saSwitchTimer; /* Rule used to select the target Training entry */ UINT32 candStaRule; RTMP_SA_TRAINING_PARAM trainEntry[SA_ENTRY_MAX_NUM]; } SMART_ANTENNA_STRUCT; #endif /* SMART_ANTENNA // */ typedef struct _BBP_RESET_CTL { #define BBP_RECORD_NUM 49 REG_PAIR BBPRegDB[BBP_RECORD_NUM]; BOOLEAN AsicCheckEn; } BBP_RESET_CTL, *PBBP_RESET_CTL; #define DEFLAUT_PARTIAL_SCAN_CH_NUM 1 #define DEFLAUT_PARTIAL_SCAN_BREAK_TIME 4 /* Period of partial scaning: unit: 100ms */ typedef struct _PARTIAL_SCAN_ { BOOLEAN bScanning; /* Doing partial scan or not */ UINT8 NumOfChannels; /* How many channels to scan each time */ UINT8 LastScanChannel; /* last scaned channel */ UINT32 BreakTime; /* Period of partial scanning: unit: 100ms */ struct wifi_dev *pwdev; } PARTIAL_SCAN; typedef struct _SCAN_CTRL_ { UCHAR ScanType; UCHAR BssType; UCHAR Channel; UCHAR SsidLen; CHAR Ssid[MAX_LEN_OF_SSID]; UCHAR Bssid[MAC_ADDR_LEN]; #ifdef CONFIG_AP_SUPPORT RALINK_TIMER_STRUCT APScanTimer; #endif /* CONFIG_AP_SUPPORT */ PARTIAL_SCAN PartialScan; } SCAN_CTRL; #define TX_SWQ_FIFO_LEN 4096 typedef struct tx_swq_fifo { UCHAR swq[TX_SWQ_FIFO_LEN]; /* value 0 is used to indicate free to insert, value 1~127 used to incidate the WCID entry */ UINT enqIdx; UINT deqIdx; UINT low_water_mark; UINT high_water_mark; BOOLEAN q_state; NDIS_SPIN_LOCK swq_lock; /* spinlock for swq */ } TX_SWQ_FIFO; #ifdef RT_CFG80211_SUPPORT typedef struct _CFG80211_VIF_DEV { struct _CFG80211_VIF_DEV *pNext; BOOLEAN isMainDev; UINT32 devType; PNET_DEV net_dev; UCHAR CUR_MAC[MAC_ADDR_LEN]; /* ProbeReq Frame */ BOOLEAN Cfg80211RegisterProbeReqFrame; CHAR Cfg80211ProbeReqCount; /* Action Frame */ BOOLEAN Cfg80211RegisterActionFrame; CHAR Cfg80211ActionCount; } CFG80211_VIF_DEV, *PCFG80211_VIF_DEV; typedef struct _CFG80211_VIF_DEV_SET { #define MAX_CFG80211_VIF_DEV_NUM 2 BOOLEAN inUsed; UINT32 vifDevNum; LIST_HEADER vifDevList; BOOLEAN isGoingOn; /* To check any vif in list */ } CFG80211_VIF_DEV_SET; /* TxMmgt Related */ typedef struct _CFG80211_TX_PACKET { struct _CFG80211_TX_PACKET *pNext; UINT32 TxStatusSeq; /* TxMgmt Packet ID from sequence */ UCHAR *pTxStatusBuf; /* TxMgmt Packet buffer content */ UINT32 TxStatusBufLen; /* TxMgmt Packet buffer Length */ } CFG80211_TX_PACKET, *PCFG80211_TX_PACKET; /* CFG80211 Total CTRL Point */ typedef struct _CFG80211_CONTROL { BOOLEAN FlgCfg8021Disable2040Scan; BOOLEAN FlgCfg80211Scanning; /* Record it When scanReq from wpa_supplicant */ BOOLEAN FlgCfg80211Connecting; /* Record it When ConnectReq from wpa_supplicant*/ /* Scan Related */ UINT32 *pCfg80211ChanList; /* the channel list from from wpa_supplicant */ UCHAR Cfg80211ChanListLen; /* channel list length */ UCHAR Cfg80211CurChanIndex; /* current index in channel list when driver in scanning */ UCHAR *pExtraIe; /* Carry on Scan action from supplicant */ UINT ExtraIeLen; UCHAR Cfg_pending_Ssid[MAX_LEN_OF_SSID + 1]; /* Record the ssid, When ScanTable Full */ UCHAR Cfg_pending_SsidLen; /* ROC Related */ RALINK_TIMER_STRUCT Cfg80211RocTimer; CMD_RTPRIV_IOCTL_80211_CHAN Cfg80211ChanInfo; BOOLEAN Cfg80211RocTimerInit; BOOLEAN Cfg80211RocTimerRunning; /* Tx_Mmgt Related */ UINT32 TxStatusSeq; /* TxMgmt Packet ID from sequence */ UCHAR *pTxStatusBuf; /* TxMgmt Packet buffer content */ UINT32 TxStatusBufLen; /* TxMgmt Packet buffer Length */ BOOLEAN TxStatusInUsed; LIST_HEADER cfg80211TxPacketList; /* P2P Releated*/ UCHAR P2PCurrentAddress[MAC_ADDR_LEN]; /* User changed MAC address */ BOOLEAN isCfgDeviceInP2p; /* For BaseRate 6 */ /* MainDevice Info. */ CFG80211_VIF_DEV cfg80211MainDev; #if defined(RT_CFG80211_P2P_CONCURRENT_DEVICE) || defined(CFG80211_MULTI_STA) /* For add_virtual_intf */ CFG80211_VIF_DEV_SET Cfg80211VifDevSet; #endif /* RT_CFG80211_P2P_CONCURRENT_DEVICE || CFG80211_MULTI_STA */ #ifdef CFG80211_MULTI_STA PNET_DEV multi_sta_net_dev; BOOLEAN flg_cfg_multi_sta_init; #endif /* CFG80211_MULTI_STA */ /* In AP Mode */ UINT8 isCfgInApMode; /* Is any one Device in AP Mode */ UCHAR *beacon_tail_buf; /* Beacon buf from upper layer */ UINT32 beacon_tail_len; BOOLEAN beaconIsSetFromHostapd; /* set true after BeaconAdd */ UCHAR *pCfg80211ExtraIeAssocRsp; UINT32 Cfg80211ExtraIeAssocRspLen; /* for AdHoc Mode */ UCHAR *BeaconExtraIe; UINT BeaconExtraIeLen; /* Mcc Part */ /* BOOLEAN isMccOn; */ /* TODO: need fix it */ UCHAR Cfg80211_Alpha2[2]; CMD_RTPRIV_IOCTL_80211_KEY WepKeyInfoBackup; } CFG80211_CTRL, *PCFG80211_CTRL; #endif /* RT_CFG80211_SUPPORT */ typedef struct rtmp_mac_ctrl { #ifdef MT_MAC UINT8 wtbl_entry_cnt[4]; UINT16 wtbl_entry_size[4]; UINT32 wtbl_base_addr[4]; /* base address for WTBL2/3/4 */ UINT32 wtbl_base_fid[4]; UINT32 page_size; #endif /* MT_MAC */ } RTMP_MAC_CTRL; typedef struct _RADIO_CTRL { UCHAR BandIdx; UCHAR CurStat; UCHAR PhyMode; UCHAR Channel; UCHAR Channel2; UCHAR CentralCh; UCHAR Bw; UCHAR ExtCha; /*check first radio update is for scan or not*/ BOOLEAN scan_state; BOOLEAN IsBfBand; #ifdef GREENAP_SUPPORT BOOLEAN bGreenAPActive; #endif /* GREENAP_SUPPORT */ } RADIO_CTRL; #ifdef CONFIG_AP_SUPPORT #ifdef AP_QLOAD_SUPPORT typedef struct _QLOAD_CTRL { UINT8 FlgQloadEnable; /* 1: any BSS WMM is enabled */ ULONG QloadUpTimeLast; /* last up time */ UINT8 QloadChanUtil; /* last QBSS Load, unit: us */ UINT32 QloadChanUtilTotal; /* current QBSS Load Total */ UINT8 QloadChanUtilBeaconCnt; /* 1~100, default: 50 */ UINT8 QloadChanUtilBeaconInt; /* 1~100, default: 50 */ UINT32 QloadLatestChannelBusyTimePri; UINT32 QloadLatestChannelBusyTimeSec; /* ex: For 100ms beacon interval, if the busy time in last TBTT is smaller than 5ms, QloadBusyCount[0] ++; if the busy time in last TBTT is between 5 and 10ms, QloadBusyCount[1] ++; ...... if the busy time in last TBTT is larger than 95ms, QloadBusyCount[19] ++; Command: "iwpriv ra0 qload show". */ /* provide busy time statistics for every TBTT */ #define QLOAD_FUNC_BUSY_TIME_STATS /* provide busy time alarm mechanism */ /* use the function to avoid to locate in some noise environments */ #define QLOAD_FUNC_BUSY_TIME_ALARM #ifdef QLOAD_FUNC_BUSY_TIME_STATS #define QLOAD_BUSY_INTERVALS 20 /* partition TBTT to QLOAD_BUSY_INTERVALS */ /* for primary channel & secondary channel */ UINT32 QloadBusyCountPri[QLOAD_BUSY_INTERVALS]; UINT32 QloadBusyCountSec[QLOAD_BUSY_INTERVALS]; #endif /* QLOAD_FUNC_BUSY_TIME_STATS */ #ifdef QLOAD_FUNC_BUSY_TIME_ALARM #define QLOAD_DOES_ALARM_OCCUR(pAd) (HcGetQloadCtrl(pAd)->FlgQloadAlarmIsSuspended == TRUE) #define QLOAD_ALARM_EVER_OCCUR(pAd) (HcGetQloadCtrl(pAd)->QloadAlarmNumber > 0) BOOLEAN FlgQloadAlarmIsSuspended; /* 1: suspend */ UINT8 QloadAlarmBusyTimeThreshold; /* unit: 1/100 */ UINT8 QloadAlarmBusyNumThreshold; /* unit: 1 */ UINT8 QloadAlarmBusyNum; UINT8 QloadAlarmDuration; /* unit: TBTT */ UINT32 QloadAlarmNumber; /* total alarm times */ BOOLEAN FlgQloadAlarm; /* 1: alarm occurs */ /* speed up use */ UINT32 QloadTimePeriodLast; UINT32 QloadBusyTimeThreshold; #else #define QLOAD_DOES_ALARM_OCCUR(pAd) 0 #endif /* QLOAD_FUNC_BUSY_TIME_ALARM */ } QLOAD_CTRL; #endif /* AP_QLOAD_SUPPORT */ typedef struct _AUTO_CH_CTRL { PCHANNELINFO pChannelInfo; PBSSINFO pBssInfoTab; #ifdef CONFIG_AP_SUPPORT AUTOCH_SEL_CTRL AutoChSelCtrl; #endif } AUTO_CH_CTRL; #endif /*CONFIG_AP_SUPPORT*/ typedef struct rtmp_phy_ctrl { UINT8 rf_band_cap; #ifdef CONFIG_AP_SUPPORT AUTO_CH_CTRL AutoChCtrl; #ifdef AP_QLOAD_SUPPORT QLOAD_CTRL QloadCtrl; #endif /*AP_QLOAD_SUPPORT*/ #endif /* CONFIG_AP_SUPPORT */ RADIO_CTRL RadioCtrl; } RTMP_PHY_CTRL; typedef struct _MANUAL_CONN { UINT8 peer_mac[MAC_ADDR_LEN]; UINT8 peer_band; /* band 0/1 */ UINT8 peer_op_type; /* ap/sta for "OPMODE_AP"/"OPMODE_STA" */ UINT8 ownmac_idx; UINT8 wtbl_idx; UINT8 peer_phy_mode; /* a/b/g/gn/an/ac for "WMODE_A/B/G/GN/AN/AC" */ UINT8 peer_bw; /* 20/40/80/160 for "BW_20/40/80/160" */ UINT8 peer_nss; /* 1 ~ 4 */ UINT16 pfmuId; UINT8 spe_idx; UCHAR gid; UINT16 aid; UINT8 rca2; UINT8 rv; UINT8 peer_maxrate_mode; /* cck/ofdm/htmix/htgf/vht for "MODE_CCK/OFDM/HTMIX/HTGF/VHT" */ UINT32 peer_maxrate_mcs; /* MODE_CCK: 0~3, MODE_OFDM: 0~7, MODE_HTMIX/GF: 0~32, MODE_VHT:0~9 */ UINT8 ba_info[WMM_NUM_OF_AC]; /* protocol wise */ HT_CAP_INFO ht_cap_info; /* HT capability information */ #ifdef DOT11_VHT_AC VHT_CAP_INFO vht_cap_info; /* VHT capability information */ VHT_MCS_SET vht_mcs_set; #endif } MANUAL_CONN, *P_MANUAL_CONN; #ifdef WFA_VHT_R2_PF typedef struct _MANUAL_DUMP { UINT8 VhtBwSignal; UINT8 VhtCapIE; UINT8 VhtOpNotify; } MANUAL_DUMP, *P_MANUAL_DUMP; #endif /* WFA_VHT_R2_PF */ /* Rx Statistic */ #define MAX_ANT_NUM 4 typedef struct _RX_STATISTIC_RXV { INT32 FreqOffsetFromRx; UINT32 RSSI[MAX_ANT_NUM]; UINT32 SNR[MAX_ANT_NUM]; UINT32 RCPI[MAX_ANT_NUM]; UINT32 FAGC_RSSI_IB[MAX_ANT_NUM]; UINT32 FAGC_RSSI_WB[MAX_ANT_NUM]; } RX_STATISTIC_RXV; typedef struct _RX_STATISTIC_CR { UINT32 RxMacFCSErrCount; UINT32 RxMacMdrdyCount; UINT32 RxMacFCSOKCount; UINT32 PhyMdrdyOFDM; UINT32 PhyMdrdyCCK; UINT32 FCSErr_OFDM; UINT32 FCSErr_CCK; UINT32 RxLenMismatch; UINT32 OFDM_PD; UINT32 CCK_PD; UINT32 CCK_SIG_Err; UINT32 CCK_SFD_Err; UINT32 OFDM_SIG_Err; UINT32 OFDM_TAG_Err; UINT32 ACIHitLow; UINT32 ACIHitHigh; UINT32 Inst_IB_RSSSI[MAX_ANT_NUM]; UINT32 Inst_WB_RSSSI[MAX_ANT_NUM]; UINT32 RxMacFCSErrCount_band1; UINT32 RxMacMdrdyCount_band1; UINT32 RxMacFCSOKCount_band1; UINT32 PhyMdrdyOFDM_band1; UINT32 PhyMdrdyCCK_band1; UINT32 RxLenMismatch_band1; UINT32 OFDM_PD_band1; UINT32 CCK_PD_band1; UINT32 CCK_SIG_Err_band1; UINT32 CCK_SFD_Err_band1; UINT32 OFDM_SIG_Err_band1; UINT32 OFDM_TAG_Err_band1; } RX_STATISTIC_CR; struct peak_tp_ctl { UCHAR client_nums; struct wifi_dev *cur_wdev; BOOLEAN cli_peak_tp_running; UINT32 max_tx_tp; BOOLEAN cli_peak_tp_txop_enable; UINT16 cli_peak_tp_txop_level; BOOLEAN cli_ampdu_efficiency_running; }; struct txop_ctl { UCHAR multi_client_nums; struct wifi_dev *cur_wdev; BOOLEAN multi_cli_txop_running; }; struct multi_cli_ctl { UINT32 pkt_avg_len; UCHAR sta_nums; UCHAR amsdu_cnt; UINT32 rts_length; UINT32 rts_pkt; BOOLEAN c2s_only; ULONG last_tx_cnt; ULONG last_tx_fail_cnt; }; typedef struct _RxVBQElmt { UINT8 valid; UINT8 isEnd; UINT8 rxblk_setting_done; UINT8 rxv_setting_done; UINT8 rxblk_search_done; UINT8 rxv_search_done; UINT8 rxv_sn; UINT8 wcid; UINT8 aggcnt; UINT8 g0_debug_set; UINT8 g1_debug_set; UINT8 g2_debug_set; UCHAR chipid[5]; UINT32 MPDUbytecnt; UINT32 timestamp; UINT32 arFCScheckBitmap[8]; UINT32 RXV_CYCLE[9]; } RxVBQElmt, *PRxVBQElmt; /* The miniport adapter structure */ struct _RTMP_ADAPTER { VOID *OS_Cookie; /* save specific structure relative to OS */ PNET_DEV net_dev; NDIS_SPIN_LOCK WdevListLock; struct wifi_dev *wdev_list[WDEV_NUM_MAX]; /*About MacTab, the sta driver will use #0 and #1 for multicast and AP. */ MAC_TABLE MacTab; /* ASIC on-chip WCID entry table. At TX, ASIC always use key according to this on-chip table. */ NDIS_SPIN_LOCK MacTabLock; #ifdef DOT11_N_SUPPORT BA_TABLE BATable; NDIS_SPIN_LOCK BATabLock; RALINK_TIMER_STRUCT RECBATimer; #endif /* DOT11_N_SUPPORT */ UINT8 ucBFBackOffMode; #ifdef RF_LOCKDOWN BOOLEAN fgQAEffuseWriteBack; #endif /* RF_LOCKDOWN */ #ifdef ETSI_RX_BLOCKER_SUPPORT /* Set fix WBRSSI/IBRSSI pattern */ BOOLEAN fgFixWbIBRssiEn; CHAR c1WbRssiWF0; CHAR c1WbRssiWF1; CHAR c1WbRssiWF2; CHAR c1WbRssiWF3; CHAR c1IbRssiWF0; CHAR c1IbRssiWF1; CHAR c1IbRssiWF2; CHAR c1IbRssiWF3; /* set RSSI threshold */ CHAR c1RWbRssiHTh; CHAR c1RWbRssiLTh; CHAR c1RIbRssiLTh; CHAR c1WBRssiTh4R; /* set RX BLOCKER check para. */ UINT8 u1CheckTime; UINT8 u1To1RCheckCnt; UINT16 u2To1RvaildCntTH; UINT16 u2To4RvaildCntTH; /* for verification */ UINT8 u1RxBlockerState; UINT8 u1ValidCnt; UINT8 u14RValidCnt; UINT8 i1MaxWRssiIdxPrev; UINT8 u1TimeCnt; BOOLEAN fgAdaptRxBlock; #endif /* end of ETSI_RX_BLOCKER_SUPPORT */ BOOLEAN fgEPA; #ifdef SINGLE_SKU_V2 UINT8 TxPowerSKU[SKU_SIZE]; #if defined(MT7615) || defined(MT7622) #else UINT8 u1SkuParamLen[SINGLE_SKU_TYPE_PARSE_NUM]; UINT8 u1SkuChBandNeedParse[SINGLE_SKU_TYPE_PARSE_NUM]; UINT8 u1SkuFillParamLen[SINGLE_SKU_TYPE_NUM]; UINT8 u1BackoffParamLen[BACKOFF_TYPE_PARSE_NUM]; UINT8 u1BackoffChBandNeedParse[BACKOFF_TYPE_PARSE_NUM]; UINT8 u1BackoffFillParamLen[BACKOFF_TYPE_NUM]; #endif /* defined(MT7615) || defined(MT7622) */ #endif #ifdef RTMP_MAC_PCI /*****************************************************************************************/ /* PCI related parameters */ /*****************************************************************************************/ PUCHAR CSRBaseAddress; /* PCI MMIO Base Address, all access will use */ unsigned int irq_num; PCI_HIF_T PciHif; USHORT RLnkCtrlConfiguration; USHORT RLnkCtrlOffset; USHORT HostLnkCtrlConfiguration; USHORT HostLnkCtrlOffset; USHORT PCIePowerSaveLevel; ULONG AccessBBPFailCount; BOOLEAN bPCIclkOff; /* flag that indicate if the PICE power status in Configuration SPace.. */ BOOLEAN bPCIclkOffDisableTx; BOOLEAN brt30xxBanMcuCmd; /* when = 0xff means all commands are ok to set . */ BOOLEAN b3090ESpecialChip; /* 3090E special chip that write EEPROM 0x24=0x9280. */ /* ULONG CheckDmaBusyCount; // Check Interrupt Status Register Count. */ NDIS_SPIN_LOCK LockInterrupt; NDIS_SPIN_LOCK tssi_lock; BOOLEAN reschedule_rx0; BOOLEAN reschedule_rx1; UINT32 wrong_wlan_idx_num; #ifdef CUT_THROUGH VOID *PktTokenCb; #endif /* CUT_THROUGH */ NDIS_SPIN_LOCK fp_que_lock; QUEUE_HEADER fp_que; UINT32 fp_que_max_size; NDIS_SPIN_LOCK mgmt_que_lock; QUEUE_HEADER mgmt_que; NDIS_SPIN_LOCK high_prio_que_lock; QUEUE_HEADER high_prio_que; BOOLEAN tx_dequeue_scheduable; RTMP_NET_TASK_STRUCT tx_deque_tasklet; struct workqueue_struct *qm_wq; struct work_struct tx_deq_work; struct work_struct cmd_msg_work; #ifdef DBG_AMSDU UINT32 dbg_time_slot; RALINK_TIMER_STRUCT amsdu_history_timer; #endif BOOLEAN amsdu_fix; UCHAR amsdu_fix_num; UCHAR amsdu_max_num; #ifdef INT_STATISTIC ULONG INTCNT; #ifdef MT_MAC ULONG INTWFMACINT0CNT; ULONG INTWFMACINT1CNT; ULONG INTWFMACINT2CNT; ULONG INTWFMACINT3CNT; ULONG INTWFMACINT4CNT; ULONG INTBCNDLY; ULONG INTBMCDLY; #endif ULONG INTTxCoherentCNT; ULONG INTRxCoherentCNT; ULONG INTTxRxCoherentCNT; ULONG INTFifoStaFullIntCNT; ULONG INTMGMTDLYCNT; ULONG INTRXDATACNT; ULONG INTRXCMDCNT; ULONG INTHCCACNT; ULONG INTAC3CNT; ULONG INTAC2CNT; ULONG INTAC1CNT; ULONG INTAC0CNT; ULONG INTPreTBTTCNT; ULONG INTTBTTIntCNT; ULONG INTGPTimeOutCNT; ULONG INTRadarCNT; ULONG INTAutoWakeupIntCNT; #endif #endif /* RTMP_MAC_PCI */ NDIS_SPIN_LOCK irq_lock; /*======Cmd Thread in PCI/RBUS/USB */ CmdQ CmdQ; NDIS_SPIN_LOCK CmdQLock; /* CmdQLock spinlock */ RTMP_OS_TASK cmdQTask; HW_CTRL_T HwCtrl; RTMP_OS_SEM AutoRateLock; #ifdef CONFIG_ATE /* lock for ATE */ NDIS_SPIN_LOCK GenericLock; /* ATE Tx/Rx generic spinlock */ #endif /* CONFIG_ATE */ /*********************************************************/ /* Both PCI/USB related parameters */ /*********************************************************/ /*RTMP_DEV_INFO chipInfo; */ RTMP_INF_TYPE infType; UCHAR AntMode; /*********************************************************/ /* Driver Mgmt related parameters */ /*********************************************************/ /* OP mode: either AP or STA */ UCHAR OpMode; /* OPMODE_STA, OPMODE_AP */ UINT32 BssInfoIdxBitMap0;/* mapping BssInfoIdx inside wdev struct with FW BssInfoIdx */ UINT32 BssInfoIdxBitMap1;/* mapping BssInfoIdx inside wdev struct with FW BssInfoIdx */ NDIS_SPIN_LOCK BssInfoIdxBitMapLock; RTMP_OS_TASK mlmeTask; #ifdef RTMP_TIMER_TASK_SUPPORT /* If you want use timer task to handle the timer related jobs, enable this. */ RTMP_TIMER_TASK_QUEUE TimerQ; NDIS_SPIN_LOCK TimerQLock; RTMP_OS_TASK timerTask; #endif /* RTMP_TIMER_TASK_SUPPORT */ /*********************************************************/ /* Tx related parameters */ /*********************************************************/ BOOLEAN *DeQueueRunning; /* for ensuring RTUSBDeQueuePacket get call once */ NDIS_SPIN_LOCK *DeQueueLock; /* resource for software backlog queues */ QUEUE_HEADER *TxSwQueue; /* 4 AC + 1 HCCA */ NDIS_SPIN_LOCK *TxSwQueueLock; /* TxSwQueue spinlock */ #if defined(MT_MAC) && defined(IP_ASSEMBLY) DL_LIST *assebQueue; VOID *cur_ip_assem_data; #endif /* Maximum allowed tx software Queue length */ UINT TxSwQMaxLen; NDIS_SPIN_LOCK tx_swq_lock[WMM_NUM_OF_AC]; struct tx_swq_fifo tx_swq[WMM_NUM_OF_AC]; UCHAR LastMCUCmd; #ifdef REDUCE_TCP_ACK_SUPPORT struct hlist_head ackCnxHashTbl[REDUCE_ACK_MAX_HASH_BUCKETS]; struct list_head ackCnxList; UINT32 ReduceAckConnections; struct delayed_work ackFlushWork; struct delayed_work cnxFlushWork; NDIS_SPIN_LOCK ReduceAckLock; #endif #ifdef RACTRL_LIMIT_MAX_PHY_RATE BOOLEAN fgRaLimitPhyRate; #endif /* RACTRL_LIMIT_MAX_PHY_RATE */ /*********************************************************/ /* Rx related parameters */ /*********************************************************/ #ifdef RTMP_MAC_PCI /* TODO: shiang, check the purpose of following lock "McuCmdLock" */ NDIS_SPIN_LOCK McuCmdLock; /*MCU Command Queue spinlock for RT3090/3592/3390/3593/5390/5392/5592/3290 */ #endif /* RTMP_MAC_PCI */ /* RX re-assembly buffer for fragmentation */ FRAGMENT_FRAME FragFrame; /* Frame storage for fragment frame */ #ifdef MT_MAC TXS_CTL TxSCtl; TMR_CTRL_STRUCT *pTmrCtrlStruct; #endif #ifdef FTM_SUPPORT PFTM_CTRL pFtmCtrl; #endif /* FTM_SUPPORT */ #ifdef CONFIG_CSO_SUPPORT RX_CSO_STRUCT rCso; #endif /***********************************************************/ /* ASIC related parameters */ /***********************************************************/ RTMP_ARCH_OP archOps; struct qm_ctl qm_ctl; struct qm_ops *qm_ops; struct notify_entry qm_wsys_ne; struct tm_ops *tm_qm_ops; struct tm_ops *tm_hif_ops; struct phy_ops *phy_op; struct hw_setting hw_cfg; UINT32 MACVersion; /* MAC version. Record rt2860C(0x28600100) or rt2860D (0x28600101).. */ UINT32 ChipID; UINT32 HWVersion; UINT32 FWVersion; UINT16 ee_chipId; /* Chip version. Read from EEPROM 0x00 to identify RT5390H */ INT dev_idx; #ifdef MT_MAC struct rtmp_mac_ctrl mac_ctrl; USHORT rx_pspoll_filter; #endif /* MT_MAC */ /* --------------------------- */ /* E2PROM */ /* --------------------------- */ enum EEPROM_STORAGE_TYPE eeprom_type; ULONG EepromVersion; /* byte 0: version, byte 1: revision, byte 2~3: unused */ ULONG FirmwareVersion; /* byte 0: Minor version, byte 1: Major version, otherwise unused. */ USHORT EEPROMDefaultValue[NUM_EEPROM_BBP_PARMS]; UCHAR EEPROMAddressNum; /* 93c46=6 93c66=8 */ BOOLEAN EepromAccess; UCHAR EFuseTag; #ifdef RTMP_EFUSE_SUPPORT BOOLEAN bUseEfuse; #endif /* RTMP_EFUSE_SUPPORT */ UCHAR *EEPROMImage; UCHAR E2pAccessMode; /* Used to identify flash, efuse, eeprom or bin from start-up */ struct _EEPROM_CONTROL E2pCtrl; #ifdef RF_LOCKDOWN BOOLEAN fgCalFreeApply; UINT16 RFlockTempIdx; UINT16 CalFreeTempIdx; #endif /* RF_LOCKDOWN */ #ifdef PRE_CAL_TRX_SET1_SUPPORT BOOLEAN bDCOCReloaded; BOOLEAN bDPDReloaded; UCHAR *CalDCOCImage; UCHAR *CalDPDAPart1Image; UCHAR *CalDPDAPart2Image; #endif /* PRE_CAL_TRX_SET1_SUPPORT */ #ifdef PRE_CAL_MT7622_SUPPORT #define CAL_LOG_SIZE 5000 #define CAL_TXLPFG_SIZE (4 * sizeof(UINT32)) #define CAL_TXDCIQ_SIZE (48 * sizeof(UINT32)) #define CAL_TXDPD_PERCHAN_SIZE (304 * sizeof(UINT32)) #define CAL_TXDPD_SIZE (CAL_TXDPD_PERCHAN_SIZE * 14) BOOLEAN bPreCalMode; UCHAR *CalTXLPFGImage; UCHAR *CalTXDCIQImage; UCHAR *CalTXDPDImage; UINT16 TxDpdCalOfst; #endif /*PRE_CAL_MT7622_SUPPORT*/ #if defined(RLM_CAL_CACHE_SUPPORT) || defined(PRE_CAL_TRX_SET2_SUPPORT) UCHAR *PreCalReStoreBuffer; UCHAR *PreCalStoreBuffer; UINT16 PreCalWriteOffSet; UINT16 ChGrpMap; #endif /* defined(RLM_CAL_CACHE_SUPPORT) || defined(PRE_CAL_TRX_SET2_SUPPORT) */ #if defined(RLM_CAL_CACHE_SUPPORT) || defined(PRE_CAL_TRX_SET2_SUPPORT) VOID *rlmCalCache; #endif /* defined(RLM_CAL_CACHE_SUPPORT) || defined(PRE_CAL_TRX_SET2_SUPPORT) */ EEPROM_ANTENNA_STRUC Antenna; /* Since ANtenna definition is different for a & g. We need to save it for future reference. */ #ifdef DBDC_MODE UINT8 dbdc_band0_tx_path; UINT8 dbdc_band0_rx_path; UINT8 dbdc_band1_tx_path; UINT8 dbdc_band1_rx_path; #endif EEPROM_NIC_CONFIG2_STRUC NicConfig2; /* --------------------------- */ /* BBP Control */ /* --------------------------- */ #if defined(RTMP_BBP) || defined(CONFIG_ATE) /* TODO: shiang-6590, remove "defined(CONFIG_ATE)" after ATE has fully re-organized! */ UCHAR BbpWriteLatch[MAX_BBP_ID + 1]; /* record last BBP register value written via BBP_IO_WRITE/BBP_IO_WRITE_VY_REG_ID */ UCHAR Bbp94; #endif /* defined(RTMP_BBP) || defined(CONFIG_ATE) */ CHAR BbpRssiToDbmDelta; /* change from UCHAR to CHAR for high power */ BBP_R66_TUNING BbpTuning; /* ---------------------------- */ /* RFIC control */ /* ---------------------------- */ UCHAR RfIcType; /* RFIC_xxx */ UCHAR RfFreqOffset; /* Frequency offset for channel switching */ RTMP_RF_REGS LatchRfRegs; /* latch th latest RF programming value since RF IC doesn't support READ */ #ifdef RTMP_RBUS_SUPPORT UCHAR RfFreqDelta; /* Frequency Delta */ #endif /* RTMP_RBUS_SUPPORT */ #ifdef RTMP_MAC_PCI UCHAR ShowRf; /* Show RF register write for 2880 */ #endif /* RTMP_MAC_PCI */ /* This soft Rx Antenna Diversity mechanism is used only when user set */ /* RX Antenna = DIVERSITY ON */ SOFT_RX_ANT_DIVERSITY RxAnt; /* ---------------------------- */ /* TxPower control */ /* ---------------------------- */ CHANNEL_TX_POWER TxPower[MAX_NUM_OF_CHANNELS]; /* Store Tx power value for all channels. */ CHANNEL_TX_POWER ChannelList[MAX_NUM_OF_CHANNELS]; /* list all supported channels for site survey */ UCHAR ChannelListNum; /* number of channel in ChannelList[] */ BOOLEAN BbpForCCK; ULONG Tx20MPwrCfgABand[MAX_TXPOWER_ARRAY_SIZE]; ULONG Tx20MPwrCfgGBand[MAX_TXPOWER_ARRAY_SIZE]; ULONG Tx40MPwrCfgABand[MAX_TXPOWER_ARRAY_SIZE]; ULONG Tx40MPwrCfgGBand[MAX_TXPOWER_ARRAY_SIZE]; #ifdef DOT11_VHT_AC ULONG Tx80MPwrCfgABand[MAX_TXPOWER_ARRAY_SIZE]; /* Per-rate Tx power control for VHT BW80 (5GHz only) */ BOOLEAN force_vht_op_mode; #endif /* DOT11_VHT_AC */ BOOLEAN bAutoTxAgcA; /* Enable driver auto Tx Agc control */ UCHAR TssiRefA; /* Store Tssi reference value as 25 temperature. */ UCHAR TssiPlusBoundaryA[2][8]; /* Tssi boundary for increase Tx power to compensate. [Group][Boundary Index]*/ UCHAR TssiMinusBoundaryA[2][8]; /* Tssi boundary for decrease Tx power to compensate. [Group][Boundary Index]*/ UCHAR TxAgcStepA; /* Store Tx TSSI delta increment / decrement value */ CHAR TxAgcCompensateA; /* Store the compensation (TxAgcStep * (idx-1)) */ CHAR TssiCalibratedOffset; /* reference temperature(e2p[D1h]) */ UCHAR ChBndryIdx; /* 5G Channel Group Boundary Index for Temperature Compensation */ BOOLEAN bAutoTxAgcG; /* Enable driver auto Tx Agc control */ UCHAR TssiRefG; /* Store Tssi reference value as 25 temperature. */ UCHAR TssiPlusBoundaryG[8]; /* Tssi boundary for increase Tx power to compensate. */ UCHAR TssiMinusBoundaryG[8]; /* Tssi boundary for decrease Tx power to compensate. */ UCHAR TxAgcStepG; /* Store Tx TSSI delta increment / decrement value */ CHAR TxAgcCompensateG; /* Store the compensation (TxAgcStep * (idx-1)) */ CHAR mp_delta_pwr; /* calculated by MP ATE temperature */ #ifdef THERMAL_PROTECT_SUPPORT BOOLEAN force_one_tx_stream; BOOLEAN force_radio_off; BOOLEAN fgThermalProtectToggle; INT32 last_thermal_pro_temp; INT32 thermal_pro_high_criteria; BOOLEAN thermal_pro_high_en; INT32 thermal_pro_low_criteria; BOOLEAN thermal_pro_low_en; UINT32 recheck_timer; INT32 thermal_pro_RFOff_criteria; BOOLEAN thermal_pro_RFOff_en; #endif /* THERMAL_PROTECT_SUPPORT */ signed char BGRssiOffset[4]; /* Store B/G RSSI #0/1/2 Offset value on EEPROM 0x46h */ signed char ARssiOffset[4]; /* Store A RSSI 0/1/2 Offset value on EEPROM 0x4Ah */ CHAR BLNAGain; /* Store B/G external LNA#0 value on EEPROM 0x44h */ CHAR ALNAGain0; /* Store A external LNA#0 value for ch36~64 */ CHAR ALNAGain1; /* Store A external LNA#1 value for ch100~128 */ CHAR ALNAGain2; /* Store A external LNA#2 value for ch132~165 */ UCHAR TxMixerGain24G; /* Tx mixer gain value from EEPROM to improve Tx EVM / Tx DAC, 2.4G */ UCHAR TxMixerGain5G; #ifdef LED_CONTROL_SUPPORT /* LED control */ LED_CONTROL LedCntl; #endif /* LED_CONTROL_SUPPORT */ /* ---------------------------- */ /* MAC control */ /* ---------------------------- */ UCHAR wmm_cw_min; /* CW_MIN_IN_BITS, actual CwMin = 2^CW_MIN_IN_BITS - 1 */ UCHAR wmm_cw_max; /* CW_MAX_IN_BITS, actual CwMax = 2^CW_MAX_IN_BITS - 1 */ /*****************************************************************************************/ /* 802.11 related parameters */ /*****************************************************************************************/ /* outgoing BEACON frame buffer and corresponding TXD */ USHORT BeaconOffset[HW_BEACON_MAX_NUM]; /* pre-build PS-POLL and NULL frame upon link up. for efficiency purpose. */ HEADER_802_11 NullFrame; #ifdef UAPSD_SUPPORT NDIS_SPIN_LOCK UAPSDEOSPLock; /* EOSP frame access lock use */ BOOLEAN bAPSDFlagSPSuspend; /* 1: SP is suspended; 0: SP is not */ #endif /* UAPSD_SUPPORT */ MONITOR_STRUCT monitor_ctrl; #ifdef DOT11_SAE_SUPPORT SAE_CFG SaeCfg; #endif /* DOT11_SAE_SUPPORT */ /*=========AP=========== */ #ifdef CONFIG_AP_SUPPORT /* ----------------------------------------------- */ /* AP specific configuration & operation status */ /* used only when pAd->OpMode == OPMODE_AP */ /* ----------------------------------------------- */ AP_ADMIN_CONFIG ApCfg; /* user configuration when in AP mode */ AP_MLME_AUX ApMlmeAux; #if defined(MT7615) || defined(MT7622) || defined(P18) || defined(MT7663) BCN_CHECK_INFO_STRUC BcnCheckInfo; #endif #ifdef WDS_SUPPORT WDS_TABLE WdsTab; /* WDS table when working as an AP */ #endif /* WDS_SUPPORT */ #ifdef MBSS_SUPPORT BOOLEAN FlgMbssInit; #endif /* MBSS_SUPPORT */ #ifdef APCLI_SUPPORT BOOLEAN flg_apcli_init; #ifdef APCLI_CERT_SUPPORT BOOLEAN bApCliCertTest; #endif /* APCLI_CERT_SUPPORT */ #endif /* APCLI_SUPPORT */ #ifdef WSC_AP_SUPPORT BOOLEAN bWpsCertTest; #endif /*#ifdef AUTO_CH_SELECT_ENHANCE */ PBSSINFO pBssInfoTab; PCHANNELINFO pChannelInfo; /*#endif // AUTO_CH_SELECT_ENHANCE */ #endif /* CONFIG_AP_SUPPORT */ /*=======STA=========== */ /*=======Common=========== */ enum RATE_ADAPT_ALG rateAlg; /* Rate adaptation algorithm */ #ifdef PROFILE_PATH_DYNAMIC CHAR *profilePath; #endif /* PROFILE_PATH_DYNAMIC */ NDIS_MEDIA_STATE IndicateMediaState; /* Base on Indication state, default is NdisMediaStateDisConnected */ #ifdef PROFILE_STORE RTMP_OS_TASK WriteDatTask; BOOLEAN bWriteDat; #endif /* PROFILE_STORE */ #ifdef CREDENTIAL_STORE STA_CONNECT_INFO StaCtIf; #endif /* CREDENTIAL_STORE */ #ifdef WSC_INCLUDED RTMP_OS_TASK wscTask; UCHAR WriteWscCfgToDatFile; BOOLEAN WriteWscCfgToAr9DatFile; NDIS_SPIN_LOCK WscElmeLock; MLME_QUEUE_ELEM *pWscElme; /* WSC hardware push button function 0811 */ BOOLEAN WscHdrPshBtnFlag; /* 1: support, read from EEPROM */ #ifdef CONFIG_AP_SUPPORT BOOLEAN bWscDriverAutoUpdateCfg; #endif /* CONFIG_AP_SUPPORT */ #endif /* WSC_INCLUDED */ /* MAT related parameters */ #ifdef MAT_SUPPORT MAT_STRUCT MatCfg; #endif /* MAT_SUPPORT */ #ifdef RTMP_RBUS_SUPPORT #ifdef VIDEO_TURBINE_SUPPORT AP_VIDEO_STRUCT VideoTurbine; #endif /* VIDEO_TURBINE_SUPPORT */ #endif /* RTMP_RBUS_SUPPORT */ /* Frequency setting for rate adaptation @ra_interval: for baseline time interval @ra_fast_interval: for quick response time interval */ UINT32 ra_interval; UINT32 ra_fast_interval; /* configuration: read from Registry & E2PROM */ BOOLEAN bLocalAdminMAC; /* Use user changed MAC */ UCHAR PermanentAddress[MAC_ADDR_LEN]; /* Factory default MAC address */ UCHAR CurrentAddress[MAC_ADDR_LEN]; /* User changed MAC address */ #ifdef MT_MAC UCHAR ExtendMBssAddr[EXTEND_MBSS_MAC_MAX][MAC_ADDR_LEN]; /* User defined MAC address for MBSSID*/ BOOLEAN bLocalAdminExtendMBssMAC; /* Use user changed MAC */ #endif /* ------------------------------------------------------ */ /* common configuration to both OPMODE_STA and OPMODE_AP */ /* ------------------------------------------------------ */ UINT VirtualIfCnt; NDIS_SPIN_LOCK VirtualIfLock; COMMON_CONFIG CommonCfg; #ifdef COEX_SUPPORT BOOLEAN BtCoexBeaconLimit; UINT32 BtWlanStatus; UINT32 BtCoexSupportMode; UINT32 BtCoexMode; UINT32 BtCoexLiveTime; UINT32 BtCoexBASize; UINT32 BtCoexOriBASize; UCHAR BtProtectionMode; UCHAR BtProtectionRate; UCHAR BtSkipFDDFix20MH; #endif /* COEX_SUPPORT */ MLME_STRUCT Mlme; /* AP needs those vaiables for site survey feature. */ #if defined(AP_SCAN_SUPPORT) || defined(CONFIG_STA_SUPPORT) SCAN_CTRL ScanCtrl; BSS_TABLE ScanTab; /* store the latest SCAN result */ #endif /* defined(AP_SCAN_SUPPORT) || defined(CONFIG_STA_SUPPORT) */ EXT_CAP_INFO_ELEMENT ExtCapInfo; #ifdef AIR_MONITOR UCHAR MntEnable; MNT_STA_ENTRY MntTable[MAX_NUM_OF_MONITOR_STA]; MNT_MUAR_GROUP MntGroupTable[MAX_NUM_OF_MONITOR_GROUP]; UCHAR MntIdx; UCHAR curMntAddr[MAC_ADDR_LEN]; UINT32 MonitrCnt[BAND_NUM]; UCHAR MntRuleBitMap; #endif /* AIR_MONITOR */ #ifdef DSCP_PRI_SUPPORT INT8 dscp_pri_map[2][64]; /*priority mapping for dscp values */ #endif /* DOT11_H */ struct DOT11_H Dot11_H[DBDC_BAND_NUM]; /* encryption/decryption KEY tables */ CIPHER_KEY SharedKey[HW_BEACON_MAX_NUM + MAX_P2P_NUM][4]; /* STA always use SharedKey[BSS0][0..3] */ /* various Counters */ COUNTER_802_3 Counters8023; /* 802.3 counters */ COUNTER_802_11 WlanCounters[DBDC_BAND_NUM]; /* 802.11 MIB counters */ COUNTER_RALINK RalinkCounters; /* Ralink propriety counters */ /* COUNTER_DRS DrsCounters; */ /* counters for Dynamic TX Rate Switching */ PRIVATE_STRUC PrivateInfo; /* Private information & counters */ /* flags, see fRTMP_ADAPTER_xxx flags */ ULONG Flags; /* Represent current device status */ ULONG PSFlags; /* Power Save operation flag. */ ULONG MoreFlags; /* Represent specific requirement */ /* current TX sequence # */ USHORT Sequence; /* Control disconnect / connect event generation */ /*+++Didn't used anymore */ ULONG LinkDownTime; /*--- */ ULONG LastRxRate; ULONG LastTxRate; #ifdef CONFIG_AP_SUPPORT BOOLEAN bConfigChanged; /* Config Change flag for the same SSID setting */ #endif /*+++Used only for Station */ BOOLEAN bDisableRtsProtect; /*--- */ ULONG ExtraInfo; /* Extra information for displaying status of UI */ ULONG SystemErrorBitmap; /* b0: E2PROM version error */ #ifdef SYSTEM_LOG_SUPPORT /* --------------------------- */ /* System event log */ /* --------------------------- */ RT_802_11_EVENT_TABLE EventTab; #endif /* SYSTEM_LOG_SUPPORT */ #ifdef HOSTAPD_SUPPORT UINT32 IoctlIF; #endif /* HOSTAPD_SUPPORT */ #ifdef INF_PPA_SUPPORT UINT32 g_if_id; BOOLEAN PPAEnable; PPA_DIRECTPATH_CB *pDirectpathCb; #endif /* INF_PPA_SUPPORT */ /**********************************************************/ /* Statistic related parameters */ /**********************************************************/ BOOLEAN bUpdateBcnCntDone; ULONG macwd; /* ---------------------------- */ /* DEBUG paramerts */ /* ---------------------------- */ BOOLEAN bLinkAdapt; BOOLEAN bForcePrintTX; BOOLEAN bForcePrintRX; BOOLEAN bStaFifoTest; BOOLEAN bProtectionTest; BOOLEAN bHCCATest; BOOLEAN bGenOneHCCA; BOOLEAN bBroadComHT; ULONG BulkOutReq; ULONG BulkOutComplete; ULONG BulkOutCompleteOther; ULONG BulkOutCompleteCancel; /* seems not use now? */ struct wificonf WIFItestbed; UCHAR TssiGain; #ifdef CONFIG_ATE struct _ATE_CTRL ATECtrl; struct _LOOPBACK_CTRL LbCtrl; #endif #ifdef PRE_CAL_TRX_SET1_SUPPORT BOOLEAN KtoFlashDebug; #endif #ifdef DOT11_N_SUPPORT struct reordering_mpdu_pool mpdu_blk_pool; #endif /* DOT11_N_SUPPORT */ /* statistics count */ VOID *iw_stats; VOID *stats; #ifdef BLOCK_NET_IF BLOCK_QUEUE_ENTRY *blockQueueTab; #endif /* BLOCK_NET_IF */ #ifdef CONFIG_AP_SUPPORT #ifdef IGMP_SNOOP_SUPPORT PMULTICAST_FILTER_TABLE pMulticastFilterTable; UCHAR IgmpGroupTxRate; #endif /* IGMP_SNOOP_SUPPORT */ #endif /* CONFIG_AP_SUPPORT */ #ifdef MULTIPLE_CARD_SUPPORT INT32 MC_RowID; RTMP_STRING MC_FileName[256]; UINT32 E2P_OFFSET_IN_FLASH[MAX_NUM_OF_MULTIPLE_CARD]; #endif /* MULTIPLE_CARD_SUPPORT */ ULONG TbttTickCount; /* beacon timestamp work-around */ #ifdef CONFIG_AP_SUPPORT RALINK_TIMER_STRUCT PeriodicTimer; #endif /* CONFIG_AP_SUPPORT */ /* for detect_wmm_traffic() BE TXOP use */ ULONG OneSecondnonBEpackets; /* record non BE packets per second */ #define ONE_SECOND_NON_BE_PACKETS_THRESHOLD (50) UCHAR is_on; /* for detect_wmm_traffic() BE/BK TXOP use */ #define TIME_BASE (1000000/OS_HZ) #define TIME_ONE_SECOND (1000000/TIME_BASE) UCHAR flg_be_adjust; ULONG be_adjust_last_time; #ifdef WSC_INCLUDED /* for multiple card */ UCHAR *pHmacData; #endif /* WSC_INCLUDED */ #ifdef IKANOS_VX_1X0 struct IKANOS_TX_INFO IkanosTxInfo; struct IKANOS_TX_INFO IkanosRxInfo[HW_BEACON_MAX_NUM + MAX_WDS_ENTRY + MAX_APCLI_NUM + MAX_MESH_NUM]; #endif /* IKANOS_VX_1X0 */ UINT8 FlgCtsEnabled; UINT8 PM_FlgSuspend; UCHAR FifoUpdateDone, FifoUpdateRx; #ifdef LINUX #ifdef RT_CFG80211_SUPPORT CFG80211_CTRL cfg80211_ctrl; VOID *pCfg80211_CB; #endif /* RT_CFG80211_SUPPORT */ #endif /* LINUX */ #ifdef OS_ABL_SUPPORT #ifdef MAT_SUPPORT /* used in OS_ABL */ BOOLEAN (*MATPktRxNeedConvert)(RTMP_ADAPTER *pAd, PNET_DEV net_dev); PUCHAR (*MATEngineRxHandle)(RTMP_ADAPTER *pAd, PNDIS_PACKET pPkt, UINT infIdx); #endif /* MAT_SUPPORT */ #endif /* OS_ABL_SUPPORT */ UINT32 ContinueMemAllocFailCount; struct { INT IeLen; UCHAR *pIe; } ProbeRespIE[MAX_LEN_OF_BSS_TABLE]; /* purpose: We free all kernel resources when module is removed */ LIST_HEADER RscTimerMemList; /* resource timers memory */ LIST_HEADER RscTaskMemList; /* resource tasks memory */ LIST_HEADER RscLockMemList; /* resource locks memory */ LIST_HEADER RscTaskletMemList; /* resource tasklets memory */ LIST_HEADER RscSemMemList; /* resource semaphore memory */ LIST_HEADER RscAtomicMemList; /* resource atomic memory */ /* purpose: Cancel all timers when module is removed */ LIST_HEADER RscTimerCreateList; /* timers list */ #ifdef OS_ABL_SUPPORT #ifdef RTMP_PCI_SUPPORT RTMP_PCI_CONFIG PciConfig; #endif /* RTMP_PCI_SUPPORT */ #endif /* OS_ABL_SUPPORT */ #ifdef SMART_ANTENNA int smartAntEnable; /* trigger to enable the smartAntenna function */ int smartAntDbgOn; SMART_ANTENNA_STRUCT *pSAParam; NDIS_SPIN_LOCK smartAntLock;/* lock used to handle synchronization of smart antenna algorithms. */ #endif /* SMART_ANTENNA */ #ifdef CONFIG_MULTI_CHANNEL CHAR NullFrBuf[256]; UINT32 MultiChannelFlowCtl; RTMP_OS_TASK MultiChannelTask; UCHAR MultiChannelAction; #endif /* CONFIG_MULTI_CHANNEL */ #if (defined(WOW_SUPPORT) && defined(RTMP_MAC_USB)) || defined(NEW_WOW_SUPPORT) || defined(MT_WOW_SUPPORT) WOW_CFG_STRUCT WOW_Cfg; /* data structure for wake on wireless */ #endif /* (defined(WOW_SUPPORT) && defined(RTMP_MAC_USB)) || defined(NEW_WOW_SUPPORT) || defined(MT_WOW_SUPPORT) */ #ifdef MULTI_MAC_ADDR_EXT_SUPPORT BOOLEAN bUseMultiMacAddrExt; #endif /* MULTI_MAC_ADDR_EXT_SUPPORT */ #ifdef HW_TX_RATE_LOOKUP_SUPPORT BOOLEAN bUseHwTxLURate; #endif /* HW_TX_RATE_LOOKUP_SUPPORT */ #ifdef CONFIG_ANDES_SUPPORT struct MCU_CTRL MCUCtrl; #endif /* CONFIG_ANDES_SUPPORT */ #ifdef WLAN_SKB_RECYCLE struct sk_buff_head rx0_recycle; #endif /* WLAN_SKB_RECYCLE */ #ifdef CONFIG_MULTI_CHANNEL /* TODO: shiang-usw, duplicate definition with */ USHORT NullBufOffset[2]; CHAR NullFrBuf[100]; UINT32 NullFrLen; /* UINT32 MultiChannelFlowCtl; RTMP_OS_TASK MultiChannelTask; UCHAR MultiChannelAction; */ #endif /* CONFIG_MULTI_CHANNEL */ #ifdef SINGLE_SKU_V2 DL_LIST PwrLimitSkuList; DL_LIST PwrLimitBackoffList; UCHAR DefaultTargetPwr; CHAR SingleSkuRatePwrDiff[19]; BOOLEAN bOpenFileSuccess; #endif /* SINGLE_SKU_V2 */ #if defined(WFA_VHT_PF) || defined(MT7603_FPGA) || defined(MT7628_FPGA) || defined(MT7636_FPGA) || defined(MT7637_FPGA) BOOLEAN force_amsdu; #endif #ifdef WFA_VHT_PF BOOLEAN force_noack; BOOLEAN vht_force_sgi; BOOLEAN vht_force_tx_stbc; BOOLEAN force_vht_op_mode; UCHAR vht_pf_op_ss; UCHAR vht_pf_op_bw; #endif /* WFA_VHT_PF */ #ifdef DBG_DIAGNOSE RtmpDiagStruct DiagStruct; #endif /* DBG_DIAGNOSE */ #ifdef TXBF_SUPPORT MANUAL_CONN AteManualConnInfo; PUCHAR piBfPhaseG0; PUCHAR piBfPhaseGx; BOOLEAN fgCalibrationFail; BOOLEAN fgGroupIdPassFailStatus[9]; BOOLEAN fgAutoStart; #ifdef VHT_TXBF_SUPPORT BOOLEAN NDPA_Request; #endif TXBF_PFMU_STA_INFO rStaRecBf; PFMU_PROFILE_TAG1 rPfmuTag1; PFMU_PROFILE_TAG2 rPfmuTag2; PFMU_DATA prof; UCHAR ApCli_idx; UCHAR ApCli_CmmWlanId; BOOLEAN fgApCliBfStaRecRegister; BOOLEAN fgApClientMode; BOOLEAN fgClonedStaWithBfeeSelected; UCHAR ReptClonedStaEntry_CliIdx; #endif /* TXBF_SUPPORT */ BOOLEAN bPS_Retrieve; UINT32 rxv2_cyc3[10]; #ifdef DBG #ifdef MT_MAC UCHAR BcnCnt; /* Carter debug */ ULONG HandleInterruptTime; ULONG HandlePreInterruptTime; #endif #endif #ifdef RTMP_MAC_PCI UINT32 RxResetDropCount; BOOLEAN RxRest; BOOLEAN PDMAWatchDogEn; BOOLEAN PDMAWatchDogDbg; UINT8 TxDMACheckTimes; UINT8 RxDMACheckTimes; ULONG TxDMAResetCount; ULONG RxDMAResetCount; ULONG PDMAResetFailCount; #endif BOOLEAN PSEWatchDogEn; UINT8 RxPseCheckTimes; RTMP_OS_SEM IndirectUpdateLock; ULONG PSEResetCount; ULONG PSETriggerType1Count; ULONG PSETriggerType2Count; ULONG PSEResetFailCount; ULONG TxTotalByteCnt; ULONG RxTotalByteCnt; #ifdef MT_MAC TX_AC_PARAM_T CurrEdcaParam[CMD_EDCA_AC_MAX]; #endif /* MT_MAC */ #ifdef CONFIG_DVT_MODE DVTCTRL_T rDvtCtrl; #endif /* CONFIG_DVT_MODE */ /* ------------------- */ /* For heart beat detection*/ /* ------------------- */ UINT32 pre_cr4_heart_beat_cnt; UINT32 pre_n9_heart_beat_cnt; UINT8 heart_beat_stop; #ifdef FW_DUMP_SUPPORT /* ---------------------------- */ /* For FW crash dump */ /* ---------------------------- */ #define MAX_FW_DUMP_SIZE 1024000 UCHAR *fw_dump_buffer; UINT32 fw_dump_max_size; UINT32 fw_dump_size; UINT32 fw_dump_read; #endif #if defined(INTERNAL_CAPTURE_SUPPORT) || defined(WIFI_SPECTRUM_SUPPORT) INT32 SpectrumStatus; INT32 ICapStatus; UINT8 ICapMode; UINT32 SpectrumEventCnt; UINT32 SpectrumIdx; UINT32 ICapEventCnt; UINT32 ICapDataCnt; UINT32 ICapL32Cnt; UINT32 ICapM32Cnt; UINT32 ICapH32Cnt; UINT32 ICapIdx; UINT32 ICapCapLen; PUINT32 pL32Bit; PUINT32 pM32Bit; PUINT32 pH32Bit; RTMP_OS_FD pSrcf_IQ; RTMP_OS_FD pSrcf_Gain; RTMP_STRING *pSrc_IQ; RTMP_STRING *pSrc_Gain; RTMP_OS_COMPLETION SpectrumDumpDataDone; RTMP_OS_COMPLETION ICapDumpDone; P_RBIST_IQ_DATA_T pIQ_Array; #endif /* defined(INTERNAL_CAPTURE_SUPPORT) || defined(WIFI_SPECTRUM_SUPPORT) */ #ifdef BACKGROUND_SCAN_SUPPORT BACKGROUND_SCAN_CTRL BgndScanCtrl; #endif /* BACKGROUND_SCAN_SUPPORT */ VOID *hdev_ctrl; #ifdef CONFIG_AP_SUPPORT /*for VOW HW CR address change.*/ VOW_CR_OFFSET_FOR_GEN_T vow_gen; #endif/* CONFIG_AP_SUPPORT */ #ifdef VOW_SUPPORT #ifdef CONFIG_AP_SUPPORT VOW_RX_TIME_CFG_T vow_rx_time_cfg; VOW_BSS_USER_CFG_T vow_bss_cfg[VOW_MAX_GROUP_NUM]; /* VOW_STA_USER_CFG_T vow_sta_cfg[MAX_LEN_OF_MAC_TABLE]; */ VOW_STA_USER_CFG_T vow_sta_cfg[128]; VOW_CFG_T vow_cfg; VOW_AT_ESTIMATOR_T vow_at_est; VOW_BAD_NODE_T vow_badnode; VOW_MISC_CFG_T vow_misc_cfg; UINT8 vow_dvt_en; UINT8 vow_monitor_sta; UINT8 vow_monitor_bss; UINT8 vow_monitor_mbss; UINT16 vow_avg_num; UINT32 vow_show_sta; UINT32 vow_show_mbss; UINT8 vow_watf_en; UINT8 vow_watf_q_lv0; UINT8 vow_watf_q_lv1; UINT8 vow_watf_q_lv2; UINT8 vow_watf_q_lv3; VOW_WATF vow_watf_mac[VOW_WATF_LEVEL_NUM]; UINT8 vow_sta_frr_quantum; /* for fast round robin */ BOOLEAN vow_sta_frr_flag; struct multi_cli_ctl vow_mcli_ctl; #endif /* CONFIG_AP_SUPPORT */ #endif /* VOW_SUPPORT */ UINT8 red_en; #ifdef RED_SUPPORT UINT8 red_have_cr4; UINT8 red_debug_en; RED_STA_T red_sta[MAX_LEN_OF_MAC_TABLE]; UINT16 red_targetdelay; UINT16 red_atm_on_targetdelay; UINT16 red_atm_off_targetdelay; UINT8 red_sta_num; UINT8 red_in_use_sta; RALINK_TIMER_STRUCT red_badnode_timer; #endif /* RED_SUPPORT */ #ifdef FQ_SCH_SUPPORT struct fq_ctrl_type fq_ctrl; #endif /* FQ_SCH_SUPPORT */ UINT8 cp_support; UINT8 cp_have_cr4; UINT8 ucRxRateRecordEn; UINT32 arRateCCK[8]; UINT32 arRateOFDM[8]; UINT32 arRateHT[4][10]; UINT32 arRateVHT[4][10]; /* Start pointer of RxVB element */ PRxVBQElmt prxvbstartelmt; /* Current pointer of RxVB element */ PRxVBQElmt prxvbcurelmt; UINT32 rxvbsize; UINT8 ucRxvRecordEn; UINT8 ucRxvMode; UINT8 ucRxvWcid; UINT8 ucRxvCurSN; UINT8 ucFirstWrite; UINT8 ucRxvBandIdx; UINT8 ucRxvG0; UINT8 ucRxvG1; UINT8 ucRxvG2; UINT8 ucCurRxvQsize; UINT32 u4RFCRBand0ori; UINT32 u4RFCRBand1ori; UINT32 u4BN0RFCR0ori; UINT32 u4BN1RFCR0ori; UINT32 u4RxvDumpCnt; UINT32 u4RxvCurCnt; CHAR RxvFilePath[256]; #ifdef CONFIG_FWOWN_SUPPORT #ifdef RTMP_MAC_PCI UINT8 bDrvOwn; UINT8 bCRAccessing; UINT8 bSetFWOwnRunning; NDIS_SPIN_LOCK DriverOwnLock; /* NDIS_SPIN_LOCK PowerLock; */ #endif #endif /* CONFIG_FWOWN_SUPPORT */ WIFI_SYS_INFO_T WifiSysInfo; struct tx_rx_ctl tr_ctl; #ifdef ERR_RECOVERY ERR_RECOVERY_CTRL_T ErrRecoveryCtl; #endif #ifdef TX_AGG_ADJUST_WKR BOOLEAN TxAggAdjsut; #endif /* TX_AGG_ADJUST_WKR */ NDIS_SPIN_LOCK TimerSemLock; RX_STATISTIC_RXV rx_stat_rxv; UINT32 parse_rxv_stat_enable; UINT32 AccuOneSecRxBand0FcsErrCnt; UINT32 AccuOneSecRxBand0MdrdyCnt; UINT32 AccuOneSecRxBand1FcsErrCnt; UINT32 AccuOneSecRxBand1MdrdyCnt; #ifdef TRACELOG_TCP_PKT UINT32 u4TcpRxAckCnt; UINT32 u4TcpTxDataCnt; #endif #ifdef SMART_CARRIER_SENSE_SUPPORT SMART_CARRIER_SENSE_CTRL SCSCtrl; #endif /* SMART_CARRIER_SENSE_SUPPORT */ RvR_Debug_CTRL RVRDBGCtrl; UINT16 CCI_ACI_TxOP_Value[DBDC_BAND_NUM]; UINT16 MUMIMO_TxOP_Value; BOOL G_MODE_INFRA_TXOP_RUNNING; struct wifi_dev *g_mode_txop_wdev; MT_MIB_BUCKET_ONE_SEC OneSecMibBucket; MT_MIB_BUCKET_MS MsMibBucket; struct peak_tp_ctl peak_tp_ctl[DBDC_BAND_NUM]; struct txop_ctl txop_ctl[DBDC_BAND_NUM]; struct multi_cli_ctl mcli_ctl; #ifdef PKT_BUDGET_CTRL_SUPPORT UINT16 pbc_bound[PBC_AC_NUM]; #endif /*PKT_BUDGET_CTRL_SUPPORT*/ #ifdef HTC_DECRYPT_IOT UINT32 HTC_ICV_Err_TH; /* threshold */ #endif /* HTC_DECRYPT_IOT */ #ifdef DHCP_UC_SUPPORT BOOLEAN DhcpUcEnable; #endif /* DHCP_UC_SUPPORT */ struct wpf_ctrl wpf; /* For QAtool log buffer limitation. */ UINT16 u2LogEntryIdx; UINT8 fgDumpStart; UINT8 fgQAtoolBatchDumpSupport; #ifdef LTF_SNR_SUPPORT INT16 Avg_LTFSNR; INT16 Avg_LTFSNRx16; #endif #ifdef NF_SUPPORT INT16 Avg_NF; INT16 Avg_NFx16; #endif #ifdef CCK_LQ_SUPPORT INT16 Avg_LQ; INT16 Avg_LQx16; #endif #ifdef MULTI_PROFILE VOID *multi_pf_ctrl; #endif /*MULTI_PROFILE*/ UINT8 nearfar_far_client_num; /* far client number in near/far condition */ #ifdef DBG_STARVATION struct starv_log starv_log_ctrl; #endif /*DBG_STARVATION*/ #ifdef MBO_SUPPORT UINT8 MboBssTermCountDown; #endif /* MBO_SUPPORT */ UCHAR reg_domain; /* When connection in process with client set the bit corresponds */ /* to the AID of client and after connection phase over reset the same */ #if (MAX_LEN_OF_MAC_TABLE == 0) ULONG ConInPrgress[1]; #elif ((MAX_LEN_OF_MAC_TABLE % NUM_BITS_IN_ULONG) == 0) ULONG ConInPrgress[(MAX_LEN_OF_MAC_TABLE)/(sizeof(ULONG)*NUM_OF_BITS_IN_BYTE)]; #else ULONG ConInPrgress[(MAX_LEN_OF_MAC_TABLE)/(sizeof(ULONG)*NUM_OF_BITS_IN_BYTE) + 1]; #endif }; typedef struct _PEER_PROBE_REQ_PARAM { UCHAR Addr2[MAC_ADDR_LEN]; CHAR Ssid[MAX_LEN_OF_SSID]; UCHAR SsidLen; BOOLEAN bRequestRssi; #ifdef CONFIG_HOTSPOT BOOLEAN IsIWIE; BOOLEAN IsIWCapability; UCHAR Hessid[MAC_ADDR_LEN]; BOOLEAN IsHessid; UINT8 AccessNetWorkType; #endif /* CONFIG_HOTSPOT */ #ifdef BAND_STEERING BOOLEAN IsHtSupport; BOOLEAN IsVhtSupport; UINT32 RxMCSBitmask; #endif } PEER_PROBE_REQ_PARAM, *PPEER_PROBE_REQ_PARAM; /*************************************************************************** * Rx Path software control block related data structures **************************************************************************/ typedef enum RX_BLK_FLAGS { fRX_AMPDU = (1 << 0), fRX_AMSDU = (1 << 1), fRX_ARALINK = (1 << 2), fRX_HTC = (1 << 3), fRX_PAD = (1 << 4), fRX_QOS = (1 << 5), fRX_EAP = (1 << 6), fRX_WPI = (1 << 7), fRX_AP = (1 << 8), /* Packet received from AP */ fRX_STA = (1 << 9), /* Packet received from Client(Infra mode) */ fRX_ADHOC = (1 << 10), /* packet received from AdHoc peer */ fRX_WDS = (1 << 11), /* Packet received from WDS */ fRX_MESH = (1 << 12), /* Packet received from MESH */ fRX_DLS = (1 << 13), /* Packet received from DLS peer */ fRX_TDLS = (1 << 14), /* Packet received from TDLS peer */ fRX_RETRIEVE = (1 << 15), /* Packet received from mcu */ fRX_CMD_RSP = (1 << 16), /* Pakket received from mcu command response */ fRX_TXRX_RXV = (1 << 17), /* RxV received from Rx Ring1 */ fRX_HDR_TRANS = (1 << 18), fRX_WCID_MISMATCH = (1 << 19), /* for HW Lookup Wcid Mismatch */ } RX_BLK_FLAGS; typedef struct _RX_BLK { UCHAR hw_rx_info[RXD_SIZE]; /* include "RXD_STRUC RxD" and "RXINFO_STRUC rx_info " */ RXINFO_STRUC *pRxInfo; /* for RLT, in head of frame buffer, for RTMP, in hw_rx_info[RXINFO_OFFSET] */ /* TODO: shiang-usw, revise this! */ RXWI_STRUC *pRxWI; /*in frame buffer and after "rx_info" fields */ UCHAR *rmac_info; UCHAR *FC; UINT16 Duration; UCHAR FN; UINT16 SN; UCHAR *Addr1; UCHAR *Addr2; UCHAR *Addr3; UCHAR *Addr4; PNDIS_PACKET pRxPacket; /* os_packet pointer, shall not change */ UCHAR *pData; /* init to pRxPacket->data, refer to frame buffer, may changed depends on processing */ USHORT DataSize; /* init to RXWI->MPDUtotalByteCnt, and may changes depends on processing */ RX_BLK_FLAGS Flags; /* Mirror info of partial fields of RxWI and RxInfo */ USHORT MPDUtotalByteCnt; /* Refer to RXWI->MPDUtotalByteCnt */ UCHAR UserPriority; /* for calculate TKIP MIC using */ UCHAR OpMode; /* 0:OPMODE_STA 1:OPMODE_AP */ UCHAR wcid; /* copy of pRxWI->wcid */ UCHAR U2M; UCHAR key_idx; UCHAR bss_idx; UCHAR TID; UINT32 TimeStamp; struct rx_signal_info rx_signal; CHAR ldpc_ex_sym; HTTRANSMIT_SETTING rx_rate; UINT32 rxv2_cyc1; UINT32 rxv2_cyc2; UINT32 rxv2_cyc3; #ifdef HDR_TRANS_SUPPORT BOOLEAN bHdrVlanTaged; /* VLAN tag is added to this header */ UCHAR *pTransData; USHORT TransDataSize; #endif /* HDR_TRANS_SUPPORT */ #ifdef CONFIG_CSO_SUPPORT RX_CSO_STRUCT rCso; #endif #ifdef CUT_THROUGH UINT16 token_id; #endif /* CUT_THROUGH */ BOOLEAN CipherMis; UINT8 AmsduState; BOOLEAN DeAmsduFail; UINT64 CCMP_PN; #ifdef LTF_SNR_SUPPORT INT16 Ofdm_SNR; #endif } RX_BLK ____cacheline_aligned; #define RX_BLK_SET_FLAG(_pRxBlk, _flag) (_pRxBlk->Flags |= _flag) #define RX_BLK_TEST_FLAG(_pRxBlk, _flag) (_pRxBlk->Flags & _flag) #define RX_BLK_CLEAR_FLAG(_pRxBlk, _flag) (_pRxBlk->Flags &= ~(_flag)) #define AMSDU_SUBHEAD_LEN 14 #define ARALINK_SUBHEAD_LEN 14 #define ARALINK_HEADER_LEN 2 typedef enum TX_FRAME_TYPE { TX_UNKOWN_FRAME, TX_MCAST_FRAME = (1 << 0), TX_LEGACY_FRAME = (1 << 1), TX_AMPDU_FRAME = (1 << 2), TX_AMSDU_FRAME = (1 << 3), TX_FRAG_FRAME = (1 << 4), TX_MLME_MGMTQ_FRAME = (1 << 5), TX_MLME_DATAQ_FRAME = (1 << 6), TX_ATE_FRAME = (1 << 7), } TX_FRAME_TYPE; #define TX_FRAG_ID_NO 0x0 #define TX_FRAG_ID_FIRST 0x1 #define TX_FRAG_ID_MIDDLE 0x2 #define TX_FRAG_ID_LAST 0x3 #define TX_AMSDU_ID_NO 0x0 #define TX_AMSDU_ID_FIRST 0x1 #define TX_AMSDU_ID_MIDDLE 0x2 #define TX_AMSDU_ID_LAST 0x3 typedef enum TX_BLK_FLAGS { fTX_bRtsRequired = (1 << 0), fTX_bAckRequired = (1 << 1), fTX_bPiggyBack = (1 << 2), fTX_bHTRate = (1 << 3), fTX_bWMM = (1 << 4), fTX_bAllowFrag = (1 << 5), fTX_bMoreData = (1 << 6), fTX_bClearEAPFrame = (1 << 8), fTX_bApCliPacket = (1 << 9), fTX_bSwEncrypt = (1 << 10), fTX_bWMM_UAPSD_EOSP = (1 << 11), fTX_bWDSEntry = (1 << 12), fTX_bDonglePkt = (1 << 13), fTX_bMeshEntry = (1 << 14), fTX_bWPIDataFrame = (1 << 15), fTX_bClientWDSFrame = (1 << 16), fTX_bTdlsEntry = (1 << 17), fTX_AmsduInAmpdu = (1 << 18), fTX_ForceRate = (1 << 19), fTX_CT_WithTxD = (1 << 20), fTX_CT_WithoutTxD = (1 << 21), fTX_DumpPkt = (1 << 22), fTX_HDR_TRANS = (1 << 23), fTX_MCU_OFFLOAD = (1 << 24), fTX_MCAST_CLONE = (1 << 25), fTX_HIGH_PRIO = (1 << 26), fTX_HW_AMSDU = (1 << 28), } TX_BLK_FLAGS; typedef struct _TX_BLK { UCHAR resource_idx ____cacheline_aligned; UCHAR QueIdx; UCHAR WmmIdx; UCHAR TotalFrameNum; /* Total frame number want to send-out in one batch */ UCHAR TotalFragNum; /* Total frame fragments required in one batch */ UCHAR TxFrameType; /* Indicate the Transmission type of the all frames in one batch */ USHORT TotalFrameLen; /* Total length of all frames want to send-out in one batch */ STA_TR_ENTRY *tr_entry; PNDIS_PACKET pPacket; struct wifi_dev *wdev; MAC_TABLE_ENTRY *pMacEntry; /* NULL: packet with 802.11 RA field is multicast/broadcast address */ TX_BLK_FLAGS Flags; UCHAR UserPriority; /* priority class of packet */ UCHAR Wcid; /* The MAC entry associated to this packet */ UINT8 wmm_set; UINT8 dbdc_band; UCHAR *pSrcBufHeader; /* Reference to the head of sk_buff->data */ UINT SrcBufLen; /* Length of packet payload which not including Layer 2 header */ UCHAR wifi_hdr_len; /* 802.11 header */ UCHAR frame_idx; UCHAR amsdu_state; UCHAR FragIdx; /* refer to TX_FRAG_ID_xxxx */ UCHAR *pSrcBufData; /* Reference to the sk_buff->data, will changed depends on hanlding progresss */ UCHAR HdrPadLen; /* padding length*/ UCHAR MpduHeaderLen; /* 802.11 header + LLC/SNAP not including padding */ INT16 tx_bytes_len; /* txd + packet length not including txp */ UCHAR txp_len; UCHAR hw_rsv_len; UCHAR first_buf_len; ra_dma_addr_t SrcBufPA; QUEUE_HEADER TxPacketList; HTTRANSMIT_SETTING *pTransmit; UCHAR *pExtraLlcSnapEncap; /* NULL means no extra LLC/SNAP is required */ UCHAR *HeaderBuf; UCHAR *wifi_hdr; UCHAR FrameGap; /* what kind of IFS this packet use */ UCHAR MpduReqNum; /* number of fragments of this frame */ UCHAR TxRate; /* TODO: Obsoleted? Should change to MCS? */ UINT32 CipherAlg; /* cipher alogrithm */ PCHAR pKey; UCHAR KeyIdx; /* Indicate the transmit key index */ UCHAR OpMode; #ifdef DSCP_PRI_SUPPORT INT8 DscpMappedPri; #endif #ifdef CONFIG_AP_SUPPORT #ifdef APCLI_SUPPORT UINT ApCliIfidx; PAPCLI_STRUCT pApCliEntry; #endif /* APCLI_SUPPORT */ BSS_STRUCT *pMbss; #endif /* CONFIG_AP_SUPPORT */ ULONG Priv; /* Hardware specific value saved in here. */ #if defined(CONFIG_CSO_SUPPORT) || defined(CONFIG_TSO_SUPPORT) UCHAR naf_type; #endif /* defined(CONFIG_CSO_SUPPORT) || defined(CONFIG_TSO_SUPPORT) */ #ifdef TXBF_SUPPORT UCHAR TxSndgPkt; /* 1: sounding 2: NDP sounding */ UCHAR TxNDPSndgBW; UCHAR TxNDPSndgMcs; #endif /* TXBF_SUPPORT */ UINT8 dot11_type; UINT8 dot11_subtype; UINT8 TxSFormat; UINT8 Pid; UINT8 TxS2Host; UINT8 TxS2Mcu; UINT32 TxSPriv; #ifdef RANDOM_PKT_GEN UINT8 lmac_qidx; #endif UINT32 HeaderBuffer[32] ____cacheline_aligned; } TX_BLK; #define TX_BLK_SET_FLAG(_pTxBlk, _flag) (_pTxBlk->Flags |= _flag) #define TX_BLK_TEST_FLAG(_pTxBlk, _flag) (((_pTxBlk->Flags & _flag) == _flag) ? 1 : 0) #define TX_BLK_CLEAR_FLAG(_pTxBlk, _flag) (_pTxBlk->Flags &= ~(_flag)) #ifdef DBG_DEQUE struct deq_log_struct { UCHAR que_depth[WMM_NUM_OF_AC]; UCHAR deq_cnt[WMM_NUM_OF_AC]; UCHAR deq_round; }; #endif /* DBG_DEQUE */ typedef struct dequeue_info { BOOLEAN inited; UCHAR start_q; UCHAR end_q; CHAR cur_q; UCHAR target_wcid; UCHAR target_que; UCHAR cur_wcid; USHORT q_max_cnt[WMM_QUE_NUM]; INT pkt_bytes; INT pkt_cnt; INT deq_pkt_bytes; INT deq_pkt_cnt; INT status; BOOLEAN full_qid[WMM_QUE_NUM]; #ifdef DBG_DEQUE deq_log_struct deq_log; #endif /* DBG_DEQUE */ } DEQUE_INFO; #ifdef TRACELOG_TCP_PKT #define TCP_TRAFFIC_DATAPKT_MIN_SIZE 1000 static inline BOOLEAN RTMPIsTcpDataPkt( IN PNDIS_PACKET pPacket) { UINT32 pktlen; pktlen = GET_OS_PKT_LEN(pPacket); if (pktlen > TCP_TRAFFIC_DATAPKT_MIN_SIZE) return TRUE; else return FALSE; } #define TCP_TRAFFIC_ACKPKT_SIZE 54 static inline BOOLEAN RTMPIsTcpAckPkt( IN PNDIS_PACKET pPacket) { UINT32 pktlen; pktlen = GET_OS_PKT_LEN(pPacket); if (pktlen == TCP_TRAFFIC_ACKPKT_SIZE) return TRUE; else return FALSE; } #endif /* TRACELOG_TCP_PKT */ #ifdef RT_BIG_ENDIAN #include "hdev_ctrl.h" /*************************************************************************** * Endian conversion related functions **************************************************************************/ #ifdef MT_MAC static inline VOID mt_rmac_d0_endian_change(UINT32 *rxinfo) { (*rxinfo) = SWAP32(*rxinfo); } static inline VOID mt_rmac_base_info_endian_change( IN RTMP_ADAPTER *pAd, IN UCHAR *rxinfo) { int i; for (i = 1; i < 4; i++) *(((UINT32 *)rxinfo) + i) = SWAP32(*(((UINT32 *)rxinfo) + i)); } #endif /* MT_MAC */ /* ======================================================================== Routine Description: Endian conversion of Tx/Rx descriptor . Arguments: pAd Pointer to our adapter pData Pointer to Tx/Rx descriptor DescriptorType Direction of the frame Return Value: None Note: Call this function when read or update descriptor ======================================================================== */ static inline VOID RTMPWIEndianChange( IN RTMP_ADAPTER *pAd, IN UCHAR *pData, IN ULONG DescriptorType) { int size; int i; struct _RTMP_CHIP_CAP *cap = hc_get_chip_cap(pAd->hdev_ctrl); UINT8 TXWISize = cap->TXWISize; UINT8 RXWISize = cap->RXWISize; size = ((DescriptorType == TYPE_TXWI) ? TXWISize : RXWISize); if (DescriptorType == TYPE_TXWI) { *((UINT32 *)(pData)) = SWAP32(*((UINT32 *)(pData))); /* Byte 0~3 */ *((UINT32 *)(pData + 4)) = SWAP32(*((UINT32 *)(pData + 4))); /* Byte 4~7 */ if (size > 16) *((UINT32 *)(pData + 16)) = SWAP32(*((UINT32 *)(pData + 16))); /* Byte 16~19 */ } else { for (i = 0; i < size / 4; i++) *(((UINT32 *)pData) + i) = SWAP32(*(((UINT32 *)pData) + i)); } } #ifdef MT_MAC /* ======================================================================== Routine Description: Endian conversion of MacTxInfo/MacRxInfo descriptor . Arguments: pAd Pointer to our adapter pData Pointer to Tx/Rx descriptor DescriptorType Direction of the frame Length Length of MacTxInfo/MacRxInfo Return Value: None Note: Call this function when read or update descriptor ======================================================================== */ static inline VOID MTMacInfoEndianChange( IN RTMP_ADAPTER *pAd, IN UCHAR *pData, IN ULONG DescriptorType, IN UINT16 Length) { int i; if (DescriptorType == TYPE_TMACINFO) { for (i = 0; i < Length / 4; i++) *(((UINT32 *)pData) + i) = SWAP32(*(((UINT32 *)pData) + i)); } else { /* TYPE_RMACINFO */ for (i = 1; i < Length / 4; i++) /* i from 1, due to 1st DW had endia change already, so skip it here. */ *(((UINT32 *)pData) + i) = SWAP32(*(((UINT32 *)pData) + i)); } } #endif /* MT_MAC */ #ifdef RTMP_MAC_PCI static inline VOID WriteBackToDescriptor( IN UCHAR *Dest, IN UCHAR *Src, IN BOOLEAN DoEncrypt, IN ULONG DescriptorType) { UINT32 *p1, *p2; p1 = ((UINT32 *)Dest); p2 = ((UINT32 *)Src); *p1 = *p2; *(p1 + 2) = *(p2 + 2); /*new txd & rxd just have 3 word*/ #ifndef MT7615 *(p1 + 3) = *(p2 + 3); #endif /* +++Add by shiang for jeffrey debug */ #ifdef LINUX wmb(); #endif /* LINUX */ /* ---Add by shiang for jeffrey debug */ *(p1 + 1) = *(p2 + 1); /* Word 1; this must be written back last */ } #endif /* RTMP_MAC_PCI */ /* ======================================================================== Routine Description: Endian conversion of Tx/Rx descriptor . Arguments: pAd Pointer to our adapter pData Pointer to Tx/Rx descriptor DescriptorType Direction of the frame Return Value: None Note: Call this function when read or update descriptor ======================================================================== */ #ifdef RTMP_MAC_PCI static inline VOID RTMPDescriptorEndianChange(UCHAR *pData, ULONG DescType) { *((UINT32 *)(pData)) = SWAP32(*((UINT32 *)(pData))); /* Byte 0~3 */ *((UINT32 *)(pData + 8)) = SWAP32(*((UINT32 *)(pData + 8))); /* Byte 8~11 */ /*new txd & rxd just have 3 word*/ #ifndef MT7615 *((UINT32 *)(pData + 12)) = SWAP32(*((UINT32 *)(pData + 12))); /* Byte 12~15 */ #endif *((UINT32 *)(pData + 4)) = SWAP32(*((UINT32 *)(pData + 4))); /* Byte 4~7, this must be swapped last */ } #endif /* RTMP_MAC_PCI */ /* ======================================================================== Routine Description: Endian conversion of all kinds of 802.11 frames . Arguments: pAd Pointer to our adapter pData Pointer to the 802.11 frame structure Dir Direction of the frame FromRxDoneInt Caller is from RxDone interrupt Return Value: None Note: Call this function when read or update buffer data ======================================================================== */ static inline VOID RTMPFrameEndianChange( IN RTMP_ADAPTER *pAd, IN PUCHAR pData, IN ULONG Dir, IN BOOLEAN FromRxDoneInt) { PHEADER_802_11 pFrame; PUCHAR pMacHdr; /* swab 16 bit fields - Frame Control field */ if (Dir == DIR_READ) *(USHORT *)pData = SWAP16(*(USHORT *)pData); pFrame = (PHEADER_802_11) pData; pMacHdr = (PUCHAR) pFrame; /* swab 16 bit fields - Duration/ID field */ *(USHORT *)(pMacHdr + 2) = SWAP16(*(USHORT *)(pMacHdr + 2)); if (pFrame->FC.Type != FC_TYPE_CNTL) { /* swab 16 bit fields - Sequence Control field */ *(USHORT *)(pMacHdr + 22) = SWAP16(*(USHORT *)(pMacHdr + 22)); } if (pFrame->FC.Type == FC_TYPE_MGMT) { switch (pFrame->FC.SubType) { case SUBTYPE_ASSOC_REQ: case SUBTYPE_REASSOC_REQ: /* swab 16 bit fields - CapabilityInfo field */ pMacHdr += sizeof(HEADER_802_11); *(USHORT *)pMacHdr = SWAP16(*(USHORT *)pMacHdr); /* swab 16 bit fields - Listen Interval field */ pMacHdr += 2; *(USHORT *)pMacHdr = SWAP16(*(USHORT *)pMacHdr); break; case SUBTYPE_ASSOC_RSP: case SUBTYPE_REASSOC_RSP: /* swab 16 bit fields - CapabilityInfo field */ pMacHdr += sizeof(HEADER_802_11); *(USHORT *)pMacHdr = SWAP16(*(USHORT *)pMacHdr); /* swab 16 bit fields - Status Code field */ pMacHdr += 2; *(USHORT *)pMacHdr = SWAP16(*(USHORT *)pMacHdr); /* swab 16 bit fields - AID field */ pMacHdr += 2; *(USHORT *)pMacHdr = SWAP16(*(USHORT *)pMacHdr); break; case SUBTYPE_AUTH: /* When the WEP bit is on, don't do the conversion here. This is only shared WEP can hit this condition. For AP, it shall do conversion after decryption. For STA, it shall do conversion before encryption. */ if (pFrame->FC.Wep == 1) break; else { /* swab 16 bit fields - Auth Alg No. field */ pMacHdr += sizeof(HEADER_802_11); *(USHORT *)pMacHdr = SWAP16(*(USHORT *)pMacHdr); /* swab 16 bit fields - Auth Seq No. field */ pMacHdr += 2; *(USHORT *)pMacHdr = SWAP16(*(USHORT *)pMacHdr); /* swab 16 bit fields - Status Code field */ pMacHdr += 2; *(USHORT *)pMacHdr = SWAP16(*(USHORT *)pMacHdr); } break; case SUBTYPE_BEACON: case SUBTYPE_PROBE_RSP: /* swab 16 bit fields - BeaconInterval field */ pMacHdr += (sizeof(HEADER_802_11) + TIMESTAMP_LEN); *(USHORT *)pMacHdr = SWAP16(*(USHORT *)pMacHdr); /* swab 16 bit fields - CapabilityInfo field */ pMacHdr += sizeof(USHORT); *(USHORT *)pMacHdr = SWAP16(*(USHORT *)pMacHdr); break; case SUBTYPE_DEAUTH: case SUBTYPE_DISASSOC: /* If the PMF is negotiated, those frames shall be encrypted */ if (!FromRxDoneInt && pFrame->FC.Wep == 1) break; else { /* swab 16 bit fields - Reason code field */ pMacHdr += sizeof(HEADER_802_11); *(USHORT *)pMacHdr = SWAP16(*(USHORT *)pMacHdr); } break; } /* } else if (pFrame->FC.Type == FC_TYPE_DATA) { */ } else if (pFrame->FC.Type == FC_TYPE_CNTL) { switch (pFrame->FC.SubType) { case SUBTYPE_BLOCK_ACK_REQ: { PFRAME_BA_REQ pBAReq = (PFRAME_BA_REQ)pFrame; *(USHORT *)(&pBAReq->BARControl) = SWAP16(*(USHORT *)(&pBAReq->BARControl)); pBAReq->BAStartingSeq.word = SWAP16(pBAReq->BAStartingSeq.word); } break; case SUBTYPE_BLOCK_ACK: /* For Block Ack packet, the HT_CONTROL field is in the same offset with Addr3 */ *(UINT32 *)(&pFrame->Addr3[0]) = SWAP32(*(UINT32 *)(&pFrame->Addr3[0])); break; case SUBTYPE_ACK: /*For ACK packet, the HT_CONTROL field is in the same offset with Addr2 */ *(UINT32 *)(&pFrame->Addr2[0]) = SWAP32(*(UINT32 *)(&pFrame->Addr2[0])); break; } } else MTWF_LOG(DBG_CAT_RX, DBG_SUBCAT_ALL, DBG_LVL_ERROR, ("Invalid Frame Type!!!\n")); /* swab 16 bit fields - Frame Control */ if (Dir == DIR_WRITE) *(USHORT *)pData = SWAP16(*(USHORT *)pData); } /* ======================================================================== Routine Description: Endian conversion of normal data ,data type should be int or uint. Arguments: pAd Pointer to our adapter pData Pointer to data size length of data Return Value: None ======================================================================== */ static inline VOID RTMPEndianChange( IN UCHAR *pData, IN UINT size) { int i; if (size % 4) MTWF_LOG(DBG_CAT_AP, DBG_SUBCAT_ALL, DBG_LVL_ERROR, ("Invalid DATA Type!!!\n")); else { for (i = 0; i < size / 4; i++) *(((UINT32 *)pData) + i) = SWAP32(*(((UINT32 *)pData) + i)); } } #endif /* RT_BIG_ENDIAN */ /*************************************************************************** * Other static inline function definitions **************************************************************************/ static inline VOID ConvertMulticastIP2MAC( IN PUCHAR pIpAddr, IN PUCHAR *ppMacAddr, IN UINT16 ProtoType) { if (pIpAddr == NULL) return; if (ppMacAddr == NULL || *ppMacAddr == NULL) return; switch (ProtoType) { case ETH_P_IPV6: /* memset(*ppMacAddr, 0, MAC_ADDR_LEN); */ *(*ppMacAddr) = 0x33; *(*ppMacAddr + 1) = 0x33; *(*ppMacAddr + 2) = pIpAddr[12]; *(*ppMacAddr + 3) = pIpAddr[13]; *(*ppMacAddr + 4) = pIpAddr[14]; *(*ppMacAddr + 5) = pIpAddr[15]; break; case ETH_P_IP: default: /* memset(*ppMacAddr, 0, MAC_ADDR_LEN); */ *(*ppMacAddr) = 0x01; *(*ppMacAddr + 1) = 0x00; *(*ppMacAddr + 2) = 0x5e; *(*ppMacAddr + 3) = pIpAddr[1] & 0x7f; *(*ppMacAddr + 4) = pIpAddr[2]; *(*ppMacAddr + 5) = pIpAddr[3]; break; } return; } char *get_phymode_str(int phy_mode); NDIS_STATUS alloc_chip_cap_dep_data(RTMP_ADAPTER *pAd); VOID free_chip_cap_dep_data(RTMP_ADAPTER *pAd); NDIS_STATUS alloc_chip_cap_dep_data_cmm(RTMP_ADAPTER *pAd); VOID free_chip_cap_dep_data_cmm(RTMP_ADAPTER *pAd); NDIS_STATUS alloc_chip_cap_dep_data_pci(void *hdev_ctrl); VOID free_chip_cap_dep_data_pci(void *hdev_ctrl); NDIS_STATUS alloc_chip_cap_dep_data_usb(RTMP_ADAPTER *pAd); VOID free_chip_cap_dep_data_usb(RTMP_ADAPTER *pAd); NDIS_STATUS RTMPAllocTxRxRingMemory(RTMP_ADAPTER *pAd); #ifdef RESOURCE_PRE_ALLOC NDIS_STATUS RTMPInitTxRxRingMemory(RTMP_ADAPTER *pAd); #endif /* RESOURCE_PRE_ALLOC */ struct dev_type_name_map_t { INT type; RTMP_STRING prefix[IFNAMSIZ]; }; void rtmp_eeprom_of_platform(RTMP_ADAPTER *pAd); NDIS_STATUS load_dev_l1profile(RTMP_ADAPTER *pAd); UCHAR *get_dev_l2profile(RTMP_ADAPTER *pAd); INT get_dev_config_idx(RTMP_ADAPTER *pAd); UCHAR *get_dev_name_prefix(RTMP_ADAPTER *pAd, INT dev_type); #ifdef SINGLE_SKU_V2 UCHAR *get_single_sku_path(RTMP_ADAPTER *pAd); UCHAR *get_bf_sku_path(RTMP_ADAPTER *pAd); #endif int ShowL1profile(RTMP_ADAPTER *pAd, RTMP_STRING *arg); NDIS_STATUS RTMPReadParametersHook(RTMP_ADAPTER *pAd); NDIS_STATUS RTMPSetProfileParameters(RTMP_ADAPTER *pAd, RTMP_STRING *pBuffer); NDIS_STATUS RTMPPreReadProfile(RTMP_ADAPTER *pAd); NDIS_STATUS RTMPSetPreProfileParameters(RTMP_ADAPTER *pAd, RTMP_STRING *pBuffer); INT RTMPGetKeyParameter( IN RTMP_STRING *key, OUT RTMP_STRING *dest, IN INT destsize, IN RTMP_STRING *buffer, IN BOOLEAN bTrimSpace); INT RTMPSetKeyParameter( IN RTMP_STRING *key, OUT CHAR *value, IN INT destsize, IN RTMP_STRING *buffer, IN BOOLEAN bTrimSpace); INT RTMPAddKeyParameter( IN RTMP_STRING *key, OUT CHAR *value, IN INT destsize, IN RTMP_STRING *buffer); INT RTMPGetKeyParameterWithOffset( IN RTMP_STRING *key, OUT RTMP_STRING *dest, OUT USHORT *end_offset, IN INT destsize, IN RTMP_STRING *buffer, IN BOOLEAN bTrimSpace); #ifdef WSC_INCLUDED VOID rtmp_read_wsc_user_parms_from_file( IN RTMP_ADAPTER *pAd, IN char *tmpbuf, IN char *buffer); #endif/*WSC_INCLUDED*/ INT rtmp_band_index_get_by_order(struct _RTMP_ADAPTER *pAd, UCHAR order); #ifdef VOW_SUPPORT #ifdef CONFIG_AP_SUPPORT void rtmp_read_vow_parms_from_file(IN PRTMP_ADAPTER pAd, char *tmpbuf, char *buffer); #endif /* CONFIG_AP_SUPPORT */ #endif /* VOW_SUPPORT */ #ifdef RED_SUPPORT void rtmp_read_red_parms_from_file( IN PRTMP_ADAPTER pAd, char *tmpbuf, char *buffer); #endif /* RED_SUPPORT */ #ifdef FQ_SCH_SUPPORT void rtmp_read_fq_parms_from_file(IN PRTMP_ADAPTER pAd, char *tmpbuf, char *buffer); #endif /* FQ_SCH_SUPPORT */ void rtmp_read_cp_parms_from_file( IN PRTMP_ADAPTER pAd, char *tmpbuf, char *buffer); VOID cp_support_is_enabled( PRTMP_ADAPTER pAd); INT set_cp_support_en( IN PRTMP_ADAPTER pAd, IN RTMP_STRING *arg); #ifdef SINGLE_SKU_V2 NDIS_STATUS RTMPSetSkuParam(RTMP_ADAPTER *pAd); NDIS_STATUS RTMPSetBackOffParam(RTMP_ADAPTER *pAd); NDIS_STATUS RTMPResetSkuParam(RTMP_ADAPTER *pAd); NDIS_STATUS RTMPResetBackOffParam(RTMP_ADAPTER *pAd); VOID InitSkuRateDiffTable(RTMP_ADAPTER *pAd); UCHAR GetSkuChannelBasePwr(RTMP_ADAPTER *pAd, struct wifi_dev *wdev, UCHAR channel); VOID UpdateSkuRatePwr(RTMP_ADAPTER *pAd, UCHAR ch, UCHAR bw, CHAR base_pwr); #endif /* SINGLE_SKU_V2 */ #ifdef RTMP_RF_RW_SUPPORT VOID RTMP_ReadRF( IN RTMP_ADAPTER *pAd, IN UCHAR RegID, OUT PUCHAR pValue1, OUT PUCHAR pValue2, IN UCHAR BitMask); VOID RTMP_WriteRF( IN RTMP_ADAPTER *pAd, IN UCHAR RegID, IN UCHAR Value, IN UCHAR BitMask); NDIS_STATUS RT30xxWriteRFRegister( IN RTMP_ADAPTER *pAd, IN UCHAR regID, IN UCHAR value); NDIS_STATUS RT30xxReadRFRegister( IN RTMP_ADAPTER *pAd, IN UCHAR regID, IN PUCHAR pValue); NDIS_STATUS RT635xWriteRFRegister( IN RTMP_ADAPTER *pAd, IN UCHAR bank, IN UCHAR regID, IN UCHAR value); NDIS_STATUS RT635xReadRFRegister( IN RTMP_ADAPTER *pAd, IN UCHAR bank, IN UCHAR regID, IN PUCHAR pValue); BOOLEAN RTMPAdjustFrequencyOffset( IN RTMP_ADAPTER *pAd, INOUT PUCHAR pRefFreqOffset); #endif /* RTMP_RF_RW_SUPPORT */ BOOLEAN RTMPCheckPhyMode( IN RTMP_ADAPTER *pAd, IN UINT8 BandSupported, INOUT UCHAR *pPhyMode); #ifdef RTMP_MAC_PCI INT NICInitPwrPinCfg(RTMP_ADAPTER *pAd); #endif /* RTMP_MAC_PCI */ VOID NICInitAsicFromEEPROM(RTMP_ADAPTER *pAd); NDIS_STATUS NICInitializeAdapter(RTMP_ADAPTER *pAd); NDIS_STATUS NICInitializeAsic(RTMP_ADAPTER *pAd); VOID NICResetFromError(RTMP_ADAPTER *pAd); VOID RTMPRingCleanUp( IN RTMP_ADAPTER *pAd, IN UCHAR RingType); VOID UserCfgExit(RTMP_ADAPTER *pAd); VOID UserCfgInit(RTMP_ADAPTER *pAd); VOID NICUpdateFifoStaCounters(RTMP_ADAPTER *pAd); VOID NICUpdateRawCounters(RTMP_ADAPTER *pAd); UINT32 AsicGetCrcErrCnt(RTMP_ADAPTER *pAd); UINT32 AsicGetCCACnt(RTMP_ADAPTER *pAd); UINT32 AsicGetChBusyCnt(RTMP_ADAPTER *pAd, UCHAR ch_idx); VOID AsicDMASchedulerInit(RTMP_ADAPTER *pAd, INT mode); VOID AsicTxCntUpdate(RTMP_ADAPTER *pAd, UCHAR Wcid, MT_TX_COUNTER *pTxInfo); VOID NicResetRawCounters(RTMP_ADAPTER *pAd); VOID NicGetTxRawCounters( IN RTMP_ADAPTER *pAd, IN TX_STA_CNT0_STRUC * pStaTxCnt0, IN TX_STA_CNT1_STRUC * pStaTxCnt1); VOID RTMPZeroMemory(VOID *pSrc, ULONG Length); ULONG RTMPCompareMemory(VOID *pSrc1, VOID *pSrc2, ULONG Length); VOID RTMPMoveMemory(VOID *pDest, VOID *pSrc, ULONG Length); VOID AtoH(RTMP_STRING *src, UCHAR *dest, int destlen); UCHAR BtoH(char ch); VOID RTMP_TimerListAdd(RTMP_ADAPTER *pAd, VOID *pRsc); VOID RTMP_TimerListRelease(RTMP_ADAPTER *pAd, VOID *pRsc); VOID RTMP_AllTimerListRelease(RTMP_ADAPTER *pAd); VOID RTMPInitTimer( IN RTMP_ADAPTER *pAd, IN RALINK_TIMER_STRUCT *pTimer, IN VOID *pTimerFunc, IN VOID *pData, IN BOOLEAN Repeat); VOID RTMPSetTimer(RALINK_TIMER_STRUCT *pTimer, ULONG Value); VOID RTMPModTimer(RALINK_TIMER_STRUCT *pTimer, ULONG Value); VOID RTMPCancelTimer(RALINK_TIMER_STRUCT *pTimer, BOOLEAN *pCancelled); VOID RTMPReleaseTimer(RALINK_TIMER_STRUCT *pTimer, BOOLEAN *pCancelled); VOID RTMPShowTimerList(RTMP_ADAPTER *pAd); VOID RTMPEnableRxTx(RTMP_ADAPTER *pAd); VOID RTMPDisableRxTx(RTMP_ADAPTER *pAd); VOID AntCfgInit(RTMP_ADAPTER *pAd); VOID rtmp_init_hook_set(RTMP_ADAPTER *pAd); /* */ /* prototype in action.c */ /* */ VOID ActHeaderInit( IN RTMP_ADAPTER *pAd, IN OUT HEADER_802_11 *pHdr80211, IN UCHAR *da, IN UCHAR *sa, IN UCHAR *bssid); VOID ActionStateMachineInit( IN RTMP_ADAPTER *pAd, IN STATE_MACHINE *S, OUT STATE_MACHINE_FUNC Trans[]); VOID MlmeADDBAAction( IN RTMP_ADAPTER *pAd, IN MLME_QUEUE_ELEM *Elem); VOID MlmeDELBAAction( IN RTMP_ADAPTER *pAd, IN MLME_QUEUE_ELEM *Elem); VOID SendSMPSAction( IN RTMP_ADAPTER *pAd, IN UCHAR Wcid, IN UCHAR smps); #ifdef CONFIG_AP_SUPPORT VOID SendBeaconRequest( IN RTMP_ADAPTER *pAd, IN UCHAR Wcid); #endif /* CONFIG_AP_SUPPORT */ #ifdef DOT11_N_SUPPORT VOID RECBATimerTimeout( IN PVOID SystemSpecific1, IN PVOID FunctionContext, IN PVOID SystemSpecific2, IN PVOID SystemSpecific3); VOID ORIBATimerTimeout( IN RTMP_ADAPTER *pAd); VOID SendRefreshBAR( IN RTMP_ADAPTER *pAd, IN MAC_TABLE_ENTRY *pEntry); #ifdef DOT11N_DRAFT3 VOID RTMP_11N_D3_TimerInit( IN RTMP_ADAPTER *pAd); VOID RTMP_11N_D3_TimerRelease( IN RTMP_ADAPTER *pAd); VOID SendBSS2040CoexistMgmtAction( IN RTMP_ADAPTER *pAd, IN UCHAR Wcid, IN UCHAR apidx, IN UCHAR InfoReq); VOID SendNotifyBWActionFrame( IN RTMP_ADAPTER *pAd, IN UCHAR Wcid, IN UCHAR apidx); BOOLEAN ChannelSwitchSanityCheck( IN RTMP_ADAPTER *pAd, IN UCHAR Wcid, IN UCHAR NewChannel, IN UCHAR Secondary); VOID ChannelSwitchAction( IN RTMP_ADAPTER *pAd, IN UCHAR Wcid, IN UCHAR Channel, IN UCHAR Secondary); ULONG BuildIntolerantChannelRep( IN RTMP_ADAPTER *pAd, IN PUCHAR pDest); VOID Update2040CoexistFrameAndNotify( IN RTMP_ADAPTER *pAd, IN UCHAR Wcid, IN BOOLEAN bAddIntolerantCha); VOID Send2040CoexistAction( IN RTMP_ADAPTER *pAd, IN UCHAR Wcid, IN BOOLEAN bAddIntolerantCha); VOID UpdateBssScanParm( IN RTMP_ADAPTER *pAd, IN OVERLAP_BSS_SCAN_IE APBssScan); #endif /* DOT11N_DRAFT3 */ INT AsicSetRalinkBurstMode(RTMP_ADAPTER *pAd, BOOLEAN enable); #endif /* DOT11_N_SUPPORT */ UCHAR get_regulatory_class(RTMP_ADAPTER *pAd, UCHAR Channel, UCHAR PhyMode, struct wifi_dev *wdev); UCHAR get_channel_set_num(UCHAR *ChannelSet); PUCHAR get_channelset_by_reg_class( IN RTMP_ADAPTER *pAd, IN UINT8 RegulatoryClass, IN UCHAR PhyMode); INT Set_Reg_Domain_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); VOID BarHeaderInit( IN RTMP_ADAPTER *pAd, IN OUT PFRAME_BAR pCntlBar, IN PUCHAR pDA, IN PUCHAR pSA); VOID InsertActField( IN RTMP_ADAPTER *pAd, OUT PUCHAR pFrameBuf, OUT PULONG pFrameLen, IN UINT8 Category, IN UINT8 ActCode); BOOLEAN QosBADataParse( IN RTMP_ADAPTER *pAd, IN BOOLEAN bAMSDU, IN PUCHAR p8023Header, IN UCHAR WCID, IN UCHAR TID, IN USHORT Sequence, IN UCHAR DataOffset, IN USHORT Datasize, IN UINT CurRxIndex); BOOLEAN bar_process( RTMP_ADAPTER *pAd, ULONG Wcid, ULONG MsgLen, PFRAME_BA_REQ pMsg); VOID BaAutoManSwitch( IN RTMP_ADAPTER *pAd); VOID HTIOTCheck( IN RTMP_ADAPTER *pAd, IN UCHAR BatRecIdx); INT32 wdev_init(RTMP_ADAPTER *pAd, struct wifi_dev *wdev, enum WDEV_TYPE wdev_type, PNET_DEV if_dev, INT8 func_idx, VOID *func_dev, VOID *sys_handle); INT32 wdev_deinit(RTMP_ADAPTER *pAd, struct wifi_dev *wdev); enum queue_mm; INT wdev_ops_register(struct wifi_dev *wdev, enum WDEV_TYPE wdev_type, struct wifi_dev_ops *ops, UCHAR wmm_detect_method); INT32 wdev_attr_update(RTMP_ADAPTER *pAd, struct wifi_dev *wdev); INT wdev_tx_pkts(NDIS_HANDLE dev_hnd, PPNDIS_PACKET pkt_list, UINT pkt_cnt, struct wifi_dev *wdev); UCHAR get_frag_num(RTMP_ADAPTER *pAd, struct wifi_dev *wdev, PNDIS_PACKET pPacket); BOOLEAN check_if_fragment(struct wifi_dev *wdev, PNDIS_PACKET pPacket); #ifdef TX_AGG_ADJUST_WKR BOOLEAN tx_check_for_agg_adjust(RTMP_ADAPTER *pAd, MAC_TABLE_ENTRY *pEntry); #endif /* TX_AGG_ADJUST_WKR */ VOID tx_bytes_calculate(RTMP_ADAPTER *pAd, TX_BLK *tx_blk); struct wifi_dev *wdev_search_by_address(RTMP_ADAPTER *pAd, UCHAR *Address); struct wifi_dev *WdevSearchByBssid(RTMP_ADAPTER *pAd, UCHAR *Address); struct wifi_dev *wdev_search_by_omac_idx(RTMP_ADAPTER *pAd, UINT8 BssIndex); struct wifi_dev *wdev_search_by_wcid(RTMP_ADAPTER *pAd, UINT8 wcid); struct wifi_dev *wdev_search_by_pkt(RTMP_ADAPTER *pAd, PNDIS_PACKET pkt); struct wifi_dev *wdev_search_by_idx(RTMP_ADAPTER *pAd, UINT32 idx); struct wifi_dev *wdev_search_by_netdev(RTMP_ADAPTER *pAd, VOID *pDev); VOID BssInfoArgumentLinker(RTMP_ADAPTER *pAd, struct wifi_dev *wdev); INT32 GetBssInfoIdx(RTMP_ADAPTER *pAd); VOID ReleaseBssIdx(RTMP_ADAPTER *pAd, UINT32 BssIdx); VOID BssInfoArgumentUnLink(RTMP_ADAPTER *pAd, struct wifi_dev *wdev); VOID BssInfoArgumentLink(struct _RTMP_ADAPTER *ad, struct wifi_dev *wdev, struct _BSS_INFO_ARGUMENT_T *bssinfo); VOID wdev_if_up_down(struct _RTMP_ADAPTER *pAd, struct wifi_dev *wdev, BOOLEAN if_up_down_state); INT32 wdev_config_init(struct _RTMP_ADAPTER *pAd); void wdev_sync_ch_by_rfic(struct _RTMP_ADAPTER *ad, UCHAR rfic, UCHAR ch); void wdev_sync_prim_ch(struct _RTMP_ADAPTER *ad, struct wifi_dev *wdev); #ifdef IP_ASSEMBLY typedef union ip_flags_frag_offset { struct { #ifdef RT_BIG_ENDIAN USHORT flags_reserved:1; USHORT flags_may_frag:1; USHORT flags_more_frag:1; USHORT frag_offset:13; #else USHORT frag_offset:13; USHORT flags_more_frag:1; USHORT flags_may_frag:1; USHORT flags_reserved:1; #endif } field; USHORT word; } IP_FLAGS_FRAG_OFFSET; typedef struct ip_v4_hdr { #ifdef RT_BIG_ENDIAN UCHAR version:4, ihl:4; #else UCHAR ihl:4, version:4; #endif UCHAR tos; USHORT tot_len; USHORT identifier; } IP_V4_HDR; typedef struct ip_assemble_data { DL_LIST list; QUEUE_HEADER queue; INT32 identify; INT32 fragSize; ULONG createTime; } IP_ASSEMBLE_DATA; INT rtmp_IpAssembleHandle(RTMP_ADAPTER *pAd, STA_TR_ENTRY *pTrEntry, PNDIS_PACKET pPacket, UCHAR queIdx, PACKET_INFO packetInfo); #endif VOID ba_ori_session_start( IN RTMP_ADAPTER *pAd, IN STA_TR_ENTRY *tr_entry, IN UINT8 UserPriority); INT rtmp_tx_burst_set(struct _RTMP_ADAPTER *pAd, struct wifi_dev *wdev); VOID enable_tx_burst(struct _RTMP_ADAPTER *pAd, struct wifi_dev *wdev, UINT8 ac_type, UINT8 prio, UINT16 level); VOID disable_tx_burst(struct _RTMP_ADAPTER *pAd, struct wifi_dev *wdev, UINT8 ac_type, UINT8 prio, UINT16 level); UINT8 query_tx_burst_prio(struct _RTMP_ADAPTER *pAd, struct wifi_dev *wdev); INT TxOPUpdatingAlgo(RTMP_ADAPTER *pAd); VOID mt_detect_wmm_traffic(RTMP_ADAPTER *pAd, struct wifi_dev *wdev, UCHAR UserPriority, UCHAR FlgIsOutput); VOID rx_802_3_data_frm_announce(RTMP_ADAPTER *pAd, MAC_TABLE_ENTRY *pEntry, RX_BLK *pRxBlk, struct wifi_dev *wdev); VOID rx_data_frm_announce( IN RTMP_ADAPTER *pAd, IN MAC_TABLE_ENTRY *pEntry, IN RX_BLK *pRxBlk, IN struct wifi_dev *wdev); INT sta_rx_pkt_allow(RTMP_ADAPTER *pAd, struct wifi_dev *wdev, RX_BLK *pRxBlk); INT rx_chk_duplicate_frame(RTMP_ADAPTER *pAd, RX_BLK *pRxBlk, struct wifi_dev *wdev); VOID mt_dynamic_wmm_be_tx_op( IN RTMP_ADAPTER *pAd, IN ULONG nonBEpackets); NDIS_STATUS RTMPFreeTXDRequest( IN RTMP_ADAPTER *pAd, IN UCHAR RingType, IN UCHAR NumberRequired, IN PUCHAR FreeNumberIs); NDIS_STATUS MlmeHardTransmit( IN RTMP_ADAPTER *pAd, IN UCHAR QueIdx, IN PNDIS_PACKET pPacket, IN BOOLEAN FlgDataQForce, IN BOOLEAN FlgIsLocked, IN BOOLEAN FlgIsCheckPS); NDIS_STATUS MlmeHardTransmitMgmtRing( IN RTMP_ADAPTER *pAd, IN UCHAR QueIdx, IN PNDIS_PACKET pPacket); #ifdef RTMP_MAC_PCI NDIS_STATUS MlmeHardTransmitTxRing( IN RTMP_ADAPTER *pAd, IN UCHAR QueIdx, IN PNDIS_PACKET pPacket); NDIS_STATUS MlmeDataHardTransmit( IN RTMP_ADAPTER *pAd, IN UCHAR QueIdx, IN PNDIS_PACKET pPacket); #endif /* RTMP_MAC_PCI */ USHORT RTMPCalcDuration( IN RTMP_ADAPTER *pAd, IN UCHAR Rate, IN ULONG Size); VOID mtd_write_tmac_info_fixed_rate( IN RTMP_ADAPTER *pAd, IN UCHAR *tmac_info, IN MAC_TX_INFO * info, IN HTTRANSMIT_SETTING *pTransmit); VOID mt_write_tmac_info_fixed_rate( IN RTMP_ADAPTER *pAd, IN UCHAR *tmac_info, IN MAC_TX_INFO * info, IN HTTRANSMIT_SETTING *pTransmit); VOID rtmp_write_tmac_info_fixed_rate( IN RTMP_ADAPTER *pAd, IN UCHAR *tmac_info, IN MAC_TX_INFO * info, IN HTTRANSMIT_SETTING *pTransmit); VOID write_tmac_info_Cache(RTMP_ADAPTER *pAd, UCHAR *buf, TX_BLK *pTxBlk); #ifdef RANDOM_PKT_GEN VOID random_write_qidx(RTMP_ADAPTER *pAd, UCHAR *buf, TX_BLK *pTxBlk); #endif #ifdef MT_MAC VOID mt_write_tmac_info_beacon(RTMP_ADAPTER *pAd, struct wifi_dev *wdev, UCHAR *tmac_buf, HTTRANSMIT_SETTING *BeaconTransmit, ULONG frmLen); #endif /* MT_MAC */ VOID RTMPSuspendMsduTransmission( IN RTMP_ADAPTER *pAd, struct wifi_dev *wdev); VOID RTMPResumeMsduTransmission( IN RTMP_ADAPTER *pAd, struct wifi_dev *wdev); NDIS_STATUS MiniportMMRequest( IN RTMP_ADAPTER *pAd, IN UCHAR QueIdx, IN UCHAR *pData, IN UINT Length); VOID LowPowerDebug( PRTMP_ADAPTER pAd, PSTA_ADMIN_CONFIG pStaCfg); VOID RTMPSendNullFrame( IN RTMP_ADAPTER *pAd, IN PSTA_ADMIN_CONFIG pStaCfg, IN UCHAR TxRate, IN BOOLEAN bQosNull, IN USHORT PwrMgmt); BOOLEAN RTMPFreeTXDUponTxDmaDone( IN RTMP_ADAPTER *pAd, IN UCHAR QueIdx, IN UCHAR RingIdx, BOOLEAN ForceFree); #ifdef MT_MAC UINT32 pkt_alloc_fail_handle(RTMP_ADAPTER *ad, PNDIS_PACKET rx_packet); UINT32 mt_rx_pkt_process(RTMP_ADAPTER *, UINT8 hif_idx, RX_BLK *pRxBlk, PNDIS_PACKET pRxPacket); #endif /* MT_MAC */ #if defined(CONFIG_WIFI_PKT_FWD) || defined(CONFIG_WIFI_PKT_FWD_MODULE) BOOLEAN is_looping_packet( IN RTMP_ADAPTER *pAd, IN NDIS_PACKET * pPacket); VOID set_wf_fwd_cb( IN RTMP_ADAPTER *pAd, IN PNDIS_PACKET pPacket, IN struct wifi_dev *wdev); #endif /* CONFIG_WIFI_PKT_FWD */ BOOLEAN is_udp_packet(RTMP_ADAPTER *pAd, PNDIS_PACKET pkt); BOOLEAN RTMPCheckEtherType( IN RTMP_ADAPTER *pAd, IN PNDIS_PACKET pPacket, IN STA_TR_ENTRY *tr_entry, IN struct wifi_dev *wdev); VOID RTMPCckBbpTuning( IN RTMP_ADAPTER *pAd, IN UINT TxRate); /* MLME routines */ /* Asic/RF/BBP related functions */ VOID AsicGetTxPowerOffset( IN PRTMP_ADAPTER pAd, IN PULONG TxPwr); VOID AsicGetAutoAgcOffsetForExternalTxAlc( IN PRTMP_ADAPTER pAd, IN PCHAR pDeltaPwr, IN PCHAR pTotalDeltaPwr, IN PCHAR pAgcCompensate, IN PCHAR pDeltaPowerByBbpR1); VOID AsicExtraPowerOverMAC(RTMP_ADAPTER *pAd); VOID AsicPercentageDeltaPower( IN PRTMP_ADAPTER pAd, IN CHAR Rssi, INOUT PCHAR pDeltaPwr, INOUT PCHAR pDeltaPowerByBbpR1); VOID AsicCompensatePowerViaBBP( IN RTMP_ADAPTER *pAd, INOUT CHAR *pTotalDeltaPower); VOID AsicAdjustTxPower(RTMP_ADAPTER *pAd); #define WMM_PARAM_TXOP 0 #define WMM_PARAM_AIFSN 1 #define WMM_PARAM_CWMIN 2 #define WMM_PARAM_CWMAX 3 #define WMM_PARAM_ALL 4 #define WMM_PARAM_AC_0 0 #define WMM_PARAM_AC_1 1 #define WMM_PARAM_AC_2 2 #define WMM_PARAM_AC_3 3 #ifdef RTMP_RBUS_SUPPORT int RtmpAsicSendCommandToSwMcu( IN RTMP_ADAPTER *pAd, IN UCHAR Command, IN UCHAR Token, IN UCHAR Arg0, IN UCHAR Arg1, IN BOOLEAN FlgIsNeedLocked); #endif /* RTMP_RBUS_SUPPORT */ #ifdef STREAM_MODE_SUPPORT UINT32 StreamModeRegVal( IN RTMP_ADAPTER *pAd); /* Update the Tx chain address Parameters pAd: The adapter data structure pMacAddress: The MAC address of the peer STA Return Value: None */ VOID AsicUpdateTxChainAddress( IN RTMP_ADAPTER *pAd, IN PUCHAR pMacAddress); INT Set_StreamMode_Proc( IN RTMP_ADAPTER *pAd, IN RTMP_STRING *arg); INT Set_StreamModeMac_Proc( IN RTMP_ADAPTER *pAd, IN RTMP_STRING *arg); INT Set_StreamModeMCS_Proc( IN RTMP_ADAPTER *pAd, IN RTMP_STRING *arg); #endif /* STREAM_MODE_SUPPORT */ VOID MacAddrRandomBssid( IN RTMP_ADAPTER *pAd, OUT PUCHAR pAddr); VOID MgtMacHeaderInit( IN RTMP_ADAPTER *pAd, INOUT HEADER_802_11 *pHdr80211, IN UCHAR SubType, IN UCHAR ToDs, IN UCHAR *pDA, IN UCHAR *pSA, IN UCHAR *pBssid); VOID MgtMacHeaderInitExt( IN RTMP_ADAPTER *pAd, IN OUT PHEADER_802_11 pHdr80211, IN UCHAR SubType, IN UCHAR ToDs, IN PUCHAR pDA, IN PUCHAR pSA, IN PUCHAR pBssid); VOID MlmeRadioOff( IN RTMP_ADAPTER *pAd, struct wifi_dev *wdev); VOID MlmeRadioOn( IN RTMP_ADAPTER *pAd, struct wifi_dev *wdev); VOID MlmeLpEnter( IN RTMP_ADAPTER *pAd); VOID MlmeLpExit( IN RTMP_ADAPTER *pAd); VOID BssTableInit( IN BSS_TABLE *Tab); #if defined(DBDC_MODE) && defined(DOT11K_RRM_SUPPORT) VOID BssTableInitByBand( IN BSS_TABLE * Tab, IN UCHAR Band); #endif /* defined(DBDC_MODE) && defined(DOT11K_RRM_SUPPORT) */ #ifdef DOT11_N_SUPPORT VOID BATableInit( IN RTMP_ADAPTER *pAd, IN BA_TABLE *Tab); VOID BATableExit( IN RTMP_ADAPTER *pAd); #endif /* DOT11_N_SUPPORT */ ULONG BssTableSearch( IN BSS_TABLE *Tab, IN PUCHAR pBssid, IN UCHAR Channel); ULONG BssSsidTableSearch( IN BSS_TABLE *Tab, IN PUCHAR pBssid, IN PUCHAR pSsid, IN UCHAR SsidLen, IN UCHAR Channel); ULONG BssTableSearchWithSSID( IN BSS_TABLE *Tab, IN PUCHAR Bssid, IN PUCHAR pSsid, IN UCHAR SsidLen, IN UCHAR Channel); ULONG BssSsidTableSearchBySSID( IN BSS_TABLE *Tab, IN PUCHAR pSsid, IN UCHAR SsidLen); VOID BssTableDeleteEntry( IN OUT PBSS_TABLE pTab, IN PUCHAR pBssid, IN UCHAR Channel); ULONG BssTableSetEntry( IN RTMP_ADAPTER *pAd, OUT BSS_TABLE *Tab, IN BCN_IE_LIST * ie_list, IN CHAR Rssi, IN USHORT LengthVIE, IN PNDIS_802_11_VARIABLE_IEs pVIE); #ifdef DOT11_N_SUPPORT VOID BATableInsertEntry( IN RTMP_ADAPTER *pAd, IN USHORT Aid, IN USHORT TimeOutValue, IN USHORT StartingSeq, IN UCHAR TID, IN UCHAR BAWinSize, IN UCHAR OriginatorStatus, IN BOOLEAN IsRecipient); BOOLEAN bss_coex_insert_effected_ch_list( RTMP_ADAPTER *pAd, UCHAR Channel, BCN_IE_LIST *ie_list, struct wifi_dev *pwdev); #ifdef DOT11N_DRAFT3 VOID Bss2040CoexistTimeOut( IN PVOID SystemSpecific1, IN PVOID FunctionContext, IN PVOID SystemSpecific2, IN PVOID SystemSpecific3); VOID TriEventInit( IN RTMP_ADAPTER *pAd); INT TriEventTableSetEntry( IN RTMP_ADAPTER *pAd, OUT TRIGGER_EVENT_TAB *Tab, IN PUCHAR pBssid, IN HT_CAPABILITY_IE *pHtCapability, IN UCHAR HtCapabilityLen, IN UCHAR RegClass, IN UCHAR ChannelNo); #endif /* DOT11N_DRAFT3 */ #endif /* DOT11_N_SUPPORT */ VOID BssTableSsidSort( IN RTMP_ADAPTER *pAd, IN struct wifi_dev *wdev, OUT BSS_TABLE *OutTab, IN CHAR Ssid[], IN UCHAR SsidLen); VOID BssTableSortByRssi( IN OUT BSS_TABLE *OutTab, IN BOOLEAN isInverseOrder); NDIS_STATUS MlmeQueueInit( IN RTMP_ADAPTER *pAd, IN MLME_QUEUE *Queue); VOID MlmeQueueDestroy( IN MLME_QUEUE *Queue); #ifdef CONFIG_AP_SUPPORT BOOLEAN MlmeEnqueue( IN RTMP_ADAPTER *pAd, IN ULONG Machine, IN ULONG MsgType, IN ULONG MsgLen, IN VOID *Msg, IN ULONG Priv); #endif BOOLEAN MlmeEnqueueWithWdev( IN RTMP_ADAPTER *pAd, IN ULONG Machine, IN ULONG MsgType, IN ULONG MsgLen, IN VOID *Msg, IN ULONG Priv, IN struct wifi_dev *wdev); BOOLEAN MlmeEnqueueForRecv( IN RTMP_ADAPTER *pAd, IN ULONG Wcid, IN struct raw_rssi_info *rssi_info, IN ULONG MsgLen, IN PVOID Msg, IN UCHAR OpMode, IN struct wifi_dev *wdev, IN UCHAR RxPhyMode); #ifdef WSC_INCLUDED BOOLEAN MlmeEnqueueForWsc( IN RTMP_ADAPTER *pAd, IN ULONG eventID, IN LONG senderID, IN ULONG Machine, IN ULONG MsgType, IN ULONG MsgLen, IN VOID *Msg, IN struct wifi_dev *wdev); #endif /* WSC_INCLUDED */ BOOLEAN MlmeDequeue( IN MLME_QUEUE *Queue, OUT MLME_QUEUE_ELEM **Elem); VOID MlmeRestartStateMachine( IN RTMP_ADAPTER *pAd, IN struct wifi_dev *wdev); BOOLEAN MlmeQueueEmpty( IN MLME_QUEUE *Queue); BOOLEAN MlmeQueueFull( IN MLME_QUEUE *Queue, IN UCHAR SendId); BOOLEAN MsgTypeSubst( IN RTMP_ADAPTER *pAd, IN PFRAME_802_11 pFrame, OUT INT *Machine, OUT INT *MsgType); VOID StateMachineInit( IN STATE_MACHINE *Sm, IN STATE_MACHINE_FUNC Trans[], IN ULONG StNr, IN ULONG MsgNr, IN STATE_MACHINE_FUNC DefFunc, IN ULONG InitState, IN ULONG Base); VOID StateMachineSetAction( IN STATE_MACHINE *S, IN ULONG St, ULONG Msg, IN STATE_MACHINE_FUNC F); VOID StateMachinePerformAction( IN RTMP_ADAPTER *pAd, IN STATE_MACHINE *S, IN MLME_QUEUE_ELEM *Elem, IN ULONG CurrState); VOID Drop( IN RTMP_ADAPTER *pAd, IN MLME_QUEUE_ELEM *Elem); VOID AssocStateMachineInit( IN RTMP_ADAPTER *pAd, IN struct wifi_dev *wdev, IN STATE_MACHINE *Sm, OUT STATE_MACHINE_FUNC Trans[]); VOID ReassocTimeout( IN PVOID SystemSpecific1, IN PVOID FunctionContext, IN PVOID SystemSpecific2, IN PVOID SystemSpecific3); VOID AssocTimeout( IN PVOID SystemSpecific1, IN PVOID FunctionContext, IN PVOID SystemSpecific2, IN PVOID SystemSpecific3); VOID DisassocTimeout( IN PVOID SystemSpecific1, IN PVOID FunctionContext, IN PVOID SystemSpecific2, IN PVOID SystemSpecific3); /*---------------------------------------------- */ VOID MlmeDisassocReqAction( IN RTMP_ADAPTER *pAd, IN MLME_QUEUE_ELEM *Elem); VOID MlmeAssocReqAction( IN RTMP_ADAPTER *pAd, IN MLME_QUEUE_ELEM *Elem); VOID MlmeReassocReqAction( IN RTMP_ADAPTER *pAd, IN MLME_QUEUE_ELEM *Elem); VOID MlmeDisassocReqAction( IN RTMP_ADAPTER *pAd, IN MLME_QUEUE_ELEM *Elem); VOID PeerAssocRspAction( IN RTMP_ADAPTER *pAd, IN MLME_QUEUE_ELEM *Elem); VOID PeerReassocRspAction( IN RTMP_ADAPTER *pAd, IN MLME_QUEUE_ELEM *Elem); VOID PeerDisassocAction( IN RTMP_ADAPTER *pAd, IN MLME_QUEUE_ELEM *Elem); VOID DisassocTimeoutAction( IN RTMP_ADAPTER *pAd, IN MLME_QUEUE_ELEM *Elem); VOID AssocTimeoutAction( IN RTMP_ADAPTER *pAd, IN MLME_QUEUE_ELEM *Elem); VOID ReassocTimeoutAction( IN RTMP_ADAPTER *pAd, IN MLME_QUEUE_ELEM *Elem); VOID Cls3errAction( IN RTMP_ADAPTER *pAd, IN PUCHAR pAddr); VOID InvalidStateWhenAssoc( IN RTMP_ADAPTER *pAd, IN MLME_QUEUE_ELEM *Elem); VOID InvalidStateWhenReassoc( IN RTMP_ADAPTER *pAd, IN MLME_QUEUE_ELEM *Elem); VOID InvalidStateWhenDisassociate( IN RTMP_ADAPTER *pAd, IN MLME_QUEUE_ELEM *Elem); VOID ComposePsPoll( IN RTMP_ADAPTER *pAd, IN PPSPOLL_FRAME pPsPollFrame, IN USHORT Aid, IN UCHAR *pBssid, IN UCHAR *pTa); VOID ComposeNullFrame( RTMP_ADAPTER *pAd, PHEADER_802_11 pNullFrame, UCHAR *pAddr1, UCHAR *pAddr2, UCHAR *pAddr3); VOID AssocPostProc( IN RTMP_ADAPTER *pAd, IN PUCHAR pAddr2, IN USHORT CapabilityInfo, IN USHORT Aid, IN UCHAR SupRate[], IN UCHAR SupRateLen, IN UCHAR ExtRate[], IN UCHAR ExtRateLen, IN PEDCA_PARM pEdcaParm, struct _IE_lists *ie_list, IN HT_CAPABILITY_IE *pHtCapability, IN UCHAR HtCapabilityLen, IN ADD_HT_INFO_IE * pAddHtInfo, IN MAC_TABLE_ENTRY *pEntry); VOID AuthStateMachineInit( IN RTMP_ADAPTER *pAd, IN struct wifi_dev *wdev, IN PSTATE_MACHINE sm, OUT STATE_MACHINE_FUNC Trans[]); VOID AuthTimeout( IN PVOID SystemSpecific1, IN PVOID FunctionContext, IN PVOID SystemSpecific2, IN PVOID SystemSpecific3); VOID MlmeAuthReqAction( IN RTMP_ADAPTER *pAd, IN MLME_QUEUE_ELEM *Elem); VOID PeerAuthRspAtSeq2Action( IN RTMP_ADAPTER *pAd, IN MLME_QUEUE_ELEM *Elem); VOID PeerAuthRspAtSeq4Action( IN RTMP_ADAPTER *pAd, IN MLME_QUEUE_ELEM *Elem); VOID AuthTimeoutAction( IN RTMP_ADAPTER *pAd, IN MLME_QUEUE_ELEM *Elem); VOID Cls2errAction( IN struct wifi_dev *wdev, IN PUCHAR pAddr); VOID MlmeDeauthReqAction( IN RTMP_ADAPTER *pAd, IN MLME_QUEUE_ELEM *Elem); VOID InvalidStateWhenAuth( IN RTMP_ADAPTER *pAd, IN MLME_QUEUE_ELEM *Elem); /*============================================= */ VOID AuthRspStateMachineInit( IN RTMP_ADAPTER *pAd, IN PSTATE_MACHINE Sm, IN STATE_MACHINE_FUNC Trans[]); VOID PeerDeauthAction( IN RTMP_ADAPTER *pAd, IN MLME_QUEUE_ELEM *Elem); VOID PeerAuthSimpleRspGenAndSend( IN RTMP_ADAPTER *pAd, IN PHEADER_802_11 pHdr80211, IN USHORT Alg, IN USHORT Seq, IN USHORT Reason, IN USHORT Status); BOOLEAN PeerProbeReqSanity( IN RTMP_ADAPTER *pAd, IN VOID *Msg, IN ULONG MsgLen, OUT PEER_PROBE_REQ_PARAM * Param); /*======================================== */ VOID SyncStateMachineInit( IN RTMP_ADAPTER *pAd, IN struct wifi_dev *wdev, IN STATE_MACHINE *Sm, OUT STATE_MACHINE_FUNC Trans[]); VOID BeaconTimeout( IN PVOID SystemSpecific1, IN PVOID FunctionContext, IN PVOID SystemSpecific2, IN PVOID SystemSpecific3); VOID ScanTimeout( IN PVOID SystemSpecific1, IN PVOID FunctionContext, IN PVOID SystemSpecific2, IN PVOID SystemSpecific3); VOID MlmeScanReqAction( IN RTMP_ADAPTER *pAd, IN MLME_QUEUE_ELEM *Elem); VOID InvalidStateWhenScan( IN RTMP_ADAPTER *pAd, IN MLME_QUEUE_ELEM *Elem); VOID InvalidStateWhenJoin( IN RTMP_ADAPTER *pAd, IN MLME_QUEUE_ELEM *Elem); VOID InvalidStateWhenStart( IN RTMP_ADAPTER *pAd, IN MLME_QUEUE_ELEM *Elem); VOID PeerBeacon( IN RTMP_ADAPTER *pAd, IN MLME_QUEUE_ELEM *Elem); VOID EnqueueProbeRequest( IN RTMP_ADAPTER *pAd); BOOLEAN ScanRunning( IN RTMP_ADAPTER *pAd); /*========================================= */ VOID MlmeCntlInit( IN PRTMP_ADAPTER pAd, IN struct wifi_dev *wdev); VOID MlmeCntlMachinePerformAction( IN RTMP_ADAPTER *pAd, IN STATE_MACHINE *S, IN MLME_QUEUE_ELEM *Elem); VOID CntlIdleProc( IN RTMP_ADAPTER *pAd, IN MLME_QUEUE_ELEM *Elem); VOID CntlOidScanProc( IN RTMP_ADAPTER *pAd, IN MLME_QUEUE_ELEM *Elem); VOID CntlOidSsidProc( IN RTMP_ADAPTER *pAd, IN MLME_QUEUE_ELEM *Elem); VOID CntlOidRTBssidProc( IN RTMP_ADAPTER *pAd, IN MLME_QUEUE_ELEM *Elem); VOID CntlMlmeRoamingProc( IN RTMP_ADAPTER *pAd, IN MLME_QUEUE_ELEM *Elem); VOID CntlWaitDisassocProc( IN RTMP_ADAPTER *pAd, IN MLME_QUEUE_ELEM *Elem); VOID CntlWaitJoinProc( IN RTMP_ADAPTER *pAd, IN MLME_QUEUE_ELEM *Elem); VOID CntlWaitReassocProc( IN RTMP_ADAPTER *pAd, IN MLME_QUEUE_ELEM *Elem); VOID CntlWaitStartProc( IN RTMP_ADAPTER *pAd, IN MLME_QUEUE_ELEM *Elem); VOID CntlWaitAuthProc( IN RTMP_ADAPTER *pAd, IN MLME_QUEUE_ELEM *Elem); VOID CntlWaitAuthProc2( IN RTMP_ADAPTER *pAd, IN MLME_QUEUE_ELEM *Elem); VOID CntlWaitAssocProc( IN RTMP_ADAPTER *pAd, IN MLME_QUEUE_ELEM *Elem); VOID LinkUp( IN RTMP_ADAPTER *pAd, IN UCHAR BssType, IN struct wifi_dev *wdev); VOID LinkDown( IN RTMP_ADAPTER *pAd, IN BOOLEAN IsReqFromAP, IN struct wifi_dev *wdev); VOID IterateOnBssTab( IN RTMP_ADAPTER *pAd, IN struct wifi_dev *wdev); VOID IterateOnBssTab2( IN RTMP_ADAPTER *pAd, IN struct wifi_dev *wdev); VOID JoinParmFill( IN RTMP_ADAPTER *pAd, IN OUT MLME_JOIN_REQ_STRUCT * JoinReq, IN ULONG BssIdx); VOID AssocParmFill( IN RTMP_ADAPTER *pAd, IN OUT MLME_ASSOC_REQ_STRUCT * AssocReq, IN PUCHAR pAddr, IN USHORT CapabilityInfo, IN ULONG Timeout, IN USHORT ListenIntv); VOID ScanParmFill( IN RTMP_ADAPTER *pAd, IN OUT MLME_SCAN_REQ_STRUCT * ScanReq, IN RTMP_STRING Ssid[], IN UCHAR SsidLen, IN UCHAR BssType, IN UCHAR ScanType); VOID DisassocParmFill( IN RTMP_ADAPTER *pAd, IN OUT MLME_DISASSOC_REQ_STRUCT * DisassocReq, IN PUCHAR pAddr, IN USHORT Reason); VOID StartParmFill( IN RTMP_ADAPTER *pAd, IN OUT MLME_START_REQ_STRUCT * StartReq, IN CHAR Ssid[], IN UCHAR SsidLen); VOID AuthParmFill( IN RTMP_ADAPTER *pAd, IN OUT MLME_AUTH_REQ_STRUCT * AuthReq, IN PUCHAR pAddr, IN USHORT Alg); VOID EnqueuePsPoll( IN RTMP_ADAPTER *pAd, PSTA_ADMIN_CONFIG pStaCfg); VOID EnqueueBeaconFrame( IN RTMP_ADAPTER *pAd); VOID MlmeJoinReqAction( IN RTMP_ADAPTER *pAd, IN MLME_QUEUE_ELEM *Elem); VOID MlmeScanReqAction( IN RTMP_ADAPTER *pAd, IN MLME_QUEUE_ELEM *Elem); VOID MlmeStartReqAction( IN RTMP_ADAPTER *pAd, IN MLME_QUEUE_ELEM *Elem); VOID MlmeForceJoinReqAction( IN RTMP_ADAPTER *pAd, IN MLME_QUEUE_ELEM *Elem); VOID MlmeForceScanReqAction( IN RTMP_ADAPTER *pAd, IN MLME_QUEUE_ELEM *Elem); VOID ScanTimeoutAction( IN RTMP_ADAPTER *pAd, IN MLME_QUEUE_ELEM *Elem); VOID BeaconTimeoutAtJoinAction( IN RTMP_ADAPTER *pAd, IN MLME_QUEUE_ELEM *Elem); VOID PeerBeaconAtScanAction( IN RTMP_ADAPTER *pAd, IN MLME_QUEUE_ELEM *Elem); VOID PeerBeaconAtJoinAction( IN RTMP_ADAPTER *pAd, IN MLME_QUEUE_ELEM *Elem); VOID PeerBeacon( IN RTMP_ADAPTER *pAd, IN MLME_QUEUE_ELEM *Elem); VOID PeerProbeReqAction( IN RTMP_ADAPTER *pAd, IN MLME_QUEUE_ELEM *Elem); VOID ScanNextChannel( IN RTMP_ADAPTER *pAd, IN UCHAR OpMode, IN struct wifi_dev *wdev); BOOLEAN MlmeScanReqSanity( IN RTMP_ADAPTER *pAd, IN VOID *Msg, IN ULONG MsgLen, OUT UCHAR *BssType, OUT CHAR ssid[], OUT UCHAR *SsidLen, OUT UCHAR *ScanType); BOOLEAN PeerBeaconAndProbeRspSanity_Old( IN RTMP_ADAPTER *pAd, IN VOID *Msg, IN ULONG MsgLen, IN UCHAR MsgChannel, OUT PUCHAR pAddr2, OUT PUCHAR pBssid, OUT CHAR Ssid[], OUT UCHAR *pSsidLen, OUT UCHAR *pBssType, OUT USHORT *pBeaconPeriod, OUT UCHAR *pChannel, OUT UCHAR *pNewChannel, OUT LARGE_INTEGER *pTimestamp, OUT CF_PARM * pCfParm, OUT USHORT *pAtimWin, OUT USHORT *pCapabilityInfo, OUT UCHAR *pErp, OUT UCHAR *pDtimCount, OUT UCHAR *pDtimPeriod, OUT UCHAR *pBcastFlag, OUT UCHAR *pMessageToMe, OUT UCHAR SupRate[], OUT UCHAR *pSupRateLen, OUT UCHAR ExtRate[], OUT UCHAR *pExtRateLen, OUT UCHAR *pCkipFlag, OUT UCHAR *pAironetCellPowerLimit, OUT PEDCA_PARM pEdcaParm, OUT PQBSS_LOAD_PARM pQbssLoad, OUT PQOS_CAPABILITY_PARM pQosCapability, OUT ULONG *pRalinkIe, OUT UCHAR *pHtCapabilityLen, OUT HT_CAPABILITY_IE *pHtCapability, OUT EXT_CAP_INFO_ELEMENT *pExtCapInfo, OUT UCHAR *AddHtInfoLen, OUT ADD_HT_INFO_IE * AddHtInfo, OUT UCHAR *NewExtChannel, OUT USHORT *LengthVIE, OUT PNDIS_802_11_VARIABLE_IEs pVIE); BOOLEAN PeerBeaconAndProbeRspSanity( IN RTMP_ADAPTER *pAd, IN VOID *Msg, IN ULONG MsgLen, IN UCHAR MsgChannel, OUT BCN_IE_LIST * ie_list, OUT USHORT *LengthVIE, OUT PNDIS_802_11_VARIABLE_IEs pVIE, IN BOOLEAN bGetDtim, IN BOOLEAN bFromBeaconReport ); #ifdef DOT11_N_SUPPORT #ifdef DOT11N_DRAFT3 BOOLEAN PeerBeaconAndProbeRspSanity2( IN RTMP_ADAPTER *pAd, IN VOID *Msg, IN ULONG MsgLen, IN OVERLAP_BSS_SCAN_IE * BssScan, OUT UCHAR *RegClass); #endif /* DOT11N_DRAFT3 */ #endif /* DOT11_N_SUPPORT */ BOOLEAN PeerAddBAReqActionSanity( IN RTMP_ADAPTER *pAd, IN VOID *pMsg, IN ULONG MsgLen, OUT PUCHAR pAddr2); BOOLEAN PeerAddBARspActionSanity( IN RTMP_ADAPTER *pAd, IN VOID *pMsg, IN ULONG MsgLen); BOOLEAN PeerDelBAActionSanity( IN RTMP_ADAPTER *pAd, IN UCHAR Wcid, IN VOID *pMsg, IN ULONG MsgLen); BOOLEAN MlmeAssocReqSanity( IN RTMP_ADAPTER *pAd, IN VOID *Msg, IN ULONG MsgLen, OUT PUCHAR pApAddr, OUT USHORT *CapabilityInfo, OUT ULONG *Timeout, OUT USHORT *ListenIntv); BOOLEAN MlmeAuthReqSanity( IN RTMP_ADAPTER *pAd, IN VOID *Msg, IN ULONG MsgLen, OUT PUCHAR pAddr, OUT ULONG *Timeout, OUT USHORT *Alg); BOOLEAN MlmeStartReqSanity( IN RTMP_ADAPTER *pAd, IN VOID *Msg, IN ULONG MsgLen, OUT CHAR Ssid[], OUT UCHAR *Ssidlen); BOOLEAN PeerAuthSanity( IN RTMP_ADAPTER *pAd, IN VOID *Msg, IN ULONG MsgLen, OUT PUCHAR pAddr, OUT USHORT *Alg, OUT USHORT *Seq, OUT USHORT *Status, OUT CHAR ChlgText[]); BOOLEAN PeerAssocRspSanity( IN struct wifi_dev *wdev, IN VOID *pMsg, IN ULONG MsgLen, OUT PUCHAR pAddr2, OUT USHORT *pCapabilityInfo, OUT USHORT *pStatus, OUT USHORT *pAid, OUT UCHAR SupRate[], OUT UCHAR *pSupRateLen, OUT UCHAR ExtRate[], OUT UCHAR *pExtRateLen, OUT HT_CAPABILITY_IE *pHtCapability, OUT ADD_HT_INFO_IE * pAddHtInfo, /* AP might use this additional ht info IE */ OUT UCHAR *pHtCapabilityLen, OUT UCHAR *pAddHtInfoLen, OUT UCHAR *pNewExtChannelOffset, OUT PEDCA_PARM pEdcaParm, OUT EXT_CAP_INFO_ELEMENT *pExtCapInfo, OUT UCHAR *pCkipFlag, struct _IE_lists *ie_list); BOOLEAN PeerDisassocSanity( IN RTMP_ADAPTER *pAd, IN VOID *Msg, IN ULONG MsgLen, OUT PUCHAR pAddr2, OUT USHORT *Reason); BOOLEAN PeerDeauthSanity( IN RTMP_ADAPTER *pAd, IN VOID *Msg, IN ULONG MsgLen, OUT PUCHAR pAddr1, OUT PUCHAR pAddr2, OUT PUCHAR pAddr3, OUT USHORT *Reason); BOOLEAN GetTimBit( IN CHAR *Ptr, IN USHORT Aid, OUT UCHAR *TimLen, OUT UCHAR *BcastFlag, OUT UCHAR *DtimCount, OUT UCHAR *DtimPeriod, OUT UCHAR *MessageToMe); UCHAR ChannelSanity( IN RTMP_ADAPTER *pAd, IN UCHAR channel); NDIS_802_11_NETWORK_TYPE NetworkTypeInUseSanity( IN BSS_ENTRY * pBss); BOOLEAN MlmeDelBAReqSanity( IN RTMP_ADAPTER *pAd, IN VOID *Msg, IN ULONG MsgLen); BOOLEAN MlmeAddBAReqSanity( IN RTMP_ADAPTER *pAd, IN VOID *Msg, IN ULONG MsgLen, OUT PUCHAR pAddr2); ULONG MakeOutgoingFrame( OUT UCHAR *Buffer, OUT ULONG *Length, ...); UCHAR RandomByte( IN RTMP_ADAPTER *pAd); UCHAR RandomByte2( IN RTMP_ADAPTER *pAd); VOID MlmePeriodicExec( IN PVOID SystemSpecific1, IN PVOID FunctionContext, IN PVOID SystemSpecific2, IN PVOID SystemSpecific3); VOID MlmePeriodicExecTimer( IN PVOID SystemSpecific1, IN PVOID FunctionContext, IN PVOID SystemSpecific2, IN PVOID SystemSpecific3); VOID LinkDownExec( IN PVOID SystemSpecific1, IN PVOID FunctionContext, IN PVOID SystemSpecific2, IN PVOID SystemSpecific3); VOID LinkUpExec( IN PVOID SystemSpecific1, IN PVOID FunctionContext, IN PVOID SystemSpecific2, IN PVOID SystemSpecific3); VOID STAMlmePeriodicExec( RTMP_ADAPTER *pAd, struct wifi_dev *wdev); VOID MlmeAutoScan( IN RTMP_ADAPTER *pAd, IN struct wifi_dev *wdev); VOID MlmeAutoReconnectLastSSID( IN RTMP_ADAPTER *pAd, IN struct wifi_dev *wdev); BOOLEAN MlmeValidateSSID( IN PUCHAR pSsid, IN UCHAR SsidLen); VOID MlmeCheckForRoaming( IN RTMP_ADAPTER *pAd, IN ULONG Now32); BOOLEAN MlmeCheckForFastRoaming( IN RTMP_ADAPTER *pAd, IN struct wifi_dev *wdev); #ifdef TXBF_SUPPORT BOOLEAN MlmeTxBfAllowed( IN PRTMP_ADAPTER pAd, IN PMAC_TABLE_ENTRY pEntry, IN struct _RTMP_RA_LEGACY_TB *pTxRate); #endif /* TXBF_SUPPORT */ VOID MlmeCalculateChannelQuality( IN RTMP_ADAPTER *pAd, IN PMAC_TABLE_ENTRY pMacEntry, IN ULONG Now); VOID MlmeCheckPsmChange( IN RTMP_ADAPTER *pAd, IN ULONG Now32, IN struct wifi_dev *wdev); VOID MlmeSetPsmBit( IN RTMP_ADAPTER *pAd, IN PSTA_ADMIN_CONFIG pStaCfg, IN USHORT psm); #ifdef STA_LP_PHASE_1_SUPPORT VOID RTMPSetEnterPsmNullBit( IN PPWR_MGMT_STRUCT pPwrMgmt); VOID RTMPClearEnterPsmNullBit( IN PPWR_MGMT_STRUCT pPwrMgmt); BOOLEAN RTMPEnterPsmNullBitStatus( IN PPWR_MGMT_STRUCT pPwrMgmt); #endif /* STA_LP_PHASE_1_SUPPORT */ VOID MlmeSetTxPreamble( IN RTMP_ADAPTER *pAd, IN USHORT TxPreamble); VOID UpdateBasicRateBitmap( IN RTMP_ADAPTER *pAd, IN struct wifi_dev *wdev); VOID MlmeUpdateTxRates( IN RTMP_ADAPTER *pAd, IN BOOLEAN bLinkUp, IN UCHAR apidx); VOID MlmeUpdateTxRatesWdev(RTMP_ADAPTER *pAd, BOOLEAN bLinkUp, struct wifi_dev *wdev); #ifdef DOT11_N_SUPPORT VOID MlmeUpdateHtTxRates( IN PRTMP_ADAPTER pAd, IN UCHAR apidx); #ifdef DOT11_VHT_AC VOID MlmeUpdateVhtTxRates( IN PRTMP_ADAPTER pAd, IN PMAC_TABLE_ENTRY pEntry, IN UCHAR apidx); #endif /* DOT11_VHT_AC */ #endif /* DOT11_N_SUPPORT */ VOID RTMPCheckRates( IN RTMP_ADAPTER *pAd, IN OUT UCHAR SupRate[], IN OUT UCHAR *SupRateLen, IN UCHAR PhyMode); BOOLEAN RTMPCheckHt( IN RTMP_ADAPTER *pAd, IN UCHAR Wcid, INOUT HT_CAPABILITY_IE *pHtCapability, INOUT ADD_HT_INFO_IE * pAddHtInfo); #ifdef DOT11_VHT_AC BOOLEAN RTMPCheckVht( IN RTMP_ADAPTER *pAd, IN UCHAR Wcid, IN VHT_CAP_IE *vht_cap, IN VHT_OP_IE * vht_op); #endif /* DOT11_VHT_AC */ VOID RTMPUpdateMlmeRate( IN RTMP_ADAPTER *pAd); CHAR RTMPMaxRssi( IN RTMP_ADAPTER *pAd, IN CHAR Rssi0, IN CHAR Rssi1, IN CHAR Rssi2); CHAR RTMPMinRssi( IN RTMP_ADAPTER *pAd, IN CHAR Rssi0, IN CHAR Rssi1, IN CHAR Rssi2, IN CHAR Rssi3); CHAR RTMPAvgRssi( IN RTMP_ADAPTER *pAd, IN RSSI_SAMPLE *pRssi); CHAR RTMPMinSnr( IN RTMP_ADAPTER *pAd, IN CHAR Snr0, IN CHAR Snr1); #ifdef MICROWAVE_OVEN_SUPPORT INT Set_MO_FalseCCATh_Proc( IN RTMP_ADAPTER *pAd, IN RTMP_STRING *arg); #endif /* MICROWAVE_OVEN_SUPPORT */ #ifdef RTMP_EFUSE_SUPPORT INT set_eFuseGetFreeBlockCount_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT set_eFusedump_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT set_eFuseLoadFromBin_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); UCHAR eFuseReadRegisters(RTMP_ADAPTER *pAd, USHORT Offset, UINT16 Length, UINT16 *pData); VOID EfusePhysicalReadRegisters(RTMP_ADAPTER *pAd, USHORT Offset, USHORT Length, USHORT *pData); #ifdef CONFIG_ATE INT Set_LoadEepromBufferFromEfuse_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT set_eFuseBufferModeWriteBack_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT set_BinModeWriteBack_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); #endif /* CONFIG_ATE */ VOID rtmp_ee_load_from_efuse(RTMP_ADAPTER *pAd); #endif /* RTMP_EFUSE_SUPPORT */ VOID AsicEvaluateRxAnt(RTMP_ADAPTER *pAd); VOID AsicRxAntEvalTimeout( IN PVOID SystemSpecific1, IN PVOID FunctionContext, IN PVOID SystemSpecific2, IN PVOID SystemSpecific3); VOID APSDPeriodicExec( IN PVOID SystemSpecific1, IN PVOID FunctionContext, IN PVOID SystemSpecific2, IN PVOID SystemSpecific3); BOOLEAN RTMPCheckEntryEnableAutoRateSwitch( IN RTMP_ADAPTER *pAd, IN PMAC_TABLE_ENTRY pEntry); UCHAR RTMPStaFixedTxMode( IN RTMP_ADAPTER *pAd, IN PMAC_TABLE_ENTRY pEntry); VOID RTMPUpdateLegacyTxSetting( IN UCHAR fixed_tx_mode, IN PMAC_TABLE_ENTRY pEntry); BOOLEAN RTMPAutoRateSwitchCheck(RTMP_ADAPTER *pAd); VOID MlmeHalt(RTMP_ADAPTER *pAd); NDIS_STATUS MlmeInit(RTMP_ADAPTER *pAd); VOID MlmeResetRalinkCounters(RTMP_ADAPTER *pAd); VOID BuildChannelList(RTMP_ADAPTER *pAd, struct wifi_dev *wdev); UCHAR ApAutoChannelAtBootUp(RTMP_ADAPTER *pAd, struct wifi_dev *wdev); UCHAR FirstChannel(RTMP_ADAPTER *pAd, struct wifi_dev *wdev); UCHAR NextChannel(RTMP_ADAPTER *pAd, UCHAR channel, struct wifi_dev *wdev); UCHAR FindScanChannel(RTMP_ADAPTER *pAd, UINT8 LastScanChannel, struct wifi_dev *wdev); UCHAR FindPartialScanChannel(RTMP_ADAPTER *pAd, struct wifi_dev *wdev); INT PartialScanInit(RTMP_ADAPTER *pAd); VOID ChangeToCellPowerLimit(RTMP_ADAPTER *pAd, UCHAR AironetCellPowerLimit); VOID RTMPInitMICEngine( IN RTMP_ADAPTER *pAd, IN PUCHAR pKey, IN PUCHAR pDA, IN PUCHAR pSA, IN UCHAR UserPriority, IN PUCHAR pMICKey); BOOLEAN RTMPTkipCompareMICValue( IN RTMP_ADAPTER *pAd, IN PUCHAR pSrc, IN PUCHAR pDA, IN PUCHAR pSA, IN PUCHAR pMICKey, IN UCHAR UserPriority, IN UINT Len); VOID RTMPCalculateMICValue( IN RTMP_ADAPTER *pAd, IN PNDIS_PACKET pPacket, IN PUCHAR pEncap, IN PUCHAR pKey, IN PUCHAR pMIC, IN UCHAR apidx); VOID RTMPTkipAppendByte(TKIP_KEY_INFO *pTkip, UCHAR uChar); VOID RTMPTkipAppend(TKIP_KEY_INFO *pTkip, UCHAR *pSrc, UINT nBytes); VOID RTMPTkipGetMIC(TKIP_KEY_INFO *pTkip); INT RT_CfgSetCountryRegion( IN RTMP_ADAPTER *pAd, IN RTMP_STRING *arg, IN INT band); INT RT_CfgSetWirelessMode(RTMP_ADAPTER *pAd, RTMP_STRING *arg, struct wifi_dev *wdev); /*update phy mode for all of wdev*/ VOID RtmpUpdatePhyMode(RTMP_ADAPTER *pAd, UCHAR *pWmode); RT_802_11_PHY_MODE wmode_2_cfgmode(UCHAR wmode); UCHAR cfgmode_2_wmode(UCHAR cfg_mode); BOOLEAN wmode_valid_and_correct(RTMP_ADAPTER *pAd, UCHAR *wmode); UCHAR *wmode_2_str(UCHAR wmode); #ifdef CONFIG_AP_SUPPORT #ifdef MBSS_SUPPORT INT RT_CfgSetMbssWirelessMode(RTMP_ADAPTER *pAd, RTMP_STRING *arg); #endif /* MBSS_SUPPORT */ #endif /* CONFIG_AP_SUPPORT */ INT RT_CfgSetShortSlot(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT RT_CfgSetWepKey( IN RTMP_ADAPTER *pAd, IN RTMP_STRING *keyString, IN CIPHER_KEY *pSharedKey, IN INT keyIdx); INT RT_CfgSetFixedTxPhyMode(RTMP_STRING *arg); INT RT_CfgSetMacAddress(RTMP_ADAPTER *pAd, RTMP_STRING *arg, UCHAR idx); INT RT_CfgSetTxMCSProc(RTMP_STRING *arg, BOOLEAN *pAutoRate); INT RT_CfgSetAutoFallBack(RTMP_ADAPTER *pAd, RTMP_STRING *arg); #ifdef WSC_INCLUDED INT RT_CfgSetWscPinCode( IN RTMP_ADAPTER *pAd, IN RTMP_STRING *pPinCodeStr, OUT PWSC_CTRL pWscControl); #endif /* WSC_INCLUDED */ INT Set_Antenna_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); #ifdef HW_TX_RATE_LOOKUP_SUPPORT INT Set_HwTxRateLookUp_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); #endif /* HW_TX_RATE_LOOKUP_SUPPORT */ #ifdef MULTI_MAC_ADDR_EXT_SUPPORT INT Set_EnMultiMacAddrExt_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Set_MultiMacAddrExt_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); #endif /* MULTI_MAC_ADDR_EXT_SUPPORT */ INT set_tssi_enable(RTMP_ADAPTER *pAd, RTMP_STRING *arg); #ifdef MT_MAC INT set_cr4_query(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT set_cr4_set(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT set_cr4_capability(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT set_cr4_debug(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT dump_cr4_pdma_debug_probe(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT dump_remap_cr_content(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT set_re_calibration(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT set_fw_phy_operation(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT set_get_fid(RTMP_ADAPTER *pAd, char *arg); INT set_fw_log(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT set_isr_cmd(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT set_txop_cfg(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT set_rts_cfg(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT set_ser(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT32 set_fw_cmd(RTMP_ADAPTER *pAd, RTMP_STRING *Arg); INT32 get_fw_cmd(RTMP_ADAPTER *pAd, RTMP_STRING *Arg); INT SetManualTxOP(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Set_themal_sensor(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT SetManualTxOPThreshold(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT SetManualTxOPUpBound(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT SetManualTxOPLowBound(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT SetPSEWatchDog_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT setTmrEnableProc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT setTmrVerProc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT SetTmrCalProc(PRTMP_ADAPTER pAd, RTMP_STRING *arg); #ifdef FW_DUMP_SUPPORT INT set_fwdump_path(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT fwdump_print(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT set_fwdump_max_size(RTMP_ADAPTER *pAd, RTMP_STRING *arg); #endif #endif /* MT_MAC */ #ifdef RTMP_MAC_PCI INT Set_PDMAWatchDog_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); #endif INT Set_RadioOn_Proc( IN PRTMP_ADAPTER pAd, IN RTMP_STRING *arg); #ifdef NEW_SET_RX_STREAM INT Set_RxStream_Proc( IN PRTMP_ADAPTER pAd, IN RTMP_STRING *arg); #endif INT Set_Lp_Proc( IN PRTMP_ADAPTER pAd, IN RTMP_STRING *arg); INT set_fix_amsdu( PRTMP_ADAPTER pAd, char *arg); INT set_rx_max_cnt( PRTMP_ADAPTER pAd, char *arg); INT set_rx1_max_cnt( PRTMP_ADAPTER pAd, char *arg); INT set_rx_dly_ctl( PRTMP_ADAPTER pAd, char *arg); INT set_tx_dly_ctl( PRTMP_ADAPTER pAd, char *arg); #ifdef PCIE_ASPM_DYM_CTRL_SUPPORT void set_pcie_aspm_dym_ctrl_cap( PRTMP_ADAPTER pAd, BOOLEAN flag_pcie_aspm_dym_ctrl); BOOLEAN get_pcie_aspm_dym_ctrl_cap( PRTMP_ADAPTER pAd); #endif /* PCIE_ASPM_DYM_CTRL_SUPPORT */ #ifdef CONFIG_DVT_MODE INT16 i2SetDvt(RTMP_ADAPTER *pAd, RTMP_STRING *pArg); #endif /* CONFIG_DVT_MODE */ NDIS_STATUS RTMPWPARemoveKeyProc( IN RTMP_ADAPTER *pAd, IN PVOID pBuf); VOID RTMPWPARemoveAllKeys( IN RTMP_ADAPTER *pAd, IN struct wifi_dev *wdev); BOOLEAN RTMPCheckStrPrintAble( IN CHAR *pInPutStr, IN UCHAR strLen); VOID RTMPSetDefaultChannel( IN PRTMP_ADAPTER pAd); VOID RTMPUpdateRateInfo( UCHAR phymode, struct dev_rate_info *rate ); VOID RTMPSetPhyMode( IN RTMP_ADAPTER *pAd, IN struct wifi_dev *wdev, IN UCHAR phymode); VOID RTMPUpdateHTIE( IN UCHAR *pMcsSet, IN struct wifi_dev *wdev, OUT HT_CAPABILITY_IE *pHtCapability, OUT ADD_HT_INFO_IE * pAddHtInfo); VOID RTMPAddWcidAttributeEntry( IN RTMP_ADAPTER *pAd, IN UCHAR BssIdx, IN UCHAR KeyIdx, IN UCHAR CipherAlg, IN MAC_TABLE_ENTRY *pEntry); RTMP_STRING *GetEncryptType(CHAR enc); RTMP_STRING *GetAuthMode(CHAR auth); VOID MacTableSetEntryRaCap(RTMP_ADAPTER *pAd, MAC_TABLE_ENTRY *ent, struct _vendor_ie_cap *vendor_ie); #ifdef DOT11_N_SUPPORT VOID set_sta_ht_cap(RTMP_ADAPTER *pAd, MAC_TABLE_ENTRY *ent, HT_CAPABILITY_IE *ht_ie); VOID RTMPSetHT(RTMP_ADAPTER *pAd, OID_SET_HT_PHYMODE *pHTPhyMode, struct wifi_dev *wdev); VOID RTMPSetIndividualHT(RTMP_ADAPTER *pAd, UCHAR apidx); UINT32 starec_ht_feature_decision(struct wifi_dev *wdev, struct _MAC_TABLE_ENTRY *entry, UINT32 *feature); UCHAR get_cent_ch_by_htinfo( RTMP_ADAPTER *pAd, ADD_HT_INFO_IE *ht_op, HT_CAPABILITY_IE *ht_cap); INT get_ht_cent_ch(RTMP_ADAPTER *pAd, UINT8 *rf_bw, UINT8 *ext_ch, UCHAR Channel); INT ht_mode_adjust(RTMP_ADAPTER *pAd, MAC_TABLE_ENTRY *pEntry, HT_CAPABILITY_IE *peer_ht_cap); UINT8 get_max_nss_by_htcap_ie_mcs(UCHAR *cap_mcs); INT set_ht_fixed_mcs(RTMP_ADAPTER *pAd, MAC_TABLE_ENTRY *pEntry, UCHAR fixed_mcs, UCHAR mcs_bound); INT get_ht_max_mcs(RTMP_ADAPTER *pAd, UCHAR *desire_mcs, UCHAR *cap_mcs); UCHAR cal_ht_cent_ch(UCHAR prim_ch, UCHAR phy_bw, UCHAR ext_cha, UCHAR *cen_ch); INT build_ht_ies(RTMP_ADAPTER *pAd, struct _build_ie_info *info); #define MAKE_IE_TO_BUF(__BUF, __CONTENT, __CONTENT_LEN, __CUR_LEN) \ { \ NdisMoveMemory((__BUF+__CUR_LEN), (UCHAR *)(__CONTENT), __CONTENT_LEN); \ __CUR_LEN += __CONTENT_LEN; \ } #endif /* DOT11_N_SUPPORT */ VOID RTMPDisableDesiredHtInfo(RTMP_ADAPTER *pAd, struct wifi_dev *wdev); #ifdef SYSTEM_LOG_SUPPORT VOID RtmpDrvSendWirelessEvent( IN VOID *pAdSrc, IN USHORT Event_flag, IN PUCHAR pAddr, IN UCHAR wdev_idx, IN CHAR Rssi); #else #define RtmpDrvSendWirelessEvent(_pAd, _Event_flag, _pAddr, wdev_idx, _Rssi) #endif /* SYSTEM_LOG_SUPPORT */ CHAR ConvertToRssi( IN RTMP_ADAPTER *pAd, IN struct raw_rssi_info *rssi_info, IN UCHAR rssi_idx); CHAR ConvertToSnr(RTMP_ADAPTER *pAd, UCHAR Snr); BOOLEAN AdjustBwToSyncAp(RTMP_ADAPTER *pAd, BCN_IE_LIST *ie_list, UCHAR Wcid, UCHAR fun_tb_idx); #ifdef DOT11N_DRAFT3 VOID BuildEffectedChannelList( IN RTMP_ADAPTER *pAd, IN struct wifi_dev *wdev); VOID CntlChannelWidth( IN RTMP_ADAPTER *pAd, IN UCHAR PrimaryChannel, IN UCHAR CentralChannel, IN UCHAR ChannelWidth, IN UCHAR SecondaryChannelOffset); #endif /* DOT11N_DRAFT3 */ VOID APAsicEvaluateRxAnt( IN RTMP_ADAPTER *pAd); VOID APAsicRxAntEvalTimeout(RTMP_ADAPTER *pAd); MAC_TABLE_ENTRY *PACInquiry(RTMP_ADAPTER *pAd, UCHAR Wcid); VOID HandleCounterMeasure( IN RTMP_ADAPTER *pAd, IN MAC_TABLE_ENTRY *pEntry); VOID WPAStart4WayHS( IN PRTMP_ADAPTER pAd, IN MAC_TABLE_ENTRY *pEntry, IN ULONG TimeInterval); VOID WPAStart2WayGroupHS( IN RTMP_ADAPTER *pAd, IN MAC_TABLE_ENTRY *pEntry); VOID CMTimerExec( IN PVOID SystemSpecific1, IN PVOID FunctionContext, IN PVOID SystemSpecific2, IN PVOID SystemSpecific3); #ifdef TXBF_SUPPORT #ifndef MT_MAC VOID eTxBfProbeTimerExec( IN PVOID SystemSpecific1, IN PVOID FunctionContext, IN PVOID SystemSpecific2, IN PVOID SystemSpecific3); #endif /* MT_MAC */ #endif /* TXBF_SUPPORT */ VOID RTMPHandleSTAKey( IN RTMP_ADAPTER *pAd, IN MAC_TABLE_ENTRY *pEntry, IN MLME_QUEUE_ELEM *Elem); VOID MlmeDeAuthAction( IN RTMP_ADAPTER *pAd, IN PMAC_TABLE_ENTRY pEntry, IN USHORT Reason, IN BOOLEAN bDataFrameFirst); #ifdef DOT11W_PMF_SUPPORT VOID PMF_SAQueryTimeOut( IN PVOID SystemSpecific1, IN PVOID FunctionContext, IN PVOID SystemSpecific2, IN PVOID SystemSpecific3); VOID PMF_SAQueryConfirmTimeOut( IN PVOID SystemSpecific1, IN PVOID FunctionContext, IN PVOID SystemSpecific2, IN PVOID SystemSpecific3); #endif /* DOT11W_PMF_SUPPORT */ VOID AES_128_CMAC( IN PUCHAR key, IN PUCHAR input, IN INT len, OUT PUCHAR mac); #ifdef DOT1X_SUPPORT VOID WpaSend( IN RTMP_ADAPTER *pAd, IN PUCHAR pPacket, IN ULONG Len); INT RTMPAddPMKIDCache( IN NDIS_AP_802_11_PMKID *pPMKIDCache, IN INT apidx, IN UCHAR *pAddr, IN UCHAR *PMKID, IN UCHAR *PMK, IN UINT8 pmk_len); INT RTMPSearchPMKIDCache( IN NDIS_AP_802_11_PMKID *pPMKIDCache, IN INT apidx, IN UCHAR *pAddr); INT RTMPValidatePMKIDCache( IN NDIS_AP_802_11_PMKID *pPMKIDCache, IN INT apidx, IN UCHAR *pAddr, IN UCHAR *pPMKID); VOID RTMPDeletePMKIDCache( IN NDIS_AP_802_11_PMKID *pPMKIDCache, IN INT apidx, IN INT idx); VOID RTMPMaintainPMKIDCache( IN RTMP_ADAPTER *pAd); #else #define RTMPMaintainPMKIDCache(_pAd) #endif /* DOT1X_SUPPORT */ #ifdef RESOURCE_PRE_ALLOC VOID RTMPResetTxRxRingMemory( IN RTMP_ADAPTER *pAd); #endif /* RESOURCE_PRE_ALLOC */ VOID *alloc_rx_buf_1k(void *hif_resource); VOID free_rx_buf_1k(void *hif_resource); VOID *alloc_rx_buf_64k(void *hif_resource); VOID free_rx_buf_64k(void *hif_resource); VOID free_rx_buf(void *hdev_ctrl, UCHAR hif_idx); VOID RTMPFreeTxRxRingMemory(RTMP_ADAPTER *pAd); BOOLEAN fill_tx_blk(RTMP_ADAPTER *pAd, struct wifi_dev *wdev, struct _TX_BLK *tx_blk); UINT16 tx_pkt_classification(RTMP_ADAPTER *pAd, PNDIS_PACKET pPacket, TX_BLK *pTxBlk); INT send_data_pkt(RTMP_ADAPTER *pAd, struct wifi_dev *wdev, PNDIS_PACKET pkt); INT send_mlme_pkt(RTMP_ADAPTER *pAd, PNDIS_PACKET pkt, struct wifi_dev *wdev, UCHAR q_idx, BOOLEAN is_data_queue); INT32 fp_send_data_pkt(RTMP_ADAPTER *pAd, struct wifi_dev *wdev, PNDIS_PACKET pkt); void announce_802_3_packet( IN VOID *pAdSrc, IN PNDIS_PACKET pPacket, IN UCHAR OpMode); UINT announce_amsdu_pkt( RTMP_ADAPTER *pAd, PNDIS_PACKET pPacket, UCHAR OpMode); PNET_DEV get_netdev_from_bssid(RTMP_ADAPTER *pAd, UCHAR FromWhichBSSID); #ifdef DOT11_N_SUPPORT void ba_flush_reordering_timeout_mpdus( IN RTMP_ADAPTER *pAd, IN PBA_REC_ENTRY pBAEntry, IN ULONG Now32); void ba_timeout_flush(RTMP_ADAPTER *pAd); void ba_timeout_monitor(RTMP_ADAPTER *pAd); VOID ba_ori_session_setup( RTMP_ADAPTER *pAd, MAC_TABLE_ENTRY *pEntry, UCHAR TID, USHORT TimeOut, ULONG DelayTime, BOOLEAN isForced); BOOLEAN ba_rec_session_add( RTMP_ADAPTER *pAd, MAC_TABLE_ENTRY *pEntry, FRAME_ADDBA_REQ *pFrame); VOID ba_session_tear_down_all( RTMP_ADAPTER *pAd, UCHAR Wcid); VOID ba_ori_session_tear_down( RTMP_ADAPTER *pAd, UCHAR Wcid, UCHAR TID, BOOLEAN bPassive, BOOLEAN bForceSend); VOID ba_resource_dump_all(RTMP_ADAPTER *pAd); VOID ba_reordering_resource_dump_all(RTMP_ADAPTER *pAd); VOID ba_reodering_resource_dump(RTMP_ADAPTER *pAd, UCHAR wcid); VOID ba_rec_session_tear_down(RTMP_ADAPTER *pAd, UCHAR Wcid, UCHAR TID, BOOLEAN bPassive); #endif /* DOT11_N_SUPPORT */ BOOLEAN ba_reordering_resource_init(RTMP_ADAPTER *pAd, int num); void ba_reordering_resource_release(RTMP_ADAPTER *pAd); struct reordering_mpdu *ba_reordering_mpdu_probe(struct reordering_list *list); INT ComputeChecksum( IN UINT PIN); UINT GenerateWpsPinCode( IN RTMP_ADAPTER *pAd, IN BOOLEAN bFromApcli, IN UCHAR apidx); #ifdef WSC_INCLUDED INT Set_WscGenPinCode_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); #ifdef BB_SOC INT Set_WscResetPinCode_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); #endif INT Set_WscVendorPinCode_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); #ifdef WSC_AP_SUPPORT VOID RTMPIoctlSetWSCOOB(IN RTMP_ADAPTER *pAd); #endif /* */ /* prototype in wsc.c */ /* */ BOOLEAN WscMsgTypeSubst( IN UCHAR EAPType, IN UCHAR EAPCode, OUT INT *MsgType); VOID WscStateMachineInit( IN RTMP_ADAPTER *pAd, IN STATE_MACHINE *S, OUT STATE_MACHINE_FUNC Trans[]); VOID WscEAPOLStartAction( IN RTMP_ADAPTER *pAd, IN MLME_QUEUE_ELEM *Elem); VOID WscEAPAction( IN RTMP_ADAPTER *pAd, IN MLME_QUEUE_ELEM *Elem); VOID WscEapEnrolleeAction( IN RTMP_ADAPTER *pAd, IN MLME_QUEUE_ELEM *Elem, IN UCHAR MsgType, IN MAC_TABLE_ENTRY *pEntry, IN PWSC_CTRL pWscControl); #ifdef CONFIG_AP_SUPPORT VOID WscEapApProxyAction( IN RTMP_ADAPTER *pAd, IN MLME_QUEUE_ELEM *Elem, IN UCHAR MsgType, IN MAC_TABLE_ENTRY *pEntry, IN PWSC_CTRL pWscControl); #endif /* CONFIG_AP_SUPPORT */ VOID WscEapRegistrarAction( IN RTMP_ADAPTER *pAd, IN MLME_QUEUE_ELEM *Elem, IN UCHAR MsgType, IN MAC_TABLE_ENTRY *pEntry, IN PWSC_CTRL pWscControl); VOID WscEAPOLTimeOutAction( IN PVOID SystemSpecific1, IN PVOID FunctionContext, IN PVOID SystemSpecific2, IN PVOID SystemSpecific3); VOID Wsc2MinsTimeOutAction( IN PVOID SystemSpecific1, IN PVOID FunctionContext, IN PVOID SystemSpecific2, IN PVOID SystemSpecific3); UCHAR WscRxMsgType( IN RTMP_ADAPTER *pAd, IN PMLME_QUEUE_ELEM pElem); VOID WscInitRegistrarPair( IN RTMP_ADAPTER *pAd, IN PWSC_CTRL pWscControl, IN UCHAR apidx); VOID WscSendEapReqId( IN RTMP_ADAPTER *pAd, IN PMAC_TABLE_ENTRY pEntry, IN UCHAR CurOpMode); VOID WscSendEapolStart( IN RTMP_ADAPTER *pAd, IN PUCHAR pBssid, IN UCHAR CurOpMode, IN VOID *wdev_obj); VOID WscSendEapRspId( IN RTMP_ADAPTER *pAd, IN PMAC_TABLE_ENTRY pEntry, IN PWSC_CTRL pWscControl); VOID WscMacHeaderInit( IN RTMP_ADAPTER *pAd, IN OUT PHEADER_802_11 Hdr, IN PUCHAR pAddr1, IN PUCHAR pBSSID, IN BOOLEAN bFromApCli); VOID WscSendMessage( IN RTMP_ADAPTER *pAd, IN UCHAR OpCode, IN PUCHAR pData, IN INT Len, IN PWSC_CTRL pWscControl, IN UCHAR OpMode, /* 0: AP Mode, 1: AP Client Mode, 2: STA Mode */ IN UCHAR EapType); VOID WscSendEapReqAck( IN RTMP_ADAPTER *pAd, IN PMAC_TABLE_ENTRY pEntry); VOID WscSendEapReqDone( IN RTMP_ADAPTER *pAd, IN PMLME_QUEUE_ELEM pElem); VOID WscSendEapFail( IN RTMP_ADAPTER *pAd, IN PWSC_CTRL pWscControl, IN BOOLEAN bSendDeAuth); VOID WscM2DTimeOutAction( IN PVOID SystemSpecific1, IN PVOID FunctionContext, IN PVOID SystemSpecific2, IN PVOID SystemSpecific3); VOID WscUPnPMsgTimeOutAction( IN PVOID SystemSpecific1, IN PVOID FunctionContext, IN PVOID SystemSpecific2, IN PVOID SystemSpecific3); int WscSendUPnPConfReqMsg( IN RTMP_ADAPTER *pAd, IN UCHAR apIdx, IN PUCHAR ssidStr, IN PUCHAR macAddr, IN INT Status, IN UINT eventID, IN UCHAR CurOpMode); int WscSendUPnPMessage( IN RTMP_ADAPTER *pAd, IN UCHAR apIdx, IN USHORT msgType, IN USHORT msgSubType, IN PUCHAR pData, IN INT dataLen, IN UINT eventID, IN UINT toIPAddr, IN PUCHAR pMACAddr, IN UCHAR CurOpMode); VOID WscUPnPErrHandle( IN RTMP_ADAPTER *pAd, IN PWSC_CTRL pWscControl, IN UINT eventID); VOID WscBuildBeaconIE( IN RTMP_ADAPTER *pAd, IN UCHAR b_configured, IN BOOLEAN b_selRegistrar, IN USHORT devPwdId, IN USHORT selRegCfgMethods, IN UCHAR apidx, IN UCHAR *pAuthorizedMACs, IN UCHAR AuthorizedMACsLen, IN UCHAR CurOpMode); VOID WscBuildProbeRespIE( IN RTMP_ADAPTER *pAd, IN UCHAR respType, IN UCHAR scState, IN BOOLEAN b_selRegistrar, IN USHORT devPwdId, IN USHORT selRegCfgMethods, IN UCHAR apidx, IN UCHAR *pAuthorizedMACs, IN INT AuthorizedMACsLen, IN UCHAR CurOpMode); #ifdef CONFIG_AP_SUPPORT VOID WscBuildAssocRespIE( IN RTMP_ADAPTER *pAd, IN UCHAR ApIdx, IN UCHAR Reason, OUT PUCHAR pOutBuf, OUT PUCHAR pIeLen); VOID WscSelectedRegistrar( IN RTMP_ADAPTER *pAd, IN PUCHAR RegInfo, IN UINT length, IN UCHAR apidx); VOID WscInformFromWPA( IN PMAC_TABLE_ENTRY pEntry); #ifdef WSC_AP_SUPPORT #ifdef APCLI_SUPPORT VOID WscApCliLinkDownById( IN PRTMP_ADAPTER pAd, IN UCHAR apidx); #endif /* APCLI_SUPPORT */ #endif /* WSC_AP_SUPPORT */ #endif /* CONFIG_AP_SUPPORT */ VOID WscBuildProbeReqIE( IN RTMP_ADAPTER *pAd, IN VOID *wdev_obj, OUT PUCHAR pOutBuf, OUT PUCHAR pIeLen); VOID WscBuildAssocReqIE( IN PWSC_CTRL pWscControl, OUT PUCHAR pOutBuf, OUT PUCHAR pIeLen); VOID WscProfileRetryTimeout( IN PVOID SystemSpecific1, IN PVOID FunctionContext, IN PVOID SystemSpecific2, IN PVOID SystemSpecific3); VOID WscPBCTimeOutAction( IN PVOID SystemSpecific1, IN PVOID FunctionContext, IN PVOID SystemSpecific2, IN PVOID SystemSpecific3); #ifdef CON_WPS VOID WscScanDoneCheckTimeOutAction( IN PVOID SystemSpecific1, IN PVOID FunctionContext, IN PVOID SystemSpecific2, IN PVOID SystemSpecific3); #endif /*CON_WPS*/ #ifdef WSC_STA_SUPPORT VOID WscPINTimeOutAction( IN PVOID SystemSpecific1, IN PVOID FunctionContext, IN PVOID SystemSpecific2, IN PVOID SystemSpecific3); #endif VOID WscScanTimeOutAction( IN PVOID SystemSpecific1, IN PVOID FunctionContext, IN PVOID SystemSpecific2, IN PVOID SystemSpecific3); INT WscGenerateUUID( RTMP_ADAPTER *pAd, UCHAR *uuidHexStr, UCHAR *uuidAscStr, int apIdx, BOOLEAN bUseCurrentTime, BOOLEAN from_apcli); VOID WscStop( IN RTMP_ADAPTER *pAd, #ifdef CONFIG_AP_SUPPORT IN BOOLEAN bFromApcli, #endif /* CONFIG_AP_SUPPORT */ IN PWSC_CTRL pWscControl); VOID WscInit( IN RTMP_ADAPTER *pAd, IN BOOLEAN bFromApcli, IN UCHAR BssIndex); #ifdef CON_WPS VOID WscConWpsStop( IN PRTMP_ADAPTER pAd, IN BOOLEAN bFromApCli, IN PWSC_CTRL pWscControl); #endif /* CON_WPS */ BOOLEAN ValidateChecksum(UINT PIN); UINT WscRandomGen4digitPinCode(RTMP_ADAPTER *pAd); UINT WscRandomGeneratePinCode( IN RTMP_ADAPTER *pAd, IN UCHAR apidx); int BuildMessageM1( IN RTMP_ADAPTER *pAd, IN PWSC_CTRL pWscControl, OUT VOID *pbuf); int BuildMessageM2( IN RTMP_ADAPTER *pAd, IN PWSC_CTRL pWscControl, OUT VOID *pbuf); int BuildMessageM2D( IN RTMP_ADAPTER *pAd, IN PWSC_CTRL pWscControl, OUT VOID *pbuf); int BuildMessageM3( IN RTMP_ADAPTER *pAd, IN PWSC_CTRL pWscControl, OUT VOID *pbuf); int BuildMessageM4( IN RTMP_ADAPTER *pAd, IN PWSC_CTRL pWscControl, OUT VOID *pbuf); int BuildMessageM5( IN RTMP_ADAPTER *pAd, IN PWSC_CTRL pWscControl, OUT VOID *pbuf); int BuildMessageM6( IN RTMP_ADAPTER *pAd, IN PWSC_CTRL pWscControl, OUT VOID *pbuf); int BuildMessageM7( IN RTMP_ADAPTER *pAd, IN PWSC_CTRL pWscControl, OUT VOID *pbuf); int BuildMessageM8( IN RTMP_ADAPTER *pAd, IN PWSC_CTRL pWscControl, OUT VOID *pbuf); int BuildMessageDONE( IN RTMP_ADAPTER *pAd, IN PWSC_CTRL pWscControl, OUT VOID *pbuf); int BuildMessageACK( IN RTMP_ADAPTER *pAd, IN PWSC_CTRL pWscControl, OUT VOID *pbuf); int BuildMessageNACK( IN RTMP_ADAPTER *pAd, IN PWSC_CTRL pWscControl, OUT VOID *pbuf); int ProcessMessageM1( IN RTMP_ADAPTER *pAd, IN PWSC_CTRL pWscControl, IN VOID *precv, IN INT Length, OUT PWSC_REG_DATA pReg); int ProcessMessageM2( IN RTMP_ADAPTER *pAd, IN PWSC_CTRL pWscControl, IN VOID *precv, IN INT Length, IN UCHAR apidx, OUT PWSC_REG_DATA pReg); int ProcessMessageM2D( IN RTMP_ADAPTER *pAd, IN VOID *precv, IN INT Length, OUT PWSC_REG_DATA pReg); int ProcessMessageM3( IN RTMP_ADAPTER *pAd, IN VOID *precv, IN INT Length, OUT PWSC_REG_DATA pReg); int ProcessMessageM4( IN RTMP_ADAPTER *pAd, IN PWSC_CTRL pWscControl, IN VOID *precv, IN INT Length, OUT PWSC_REG_DATA pReg); int ProcessMessageM5( IN RTMP_ADAPTER *pAd, IN PWSC_CTRL pWscControl, IN VOID *precv, IN INT Length, OUT PWSC_REG_DATA pReg); int ProcessMessageM6( IN RTMP_ADAPTER *pAd, IN PWSC_CTRL pWscControl, IN VOID *precv, IN INT Length, OUT PWSC_REG_DATA pReg); int ProcessMessageM7( IN RTMP_ADAPTER *pAd, IN PWSC_CTRL pWscControl, IN VOID *precv, IN INT Length, OUT PWSC_REG_DATA pReg); int ProcessMessageM8( IN RTMP_ADAPTER *pAd, IN VOID *precv, IN INT Length, IN PWSC_CTRL pWscControl); USHORT WscGetAuthType( IN UINT32 authType); USHORT WscGetEncryType( IN UINT32 encryType); NDIS_STATUS WscThreadInit(RTMP_ADAPTER *pAd); BOOLEAN WscThreadExit(RTMP_ADAPTER *pAd); int AppendWSCTLV( IN USHORT index, OUT UCHAR *obuf, IN UCHAR *ibuf, IN USHORT varlen); VOID WscGetRegDataPIN( IN RTMP_ADAPTER *pAd, IN UINT PinCode, IN PWSC_CTRL pWscControl); VOID WscPushPBCAction( IN RTMP_ADAPTER *pAd, IN PWSC_CTRL pWscControl); #ifdef WSC_STA_SUPPORT VOID WscPINAction( IN RTMP_ADAPTER *pAd, IN PWSC_CTRL pWscControl); BOOLEAN WscPINExec( IN RTMP_ADAPTER *pAd, IN BOOLEAN bFromM2, IN PWSC_CTRL pWscControl); VOID WscPINBssTableSort( IN RTMP_ADAPTER *pAd, IN PWSC_CTRL pWscControl); #endif VOID WscScanExec( IN RTMP_ADAPTER *pAd, IN PWSC_CTRL pWscControl); BOOLEAN WscPBCExec( IN RTMP_ADAPTER *pAd, IN BOOLEAN bFromM2, IN PWSC_CTRL pWscControl); VOID WscPBCBssTableSort( IN RTMP_ADAPTER *pAd, IN PWSC_CTRL pWscControl); VOID WscGenRandomKey( IN RTMP_ADAPTER *pAd, IN PWSC_CTRL pWscControl, INOUT PUCHAR pKey, INOUT PUSHORT pKeyLen); VOID WscCreateProfileFromCfg( IN RTMP_ADAPTER *pAd, IN UCHAR OpMode, /* 0: AP Mode, 1: AP Client Mode, 2: STA Mode */ IN PWSC_CTRL pWscControl, OUT PWSC_PROFILE pWscProfile); void WscWriteConfToPortCfg( IN RTMP_ADAPTER *pAd, IN PWSC_CTRL pWscControl, IN PWSC_CREDENTIAL pCredential, IN BOOLEAN bEnrollee); #ifdef APCLI_SUPPORT void WscWriteConfToApCliCfg( IN RTMP_ADAPTER *pAd, IN PWSC_CTRL pWscControl, IN PWSC_CREDENTIAL pCredential, IN BOOLEAN bEnrollee); #endif /* APCLI_SUPPORT */ VOID WpsSmProcess( IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM *Elem); VOID WscPBCSessionOverlapCheck( IN RTMP_ADAPTER * pAd, IN UCHAR current_band); VOID WscPBC_DPID_FromSTA( IN RTMP_ADAPTER *pAd, IN PUCHAR pMacAddr, IN UCHAR current_band); #ifdef CONFIG_AP_SUPPORT INT WscGetConfWithoutTrigger( IN RTMP_ADAPTER *pAd, IN PWSC_CTRL pWscControl, IN BOOLEAN bFromUPnP); BOOLEAN WscReadProfileFromUfdFile( IN RTMP_ADAPTER *pAd, IN UCHAR ApIdx, IN RTMP_STRING *pUfdFileName); BOOLEAN WscWriteProfileToUfdFile( IN RTMP_ADAPTER *pAd, IN UCHAR ApIdx, IN RTMP_STRING *pUfdFileName); #endif /* CONFIG_AP_SUPPORT */ VOID WscCheckWpsIeFromWpsAP( IN RTMP_ADAPTER *pAd, IN PEID_STRUCT pEid, OUT PUSHORT pDPIDFromAP); /* WSC hardware push button function 0811 */ VOID WSC_HDR_BTN_Init(RTMP_ADAPTER *pAd); VOID WSC_HDR_BTN_Stop(RTMP_ADAPTER *pAd); VOID WSC_HDR_BTN_CheckHandler(RTMP_ADAPTER *pAd); #ifdef WSC_LED_SUPPORT BOOLEAN WscSupportWPSLEDMode(RTMP_ADAPTER *pAd); BOOLEAN WscSupportWPSLEDMode10(RTMP_ADAPTER *pAd); BOOLEAN WscAPHasSecuritySetting(RTMP_ADAPTER *pAd, PWSC_CTRL pWscControl); VOID WscLEDTimer( IN PVOID SystemSpecific1, IN PVOID FunctionContext, IN PVOID SystemSpecific2, IN PVOID SystemSpecific3); VOID WscSkipTurnOffLEDTimer( IN PVOID SystemSpecific1, IN PVOID FunctionContext, IN PVOID SystemSpecific2, IN PVOID SystemSpecific3); #endif /* WSC_LED_SUPPORT */ #ifdef CONFIG_AP_SUPPORT VOID WscUpdatePortCfgTimeout( IN PVOID SystemSpecific1, IN PVOID FunctionContext, IN PVOID SystemSpecific2, IN PVOID SystemSpecific3); #endif /* CONFIG_AP_SUPPORT */ VOID WscCheckPeerDPID( IN RTMP_ADAPTER *pAd, IN PFRAME_802_11 Fr, IN PUCHAR eid_data, IN INT eid_len, IN UCHAR current_band); VOID WscClearPeerList(PLIST_HEADER pWscEnList); PWSC_PEER_ENTRY WscFindPeerEntry(PLIST_HEADER pWscEnList, UCHAR *pMacAddr); VOID WscDelListEntryByMAC(PLIST_HEADER pWscEnList, UCHAR *pMacAddr); VOID WscInsertPeerEntryByMAC(PLIST_HEADER pWscEnList, UCHAR *pMacAddr); #ifdef CONFIG_AP_SUPPORT INT WscApShowPeerList(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT WscApShowPin(RTMP_ADAPTER *pAd, RTMP_STRING *arg); #endif /* CONFIG_AP_SUPPORT */ VOID WscMaintainPeerList(RTMP_ADAPTER *pAd, PWSC_CTRL pWpsCtrl); VOID WscAssignEntryMAC(RTMP_ADAPTER *pAd, PWSC_CTRL pWpsCtrl); #ifdef WSC_V2_SUPPORT #ifdef CONFIG_AP_SUPPORT VOID WscOnOff(RTMP_ADAPTER *pAd, INT ApIdx, BOOLEAN bOff); VOID WscAddEntryToAclList(RTMP_ADAPTER *pAd, INT ApIdx, UCHAR *pMacAddr); VOID WscSetupLockTimeout( IN PVOID SystemSpecific1, IN PVOID FunctionContext, IN PVOID SystemSpecific2, IN PVOID SystemSpecific3); VOID WscCheckPinAttackCount(RTMP_ADAPTER *pAd, PWSC_CTRL pWscControl); #endif /* CONFIG_AP_SUPPORT */ BOOLEAN WscGenV2Msg( IN PWSC_CTRL pWpsCtrl, IN BOOLEAN bSelRegistrar, IN PUCHAR pAuthorizedMACs, IN INT AuthorizedMACsLen, OUT UCHAR **pOutBuf, OUT INT *pOutBufLen); BOOLEAN WscParseV2SubItem( IN UCHAR SubID, IN PUCHAR pData, IN USHORT DataLen, OUT PUCHAR pOutBuf, OUT PUCHAR pOutBufLen); VOID WscSendEapFragAck( IN RTMP_ADAPTER *pAd, IN PWSC_CTRL pWscControl, IN PMAC_TABLE_ENTRY pEntry); VOID WscSendEapFragData( IN RTMP_ADAPTER *pAd, IN PWSC_CTRL pWscControl, IN PMAC_TABLE_ENTRY pEntry); #endif /* WSC_V2_SUPPORT */ BOOLEAN WscGetDataFromPeerByTag( IN RTMP_ADAPTER *pAd, IN PUCHAR pIeData, IN INT IeDataLen, IN USHORT WscTag, OUT PUCHAR pWscBuf, OUT PUSHORT pWscBufLen); VOID WscUUIDInit( IN PRTMP_ADAPTER pAd, IN INT inf_idx, IN UCHAR from_apcli); #ifdef CONFIG_AP_SUPPORT INT Set_AP_WscMode_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Set_AP_WscGetConf_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); #endif /* CONFIG_AP_SUPPORT */ #endif /* WSC_INCLUDED */ INT32 ShowRFInfo(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT32 ShowBBPInfo(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT32 show_redirect_proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT32 ShowWifiInterruptCntProc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); BOOLEAN rtstrmactohex(RTMP_STRING *s1, RTMP_STRING *s2); BOOLEAN rtstrcasecmp(RTMP_STRING *s1, RTMP_STRING *s2); RTMP_STRING *rtstrstruncasecmp(RTMP_STRING *s1, RTMP_STRING *s2); RTMP_STRING *rtstrstr(const RTMP_STRING *s1, const RTMP_STRING *s2); RTMP_STRING *rstrtok(RTMP_STRING *s, const RTMP_STRING *ct); int rtinet_aton(const RTMP_STRING *cp, unsigned int *addr); /*//////// common ioctl functions ////////*/ INT show_driverinfo_proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Set_CountryRegion_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Set_CountryRegionABand_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Set_WirelessMode_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); #ifdef RT_CFG80211_SUPPORT INT Set_DisableCfg2040Scan_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); #endif INT Set_MBSS_WirelessMode_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Set_Channel_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT rtmp_set_channel(RTMP_ADAPTER *pAd, struct wifi_dev *wdev, UCHAR Channel); INT Set_ShortSlot_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Set_TxPower_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Set_BGProtection_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Set_TxPreamble_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Set_RTSThreshold_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Set_FragThreshold_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Set_TxBurst_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); #ifdef RTMP_MAC_PCI INT Set_ShowRF_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); #endif /* RTMP_MAC_PCI */ #ifdef AGGREGATION_SUPPORT INT Set_PktAggregate_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); #endif /* AGGREGATION_SUPPORT */ INT Set_IEEE80211H_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); #ifdef EXT_BUILD_CHANNEL_LIST INT Set_ExtCountryCode_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Set_ExtDfsType_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Set_ChannelListAdd_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Set_ChannelListShow_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Set_ChannelListDel_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); #endif /* EXT_BUILD_CHANNEL_LIST */ #ifdef DBG INT Set_Debug_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Set_DebugCategory_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); VOID RTMPIoctlMAC(RTMP_ADAPTER *pAd, RTMP_IOCTL_INPUT_STRUCT *wrq); #endif #ifdef RANDOM_PKT_GEN INT Set_TxCtrl_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); VOID regular_pause_umac(RTMP_ADAPTER *pAd); #endif #ifdef CSO_TEST_SUPPORT INT Set_CsCtrl_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); #endif #ifdef MT_MAC INT Show_TxVinfo(RTMP_ADAPTER *pAd, RTMP_STRING *arg); #endif #ifdef THERMAL_PROTECT_SUPPORT INT set_thermal_protection_criteria_proc( IN RTMP_ADAPTER *pAd, IN RTMP_STRING *arg); INT set_thermal_protection_admin_ctrl_duty_proc( IN RTMP_ADAPTER *pAd, IN RTMP_STRING *arg); #endif /* THERMAL_PROTECT_SUPPORT */ #ifdef TXBF_SUPPORT INT Set_ReadITxBf_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Set_ReadETxBf_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Set_WriteITxBf_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Set_WriteETxBf_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Set_StatITxBf_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Set_StatETxBf_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Set_TxBfTag_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Set_ITxBfTimeout_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Set_ETxBfTimeout_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Set_InvTxBfTag_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Set_ITxBfCal_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Set_ITxBfDivCal_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Set_ITxBfLnaCal_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Set_ETxBfEnCond_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Set_ETxBfCodebook_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Set_ETxBfCoefficient_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Set_ETxBfGrouping_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Set_ETxBfNoncompress_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Set_ETxBfIncapable_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Set_NoSndgCntThrd_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Set_NdpSndgStreams_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Set_Trigger_Sounding_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Set_Stop_Sounding_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Set_ITxBfEn_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Set_StaITxBfEnCond_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); #if defined(MT76x2) || defined(MT7636) INT Set_TxBfProfileTag_Help(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Set_TxBfProfileTagValid(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Set_TxBfProfileTagRead(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Set_TxBfProfileTagWrite(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Set_TxBfProfileDataRead(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Set_TxBfProfileDataWrite(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Set_TxBfProfileDataWriteAll(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Set_TxBfProfileDataReadAll(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Set_TxBfProfileTag_Valid(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Set_TxBfProfileTag_Matrix(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Set_TxBfProfileTag_SNR(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Set_TxBfProfileTag_TxScale(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Set_TxBfProfileTag_MAC(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Set_TxBfProfileTag_Flg(RTMP_ADAPTER *pAd, RTMP_STRING *arg); #endif /* MT76x2 || MT7636 */ #ifdef MT_MAC INT Set_TxBfProfileTag_Help(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Set_TxBfProfileTag_PfmuIdx(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Set_TxBfProfileTag_BfType(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Set_TxBfProfileTag_DBW(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Set_TxBfProfileTag_SuMu(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Set_TxBfProfileTag_InValid(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Set_TxBfProfileTag_Mem(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Set_TxBfProfileTag_Matrix(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Set_TxBfProfileTag_SNR(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Set_TxBfProfileTag_SmartAnt(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Set_TxBfProfileTag_SeIdx(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Set_TxBfProfileTag_RmsdThrd(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Set_TxBfProfileTag_McsThrd(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Set_TxBfProfileTag_TimeOut(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Set_TxBfProfileTag_DesiredBW(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Set_TxBfProfileTag_DesiredNc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Set_TxBfProfileTag_DesiredNr(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Set_TxBfProfileTagRead(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Set_TxBfProfileTagWrite(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Set_TxBfProfileDataRead(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Set_TxBfProfileDataWrite(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Set_TxBfProfilePnRead(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Set_TxBfProfilePnWrite(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Set_TxBfQdRead(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Set_TxBfTxApply(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Set_TxBfPfmuMemAlloc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Set_TxBfPfmuMemRelease(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Set_TxBfPfmuMemAllocMapRead(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Set_StaRecCmmUpdate(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Set_StaRecBfUpdate(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Set_StaRecBfRead(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Set_TxBfAwareCtrl(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Set_BssInfoUpdate(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Set_DevInfoUpdate(RTMP_ADAPTER *pAd, RTMP_STRING *arg); #ifdef TXBF_DYNAMIC_DISABLE INT Set_TxBfDynamicDisable_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); #endif /* TXBF_DYNAMIC_DISABLE */ #endif /* MT_MAC */ #endif /* TXBF_SUPPORT */ #ifdef VHT_TXBF_SUPPORT INT Set_VhtNDPA_Sounding_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); #endif /* VHT_TXBF_SUPPORT */ #if defined(CONFIG_WIFI_PKT_FWD) || defined(CONFIG_WIFI_PKT_FWD_MODULE) INT WifiFwdSet(IN int disabled); INT Set_WifiFwd_Proc(PRTMP_ADAPTER pAd, RTMP_STRING *arg); INT Set_WifiFwd_Down(IN PRTMP_ADAPTER pAd, IN RTMP_STRING *arg); INT Set_WifiFwdAccessSchedule_Proc(PRTMP_ADAPTER pAd, RTMP_STRING *arg); INT Set_WifiFwdHijack_Proc(PRTMP_ADAPTER pAd, RTMP_STRING *arg); INT Set_WifiFwdBpdu_Proc(PRTMP_ADAPTER pAd, RTMP_STRING *arg); INT Set_WifiFwdRepDevice(PRTMP_ADAPTER pAd, RTMP_STRING *arg); INT Set_WifiFwdShowEntry(PRTMP_ADAPTER pAd, RTMP_STRING *arg); INT Set_WifiFwdDeleteEntry(PRTMP_ADAPTER pAd, RTMP_STRING *arg); INT Set_PacketSourceShowEntry(PRTMP_ADAPTER pAd, RTMP_STRING *arg); INT Set_PacketSourceDeleteEntry(PRTMP_ADAPTER pAd, RTMP_STRING *arg); INT Set_WifiFwdBridge_Proc(IN PRTMP_ADAPTER pAd, IN RTMP_STRING *arg); #endif /* CONFIG_WIFI_PKT_FWD */ INT Set_RateAdaptInterval(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Show_DescInfo_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Show_MacTable_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); #ifdef DOT11_N_SUPPORT INT Show_BaTable_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Show_ChannelSet_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); #endif /* DOT11_N_SUPPORT */ #ifdef MT_MAC INT Show_PSTable_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT show_wtbl_proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT show_wtbltlv_proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT show_mib_proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT show_amsdu_proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT32 show_wifi_sys(RTMP_ADAPTER *pAd, RTMP_STRING *arg); #ifdef DBDC_MODE INT32 ShowDbdcProc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); #endif INT32 ShowChCtrl(RTMP_ADAPTER *pAd, RTMP_STRING *arg); #ifdef GREENAP_SUPPORT INT32 ShowGreenAPProc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); #endif /* GREENAP_SUPPORT */ #ifdef PCIE_ASPM_DYM_CTRL_SUPPORT INT32 show_pcie_aspm_dym_ctrl_cap_proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); #endif /* PCIE_ASPM_DYM_CTRL_SUPPORT */ INT32 show_tx_burst_info(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT32 ShowTmacInfo(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT32 ShowAggInfo(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT ShowManualTxOP(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT show_dmasch_proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT32 ShowPseInfo(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT32 ShowPseData(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT ShowPLEInfo(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT show_TXD_proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT ShowTXDInfo(RTMP_ADAPTER *pAd, UINT fid); INT show_mem_proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT show_protect_info(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT show_cca_info(RTMP_ADAPTER *pAd, RTMP_STRING *arg); #ifdef CUT_THROUGH INT ShowCutThroughInfo(RTMP_ADAPTER *pAd, RTMP_STRING *arg); #endif /* CUT_THROUGH */ #endif /* MT_MAC */ INT Show_sta_tr_proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT show_stainfo_proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT show_devinfo_proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT show_sysinfo_proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT show_trinfo_proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT show_tpinfo_proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT show_txqinfo_proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT show_swqinfo(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT show_efuseinfo_proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); #if defined(MT_MAC) && (!defined(MT7636)) && defined(TXBF_SUPPORT) INT Show_AteIbfPhaseCalStatus(RTMP_ADAPTER *pAd, RTMP_STRING *arg); #endif INT Set_ResetStatCounter_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT SetCommonHtVht(RTMP_ADAPTER *pAd, struct wifi_dev *wdev); #ifdef DOT11_N_SUPPORT INT Set_BASetup_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Set_BADecline_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Set_BAOriTearDown_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Set_BARecTearDown_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Set_HtBw_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Set_HtMcs_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Set_HtGi_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Set_HtOpMode_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Set_HtStbc_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Set_HtExtcha_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT set_extcha_for_wdev(RTMP_ADAPTER *pAd, struct wifi_dev *wdev, UCHAR value); INT Set_HtMpduDensity_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Set_HtBaWinSize_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Set_HtRdg_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Set_HtLinkAdapt_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Set_HtAmsdu_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Set_HtAutoBa_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Set_HtProtect_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Set_HtMimoPs_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); #ifdef DOT11N_DRAFT3 INT Set_HT_BssCoex_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Set_HT_BssCoexApCntThr_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); #endif /* DOT11N_DRAFT3 */ #ifdef CONFIG_AP_SUPPORT INT Set_HtTxStream_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Set_HtRxStream_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); #ifdef DOT11_N_SUPPORT #ifdef GREENAP_SUPPORT INT Set_GreenAP_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); #endif /* GREENAP_SUPPORT */ #endif /* DOT11_N_SUPPORT */ #endif /* CONFIG_AP_SUPPORT */ #ifdef PCIE_ASPM_DYM_CTRL_SUPPORT INT set_pcie_aspm_dym_ctrl_cap_proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); #endif /* PCIE_ASPM_DYM_CTRL_SUPPORT */ INT SetCommonHT(RTMP_ADAPTER *pAd, struct wifi_dev *wdev); INT Set_ForceShortGI_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Set_ForceGF_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Set_SendSMPSAction_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); void convert_reordering_packet_to_preAMSDU_or_802_3_packet( IN RTMP_ADAPTER *pAd, IN RX_BLK *pRxBlk, IN UCHAR wdev_idx); INT Set_HtMIMOPSmode_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Set_HtTxBASize_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Set_HtDisallowTKIP_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Set_BurstMode_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); #endif /* DOT11_N_SUPPORT */ #ifdef DOT11_VHT_AC INT Set_VhtBw_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Set_VhtStbc_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT set_VhtBwSignal_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Set_VhtDisallowNonVHT_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); #endif /* DOT11_VHT_AC */ #ifdef APCLI_SUPPORT INT RTMPIoctlConnStatus(RTMP_ADAPTER *pAd, RTMP_STRING *arg); #endif /*APCLI_SUPPORT*/ #ifdef MEM_ALLOC_INFO_SUPPORT INT Show_MemInfo_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Show_PktInfo_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); #endif /* MEM_ALLOC_INFO_SUPPORT */ RTMP_STRING *GetAuthModeStr( IN UINT32 authMode); RTMP_STRING *GetEncryModeStr( IN UINT32 encryMode); UINT32 SecAuthModeOldToNew( IN USHORT authMode); UINT32 SecEncryModeOldToNew( IN USHORT encryMode); USHORT SecAuthModeNewToOld( IN UINT32 authMode); USHORT SecEncryModeNewToOld( IN UINT32 encryMode); VOID detect_wmm_traffic(RTMP_ADAPTER *pAd, struct wifi_dev *wdev, UCHAR up, UCHAR bOutput); #ifdef CONFIG_AP_SUPPORT VOID dynamic_tune_be_tx_op(RTMP_ADAPTER *pAd, ULONG nonBEpackets); #endif /* CONFIG_AP_SUPPORT */ #ifdef DOT11_N_SUPPORT VOID Handle_BSS_Width_Trigger_Events(RTMP_ADAPTER *pAd, UCHAR Channel); #if defined(A_BAND_SUPPORT) && defined(CONFIG_AP_SUPPORT) void build_ext_channel_switch_ie( IN RTMP_ADAPTER *pAd, IN HT_EXT_CHANNEL_SWITCH_ANNOUNCEMENT_IE * pIE, IN UCHAR Channel, IN UCHAR PhyMode, IN struct wifi_dev *wdev); #endif /*defined (A_BAND_SUPPORT) && defined (CONFIG_AP_SUPPORT)*/ void assoc_ht_info_debugshow( IN RTMP_ADAPTER *pAd, IN MAC_TABLE_ENTRY *pEntry, IN UCHAR ht_cap_len, IN HT_CAPABILITY_IE *pHTCapability); #endif /* DOT11_N_SUPPORT */ INT header_packet_process( RTMP_ADAPTER *pAd, PNDIS_PACKET pRxPacket, RX_BLK *pRxBlk); NDIS_STATUS rx_packet_process( RTMP_ADAPTER *pAd, PNDIS_PACKET pRxPacket, RX_BLK *pRxBlk); VOID ap_ieee802_3_data_rx(RTMP_ADAPTER *pAd, RX_BLK *pRxBlk); VOID sta_ieee802_3_data_rx(RTMP_ADAPTER *pAd, RX_BLK *pRxBlk); BOOLEAN rtmp_rx_done_handle(RTMP_ADAPTER *pAd); BOOLEAN mtd_rx_done_handle(RTMP_ADAPTER *pAd); #if defined(RTMP_PCI_SUPPORT) || defined(RTMP_RBUS_SUPPORT) #ifdef CONFIG_ANDES_SUPPORT BOOLEAN RxRing1DoneInterruptHandle(RTMP_ADAPTER *pAd); VOID RTMPHandleTxRing8DmaDoneInterrupt(RTMP_ADAPTER *pAd); #if defined(MT7615) || defined(MT7622) || defined(P18) || defined(MT7663) BOOLEAN RTMPHandleFwDwloCmdRingDmaDoneInterrupt(RTMP_ADAPTER *pAd); #endif /* defined(MT7615) || defined(MT7622) */ #endif /* CONFIG_ANDES_SUPPORT */ #ifdef MT_MAC VOID RTMPHandleBcnDmaDoneInterrupt(RTMP_ADAPTER *pAd); #endif /* MT_MAC */ #endif /* RTMP_PCI_SUPPORT */ VOID indicate_rx_pkt(RTMP_ADAPTER *pAd, RX_BLK *pRxBlk, UCHAR wdev_idx); VOID indicate_ampdu_pkt(RTMP_ADAPTER *pAd, RX_BLK *pRxBlk, UCHAR wdev_idx); VOID indicate_amsdu_pkt(RTMP_ADAPTER *pAd, RX_BLK *pRxBlk, UCHAR wdev_idx); VOID ba_reorder(RTMP_ADAPTER *pAd, RX_BLK *pRxBlk, UCHAR wdev_idx); VOID ba_reorder_buf_maintain(RTMP_ADAPTER *pAd); VOID indicate_802_3_pkt(RTMP_ADAPTER *pAd, RX_BLK *pRxBlk, UCHAR wdev_idx); VOID indicate_802_11_pkt(RTMP_ADAPTER *pAd, RX_BLK *pRxBlk, UCHAR wdev_idx); VOID indicate_eapol_pkt(RTMP_ADAPTER *pAd, RX_BLK *pRxBlk, UCHAR wdev_idx); UINT deaggregate_amsdu_announce( IN RTMP_ADAPTER *pAd, PNDIS_PACKET pPacket, IN PUCHAR pData, IN ULONG DataSize, IN UCHAR OpMode); #ifdef TXBF_SUPPORT BOOLEAN clientSupportsETxBF(RTMP_ADAPTER *pAd, HT_BF_CAP *pTxBFCap); void setETxBFCap(RTMP_ADAPTER *pAd, HT_BF_CAP *pTxBFCap); #ifdef VHT_TXBF_SUPPORT BOOLEAN clientSupportsVHTETxBF(RTMP_ADAPTER *pAd, VHT_CAP_INFO *pTxBFCapInfo); void setVHTETxBFCap(RTMP_ADAPTER *pAd, VHT_CAP_INFO *pTxBFCap); #endif /* VHT_TXBF_SUPPORT */ #ifdef ETXBF_EN_COND3_SUPPORT VOID txSndgSameMcs(RTMP_ADAPTER *pAd, MAC_TABLE_ENTRY *pEnt, UCHAR smoothMfb); VOID txSndgOtherGroup(RTMP_ADAPTER *pAd, MAC_TABLE_ENTRY *pEntry); VOID txMrqInvTxBF(RTMP_ADAPTER *pAd, MAC_TABLE_ENTRY *pEntry); VOID chooseBestMethod(RTMP_ADAPTER *pAd, MAC_TABLE_ENTRY *pEntry, UCHAR mfb); VOID rxBestSndg(RTMP_ADAPTER *pAd, MAC_TABLE_ENTRY *pEntry); #endif /* ETXBF_EN_COND3_SUPPORT */ VOID handleBfFb(RTMP_ADAPTER *pAd, RX_BLK *pRxBlk); VOID TxBFInit(RTMP_ADAPTER *pAd, MAC_TABLE_ENTRY *pEntry, BOOLEAN supETxBF); #ifndef MT_MAC VOID eTxBFProbing(RTMP_ADAPTER *pAd, MAC_TABLE_ENTRY *pEntry); #endif /* #ifndef MT_MAC */ /* VOID Trigger_Sounding_Packet( */ /* IN RTMP_ADAPTER *pAd, */ /* IN UCHAR SndgType, */ /* IN UCHAR SndgBW, */ /* IN UCHAR SndgMcs, */ /* IN MAC_TABLE_ENTRY *pEntry); */ /* #endif */ #ifndef MT_MAC VOID rtmp_asic_set_bf(RTMP_ADAPTER *pAd); #endif BOOLEAN rtmp_chk_itxbf_calibration(RTMP_ADAPTER *pAd); #endif /* TXBF_SUPPORT */ /* remove LLC and get 802_3 Header */ #define RTMP_802_11_REMOVE_LLC_AND_CONVERT_TO_802_3(_pRxBlk, _pHeader802_3) \ { \ PUCHAR _pRemovedLLCSNAP = NULL, _pDA, _pSA; \ \ if (RX_BLK_TEST_FLAG(_pRxBlk, fRX_WDS) || RX_BLK_TEST_FLAG(_pRxBlk, fRX_MESH)) { \ _pDA = _pRxBlk->Addr3; \ _pSA = _pRxBlk->Addr4; \ } else if (RX_BLK_TEST_FLAG(_pRxBlk, fRX_AP)) { \ _pDA = _pRxBlk->Addr1; \ if (RX_BLK_TEST_FLAG(_pRxBlk, fRX_DLS)) \ _pSA = _pRxBlk->Addr2; \ else \ _pSA = _pRxBlk->Addr3; \ } else if (RX_BLK_TEST_FLAG(_pRxBlk, fRX_STA)) { \ _pDA = _pRxBlk->Addr3; \ _pSA = _pRxBlk->Addr2; \ } else if (RX_BLK_TEST_FLAG(_pRxBlk, fRX_ADHOC)) { \ _pDA = _pRxBlk->Addr1; \ _pSA = _pRxBlk->Addr2; \ } else { \ /* TODO: shiang-usw, where shall we go here?? */ \ MTWF_LOG(DBG_CAT_RX, DBG_SUBCAT_ALL, DBG_LVL_ERROR, ("%s():Un-assigned Peer's Role!\n", __func__));\ _pDA = _pRxBlk->Addr3; \ _pSA = _pRxBlk->Addr2; \ } \ \ CONVERT_TO_802_3(_pHeader802_3, _pDA, _pSA, _pRxBlk->pData, \ _pRxBlk->DataSize, _pRemovedLLCSNAP); \ } VOID announce_or_forward_802_3_pkt(RTMP_ADAPTER *pAd, PNDIS_PACKET pPacket, struct wifi_dev *wdev, UCHAR op_mode); VOID indicate_agg_ralink_pkt( IN RTMP_ADAPTER *pAd, IN MAC_TABLE_ENTRY *pEntry, IN RX_BLK *pRxBlk, IN UCHAR wdev_idx); VOID Update_Rssi_Sample( IN RTMP_ADAPTER *pAd, IN RSSI_SAMPLE *pRssi, IN struct rx_signal_info *signal, IN UCHAR phymode, IN UCHAR bw); UINT32 mtd_pci_get_resource_idx(RTMP_ADAPTER *pAd, struct wifi_dev *wdev, enum PACKET_TYPE, UCHAR q_idx); PNDIS_PACKET mtd_pci_get_pkt_from_rx_resource( RTMP_ADAPTER *pAd, BOOLEAN *pbReschedule, UINT32 *pRxPending, UCHAR RxRingNo); PNDIS_PACKET mtd_pci_get_pkt_from_rx_resource_io( RTMP_ADAPTER *pAd, BOOLEAN *pbReschedule, UINT32 *pRxPending, UCHAR RxRingNo); PNDIS_PACKET pci_get_pkt_from_rx_resource( RTMP_ADAPTER *pAd, BOOLEAN *pbReschedule, UINT32 *pRxPending, UCHAR RxRingNo); PNDIS_PACKET usb_get_pkt_from_rx_resource( RTMP_ADAPTER *pAd, BOOLEAN *pbReschedule, UINT32 *pRxPending, UCHAR RxRingNo); PNDIS_PACKET sdio_get_pkt_from_rx_resource( RTMP_ADAPTER *pAd, BOOLEAN *pbReschedule, UINT32 *pRxPending, UCHAR RxRingNo); UCHAR *mt_pci_get_hif_buf(RTMP_ADAPTER *pAd, struct _TX_BLK *tx_blk, UCHAR hif_idx, UCHAR frame_type); VOID de_fragment_data_pkt(RTMP_ADAPTER *pAd, RX_BLK *pRxBlk); #if defined(AP_SCAN_SUPPORT) || defined(CONFIG_STA_SUPPORT) VOID RTMPIoctlGetSiteSurvey( IN RTMP_ADAPTER *pAd, IN RTMP_IOCTL_INPUT_STRUCT *wrq); #endif #ifdef CONFIG_AP_SUPPORT #ifdef APCLI_SUPPORT INT Set_ApCli_Enable_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Set_ApCli_Ssid_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); #ifdef ROAMING_ENHANCE_SUPPORT BOOLEAN IsApCliLinkUp(IN PRTMP_ADAPTER pAd); BOOLEAN ApCliDoRoamingRefresh( IN PRTMP_ADAPTER pAd, IN PMAC_TABLE_ENTRY pEntry, IN PNDIS_PACKET pRxPacket, IN struct wifi_dev *wdev); #endif /* ROAMING_ENHANCE_SUPPORT */ #endif /* APCLI_SUPPORT */ #endif /* CONFIG_AP_SUPPORT */ #ifdef MAT_SUPPORT VOID getIPv6MacTbInfo(MAT_STRUCT *, char *, ULONG); VOID getIPMacTbInfo(MAT_STRUCT *pMatCfg, char *pOutBuf, ULONG BufLen); NDIS_STATUS MATEngineInit(RTMP_ADAPTER *pAd); NDIS_STATUS MATEngineExit(RTMP_ADAPTER *pAd); PUCHAR MATEngineRxHandle(RTMP_ADAPTER *pAd, PNDIS_PACKET pPkt, UINT infIdx); PUCHAR MATEngineTxHandle(RTMP_ADAPTER *pAd, PNDIS_PACKET pPkt, UINT infIdx, UCHAR OpMode); BOOLEAN MATPktRxNeedConvert(RTMP_ADAPTER *pAd, PNET_DEV net_dev); #endif /* MAT_SUPPORT */ #ifdef CONFIG_AP_SUPPORT typedef struct CountryCodeToCountryRegion { USHORT CountryNum; UCHAR IsoName[3]; /*UCHAR CountryName[40]; */ RTMP_STRING *pCountryName; BOOLEAN SupportABand; /*ULONG RegDomainNum11A; */ UCHAR RegDomainNum11A; BOOLEAN SupportGBand; /*ULONG RegDomainNum11G; */ UCHAR RegDomainNum11G; } COUNTRY_CODE_TO_COUNTRY_REGION; #endif /* CONFIG_AP_SUPPORT */ #ifdef SNMP_SUPPORT /*for snmp */ typedef struct _DefaultKeyIdxValue { UCHAR KeyIdx; UCHAR Value[16]; } DefaultKeyIdxValue, *PDefaultKeyIdxValue; #endif void STA_MonPktSend(RTMP_ADAPTER *pAd, RX_BLK *pRxBlk); INT Set_FixedTxMode_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); #ifdef CONFIG_APSTA_MIXED_SUPPORT INT Set_OpMode_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); #endif /* CONFIG_APSTA_MIXED_SUPPORT */ INT Set_LongRetryLimit_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Set_ShortRetryLimit_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Set_AutoFallBack_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); VOID RT28XXDMADisable(RTMP_ADAPTER *pAd); VOID RT28XXDMAEnable(RTMP_ADAPTER *pAd); VOID RT28XXDMAReset(RTMP_ADAPTER *pAd); #ifdef RTMP_MAC_PCI VOID PDMAWatchDog(RTMP_ADAPTER *pAd); VOID PDMAResetAndRecovery(RTMP_ADAPTER *pAd); #endif #ifdef MT_MAC VOID DumpPseInfo(RTMP_ADAPTER *pAd); VOID PSEWatchDog(RTMP_ADAPTER *pAd); VOID PSEResetAndRecovery(RTMP_ADAPTER *pAd); #endif VOID MtUpdateBeaconToAsic( IN RTMP_ADAPTER *pAd, VOID *wdev_void, IN UINT16 FrameLen, IN UCHAR UpdatePktType); void CfgInitHook(RTMP_ADAPTER *pAd); NDIS_STATUS RtmpMgmtTaskInit(RTMP_ADAPTER *pAd); VOID mtd_net_tasklet_exit(RTMP_ADAPTER *pAd); VOID RtmpMgmtTaskExit(RTMP_ADAPTER *pAd); void tbtt_tasklet(unsigned long data); #ifdef MT_MAC void mt_mac_int_0_tasklet(unsigned long data); void mt_mac_int_1_tasklet(unsigned long data); void mt_mac_int_2_tasklet(unsigned long data); void mt_mac_int_3_tasklet(unsigned long data); void mt_mac_int_4_tasklet(unsigned long data); #endif /* MT_MAC */ #ifdef RTMP_MAC_PCI BOOLEAN RT28xxPciAsicRadioOff( IN RTMP_ADAPTER *pAd, IN UCHAR Level, IN USHORT TbttNumToNextWakeUp); BOOLEAN RT28xxPciAsicRadioOn(RTMP_ADAPTER *pAd, UCHAR Level); VOID RTMPInitPCIeDevice(RT_CMD_PCIE_INIT *pConfig, VOID *pAd); VOID PciMlmeRadioOn(RTMP_ADAPTER *pAd, struct wifi_dev *wdev); VOID PciMlmeRadioOFF(RTMP_ADAPTER *pAd, struct wifi_dev *wdev); ra_dma_addr_t RtmpDrvPciMapSingle( IN RTMP_ADAPTER *pAd, IN VOID *ptr, IN size_t size, IN INT sd_idx, IN INT direction); VOID pci_io_write32(RTMP_ADAPTER *ad, UINT32 addr, UINT32 value); VOID pci_io_read32(RTMP_ADAPTER *ad, UINT32 addr, UINT32 *value); #endif /* RTMP_MAC_PCI */ INT irq_init(RTMP_ADAPTER *pAd); #ifdef NEW_WOW_SUPPORT VOID RT28xxAndesWOWEnable(RTMP_ADAPTER *pAd); VOID RT28xxAndesWOWDisable(RTMP_ADAPTER *pAd); #endif /* NEW_WOW_SUPPORT */ #ifdef MT_WOW_SUPPORT VOID MT76xxAndesWOWEnable(RTMP_ADAPTER *pAd, PSTA_ADMIN_CONFIG pStaCfg); VOID MT76xxAndesWOWDisable(RTMP_ADAPTER *pAd, PSTA_ADMIN_CONFIG pStaCfg); VOID MT76xxAndesWOWInit(RTMP_ADAPTER *pAd); #endif #if (defined(WOW_SUPPORT) && defined(RTMP_MAC_USB)) || defined(NEW_WOW_SUPPORT) VOID RT28xxAsicWOWEnable(RTMP_ADAPTER *pAd, PSTA_ADMIN_CONFIG pStaCfg); VOID RT28xxAsicWOWDisable(RTMP_ADAPTER *pAd); #endif /* (defined(WOW_SUPPORT) && defined(RTMP_MAC_USB)) || defined(NEW_WOW_SUPPORT) */ /*////////////////////////////////////*/ /*///////////////////////////////////*/ INT RTMPShowCfgValue(RTMP_ADAPTER *pAd, RTMP_STRING *name, RTMP_STRING *buf, UINT32 MaxLen); /*//////////////////////////////////*/ #ifdef TXBF_SUPPORT VOID handleHtcField(RTMP_ADAPTER *pAd, RX_BLK *pRxBlk); #endif /* TXBF_SUPPORT */ #ifdef MFB_SUPPORT VOID MFB_PerPareMRQ(RTMP_ADAPTER *pAd, VOID *pBuf, MAC_TABLE_ENTRY *pEntry); VOID MFB_PerPareMFB(RTMP_ADAPTER *pAd, VOID *pBuf, MAC_TABLE_ENTRY *pEntry); #endif /* MFB_SUPPORT */ UINT VIRTUAL_IF_INC(RTMP_ADAPTER *pAd); UINT VIRTUAL_IF_DEC(RTMP_ADAPTER *pAd); UINT VIRTUAL_IF_NUM(RTMP_ADAPTER *pAd); #ifdef SOFT_ENCRYPT BOOLEAN RTMPExpandPacketForSwEncrypt(RTMP_ADAPTER *pAd, TX_BLK *pTxBlk); VOID RTMPUpdateSwCacheCipherInfo(RTMP_ADAPTER *pAd, TX_BLK *pTxBlk, UCHAR *pHdr); INT tx_sw_encrypt(RTMP_ADAPTER *pAd, TX_BLK *pTxBlk, UCHAR *buf_ptr, HEADER_802_11 *wifi_hdr); #endif /* SOFT_ENCRYPT */ /* OS Related funciton prototype definitions. TODO: Maybe we need to move these function prototypes to other proper place. */ VOID RTInitializeCmdQ(PCmdQ cmdq); INT RTPCICmdThread(ULONG Context); VOID CMDHandler(RTMP_ADAPTER *pAd); VOID RTThreadDequeueCmd(PCmdQ cmdq, PCmdQElmt *pcmdqelmt); NDIS_STATUS RTEnqueueInternalCmd( IN RTMP_ADAPTER *pAd, IN NDIS_OID Oid, IN PVOID pInformationBuffer, IN UINT32 InformationBufferLength); void RtmpCmdQExit(RTMP_ADAPTER *pAd); void RtmpCmdQInit(RTMP_ADAPTER *pAd); #ifdef HOSTAPD_SUPPORT VOID ieee80211_notify_michael_failure( IN RTMP_ADAPTER *pAd, IN PHEADER_802_11 pHeader, IN UINT keyix, IN INT report); const CHAR *ether_sprintf(const UINT8 *mac); #endif/*HOSTAPD_SUPPORT*/ #ifdef VENDOR_FEATURE3_SUPPORT VOID RTMP_IO_WRITE32(RTMP_ADAPTER *pAd, UINT32 Offset, UINT32 Value); #endif /* VENDOR_FEATURE3_SUPPORT */ BOOLEAN CHAN_PropertyCheck(RTMP_ADAPTER *pAd, UINT32 ChanNum, UCHAR Property); INT32 getLegacyOFDMMCSIndex(UINT8 MCS); void getRate(HTTRANSMIT_SETTING HTSetting, ULONG *fLastTxRxRate); #ifdef APCLI_SUPPORT VOID ApCliRTMPSendNullFrame( IN RTMP_ADAPTER *pAd, IN UCHAR TxRate, IN BOOLEAN bQosNull, IN MAC_TABLE_ENTRY *pMacEntry, IN USHORT PwrMgmt); #endif/*APCLI_SUPPORT*/ void RTMP_IndicateMediaState( IN RTMP_ADAPTER *pAd, IN NDIS_MEDIA_STATE media_state); INT RTMPSetInformation( IN RTMP_ADAPTER *pAd, IN OUT RTMP_IOCTL_INPUT_STRUCT *rq, IN INT cmd, IN struct wifi_dev *wdev); INT RTMPQueryInformation( IN RTMP_ADAPTER *pAd, INOUT RTMP_IOCTL_INPUT_STRUCT *rq, IN INT cmd, IN struct wifi_dev *wdev); VOID RTMPIoctlShow( IN RTMP_ADAPTER *pAd, IN RTMP_IOCTL_INPUT_STRUCT *rq, IN UINT32 subcmd, IN VOID *pData, IN ULONG Data); INT RTMP_COM_IoctlHandle( IN VOID *pAdSrc, IN RTMP_IOCTL_INPUT_STRUCT *wrq, IN INT cmd, IN USHORT subcmd, IN VOID *pData, IN ULONG Data); #ifdef CONFIG_AP_SUPPORT INT RTMP_AP_IoctlPrepare(RTMP_ADAPTER *pAd, VOID *pCB); #endif /* CONFIG_AP_SUPPORT */ INT Set_VcoPeriod_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Set_RateAlg_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); NDIS_STATUS RtmpEnqueueTokenFrame( IN RTMP_ADAPTER *pAd, IN UCHAR *pAddr, IN UCHAR TxRate, IN UCHAR AID, IN UCHAR apidx, IN UCHAR OldUP); VOID RtmpEnqueueNullFrame( IN RTMP_ADAPTER *pAd, IN UCHAR *pAddr, IN UCHAR TxRate, IN UCHAR AID, IN UCHAR apidx, IN BOOLEAN bQosNull, IN BOOLEAN bEOSP, IN UCHAR OldUP); VOID RtmpCleanupPsQueue( IN RTMP_ADAPTER *pAd, IN PQUEUE_HEADER pQueue); NDIS_STATUS RtmpInsertPsQueue( IN RTMP_ADAPTER *pAd, IN PNDIS_PACKET pPacket, IN MAC_TABLE_ENTRY *pMacEntry, IN UCHAR QueIdx); VOID RtmpHandleRxPsPoll(RTMP_ADAPTER *pAd, UCHAR *pAddr, USHORT Aid, BOOLEAN isActive); BOOLEAN RtmpPsIndicate(RTMP_ADAPTER *pAd, UCHAR *pAddr, UCHAR wcid, UCHAR Psm); #ifdef MT_MAC VOID MtHandleRxPsPoll(RTMP_ADAPTER *pAd, UCHAR *pAddr, USHORT wcid, BOOLEAN isActive); BOOLEAN MtPsIndicate(RTMP_ADAPTER *pAd, UCHAR *pAddr, UCHAR wcid, UCHAR Psm); VOID MtPsRedirectDisableCheck(RTMP_ADAPTER *pAd, UCHAR wcid); VOID MtPsSendToken(RTMP_ADAPTER *pAd, UINT32 WlanIdx); VOID MtPsRecovery(RTMP_ADAPTER *pAd); VOID MtSetIgnorePsm(RTMP_ADAPTER *pAd, MAC_TABLE_ENTRY *pEntry, UCHAR value); VOID MtEnqTxSwqFromPsQueue(RTMP_ADAPTER *pAd, UCHAR qidx, STA_TR_ENTRY *tr_entry); VOID CheckSkipTX(RTMP_ADAPTER *pAd, MAC_TABLE_ENTRY *pEntry); #endif /* MT_MAC */ #ifdef CONFIG_MULTI_CHANNEL VOID RtmpEnqueueLastNullFrame( IN RTMP_ADAPTER *pAd, IN PUCHAR pAddr, IN UCHAR TxRate, IN UCHAR PID, IN UCHAR apidx, IN BOOLEAN bQosNull, IN BOOLEAN bEOSP, IN UCHAR OldUP, IN UCHAR PwrMgmt, IN UCHAR OpMode); VOID EnableMACTxPacket( IN RTMP_ADAPTER *pAd, IN PMAC_TABLE_ENTRY pEntry, IN UCHAR PwrMgmt, IN BOOLEAN bTxNullFramei, IN UCHAR QSel); VOID DisableMACTxPacket( IN RTMP_ADAPTER *pAd, IN PMAC_TABLE_ENTRY pEntry, IN UCHAR PwrMgmt, IN BOOLEAN bWaitACK, IN UCHAR QSel); VOID InitMultiChannelRelatedValue( IN RTMP_ADAPTER *pAd, IN UCHAR Channel, IN UCHAR CentralChannel); VOID EDCA_ActionTimeout( IN PVOID SystemSpecific1, IN PVOID FunctionContext, IN PVOID SystemSpecific2, IN PVOID SystemSpecific3); VOID HCCA_ActionTimeout( IN PVOID SystemSpecific1, IN PVOID FunctionContext, IN PVOID SystemSpecific2, IN PVOID SystemSpecific3); NDIS_STATUS MultiChannelThreadInit(RTMP_ADAPTER *pAd); BOOLEAN MultiChannelThreadExit(RTMP_ADAPTER *pAd); VOID MultiChannelTimerStop(RTMP_ADAPTER *pAd); VOID MultiChannelTimerStart(RTMP_ADAPTER *pAd, MAC_TABLE_ENTRY *pEntry); #endif /* CONFIG_MULTI_CHANNEL */ VOID dev_rx_802_11_data_frm(RTMP_ADAPTER *pAd, RX_BLK *pRxBlk); VOID dev_rx_mgmt_frm(RTMP_ADAPTER *pAd, RX_BLK *pRxBlk); VOID dev_rx_ctrl_frm(RTMP_ADAPTER *pAd, RX_BLK *pRxBlk); #ifdef DOT11_N_SUPPORT void DisplayTxAgg(RTMP_ADAPTER *pAd); #endif /* DOT11_N_SUPPORT */ VOID set_default_ap_edca_param(EDCA_PARM *pEdca); VOID set_default_sta_edca_param(EDCA_PARM *pEdca); UCHAR dot11_2_ra_rate(UCHAR MaxSupportedRateIn500Kbps); UCHAR dot11_max_sup_rate(INT SupRateLen, UCHAR *SupRate, INT ExtRateLen, UCHAR *ExtRate); VOID TRTableResetEntry(RTMP_ADAPTER *pAd, UCHAR tr_tb_idx); VOID TRTableInsertEntry(RTMP_ADAPTER *pAd, UCHAR tr_tb_idx, MAC_TABLE_ENTRY *pEntry); VOID TRTableInsertMcastEntry(RTMP_ADAPTER *pAd, UCHAR tr_tb_idx, struct wifi_dev *wdev); VOID TRTableEntryDump(RTMP_ADAPTER *pAd, INT tr_idx, const RTMP_STRING *caller, INT line); VOID MgmtTableSetMcastEntry(RTMP_ADAPTER *pAd, UCHAR wcid); VOID DataTableSetMcastEntry(RTMP_ADAPTER *pAd, UCHAR wcid); VOID MacTableSetEntryPhyCfg(RTMP_ADAPTER *pAd, MAC_TABLE_ENTRY *pEntry); VOID MacTableReset(RTMP_ADAPTER *pAd); VOID MacTableResetWdev(RTMP_ADAPTER *pAd, struct wifi_dev *wdev); MAC_TABLE_ENTRY *MacTableLookup(RTMP_ADAPTER *pAd, UCHAR *pAddr); MAC_TABLE_ENTRY *MacTableLookup2(RTMP_ADAPTER *pAd, UCHAR *pAddr, struct wifi_dev *wdev); BOOLEAN MacTableDeleteEntry(RTMP_ADAPTER *pAd, USHORT wcid, UCHAR *pAddr); MAC_TABLE_ENTRY *MacTableInsertEntry( IN RTMP_ADAPTER *pAd, IN UCHAR *pAddr, IN struct wifi_dev *wdev, IN UINT32 ent_type, IN UCHAR OpMode, IN BOOLEAN CleanAll); VOID dump_rxblk(RTMP_ADAPTER *pAd, RX_BLK *pRxBlk); #ifdef RTMP_MAC_PCI VOID dump_rxd(RTMP_ADAPTER *pAd, RXD_STRUC *pRxD); #endif /* RTMP_MAC_PCI */ INT set_no_bcn(RTMP_ADAPTER *pAd, RTMP_STRING *arg); #if defined(WFA_VHT_PF) || defined(MT7603_FPGA) || defined(MT7628_FPGA) || defined(MT7636_FPGA) || defined(MT7637_FPGA) INT set_force_amsdu(RTMP_ADAPTER *pAd, RTMP_STRING *arg); #endif /* defined(WFA_VHT_PF) || defined(MT7603_FPGA) */ #ifdef WFA_VHT_PF /* for SIGMA */ INT set_vht_nss_mcs_cap(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT set_vht_nss_mcs_opt(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT set_vht_opmode_notify_ie(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT set_force_operating_mode(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT set_force_noack(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT set_force_vht_sgi(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT set_force_vht_tx_stbc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT set_force_ext_cca(RTMP_ADAPTER *pAd, RTMP_STRING *arg); #endif /* WFA_VHT_PF */ #if defined(CONFIG_CSO_SUPPORT) || defined(CONFIG_TSO_SUPPORT) INT rlt_net_acc_init(RTMP_ADAPTER *pAd); #endif INT SetRF(RTMP_ADAPTER *pAd, RTMP_STRING *Arg); int write_reg(RTMP_ADAPTER *ad, UINT32 base, UINT16 offset, UINT32 value); int read_reg(struct _RTMP_ADAPTER *ad, UINT32 base, UINT16 offset, UINT32 *value); #ifdef MT_MAC VOID StatRateToString(RTMP_ADAPTER *pAd, CHAR *Output, UCHAR TxRx, UINT32 RawData); #endif /* MT_MAC */ #ifdef CONFIG_MULTI_CHANNEL VOID Start_MCC(RTMP_ADAPTER *pAd); VOID Stop_MCC(RTMP_ADAPTER *pAd, INT channel); #endif /* CONFIG_MULTI_CHANNEL */ NDIS_STATUS RTMPInitHifAdapterBlock(RTMP_ADAPTER *pAd); NDIS_STATUS RTMPFreeHifAdapterBlock(RTMP_ADAPTER *pAd); VOID rtmp_hif_data_init(RTMP_ADAPTER *pAd); BOOLEAN wmode_band_equal(UCHAR smode, UCHAR tmode); UCHAR wmode_2_rfic(UCHAR PhyMode); struct wifi_dev *get_wdev_by_ioctl_idx_and_iftype(RTMP_ADAPTER *pAd, INT idx, INT if_type); struct wifi_dev *get_wdev_by_idx(RTMP_ADAPTER *pAd, INT idx); #ifdef CONFIG_FWOWN_SUPPORT VOID FwOwn(RTMP_ADAPTER *pAd); INT32 DriverOwn(RTMP_ADAPTER *pAd); #endif #ifdef ERR_RECOVERY INT Set_ErrDetectOn_Proc( IN PRTMP_ADAPTER pAd, IN RTMP_STRING *arg); INT Set_ErrDetectMode_Proc( IN PRTMP_ADAPTER pAd, IN RTMP_STRING *arg); #endif /* ERR_RECOVERY */ VOID mac_entry_lookup(RTMP_ADAPTER *pAd, UCHAR *pAddr, struct wifi_dev *wdev, MAC_TABLE_ENTRY **entry); VOID mac_entry_delete(struct _RTMP_ADAPTER *ad, struct _MAC_TABLE_ENTRY *entry); INT test_flag_con_in_prog(ULONG *ConInPrgress); #define TEST_FLAG_CONN_IN_PROG(_a) test_flag_con_in_prog(_a) INT32 MtAcquirePowerControl(RTMP_ADAPTER *pAd, UINT32 Offset); void MtReleasePowerControl(RTMP_ADAPTER *pAd, UINT32 Offset); #ifdef BACKGROUND_SCAN_SUPPORT INT set_background_scan(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT set_background_scan_cfg(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT set_background_scan_test(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT set_background_scan_notify(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT show_background_scan_info(RTMP_ADAPTER *pAd, RTMP_STRING *arg); #endif /* BACKGROUND_SCAN_SUPPORT */ #if defined(INTERNAL_CAPTURE_SUPPORT) || defined(WIFI_SPECTRUM_SUPPORT) INT32 Set_RBIST_Switch_Mode( IN RTMP_ADAPTER *pAd, IN RTMP_STRING *arg); INT32 Set_RBIST_Capture_Start( IN RTMP_ADAPTER *pAd, IN RTMP_STRING *arg); INT32 Get_RBIST_Capture_Status( IN RTMP_ADAPTER *pAd, IN RTMP_STRING *arg); INT32 Get_RBIST_Raw_Data_Proc( IN RTMP_ADAPTER *pAd, IN RTMP_STRING *arg); INT32 Get_RBIST_IQ_Data( IN RTMP_ADAPTER *pAd, IN PINT32 pData, IN PINT32 pDataLen, IN UINT32 IQ_Type, IN UINT32 WF_Num); INT32 Get_RBIST_IQ_Data_Proc( IN RTMP_ADAPTER *pAd, IN RTMP_STRING *arg); UINT32 Get_System_CapNode_Info( IN RTMP_ADAPTER *pAd); UINT32 Get_System_CenFreq_Info( IN RTMP_ADAPTER *pAd, IN UINT32 CapNode); UINT8 Get_System_Bw_Info( IN RTMP_ADAPTER *pAd, IN UINT32 CapNode); INT32 Get_System_Wireless_Info( IN RTMP_ADAPTER *pAd, IN RTMP_STRING *arg); #endif /* defined(INTERNAL_CAPTURE_SUPPORT) || defined(WIFI_SPECTRUM_SUPPORT) */ #define QA_IRR_WF0 1 #define QA_IRR_WF1 2 #define QA_IRR_WF2 4 #define QA_IRR_WF3 8 #define WF0 0 #define WF1 1 #define WF2 2 #define WF3 3 #define WF_NUM 4 #define BITMAP_WF0 1 #define BITMAP_WF1 2 #define BITMAP_WF2 4 #define BITMAP_WF3 8 #define BITMAP_WF_ALL 15 INT Set_IRR_ADC(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Set_IRR_RxGain(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Set_IRR_TTG(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Set_IRR_TTGOnOff(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT set_manual_protect(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT set_manual_rdg(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT set_cca_en(RTMP_ADAPTER *pAd, RTMP_STRING *arg); #if defined(MT7615) || defined(MT7622) || defined(P18) || defined(MT7663) typedef enum _Stat_Action { RESET_COUNTER = 0, SHOW_RX_STATISTIC } Stat_Action; INT Set_Rx_Vector_Control(RTMP_ADAPTER *pAd, RTMP_STRING *arg, RTMP_IOCTL_INPUT_STRUCT *wrq); INT Show_Rx_Statistic(RTMP_ADAPTER *pAd, RTMP_STRING *arg, RTMP_IOCTL_INPUT_STRUCT *wrq); #endif /* defined(MT7615) || defined(MT7622) */ #ifdef CUT_THROUGH INT Set_CtLowWaterMark_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); #endif /*CUT_THROUGH*/ #ifdef SMART_CARRIER_SENSE_SUPPORT INT Set_SCSEnable_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Set_SCSCfg_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Set_SCSPd_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Show_SCSinfo_proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); #endif /* SMART_CARRIER_SENSE_SUPPORT */ INT Set_MibBucket_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT Show_MibBucket_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); #ifdef DHCP_UC_SUPPORT UINT16 RTMP_UDP_Checksum(IN PNDIS_PACKET pSkb); #endif /* DHCP_UC_SUPPORT */ #ifdef RTMP_UDMA_SUPPORT #endif /*RTMP_UDMA_SUPPORT*/ INT SetSKUCtrl(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT SetPercentageCtrl(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT SetPowerDropCtrl(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT SetBfBackoffCtrl(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT SetThermoCompCtrl(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT SetCCKTxStream(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT SetRfTxAnt(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT SetTxPowerInfo(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT SetTOAECtrl(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT SetEDCCACtrl(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT ShowEDCCAStatus(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT SetSKUInfo(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT SetBFBackoffInfo(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT SetMUTxPower(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT SetBFNDPATxDCtrl(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT SetTxPowerCompInfo(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT SetThermalManualCtrl(RTMP_ADAPTER *pAd, RTMP_STRING *arg); #ifdef TX_POWER_CONTROL_SUPPORT INT SetTxPowerBoostCtrl(RTMP_ADAPTER *pAd, RTMP_STRING *arg); #endif /* TX_POWER_CONTROL_SUPPORT */ #ifdef RF_LOCKDOWN INT SetCalFreeApply(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT SetWriteEffuseRFpara(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT SetRFBackup(RTMP_ADAPTER *pAd, RTMP_STRING *arg); #endif /* RF_LOCKDOWN */ #ifdef ETSI_RX_BLOCKER_SUPPORT INT SetFixWbIbRssiCtrl(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT SetRssiThCtrl(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT SetCheckThCtrl(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT SetAdaptRxBlockCtrl(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT SetWbRssiDirectCtrl(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT SetIbRssiDirectCtrl(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT ShowRssiThInfo(RTMP_ADAPTER *pAd, RTMP_STRING *arg); #endif /* end of ETSI_RX_BLOCKER_SUPPORT */ #ifdef TXPWRMANUAL INT TxPowerManualCtrl(PRTMP_ADAPTER pAd, BOOLEAN fgPwrManCtrl, UINT8 u1TxPwrModeManual, UINT8 u1TxPwrBwManual, UINT8 u1TxPwrRateManual, INT8 i1TxPwrValueManual, UCHAR ucBandIdx); INT SetTxPwrManualCtrl(RTMP_ADAPTER *pAd, RTMP_STRING *arg); #endif /* TXPWRMANUAL */ INT TxPowerPercentCtrl(PRTMP_ADAPTER pAd, BOOLEAN fgTxPowerPercentEn, UCHAR ucBandIdx); INT TxPowerDropCtrl(PRTMP_ADAPTER pAd, UINT8 ucPowerDrop, UCHAR ucBandIdx); #ifdef SINGLE_SKU_V2 #if defined(MT7615) || defined(MT7622) INT TxPowerSKUCtrl(PRTMP_ADAPTER pAd, BOOLEAN fgTxPowerSKUEn, UCHAR ucBandIdx); INT TxPowerBfBackoffCtrl(PRTMP_ADAPTER pAd, BOOLEAN fgTxBFBackoffEn, UCHAR ucBandIdx); INT TxPowerBfBackoffParaCtrl(PRTMP_ADAPTER pAd, UCHAR ChannelBand, UCHAR ControlChannel, UCHAR ucBandIdx); #else #endif /* defined(MT7615) || defined(MT7622) */ #endif /* SINGLE_SKU_V2 */ INT TxCCKStreamCtrl(PRTMP_ADAPTER pAd, UINT8 u1CCKTxStream, UCHAR ucBandIdx); INT ThermoCompCtrl(PRTMP_ADAPTER pAd, BOOLEAN fgThermoCompEn, UCHAR ucBandIdx); INT TxPowerRfTxAnt(PRTMP_ADAPTER pAd, UINT8 ucTxAntIdx); INT TxPowerShowInfo(PRTMP_ADAPTER pAd, UCHAR ucTxPowerInfoCatg, UINT8 ucBandIdx); INT TOAECtrlCmd(PRTMP_ADAPTER pAd, UCHAR TOAECtrl); INT EDCCACtrlCmd(PRTMP_ADAPTER pAd, UCHAR ucBandIdx, UCHAR EDCCACtrl); INT MUPowerCtrlCmd(PRTMP_ADAPTER pAd, BOOLEAN MUPowerForce, UCHAR MUPowerCtrl); INT BFNDPATxDCtrlCmd(PRTMP_ADAPTER pAd, BOOLEAN fgNDPA_ManualMode, UINT8 ucNDPA_TxMode, UINT8 ucNDPA_Rate, UINT8 ucNDPA_BW, UINT8 ucNDPA_PowerOffset); INT TemperatureCtrl(PRTMP_ADAPTER pAd, BOOLEAN fgManualMode, CHAR cTemperature); #ifdef TX_POWER_CONTROL_SUPPORT INT TxPwrUpCtrl(PRTMP_ADAPTER pAd, UINT8 ucBandIdx, CHAR cPwrUpCat, CHAR cPwrUpValue[POWER_UP_CATEGORY_RATE_NUM]); #endif /* TX_POWER_CONTROL_SUPPORT */ UINT8 TxPowerGetChBand(UINT8 ucBandIdx, UINT8 CentralCh); #ifdef TPC_SUPPORT INT TxPowerTpcFeatureCtrl(PRTMP_ADAPTER pAd, struct wifi_dev *wdev, INT8 TpcPowerValue); INT TxPowerTpcFeatureForceCtrl(PRTMP_ADAPTER pAd, INT8 TpcPowerValue, UINT8 ucBandIdx, UINT8 CentralChannel); #endif /* TPC_SUPPORT */ #define RETURN_STATUS_TRUE 0 INT set_hnat_register(RTMP_ADAPTER *pAd, RTMP_STRING *arg); enum { MSDU_FORMAT, FINAL_AMSDU_FORMAT, MIDDLE_AMSDU_FORMAT, FIRST_AMSDU_FORMAT, }; #define RETURN_IF_PAD_NULL(_pAd) \ { \ if (_pAd == NULL) { \ MTWF_LOG(DBG_CAT_ALL, DBG_SUBCAT_ALL, DBG_LVL_ERROR, ("%s():Unexpected pAd NULL!\n", __func__)); \ return; \ } \ } #define RETURN_ZERO_IF_PAD_NULL(_pAd) \ { \ if (_pAd == NULL) { \ MTWF_LOG(DBG_CAT_ALL, DBG_SUBCAT_ALL, DBG_LVL_ERROR, ("%s():Unexpected pAd NULL!\n", __func__)); \ return 0; \ } \ } UINT32 Get_OBSS_AirTime(PRTMP_ADAPTER pAd, UCHAR BandIdx); VOID Reset_OBSS_AirTime(PRTMP_ADAPTER pAd, UCHAR BandIdx); UINT32 Get_My_Tx_AirTime(PRTMP_ADAPTER pAd, UCHAR BandIdx); UINT32 Get_My_Rx_AirTime(PRTMP_ADAPTER pAd, UCHAR BandIdx); UINT32 Get_EDCCA_Time(PRTMP_ADAPTER pAd, UCHAR BandIdx); VOID CCI_ACI_scenario_maintain(PRTMP_ADAPTER pAd); #ifdef VENDOR_FEATURE7_SUPPORT #ifdef DOT11_N_SUPPORT INT Show_HtBw_Proc( IN PRTMP_ADAPTER pAd, OUT RTMP_STRING *pBuf, IN ULONG BufLen); INT Show_HtExtcha_Proc( IN PRTMP_ADAPTER pAd, OUT RTMP_STRING *pBuf, IN ULONG BufLen); #endif #endif #if defined(MT_MAC) && defined(VHT_TXBF_SUPPORT) VOID Mumimo_scenario_maintain(PRTMP_ADAPTER pAd); #endif #ifdef LED_CONTROL_SUPPORT INT Set_Led_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg); #endif INT wdev_edca_acquire(struct _RTMP_ADAPTER *ad, struct wifi_dev *wdev); struct wifi_dev *get_default_wdev(struct _RTMP_ADAPTER *ad); UCHAR decide_phy_bw_by_channel(struct _RTMP_ADAPTER *ad, UCHAR channel); void update_att_from_wdev(struct wifi_dev *dev1, struct wifi_dev *dev2); BOOLEAN IsPublicActionFrame(PRTMP_ADAPTER pAd, VOID *pbuf); #ifdef ERR_RECOVERY INT32 ShowSerProc(struct _RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT32 ShowSerProc2(struct _RTMP_ADAPTER *pAd, RTMP_STRING *arg); #endif INT32 ShowBcnProc(struct _RTMP_ADAPTER *pAd, RTMP_STRING *arg); #ifdef TX_POWER_CONTROL_SUPPORT INT32 ShowTxPowerBoostInfo(RTMP_ADAPTER *pAd, RTMP_STRING *arg); #endif /* TX_POWER_CONTROL_SUPPORT */ #ifdef MT_FDB void fdb_enable(struct _RTMP_ADAPTER *pAd); INT show_fdb_n9_log(struct _RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT show_fdb_cr4_log(struct _RTMP_ADAPTER *pAd, RTMP_STRING *arg); #endif /* MT_FDB */ INT wdev_do_open(struct wifi_dev *wdev); INT wdev_do_close(struct wifi_dev *wdev); INT wdev_do_linkup(struct wifi_dev *wdev, struct _MAC_TABLE_ENTRY *entry); INT wdev_do_linkdown(struct wifi_dev *wdev); INT wdev_do_conn_act(struct wifi_dev *wdev, struct _MAC_TABLE_ENTRY *entry); INT wdev_do_disconn_act(struct wifi_dev *wdev, struct _MAC_TABLE_ENTRY *entry); #ifdef CON_WPS VOID APMlmeScanCompleteAction(PRTMP_ADAPTER pAd, MLME_QUEUE_ELEM *Elem); #endif /* CON_WPS */ void ApSendBroadcastDeauth(void *ad_obj, struct wifi_dev *wdev); #ifdef MULTI_PROFILE typedef enum MTB_PROFILE_ID_T { MTB_2G_PROFILE, MTB_5G_PROFILE, MTB_MERGE_PROFILE, MTB_DEV_PREFIX } MTB_PROFILE_ID; NDIS_STATUS update_mtb_value(RTMP_ADAPTER *pAd, UCHAR profile_id, UINT_32 extra, RTMP_STRING *value); INT multi_profile_apcli_devname_req(struct _RTMP_ADAPTER *ad, UCHAR *final_name, INT *ifidx); UCHAR is_multi_profile_enable(struct _RTMP_ADAPTER *ad); UCHAR multi_profile_get_pf1_num(struct _RTMP_ADAPTER *ad); UCHAR multi_profile_get_pf2_num(struct _RTMP_ADAPTER *ad); #endif /*MULTI_PROFILE*/ #ifdef PCIE_ASPM_DYM_CTRL_SUPPORT typedef enum _ENUM_PCIE_ASPM_TYPE_T { PCIE_ASPM_TYPE_L0S, PCIE_ASPM_TYPE_L1, PCIE_ASPM_TYPE_NUM, } ENUM_PCIE_ASPM_TYPE_T, *P_ENUM_PCIE_ASPM_TYPE_T; #endif /* PCIE_ASPM_DYM_CTRL_SUPPORT */ INT build_extra_ie(RTMP_ADAPTER *pAd, struct _build_ie_info *info); INT build_extended_cap_ie(RTMP_ADAPTER *pAd, struct _build_ie_info *info); INT build_rsn_ie(RTMP_ADAPTER *pAd, struct wifi_dev *wdev, UCHAR *buf); INT build_wsc_ie(RTMP_ADAPTER *pAd, struct _build_ie_info *info); INT build_wmm_cap_ie(RTMP_ADAPTER *pAd, struct _build_ie_info *info); VOID parse_RXV_packet_v1(RTMP_ADAPTER *pAd, UINT32 Type, RX_BLK *RxBlk, UCHAR *Data); VOID parse_RXV_packet_v2(RTMP_ADAPTER *pAd, UINT32 Type, RX_BLK *RxBlk, UCHAR *Data); INT32 txs_handler_v1(RTMP_ADAPTER *pAd, RX_BLK *rx_blk, VOID *rx_packet); INT32 txs_handler_v2(RTMP_ADAPTER *pAd, RX_BLK *rx_blk, VOID *rx_packet); INT SetRxRateRecordEn(RTMP_ADAPTER *pAd, RTMP_STRING *arg); INT SetRxvRecordEn(RTMP_ADAPTER *pAd, RTMP_STRING *arg); BOOLEAN SetCsdDebugSet(RTMP_ADAPTER *pAd, UINT8 band_idx, UINT8 g0_value, UINT8 g1_value, UINT8 g2_value); INT ShowRxRateHistogram(RTMP_ADAPTER *pAd, RTMP_STRING *arg); PRxVBQElmt RxVBDequeue( IN PRTMP_ADAPTER pAd); PRxVBQElmt RxVBQueueSearch( IN PRTMP_ADAPTER pAd, IN UINT8 rxv_sn, IN UINT32 Type); VOID RecordRxVB( RTMP_ADAPTER *pAd, RX_BLK *RxBlk, UCHAR *Data, UINT32 Type); VOID RxVB_Report_Action( PRTMP_ADAPTER pAd, UCHAR wcid, PRxVBQElmt prxvbqelmt); UINT16 Checksum16(UINT8 *pData, int len); UINT16 UdpChecksum16(UINT8 *pData, int len); #endif /* __RTMP_H__ */
28.195308
218
0.752476
[ "mesh" ]
16706aa13c3a598dbdd74b67c3e6b692af3ff959
5,188
h
C
build.h/util/cli.h
SonnyBonds/build.h
7ff15859d0e779445303b9a8bffb7e2ddf53d662
[ "MIT" ]
6
2022-01-30T03:22:46.000Z
2022-03-25T17:40:50.000Z
build.h/util/cli.h
SonnyBonds/build.h
7ff15859d0e779445303b9a8bffb7e2ddf53d662
[ "MIT" ]
null
null
null
build.h/util/cli.h
SonnyBonds/build.h
7ff15859d0e779445303b9a8bffb7e2ddf53d662
[ "MIT" ]
null
null
null
#pragma once #include <algorithm> #include <filesystem> #include <iostream> #include <string> #include <stdexcept> #include <utility> #include <variant> #include "core/emitter.h" #include "util/string.h" namespace cli { struct argument_error : public std::runtime_error { argument_error(std::string message) : runtime_error(message) {} }; struct ArgumentDefinition { // Processes the argument argStr and returns true if it was used std::function<bool(std::string_view argStr)> argumentProcessor; std::string example; std::string description; }; namespace detail { template<typename U> std::optional<std::string> grabValue(const std::optional<U>& value) { if(value) { return std::string(*value); } return {}; } std::optional<std::string> grabValue(const std::filesystem::path& value) { return value.string(); } template<typename U> std::optional<std::string> grabValue(const U& value) { return std::string(value); } } template<typename T> ArgumentDefinition stringArgument(std::string trigger, T& value, std::string description) { ArgumentDefinition def; def.example = trigger + "=<value>"; def.description = description; std::optional<std::string> defaultValue = detail::grabValue(value); if(defaultValue) { def.description += " [default: \"" + *defaultValue + "\"]"; } def.argumentProcessor = [trigger, &value](std::string_view argStr) { if(argStr.compare(0, trigger.size(), trigger) != 0) { return false; } if(argStr.size() <= trigger.size()) { throw argument_error("Expected value for option '" + trigger + "'."); } if(argStr[trigger.size()] != '=') { return false; } value = argStr.substr(trigger.size()+1); return true; }; return def; } ArgumentDefinition boolArgument(std::string trigger, bool& value, std::string description) { ArgumentDefinition def; def.example = trigger; def.description = description; def.argumentProcessor = [trigger, &value](std::string_view argStr) { if(argStr == trigger) { value = true; return true; } return false; }; return def; } template<typename T> ArgumentDefinition selectionArgument(std::vector<std::pair<StringId, T>> possibleValues, T& value, std::string description) { ArgumentDefinition def; def.description = description; def.example = "{"; bool first = true; for(auto& valuePair : possibleValues) { if(!first) { def.example += "|"; } first = false; def.example += std::string(valuePair.first); } def.example += "}"; def.argumentProcessor = [possibleValues, &value](std::string_view argStr) { StringId argId(argStr); for(auto valuePair : possibleValues) { if(argId == valuePair.first) { value = valuePair.second; return true; } } return false; }; return def; } void extractArguments(std::vector<std::string>& argumentStrings, const std::vector<ArgumentDefinition>& argumentDefinitions) { auto it = argumentStrings.begin(); while(it != argumentStrings.end()) { auto& argStr = *it; bool found = false; for(auto& def : argumentDefinitions) { if(def.argumentProcessor(argStr)) { found = true; break; } } if(found) { it = argumentStrings.erase(it); } else { ++it; } } } struct Context { Context(std::filesystem::path startPath, std::string invocation, std::vector<std::string> arguments) : startPath(std::move(startPath)) , invocation(std::move(invocation)) , allArguments(std::move(arguments)) { unusedArguments = allArguments; } void addArgumentDescription(const std::string& argument, const std::string& doc, std::string prefix = " ") { usage += prefix + str::padRightToSize(argument, 30) + " " + doc + "\n"; } void addArgumentDescriptions(const std::vector<ArgumentDefinition>& argumentDefinitions, std::string prefix = " ") { bool first = true; for(auto& def : argumentDefinitions) { addArgumentDescription(def.example, def.description, prefix); if(first) { first = false; prefix = std::string(prefix.size(), ' '); } } } void extractArguments(const std::vector<ArgumentDefinition>& argumentDefinitions) { cli::extractArguments(unusedArguments, argumentDefinitions); } const std::filesystem::path startPath; const std::string invocation; const std::vector<std::string> allArguments; std::vector<std::string> unusedArguments; std::string usage; }; }
24.018519
124
0.578065
[ "vector" ]
1678bb6a142886c2ae39a08c8ca5406d0966e3f5
94,220
h
C
src/_IRichTextBoxEvents_CP.h
TimoKunze/RichTextBoxControl
7bc1c30ce836e96cdb085e5fbaa6ccf1734d1e3f
[ "MIT" ]
4
2018-04-23T07:25:15.000Z
2020-12-03T05:52:38.000Z
src/_IRichTextBoxEvents_CP.h
TimoKunze/RichTextBoxControl
7bc1c30ce836e96cdb085e5fbaa6ccf1734d1e3f
[ "MIT" ]
null
null
null
src/_IRichTextBoxEvents_CP.h
TimoKunze/RichTextBoxControl
7bc1c30ce836e96cdb085e5fbaa6ccf1734d1e3f
[ "MIT" ]
2
2019-07-21T11:12:34.000Z
2022-01-31T01:11:45.000Z
////////////////////////////////////////////////////////////////////// /// \class Proxy_IRichTextBoxEvents /// \author Timo "TimoSoft" Kunze /// \brief <em>Fires events specified by the \c _IRichTextBoxEvents interface</em> /// /// \if UNICODE /// \sa RichTextBox, RichTextBoxCtlLibU::_IRichTextBoxEvents /// \else /// \sa RichTextBox, RichTextBoxCtlLibA::_IRichTextBoxEvents /// \endif ////////////////////////////////////////////////////////////////////// #pragma once #include "DispIDs.h" template<class TypeOfTrigger> class Proxy_IRichTextBoxEvents : public IConnectionPointImpl<TypeOfTrigger, &__uuidof(_IRichTextBoxEvents), CComDynamicUnkArray> { public: /// \brief <em>Fires the \c BeginDrag event</em> /// /// \param[in] pTextRange A \c IRichTextRange object wrapping the text that the user wants to drag. /// \param[in] button The pressed mouse buttons. Any combination of the values defined by VB's /// \c MouseButtonConstants enumeration is valid, but usually it should be just /// \c vbLeftButton. /// \param[in] shift The pressed modifier keys (Shift, Ctrl, Alt). Any combination of the values /// defined by VB's \c ShiftConstants enumeration is valid. /// \param[in] x The x-coordinate (in pixels) of the mouse cursor's position relative to the control's /// upper-left corner. /// \param[in] y The y-coordinate (in pixels) of the mouse cursor's position relative to the control's /// upper-left corner. /// \param[in] hitTestDetails The exact part of the control that the mouse cursor's position lies in. /// Some of the values defined by the \c HitTestConstants enumeration are valid. /// /// \return An \c HRESULT error code. /// /// \if UNICODE /// \sa RichTextBoxCtlLibU::_IRichTextBoxEvents::BeginDrag, RichTextBox::Raise_BeginDrag, /// Fire_BeginRDrag /// \else /// \sa RichTextBoxCtlLibA::_IRichTextBoxEvents::BeginDrag, RichTextBox::Raise_BeginDrag, /// Fire_BeginRDrag /// \endif HRESULT Fire_BeginDrag(IRichTextRange* pTextRange, SHORT button, SHORT shift, OLE_XPOS_PIXELS x, OLE_YPOS_PIXELS y, HitTestConstants hitTestDetails) { HRESULT hr = S_OK; // invoke the event for each connection point for(int i = 0; i < m_vec.GetSize(); ++i) { LPDISPATCH pConnection = static_cast<LPDISPATCH>(m_vec.GetAt(i)); if(pConnection) { CComVariant p[6]; p[5] = pTextRange; p[4] = button; p[4].vt = VT_I2; p[3] = shift; p[3].vt = VT_I2; p[2] = x; p[2].vt = VT_XPOS_PIXELS; p[1] = y; p[1].vt = VT_YPOS_PIXELS; p[0].lVal = static_cast<LONG>(hitTestDetails); p[0].vt = VT_I4; // invoke the event DISPPARAMS params = {p, NULL, 6, 0}; hr = pConnection->Invoke(DISPID_RTBE_BEGINDRAG, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &params, NULL, NULL, NULL); } } return hr; } /// \brief <em>Fires the \c BeginRDrag event</em> /// /// \param[in] pTextRange A \c IRichTextRange object wrapping the text that the user wants to drag. /// \param[in] button The pressed mouse buttons. Any combination of the values defined by VB's /// \c MouseButtonConstants enumeration is valid, but usually it should be just /// \c vbRightButton. /// \param[in] shift The pressed modifier keys (Shift, Ctrl, Alt). Any combination of the values /// defined by VB's \c ShiftConstants enumeration is valid. /// \param[in] x The x-coordinate (in pixels) of the mouse cursor's position relative to the control's /// upper-left corner. /// \param[in] y The y-coordinate (in pixels) of the mouse cursor's position relative to the control's /// upper-left corner. /// \param[in] hitTestDetails The exact part of the control that the mouse cursor's position lies in. /// Some of the values defined by the \c HitTestConstants enumeration are valid. /// /// \return An \c HRESULT error code. /// /// \if UNICODE /// \sa RichTextBoxCtlLibU::_IRichTextBoxEvents::BeginRDrag, RichTextBox::Raise_BeginRDrag, /// Fire_BeginDrag /// \else /// \sa RichTextBoxCtlLibA::_IRichTextBoxEvents::BeginRDrag, RichTextBox::Raise_BeginRDrag, /// Fire_BeginDrag /// \endif HRESULT Fire_BeginRDrag(IRichTextRange* pTextRange, SHORT button, SHORT shift, OLE_XPOS_PIXELS x, OLE_YPOS_PIXELS y, HitTestConstants hitTestDetails) { HRESULT hr = S_OK; // invoke the event for each connection point for(int i = 0; i < m_vec.GetSize(); ++i) { LPDISPATCH pConnection = static_cast<LPDISPATCH>(m_vec.GetAt(i)); if(pConnection) { CComVariant p[6]; p[5] = pTextRange; p[4] = button; p[4].vt = VT_I2; p[3] = shift; p[3].vt = VT_I2; p[2] = x; p[2].vt = VT_XPOS_PIXELS; p[1] = y; p[1].vt = VT_YPOS_PIXELS; p[0].lVal = static_cast<LONG>(hitTestDetails); p[0].vt = VT_I4; // invoke the event DISPPARAMS params = {p, NULL, 6, 0}; hr = pConnection->Invoke(DISPID_RTBE_BEGINRDRAG, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &params, NULL, NULL, NULL); } } return hr; } /// \brief <em>Fires the \c Click event</em> /// /// \param[in] pTextRange A \c IRichTextRange object wrapping the clicked text. /// \param[in] button The mouse buttons that were pressed during the click. This should always be /// \c vbLeftButton (defined by VB's \c MouseButtonConstants enumeration). /// \param[in] shift The modifier keys (Shift, Ctrl, Alt) that were pressed during the click. Any /// combination of the values defined by VB's \c ShiftConstants enumeration is valid. /// \param[in] x The x-coordinate (in pixels) of the click's position relative to the control's /// upper-left corner. /// \param[in] y The y-coordinate (in pixels) of the click's position relative to the control's /// upper-left corner. /// \param[in] hitTestDetails The part of the control that was clicked. Any of the values defined /// by the \c HitTestConstants enumeration is valid. /// /// \return An \c HRESULT error code. /// /// \if UNICODE /// \sa RichTextBoxCtlLibU::_IRichTextBoxEvents::Click, RichTextBox::Raise_Click, Fire_DblClick, /// Fire_MClick, Fire_RClick, Fire_XClick /// \else /// \sa RichTextBoxCtlLibA::_IRichTextBoxEvents::Click, RichTextBox::Raise_Click, Fire_DblClick, /// Fire_MClick, Fire_RClick, Fire_XClick /// \endif HRESULT Fire_Click(IRichTextRange* pTextRange, SHORT button, SHORT shift, OLE_XPOS_PIXELS x, OLE_YPOS_PIXELS y, HitTestConstants hitTestDetails) { HRESULT hr = S_OK; // invoke the event for each connection point for(int i = 0; i < m_vec.GetSize(); ++i) { LPDISPATCH pConnection = static_cast<LPDISPATCH>(m_vec.GetAt(i)); if(pConnection) { CComVariant p[6]; p[5] = pTextRange; p[4] = button; p[4].vt = VT_I2; p[3] = shift; p[3].vt = VT_I2; p[2] = x; p[2].vt = VT_XPOS_PIXELS; p[1] = y; p[1].vt = VT_YPOS_PIXELS; p[0].lVal = static_cast<LONG>(hitTestDetails); p[0].vt = VT_I4; // invoke the event DISPPARAMS params = {p, NULL, 6, 0}; hr = pConnection->Invoke(DISPID_RTBE_CLICK, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &params, NULL, NULL, NULL); } } return hr; } /// \brief <em>Fires the \c ContextMenu event</em> /// /// \param[in] menuType Specifies which kind of menu is being requested. Some combinations of the values /// defined by the \c MenuTypeConstants enumeration are valid. /// \param[in] pTextRange A \c IRichTextRange object wrapping the selected text. /// \param[in] selectionType Specifies what kind of data the current selection contains. Any combination /// of the values defined by the \c SelectionTypeConstants enumeration is valid. /// \param[in] pOLEObject A \c IRichOLEObject object wrapping the (first) embedded OLE object within /// the current selection. May be \c NULL. /// \param[in] button The pressed mouse buttons. Any combination of the values defined by VB's /// \c MouseButtonConstants enumeration is valid. /// \param[in] shift The pressed modifier keys (Shift, Ctrl, Alt). Any combination of the values /// defined by VB's \c ShiftConstants enumeration is valid. /// \param[in] x The x-coordinate (in pixels) of the menu's proposed position relative to the control's /// upper-left corner. /// \param[in] y The y-coordinate (in pixels) of the menu's proposed position relative to the control's /// upper-left corner. /// \param[in] hitTestDetails The part of the control that the menu's proposed position lies in. /// Any of the values defined by the \c HitTestConstants enumeration is valid. /// \param[in] isRightMouseDrop If \c VARIANT_TRUE, the context menu for a drag'n'drop operation with the /// right mouse button should be generated. If \c VARIANT_FALSE, the context menu request has /// been triggered by a normal right click or by pressing the context menu key (or /// [SHIFT]+[F10]) on the keyboard. /// \param[in] pDraggedData A \c IOLEDataObject object that holds the dragged data. May be \c NULL. /// \param[in,out] pHMenuToDisplay Receives the handle of the context menu to display. The menu will /// be destroyed by the control after use. /// /// \return An \c HRESULT error code. /// /// \if UNICODE /// \sa RichTextBoxCtlLibU::_IRichTextBoxEvents::ContextMenu, RichTextBox::Raise_ContextMenu, /// Fire_RClick /// \else /// \sa RichTextBoxCtlLibA::_IRichTextBoxEvents::ContextMenu, RichTextBox::Raise_ContextMenu, /// Fire_RClick /// \endif HRESULT Fire_ContextMenu(MenuTypeConstants menuType, IRichTextRange* pTextRange, SelectionTypeConstants selectionType, IRichOLEObject* pOLEObject, SHORT button, SHORT shift, OLE_XPOS_PIXELS x, OLE_YPOS_PIXELS y, HitTestConstants hitTestDetails, VARIANT_BOOL isRightMouseDrop, IOLEDataObject* pDraggedData, OLE_HANDLE* pHMenuToDisplay) { HRESULT hr = S_OK; // invoke the event for each connection point for(int i = 0; i < m_vec.GetSize(); ++i) { LPDISPATCH pConnection = static_cast<LPDISPATCH>(m_vec.GetAt(i)); if(pConnection) { CComVariant p[12]; p[11].lVal = static_cast<LONG>(menuType); p[11].vt = VT_I4; p[10] = pTextRange; p[9].lVal = static_cast<LONG>(selectionType); p[9].vt = VT_I4; p[8] = pOLEObject; p[7] = button; p[7].vt = VT_I2; p[6] = shift; p[6].vt = VT_I2; p[5] = x; p[5].vt = VT_XPOS_PIXELS; p[4] = y; p[4].vt = VT_YPOS_PIXELS; p[3].lVal = static_cast<LONG>(hitTestDetails); p[3].vt = VT_I4; p[2] = isRightMouseDrop; p[1] = pDraggedData; p[0].plVal = reinterpret_cast<PLONG>(pHMenuToDisplay); p[0].vt = VT_I4 | VT_BYREF; // invoke the event DISPPARAMS params = {p, NULL, 12, 0}; hr = pConnection->Invoke(DISPID_RTBE_CONTEXTMENU, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &params, NULL, NULL, NULL); } } return hr; } /// \brief <em>Fires the \c DblClick event</em> /// /// \param[in] pTextRange A \c IRichTextRange object wrapping the double-clicked text. /// \param[in] button The mouse buttons that were pressed during the double-click. This should /// always be \c vbLeftButton (defined by VB's \c MouseButtonConstants enumeration). /// \param[in] shift The modifier keys (Shift, Ctrl, Alt) that were pressed during the double-click. /// Any combination of the values defined by VB's \c ShiftConstants enumeration is valid. /// \param[in] x The x-coordinate (in pixels) of the double-click's position relative to the control's /// upper-left corner. /// \param[in] y The y-coordinate (in pixels) of the double-click's position relative to the control's /// upper-left corner. /// \param[in] hitTestDetails The part of the control that was double-clicked. Any of the values defined /// by the \c HitTestConstants enumeration is valid. /// /// \return An \c HRESULT error code. /// /// \if UNICODE /// \sa RichTextBoxCtlLibU::_IRichTextBoxEvents::DblClick, RichTextBox::Raise_DblClick, Fire_Click, /// Fire_MDblClick, Fire_RDblClick, Fire_XDblClick /// \else /// \sa RichTextBoxCtlLibA::_IRichTextBoxEvents::DblClick, RichTextBox::Raise_DblClick, Fire_Click, /// Fire_MDblClick, Fire_RDblClick, Fire_XDblClick /// \endif HRESULT Fire_DblClick(IRichTextRange* pTextRange, SHORT button, SHORT shift, OLE_XPOS_PIXELS x, OLE_YPOS_PIXELS y, HitTestConstants hitTestDetails) { HRESULT hr = S_OK; // invoke the event for each connection point for(int i = 0; i < m_vec.GetSize(); ++i) { LPDISPATCH pConnection = static_cast<LPDISPATCH>(m_vec.GetAt(i)); if(pConnection) { CComVariant p[6]; p[5] = pTextRange; p[4] = button; p[4].vt = VT_I2; p[3] = shift; p[3].vt = VT_I2; p[2] = x; p[2].vt = VT_XPOS_PIXELS; p[1] = y; p[1].vt = VT_YPOS_PIXELS; p[0].lVal = static_cast<LONG>(hitTestDetails); p[0].vt = VT_I4; // invoke the event DISPPARAMS params = {p, NULL, 6, 0}; hr = pConnection->Invoke(DISPID_RTBE_DBLCLICK, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &params, NULL, NULL, NULL); } } return hr; } /// \brief <em>Fires the \c DestroyedControlWindow event</em> /// /// \param[in] hWnd The control's window handle. /// /// \return An \c HRESULT error code. /// /// \if UNICODE /// \sa RichTextBoxCtlLibU::_IRichTextBoxEvents::DestroyedControlWindow, /// RichTextBox::Raise_DestroyedControlWindow, Fire_RecreatedControlWindow /// \else /// \sa RichTextBoxCtlLibA::_IRichTextBoxEvents::DestroyedControlWindow, /// RichTextBox::Raise_DestroyedControlWindow, Fire_RecreatedControlWindow /// \endif HRESULT Fire_DestroyedControlWindow(LONG hWnd) { HRESULT hr = S_OK; // invoke the event for each connection point for(int i = 0; i < m_vec.GetSize(); ++i) { LPDISPATCH pConnection = static_cast<LPDISPATCH>(m_vec.GetAt(i)); if(pConnection) { CComVariant p[1]; p[0] = hWnd; // invoke the event DISPPARAMS params = {p, NULL, 1, 0}; hr = pConnection->Invoke(DISPID_RTBE_DESTROYEDCONTROLWINDOW, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &params, NULL, NULL, NULL); } } return hr; } /// \brief <em>Fires the \c DragDropDone event</em> /// /// \return An \c HRESULT error code. /// /// \if UNICODE /// \sa RichTextBoxCtlLibU::_IRichTextBoxEvents::DragDropDone, RichTextBox::Raise_DragDropDone, /// Fire_OLECompleteDrag /// \else /// \sa RichTextBoxCtlLibA::_IRichTextBoxEvents::DragDropDone, RichTextBox::Raise_DragDropDone, /// Fire_OLECompleteDrag /// \endif HRESULT Fire_DragDropDone(void) { HRESULT hr = S_OK; // invoke the event for each connection point for(int i = 0; i < m_vec.GetSize(); ++i) { LPDISPATCH pConnection = static_cast<LPDISPATCH>(m_vec.GetAt(i)); if(pConnection) { // invoke the event DISPPARAMS params = {NULL, NULL, 0, 0}; hr = pConnection->Invoke(DISPID_RTBE_DRAGDROPDONE, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &params, NULL, NULL, NULL); } } return hr; } /// \brief <em>Fires the \c GetDataObject event</em> /// /// \param[in] pTextRange A \c IRichTextRange object wrapping the text that the operation is performed /// on. /// \param[in] operationType Specifies the kind of operation that will take place. Some of the values /// defined by the \c ClipboardOperationTypeConstants enumeration is valid. /// \param[in,out] ppDataObject The instance of \c IDataObject that is used to transfer data during the /// operation. The client application may set this value to a custom object that /// implements \c IDataObject. /// \param[in,out] pUseCustomDataObject Must be set to \c VARIANT_TRUE by the client application, if the /// data object has been replaced with a custom implementation. /// /// \return An \c HRESULT error code. /// /// \if UNICODE /// \sa RichTextBoxCtlLibU::_IRichTextBoxEvents::GetDataObject, RichTextBox::Raise_GetDataObject /// \else /// \sa RichTextBoxCtlLibA::_IRichTextBoxEvents::GetDataObject, RichTextBox::Raise_GetDataObject /// \endif HRESULT Fire_GetDataObject(IRichTextRange* pTextRange, ClipboardOperationTypeConstants operationType, LONG* ppDataObject, VARIANT_BOOL* pUseCustomDataObject) { HRESULT hr = S_OK; // invoke the event for each connection point for(int i = 0; i < m_vec.GetSize(); ++i) { LPDISPATCH pConnection = static_cast<LPDISPATCH>(m_vec.GetAt(i)); if(pConnection) { CComVariant p[4]; p[3] = pTextRange; p[2] = static_cast<LONG>(operationType); p[2].vt = VT_I4; p[1].plVal = ppDataObject; p[1].vt = VT_I4 | VT_BYREF; p[0].pboolVal = pUseCustomDataObject; p[0].vt = VT_BOOL | VT_BYREF; // invoke the event DISPPARAMS params = {p, NULL, 4, 0}; hr = pConnection->Invoke(DISPID_RTBE_GETDATAOBJECT, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &params, NULL, NULL, NULL); } } return hr; } /// \brief <em>Fires the \c GetDragDropEffect event</em> /// /// \param[in] getSourceEffects If \c VARIANT_TRUE, the event is raised to determine the effects allowed /// by the drag source. Otherwise it is raised to determine the effects allowed by the drop /// target. /// \param[in] button The pressed mouse buttons. Any combination of the values defined by VB's /// \c MouseButtonConstants enumeration is valid. /// \param[in] shift The pressed modifier keys (Shift, Ctrl, Alt). Any combination of the values /// defined by VB's \c ShiftConstants enumeration is valid. /// \param[in,out] pEffect On entry, a bit field of the drop effects (defined by the /// \c OLEDropEffectConstants enumeration) supported by the drag source. On return, /// the drop effect that the client wants to be used on drop. /// \param[in,out] pSkipDefaultProcessing Must be set to \c VARIANT_TRUE to prevent the native rich edit /// control chose an effect on its own. /// /// \return An \c HRESULT error code. /// /// \if UNICODE /// \sa RichTextBoxCtlLibU::_IRichTextBoxEvents::GetDragDropEffect, /// RichTextBox::Raise_GetDragDropEffect, Fire_OLEDragEnter, Fire_OLEDragMouseMove, /// Fire_OLEDragDrop /// \else /// \sa RichTextBoxCtlLibA::_IRichTextBoxEvents::GetDragDropEffect, /// RichTextBox::Raise_GetDragDropEffect, Fire_OLEDragEnter, Fire_OLEDragMouseMove, /// Fire_OLEDragDrop /// \endif HRESULT Fire_GetDragDropEffect(VARIANT_BOOL getSourceEffects, SHORT button, SHORT shift, OLEDropEffectConstants* pEffect, VARIANT_BOOL* pSkipDefaultProcessing) { HRESULT hr = S_OK; // invoke the event for each connection point for(int i = 0; i < m_vec.GetSize(); ++i) { LPDISPATCH pConnection = static_cast<LPDISPATCH>(m_vec.GetAt(i)); if(pConnection) { CComVariant p[5]; p[4] = getSourceEffects; p[3] = button; p[3].vt = VT_I2; p[2] = shift; p[2].vt = VT_I2; p[1].plVal = reinterpret_cast<LONG*>(pEffect); p[1].vt = VT_I4 | VT_BYREF; p[0].pboolVal = pSkipDefaultProcessing; p[0].vt = VT_BOOL | VT_BYREF; // invoke the event DISPPARAMS params = {p, NULL, 5, 0}; hr = pConnection->Invoke(DISPID_RTBE_GETDRAGDROPEFFECT, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &params, NULL, NULL, NULL); } } return hr; } /// \brief <em>Fires the \c InsertingOLEObject event</em> /// /// \param[in] pTextRange The insertion position at which the new object is about to be inserted. /// \param[in,out] pClassID The class identifier (\c CLSID) of the object that is about to be inserted. /// \param[in] pStorage The \c IStorage object holding the object data. /// \param[in,out] pCancelInsertion If \c VARIANT_TRUE, the caller should abort insertion; otherwise /// not. /// /// \return An \c HRESULT error code. /// /// \if UNICODE /// \sa RichTextBoxCtlLibU::_IRichTextBoxEvents::InsertingOLEObject, /// RichTextBox::Raise_InsertingOLEObject, Fire_RemovingOLEObject /// \else /// \sa RichTextBoxCtlLibA::_IRichTextBoxEvents::InsertingOLEObject, /// RichTextBox::Raise_InsertingOLEObject, Fire_RemovingOLEObject /// \endif HRESULT Fire_InsertingOLEObject(IRichTextRange* pTextRange, BSTR* pClassID, LONG pStorage, VARIANT_BOOL* pCancelInsertion) { HRESULT hr = S_OK; // invoke the event for each connection point for(int i = 0; i < m_vec.GetSize(); ++i) { LPDISPATCH pConnection = static_cast<LPDISPATCH>(m_vec.GetAt(i)); if(pConnection) { CComVariant p[4]; p[3] = pTextRange; p[2].pbstrVal = pClassID; p[2].vt = VT_BSTR | VT_BYREF; p[1] = pStorage; p[0].pboolVal = pCancelInsertion; p[0].vt = VT_BOOL | VT_BYREF; // invoke the event DISPPARAMS params = {p, NULL, 4, 0}; hr = pConnection->Invoke(DISPID_RTBE_INSERTINGOLEOBJECT, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &params, NULL, NULL, NULL); } } return hr; } /// \brief <em>Fires the \c KeyDown event</em> /// /// \param[in,out] pKeyCode The pressed key. Any of the values defined by VB's \c KeyCodeConstants /// enumeration is valid. If set to 0, the caller should eat the \c WM_KEYDOWN message. /// \param[in] shift The pressed modifier keys (Shift, Ctrl, Alt). Any combination of the values /// defined by VB's \c ShiftConstants enumeration is valid. /// /// \return An \c HRESULT error code. /// /// \if UNICODE /// \sa RichTextBoxCtlLibU::_IRichTextBoxEvents::KeyDown, RichTextBox::Raise_KeyDown, Fire_KeyUp, /// Fire_KeyPress /// \else /// \sa RichTextBoxCtlLibA::_IRichTextBoxEvents::KeyDown, RichTextBox::Raise_KeyDown, Fire_KeyUp, /// Fire_KeyPress /// \endif HRESULT Fire_KeyDown(SHORT* pKeyCode, SHORT shift) { HRESULT hr = S_OK; // invoke the event for each connection point for(int i = 0; i < m_vec.GetSize(); ++i) { LPDISPATCH pConnection = static_cast<LPDISPATCH>(m_vec.GetAt(i)); if(pConnection) { CComVariant p[2]; p[1].piVal = pKeyCode; p[1].vt = VT_I2 | VT_BYREF; p[0] = shift; p[0].vt = VT_I2; // invoke the event DISPPARAMS params = {p, NULL, 2, 0}; hr = pConnection->Invoke(DISPID_RTBE_KEYDOWN, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &params, NULL, NULL, NULL); } } return hr; } /// \brief <em>Fires the \c KeyPress event</em> /// /// \param[in,out] pKeyAscii The pressed key's ASCII code. If set to 0, the caller should eat the /// \c WM_CHAR message. /// /// \return An \c HRESULT error code. /// /// \if UNICODE /// \sa RichTextBoxCtlLibU::_IRichTextBoxEvents::KeyPress, RichTextBox::Raise_KeyPress, Fire_KeyDown, /// Fire_KeyUp /// \else /// \sa RichTextBoxCtlLibA::_IRichTextBoxEvents::KeyPress, RichTextBox::Raise_KeyPress, Fire_KeyDown, /// Fire_KeyUp /// \endif HRESULT Fire_KeyPress(SHORT* pKeyAscii) { HRESULT hr = S_OK; // invoke the event for each connection point for(int i = 0; i < m_vec.GetSize(); ++i) { LPDISPATCH pConnection = static_cast<LPDISPATCH>(m_vec.GetAt(i)); if(pConnection) { CComVariant p[1]; p[0].piVal = pKeyAscii; p[0].vt = VT_I2 | VT_BYREF; // invoke the event DISPPARAMS params = {p, NULL, 1, 0}; hr = pConnection->Invoke(DISPID_RTBE_KEYPRESS, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &params, NULL, NULL, NULL); } } return hr; } /// \brief <em>Fires the \c KeyUp event</em> /// /// \param[in,out] pKeyCode The released key. Any of the values defined by VB's \c KeyCodeConstants /// enumeration is valid. If set to 0, the caller should eat the \c WM_KEYUP message. /// \param[in] shift The pressed modifier keys (Shift, Ctrl, Alt). Any combination of the values /// defined by VB's \c ShiftConstants enumeration is valid. /// /// \return An \c HRESULT error code. /// /// \if UNICODE /// \sa RichTextBoxCtlLibU::_IRichTextBoxEvents::KeyUp, RichTextBox::Raise_KeyUp, Fire_KeyDown, /// Fire_KeyPress /// \else /// \sa RichTextBoxCtlLibA::_IRichTextBoxEvents::KeyUp, RichTextBox::Raise_KeyUp, Fire_KeyDown, /// Fire_KeyPress /// \endif HRESULT Fire_KeyUp(SHORT* pKeyCode, SHORT shift) { HRESULT hr = S_OK; // invoke the event for each connection point for(int i = 0; i < m_vec.GetSize(); ++i) { LPDISPATCH pConnection = static_cast<LPDISPATCH>(m_vec.GetAt(i)); if(pConnection) { CComVariant p[2]; p[1].piVal = pKeyCode; p[1].vt = VT_I2 | VT_BYREF; p[0] = shift; p[0].vt = VT_I2; // invoke the event DISPPARAMS params = {p, NULL, 2, 0}; hr = pConnection->Invoke(DISPID_RTBE_KEYUP, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &params, NULL, NULL, NULL); } } return hr; } /// \brief <em>Fires the \c MClick event</em> /// /// \param[in] pTextRange A \c IRichTextRange object wrapping the clicked text. /// \param[in] button The mouse buttons that were pressed during the click. This should always be /// \c vbMiddleButton (defined by VB's \c MouseButtonConstants enumeration). /// \param[in] shift The modifier keys (Shift, Ctrl, Alt) that were pressed during the click. Any /// combination of the values defined by VB's \c ShiftConstants enumeration is valid. /// \param[in] x The x-coordinate (in pixels) of the click's position relative to the control's /// upper-left corner. /// \param[in] y The y-coordinate (in pixels) of the click's position relative to the control's /// upper-left corner. /// \param[in] hitTestDetails The part of the control that was clicked. Any of the values defined /// by the \c HitTestConstants enumeration is valid. /// /// \return An \c HRESULT error code. /// /// \if UNICODE /// \sa RichTextBoxCtlLibU::_IRichTextBoxEvents::MClick, RichTextBox::Raise_MClick, Fire_MDblClick, /// Fire_Click, Fire_RClick, Fire_XClick /// \else /// \sa RichTextBoxCtlLibA::_IRichTextBoxEvents::MClick, RichTextBox::Raise_MClick, Fire_MDblClick, /// Fire_Click, Fire_RClick, Fire_XClick /// \endif HRESULT Fire_MClick(IRichTextRange* pTextRange, SHORT button, SHORT shift, OLE_XPOS_PIXELS x, OLE_YPOS_PIXELS y, HitTestConstants hitTestDetails) { HRESULT hr = S_OK; // invoke the event for each connection point for(int i = 0; i < m_vec.GetSize(); ++i) { LPDISPATCH pConnection = static_cast<LPDISPATCH>(m_vec.GetAt(i)); if(pConnection) { CComVariant p[6]; p[5] = pTextRange; p[4] = button; p[4].vt = VT_I2; p[3] = shift; p[3].vt = VT_I2; p[2] = x; p[2].vt = VT_XPOS_PIXELS; p[1] = y; p[1].vt = VT_YPOS_PIXELS; p[0].lVal = static_cast<LONG>(hitTestDetails); p[0].vt = VT_I4; // invoke the event DISPPARAMS params = {p, NULL, 6, 0}; hr = pConnection->Invoke(DISPID_RTBE_MCLICK, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &params, NULL, NULL, NULL); } } return hr; } /// \brief <em>Fires the \c MDblClick event</em> /// /// \param[in] pTextRange A \c IRichTextRange object wrapping the double-clicked text. /// \param[in] button The mouse buttons that were pressed during the double-click. This should /// always be \c vbMiddleButton (defined by VB's \c MouseButtonConstants enumeration). /// \param[in] shift The modifier keys (Shift, Ctrl, Alt) that were pressed during the double-click. /// Any combination of the values defined by VB's \c ShiftConstants enumeration is valid. /// \param[in] x The x-coordinate (in pixels) of the double-click's position relative to the control's /// upper-left corner. /// \param[in] y The y-coordinate (in pixels) of the double-click's position relative to the control's /// upper-left corner. /// \param[in] hitTestDetails The part of the control that was double-clicked. Any of the values defined /// by the \c HitTestConstants enumeration is valid. /// /// \return An \c HRESULT error code. /// /// \if UNICODE /// \sa RichTextBoxCtlLibU::_IRichTextBoxEvents::MDblClick, RichTextBox::Raise_MDblClick, Fire_MClick, /// Fire_DblClick, Fire_RDblClick, Fire_XDblClick /// \else /// \sa RichTextBoxCtlLibA::_IRichTextBoxEvents::MDblClick, RichTextBox::Raise_MDblClick, Fire_MClick, /// Fire_DblClick, Fire_RDblClick, Fire_XDblClick /// \endif HRESULT Fire_MDblClick(IRichTextRange* pTextRange, SHORT button, SHORT shift, OLE_XPOS_PIXELS x, OLE_YPOS_PIXELS y, HitTestConstants hitTestDetails) { HRESULT hr = S_OK; // invoke the event for each connection point for(int i = 0; i < m_vec.GetSize(); ++i) { LPDISPATCH pConnection = static_cast<LPDISPATCH>(m_vec.GetAt(i)); if(pConnection) { CComVariant p[6]; p[5] = pTextRange; p[4] = button; p[4].vt = VT_I2; p[3] = shift; p[3].vt = VT_I2; p[2] = x; p[2].vt = VT_XPOS_PIXELS; p[1] = y; p[1].vt = VT_YPOS_PIXELS; p[0].lVal = static_cast<LONG>(hitTestDetails); p[0].vt = VT_I4; // invoke the event DISPPARAMS params = {p, NULL, 6, 0}; hr = pConnection->Invoke(DISPID_RTBE_MDBLCLICK, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &params, NULL, NULL, NULL); } } return hr; } /// \brief <em>Fires the \c MouseDown event</em> /// /// \param[in] pTextRange A \c IRichTextRange object wrapping the text that the mouse cursor is located /// over. /// \param[in] button The pressed mouse button. Any of the values defined by VB's /// \c MouseButtonConstants enumeration or the \c ExtendedMouseButtonConstants enumeration /// is valid. /// \param[in] shift The pressed modifier keys (Shift, Ctrl, Alt). Any combination of the values /// defined by VB's \c ShiftConstants enumeration is valid. /// \param[in] x The x-coordinate (in pixels) of the mouse cursor's position relative to the control's /// upper-left corner. /// \param[in] y The y-coordinate (in pixels) of the mouse cursor's position relative to the control's /// upper-left corner. /// \param[in] hitTestDetails The exact part of the control that the mouse cursor's position lies in. /// Any of the values defined by the \c HitTestConstants enumeration is valid. /// /// \return An \c HRESULT error code. /// /// \if UNICODE /// \sa RichTextBoxCtlLibU::_IRichTextBoxEvents::MouseDown, RichTextBox::Raise_MouseDown, Fire_MouseUp, /// Fire_Click, Fire_MClick, Fire_RClick, Fire_XClick /// \else /// \sa RichTextBoxCtlLibA::_IRichTextBoxEvents::MouseDown, RichTextBox::Raise_MouseDown, Fire_MouseUp, /// Fire_Click, Fire_MClick, Fire_RClick, Fire_XClick /// \endif HRESULT Fire_MouseDown(IRichTextRange* pTextRange, SHORT button, SHORT shift, OLE_XPOS_PIXELS x, OLE_YPOS_PIXELS y, HitTestConstants hitTestDetails) { HRESULT hr = S_OK; // invoke the event for each connection point for(int i = 0; i < m_vec.GetSize(); ++i) { LPDISPATCH pConnection = static_cast<LPDISPATCH>(m_vec.GetAt(i)); if(pConnection) { CComVariant p[6]; p[5] = pTextRange; p[4] = button; p[4].vt = VT_I2; p[3] = shift; p[3].vt = VT_I2; p[2] = x; p[2].vt = VT_XPOS_PIXELS; p[1] = y; p[1].vt = VT_YPOS_PIXELS; p[0].lVal = static_cast<LONG>(hitTestDetails); p[0].vt = VT_I4; // invoke the event DISPPARAMS params = {p, NULL, 6, 0}; hr = pConnection->Invoke(DISPID_RTBE_MOUSEDOWN, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &params, NULL, NULL, NULL); } } return hr; } /// \brief <em>Fires the \c MouseEnter event</em> /// /// \param[in] pTextRange A \c IRichTextRange object wrapping the text that the mouse cursor is located /// over. /// \param[in] button The pressed mouse buttons. Any combination of the values defined by VB's /// \c MouseButtonConstants enumeration or the \c ExtendedMouseButtonConstants enumeration /// is valid. /// \param[in] shift The pressed modifier keys (Shift, Ctrl, Alt). Any combination of the values /// defined by VB's \c ShiftConstants enumeration is valid. /// \param[in] x The x-coordinate (in pixels) of the mouse cursor's position relative to the control's /// upper-left corner. /// \param[in] y The y-coordinate (in pixels) of the mouse cursor's position relative to the control's /// upper-left corner. /// \param[in] hitTestDetails The exact part of the control that the mouse cursor's position lies in. /// Any of the values defined by the \c HitTestConstants enumeration is valid. /// /// \return An \c HRESULT error code. /// /// \if UNICODE /// \sa RichTextBoxCtlLibU::_IRichTextBoxEvents::MouseEnter, RichTextBox::Raise_MouseEnter, /// Fire_MouseLeave, Fire_MouseHover, Fire_MouseMove /// \else /// \sa RichTextBoxCtlLibA::_IRichTextBoxEvents::MouseEnter, RichTextBox::Raise_MouseEnter, /// Fire_MouseLeave, Fire_MouseHover, Fire_MouseMove /// \endif HRESULT Fire_MouseEnter(IRichTextRange* pTextRange, SHORT button, SHORT shift, OLE_XPOS_PIXELS x, OLE_YPOS_PIXELS y, HitTestConstants hitTestDetails) { HRESULT hr = S_OK; // invoke the event for each connection point for(int i = 0; i < m_vec.GetSize(); ++i) { LPDISPATCH pConnection = static_cast<LPDISPATCH>(m_vec.GetAt(i)); if(pConnection) { CComVariant p[6]; p[5] = pTextRange; p[4] = button; p[4].vt = VT_I2; p[3] = shift; p[3].vt = VT_I2; p[2] = x; p[2].vt = VT_XPOS_PIXELS; p[1] = y; p[1].vt = VT_YPOS_PIXELS; p[0].lVal = static_cast<LONG>(hitTestDetails); p[0].vt = VT_I4; // invoke the event DISPPARAMS params = {p, NULL, 6, 0}; hr = pConnection->Invoke(DISPID_RTBE_MOUSEENTER, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &params, NULL, NULL, NULL); } } return hr; } /// \brief <em>Fires the \c MouseHover event</em> /// /// \param[in] pTextRange A \c IRichTextRange object wrapping the text that the mouse cursor is located /// over. /// \param[in] button The pressed mouse buttons. Any combination of the values defined by VB's /// \c MouseButtonConstants enumeration or the \c ExtendedMouseButtonConstants enumeration /// is valid. /// \param[in] shift The pressed modifier keys (Shift, Ctrl, Alt). Any combination of the values /// defined by VB's \c ShiftConstants enumeration is valid. /// \param[in] x The x-coordinate (in pixels) of the mouse cursor's position relative to the control's /// upper-left corner. /// \param[in] y The y-coordinate (in pixels) of the mouse cursor's position relative to the control's /// upper-left corner. /// \param[in] hitTestDetails The exact part of the control that the mouse cursor's position lies in. /// Any of the values defined by the \c HitTestConstants enumeration is valid. /// /// \return An \c HRESULT error code. /// /// \if UNICODE /// \sa RichTextBoxCtlLibU::_IRichTextBoxEvents::MouseHover, RichTextBox::Raise_MouseHover, /// Fire_MouseEnter, Fire_MouseLeave, Fire_MouseMove /// \else /// \sa RichTextBoxCtlLibA::_IRichTextBoxEvents::MouseHover, RichTextBox::Raise_MouseHover, /// Fire_MouseEnter, Fire_MouseLeave, Fire_MouseMove /// \endif HRESULT Fire_MouseHover(IRichTextRange* pTextRange, SHORT button, SHORT shift, OLE_XPOS_PIXELS x, OLE_YPOS_PIXELS y, HitTestConstants hitTestDetails) { HRESULT hr = S_OK; // invoke the event for each connection point for(int i = 0; i < m_vec.GetSize(); ++i) { LPDISPATCH pConnection = static_cast<LPDISPATCH>(m_vec.GetAt(i)); if(pConnection) { CComVariant p[6]; p[5] = pTextRange; p[4] = button; p[4].vt = VT_I2; p[3] = shift; p[3].vt = VT_I2; p[2] = x; p[2].vt = VT_XPOS_PIXELS; p[1] = y; p[1].vt = VT_YPOS_PIXELS; p[0].lVal = static_cast<LONG>(hitTestDetails); p[0].vt = VT_I4; // invoke the event DISPPARAMS params = {p, NULL, 6, 0}; hr = pConnection->Invoke(DISPID_RTBE_MOUSEHOVER, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &params, NULL, NULL, NULL); } } return hr; } /// \brief <em>Fires the \c MouseLeave event</em> /// /// \param[in] pTextRange A \c IRichTextRange object wrapping the text that the mouse cursor is located /// over. /// \param[in] button The pressed mouse buttons. Any combination of the values defined by VB's /// \c MouseButtonConstants enumeration or the \c ExtendedMouseButtonConstants enumeration /// is valid. /// \param[in] shift The pressed modifier keys (Shift, Ctrl, Alt). Any combination of the values /// defined by VB's \c ShiftConstants enumeration is valid. /// \param[in] x The x-coordinate (in pixels) of the mouse cursor's position relative to the control's /// upper-left corner. /// \param[in] y The y-coordinate (in pixels) of the mouse cursor's position relative to the control's /// upper-left corner. /// \param[in] hitTestDetails The exact part of the control that the mouse cursor's position lies in. /// Any of the values defined by the \c HitTestConstants enumeration is valid. /// /// \return An \c HRESULT error code. /// /// \if UNICODE /// \sa RichTextBoxCtlLibU::_IRichTextBoxEvents::MouseLeave, RichTextBox::Raise_MouseLeave, /// Fire_MouseEnter, Fire_MouseHover, Fire_MouseMove /// \else /// \sa RichTextBoxCtlLibA::_IRichTextBoxEvents::MouseLeave, RichTextBox::Raise_MouseLeave, /// Fire_MouseEnter, Fire_MouseHover, Fire_MouseMove /// \endif HRESULT Fire_MouseLeave(IRichTextRange* pTextRange, SHORT button, SHORT shift, OLE_XPOS_PIXELS x, OLE_YPOS_PIXELS y, HitTestConstants hitTestDetails) { HRESULT hr = S_OK; // invoke the event for each connection point for(int i = 0; i < m_vec.GetSize(); ++i) { LPDISPATCH pConnection = static_cast<LPDISPATCH>(m_vec.GetAt(i)); if(pConnection) { CComVariant p[6]; p[5] = pTextRange; p[4] = button; p[4].vt = VT_I2; p[3] = shift; p[3].vt = VT_I2; p[2] = x; p[2].vt = VT_XPOS_PIXELS; p[1] = y; p[1].vt = VT_YPOS_PIXELS; p[0].lVal = static_cast<LONG>(hitTestDetails); p[0].vt = VT_I4; // invoke the event DISPPARAMS params = {p, NULL, 6, 0}; hr = pConnection->Invoke(DISPID_RTBE_MOUSELEAVE, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &params, NULL, NULL, NULL); } } return hr; } /// \brief <em>Fires the \c MouseMove event</em> /// /// \param[in] pTextRange A \c IRichTextRange object wrapping the text that the mouse cursor is located /// over. /// \param[in] button The pressed mouse buttons. Any combination of the values defined by VB's /// \c MouseButtonConstants enumeration or the \c ExtendedMouseButtonConstants enumeration /// is valid. /// \param[in] shift The pressed modifier keys (Shift, Ctrl, Alt). Any combination of the values /// defined by VB's \c ShiftConstants enumeration is valid. /// \param[in] x The x-coordinate (in pixels) of the mouse cursor's position relative to the control's /// upper-left corner. /// \param[in] y The y-coordinate (in pixels) of the mouse cursor's position relative to the control's /// upper-left corner. /// \param[in] hitTestDetails The exact part of the control that the mouse cursor's position lies in. /// Any of the values defined by the \c HitTestConstants enumeration is valid. /// /// \return An \c HRESULT error code. /// /// \if UNICODE /// \sa RichTextBoxCtlLibU::_IRichTextBoxEvents::MouseMove, RichTextBox::Raise_MouseMove, /// Fire_MouseEnter, Fire_MouseLeave, Fire_MouseDown, Fire_MouseUp, Fire_MouseWheel /// \else /// \sa RichTextBoxCtlLibA::_IRichTextBoxEvents::MouseMove, RichTextBox::Raise_MouseMove, /// Fire_MouseEnter, Fire_MouseLeave, Fire_MouseDown, Fire_MouseUp, Fire_MouseWheel /// \endif HRESULT Fire_MouseMove(IRichTextRange* pTextRange, SHORT button, SHORT shift, OLE_XPOS_PIXELS x, OLE_YPOS_PIXELS y, HitTestConstants hitTestDetails) { HRESULT hr = S_OK; // invoke the event for each connection point for(int i = 0; i < m_vec.GetSize(); ++i) { LPDISPATCH pConnection = static_cast<LPDISPATCH>(m_vec.GetAt(i)); if(pConnection) { CComVariant p[6]; p[5] = pTextRange; p[4] = button; p[4].vt = VT_I2; p[3] = shift; p[3].vt = VT_I2; p[2] = x; p[2].vt = VT_XPOS_PIXELS; p[1] = y; p[1].vt = VT_YPOS_PIXELS; p[0].lVal = static_cast<LONG>(hitTestDetails); p[0].vt = VT_I4; // invoke the event DISPPARAMS params = {p, NULL, 6, 0}; hr = pConnection->Invoke(DISPID_RTBE_MOUSEMOVE, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &params, NULL, NULL, NULL); } } return hr; } /// \brief <em>Fires the \c MouseUp event</em> /// /// \param[in] pTextRange A \c IRichTextRange object wrapping the text that the mouse cursor is located /// over. /// \param[in] button The released mouse buttons. Any of the values defined by VB's /// \c MouseButtonConstants enumeration or the \c ExtendedMouseButtonConstants enumeration /// is valid. /// \param[in] shift The pressed modifier keys (Shift, Ctrl, Alt). Any combination of the values /// defined by VB's \c ShiftConstants enumeration is valid. /// \param[in] x The x-coordinate (in pixels) of the mouse cursor's position relative to the control's /// upper-left corner. /// \param[in] y The y-coordinate (in pixels) of the mouse cursor's position relative to the control's /// upper-left corner. /// \param[in] hitTestDetails The exact part of the control that the mouse cursor's position lies in. /// Any of the values defined by the \c HitTestConstants enumeration is valid. /// /// \return An \c HRESULT error code. /// /// \if UNICODE /// \sa RichTextBoxCtlLibU::_IRichTextBoxEvents::MouseUp, RichTextBox::Raise_MouseUp, Fire_MouseDown, /// Fire_Click, Fire_MClick, Fire_RClick, Fire_XClick /// \else /// \sa RichTextBoxCtlLibA::_IRichTextBoxEvents::MouseUp, RichTextBox::Raise_MouseUp, Fire_MouseDown, /// Fire_Click, Fire_MClick, Fire_RClick, Fire_XClick /// \endif HRESULT Fire_MouseUp(IRichTextRange* pTextRange, SHORT button, SHORT shift, OLE_XPOS_PIXELS x, OLE_YPOS_PIXELS y, HitTestConstants hitTestDetails) { HRESULT hr = S_OK; // invoke the event for each connection point for(int i = 0; i < m_vec.GetSize(); ++i) { LPDISPATCH pConnection = static_cast<LPDISPATCH>(m_vec.GetAt(i)); if(pConnection) { CComVariant p[6]; p[5] = pTextRange; p[4] = button; p[4].vt = VT_I2; p[3] = shift; p[3].vt = VT_I2; p[2] = x; p[2].vt = VT_XPOS_PIXELS; p[1] = y; p[1].vt = VT_YPOS_PIXELS; p[0].lVal = static_cast<LONG>(hitTestDetails); p[0].vt = VT_I4; // invoke the event DISPPARAMS params = {p, NULL, 6, 0}; hr = pConnection->Invoke(DISPID_RTBE_MOUSEUP, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &params, NULL, NULL, NULL); } } return hr; } /// \brief <em>Fires the \c MouseWheel event</em> /// /// \param[in] pTextRange A \c IRichTextRange object wrapping the text that the mouse cursor is located /// over. /// \param[in] button The pressed mouse buttons. Any combination of the values defined by VB's /// \c MouseButtonConstants enumeration or the \c ExtendedMouseButtonConstants enumeration /// is valid. /// \param[in] shift The pressed modifier keys (Shift, Ctrl, Alt). Any combination of the values /// defined by VB's \c ShiftConstants enumeration is valid. /// \param[in] x The x-coordinate (in pixels) of the mouse cursor's position relative to the control's /// upper-left corner. /// \param[in] y The y-coordinate (in pixels) of the mouse cursor's position relative to the control's /// upper-left corner. /// \param[in] hitTestDetails The exact part of the control that the mouse cursor's position lies in. /// Any of the values defined by the \c HitTestConstants enumeration is valid. /// \param[in] scrollAxis Specifies whether the user intents to scroll vertically or horizontally. /// Any of the values defined by the \c ScrollAxisConstants enumeration is valid. /// \param[in] wheelDelta The distance the wheel has been rotated. /// /// \return An \c HRESULT error code. /// /// \if UNICODE /// \sa RichTextBoxCtlLibU::_IRichTextBoxEvents::MouseWheel, RichTextBox::Raise_MouseWheel, /// Fire_MouseMove /// \else /// \sa RichTextBoxCtlLibA::_IRichTextBoxEvents::MouseWheel, RichTextBox::Raise_MouseWheel, /// Fire_MouseMove /// \endif HRESULT Fire_MouseWheel(IRichTextRange* pTextRange, SHORT button, SHORT shift, OLE_XPOS_PIXELS x, OLE_YPOS_PIXELS y, HitTestConstants hitTestDetails, ScrollAxisConstants scrollAxis, SHORT wheelDelta) { HRESULT hr = S_OK; // invoke the event for each connection point for(int i = 0; i < m_vec.GetSize(); ++i) { LPDISPATCH pConnection = static_cast<LPDISPATCH>(m_vec.GetAt(i)); if(pConnection) { CComVariant p[8]; p[7] = pTextRange; p[6] = button; p[6].vt = VT_I2; p[5] = shift; p[5].vt = VT_I2; p[4] = x; p[4].vt = VT_XPOS_PIXELS; p[3] = y; p[3].vt = VT_YPOS_PIXELS; p[2].lVal = static_cast<LONG>(hitTestDetails); p[2].vt = VT_I4; p[1].lVal = static_cast<LONG>(scrollAxis); p[1].vt = VT_I4; p[0] = wheelDelta; p[0].vt = VT_I2; // invoke the event DISPPARAMS params = {p, NULL, 8, 0}; hr = pConnection->Invoke(DISPID_RTBE_MOUSEWHEEL, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &params, NULL, NULL, NULL); } } return hr; } /// \brief <em>Fires the \c OLECompleteDrag event</em> /// /// \param[in] pData The object that holds the dragged data. /// \param[in] performedEffect The performed drop effect. Any of the values (except \c odeScroll) /// defined by the \c OLEDropEffectConstants enumeration is valid. /// /// \return An \c HRESULT error code. /// /// \if UNICODE /// \sa RichTextBoxCtlLibU::_IRichTextBoxEvents::OLECompleteDrag, RichTextBox::Raise_OLECompleteDrag, /// Fire_OLEStartDrag, Fire_DragDropDone /// \else /// \sa RichTextBoxCtlLibA::_IRichTextBoxEvents::OLECompleteDrag, RichTextBox::Raise_OLECompleteDrag, /// Fire_OLEStartDrag, Fire_DragDropDone /// \endif HRESULT Fire_OLECompleteDrag(IOLEDataObject* pData, OLEDropEffectConstants performedEffect) { HRESULT hr = S_OK; // invoke the event for each connection point for(int i = 0; i < m_vec.GetSize(); ++i) { LPDISPATCH pConnection = static_cast<LPDISPATCH>(m_vec.GetAt(i)); if(pConnection) { CComVariant p[2]; p[1] = pData; p[0].lVal = static_cast<LONG>(performedEffect); p[0].vt = VT_I4; // invoke the event DISPPARAMS params = {p, NULL, 2, 0}; hr = pConnection->Invoke(DISPID_RTBE_OLECOMPLETEDRAG, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &params, NULL, NULL, NULL); } } return hr; } /// \brief <em>Fires the \c OLEDragDrop event</em> /// /// \param[in] pData The dropped data. /// \param[in,out] pEffect On entry, a bit field of the drop effects (defined by the /// \c OLEDropEffectConstants enumeration) supported by the drag source. On return, /// the drop effect that the client finally executed. /// \param[in] pDropTarget The text range (an insertion point) that is the current target of the /// drag'n'drop operation. /// \param[in] button The pressed mouse buttons. Any combination of the values defined by VB's /// \c MouseButtonConstants enumeration is valid. /// \param[in] shift The pressed modifier keys (Shift, Ctrl, Alt). Any combination of the values /// defined by VB's \c ShiftConstants enumeration is valid. /// \param[in] x The x-coordinate (in pixels) of the mouse cursor's position relative to the control's /// upper-left corner. /// \param[in] y The y-coordinate (in pixels) of the mouse cursor's position relative to the control's /// upper-left corner. /// \param[in] hitTestDetails Specifies the part of the control that the mouse cursor's position lies /// in. Any of the values defined by the \c HitTestConstants enumeration is valid. /// /// \return An \c HRESULT error code. /// /// \if UNICODE /// \sa RichTextBoxCtlLibU::_IRichTextBoxEvents::OLEDragDrop, RichTextBox::Raise_OLEDragDrop, /// Fire_OLEDragEnter, Fire_OLEDragMouseMove, Fire_OLEDragLeave, Fire_GetDragDropEffect, /// Fire_MouseUp /// \else /// \sa RichTextBoxCtlLibA::_IRichTextBoxEvents::OLEDragDrop, RichTextBox::Raise_OLEDragDrop, /// Fire_OLEDragEnter, Fire_OLEDragMouseMove, Fire_OLEDragLeave, Fire_GetDragDropEffect, /// Fire_MouseUp /// \endif HRESULT Fire_OLEDragDrop(IOLEDataObject* pData, OLEDropEffectConstants* pEffect, IRichTextRange* pDropTarget, SHORT button, SHORT shift, OLE_XPOS_PIXELS x, OLE_YPOS_PIXELS y, HitTestConstants hitTestDetails) { HRESULT hr = S_OK; // invoke the event for each connection point for(int i = 0; i < m_vec.GetSize(); ++i) { LPDISPATCH pConnection = static_cast<LPDISPATCH>(m_vec.GetAt(i)); if(pConnection) { CComVariant p[8]; p[7] = pData; p[6].plVal = reinterpret_cast<PLONG>(pEffect); p[6].vt = VT_I4 | VT_BYREF; p[5] = pDropTarget; p[4] = button; p[4].vt = VT_I2; p[3] = shift; p[3].vt = VT_I2; p[2] = x; p[2].vt = VT_XPOS_PIXELS; p[1] = y; p[1].vt = VT_YPOS_PIXELS; p[0].lVal = static_cast<LONG>(hitTestDetails); p[0].vt = VT_I4; // invoke the event DISPPARAMS params = {p, NULL, 8, 0}; hr = pConnection->Invoke(DISPID_RTBE_OLEDRAGDROP, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &params, NULL, NULL, NULL); } } return hr; } /// \brief <em>Fires the \c OLEDragEnter event</em> /// /// \param[in] pData The dragged data. /// \param[in,out] pEffect On entry, a bit field of the drop effects (defined by the /// \c OLEDropEffectConstants enumeration) supported by the drag source. On return, /// the drop effect that the client wants to be used on drop. /// \param[in] pDropTarget The text range (an insertion point) that is the current target of the /// drag'n'drop operation. /// \param[in] button The pressed mouse buttons. Any combination of the values defined by VB's /// \c MouseButtonConstants enumeration is valid. /// \param[in] shift The pressed modifier keys (Shift, Ctrl, Alt). Any combination of the values /// defined by VB's \c ShiftConstants enumeration is valid. /// \param[in] x The x-coordinate (in pixels) of the mouse cursor's position relative to the control's /// upper-left corner. /// \param[in] y The y-coordinate (in pixels) of the mouse cursor's position relative to the control's /// upper-left corner. /// \param[in] hitTestDetails Specifies the part of the control that the mouse cursor's position lies /// in. Any of the values defined by the \c HitTestConstants enumeration is valid. /// \param[in,out] pAutoHScrollVelocity The speed multiplier for horizontal auto-scrolling. If set /// to 0, the caller should disable horizontal auto-scrolling; if set to a value less /// than 0, it should scroll the control to the left; if set to a value greater than 0, /// it should scroll the control to the right. The higher/lower the value is, the faster /// the caller should scroll the control. /// \param[in,out] pAutoVScrollVelocity The speed multiplier for vertical auto-scrolling. If set to /// 0, the caller should disable vertical auto-scrolling; if set to a value less than /// 0, it should scroll the control upwardly; if set to a value greater than 0, it /// should scroll the control downwards. The higher/lower the value is, the faster the /// caller should scroll the control. /// /// \return An \c HRESULT error code. /// /// \if UNICODE /// \sa RichTextBoxCtlLibU::_IRichTextBoxEvents::OLEDragEnter, RichTextBox::Raise_OLEDragEnter, /// Fire_OLEDragMouseMove, Fire_OLEDragLeave, Fire_OLEDragDrop, Fire_GetDragDropEffect, /// Fire_MouseEnter /// \else /// \sa RichTextBoxCtlLibA::_IRichTextBoxEvents::OLEDragEnter, RichTextBox::Raise_OLEDragEnter, /// Fire_OLEDragMouseMove, Fire_OLEDragLeave, Fire_OLEDragDrop, Fire_GetDragDropEffect, /// Fire_MouseEnter /// \endif HRESULT Fire_OLEDragEnter(IOLEDataObject* pData, OLEDropEffectConstants* pEffect, IRichTextRange* pDropTarget, SHORT button, SHORT shift, OLE_XPOS_PIXELS x, OLE_YPOS_PIXELS y, HitTestConstants hitTestDetails, LONG* pAutoHScrollVelocity, LONG* pAutoVScrollVelocity) { HRESULT hr = S_OK; // invoke the event for each connection point for(int i = 0; i < m_vec.GetSize(); ++i) { LPDISPATCH pConnection = static_cast<LPDISPATCH>(m_vec.GetAt(i)); if(pConnection) { CComVariant p[10]; p[9] = pData; p[8].plVal = reinterpret_cast<PLONG>(pEffect); p[8].vt = VT_I4 | VT_BYREF; p[7] = pDropTarget; p[6] = button; p[6].vt = VT_I2; p[5] = shift; p[5].vt = VT_I2; p[4] = x; p[4].vt = VT_XPOS_PIXELS; p[3] = y; p[3].vt = VT_YPOS_PIXELS; p[2].lVal = static_cast<LONG>(hitTestDetails); p[2].vt = VT_I4; p[1].plVal = pAutoHScrollVelocity; p[1].vt = VT_I4 | VT_BYREF; p[0].plVal = pAutoVScrollVelocity; p[0].vt = VT_I4 | VT_BYREF; // invoke the event DISPPARAMS params = {p, NULL, 10, 0}; hr = pConnection->Invoke(DISPID_RTBE_OLEDRAGENTER, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &params, NULL, NULL, NULL); } } return hr; } /// \brief <em>Fires the \c OLEDragEnterPotentialTarget event</em> /// /// \param[in] hWndPotentialTarget The handle of the potential drag'n'drop target window. /// /// \return An \c HRESULT error code. /// /// \if UNICODE /// \sa RichTextBoxCtlLibU::_IRichTextBoxEvents::OLEDragEnterPotentialTarget, /// RichTextBox::Raise_OLEDragEnterPotentialTarget, Fire_OLEDragLeavePotentialTarget /// \else /// \sa RichTextBoxCtlLibA::_IRichTextBoxEvents::OLEDragEnterPotentialTarget, /// RichTextBox::Raise_OLEDragEnterPotentialTarget, Fire_OLEDragLeavePotentialTarget /// \endif HRESULT Fire_OLEDragEnterPotentialTarget(LONG hWndPotentialTarget) { HRESULT hr = S_OK; // invoke the event for each connection point for(int i = 0; i < m_vec.GetSize(); ++i) { LPDISPATCH pConnection = static_cast<LPDISPATCH>(m_vec.GetAt(i)); if(pConnection) { CComVariant p[1]; p[0] = hWndPotentialTarget; // invoke the event DISPPARAMS params = {p, NULL, 1, 0}; hr = pConnection->Invoke(DISPID_RTBE_OLEDRAGENTERPOTENTIALTARGET, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &params, NULL, NULL, NULL); } } return hr; } /// \brief <em>Fires the \c OLEDragLeave event</em> /// /// \param[in] pData The dragged data. /// \param[in] pDropTarget The text range (an insertion point) that is the current target of the /// drag'n'drop operation. /// \param[in] button The pressed mouse buttons. Any combination of the values defined by VB's /// \c MouseButtonConstants enumeration is valid. /// \param[in] shift The pressed modifier keys (Shift, Ctrl, Alt). Any combination of the values /// defined by VB's \c ShiftConstants enumeration is valid. /// \param[in] x The x-coordinate (in pixels) of the mouse cursor's position relative to the control's /// upper-left corner. /// \param[in] y The y-coordinate (in pixels) of the mouse cursor's position relative to the control's /// upper-left corner. /// \param[in] hitTestDetails Specifies the part of the control that the mouse cursor's position lies /// in. Any of the values defined by the \c HitTestConstants enumeration is valid. /// /// \return An \c HRESULT error code. /// /// \if UNICODE /// \sa RichTextBoxCtlLibU::_IRichTextBoxEvents::OLEDragLeave, RichTextBox::Raise_OLEDragLeave, /// Fire_OLEDragEnter, Fire_OLEDragMouseMove, Fire_OLEDragDrop, Fire_MouseLeave /// \else /// \sa RichTextBoxCtlLibA::_IRichTextBoxEvents::OLEDragLeave, RichTextBox::Raise_OLEDragLeave, /// Fire_OLEDragEnter, Fire_OLEDragMouseMove, Fire_OLEDragDrop, Fire_MouseLeave /// \endif HRESULT Fire_OLEDragLeave(IOLEDataObject* pData, IRichTextRange* pDropTarget, SHORT button, SHORT shift, OLE_XPOS_PIXELS x, OLE_YPOS_PIXELS y, HitTestConstants hitTestDetails) { HRESULT hr = S_OK; // invoke the event for each connection point for(int i = 0; i < m_vec.GetSize(); ++i) { LPDISPATCH pConnection = static_cast<LPDISPATCH>(m_vec.GetAt(i)); if(pConnection) { CComVariant p[7]; p[6] = pData; p[5] = pDropTarget; p[4] = button; p[4].vt = VT_I2; p[3] = shift; p[3].vt = VT_I2; p[2].lVal = static_cast<LONG>(hitTestDetails); p[2].vt = VT_I4; p[1] = x; p[1].vt = VT_XPOS_PIXELS; p[0] = y; p[0].vt = VT_YPOS_PIXELS; // invoke the event DISPPARAMS params = {p, NULL, 7, 0}; hr = pConnection->Invoke(DISPID_RTBE_OLEDRAGLEAVE, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &params, NULL, NULL, NULL); } } return hr; } /// \brief <em>Fires the \c OLEDragLeavePotentialTarget event</em> /// /// \return An \c HRESULT error code. /// /// \if UNICODE /// \sa RichTextBoxCtlLibU::_IRichTextBoxEvents::OLEDragLeavePotentialTarget, /// RichTextBox::Raise_OLEDragLeavePotentialTarget, Fire_OLEDragEnterPotentialTarget /// \else /// \sa RichTextBoxCtlLibA::_IRichTextBoxEvents::OLEDragLeavePotentialTarget, /// RichTextBox::Raise_OLEDragLeavePotentialTarget, Fire_OLEDragEnterPotentialTarget /// \endif HRESULT Fire_OLEDragLeavePotentialTarget(void) { HRESULT hr = S_OK; // invoke the event for each connection point for(int i = 0; i < m_vec.GetSize(); ++i) { LPDISPATCH pConnection = static_cast<LPDISPATCH>(m_vec.GetAt(i)); if(pConnection) { // invoke the event DISPPARAMS params = {NULL, NULL, 0, 0}; hr = pConnection->Invoke(DISPID_RTBE_OLEDRAGLEAVEPOTENTIALTARGET, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &params, NULL, NULL, NULL); } } return hr; } /// \brief <em>Fires the \c OLEDragMouseMove event</em> /// /// \param[in] pData The dragged data. /// \param[in,out] pEffect On entry, a bit field of the drop effects (defined by the /// \c OLEDropEffectConstants enumeration) supported by the drag source. On return, /// the drop effect that the client wants to be used on drop. /// \param[in] pDropTarget The text range (an insertion point) that is the current target of the /// drag'n'drop operation. /// \param[in] button The pressed mouse buttons. Any combination of the values defined by VB's /// \c MouseButtonConstants enumeration is valid. /// \param[in] shift The pressed modifier keys (Shift, Ctrl, Alt). Any combination of the values /// defined by VB's \c ShiftConstants enumeration is valid. /// \param[in] x The x-coordinate (in pixels) of the mouse cursor's position relative to the control's /// upper-left corner. /// \param[in] y The y-coordinate (in pixels) of the mouse cursor's position relative to the control's /// upper-left corner. /// \param[in,out] pAutoHScrollVelocity The speed multiplier for horizontal auto-scrolling. If set /// to 0, the caller should disable horizontal auto-scrolling; if set to a value less /// than 0, it should scroll the control to the left; if set to a value greater than 0, /// it should scroll the control to the right. The higher/lower the value is, the faster /// the caller should scroll the control. /// \param[in,out] pAutoVScrollVelocity The speed multiplier for vertical auto-scrolling. If set to /// 0, the caller should disable vertical auto-scrolling; if set to a value less than /// 0, it should scroll the control upwardly; if set to a value greater than 0, it /// should scroll the control downwards. The higher/lower the value is, the faster the /// caller should scroll the control. /// \param[in] hitTestDetails Specifies the part of the control that the mouse cursor's position lies /// in. Any of the values defined by the \c HitTestConstants enumeration is valid. /// /// \return An \c HRESULT error code. /// /// \if UNICODE /// \sa RichTextBoxCtlLibU::_IRichTextBoxEvents::OLEDragMouseMove, RichTextBox::Raise_OLEDragMouseMove, /// Fire_OLEDragEnter, Fire_OLEDragLeave, Fire_OLEDragDrop, Fire_GetDragDropEffect, Fire_MouseMove /// \else /// \sa RichTextBoxCtlLibA::_IRichTextBoxEvents::OLEDragMouseMove, RichTextBox::Raise_OLEDragMouseMove, /// Fire_OLEDragEnter, Fire_OLEDragLeave, Fire_OLEDragDrop, Fire_GetDragDropEffect, Fire_MouseMove /// \endif HRESULT Fire_OLEDragMouseMove(IOLEDataObject* pData, OLEDropEffectConstants* pEffect, IRichTextRange* pDropTarget, SHORT button, SHORT shift, OLE_XPOS_PIXELS x, OLE_YPOS_PIXELS y, HitTestConstants hitTestDetails, LONG* pAutoHScrollVelocity, LONG* pAutoVScrollVelocity) { HRESULT hr = S_OK; // invoke the event for each connection point for(int i = 0; i < m_vec.GetSize(); ++i) { LPDISPATCH pConnection = static_cast<LPDISPATCH>(m_vec.GetAt(i)); if(pConnection) { CComVariant p[10]; p[9] = pData; p[8].plVal = reinterpret_cast<PLONG>(pEffect); p[8].vt = VT_I4 | VT_BYREF; p[7] = pDropTarget; p[6] = button; p[6].vt = VT_I2; p[5] = shift; p[5].vt = VT_I2; p[4] = x; p[4].vt = VT_XPOS_PIXELS; p[3] = y; p[3].vt = VT_YPOS_PIXELS; p[2].lVal = static_cast<LONG>(hitTestDetails); p[2].vt = VT_I4; p[1].plVal = pAutoHScrollVelocity; p[1].vt = VT_I4 | VT_BYREF; p[0].plVal = pAutoVScrollVelocity; p[0].vt = VT_I4 | VT_BYREF; // invoke the event DISPPARAMS params = {p, NULL, 10, 0}; hr = pConnection->Invoke(DISPID_RTBE_OLEDRAGMOUSEMOVE, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &params, NULL, NULL, NULL); } } return hr; } /// \brief <em>Fires the \c OLEGiveFeedback event</em> /// /// \param[in] effect The current drop effect. It is chosen by the potential drop target. Any of /// the values defined by the \c OLEDropEffectConstants enumeration is valid. /// \param[in,out] pUseDefaultCursors If set to \c VARIANT_TRUE, the system's default mouse cursors /// shall be used to visualize the various drop effects. If set to \c VARIANT_FALSE, /// the client has set a custom mouse cursor. /// /// \return An \c HRESULT error code. /// /// \if UNICODE /// \sa RichTextBoxCtlLibU::_IRichTextBoxEvents::OLEGiveFeedback, RichTextBox::Raise_OLEGiveFeedback, /// Fire_OLEQueryContinueDrag /// \else /// \sa RichTextBoxCtlLibA::_IRichTextBoxEvents::OLEGiveFeedback, RichTextBox::Raise_OLEGiveFeedback, /// Fire_OLEQueryContinueDrag /// \endif HRESULT Fire_OLEGiveFeedback(OLEDropEffectConstants effect, VARIANT_BOOL* pUseDefaultCursors) { HRESULT hr = S_OK; // invoke the event for each connection point for(int i = 0; i < m_vec.GetSize(); ++i) { LPDISPATCH pConnection = static_cast<LPDISPATCH>(m_vec.GetAt(i)); if(pConnection) { CComVariant p[2]; p[1] = static_cast<LONG>(effect); p[1].vt = VT_I4; p[0].pboolVal = pUseDefaultCursors; p[0].vt = VT_BOOL | VT_BYREF; // invoke the event DISPPARAMS params = {p, NULL, 2, 0}; hr = pConnection->Invoke(DISPID_RTBE_OLEGIVEFEEDBACK, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &params, NULL, NULL, NULL); } } return hr; } /// \brief <em>Fires the \c OLEQueryContinueDrag event</em> /// /// \param[in] pressedEscape If \c VARIANT_TRUE, the user has pressed the \c ESC key since the last /// time this event was fired; otherwise not. /// \param[in] button The pressed mouse buttons. Any combination of the values defined by VB's /// \c MouseButtonConstants enumeration is valid. /// \param[in] shift The pressed modifier keys (Shift, Ctrl, Alt). Any combination of the values /// defined by VB's \c ShiftConstants enumeration is valid. /// \param[in,out] pActionToContinueWith Indicates whether to continue, cancel or complete the /// drag'n'drop operation. Any of the values defined by the /// \c OLEActionToContinueWithConstants enumeration is valid. /// /// \return An \c HRESULT error code. /// /// \if UNICODE /// \sa RichTextBoxCtlLibU::_IRichTextBoxEvents::OLEQueryContinueDrag, /// RichTextBox::Raise_OLEQueryContinueDrag, Fire_OLEGiveFeedback /// \else /// \sa RichTextBoxCtlLibA::_IRichTextBoxEvents::OLEQueryContinueDrag, /// RichTextBox::Raise_OLEQueryContinueDrag, Fire_OLEGiveFeedback /// \endif HRESULT Fire_OLEQueryContinueDrag(VARIANT_BOOL pressedEscape, SHORT button, SHORT shift, OLEActionToContinueWithConstants* pActionToContinueWith) { HRESULT hr = S_OK; // invoke the event for each connection point for(int i = 0; i < m_vec.GetSize(); ++i) { LPDISPATCH pConnection = static_cast<LPDISPATCH>(m_vec.GetAt(i)); if(pConnection) { CComVariant p[4]; p[3] = pressedEscape; p[2] = button; p[2].vt = VT_I2; p[1] = shift; p[1].vt = VT_I2; p[0].plVal = reinterpret_cast<PLONG>(pActionToContinueWith); p[0].vt = VT_I4 | VT_BYREF; // invoke the event DISPPARAMS params = {p, NULL, 4, 0}; hr = pConnection->Invoke(DISPID_RTBE_OLEQUERYCONTINUEDRAG, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &params, NULL, NULL, NULL); } } return hr; } /// \brief <em>Fires the \c OLEReceivedNewData event</em> /// /// \param[in] pData The object that holds the dragged data. /// \param[in] formatID An integer value specifying the format the data object has received data for. /// Valid values are those defined by VB's \c ClipBoardConstants enumeration, but also any /// other format that has been registered using the \c RegisterClipboardFormat API function. /// \param[in] index An integer value that is assigned to the internal \c FORMATETC struct's \c lindex /// member. Usually it is -1, but some formats like \c CFSTR_FILECONTENTS require multiple /// \c FORMATETC structs for the same format. In such cases each struct of this format will /// have a separate index. /// \param[in] dataOrViewAspect An integer value that is assigned to the internal \c FORMATETC struct's /// \c dwAspect member. Any of the \c DVASPECT_* values defined by the Microsoft&reg; /// Windows&reg; SDK are valid. The default is \c DVASPECT_CONTENT. /// /// \return An \c HRESULT error code. /// /// \if UNICODE /// \sa RichTextBoxCtlLibU::_IRichTextBoxEvents::OLEReceivedNewData, /// RichTextBox::Raise_OLEReceivedNewData, Fire_OLESetData /// \else /// \sa RichTextBoxCtlLibA::_IRichTextBoxEvents::OLEReceivedNewData, /// RichTextBox::Raise_OLEReceivedNewData, Fire_OLESetData /// \endif HRESULT Fire_OLEReceivedNewData(IOLEDataObject* pData, LONG formatID, LONG index, LONG dataOrViewAspect) { HRESULT hr = S_OK; // invoke the event for each connection point for(int i = 0; i < m_vec.GetSize(); ++i) { LPDISPATCH pConnection = static_cast<LPDISPATCH>(m_vec.GetAt(i)); if(pConnection) { CComVariant p[4]; p[3] = pData; p[2] = formatID; p[1] = index; p[0] = dataOrViewAspect; // invoke the event DISPPARAMS params = {p, NULL, 4, 0}; hr = pConnection->Invoke(DISPID_RTBE_OLERECEIVEDNEWDATA, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &params, NULL, NULL, NULL); } } return hr; } /// \brief <em>Fires the \c OLESetData event</em> /// /// \param[in] pData The object that holds the dragged data. /// \param[in] formatID An integer value specifying the format the drop target is requesting data for. /// Valid values are those defined by VB's \c ClipBoardConstants enumeration, but also any /// other format that has been registered using the \c RegisterClipboardFormat API function. /// \param[in] index An integer value that is assigned to the internal \c FORMATETC struct's \c lindex /// member. Usually it is -1, but some formats like \c CFSTR_FILECONTENTS require multiple /// \c FORMATETC structs for the same format. In such cases each struct of this format will /// have a separate index. /// \param[in] dataOrViewAspect An integer value that is assigned to the internal \c FORMATETC struct's /// \c dwAspect member. Any of the \c DVASPECT_* values defined by the Microsoft&reg; /// Windows&reg; SDK are valid. The default is \c DVASPECT_CONTENT. /// /// \return An \c HRESULT error code. /// /// \if UNICODE /// \sa RichTextBoxCtlLibU::_IRichTextBoxEvents::OLESetData, RichTextBox::Raise_OLESetData, /// Fire_OLEStartDrag /// \else /// \sa RichTextBoxCtlLibA::_IRichTextBoxEvents::OLESetData, RichTextBox::Raise_OLESetData, /// Fire_OLEStartDrag /// \endif HRESULT Fire_OLESetData(IOLEDataObject* pData, LONG formatID, LONG index, LONG dataOrViewAspect) { HRESULT hr = S_OK; // invoke the event for each connection point for(int i = 0; i < m_vec.GetSize(); ++i) { LPDISPATCH pConnection = static_cast<LPDISPATCH>(m_vec.GetAt(i)); if(pConnection) { CComVariant p[4]; p[3] = pData; p[2] = formatID; p[1] = index; p[0] = dataOrViewAspect; // invoke the event DISPPARAMS params = {p, NULL, 4, 0}; hr = pConnection->Invoke(DISPID_RTBE_OLESETDATA, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &params, NULL, NULL, NULL); } } return hr; } /// \brief <em>Fires the \c OLEStartDrag event</em> /// /// \param[in] pData The object that holds the dragged data. /// /// \return An \c HRESULT error code. /// /// \if UNICODE /// \sa RichTextBoxCtlLibU::_IRichTextBoxEvents::OLEStartDrag, RichTextBox::Raise_OLEStartDrag, /// Fire_OLESetData, Fire_OLECompleteDrag /// \else /// \sa RichTextBoxCtlLibA::_IRichTextBoxEvents::OLEStartDrag, RichTextBox::Raise_OLEStartDrag, /// Fire_OLESetData, Fire_OLECompleteDrag /// \endif HRESULT Fire_OLEStartDrag(IOLEDataObject* pData) { HRESULT hr = S_OK; // invoke the event for each connection point for(int i = 0; i < m_vec.GetSize(); ++i) { LPDISPATCH pConnection = static_cast<LPDISPATCH>(m_vec.GetAt(i)); if(pConnection) { CComVariant p[1]; p[0] = pData; // invoke the event DISPPARAMS params = {p, NULL, 1, 0}; hr = pConnection->Invoke(DISPID_RTBE_OLESTARTDRAG, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &params, NULL, NULL, NULL); } } return hr; } /// \brief <em>Fires the \c QueryAcceptData event</em> /// /// \param[in] pData The object that holds the copied or dragged data. /// \param[in,out] pFormatID An integer value specifying the format in which the copied or dragged /// data will be pasted or dropped. The client application may change the format to /// any other format provided by the data object.\n /// Valid values are those defined by VB's \c ClipBoardConstants enumeration, but /// also any other format that has been registered using the \c RegisterClipboardFormat /// API function. /// \param[in] operationType Specifies the kind of operation that will take place. Some of the values /// defined by the \c ClipboardOperationTypeConstants enumeration are valid. /// \param[in] performOperation If \c VARIANT_TRUE, the operation is actually being performed; otherwise /// the event is fired only to check whether the data would be accepted or refused. /// \param[in] hMetafilePicture A handle to a metafile image that should be used to display the /// inserted object as icon. /// \param[in,out] acceptData Specifies whether to accept or refuse the provided data or whether to /// let the native rich edit control decide. Any of the values defined by the /// \c QueryAcceptDataConstants enumeration is valid. /// /// \return An \c HRESULT error code. /// /// \if UNICODE /// \sa RichTextBoxCtlLibU::_IRichTextBoxEvents::QueryAcceptData, RichTextBox::Raise_QueryAcceptData, /// Fire_GetDataObject /// \else /// \sa RichTextBoxCtlLibA::_IRichTextBoxEvents::QueryAcceptData, RichTextBox::Raise_QueryAcceptData, /// Fire_GetDataObject /// \endif HRESULT Fire_QueryAcceptData(IOLEDataObject* pData, LONG* pFormatID, ClipboardOperationTypeConstants operationType, VARIANT_BOOL performOperation, OLE_HANDLE hMetafilePicture, QueryAcceptDataConstants* pAcceptData) { HRESULT hr = S_OK; // invoke the event for each connection point for(int i = 0; i < m_vec.GetSize(); ++i) { LPDISPATCH pConnection = static_cast<LPDISPATCH>(m_vec.GetAt(i)); if(pConnection) { CComVariant p[6]; p[5] = pData; p[4].plVal = pFormatID; p[4].vt = VT_I4 | VT_BYREF; p[3] = static_cast<LONG>(operationType); p[3].vt = VT_I4; p[2].boolVal = performOperation; p[2].vt = VT_BOOL; p[1].lVal = hMetafilePicture; p[1].vt = VT_I4; p[0].plVal = reinterpret_cast<LONG*>(pAcceptData); p[0].vt = VT_I4 | VT_BYREF; // invoke the event DISPPARAMS params = {p, NULL, 6, 0}; hr = pConnection->Invoke(DISPID_RTBE_QUERYACCEPTDATA, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &params, NULL, NULL, NULL); } } return hr; } /// \brief <em>Fires the \c RClick event</em> /// /// \param[in] pTextRange A \c IRichTextRange object wrapping the clicked text. /// \param[in] button The mouse buttons that were pressed during the click. This should always be /// \c vbRightButton (defined by VB's \c MouseButtonConstants enumeration). /// \param[in] shift The modifier keys (Shift, Ctrl, Alt) that were pressed during the click. Any /// combination of the values defined by VB's \c ShiftConstants enumeration is valid. /// \param[in] x The x-coordinate (in pixels) of the click's position relative to the control's /// upper-left corner. /// \param[in] y The y-coordinate (in pixels) of the click's position relative to the control's /// upper-left corner. /// \param[in] hitTestDetails The part of the control that was clicked. Any of the values defined /// by the \c HitTestConstants enumeration is valid. /// /// \return An \c HRESULT error code. /// /// \if UNICODE /// \sa RichTextBoxCtlLibU::_IRichTextBoxEvents::RClick, RichTextBox::Raise_RClick, Fire_ContextMenu, /// Fire_RDblClick, Fire_Click, Fire_MClick, Fire_XClick /// \else /// \sa RichTextBoxCtlLibA::_IRichTextBoxEvents::RClick, RichTextBox::Raise_RClick, Fire_ContextMenu, /// Fire_RDblClick, Fire_Click, Fire_MClick, Fire_XClick /// \endif HRESULT Fire_RClick(IRichTextRange* pTextRange, SHORT button, SHORT shift, OLE_XPOS_PIXELS x, OLE_YPOS_PIXELS y, HitTestConstants hitTestDetails) { HRESULT hr = S_OK; // invoke the event for each connection point for(int i = 0; i < m_vec.GetSize(); ++i) { LPDISPATCH pConnection = static_cast<LPDISPATCH>(m_vec.GetAt(i)); if(pConnection) { CComVariant p[6]; p[5] = pTextRange; p[4] = button; p[4].vt = VT_I2; p[3] = shift; p[3].vt = VT_I2; p[2] = x; p[2].vt = VT_XPOS_PIXELS; p[1] = y; p[1].vt = VT_YPOS_PIXELS; p[0].lVal = static_cast<LONG>(hitTestDetails); p[0].vt = VT_I4; // invoke the event DISPPARAMS params = {p, NULL, 6, 0}; hr = pConnection->Invoke(DISPID_RTBE_RCLICK, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &params, NULL, NULL, NULL); } } return hr; } /// \brief <em>Fires the \c RDblClick event</em> /// /// \param[in] pTextRange A \c IRichTextRange object wrapping the double-clicked text. /// \param[in] button The mouse buttons that were pressed during the double-click. This should /// always be \c vbRightButton (defined by VB's \c MouseButtonConstants enumeration). /// \param[in] shift The modifier keys (Shift, Ctrl, Alt) that were pressed during the double-click. /// Any combination of the values defined by VB's \c ShiftConstants enumeration is valid. /// \param[in] x The x-coordinate (in pixels) of the double-click's position relative to the control's /// upper-left corner. /// \param[in] y The y-coordinate (in pixels) of the double-click's position relative to the control's /// upper-left corner. /// \param[in] hitTestDetails The part of the control that was double-clicked. Any of the values defined /// by the \c HitTestConstants enumeration is valid. /// /// \return An \c HRESULT error code. /// /// \if UNICODE /// \sa RichTextBoxCtlLibU::_IRichTextBoxEvents::RDblClick, RichTextBox::Raise_RDblClick, Fire_RClick, /// Fire_DblClick, Fire_MDblClick, Fire_XDblClick /// \else /// \sa RichTextBoxCtlLibA::_IRichTextBoxEvents::RDblClick, RichTextBox::Raise_RDblClick, Fire_RClick, /// Fire_DblClick, Fire_MDblClick, Fire_XDblClick /// \endif HRESULT Fire_RDblClick(IRichTextRange* pTextRange, SHORT button, SHORT shift, OLE_XPOS_PIXELS x, OLE_YPOS_PIXELS y, HitTestConstants hitTestDetails) { HRESULT hr = S_OK; // invoke the event for each connection point for(int i = 0; i < m_vec.GetSize(); ++i) { LPDISPATCH pConnection = static_cast<LPDISPATCH>(m_vec.GetAt(i)); if(pConnection) { CComVariant p[6]; p[5] = pTextRange; p[4] = button; p[4].vt = VT_I2; p[3] = shift; p[3].vt = VT_I2; p[2] = x; p[2].vt = VT_XPOS_PIXELS; p[1] = y; p[1].vt = VT_YPOS_PIXELS; p[0].lVal = static_cast<LONG>(hitTestDetails); p[0].vt = VT_I4; // invoke the event DISPPARAMS params = {p, NULL, 6, 0}; hr = pConnection->Invoke(DISPID_RTBE_RDBLCLICK, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &params, NULL, NULL, NULL); } } return hr; } /// \brief <em>Fires the \c RecreatedControlWindow event</em> /// /// \param[in] hWnd The control's window handle. /// /// \return An \c HRESULT error code. /// /// \if UNICODE /// \sa RichTextBoxCtlLibU::_IRichTextBoxEvents::RecreatedControlWindow, /// RichTextBox::Raise_RecreatedControlWindow, Fire_DestroyedControlWindow /// \else /// \sa RichTextBoxCtlLibA::_IRichTextBoxEvents::RecreatedControlWindow, /// RichTextBox::Raise_RecreatedControlWindow, Fire_DestroyedControlWindow /// \endif HRESULT Fire_RecreatedControlWindow(LONG hWnd) { HRESULT hr = S_OK; // invoke the event for each connection point for(int i = 0; i < m_vec.GetSize(); ++i) { LPDISPATCH pConnection = static_cast<LPDISPATCH>(m_vec.GetAt(i)); if(pConnection) { CComVariant p[1]; p[0] = hWnd; // invoke the event DISPPARAMS params = {p, NULL, 1, 0}; hr = pConnection->Invoke(DISPID_RTBE_RECREATEDCONTROLWINDOW, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &params, NULL, NULL, NULL); } } return hr; } /// \brief <em>Fires the \c RemovingObject event</em> /// /// \param[in] pOLEObject The object being removed. /// \param[in,out] pCancelDeletion If \c VARIANT_TRUE, the caller should abort deletion; otherwise /// not. /// /// \return An \c HRESULT error code. /// /// \if UNICODE /// \sa RichTextBoxCtlLibU::_IRichTextBoxEvents::RemovingOLEObject, /// RichTextBox::Raise_RemovingOLEObject, Fire_InsertingOLEObject /// \else /// \sa RichTextBoxCtlLibA::_IRichTextBoxEvents::RemovingOLEObject, /// RichTextBox::Raise_RemovingOLEObject, Fire_InsertingOLEObject /// \endif HRESULT Fire_RemovingOLEObject(IRichOLEObject* pOLEObject, VARIANT_BOOL* pCancelDeletion) { HRESULT hr = S_OK; // invoke the event for each connection point for(int i = 0; i < m_vec.GetSize(); ++i) { LPDISPATCH pConnection = static_cast<LPDISPATCH>(m_vec.GetAt(i)); if(pConnection) { CComVariant p[2]; p[1] = pOLEObject; p[0].pboolVal = pCancelDeletion; p[0].vt = VT_BOOL | VT_BYREF; // invoke the event DISPPARAMS params = {p, NULL, 2, 0}; hr = pConnection->Invoke(DISPID_RTBE_REMOVINGOLEOBJECT, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &params, NULL, NULL, NULL); } } return hr; } /// \brief <em>Fires the \c ResizedControlWindow event</em> /// /// \return An \c HRESULT error code. /// /// \if UNICODE /// \sa RichTextBoxCtlLibU::_IRichTextBoxEvents::ResizedControlWindow, /// RichTextBox::Raise_ResizedControlWindow /// \else /// \sa RichTextBoxCtlLibA::_IRichTextBoxEvents::ResizedControlWindow, /// RichTextBox::Raise_ResizedControlWindow /// \endif HRESULT Fire_ResizedControlWindow(void) { HRESULT hr = S_OK; // invoke the event for each connection point for(int i = 0; i < m_vec.GetSize(); ++i) { LPDISPATCH pConnection = static_cast<LPDISPATCH>(m_vec.GetAt(i)); if(pConnection) { // invoke the event DISPPARAMS params = {NULL, NULL, 0, 0}; hr = pConnection->Invoke(DISPID_RTBE_RESIZEDCONTROLWINDOW, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &params, NULL, NULL, NULL); } } return hr; } /// \brief <em>Fires the \c Scrolling event</em> /// /// \param[in] axis The axis which is scrolled. Any of the values defined by the \c ScrollAxisConstants /// enumeration is valid. /// /// \return An \c HRESULT error code. /// /// \if UNICODE /// \sa RichTextBoxCtlLibU::_IRichTextBoxEvents::Scrolling, RichTextBox::Raise_Scrolling /// \else /// \sa RichTextBoxCtlLibA::_IRichTextBoxEvents::Scrolling, RichTextBox::Raise_Scrolling /// \endif HRESULT Fire_Scrolling(ScrollAxisConstants axis) { HRESULT hr = S_OK; // invoke the event for each connection point for(int i = 0; i < m_vec.GetSize(); ++i) { LPDISPATCH pConnection = static_cast<LPDISPATCH>(m_vec.GetAt(i)); if(pConnection) { CComVariant p[1]; p[0].lVal = static_cast<LONG>(axis); p[0].vt = VT_I4; // invoke the event DISPPARAMS params = {p, NULL, 1, 0}; hr = pConnection->Invoke(DISPID_RTBE_SCROLLING, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &params, NULL, NULL, NULL); } } return hr; } /// \brief <em>Fires the \c SelectionChanged event</em> /// /// \param[in] pSelectedTextRange A \c IRichTextRange object wrapping the (new) selected text. /// \param[in] selectionType Specifies what kind of data the current selection contains. Any /// combination of the values defined by the \c SelectionTypeConstants enumeration is /// valid. /// /// \return An \c HRESULT error code. /// /// \if UNICODE /// \sa RichTextBoxCtlLibU::_IRichTextBoxEvents::SelectionChanged, RichTextBox::Raise_SelectionChanged /// \else /// \sa RichTextBoxCtlLibA::_IRichTextBoxEvents::SelectionChanged, RichTextBox::Raise_SelectionChanged /// \endif HRESULT Fire_SelectionChanged(IRichTextRange* pSelectedTextRange, SelectionTypeConstants selectionType) { HRESULT hr = S_OK; // invoke the event for each connection point for(int i = 0; i < m_vec.GetSize(); ++i) { LPDISPATCH pConnection = static_cast<LPDISPATCH>(m_vec.GetAt(i)); if(pConnection) { CComVariant p[2]; p[1] = pSelectedTextRange; p[0].lVal = static_cast<LONG>(selectionType); p[0].vt = VT_I4; // invoke the event DISPPARAMS params = {p, NULL, 2, 0}; hr = pConnection->Invoke(DISPID_RTBE_SELECTIONCHANGED, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &params, NULL, NULL, NULL); } } return hr; } /// \brief <em>Fires the \c ShouldResizeControlWindow event</em> /// /// \param[in] pSuggestedControlSize The rectangle that the control should be resized to. /// /// \return An \c HRESULT error code. /// /// \if UNICODE /// \sa RichTextBoxCtlLibU::_IRichTextBoxEvents::ShouldResizeControlWindow, /// RichTextBox::Raise_ShouldResizeControlWindow /// \else /// \sa RichTextBoxCtlLibA::_IRichTextBoxEvents::ShouldResizeControlWindow, /// RichTextBox::Raise_ShouldResizeControlWindow /// \endif HRESULT Fire_ShouldResizeControlWindow(RECTANGLE* pSuggestedControlSize) { HRESULT hr = S_OK; // invoke the event for each connection point for(int i = 0; i < m_vec.GetSize(); ++i) { LPDISPATCH pConnection = static_cast<LPDISPATCH>(m_vec.GetAt(i)); if(pConnection) { CComVariant p[1]; // pack the pSuggestedControlSize parameters into a VARIANT of type VT_RECORD CComPtr<IRecordInfo> pRecordInfo = NULL; CLSID clsidRECTANGLE = {0}; #ifdef UNICODE LPOLESTR clsid = OLESTR("{A8BE18E3-B89F-4EEC-8139-3F0981D44E35}"); CLSIDFromString(clsid, &clsidRECTANGLE); ATLVERIFY(SUCCEEDED(GetRecordInfoFromGuids(LIBID_RichTextBoxCtlLibU, VERSION_MAJOR, VERSION_MINOR, GetUserDefaultLCID(), static_cast<REFGUID>(clsidRECTANGLE), &pRecordInfo))); #else LPOLESTR clsid = OLESTR("{42239B47-C660-4CC3-847C-A5EE735A8796}"); CLSIDFromString(clsid, &clsidRECTANGLE); ATLVERIFY(SUCCEEDED(GetRecordInfoFromGuids(LIBID_RichTextBoxCtlLibA, VERSION_MAJOR, VERSION_MINOR, GetUserDefaultLCID(), static_cast<REFGUID>(clsidRECTANGLE), &pRecordInfo))); #endif VariantInit(&p[0]); p[0].vt = VT_RECORD | VT_BYREF; p[0].pRecInfo = pRecordInfo; p[0].pvRecord = pRecordInfo->RecordCreate(); // transfer data reinterpret_cast<RECTANGLE*>(p[0].pvRecord)->Bottom = pSuggestedControlSize->Bottom; reinterpret_cast<RECTANGLE*>(p[0].pvRecord)->Left = pSuggestedControlSize->Left; reinterpret_cast<RECTANGLE*>(p[0].pvRecord)->Right = pSuggestedControlSize->Right; reinterpret_cast<RECTANGLE*>(p[0].pvRecord)->Top = pSuggestedControlSize->Top; // invoke the event DISPPARAMS params = {p, NULL, 1, 0}; hr = pConnection->Invoke(DISPID_RTBE_SHOULDRESIZECONTROLWINDOW, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &params, NULL, NULL, NULL); if(pRecordInfo) { pRecordInfo->RecordDestroy(p[0].pvRecord); } } } return hr; } /// \brief <em>Fires the \c TextChanged event</em> /// /// \return An \c HRESULT error code. /// /// \if UNICODE /// \sa RichTextBoxCtlLibU::_IRichTextBoxEvents::TextChanged, RichTextBox::Raise_TextChanged /// \else /// \sa RichTextBoxCtlLibA::_IRichTextBoxEvents::TextChanged, RichTextBox::Raise_TextChanged /// \endif HRESULT Fire_TextChanged(void) { HRESULT hr = S_OK; // invoke the event for each connection point for(int i = 0; i < m_vec.GetSize(); ++i) { LPDISPATCH pConnection = static_cast<LPDISPATCH>(m_vec.GetAt(i)); if(pConnection) { // invoke the event DISPPARAMS params = {NULL, NULL, 0, 0}; hr = pConnection->Invoke(DISPID_RTBE_TEXTCHANGED, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &params, NULL, NULL, NULL); } } return hr; } /// \brief <em>Fires the \c TruncatedText event</em> /// /// \return An \c HRESULT error code. /// /// \if UNICODE /// \sa RichTextBoxCtlLibU::_IRichTextBoxEvents::TruncatedText, RichTextBox::Raise_TruncatedText /// \else /// \sa RichTextBoxCtlLibA::_IRichTextBoxEvents::TruncatedText, RichTextBox::Raise_TruncatedText /// \endif HRESULT Fire_TruncatedText(void) { HRESULT hr = S_OK; // invoke the event for each connection point for(int i = 0; i < m_vec.GetSize(); ++i) { LPDISPATCH pConnection = static_cast<LPDISPATCH>(m_vec.GetAt(i)); if(pConnection) { // invoke the event DISPPARAMS params = {NULL, NULL, 0, 0}; hr = pConnection->Invoke(DISPID_RTBE_TRUNCATEDTEXT, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &params, NULL, NULL, NULL); } } return hr; } /// \brief <em>Fires the \c XClick event</em> /// /// \param[in] pTextRange A \c IRichTextRange object wrapping the clicked text. /// \param[in] button The mouse buttons that were pressed during the click. This should always be /// constant defined by the \c ExtendedMouseButtonConstants enumeration. /// \param[in] shift The modifier keys (Shift, Ctrl, Alt) that were pressed during the click. Any /// combination of the values defined by VB's \c ShiftConstants enumeration is valid. /// \param[in] x The x-coordinate (in pixels) of the click's position relative to the control's /// upper-left corner. /// \param[in] y The y-coordinate (in pixels) of the click's position relative to the control's /// upper-left corner. /// \param[in] hitTestDetails The part of the control that was clicked. Any of the values defined /// by the \c HitTestConstants enumeration is valid. /// /// \return An \c HRESULT error code. /// /// \if UNICODE /// \sa RichTextBoxCtlLibU::_IRichTextBoxEvents::XClick, RichTextBox::Raise_XClick, Fire_XDblClick, /// Fire_Click, Fire_MClick, Fire_RClick /// \else /// \sa RichTextBoxCtlLibA::_IRichTextBoxEvents::XClick, RichTextBox::Raise_XClick, Fire_XDblClick, /// Fire_Click, Fire_MClick, Fire_RClick /// \endif HRESULT Fire_XClick(IRichTextRange* pTextRange, SHORT button, SHORT shift, OLE_XPOS_PIXELS x, OLE_YPOS_PIXELS y, HitTestConstants hitTestDetails) { HRESULT hr = S_OK; // invoke the event for each connection point for(int i = 0; i < m_vec.GetSize(); ++i) { LPDISPATCH pConnection = static_cast<LPDISPATCH>(m_vec.GetAt(i)); if(pConnection) { CComVariant p[6]; p[5] = pTextRange; p[4] = button; p[4].vt = VT_I2; p[3] = shift; p[3].vt = VT_I2; p[2] = x; p[2].vt = VT_XPOS_PIXELS; p[1] = y; p[1].vt = VT_YPOS_PIXELS; p[0].lVal = static_cast<LONG>(hitTestDetails); p[0].vt = VT_I4; // invoke the event DISPPARAMS params = {p, NULL, 6, 0}; hr = pConnection->Invoke(DISPID_RTBE_XCLICK, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &params, NULL, NULL, NULL); } } return hr; } /// \brief <em>Fires the \c XDblClick event</em> /// /// \param[in] pTextRange A \c IRichTextRange object wrapping the double-clicked text. /// \param[in] button The mouse buttons that were pressed during the double-click. This should /// always be a constant defined by the \c ExtendedMouseButtonConstants enumeration. /// \param[in] shift The modifier keys (Shift, Ctrl, Alt) that were pressed during the double-click. /// Any combination of the values defined by VB's \c ShiftConstants enumeration is valid. /// \param[in] x The x-coordinate (in pixels) of the double-click's position relative to the control's /// upper-left corner. /// \param[in] y The y-coordinate (in pixels) of the double-click's position relative to the control's /// upper-left corner. /// \param[in] hitTestDetails The part of the control that was double-clicked. Any of the values defined /// by the \c HitTestConstants enumeration is valid. /// /// \return An \c HRESULT error code. /// /// \if UNICODE /// \sa RichTextBoxCtlLibU::_IRichTextBoxEvents::XDblClick, RichTextBox::Raise_XDblClick, Fire_XClick, /// Fire_DblClick, Fire_MDblClick, Fire_RDblClick /// \else /// \sa RichTextBoxCtlLibA::_IRichTextBoxEvents::XDblClick, RichTextBox::Raise_XDblClick, Fire_XClick, /// Fire_DblClick, Fire_MDblClick, Fire_RDblClick /// \endif HRESULT Fire_XDblClick(IRichTextRange* pTextRange, SHORT button, SHORT shift, OLE_XPOS_PIXELS x, OLE_YPOS_PIXELS y, HitTestConstants hitTestDetails) { HRESULT hr = S_OK; // invoke the event for each connection point for(int i = 0; i < m_vec.GetSize(); ++i) { LPDISPATCH pConnection = static_cast<LPDISPATCH>(m_vec.GetAt(i)); if(pConnection) { CComVariant p[6]; p[5] = pTextRange; p[4] = button; p[4].vt = VT_I2; p[3] = shift; p[3].vt = VT_I2; p[2] = x; p[2].vt = VT_XPOS_PIXELS; p[1] = y; p[1].vt = VT_YPOS_PIXELS; p[0].lVal = static_cast<LONG>(hitTestDetails); p[0].vt = VT_I4; // invoke the event DISPPARAMS params = {p, NULL, 6, 0}; hr = pConnection->Invoke(DISPID_RTBE_XDBLCLICK, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &params, NULL, NULL, NULL); } } return hr; } }; // Proxy_IRichTextBoxEvents
46.898955
335
0.668839
[ "object" ]
167b39c66da31cd64b12477ad6c61304d98c7b2f
24,923
c
C
kethu.c
zetolhousa/kethu
f5677cc5557318fc3ea15089dc70fa1074e23a98
[ "BSD-2-Clause" ]
null
null
null
kethu.c
zetolhousa/kethu
f5677cc5557318fc3ea15089dc70fa1074e23a98
[ "BSD-2-Clause" ]
null
null
null
kethu.c
zetolhousa/kethu
f5677cc5557318fc3ea15089dc70fa1074e23a98
[ "BSD-2-Clause" ]
null
null
null
//feature test macros: explicitly requesting additional features by defining one or more of the feature macros #define _DEFAULT_SOURCE ////If you define this macro, most features are included apart from X/Open, LFS and GNU extensions: the effect is to enable features from the 2008 edition of POSIX, as well as certain BSD and SVID features without a separate feature test macro to control them. #define _BSD_SOURCE #define _GNU_SOURCE //If you define this macro, everything is included: ISO C89, ISO C99, POSIX.1, POSIX.2, BSD, SVID, X/Open, LFS, and GNU extensions. In the cases where POSIX.1 conflicts with BSD, the POSIX definitions take precedence. /*** includes ***/ #include <ctype.h> #include <errno.h> #include <fcntl.h> #include <stdio.h> #include <stdarg.h> #include <stdlib.h> //atexit() #include <string.h> //memcpy() #include <sys/ioctl.h> //to get size of terminal with TIOCGWINSZ #include <sys/types.h> #include <termios.h> //terminal settings #include <time.h> #include <unistd.h> /*** defines ***/ #define KETHU_VERSION "0.0.1" #define KETHU_TAB_STOP 8 #define KILO_QUIT_TIMES 3 #define CTRL_KEY(k) ((k) & 0x1f) //bitwise ANDs char with 0x1f(00011111) //upper 3bits of character made 0, mirroring what ctrl key does in terminal, it strips bit 5 and 6 from whatever key pressed in combo with ctrl and sends that. //notice: first 4bits of both upper and lower case are same. enum editorKey { BACKSPACE = 127, ARROW_LEFT = 1000, //1000 ARROW_RIGHT, //1001 ARROW_UP, //1002 ARROW_DOWN, //1003 DEL_KEY, HOME_KEY, END_KEY, PAGE_UP, PAGE_DOWN }; /*** data ***/ typedef struct erow { int size; int rsize; char *chars; char *render; } erow; struct editorConfig { //to store editor state int cx, cy; //store position of cursor int rx; //position of cursor on the render field int rowoff; //keep track of row offset in file the user in currently at int coloff; //keep track of col offset in file int screenrows; //number of rows visible in terminal int screencols; //number of cols visible in terminal int numrows; //number of rows in file opened erow *row; //struct to store each row in file int dirty; char *filename; char statusmsg[80]; time_t statusmsg_time; struct termios orig_termios; }; struct editorConfig E; /*** prototypes ***/ void editorSetStatusMessage(const char *fmt, ...); void editorRefreshScreen(); char *editorPrompt(char *prompt); /*** terminal ***/ void die(const char *s) { write(STDOUT_FILENO, "\x1b[2J", 4); //clear screen write(STDOUT_FILENO, "\x1b[H", 3); //reposition cursor perror(s); //C lib funcs on failing set global errno var. perror() looks at the value and prints apt msg exit(1); //nonzero means unsuccesful exectution } void disableRawMode() { if (tcsetattr(STDIN_FILENO, TCSAFLUSH, &E.orig_termios) == -1) die("tcsetattr"); } void enableRawMode() { if (tcgetattr(STDIN_FILENO, &E.orig_termios) == -1) die("tcgetattr"); atexit(disableRawMode); struct termios raw = E.orig_termios; raw.c_iflag &= ~(BRKINT | ICRNL | INPCK | ISTRIP | IXON); //misc flags included raw.c_oflag &= ~(OPOST); //turn off all output processing raw.c_cflag |= (CS8); //misc mask with multiple bits raw.c_lflag &= ~(ECHO | ICANON | IEXTEN | ISIG); raw.c_cc[VMIN] = 0; //defines min bytes to input before read() returns raw.c_cc[VTIME] = 1; //defines max amount of time to wait before read() returns. Here 1/10s or 100ms. After timeout returns 0 //Here in WSL read() still gets blocked and gives no shit about VTIME, but it won't matter later if (tcsetattr(STDIN_FILENO, TCSAFLUSH, &raw) == -1) die("tcsetattr"); //call die() on error } int editorReadKey() { //job is to wait for ONE keypress and return it int nread; char c; while ((nread = read(STDIN_FILENO, &c, 1)) != 1) { //as long as error keep trying if (nread == -1 && errno != EAGAIN) die("read"); //but if <cond> then exit. } if (c == '\x1b') { //if ESC character is read from above char seq[3]; //Here only 2 used by 3B just for future purposes // !=1 is used because read() returns 0 if when starting at the current file offset, the file offset if detected to be at or past the EOF 0B are read. if (read(STDIN_FILENO, &seq[0], 1) != 1) return '\x1b'; //then read() another byte and put into seq[0] : for 2nd Byte of ESC seq '[' but IF read()!=1, unsuccesful read(because offset beyond EOF) return only ESC char if (read(STDIN_FILENO, &seq[1], 1) != 1) return '\x1b'; //and read() another byte and put into seq[1] : for the last Byte of ESC seq but IF read()!=1, unsuccesful read(because offset beyond EOF) return only ESC char if (seq[0] == '[') { //if we get this far it means 3B have been read succesfully. 1st Byte c='\x1b' | 2nd Byte seq[0] | 3rd Byte seq[1] if (seq[1] >= '0' && seq[1] <= '9') { if (read(STDIN_FILENO, &seq[2], 1) != 1) return '\x1b'; //read() 3rd Byte(does not include ESC char), if a Byte is not read succesfully then return ESC char if (seq[2] == '~') { //condition for pageUp and pageDown, which take the following format: '\x1b[5~' and '\x1b[6~' switch (seq[1]) { case '1': return HOME_KEY; //<esc>[1~, <esc>[7~, <esc>[H, or <esc>OH case '3': return DEL_KEY; case '4': return END_KEY; //<esc>[4~, <esc>[8~, <esc>[F, or <esc>OF case '5': return PAGE_UP; case '6': return PAGE_DOWN; case '7': return HOME_KEY; case '8': return END_KEY; } } } else { switch (seq[1]) { case 'A': return ARROW_UP; case 'B': return ARROW_DOWN; case 'C': return ARROW_RIGHT; case 'D': return ARROW_LEFT; case 'H': return HOME_KEY; //<esc>[H case 'F': return END_KEY; //<esc>[F } } } else if (seq[0] == 'O') { switch (seq[1]) { case 'H': return HOME_KEY; //<esc>OH case 'F': return END_KEY; //<esc>OF } } return '\x1b'; } else { //else if normal character return it return c; } } int getCursorPosition(int *rows, int *cols) { char buf[32]; unsigned int i = 0; if (write(STDOUT_FILENO, "\x1b[6n", 4) != 4) return -1; //write to stdout while (i < sizeof(buf) - 1) { if (read(STDIN_FILENO, &buf[i], 1) != 1) break; //read output result from stdin and store into buf one at a time if (buf[i] == 'R') break; //break out when we read 'R' (part of the command) i++; } buf[i] = '\0'; //'R' replaced with null character if (buf[0] != '\x1b' || buf[1] != '[') return -1; //make sure response is in ESC seq form, else on error return -1 if (sscanf(&buf[2], "%d;%d", rows, cols) != 2) return -1; //next we start from 3rd Byte, which comes after '\x1b['. So string format is in the from '24;130' and sscanf() reads that appropriately return 0; //and pass it into rows and cols variables. } int getWindowSize(int *rows, int *cols) { struct winsize ws; if (ioctl(STDOUT_FILENO, TIOCGWINSZ, &ws) == -1 || ws.ws_col == 0) { //removed prior 1 || conditions if (write(STDOUT_FILENO, "\x1b[999C\x1b[999B", 12) != 12) return -1; return getCursorPosition(rows, cols); } else { *cols = ws.ws_col; *rows = ws.ws_row; return 0; } } /*** row operations ***/ int editorRowCxToRx(erow *row, int cx) { //converts chars index into render index int rx = 0; int j; for (j = 0; j < cx; j++) { if (row->chars[j] == '\t') rx += (KETHU_TAB_STOP - 1) - (rx % KETHU_TAB_STOP); rx++; } return rx; } void editorUpdateRow(erow *row) { //cleanup the tabs int tabs = 0; int j; for (j = 0; j < row->size; j++) if (row->chars[j] == '\t') tabs++; free(row->render); row->render = malloc(row->size + tabs*(KETHU_TAB_STOP-1) + 1); //*7 because tab is counted only as one entity(of width=8 but row->size already has +1 for each tab so *7 and not *8) //but we need to break thar up into spaces the width of a tab so we allocate that much space //and end with +1 to accomodate null char '\0' int idx = 0; for (j = 0; j < row->size; j++) { //for each char in row (tab is also a single char) if (row->chars[j] == '\t') { //if tab found in chars row->render[idx++] = ' '; //add ' ' in render while (idx % KETHU_TAB_STOP != 0) row->render[idx++] = ' '; //and modulate for possible remaining whitepaces to reach width of 8. Eg: "Hello\tWorld" would be "Hello---World". Since at 'o' idx=5 and 5/8 till 8/8 will be filled with ' ' } else { //else normal copy row->render[idx++] = row->chars[j]; } } //idx now is the size of characters in render. Suppose idx=11, we allocated +1 space so total length = 12 row->render[idx] = '\0'; //make 11 index as null character to signal end row->rsize = idx; //does not include '\0'?? } void editorInsertRow(int at, char *s, size_t len) { if (at < 0 || at > E.numrows) return; E.row = realloc(E.row, sizeof(erow) * (E.numrows + 1)); memmove(&E.row[at + 1], &E.row[at], sizeof(erow) * (E.numrows - at)); E.row[at].size = len; E.row[at].chars = malloc(len + 1); memcpy(E.row[at].chars, s, len); E.row[at].chars[len] = '\0'; E.row[at].rsize = 0; E.row[at].render = NULL; editorUpdateRow(&E.row[at]); E.numrows++; E.dirty++; } void editorFreeRow(erow *row) { //free up mem for a row free(row->render); free(row->chars); } void editorDelRow(int at) { //replace freed up row with rows below it if (at < 0 || at >= E.numrows) return; editorFreeRow(&E.row[at]); memmove(&E.row[at], &E.row[at + 1], sizeof(erow) * (E.numrows - at - 1)); //move all rows that comes after deleted row to 'at' E.numrows--; E.dirty++; } void editorRowInsertChar(erow *row, int at, int c) { if (at < 0 || at > row->size) at = row->size; row->chars = realloc(row->chars, row->size + 2); // +1 for new char +1 for nullchar memmove(&row->chars[at + 1], &row->chars[at], row->size - at + 1); //(dest, src, size) works like strcpy but for overlapping locations row->size++; row->chars[at] = c; editorUpdateRow(row); E.dirty++; } void editorRowAppendString(erow *row, char *s, size_t len) { //append for backspacing a row to the upper row row->chars = realloc(row->chars, row->size + len + 1); //space for the row + nullchar memcpy(&row->chars[row->size], s, len); //append to that row row->size += len; //new size row->chars[row->size] = '\0'; editorUpdateRow(row); E.dirty++; } void editorRowDelChar(erow *row, int at) { if (at < 0 || at >= row->size) return; memmove(&row->chars[at], &row->chars[at + 1], row->size - at); row->size--; editorUpdateRow(row); E.dirty++; } /*** editor operations ***/ void editorInsertChar(int c) { if (E.cy == E.numrows) { //means that cursor is on the last line, the ~ line editorInsertRow(E.numrows, "", 0); //insert an empty row } editorRowInsertChar(&E.row[E.cy], E.cx, c); E.cx++; } void editorInsertNewline() { if (E.cx == 0) { editorInsertRow(E.cy, "", 0); } else { erow *row = &E.row[E.cy]; editorInsertRow(E.cy + 1, &row->chars[E.cx], row->size - E.cx); //move all chars from current cursor position to the next row row = &E.row[E.cy]; //row now points to remaining lines before enter pressed (reassigned again because realloc() in editorInsertRow() changes mem locations) row->size = E.cx; //and we give it appropriate size row->chars[row->size] = '\0'; //end with nullchar editorUpdateRow(row); } E.cy++; //then go to the next line E.cx = 0; } void editorDelChar() { if (E.cy == E.numrows) return; if (E.cx == 0 && E.cy == 0) return; erow *row = &E.row[E.cy]; if (E.cx > 0) { editorRowDelChar(row, E.cx - 1); E.cx--; } else { E.cx = E.row[E.cy - 1].size; //last col of prev line editorRowAppendString(&E.row[E.cy - 1], row->chars, row->size); editorDelRow(E.cy); E.cy--; } } /*** file i/o ***/ char *editorRowsToString(int *buflen) { int totlen = 0; int j; for (j = 0; j < E.numrows; j++) totlen += E.row[j].size + 1; //lengths of all rows summed up in totlen and +1 for newline character *buflen = totlen; //tell caller how long char *buf = malloc(totlen); //allocate space for all characters char *p = buf; //to keep *buf pointing to start of mem and let *p do the moving for (j = 0; j < E.numrows; j++) { memcpy(p, E.row[j].chars, E.row[j].size); //copy one row onto *buf p += E.row[j].size; //move ahead required Bytes for the row *p = '\n'; //add newline to that row p++; //moving onto the next row } return buf; //return mem location } void editorOpen(char *filename) { free(E.filename); E.filename = strdup(filename); //makes copy of given string, also allocates required mem but has to be free() after use FILE *fp = fopen(filename, "r"); if (!fp) die("fopen"); char *line = NULL; size_t linecap = 0; ssize_t linelen; while ((linelen = getline(&line, &linecap, fp)) != -1) { //-1 when end of file while (linelen > 0 && (line[linelen - 1] == '\n' || line[linelen - 1] == '\r')) //removing all the newlines? linelen--; editorInsertRow(E.numrows, line, linelen); } free(line); fclose(fp); E.dirty = 0; } void editorSave() { if (E.filename == NULL) { E.filename = editorPrompt("Save as: %s (ESC to cancel)"); if (E.filename == NULL) { editorSetStatusMessage("Save aborted"); return; } } int len; char *buf = editorRowsToString(&len); int fd = open(E.filename, O_RDWR | O_CREAT, 0644); if (fd != -1) { if (ftruncate(fd, len) != -1) { if (write(fd, buf, len) == len) { close(fd); free(buf); E.dirty = 0; editorSetStatusMessage("%d bytes written to disk", len); return; } } close(fd); } free(buf); editorSetStatusMessage("Can't save! I/O error: %s", strerror(errno)); } /*** append buffer ***/ struct abuf { //struct to buffer all output and write it out only later char *b; //pointer to buffer in memory int len; //length }; #define ABUF_INIT {NULL, 0} //acts as constructor for abuf type void abAppend(struct abuf *ab, const char *s, int len) { char *new = realloc(ab->b, ab->len + len); //realloc memory block where size is old len + new len if (new == NULL) return; memcpy(&new[ab->len], s, len); //(dest, src, size) Here we copy s after the end of old data ab->b = new; //updating pointer ab->len += len; //and new length } void abFree(struct abuf *ab) { //Destructor free(ab->b); } /*** output ***/ void editorScroll() { E.rx = 0; if (E.cy < E.numrows) { E.rx = editorRowCxToRx(&E.row[E.cy], E.cx); } if (E.cy < E.rowoff) { E.rowoff = E.cy; } if (E.cy >= E.rowoff + E.screenrows) { E.rowoff = E.cy - E.screenrows + 1; } if (E.rx < E.coloff) { E.coloff = E.rx; } if (E.rx >= E.coloff + E.screencols) { E.coloff = E.rx - E.screencols + 1; } } void editorDrawRows(struct abuf *ab) { int y; for (y = 0; y < E.screenrows; y++) { int filerow = y + E.rowoff; //offset. y ranges from top to bottom of visible screen eg: in a 50*200 terminal y->{0...49} //On update of rowoff=1(from above function) filerow will now be =0+1=1. Therefore dispay on terminal will start from 2nd line of file. Basically scrolled one row down. if (filerow >= E.numrows) { //when current row greater than or equal to number of row in text file we start inserting '~' for the rest of the empty lines. if (E.numrows == 0 && y == E.screenrows / 3) { //only when there is no file opened (and we are 1/3 of the way down) we display welcome text char welcome[80]; int welcomelen = snprintf(welcome, sizeof(welcome), "Kethu editor -- version %s", KETHU_VERSION); if (welcomelen > E.screencols) welcomelen = E.screencols; int padding = (E.screencols - welcomelen) / 2; if (padding) { abAppend(ab, "~", 1); padding--; } while (padding--) abAppend(ab, " ", 1); //insert empty spaces in line before the welcome text follows abAppend(ab, welcome, welcomelen); } else { abAppend(ab, "~", 1); } } else { //or else display the row of text in file int len = E.row[filerow].rsize - E.coloff; if (len < 0) len = 0; if (len > E.screencols) len = E.screencols; abAppend(ab, &E.row[filerow].render[E.coloff], len); } abAppend(ab, "\x1b[K", 3); abAppend(ab, "\r\n", 2); } } void editorDrawStatusBar(struct abuf *ab) { abAppend(ab, "\x1b[7m", 4); //graphicRendition(m) command switches to inverted colors. 1-bold, 4-underscore, 5-blink, 7-invert char status[80], rstatus[80]; int len = snprintf(status, sizeof(status), "%.20s - %d lines %s", E.filename ? E.filename : "[No Name]", E.numrows, E.dirty ? "(modified)" : ""); int rlen = snprintf(rstatus, sizeof(rstatus), "%d/%d", E.cy + 1, E.numrows); //current line no out of total lines if (len > E.screencols) len = E.screencols; abAppend(ab, status, len); while (len < E.screencols) { if (E.screencols - len == rlen) { abAppend(ab, rstatus, rlen); break; } else { abAppend(ab, " ", 1); //add spaces until we just have enough length left for rstatus len++; } } abAppend(ab, "\x1b[m", 3); //switches back to normal. Using no args clears all set attributes abAppend(ab, "\r\n", 2); } void editorDrawMessageBar(struct abuf *ab) { abAppend(ab, "\x1b[K", 3); int msglen = strlen(E.statusmsg); if (msglen > E.screencols) msglen = E.screencols; if (msglen && time(NULL) - E.statusmsg_time < 5) //show statusmsg while diff between time when msg was set and current time(updated every refresh) is within 5secs abAppend(ab, E.statusmsg, msglen); } void editorRefreshScreen() { editorScroll(); struct abuf ab = ABUF_INIT; abAppend(&ab, "\x1b[?25l", 6); //resetMode(l) command to turn off features/modes. '?25l' cursor hiding //abAppend(&ab, "\x1b[2J", 4); REMOVED and instead clear as we redraw on line at a time abAppend(&ab, "\x1b[H", 3); editorDrawRows(&ab); editorDrawStatusBar(&ab); editorDrawMessageBar(&ab); char buf[32]; snprintf(buf, sizeof(buf), "\x1b[%d;%dH", (E.cy-E.rowoff) + 1, (E.rx-E.coloff) + 1); //Display cursor position. Updated!!! abAppend(&ab, buf, strlen(buf)); abAppend(&ab, "\x1b[?25h", 6); //setMode(h) command to turn on. '?25h' cursor show. If hide/show feature not supported, ESC seq just ignored. No big deal write(STDOUT_FILENO, ab.b, ab.len); abFree(&ab); } void editorSetStatusMessage(const char *fmt, ...) { va_list ap; va_start(ap, fmt); vsnprintf(E.statusmsg, sizeof(E.statusmsg), fmt, ap); //writes to E.statusmsg still the given sizeof(). The content is given by format(fmt) with argument pointer(ap) va_end(ap); E.statusmsg_time = time(NULL); } /*** input ***/ char *editorPrompt(char *prompt) { size_t bufsize = 128; char *buf = malloc(bufsize); size_t buflen = 0; buf[0] = '\0'; while (1) { editorSetStatusMessage(prompt, buf); editorRefreshScreen(); int c = editorReadKey(); if (c == DEL_KEY || c == CTRL_KEY('h') || c == BACKSPACE) { //backspace and delete while entering filename if (buflen != 0) buf[--buflen] = '\0'; } else if (c == '\x1b') { //ESC key pressed editorSetStatusMessage(""); free(buf); return NULL; } else if (c == '\r') { //when user presses enter we get into exit protocol if (buflen != 0) { editorSetStatusMessage(""); //clear/reset status message before returning value return buf; } } else if (!iscntrl(c) && c < 128) { //is char is not a control char and it is printable char if (buflen == bufsize - 1) { //is user input length reaches alloted size we double allotment bufsize *= 2; buf = realloc(buf, bufsize); } buf[buflen++] = c; buf[buflen] = '\0'; } } } void editorMoveCursor(int key) { erow *row = (E.cy >= E.numrows)? NULL : &E.row[E.cy]; //pointer to row at current line switch (key) { case ARROW_LEFT: if (E.cx != 0) { //only if cursor is not at leftmost of screen E.cx--; } else if(E.cy > 0) { E.cy--; E.cx = E.row[E.cy].size; } break; case ARROW_RIGHT: if (row && E.cx < row->size) { //if row exists and cursor does not cross right limit E.cx++; } else if(row && E.cx == row->size) { E.cy++; E.cx = 0; } break; case ARROW_UP: if (E.cy != 0) { //only if cursor is not at top of screen E.cy--; } break; case ARROW_DOWN: if (E.cy < E.numrows) { //if cursor pos is smaller than the number of rows in text E.cy++; } break; } //snapping to the rightmost of current line row = (E.cy >= E.numrows) ? NULL : &E.row[E.cy]; //if cursor on valid row | another row assignment because cursor E.cy just changed line from above int rowlen = row ? row->size : 0; //if row valid then assing size of that row if (E.cx > rowlen) { //if cursor past the rows length E.cx = rowlen; //assign length of current row to cursor value } //else cursor position from previos row remains } void editorProcessKeypress() { //get keypress from editorReadKey() and handles it as needed static int quit_times = KILO_QUIT_TIMES; int c = editorReadKey(); switch (c) { case '\r': editorInsertNewline(); break; case CTRL_KEY('q'): if (E.dirty && quit_times > 0) { editorSetStatusMessage("WARNING!!! File has unsaved changes. " "Press Ctrl-Q %d more times to quit.", quit_times); quit_times--; return; } write(STDOUT_FILENO, "\x1b[2J", 4); //clear screen write(STDOUT_FILENO, "\x1b[H", 3); //reposition cursor exit(0); //0 is success in terms of program execution but 0 is FALSE in terms of boolean break; case CTRL_KEY('s'): editorSave(); break; case HOME_KEY: E.cx = 0; break; case END_KEY: if (E.cy < E.numrows) E.cx = E.row[E.cy].size; //end of current row and not rightmost of screen break; case BACKSPACE: case CTRL_KEY('h'): case DEL_KEY: if (c == DEL_KEY) editorMoveCursor(ARROW_RIGHT); editorDelChar(); break; case PAGE_UP: case PAGE_DOWN: { //this block of braces is used because declaring vars directly is not allowed if (c == PAGE_UP) { E.cy = E.rowoff; } else if (c == PAGE_DOWN) { E.cy = E.rowoff + E.screenrows - 1; if (E.cy > E.numrows) E.cy = E.numrows; } int times = E.screenrows; while (times--) //for now pageUp is aliased as multiple Downs arrow till we reach bottom vice versa for pageUp editorMoveCursor(c == PAGE_UP ? ARROW_UP : ARROW_DOWN); } break; case ARROW_UP: case ARROW_DOWN: case ARROW_LEFT: case ARROW_RIGHT: editorMoveCursor(c); break; case CTRL_KEY('l'): case '\x1b': break; default: editorInsertChar(c); break; } quit_times = KILO_QUIT_TIMES; //in the midst of quiting if user press another key the count is reset } /*** init ***/ void initEditor() { //func to init fields in struct E E.cx = 0; E.cy = 0; E.rx = 0; E.rowoff = 0; //scroll to top by default initially E.coloff = 0; //beginning of line E.numrows = 0; //temporary E.row = NULL; E.dirty = 0; E.filename = NULL; E.statusmsg[0] = '\0'; E.statusmsg_time = 0; if (getWindowSize(&E.screenrows, &E.screencols) == -1) die("getWindowSize"); E.screenrows -=2; } int main(int argc, char *argv[]) { enableRawMode(); initEditor(); if (argc >= 2) { editorOpen(argv[1]); //open the file if arg provided else a blank file } editorSetStatusMessage("HELP: Ctrl-S = save | Ctrl-Q = quit"); while (1) { editorRefreshScreen(); //renders screen editorProcessKeypress(); //takes in keypress and process it } return 0; }
35.757532
284
0.596638
[ "render" ]
1683e7df4cbf0c265c44879e3269f1eead1fdb64
33,104
c
C
modules/module-lua-scripting/pod.c
PipeWire/wireplumber
51713d309a08d1040d883a226d0f82a832c7eb2d
[ "MIT" ]
10
2020-02-02T18:18:47.000Z
2022-03-29T13:22:46.000Z
modules/module-lua-scripting/pod.c
PipeWire/wireplumber
51713d309a08d1040d883a226d0f82a832c7eb2d
[ "MIT" ]
6
2021-06-01T09:31:09.000Z
2022-03-14T13:18:42.000Z
modules/module-lua-scripting/pod.c
PipeWire/wireplumber
51713d309a08d1040d883a226d0f82a832c7eb2d
[ "MIT" ]
1
2020-10-11T08:30:59.000Z
2020-10-11T08:30:59.000Z
/* WirePlumber * * Copyright © 2021 Collabora Ltd. * @author Julian Bouzas <julian.bouzas@collabora.com> * * SPDX-License-Identifier: MIT */ #include <wp/wp.h> #include <wplua/wplua.h> #include <spa/utils/type.h> #define MAX_LUA_TYPES 9 /* Builder */ typedef gboolean (*primitive_lua_add_func) (WpSpaPodBuilder *, WpSpaIdValue, lua_State *, int); struct primitive_lua_type { WpSpaType primitive_type; primitive_lua_add_func primitive_lua_add_funcs[MAX_LUA_TYPES]; }; static inline gboolean builder_add_boolean_lua_boolean (WpSpaPodBuilder *b, WpSpaIdValue key_id, lua_State *L, int idx) { wp_spa_pod_builder_add_boolean (b, lua_toboolean (L, idx)); return TRUE; } static inline gboolean builder_add_boolean_lua_number (WpSpaPodBuilder *b, WpSpaIdValue key_id, lua_State *L, int idx) { if (lua_isinteger (L, idx)) { wp_spa_pod_builder_add_boolean (b, lua_tointeger (L, idx) > 0); return TRUE; } return FALSE; } static inline gboolean builder_add_boolean_lua_string (WpSpaPodBuilder *b, WpSpaIdValue key_id, lua_State *L, int idx) { const gchar *value = lua_tostring (L, idx); wp_spa_pod_builder_add_boolean (b, g_strcmp0 (value, "true") == 0 || g_strcmp0 (value, "1") == 0); return TRUE; } static inline gboolean builder_add_id_lua_number (WpSpaPodBuilder *b, WpSpaIdValue key_id, lua_State *L, int idx) { if (lua_isinteger (L, idx)) { wp_spa_pod_builder_add_id (b, lua_tointeger (L, idx)); return TRUE; } return FALSE; } static inline gboolean builder_add_id_lua_string (WpSpaPodBuilder *b, WpSpaIdValue key_id, lua_State *L, int idx) { const gchar *value = lua_tostring (L, idx); WpSpaIdTable id_table = NULL; WpSpaIdValue id_val = NULL; if (key_id) { wp_spa_id_value_get_value_type (key_id, &id_table); if (id_table) { id_val = wp_spa_id_table_find_value_from_short_name (id_table, value); wp_spa_pod_builder_add_id (b, wp_spa_id_value_number (id_val)); return TRUE; } } return FALSE; } static inline gboolean builder_add_int_lua_boolean (WpSpaPodBuilder *b, WpSpaIdValue key_id, lua_State *L, int idx) { gboolean value = lua_toboolean (L, idx); wp_spa_pod_builder_add_int (b, value ? 1 : 0); return TRUE; } static inline gboolean builder_add_int_lua_number (WpSpaPodBuilder *b, WpSpaIdValue key_id, lua_State *L, int idx) { if (lua_isinteger (L, idx)) { wp_spa_pod_builder_add_int (b, lua_tointeger (L, idx)); return TRUE; } return FALSE; } static inline gboolean builder_add_int_lua_string (WpSpaPodBuilder *b, WpSpaIdValue key_id, lua_State *L, int idx) { const gchar *value = lua_tostring (L, idx); wp_spa_pod_builder_add_int (b, strtol (value, NULL, 10)); return TRUE; } static inline gboolean builder_add_long_lua_boolean (WpSpaPodBuilder *b, WpSpaIdValue key_id, lua_State *L, int idx) { gboolean value = lua_toboolean (L, idx); wp_spa_pod_builder_add_long (b, value ? 1 : 0); return TRUE; } static inline gboolean builder_add_long_lua_number (WpSpaPodBuilder *b, WpSpaIdValue key_id, lua_State *L, int idx) { if (lua_isinteger (L, idx)) { wp_spa_pod_builder_add_long (b, lua_tointeger (L, idx)); return TRUE; } return FALSE; } static inline gboolean builder_add_long_lua_string (WpSpaPodBuilder *b, WpSpaIdValue key_id, lua_State *L, int idx) { const gchar *value = lua_tostring (L, idx); wp_spa_pod_builder_add_long (b, strtol (value, NULL, 10)); return TRUE; } static inline gboolean builder_add_float_lua_boolean (WpSpaPodBuilder *b, WpSpaIdValue key_id, lua_State *L, int idx) { gboolean value = lua_toboolean (L, idx); wp_spa_pod_builder_add_float (b, value ? 1.0f : 0.0f); return TRUE; } static inline gboolean builder_add_float_lua_number (WpSpaPodBuilder *b, WpSpaIdValue key_id, lua_State *L, int idx) { if (lua_isnumber (L, idx) && !lua_isinteger (L, idx)) { wp_spa_pod_builder_add_float (b, lua_tonumber (L, idx)); return TRUE; } return FALSE; } static inline gboolean builder_add_double_lua_boolean (WpSpaPodBuilder *b, WpSpaIdValue key_id, lua_State *L, int idx) { gboolean value = lua_toboolean (L, idx); wp_spa_pod_builder_add_double (b, value ? 1.0f : 0.0f); return TRUE; } static inline gboolean builder_add_double_lua_number (WpSpaPodBuilder *b, WpSpaIdValue key_id, lua_State *L, int idx) { if (lua_isnumber (L, idx) && !lua_isinteger (L, idx)) { wp_spa_pod_builder_add_double (b, lua_tonumber (L, idx)); return TRUE; } return FALSE; } static inline gboolean builder_add_string_lua_boolean (WpSpaPodBuilder *b, WpSpaIdValue key_id, lua_State *L, int idx) { gboolean value = lua_toboolean (L, idx); wp_spa_pod_builder_add_string (b, value ? "true" : "false"); return TRUE; } static inline gboolean builder_add_string_lua_number (WpSpaPodBuilder *b, WpSpaIdValue key_id, lua_State *L, int idx) { g_autofree gchar *value = NULL; value = lua_isinteger (L, idx) ? g_strdup_printf ("%lld", lua_tointeger (L, idx)) : g_strdup_printf ("%f", lua_tonumber (L, idx)); wp_spa_pod_builder_add_string (b, value); return TRUE; } static inline gboolean builder_add_string_lua_string (WpSpaPodBuilder *b, WpSpaIdValue key_id, lua_State *L, int idx) { const gchar *value = lua_tostring (L, idx); wp_spa_pod_builder_add_string (b, value); return TRUE; } static inline gboolean builder_add_bytes_lua_number (WpSpaPodBuilder *b, WpSpaIdValue key_id, lua_State *L, int idx) { if (lua_isinteger (L, idx)) { gint64 value = lua_tointeger (L, idx); wp_spa_pod_builder_add_bytes (b, (gconstpointer)&value, sizeof (value)); } else { double value = lua_tonumber (L, idx); wp_spa_pod_builder_add_bytes (b, (gconstpointer)&value, sizeof (value)); } return TRUE; } static inline gboolean builder_add_bytes_lua_string (WpSpaPodBuilder *b, WpSpaIdValue key_id, lua_State *L, int idx) { const gchar *value = lua_tostring (L, idx); wp_spa_pod_builder_add_bytes (b, (gconstpointer)value, strlen (value)); return TRUE; } static inline gboolean builder_add_fd_lua_number (WpSpaPodBuilder *b, WpSpaIdValue key_id, lua_State *L, int idx) { if (lua_isinteger (L, idx)) { wp_spa_pod_builder_add_fd (b, lua_tointeger (L, idx)); return TRUE; } return FALSE; } static inline gboolean builder_add_fd_lua_string (WpSpaPodBuilder *b, WpSpaIdValue key_id, lua_State *L, int idx) { const gchar *value = lua_tostring (L, idx); wp_spa_pod_builder_add_fd (b, strtol (value, NULL, 10)); return TRUE; } static inline gboolean is_pod_type_compatible (WpSpaType type, WpSpaPod *pod) { /* Check if the pod type matches */ if (type == wp_spa_pod_get_spa_type (pod)) return TRUE; /* Otherwise, check if the child type of Choice pod matches */ if (wp_spa_pod_is_choice (pod)) { g_autoptr (WpSpaPod) child = wp_spa_pod_get_choice_child (pod); WpSpaType child_type = wp_spa_pod_get_spa_type (child); if (type == child_type) return TRUE; } return FALSE; } static inline gboolean builder_add_lua_userdata (WpSpaPodBuilder *b, WpSpaIdValue key_id, lua_State *L, int idx) { WpSpaPod *pod = wplua_checkboxed (L, idx, WP_TYPE_SPA_POD); if (pod) { if (key_id) { WpSpaType prop_type = wp_spa_id_value_get_value_type (key_id, NULL); if (is_pod_type_compatible (prop_type, pod)) { wp_spa_pod_builder_add_pod (b, pod); return TRUE; } } else { wp_spa_pod_builder_add_pod (b, pod); return TRUE; } } return FALSE; } static const struct primitive_lua_type primitive_lua_types[] = { {SPA_TYPE_Bool, { [LUA_TBOOLEAN] = builder_add_boolean_lua_boolean, [LUA_TNUMBER] = builder_add_boolean_lua_number, [LUA_TSTRING] = builder_add_boolean_lua_string, }}, {SPA_TYPE_Id, { [LUA_TNUMBER] = builder_add_id_lua_number, [LUA_TSTRING] = builder_add_id_lua_string, }}, {SPA_TYPE_Int, { [LUA_TBOOLEAN] = builder_add_int_lua_boolean, [LUA_TNUMBER] = builder_add_int_lua_number, [LUA_TSTRING] = builder_add_int_lua_string, }}, {SPA_TYPE_Long, { [LUA_TBOOLEAN] = builder_add_long_lua_boolean, [LUA_TNUMBER] = builder_add_long_lua_number, [LUA_TSTRING] = builder_add_long_lua_string, }}, {SPA_TYPE_Float, { [LUA_TBOOLEAN] = builder_add_float_lua_boolean, [LUA_TNUMBER] = builder_add_float_lua_number, }}, {SPA_TYPE_Double, { [LUA_TBOOLEAN] = builder_add_double_lua_boolean, [LUA_TNUMBER] = builder_add_double_lua_number, }}, {SPA_TYPE_String, { [LUA_TBOOLEAN] = builder_add_string_lua_boolean, [LUA_TNUMBER] = builder_add_string_lua_number, [LUA_TSTRING] = builder_add_string_lua_string, }}, {SPA_TYPE_Bytes, { [LUA_TNUMBER] = builder_add_bytes_lua_number, [LUA_TSTRING] = builder_add_bytes_lua_string, }}, {SPA_TYPE_Fd, { [LUA_TNUMBER] = builder_add_fd_lua_number, [LUA_TSTRING] = builder_add_fd_lua_string, }}, {0, {}}, }; static gboolean builder_add_key (WpSpaPodBuilder *b, WpSpaIdTable table, lua_State *L, int idx) { /* Number */ if (lua_type (L, -1) == LUA_TNUMBER) { wp_spa_pod_builder_add_id (b, lua_tonumber (L, idx)); return TRUE; } /* String */ else if (lua_type (L, -1) == LUA_TSTRING) { const gchar *key = lua_tostring (L, idx); WpSpaIdValue val = wp_spa_id_table_find_value_from_short_name (table, key); if (val) { wp_spa_pod_builder_add_id (b, wp_spa_id_value_number (val)); return TRUE; } } return FALSE; } static gboolean builder_add_value (WpSpaPodBuilder *b, WpSpaType array_type, lua_State *L, int idx) { int ltype = lua_type (L, idx); guint i; if (ltype < 0 || ltype >= MAX_LUA_TYPES) return FALSE; for (i = 0; primitive_lua_types[i].primitive_type; i++) { const struct primitive_lua_type *t = primitive_lua_types + i; if (t->primitive_type == array_type) { primitive_lua_add_func f = t->primitive_lua_add_funcs[ltype]; if (f) { return f (b, NULL, L, idx); } } } return FALSE; } static void builder_add_table (lua_State *L, WpSpaPodBuilder *builder) { const gchar *type_name = NULL; WpSpaType type = WP_SPA_TYPE_INVALID; WpSpaIdTable table = NULL; luaL_checktype (L, 1, LUA_TTABLE); lua_pushnil (L); while (lua_next (L, 1)) { /* First filed is always the item type or table */ if (type == WP_SPA_TYPE_INVALID && !table) { if (lua_type (L, -1) == LUA_TSTRING) { type_name = lua_tostring (L, -1); type = wp_spa_type_from_name (type_name); if (type == WP_SPA_TYPE_INVALID) { table = wp_spa_id_table_from_name (type_name); if (!table) luaL_error (L, "Unknown type '%s'", type_name); } } else { luaL_error (L, "must have the item type or table on its first field"); } } /* Add remaining table key elements */ else if (table) { if (!builder_add_key (builder, table, L, -1)) luaL_error (L, "key could not be added"); } /* Add remaining value elements */ else if (type != WP_SPA_TYPE_INVALID) { if (!builder_add_value (builder, type, L, -1)) luaL_error (L, "value could not be added"); } lua_pop (L, 1); } } /* None */ static int spa_pod_none_new (lua_State *L) { wplua_pushboxed (L, WP_TYPE_SPA_POD, wp_spa_pod_new_none ()); return 1; } /* Boolean */ static int spa_pod_boolean_new (lua_State *L) { gboolean value = lua_toboolean (L, 1); wplua_pushboxed (L, WP_TYPE_SPA_POD, wp_spa_pod_new_boolean (value)); return 1; } /* Id */ static int spa_pod_id_new (lua_State *L) { /* Id number */ if (lua_type (L, 1) == LUA_TNUMBER) { gint64 value = lua_tointeger (L, 1); wplua_pushboxed (L, WP_TYPE_SPA_POD, wp_spa_pod_new_id (value)); return 1; } /* Table name and key name */ else if (lua_type (L, 1) == LUA_TSTRING) { const gchar *table_name = lua_tostring (L, 1); const gchar *key_name = lua_tostring (L, 2); WpSpaIdTable table = NULL; WpSpaIdValue value = NULL; table = wp_spa_id_table_from_name (table_name); if (!table) luaL_error (L, "table '%s' does not exist", table_name); value = wp_spa_id_table_find_value_from_short_name (table, key_name); if (!value) luaL_error (L, "key '%s' does not exist in '%s'", key_name, table_name); wplua_pushboxed (L, WP_TYPE_SPA_POD, wp_spa_pod_new_id (wp_spa_id_value_number (value))); return 1; } /* Error */ luaL_error (L, "Invalid parameters"); return 0; } /* Int */ static int spa_pod_int_new (lua_State *L) { gint64 value = lua_tointeger (L, 1); wplua_pushboxed (L, WP_TYPE_SPA_POD, wp_spa_pod_new_int (value)); return 1; } /* Long */ static int spa_pod_long_new (lua_State *L) { gint64 value = lua_tointeger (L, 1); wplua_pushboxed (L, WP_TYPE_SPA_POD, wp_spa_pod_new_long (value)); return 1; } /* Float */ static int spa_pod_float_new (lua_State *L) { float value = lua_tonumber (L, 1); wplua_pushboxed (L, WP_TYPE_SPA_POD, wp_spa_pod_new_float (value)); return 1; } /* Double */ static int spa_pod_double_new (lua_State *L) { double value = lua_tonumber (L, 1); wplua_pushboxed (L, WP_TYPE_SPA_POD, wp_spa_pod_new_double (value)); return 1; } /* String */ static int spa_pod_string_new (lua_State *L) { const gchar *value = lua_tostring (L, 1); wplua_pushboxed (L, WP_TYPE_SPA_POD, wp_spa_pod_new_string (value)); return 1; } /* Bytes */ static int spa_pod_bytes_new (lua_State *L) { switch (lua_type (L, 1)) { case LUA_TNUMBER: { if (lua_isinteger (L, 1)) { guint64 value = lua_tointeger (L, 1); wplua_pushboxed (L, WP_TYPE_SPA_POD, wp_spa_pod_new_bytes (&value, sizeof (guint64))); } else { double value = lua_tonumber (L, 1); wplua_pushboxed (L, WP_TYPE_SPA_POD, wp_spa_pod_new_bytes (&value, sizeof (double))); } return 1; } case LUA_TSTRING: { const gchar *str = lua_tostring (L, 1); wplua_pushboxed (L, WP_TYPE_SPA_POD, wp_spa_pod_new_bytes (str, strlen (str))); return 1; } default: luaL_error (L, "Only numner and strings are valid for bytes pod"); break; } return 0; } /* Pointer */ static int spa_pod_pointer_new (lua_State *L) { const gchar *type = lua_tostring (L, 1); gconstpointer value = lua_touserdata (L, 2); wplua_pushboxed (L, WP_TYPE_SPA_POD, wp_spa_pod_new_pointer (type, value)); return 1; } /* Fd */ static int spa_pod_fd_new (lua_State *L) { gint64 value = lua_tointeger (L, 1); wplua_pushboxed (L, WP_TYPE_SPA_POD, wp_spa_pod_new_fd (value)); return 1; } /* Rectangle */ static int spa_pod_rectangle_new (lua_State *L) { gint64 width = lua_tointeger (L, 1); gint64 height = lua_tointeger (L, 2); wplua_pushboxed (L, WP_TYPE_SPA_POD, wp_spa_pod_new_rectangle (width, height)); return 1; } /* Fraction */ static int spa_pod_fraction_new (lua_State *L) { gint64 num = lua_tointeger (L, 1); gint64 denom = lua_tointeger (L, 2); wplua_pushboxed (L, WP_TYPE_SPA_POD, wp_spa_pod_new_fraction (num, denom)); return 1; } /* Object */ static gboolean object_add_property (WpSpaPodBuilder *b, WpSpaIdTable table, const gchar *key, lua_State *L, int idx) { guint i; WpSpaIdValue prop_id = NULL; int ltype = lua_type (L, idx); if (ltype < 0 || ltype >= MAX_LUA_TYPES) return FALSE; /* Check if we can add primitive property directly from LUA type */ prop_id = wp_spa_id_table_find_value_from_short_name (table, key); if (prop_id) { WpSpaType prop_type = wp_spa_id_value_get_value_type (prop_id, NULL); if (prop_type != WP_SPA_TYPE_INVALID) { for (i = 0; primitive_lua_types[i].primitive_type; i++) { const struct primitive_lua_type *t = primitive_lua_types + i; if (t->primitive_type == prop_type) { primitive_lua_add_func f = t->primitive_lua_add_funcs[ltype]; if (f) { wp_spa_pod_builder_add_property (b, key); return f (b, prop_id, L, idx); } } } } } /* Otherwise just add pod property */ if (lua_type (L, idx) == LUA_TUSERDATA) { wp_spa_pod_builder_add_property (b, key); return builder_add_lua_userdata (b, prop_id, L, idx); } return FALSE; } static int spa_pod_object_new (lua_State *L) { g_autoptr (WpSpaPodBuilder) builder = NULL; const gchar *fields[2] = { NULL, NULL }; // type_name, name_id WpSpaType object_type = WP_SPA_TYPE_INVALID; WpSpaIdTable table = NULL; luaL_checktype (L, 1, LUA_TTABLE); lua_geti (L, 1, 1); fields[0] = lua_tostring (L, -1); lua_geti (L, 1, 2); fields[1] = lua_tostring (L, -1); object_type = wp_spa_type_from_name (fields[0]); if (object_type == WP_SPA_TYPE_INVALID) luaL_error (L, "Invalid object type '%s'", fields[0]); table = wp_spa_type_get_values_table (object_type); if (!table) luaL_error (L, "Object type '%s' has incomplete type information", fields[0]); builder = wp_spa_pod_builder_new_object (fields[0], fields[1]); if (!builder) luaL_error (L, "Could not create pod object"); lua_pop (L, 2); lua_pushnil(L); while (lua_next (L, -2)) { /* Remaining fields with string keys are the object properties */ if (lua_type (L, -2) == LUA_TSTRING) { const gchar *key = lua_tostring (L, -2); if (!object_add_property (builder, table, key, L, -1)) luaL_error (L, "Property '%s' could not be added", key); } lua_pop (L, 1); } wplua_pushboxed (L, WP_TYPE_SPA_POD, wp_spa_pod_builder_end (builder)); return 1; } /* Struct */ static int spa_pod_struct_new (lua_State *L) { g_autoptr (WpSpaPodBuilder) builder = NULL; luaL_checktype (L, 1, LUA_TTABLE); builder = wp_spa_pod_builder_new_struct (); lua_pushnil (L); while (lua_next (L, 1)) { switch (lua_type (L, -1)) { case LUA_TBOOLEAN: wp_spa_pod_builder_add_boolean (builder, lua_toboolean (L, -1)); break; case LUA_TNUMBER: if (lua_isinteger (L, -1)) wp_spa_pod_builder_add_long (builder, lua_tointeger (L, -1)); else wp_spa_pod_builder_add_double (builder, lua_tonumber (L, -1)); break; case LUA_TSTRING: wp_spa_pod_builder_add_string (builder, lua_tostring (L, -1)); break; case LUA_TUSERDATA: { WpSpaPod *pod = wplua_checkboxed (L, -1, WP_TYPE_SPA_POD); wp_spa_pod_builder_add_pod (builder, pod); break; } default: luaL_error (L, "Struct does not support lua type ", lua_typename(L, lua_type(L, -1))); break; } lua_pop (L, 1); } wplua_pushboxed (L, WP_TYPE_SPA_POD, wp_spa_pod_builder_end (builder)); return 1; } /* Sequence */ static int spa_pod_sequence_new (lua_State *L) { g_autoptr (WpSpaPodBuilder) builder = NULL; luaL_checktype (L, 1, LUA_TTABLE); builder = wp_spa_pod_builder_new_sequence (0); lua_pushnil (L); while (lua_next (L, -2)) { guint32 offset = 0; const gchar *type_name = NULL; WpSpaPod *value = NULL; /* Read Control */ if (lua_istable(L, -1)) { lua_pushnil (L); while (lua_next (L, -2)) { const gchar *key = lua_tostring (L, -2); if (g_strcmp0 (key, "offset") == 0) { offset = lua_tointeger (L, -1); } else if (!type_name && g_strcmp0 (key, "typename") == 0) { type_name = lua_tostring (L, -1); } else if (!value && g_strcmp0 (key, "value") == 0) { switch (lua_type (L, -1)) { case LUA_TBOOLEAN: value = wp_spa_pod_new_boolean (lua_toboolean (L, -1)); break; case LUA_TNUMBER: if (lua_isinteger (L, -1)) value = wp_spa_pod_new_long (lua_tointeger (L, -1)); else value = wp_spa_pod_new_double (lua_tonumber (L, -1)); break; case LUA_TSTRING: value = wp_spa_pod_new_string (lua_tostring (L, -1)); break; case LUA_TUSERDATA: { value = wplua_checkboxed (L, -1, WP_TYPE_SPA_POD); break; } default: { luaL_error (L, "Control value does not support lua type ", lua_typename(L, lua_type(L, -1))); value = NULL; break; } } } lua_pop(L, 1); } } /* Add control */ if (type_name && value) { wp_spa_pod_builder_add_control (builder, offset, type_name); wp_spa_pod_builder_add_pod (builder, value); wp_spa_pod_unref (value); } lua_pop(L, 1); } wplua_pushboxed (L, WP_TYPE_SPA_POD, wp_spa_pod_builder_end (builder)); return 1; } /* Array */ static int spa_pod_array_new (lua_State *L) { g_autoptr (WpSpaPodBuilder) builder = wp_spa_pod_builder_new_array (); builder_add_table (L, builder); wplua_pushboxed (L, WP_TYPE_SPA_POD, wp_spa_pod_builder_end (builder)); return 1; } /* Choice */ static int spa_pod_choice_none_new (lua_State *L) { g_autoptr (WpSpaPodBuilder) builder = wp_spa_pod_builder_new_choice ("None"); builder_add_table (L, builder); wplua_pushboxed (L, WP_TYPE_SPA_POD, wp_spa_pod_builder_end (builder)); return 1; } static int spa_pod_choice_range_new (lua_State *L) { g_autoptr (WpSpaPodBuilder) builder = wp_spa_pod_builder_new_choice ("Range"); builder_add_table (L, builder); wplua_pushboxed (L, WP_TYPE_SPA_POD, wp_spa_pod_builder_end (builder)); return 1; } static int spa_pod_choice_step_new (lua_State *L) { g_autoptr (WpSpaPodBuilder) builder = wp_spa_pod_builder_new_choice ("Step"); builder_add_table (L, builder); wplua_pushboxed (L, WP_TYPE_SPA_POD, wp_spa_pod_builder_end (builder)); return 1; } static int spa_pod_choice_enum_new (lua_State *L) { g_autoptr (WpSpaPodBuilder) builder = wp_spa_pod_builder_new_choice ("Enum"); builder_add_table (L, builder); wplua_pushboxed (L, WP_TYPE_SPA_POD, wp_spa_pod_builder_end (builder)); return 1; } static int spa_pod_choice_flags_new (lua_State *L) { g_autoptr (WpSpaPodBuilder) builder = wp_spa_pod_builder_new_choice ("Flags"); builder_add_table (L, builder); wplua_pushboxed (L, WP_TYPE_SPA_POD, wp_spa_pod_builder_end (builder)); return 1; } /* API */ static int spa_pod_get_type_name (lua_State *L) { WpSpaPod *pod = wplua_checkboxed (L, 1, WP_TYPE_SPA_POD); lua_pushstring (L, wp_spa_type_name (wp_spa_pod_get_spa_type (pod))); return 1; } static void push_primitive_values (lua_State *L, WpSpaPod *pod, WpSpaType type, guint start_index, WpSpaIdTable idtable) { g_auto (GValue) item = G_VALUE_INIT; g_autoptr (WpIterator) it = wp_spa_pod_new_iterator (pod); for (; wp_iterator_next (it, &item); g_value_unset (&item)) { gpointer p = g_value_get_pointer (&item); if (!p) continue; switch (type) { case SPA_TYPE_Bool: lua_pushboolean (L, *(gboolean *)p); break; case SPA_TYPE_Id: { WpSpaIdValue idval = NULL; if (idtable) idval = wp_spa_id_table_find_value (idtable, *(guint32 *)p); if (idval) lua_pushstring (L, wp_spa_id_value_short_name (idval)); else lua_pushinteger (L, *(guint32 *)p); break; } case SPA_TYPE_Int: lua_pushinteger (L, *(gint *)p); break; case SPA_TYPE_Long: lua_pushinteger (L, *(long *)p); break; case SPA_TYPE_Float: lua_pushnumber (L, *(float *)p); break; case SPA_TYPE_Double: lua_pushnumber (L, *(double *)p); break; case SPA_TYPE_Fd: lua_pushnumber (L, *(gint64 *)p); break; default: continue; } lua_rawseti (L, -2, start_index++); } } static void push_luapod (lua_State *L, WpSpaPod *pod, WpSpaIdValue field_idval) { /* None */ if (wp_spa_pod_is_none (pod)) { lua_pushnil (L); } /* Boolean */ else if (wp_spa_pod_is_boolean (pod)) { gboolean value = FALSE; g_warn_if_fail (wp_spa_pod_get_boolean (pod, &value)); lua_pushboolean (L, value); } /* Id */ else if (wp_spa_pod_is_id (pod)) { guint32 value = 0; WpSpaIdTable idtable = NULL; WpSpaIdValue idval = NULL; g_warn_if_fail (wp_spa_pod_get_id (pod, &value)); if (field_idval && SPA_TYPE_Id == wp_spa_id_value_get_value_type (field_idval, &idtable)) { idval = wp_spa_id_table_find_value (idtable, value); } if (idval) lua_pushstring (L, wp_spa_id_value_short_name (idval)); else lua_pushinteger (L, value); } /* Int */ else if (wp_spa_pod_is_int (pod)) { gint value = 0; g_warn_if_fail (wp_spa_pod_get_int (pod, &value)); lua_pushinteger (L, value); } /* Long */ else if (wp_spa_pod_is_long (pod)) { gint64 value = 0; wp_spa_pod_get_long (pod, &value); lua_pushinteger (L, value); } /* Float */ else if (wp_spa_pod_is_float (pod)) { float value = 0; g_warn_if_fail (wp_spa_pod_get_float (pod, &value)); lua_pushnumber (L, value); } /* Double */ else if (wp_spa_pod_is_double (pod)) { double value = 0; g_warn_if_fail (wp_spa_pod_get_double (pod, &value)); lua_pushnumber (L, value); } /* String */ else if (wp_spa_pod_is_string (pod)) { const gchar *value = NULL; g_warn_if_fail (wp_spa_pod_get_string (pod, &value)); lua_pushstring (L, value); } /* Bytes */ else if (wp_spa_pod_is_bytes (pod)) { gconstpointer value = NULL; guint32 size = 0; g_warn_if_fail (wp_spa_pod_get_bytes (pod, &value, &size)); char str[size + 1]; for (guint i = 0; i < size; i++) str[i] = ((const gchar *)value)[i]; str[size] = '\0'; lua_pushstring (L, str); } /* Pointer */ else if (wp_spa_pod_is_pointer (pod)) { gconstpointer value = NULL; g_warn_if_fail (wp_spa_pod_get_pointer (pod, &value)); if (!value) lua_pushnil (L); else lua_pushlightuserdata (L, (gpointer)value); } /* Fd */ else if (wp_spa_pod_is_fd (pod)) { gint64 value = 0; g_warn_if_fail (wp_spa_pod_get_fd (pod, &value)); lua_pushinteger (L, value); } /* Rectangle */ else if (wp_spa_pod_is_rectangle (pod)) { guint32 width = 0, height = 0; g_warn_if_fail (wp_spa_pod_get_rectangle (pod, &width, &height)); lua_newtable (L); lua_pushstring (L, "Rectangle"); lua_setfield (L, -2, "pod_type"); lua_pushinteger (L, width); lua_setfield (L, -2, "width"); lua_pushinteger (L, height); lua_setfield (L, -2, "height"); } /* Fraction */ else if (wp_spa_pod_is_fraction (pod)) { guint32 num = 0, denom = 0; g_warn_if_fail (wp_spa_pod_get_fraction (pod, &num, &denom)); lua_newtable (L); lua_pushstring (L, "Fraction"); lua_setfield (L, -2, "pod_type"); lua_pushinteger (L, num); lua_setfield (L, -2, "num"); lua_pushinteger (L, denom); lua_setfield (L, -2, "denom"); } /* Object */ else if (wp_spa_pod_is_object (pod)) { WpSpaType type = wp_spa_pod_get_spa_type (pod); WpSpaIdTable values_table = wp_spa_type_get_values_table (type); const gchar *id_name = NULL; g_auto (GValue) item = G_VALUE_INIT; g_autoptr (WpIterator) it = NULL; g_warn_if_fail (wp_spa_pod_get_object (pod, &id_name, NULL)); lua_newtable (L); lua_pushstring (L, "Object"); lua_setfield (L, -2, "pod_type"); lua_pushstring (L, id_name); lua_setfield (L, -2, "object_id"); it = wp_spa_pod_new_iterator (pod); lua_newtable (L); for (; wp_iterator_next (it, &item); g_value_unset (&item)) { WpSpaPod *prop = g_value_get_boxed (&item); const gchar *key = NULL; g_autoptr (WpSpaPod) val = NULL; //FIXME: this is suboptimal because _get_property() converts // the key to a short name and we convert it back g_warn_if_fail (wp_spa_pod_get_property (prop, &key, &val)); if (key) { push_luapod (L, val, wp_spa_id_table_find_value_from_short_name (values_table, key)); lua_setfield (L, -2, key); } } lua_setfield (L, -2, "properties"); } /* Struct */ else if (wp_spa_pod_is_struct (pod)) { g_auto (GValue) item = G_VALUE_INIT; g_autoptr (WpIterator) it = wp_spa_pod_new_iterator (pod); guint i = 1; lua_newtable (L); lua_pushstring (L, "Struct"); lua_setfield (L, -2, "pod_type"); for (; wp_iterator_next (it, &item); g_value_unset (&item)) { WpSpaPod *val = g_value_get_boxed (&item); push_luapod (L, val, NULL); lua_rawseti (L, -2, i++); } } /* Sequence */ else if (wp_spa_pod_is_sequence (pod)) { g_auto (GValue) item = G_VALUE_INIT; g_autoptr (WpIterator) it = wp_spa_pod_new_iterator (pod); guint i = 1; lua_newtable (L); lua_pushstring (L, "Sequence"); lua_setfield (L, -2, "pod_type"); for (; wp_iterator_next (it, &item); g_value_unset (&item)) { WpSpaPod *control = g_value_get_boxed (&item); guint32 offset = 0; const char *type_name = NULL; g_autoptr (WpSpaPod) val = NULL; g_warn_if_fail (wp_spa_pod_get_control (control, &offset, &type_name, &val)); lua_newtable (L); lua_pushinteger (L, offset); lua_setfield (L, -2, "offset"); lua_pushstring (L, type_name); lua_setfield (L, -2, "typename"); push_luapod (L, val, NULL); lua_setfield (L, -2, "value"); lua_rawseti (L, -2, i++); } } /* Array */ else if (wp_spa_pod_is_array (pod)) { g_autoptr (WpSpaPod) child = wp_spa_pod_get_array_child (pod); WpSpaType type = wp_spa_pod_get_spa_type (child); WpSpaIdTable idtable = NULL; if (field_idval && type == SPA_TYPE_Id && SPA_TYPE_Array == wp_spa_id_value_get_value_type (field_idval, &idtable)) wp_spa_id_value_array_get_item_type (field_idval, &idtable); lua_newtable (L); lua_pushstring (L, "Array"); lua_setfield (L, -2, "pod_type"); lua_pushstring (L, wp_spa_type_name (type)); lua_setfield (L, -2, "value_type"); push_primitive_values (L, pod, type, 1, idtable); } /* Choice */ else if (wp_spa_pod_is_choice (pod)) { g_autoptr (WpSpaPod) child = wp_spa_pod_get_choice_child (pod); WpSpaType type = wp_spa_pod_get_spa_type (child); g_autofree const gchar *choice_type = g_strdup_printf ("Choice.%s", wp_spa_id_value_short_name (wp_spa_pod_get_choice_type (pod))); WpSpaIdTable idtable = NULL; if (field_idval && type == SPA_TYPE_Id) wp_spa_id_value_get_value_type (field_idval, &idtable); lua_newtable (L); lua_pushstring (L, choice_type); lua_setfield (L, -2, "pod_type"); lua_pushstring (L, wp_spa_type_name (type)); lua_setfield (L, -2, "value_type"); push_primitive_values (L, pod, type, 1, idtable); } /* Error */ else { luaL_error (L, "Unsupported pod type ", wp_spa_type_name (wp_spa_pod_get_spa_type (pod))); } } static int spa_pod_parse (lua_State *L) { WpSpaPod *pod = wplua_checkboxed (L, 1, WP_TYPE_SPA_POD); push_luapod (L, pod, NULL); return 1; } static int spa_pod_fixate (lua_State *L) { WpSpaPod *pod = wplua_checkboxed (L, 1, WP_TYPE_SPA_POD); gboolean res = wp_spa_pod_fixate (pod); lua_pushboolean (L, res); return 1; } static inline WpSpaPod * _checkpod (lua_State *L, int n) { return wplua_checkboxed (L, n, WP_TYPE_SPA_POD); } static int spa_pod_filter (lua_State *L) { WpSpaPod *pod = wplua_checkboxed (L, 1, WP_TYPE_SPA_POD); WpSpaPod *filter = luaL_opt (L, _checkpod, 2, NULL); WpSpaPod *result = wp_spa_pod_filter (pod, filter); if (result) { wplua_pushboxed (L, WP_TYPE_SPA_POD, result); return 1; } return 0; } static const luaL_Reg spa_pod_methods[] = { { "get_type_name", spa_pod_get_type_name }, { "parse", spa_pod_parse }, { "fixate", spa_pod_fixate }, { "filter", spa_pod_filter }, { NULL, NULL } }; static const luaL_Reg spa_pod_constructors[] = { { "None", spa_pod_none_new }, { "Boolean", spa_pod_boolean_new }, { "Id", spa_pod_id_new }, { "Int", spa_pod_int_new }, { "Long", spa_pod_long_new }, { "Float", spa_pod_float_new }, { "Double", spa_pod_double_new }, { "String", spa_pod_string_new }, { "Bytes", spa_pod_bytes_new }, { "Pointer", spa_pod_pointer_new }, { "Fd", spa_pod_fd_new }, { "Rectangle", spa_pod_rectangle_new }, { "Fraction", spa_pod_fraction_new }, { "Object", spa_pod_object_new }, { "Struct", spa_pod_struct_new }, { "Sequence", spa_pod_sequence_new }, { "Array", spa_pod_array_new }, { NULL, NULL } }; static const luaL_Reg spa_pod_choice_constructors[] = { { "None", spa_pod_choice_none_new }, { "Range", spa_pod_choice_range_new }, { "Step", spa_pod_choice_step_new }, { "Enum", spa_pod_choice_enum_new }, { "Flags", spa_pod_choice_flags_new }, { NULL, NULL } }; /* Init */ void wp_lua_scripting_pod_init (lua_State *L) { luaL_newlib (L, spa_pod_constructors); luaL_newlib (L, spa_pod_choice_constructors); lua_setfield (L, -2, "Choice"); lua_setglobal (L, "WpSpaPod"); wplua_register_type_methods (L, WP_TYPE_SPA_POD, NULL, spa_pod_methods); }
26.804858
80
0.668227
[ "object" ]
16863e98cd665027d641ca3386b67e90e1f58ad0
10,547
h
C
src/io_dxf/dxf.h
Unionfab/mayo
881b81b2b6febe6fb88967e4eef6ef22882e1734
[ "BSD-2-Clause" ]
382
2018-02-24T23:46:02.000Z
2022-03-31T16:08:24.000Z
src/io_dxf/dxf.h
Unionfab/mayo
881b81b2b6febe6fb88967e4eef6ef22882e1734
[ "BSD-2-Clause" ]
102
2017-05-18T09:36:26.000Z
2022-03-24T15:24:28.000Z
src/io_dxf/dxf.h
Unionfab/mayo
881b81b2b6febe6fb88967e4eef6ef22882e1734
[ "BSD-2-Clause" ]
124
2017-10-22T23:40:13.000Z
2022-03-28T08:57:23.000Z
// dxf.h // Copyright (c) 2009, Dan Heeks // This program is released under the BSD license. See the file COPYING for details. // modified 2018 wandererfan // MAYO: file initially taken from FreeCad/src/Mod/Import/App/dxf.h -- commit #47d5707 #ifndef _dxf_h_ #define _dxf_h_ #pragma once #include <algorithm> #include <list> #include <vector> #include <map> #include <set> #include <fstream> #include <sstream> #include <iostream> #include <stdio.h> #include <string.h> #include <math.h> #include "freecad.h" #define ImportExport //Following is required to be defined on Ubuntu with OCC 6.3.1 #ifndef HAVE_IOSTREAM #define HAVE_IOSTREAM #endif typedef int Aci_t; // AutoCAD color index typedef enum { eUnspecified = 0, // Unspecified (No units) eInches, eFeet, eMiles, eMillimeters, eCentimeters, eMeters, eKilometers, eMicroinches, eMils, eYards, eAngstroms, eNanometers, eMicrons, eDecimeters, eDekameters, eHectometers, eGigameters, eAstronomicalUnits, eLightYears, eParsecs } eDxfUnits_t; //spline data for reading struct SplineData { double norm[3]; int degree; int knots; int control_points; int fit_points; int flag; std::list<double> starttanx; std::list<double> starttany; std::list<double> starttanz; std::list<double> endtanx; std::list<double> endtany; std::list<double> endtanz; std::list<double> knot; std::list<double> weight; std::list<double> controlx; std::list<double> controly; std::list<double> controlz; std::list<double> fitx; std::list<double> fity; std::list<double> fitz; }; //*************************** //data structures for writing //added by Wandererfan 2018 (wandererfan@gmail.com) for FreeCAD project struct point3D { double x; double y; double z; }; struct SplineDataOut { point3D norm; int degree; int knots; int control_points; int fit_points; int flag; point3D starttan; point3D endtan; std::vector<double> knot; std::vector<double> weight; std::vector<point3D> control; std::vector<point3D> fit; }; struct LWPolyDataOut { double nVert; int Flag; double Width; double Elev; double Thick; std::vector<point3D> Verts; std::vector<double> StartWidth; std::vector<double> EndWidth; std::vector<double> Bulge; point3D Extr; }; //******************** class ImportExport CDxfWrite{ private: std::ofstream* m_ofs; bool m_fail; std::ostringstream* m_ssBlock; std::ostringstream* m_ssBlkRecord; std::ostringstream* m_ssEntity; std::ostringstream* m_ssLayer; protected: void putLine(const Base::Vector3d s, const Base::Vector3d e, std::ostringstream* outStream, const std::string handle, const std::string ownerHandle); void putText(const char* text, const Base::Vector3d location1, const Base::Vector3d location2, const double height, const int horizJust, std::ostringstream* outStream, const std::string handle, const std::string ownerHandle); void putArrow(Base::Vector3d arrowPos, Base::Vector3d barb1Pos, Base::Vector3d barb2Pos, std::ostringstream* outStream, const std::string handle, const std::string ownerHandle); //! copy boiler plate file std::string getPlateFile(std::string fileSpec); void setDataDir(std::string s) { m_dataDir = s; } std::string getHandle(void); std::string getEntityHandle(void); std::string getLayerHandle(void); std::string getBlockHandle(void); std::string getBlkRecordHandle(void); std::string m_optionSource; int m_version; int m_handle; int m_entityHandle; int m_layerHandle; int m_blockHandle; int m_blkRecordHandle; bool m_polyOverride; std::string m_saveModelSpaceHandle; std::string m_savePaperSpaceHandle; std::string m_saveBlockRecordTableHandle; std::string m_saveBlkRecordHandle; std::string m_currentBlock; std::string m_dataDir; std::string m_layerName; std::vector<std::string> m_layerList; std::vector<std::string> m_blockList; std::vector<std::string> m_blkRecordList; public: CDxfWrite(const char* filepath); ~CDxfWrite(); void init(void); void endRun(void); bool Failed(){return m_fail;} // void setOptions(void); // bool isVersionValid(int vers); std::string getLayerName() { return m_layerName; } void setLayerName(std::string s); void setVersion(int v) { m_version = v;} void setPolyOverride(bool b) { m_polyOverride = b; } void addBlockName(std::string s, std::string blkRecordHandle); void writeLine(const double* s, const double* e); void writePoint(const double*); void writeArc(const double* s, const double* e, const double* c, bool dir); void writeEllipse(const double* c, double major_radius, double minor_radius, double rotation, double start_angle, double end_angle, bool endIsCW); void writeCircle(const double* c, double radius ); void writeSpline(const SplineDataOut &sd); void writeLWPolyLine(const LWPolyDataOut &pd); void writePolyline(const LWPolyDataOut &pd); void writeVertex(double x, double y, double z); void writeText(const char* text, const double* location1, const double* location2, const double height, const int horizJust); void writeLinearDim(const double* textMidPoint, const double* lineDefPoint, const double* extLine1, const double* extLine2, const char* dimText, int type); void writeLinearDimBlock(const double* textMidPoint, const double* lineDefPoint, const double* extLine1, const double* extLine2, const char* dimText, int type); void writeAngularDim(const double* textMidPoint, const double* lineDefPoint, const double* startExt1, const double* endExt1, const double* startExt2, const double* endExt2, const char* dimText); void writeAngularDimBlock(const double* textMidPoint, const double* lineDefPoint, const double* startExt1, const double* endExt1, const double* startExt2, const double* endExt2, const char* dimText); void writeRadialDim(const double* centerPoint, const double* textMidPoint, const double* arcPoint, const char* dimText); void writeRadialDimBlock(const double* centerPoint, const double* textMidPoint, const double* arcPoint, const char* dimText); void writeDiametricDim(const double* textMidPoint, const double* arcPoint1, const double* arcPoint2, const char* dimText); void writeDiametricDimBlock(const double* textMidPoint, const double* arcPoint1, const double* arcPoint2, const char* dimText); void writeDimBlockPreamble(); void writeBlockTrailer(void); void writeHeaderSection(void); void writeTablesSection(void); void writeBlocksSection(void); void writeEntitiesSection(void); void writeObjectsSection(void); void writeClassesSection(void); void makeLayerTable(void); void makeBlockRecordTableHead(void); void makeBlockRecordTableBody(void); void makeBlockSectionHead(void); }; // derive a class from this and implement it's virtual functions class ImportExport CDxfRead{ private: std::ifstream* m_ifs; bool m_fail; char m_str[1024]; char m_unused_line[1024]; eDxfUnits_t m_eUnits; bool m_measurement_inch; char m_layer_name[1024]; char m_section_name[1024]; char m_block_name[1024]; bool m_ignore_errors; typedef std::map< std::string,Aci_t > LayerAciMap_t; LayerAciMap_t m_layer_aci; // layer names -> layer color aci map bool ReadUnits(); bool ReadLayer(); bool ReadLine(); bool ReadText(); bool ReadArc(); bool ReadCircle(); bool ReadEllipse(); bool ReadPoint(); bool ReadSpline(); bool ReadLwPolyLine(); bool ReadPolyLine(); bool ReadVertex(double *pVertex, bool *bulge_found, double *bulge); void OnReadArc(double start_angle, double end_angle, double radius, const double* c, double z_extrusion_dir, bool hidden); void OnReadCircle(const double* c, double radius, bool hidden); void OnReadEllipse(const double* c, const double* m, double ratio, double start_angle, double end_angle); bool ReadInsert(); bool ReadDimension(); bool ReadBlockInfo(); void put_line(const char *value); void DerefACI(); void ReportError_readInteger(const char* context); protected: Aci_t m_aci; // manifest color name or 256 for layer color int m_lineNum = 0; std::streamsize gcount() const; virtual void get_line(); virtual void ReportError(const char* /*msg*/) {} public: CDxfRead(const char* filepath); // this opens the file virtual ~CDxfRead(); // this closes the file bool Failed(){return m_fail;} void DoRead(const bool ignore_errors = false); // this reads the file and calls the following functions double mm( double value ) const; bool IgnoreErrors() const { return(m_ignore_errors); } virtual void OnReadLine(const double* /*s*/, const double* /*e*/, bool /*hidden*/){} virtual void OnReadPoint(const double* /*s*/){} virtual void OnReadText(const double* /*point*/, const double /*height*/, double /*rotation*/, const char* /*text*/){} virtual void OnReadArc(const double* /*s*/, const double* /*e*/, const double* /*c*/, bool /*dir*/, bool /*hidden*/){} virtual void OnReadCircle(const double* /*s*/, const double* /*c*/, bool /*dir*/, bool /*hidden*/){} virtual void OnReadEllipse(const double* /*c*/, double /*major_radius*/, double /*minor_radius*/, double /*rotation*/, double /*start_angle*/, double /*end_angle*/, bool /*dir*/){} virtual void OnReadSpline(struct SplineData& /*sd*/){} virtual void OnReadInsert(const double* /*point*/, const double* /*scale*/, const char* /*name*/, double /*rotation*/){} virtual void OnReadDimension(const double* /*s*/, const double* /*e*/, const double* /*point*/, double /*rotation*/){} virtual void AddGraphics() const { } std::string LayerName() const; }; #endif
32.552469
184
0.665118
[ "vector" ]
1694f28db13a5d37d35bb0b138face7ffc83f952
12,363
c
C
pl/math/v_erf_data.c
forksnd/optimized-routines
ea4649a6ea3b79033755217613bd8ab4791c1dea
[ "MIT" ]
null
null
null
pl/math/v_erf_data.c
forksnd/optimized-routines
ea4649a6ea3b79033755217613bd8ab4791c1dea
[ "MIT" ]
null
null
null
pl/math/v_erf_data.c
forksnd/optimized-routines
ea4649a6ea3b79033755217613bd8ab4791c1dea
[ "MIT" ]
null
null
null
/* * Polynomial coefficients and shifts for double-precision erf(x) vector * function. * * Copyright (c) 2019-2022, Arm Limited. * SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception */ #include "math_config.h" /* 48 intervals of the form [x_i, x_{i+1}] with x_i = i / 8 for i=1,...,47 (x_0 = 2^-1022). There is an extra dummy interval for [6, +inf] with all coeffs = 0 except for P_0 = 1.0, as erf(x) == 1 above 6. Coefficients for each interval generated using fpminimax algorithm. See v_erf.sollya for details. Note the array is transposed, so for a set of coefficients C generated on interval i, C[j] is at coeffs[j][i]. */ const struct v_erf_data __v_erf_data = {.shifts = {-0x1p-1019, -1, -2, -3, -4, -5, -6, -7, -8, -9, -10, -11, -12, -13, -14, -15, -16, -17, -18, -19, -20, -21, -22, -23, -24, -25, -26, -27, -28, -29, -30, -31, -32, -33, -34, -35, -36, -37, -38, -39, -40, -41, -42, -43, -44, -45, -46, -47, 0}, .coeffs = { // clang-format off {0x1.20dd750429b6dp-1022, 0x1.1f5e1a35c3b8ap-3, 0x1.1af54e232d609p-2, 0x1.9dd0d2b721f39p-2, 0x1.0a7ef5c18edd2p-1, 0x1.3f196dcd0f135p-1, 0x1.6c1c9759d0e5fp-1, 0x1.91724951b8fc6p-1, 0x1.af767a741088bp-1, 0x1.c6dad2829ec62p-1, 0x1.d8865d98abe00p-1, 0x1.e5768c3b4a3fcp-1, 0x1.eea5557137ae0p-1, 0x1.f4f693b67bd77p-1, 0x1.f92d077f8d56dp-1, 0x1.fbe61eef4cf6ap-1, 0x1.fd9ae142795e3p-1, 0x1.fea4218d6594ap-1, 0x1.ff404760319b4p-1, 0x1.ff9960f3eb327p-1, 0x1.ffcaa8f4c9beap-1, 0x1.ffe514bbdc197p-1, 0x1.fff2cfb0453d9p-1, 0x1.fff9ba420e834p-1, 0x1.fffd1ac4135f9p-1, 0x1.fffeb3ebb267bp-1, 0x1.ffff6f9f67e55p-1, 0x1.ffffc316d9ed0p-1, 0x1.ffffe710d565ep-1, 0x1.fffff618c3da6p-1, 0x1.fffffc2f171e3p-1, 0x1.fffffe92ced93p-1, 0x1.ffffff7b91176p-1, 0x1.ffffffd169d0cp-1, 0x1.fffffff01a8b6p-1, 0x1.fffffffabd229p-1, 0x1.fffffffe4fa30p-1, 0x1.ffffffff79626p-1, 0x1.ffffffffd759dp-1, 0x1.fffffffff4188p-1, 0x1.fffffffffc9e8p-1, 0x1.ffffffffff11ap-1, 0x1.ffffffffffc05p-1, 0x1.ffffffffffef8p-1, 0x1.fffffffffffbep-1, 0x1.ffffffffffff0p-1, 0x1.ffffffffffffcp-1, 0x1.fffffffffffffp-1, 1.0}, {0x1.20dd750429b6dp-3, 0x1.1c62fa1e86989p-3, 0x1.0f5d1602f7dfbp-3, 0x1.f5f0cdaf152b2p-4, 0x1.c1efca49a5051p-4, 0x1.86e9694134b22p-4, 0x1.492e42d78d39cp-4, 0x1.0cab61f084b1bp-4, 0x1.a911f096fbb79p-5, 0x1.45e99bcbb78d4p-5, 0x1.e4652fadcbaa3p-6, 0x1.5ce595c455bccp-6, 0x1.e723726b81ff1p-7, 0x1.499d478bca4acp-7, 0x1.b055303221566p-8, 0x1.12ceb37ffa389p-8, 0x1.529b9e8cfa59fp-9, 0x1.94624e78e084fp-10, 0x1.d4143a9e023f5p-11, 0x1.06918b63537c2p-11, 0x1.1d83170fcc34bp-12, 0x1.2ce898808f08ep-13, 0x1.3360ccd26e06ap-14, 0x1.30538fbb986fbp-15, 0x1.2408e9bb1b657p-16, 0x1.0f9e1b4e4baaep-17, 0x1.e9b5e8d71b5e3p-19, 0x1.abe09e85af38ap-20, 0x1.6a5972347c568p-21, 0x1.296a70eff1bd9p-22, 0x1.d9371ee6bfc07p-24, 0x1.6ce1a88a01b3ap-25, 0x1.10b14985663f9p-26, 0x1.8b0d07ade43d8p-28, 0x1.155a098eceb0fp-29, 0x1.7974d3b397e7cp-31, 0x1.f1e3bf5a6493ap-33, 0x1.3e47781d91b97p-34, 0x1.8a7038368986cp-36, 0x1.d9d4d7be5992cp-38, 0x1.137dabebc1319p-39, 0x1.367541123e46cp-41, 0x1.58007ab162c1dp-43, 0x1.709f0d280b3f5p-45, 0x1.30a3dcf531ebfp-47, 0x1.d2707c055dedcp-50, 0x1.0d97f61945387p-49, 0x1.1dbc3ab728933p-50, 0}, {0x1.2411381609db0p-51, -0x1.1c62fa1e75c0ap-9, -0x1.0f5d1602eb436p-8, -0x1.78749a4346714p-8, -0x1.c1efca49a7b15p-8, -0x1.e8a3c39178d95p-8, -0x1.edc5644363883p-8, -0x1.d62beb64e19eep-8, -0x1.a911f096f7a87p-8, -0x1.6ea6cf452dca3p-8, -0x1.2ebf3dccb166cp-8, -0x1.dfbbadedfcde6p-9, -0x1.6d5a95d08c346p-9, -0x1.0bcfca21880c9p-9, -0x1.7a4a8a2bf1a0bp-10, -0x1.01a1c8481a466p-10, -0x1.529b9e8d29ddap-11, -0x1.ada873604cf20p-12, -0x1.074b60f960c25p-12, -0x1.37ccd585732c6p-13, -0x1.64e3dcd73a1d3p-14, -0x1.8af14827e93bap-15, -0x1.a6a519ae712fbp-16, -0x1.b5781ea681265p-17, -0x1.b60d5ed744563p-18, -0x1.a8670acc75c29p-19, -0x1.8de3ce2154088p-20, -0x1.690584329096ap-21, -0x1.3d0e478659a54p-22, -0x1.0d8875cb088d0p-23, -0x1.bba3c56e56d69p-25, -0x1.617a60b4bcd87p-26, -0x1.10b16afb9ce08p-27, -0x1.9766e11f62828p-29, -0x1.26afbc55ef33cp-30, -0x1.9cd52c0e709a9p-32, -0x1.18175f6758766p-33, -0x1.705a68dde7f3ap-35, -0x1.d65ba6d52556dp-37, -0x1.23af5c3865987p-38, -0x1.51c72cd64a6bcp-40, -0x1.79f63bbc02f5ap-42, -0x1.2346f2840d7bfp-43, -0x1.8110f614395a8p-45, 0x1.c3309f1fe85a4p-46, 0x1.09e6fb6ee0b85p-46, -0x1.959834938224fp-46, -0x1.0e9a684ecee47p-46, 0}, {-0x1.812746b057b58p-11, -0x1.6f552dbf96b31p-11, -0x1.3c97445cee1b0p-11, -0x1.e106c523a966dp-12, -0x1.2bf5318638e21p-12, -0x1.c8105034ea92fp-14, 0x1.b6e85963275c5p-15, 0x1.7c9d756585d29p-13, 0x1.1b614b0e78122p-12, 0x1.4cb3cf0b42031p-12, 0x1.571d01cf7eeb3p-12, 0x1.4374d82fe7f2ep-12, 0x1.1c2a02b9199a0p-12, 0x1.d6631e131dabap-13, 0x1.7148c3d9d22bap-13, 0x1.143d1c76ae7c6p-13, 0x1.8b0ae3afc07e6p-14, 0x1.0ea475d5b3822p-14, 0x1.63ef6208bd4adp-15, 0x1.c1ec100ec3e71p-16, 0x1.119da13709716p-16, 0x1.407fbd00318a5p-17, 0x1.69cf481b4666cp-18, 0x1.89e17d2b19c42p-19, 0x1.9db7531fa76f6p-20, 0x1.a37382bd61dc8p-21, 0x1.9aa4a8e8fe8dfp-22, 0x1.8451fcde36f23p-23, 0x1.62cd605193fe9p-24, 0x1.394b0d46af85cp-25, 0x1.0b6c0d1191ec9p-26, 0x1.b9581bcc8f4ebp-28, 0x1.603ea0f602119p-29, 0x1.0ff28bc88022cp-30, 0x1.95ecc71a0b4bep-32, 0x1.24ffe516534d4p-33, 0x1.9aa89abeffd90p-35, 0x1.1ab57210158fap-36, 0x1.8b0c503eafbcbp-38, 0x1.166413b8ba611p-39, 0x1.5848fad1e38e9p-42, 0x1.3573cc6d6d4e6p-49, 0x1.404c0dc8b5ffcp-42, 0x1.38779160f5f11p-43, -0x1.1dc84293acf27p-42, -0x1.2892755467252p-43, 0x1.8e40aed4a9e02p-43, 0x1.0cef3bce98bedp-43, 0}, {0x1.4ade8e6d47ef0p-43, 0x1.196c9ee6491cfp-16, 0x1.040e8be6a9625p-15, 0x1.5529ad049b967p-15, 0x1.76f27e1744b44p-15, 0x1.6963c95cd8395p-15, 0x1.349b5d6ae76a6p-15, 0x1.cc6056b95eed3p-16, 0x1.1b614adacb10dp-16, 0x1.ca5080f4ec9b9p-18, -0x1.93a9d54fb750bp-20, -0x1.f3b8d7695d38cp-18, -0x1.6d5a929bfde5fp-17, -0x1.974c013452be9p-17, -0x1.8a0da620ab60fp-17, -0x1.5a3166e1f5682p-17, -0x1.1a2c5ad80a584p-17, -0x1.afe552a6507eep-18, -0x1.38a9879a760b8p-18, -0x1.ae595d5041755p-19, -0x1.1a89c93c4b9c8p-19, -0x1.62d4c3dc10fdbp-20, -0x1.ab0c620cf63d1p-21, -0x1.ed4aeff35fd90p-22, -0x1.11c8e63fae76dp-22, -0x1.2454a1fb4749ap-23, -0x1.2c7f7846b0e7bp-24, -0x1.298c17acfd63ap-25, -0x1.1c0f6cc5baa18p-26, -0x1.0574c9f0e63fap-27, -0x1.d0a5c4232f4cep-29, -0x1.8d9d301253af8p-30, -0x1.49cb78be34c81p-31, -0x1.08fc30eb50526p-32, -0x1.96e2f50cad458p-34, -0x1.2c888ddad994bp-35, -0x1.c5dd3068e7fcap-37, -0x1.935b876ed56ffp-38, -0x1.e74a7c256ba0dp-39, -0x1.1681c73733b50p-39, 0x1.855ab0b8664dep-41, 0x1.4aebdf7fb67e5p-41, -0x1.2aef07c393759p-40, -0x1.37e52b17505e6p-41, 0x1.394b997da7ed5p-40, 0x1.4345440ea9876p-41, -0x1.af227669dca68p-41, -0x1.23589e4f3cc49p-41, 0}, {0x1.ce2f1b1646d4bp-19, 0x1.aaba29a029bd5p-19, 0x1.47e57fbf662a0p-19, 0x1.74882f55f1bd4p-20, 0x1.dfed759bd9091p-23, -0x1.c124b2acb3ee8p-21, -0x1.b429a82901889p-20, -0x1.1350ee93fbfb3p-19, -0x1.1b613a5e1e196p-19, -0x1.f65ceb61aa63ap-20, -0x1.82814da1daaa1p-20, -0x1.f5729185c040ep-21, -0x1.e72489bfea503p-22, -0x1.17d784c065f21p-24, 0x1.b2229e5122850p-23, 0x1.779b916c44358p-22, 0x1.ace7a08f66cb0p-22, 0x1.9973788b8f181p-22, 0x1.5d3bceb9c39d5p-22, 0x1.11da976499339p-22, 0x1.90eaa0d25df91p-23, 0x1.146c19a9f0ae8p-23, 0x1.693a52f5ccd0bp-24, 0x1.c122683fc1404p-25, 0x1.0a866e311e50ap-25, 0x1.2e85588e08741p-26, 0x1.493501a3ee15cp-27, 0x1.572eec204dc18p-28, 0x1.590e0157d4dabp-29, 0x1.4c0619d7359e8p-30, 0x1.36608b7b22d22p-31, 0x1.0e3f514a0d7fep-32, 0x1.e04d29135056ep-34, 0x1.aa936eb977e33p-35, 0x1.3ce1ec4a299b6p-36, 0x1.aba42bc751130p-38, 0x1.0861b5dc819e3p-38, 0x1.3bc7b1f0f8afbp-38, 0x1.7d6c896bf3579p-38, 0x1.14f24be91338cp-38, -0x1.2896024cf2ca9p-39, -0x1.c2e8399d1e8e7p-40, 0x1.7836a61cc0f4bp-39, 0x1.8a98e07f8cdfcp-40, -0x1.8f332379c6ce4p-39, -0x1.9bbec3ab83755p-40, 0x1.126c9c6d24bd6p-39, 0x1.72eaeac065cc2p-40, 0}, {0x1.240b25b9a9823p-39, -0x1.733f879c52150p-24, -0x1.4c00873f3742fp-23, -0x1.9a6fe48163775p-23, -0x1.99ed7481d2399p-23, -0x1.52aea61425cf7p-23, -0x1.b853c3ad1c781p-24, -0x1.53c3e486c1845p-25, 0x1.2e2a4e7a0286dp-26, 0x1.fd0e266132929p-25, 0x1.5cf1d8fe5611fp-24, 0x1.6b140ba72ac56p-24, 0x1.3cab2fa73a9c4p-24, 0x1.d864967df5009p-25, 0x1.25b4551256078p-25, 0x1.0d029bc50b0cdp-26, 0x1.e126485c5dceep-30, -0x1.dd5e4bed818c0p-28, -0x1.7cd1b44dbfdc3p-27, -0x1.981def704f39ep-27, -0x1.6f0e87a0f3e35p-27, -0x1.267c0dc9b6e95p-27, -0x1.b2ec3078bf153p-28, -0x1.2b066605239f5p-28, -0x1.840473ed3d070p-29, -0x1.daf9b9b8c06cap-30, -0x1.1661520cf8a32p-30, -0x1.2fa49c29e30b5p-31, -0x1.4ddfd9d6a7cf4p-32, -0x1.4a55b8564425ap-33, -0x1.5df1ca746f291p-34, -0x1.dd6b8d1ec2e4fp-36, -0x1.34c63d902f888p-36, -0x1.b55b65a1655c0p-37, -0x1.9c1cfd1e2142cp-39, 0x1.98f2b73f288c4p-43, -0x1.3baba91a10af8p-39, -0x1.8cb03e5359e2bp-38, -0x1.16063ce2129afp-37, -0x1.9fd74120d8e00p-38, 0x1.cf0caf7defe71p-39, 0x1.5d029f324f3a7p-39, -0x1.21268c2290cb5p-38, -0x1.2f6de12d74afdp-39, 0x1.332ead763d55ap-38, 0x1.3cd3a7103e138p-39, -0x1.a64e5d1cdb028p-39, -0x1.1d674b3db2a42p-39, 0}, {-0x1.b84a0abf33534p-27, -0x1.89c6cd0cf2b65p-27, -0x1.09bb37091d4aep-27, -0x1.68f777b72ca95p-29, 0x1.60a5240c5ece1p-29, 0x1.c7421c28ef551p-28, 0x1.2e75b6acb2116p-27, 0x1.30f14412b258cp-27, 0x1.f153992d28a09p-28, 0x1.3b80153a3c97bp-28, 0x1.df36fe4b5094cp-30, -0x1.724a2b185f507p-31, -0x1.37cb36ce4237dp-29, -0x1.963d70f677f90p-29, -0x1.8d5c135b0af66p-29, -0x1.42fbc01c11a3bp-29, -0x1.baba060b7adb1p-30, -0x1.eaf481fbc6feap-31, -0x1.5b5d0a354e49cp-32, 0x1.fb57bbdb6f854p-35, 0x1.2423823b5dcaep-32, 0x1.64e9c7f44ececp-32, 0x1.59b6fb115bcefp-32, 0x1.179a1737c24d9p-32, 0x1.a9515bcf95bb0p-33, 0x1.1ca83baba64bdp-33, 0x1.826e7ef89b3cap-34, 0x1.7ab5cb5ca2db0p-35, 0x1.2ce997226e82dp-35, 0x1.fdd14ca5a6d38p-37, 0x1.d35252de2a363p-37, -0x1.8dd5e799b3695p-39, 0x1.047fd46786432p-38, 0x1.aa8639c65a4a4p-38, 0x1.10495d2cdaee5p-41, -0x1.24b2b7e751230p-40, 0x1.e2ec0b9e9b211p-40, 0x1.6203cc50754ffp-38, 0x1.f95c0def7238bp-38, 0x1.7b31a463405b9p-38, -0x1.a826fa90b3c96p-39, -0x1.3f6315812b719p-39, 0x1.0862d42832ac6p-38, 0x1.1575d5fa4614cp-39, -0x1.18eb527929cedp-38, -0x1.21bd844e0e3b8p-39, 0x1.8233e415548a0p-39, 0x1.0501b16f5819bp-39, 0}, {0x1.9b4497171a29dp-39, 0x1.7f9c0bcd4b3e7p-32, 0x1.4928133bccac3p-31, 0x1.7b5a70f49485bp-31, 0x1.4f71ee2c4aff3p-31, 0x1.bca22e6a9cd38p-32, 0x1.1c93a34970852p-33, -0x1.03d86c164d20cp-33, -0x1.448222383eb95p-32, -0x1.95aa76b3417ddp-32, -0x1.80448ecd34689p-32, -0x1.19d3f547d1f1fp-32, -0x1.2c65995a6a63fp-33, -0x1.01b5832823cc6p-35, 0x1.97d70f56a4524p-35, 0x1.7d57df58d20a9p-34, 0x1.a3d6fe32773b9p-34, 0x1.6ff53581ac827p-34, 0x1.faff84d277a6fp-35, 0x1.39ff19e23455bp-35, 0x1.9b1e383b8e03dp-37, 0x1.fd37bce839816p-40, -0x1.31b58a910d109p-37, -0x1.480a28743a67fp-37, -0x1.9a8b926ca51b4p-37, -0x1.14d6b0b9c8256p-37, -0x1.227dfd10a7f51p-37, -0x1.d1d5ba9e5676cp-42, -0x1.71c57d72b90eap-38, -0x1.018922e3bb1eap-40, -0x1.e0970faab38e6p-39, 0x1.a442b8ab5ed33p-39, -0x1.3a6f0acbd7293p-40, -0x1.7c53be7062a3ap-39, -0x1.c562622693573p-44, 0x1.458e668db57cdp-41, -0x1.d5f41a61e90a0p-41, -0x1.60d1f7c57cb11p-39, -0x1.f8fa4c98324fep-39, -0x1.7b178840b90e3p-39, 0x1.a8558cdf5220ap-40, 0x1.3f7acb241cdbbp-40, -0x1.086dc81118428p-39, -0x1.15828db8b2da6p-40, 0x1.18f9d5a5099c3p-39, 0x1.21cd05249b8c9p-40, -0x1.82493a2d7a1fep-40, -0x1.0510a8a58c1abp-40, 0}, {0x1.4c0cf8eccd2e0p-35, 0x1.de696ed8004cbp-36, 0x1.62392d5363e58p-37, -0x1.21d68e1a8e4c7p-37, -0x1.867b57075ec9dp-36, -0x1.058af4c30abafp-35, -0x1.dbb6594ed5127p-36, -0x1.6006d1f354794p-36, -0x1.311e96adfec96p-37, 0x1.2c82e5ef56703p-39, 0x1.6f2c1413cbe8ep-37, 0x1.c46886dd6c5d6p-37, 0x1.92e273bf63d54p-37, 0x1.2982faf5df034p-37, 0x1.5ad37b1dc30c4p-38, 0x1.97104fd2630f8p-40, -0x1.38bcd955ecbb9p-40, -0x1.7779727d36c91p-39, -0x1.4862c13c3ccf5p-39, -0x1.53facd6319433p-39, -0x1.de2f6e88b0926p-41, -0x1.fb0967f0fa611p-41, 0x1.5fadb405af344p-42, 0x1.e90319ef64411p-43, 0x1.fc013fac4d3d7p-41, 0x1.0546d08a05cacp-41, 0x1.fa1b10c35012ep-41, -0x1.000d4354b8049p-41, 0x1.b68ee44b2b84bp-41, 0x1.cfa36d83ea2afp-48, 0x1.5c41a6c8aaf3ap-41, -0x1.7edb2342ceb28p-41, 0x1.d9211942a37d9p-43, 0x1.39b815d399ba2p-41, 0x1.1fc46969db91bp-46, -0x1.1736507c25bafp-43, 0x1.89bbcfdb5c677p-43, 0x1.28f22b295bc86p-41, 0x1.a9396e0b45a3bp-41, 0x1.3f409ac2dbfafp-41, -0x1.65682520f07a7p-42, -0x1.0d1586492d3b1p-42, 0x1.bd6c9f236abc3p-42, 0x1.d376a4bd795bep-43, -0x1.d94e87dd31275p-42, -0x1.e82d04ff5649fp-43, 0x1.455b18d5d810fp-42, 0x1.b7c6a4ab711bdp-43, 0} // clang-format on }};
103.025
146
0.78282
[ "vector" ]
16a628e41f1b66ac9038a5a63dad92da3184886d
1,568
h
C
Fusin/include/IOSystems/FusinRawInputIOSystem.h
LegendaryMauricius/Fusin
36364b708257630be8b3f1aec27c9f711d255ab1
[ "MIT" ]
null
null
null
Fusin/include/IOSystems/FusinRawInputIOSystem.h
LegendaryMauricius/Fusin
36364b708257630be8b3f1aec27c9f711d255ab1
[ "MIT" ]
null
null
null
Fusin/include/IOSystems/FusinRawInputIOSystem.h
LegendaryMauricius/Fusin
36364b708257630be8b3f1aec27c9f711d255ab1
[ "MIT" ]
null
null
null
#ifndef _FUSIN_RAW_INPUT_SYSTEM_H #define _FUSIN_RAW_INPUT_SYSTEM_H #include "FusinIOSystem.h" #include "FusinPrerequisites.h" #ifdef FUSIN_BUILD_RAW_INPUT #include <map> #include <vector> #include <list> #include <windows.h> namespace Fusin { class RawInputDeviceHandler; class Device; class KeyboardDevice; class MouseDevice; class GamepadDevice; class DSDevice; /* IOSystem for RawInput on Windows Uses the config map to set the configuration. Possible config entries: ****NAME: TYPE - DEFAULT ****Receive input outside focus: bool - True ****Support DS: bool - True ****Support XInput: bool - False ****Support Nintendo: bool - True ****Max gamepad messages: int - 0 (infinite) */ class _FUSIN_EXPORT RawInputIOSystem : public IOSystem { public: RawInputIOSystem(); ~RawInputIOSystem(); void initialize(DeviceEnumerator* de, const std::map<String, String>& config, void* window); void updateDeviceList(); void update(); void handleMessage(const MSG* msg); protected: HWND mWindow; bool mCreatedHiddenWindow;// If the hidden message window has been created RAWINPUTDEVICE *mRIDevices; std::map<HANDLE, RawInputDeviceHandler*> mHandlerPerHandle; std::map<HANDLE, int> mMessageCounterPerHandle; bool mReceiveInputOutsideFocus, mSupportXInput, mSupportDS, mSupportNintendo; int mMaxGamepadMessages; }; } // Windows headers lack this definition for horizontal scroll, but it *supposedly* works #define RI_MOUSE_HWHEEL 0x0800 #endif // FUSIN_BUILD_RAW_INPUT #endif
24.123077
95
0.737245
[ "vector" ]
16a6afa96f71a1b6373ff7c67bea266d3788a512
3,930
h
C
Socialize-noarc/SocializeFacebook.h
dontfallisleep/socialize-sdk-ios
687d4730d12be4201309f24de5820deedf848342
[ "MIT" ]
38
2015-01-07T07:22:50.000Z
2021-01-08T04:37:43.000Z
Socialize-noarc/SocializeFacebook.h
dontfallisleep/socialize-sdk-ios
687d4730d12be4201309f24de5820deedf848342
[ "MIT" ]
2
2015-02-27T02:45:24.000Z
2018-04-07T03:32:50.000Z
Socialize-noarc/SocializeFacebook.h
dontfallisleep/socialize-sdk-ios
687d4730d12be4201309f24de5820deedf848342
[ "MIT" ]
21
2015-01-28T02:56:57.000Z
2019-02-17T13:41:53.000Z
// // SocializeFacebook.h // Socialize // // Created by David Jedeikin on 10/20/14. // Copyright (c) 2014 Socialize. All rights reserved. // #import <Foundation/Foundation.h> #import <FacebookSDK/FacebookSDK.h> @protocol SocializeFBSessionDelegate; @protocol SocializeFBRequestDelegate; @interface SocializeFacebook : NSObject @property (nonatomic, copy) NSString *accessToken; @property (nonatomic, copy) NSDate *expirationDate; @property (nonatomic, assign) id<SocializeFBSessionDelegate> sessionDelegate; @property (nonatomic, copy) NSString *urlSchemeSuffix; @property (nonatomic, readonly) BOOL isFrictionlessRequestsEnabled; - (instancetype)initWithAppId:(NSString *)appId urlSchemeSuffix:(NSString *)urlSchemeSuffix andDelegate:(id<SocializeFBSessionDelegate>)delegate; - (void)authorize:(NSArray *)permissions; - (BOOL)handleOpenURL:(NSURL *)url; - (void)extendAccessToken; - (FBRequest *)requestWithGraphPath:(NSString *)graphPath andParams:(NSMutableDictionary *)params andHttpMethod:(NSString *)httpMethod andDelegate:(id<SocializeFBRequestDelegate>)delegate; @end //////////////////////////////////////////////////////////////////////////////// /** * Your application should implement this delegate to receive session callbacks. */ @protocol SocializeFBSessionDelegate <NSObject> /** * Called when the user successfully logged in. */ - (void)fbDidLogin; /** * Called when the user dismissed the dialog without logging in. */ - (void)fbDidNotLogin:(BOOL)cancelled; /** * Called after the access token was extended. If your application has any * references to the previous access token (for example, if your application * stores the previous access token in persistent storage), your application * should overwrite the old access token with the new one in this method. * See extendAccessToken for more details. */ - (void)fbDidExtendToken:(NSString *)accessToken expiresAt:(NSDate *)expiresAt; /** * Called when the user logged out. */ - (void)fbDidLogout; /** * Called when the current session has expired. This might happen when: * - the access token expired * - the app has been disabled * - the user revoked the app's permissions * - the user changed his or her password */ - (void)fbSessionInvalidated; @end enum { kFBRequestStateReady, kFBRequestStateLoading, kFBRequestStateComplete, kFBRequestStateError }; //////////////////////////////////////////////////////////////////////////////// /* *Your application should implement this delegate */ @protocol SocializeFBRequestDelegate <NSObject> @optional /** * Called just before the request is sent to the server. */ - (void)requestLoading:(FBRequest *)request; /** * Called when the Facebook API request has returned a response. * * This callback gives you access to the raw response. It's called before * (void)request:(FBRequest *)request didLoad:(id)result, * which is passed the parsed response object. */ - (void)request:(FBRequest *)request didReceiveResponse:(NSURLResponse *)response; /** * Called when an error prevents the request from completing successfully. */ - (void)request:(FBRequest *)request didFailWithError:(NSError *)error; /** * Called when a request returns and its response has been parsed into * an object. * * The resulting object may be a dictionary, an array or a string, depending * on the format of the API response. If you need access to the raw response, * use: * * (void)request:(FBRequest *)request * didReceiveResponse:(NSURLResponse *)response */ - (void)request:(FBRequest *)request didLoad:(id)result; /** * Called when a request returns a response. * * The result object is the raw response from the server of type NSData */ - (void)request:(FBRequest *)request didLoadRawResponse:(NSData *)data; @end
28.273381
82
0.696183
[ "object" ]
16aa4985421f4f4818279f4ec79c29f29423c92d
1,632
h
C
ParaViewCore/ServerManager/Default/vtkSMAnimationSceneProxy.h
UV-CDAT/ParaView
095ac28404a85fd86676491b8952884805842223
[ "Apache-2.0" ]
null
null
null
ParaViewCore/ServerManager/Default/vtkSMAnimationSceneProxy.h
UV-CDAT/ParaView
095ac28404a85fd86676491b8952884805842223
[ "Apache-2.0" ]
null
null
null
ParaViewCore/ServerManager/Default/vtkSMAnimationSceneProxy.h
UV-CDAT/ParaView
095ac28404a85fd86676491b8952884805842223
[ "Apache-2.0" ]
null
null
null
/*========================================================================= Program: ParaView Module: $RCSfile$ Copyright (c) Kitware, Inc. All rights reserved. See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notice for more information. =========================================================================*/ // .NAME vtkSMAnimationSceneProxy // .SECTION Description // vtkSMAnimationSceneProxy observes vtkCommand::ModifiedEvent on the // client-side VTK-object to call UpdatePropertyInformation() every time that // happens. #ifndef __vtkSMAnimationSceneProxy_h #define __vtkSMAnimationSceneProxy_h #include "vtkPVServerManagerDefaultModule.h" //needed for exports #include "vtkSMProxy.h" class VTKPVSERVERMANAGERDEFAULT_EXPORT vtkSMAnimationSceneProxy : public vtkSMProxy { public: static vtkSMAnimationSceneProxy* New(); vtkTypeMacro(vtkSMAnimationSceneProxy, vtkSMProxy); void PrintSelf(ostream& os, vtkIndent indent); //BTX protected: vtkSMAnimationSceneProxy(); ~vtkSMAnimationSceneProxy(); // Description: // Given a class name (by setting VTKClassName) and server ids (by // setting ServerIDs), this methods instantiates the objects on the // server(s) virtual void CreateVTKObjects(); private: vtkSMAnimationSceneProxy(const vtkSMAnimationSceneProxy&); // Not implemented void operator=(const vtkSMAnimationSceneProxy&); // Not implemented //ETX }; #endif
31.384615
83
0.705882
[ "object" ]
16ab64942b51266572cff8d73437108d3f633c20
11,023
c
C
src/distinct_values.c
sandialabs/avatar
19322b61835d73b5035640de8c822efb1f31935d
[ "BSD-3-Clause" ]
1
2022-02-26T17:25:03.000Z
2022-02-26T17:25:03.000Z
src/distinct_values.c
sandialabs/avatar
19322b61835d73b5035640de8c822efb1f31935d
[ "BSD-3-Clause" ]
null
null
null
src/distinct_values.c
sandialabs/avatar
19322b61835d73b5035640de8c822efb1f31935d
[ "BSD-3-Clause" ]
null
null
null
/********************************************************************************** Avatar Tools Copyright (c) 2019, National Technology and Engineering Solutions of Sandia, LLC All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. For questions, comments or contributions contact Philip Kegelmeyer, wpk@sandia.gov *******************************************************************************/ #include <stdlib.h> #include <stdio.h> #include <string.h> #include "crossval.h" #include "distinct_values.h" #include "util.h" #include "av_utils.h" void _tree_to_array(float *array, BST_Node *tree, int node, int *me) { if (tree[node].left != -1) _tree_to_array(array, tree, tree[node].left, me); array[(*me)++] = tree[node].value; if (tree[node].right != -1) _tree_to_array(array, tree, tree[node].right, me); } void tree_to_array(float *array, BST_Node *tree) { int me = 0; _tree_to_array(array, tree, 0, &me); } short tree_insert(BST_Node **tree, Tree_Bookkeeping *books, float new_value) { int x = 0; Boolean keep_going = TRUE; while (keep_going) { if (new_value < (*tree)[x].value) { if ((*tree)[x].left == -1) { // Can't go any further -- create new node keep_going = FALSE; (*tree)[x].left = books->next_unused_node; // Make sure we have a node allocated while (books->num_malloced_nodes <= books->next_unused_node) { books->num_malloced_nodes *= 2; *tree = (BST_Node *)realloc(*tree, books->num_malloced_nodes * sizeof(BST_Node)); } (*tree)[books->next_unused_node].value = new_value; (*tree)[books->next_unused_node].left = -1; (*tree)[books->next_unused_node].right = -1; books->next_unused_node++; } else { x = (*tree)[x].left; } } else if (new_value > (*tree)[x].value) { if ((*tree)[x].right == -1) { // Can't go any further -- create new node keep_going = FALSE; (*tree)[x].right = books->next_unused_node; // Make sure we have a node allocated while (books->num_malloced_nodes <= books->next_unused_node) { books->num_malloced_nodes *= 2; *tree = (BST_Node *)realloc(*tree, books->num_malloced_nodes * sizeof(BST_Node)); } (*tree)[books->next_unused_node].value = new_value; (*tree)[books->next_unused_node].left = -1; (*tree)[books->next_unused_node].right = -1; books->next_unused_node++; } else { x = (*tree)[x].right; } } else { // We've seen this value already return 0; } } return 1; } int translate(float *array, float value, int low, int high) { int match = (low + high)/2; //printf(" low -> match -> high = %d -> %d -> %d\n", low, match, high); //printf(" value -> value = %f -> %f\n", value, array[match]); if (value == array[match]) return match; else { if (value > array[match]) return translate(array, value, match, high); else return translate(array, value, low, match); } } int translate_discrete(char **map, int num_ids, char *value) { int i; //printf("Looking for %s ...\n", value); for (i = 0; i < num_ids; i++) { //printf(" ... '%s'?\n", map[i]); if (! strcmp(map[i], value)) return i; } return -1; } void create_cv_subset(CV_Dataset data, CV_Subset *train) { #ifdef HAVE_AVATAR_FCLIB int i, j, k; AV_ReturnCode rc; void *data_ptr; int num_data_points; BST_Node **tree; Tree_Bookkeeping *books; train->meta.num_classes = data.meta.num_classes; train->meta.num_attributes = data.meta.num_attributes; train->meta.num_fclib_seq = data.meta.num_fclib_seq; train->meta.num_examples = data.meta.num_examples; train->meta.class_names = data.meta.class_names; train->meta.attribute_names = data.meta.attribute_names; train->meta.attribute_types = data.meta.attribute_types; train->meta.global_offset = data.meta.global_offset; train->examples = data.examples; free(train->meta.num_examples_per_class); train->meta.num_examples_per_class = (int *)malloc(data.meta.num_classes * sizeof(int)); for (i = 0; i < data.meta.num_classes; i++) train->meta.num_examples_per_class[i] = data.meta.num_examples_per_class[i]; //printf("Copying %d sequences\n", data.meta.exo_data.num_seq_meshes); if (data.meta.exo_data.num_seq_meshes > 0) { train->meta.exo_data.num_seq_meshes = data.meta.exo_data.num_seq_meshes; train->meta.exo_data.seq_meshes = (FC_Mesh *)malloc(train->meta.exo_data.num_seq_meshes * sizeof(FC_Mesh)); for (i = 0; i < train->meta.exo_data.num_seq_meshes; i++) train->meta.exo_data.seq_meshes[i] = data.meta.exo_data.seq_meshes[i]; train->meta.exo_data.assoc_type = data.meta.exo_data.assoc_type; } // Allocate one tree and one set of high/low for each attribute tree = (BST_Node **)malloc(train->meta.num_attributes * sizeof(BST_Node *)); books = (Tree_Bookkeeping *)malloc(train->meta.num_attributes * sizeof(Tree_Bookkeeping)); train->low = (int *)malloc(train->meta.num_attributes * sizeof(int)); train->high = (int *)malloc(train->meta.num_attributes * sizeof(int)); for (i = 0; i < train->meta.num_fclib_seq; i++) { for (j = 0; j < train->meta.num_attributes; j++) { // Initialize the tree for each attribute on the first sequence only if (i == 0) { books[j].num_malloced_nodes = 1000; books[j].next_unused_node = 1; books[j].current_node = 0; tree[j] = (BST_Node *)malloc(books[i].num_malloced_nodes * sizeof(BST_Node)); //tree[j] = NULL; } // Get data pointer for this attribute rc = fc_getVariableDataPtr(data.meta.exo_data.variables[i][j], &data_ptr); av_exitIfErrorPrintf(rc, "Failed to get data pointer for %s on mesh %d\n", data.meta.attribute_names[j], i); // Step through data and insert into tree rc = fc_getVariableNumDataPoint(data.meta.exo_data.variables[i][j], &num_data_points); for (k = 0; k < num_data_points; k++) { if (books[j].current_node == 0) { tree[j][0].value = *((double *)(data_ptr) + k); tree[j][0].left = -1; tree[j][0].right = -1; train->low[j] = 0; train->high[j] = 0; // current_node == 0 only triggers the initialization. Otherwise we don't care about it. // Increment it only so the initialization is not repeated books[j].current_node++; } else { train->high[j] += tree_insert(&tree[j], &books[j], *((double *)(data_ptr) + k)); } } } } // Create the float array to translate int back to float for each attribute train->float_data = (float **)malloc(train->meta.num_attributes * sizeof(float *)); for (i = 0; i < train->meta.num_attributes; i++) { train->float_data[i] = (float *)malloc((train->high[i] + 1)*sizeof(float)); tree_to_array(train->float_data[i], tree[i]); free(tree[i]); } free(tree); #else av_missingFCLIB(); #endif } void populate_distinct_values_from_dataset(CV_Dataset data, CV_Subset *sub, AV_SortedBlobArray *blob) { #ifdef HAVE_AVATAR_FCLIB int i, j, k; int gid; FC_ReturnCode rc; for (i = 0; i < data.meta.num_fclib_seq; i++) { for (j = 0; j < data.meta.num_attributes; j++) { // Get data pointer for this mesh and attribute void *data_ptr; rc = fc_getVariableDataPtr(data.meta.exo_data.variables[i][j], &data_ptr); av_exitIfErrorPrintf(rc, "Failed to get data pointer for sequence %d and attribute %d\n", i, j); for (k = 0; k < data.meta.global_offset[i+1] - data.meta.global_offset[i]; k++) { gid = fclib2global(i, k, data.meta.num_fclib_seq, data.meta.global_offset); if (j == 0) { sub->examples[gid].distinct_attribute_values = (int *)malloc(data.meta.num_attributes * sizeof(int)); rc = av_addBlobToSortedBlobArray(blob, &sub->examples[gid], cv_example_compare_by_seq_id); if (rc < 0) { av_exitIfErrorPrintf(rc, "Failed to add example %d to SBA\n", gid); } else if (rc == 0) { fprintf(stderr, "Example %d already exists in SBA\n", gid); } } sub->examples[gid].distinct_attribute_values[j] = translate(sub->float_data[j], *((double *)data_ptr + k), 0, sub->high[j] + 1); } } } #else av_missingFCLIB(); #endif }
43.227451
120
0.576613
[ "mesh" ]
16b8c5bf5efa90574495c3fb6530d9a66f487f8b
3,762
c
C
kernel_dvfs/linux-linaro-tracking-gem5/drivers/gpu/drm/nouveau/core/subdev/gpio/nve0.c
lokeshjindal15/pd-gem5_transformer
f8eb40dc65a5d7e15c8aa0756b1b48dd104bd54f
[ "BSD-3-Clause" ]
55
2019-12-20T03:25:14.000Z
2022-01-16T07:19:47.000Z
kernel_dvfs/linux-linaro-tracking-gem5/drivers/gpu/drm/nouveau/core/subdev/gpio/nve0.c
lokeshjindal15/pd-gem5_transformer
f8eb40dc65a5d7e15c8aa0756b1b48dd104bd54f
[ "BSD-3-Clause" ]
2
2020-11-02T08:01:00.000Z
2022-03-27T02:59:18.000Z
kernel_dvfs/linux-linaro-tracking-gem5/drivers/gpu/drm/nouveau/core/subdev/gpio/nve0.c
lokeshjindal15/pd-gem5_transformer
f8eb40dc65a5d7e15c8aa0756b1b48dd104bd54f
[ "BSD-3-Clause" ]
11
2020-08-06T03:59:45.000Z
2022-02-25T02:31:59.000Z
/* * Copyright 2012 Red Hat Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. * * Authors: Ben Skeggs */ #include "priv.h" struct nve0_gpio_priv { struct nouveau_gpio base; }; void nve0_gpio_intr(struct nouveau_subdev *subdev) { struct nve0_gpio_priv *priv = (void *)subdev; u32 intr0 = nv_rd32(priv, 0xdc00) & nv_rd32(priv, 0xdc08); u32 intr1 = nv_rd32(priv, 0xdc80) & nv_rd32(priv, 0xdc88); u32 hi = (intr0 & 0x0000ffff) | (intr1 << 16); u32 lo = (intr0 >> 16) | (intr1 & 0xffff0000); int i; for (i = 0; (hi | lo) && i < 32; i++) { if ((hi | lo) & (1 << i)) nouveau_event_trigger(priv->base.events, i); } nv_wr32(priv, 0xdc00, intr0); nv_wr32(priv, 0xdc88, intr1); } void nve0_gpio_intr_enable(struct nouveau_event *event, int line) { const u32 addr = line < 16 ? 0xdc00 : 0xdc80; const u32 mask = 0x00010001 << (line & 0xf); nv_wr32(event->priv, addr + 0x08, mask); nv_mask(event->priv, addr + 0x00, mask, mask); } void nve0_gpio_intr_disable(struct nouveau_event *event, int line) { const u32 addr = line < 16 ? 0xdc00 : 0xdc80; const u32 mask = 0x00010001 << (line & 0xf); nv_wr32(event->priv, addr + 0x08, mask); nv_mask(event->priv, addr + 0x00, mask, 0x00000000); } int nve0_gpio_fini(struct nouveau_object *object, bool suspend) { struct nve0_gpio_priv *priv = (void *)object; nv_wr32(priv, 0xdc08, 0x00000000); nv_wr32(priv, 0xdc88, 0x00000000); return nouveau_gpio_fini(&priv->base, suspend); } int nve0_gpio_init(struct nouveau_object *object) { struct nve0_gpio_priv *priv = (void *)object; int ret; ret = nouveau_gpio_init(&priv->base); if (ret) return ret; nv_wr32(priv, 0xdc00, 0xffffffff); nv_wr32(priv, 0xdc80, 0xffffffff); return 0; } void nve0_gpio_dtor(struct nouveau_object *object) { struct nve0_gpio_priv *priv = (void *)object; nouveau_gpio_destroy(&priv->base); } static int nve0_gpio_ctor(struct nouveau_object *parent, struct nouveau_object *engine, struct nouveau_oclass *oclass, void *data, u32 size, struct nouveau_object **pobject) { struct nve0_gpio_priv *priv; int ret; ret = nouveau_gpio_create(parent, engine, oclass, 32, &priv); *pobject = nv_object(priv); if (ret) return ret; priv->base.reset = nvd0_gpio_reset; priv->base.drive = nvd0_gpio_drive; priv->base.sense = nvd0_gpio_sense; priv->base.events->priv = priv; priv->base.events->enable = nve0_gpio_intr_enable; priv->base.events->disable = nve0_gpio_intr_disable; nv_subdev(priv)->intr = nve0_gpio_intr; return 0; } struct nouveau_oclass nve0_gpio_oclass = { .handle = NV_SUBDEV(GPIO, 0xe0), .ofuncs = &(struct nouveau_ofuncs) { .ctor = nve0_gpio_ctor, .dtor = nv50_gpio_dtor, .init = nve0_gpio_init, .fini = nve0_gpio_fini, }, };
28.5
77
0.719298
[ "object" ]
16babbfa8ed1a6cf2b0425ac0ba531f2e3dc95cb
1,485
h
C
Arkanoid/IArkanoidPhysics.h
Excelsus4/ArkanoidGame
15f4aa1cf4bfc950bed36f2701d699f3dec82f8c
[ "MIT" ]
null
null
null
Arkanoid/IArkanoidPhysics.h
Excelsus4/ArkanoidGame
15f4aa1cf4bfc950bed36f2701d699f3dec82f8c
[ "MIT" ]
null
null
null
Arkanoid/IArkanoidPhysics.h
Excelsus4/ArkanoidGame
15f4aa1cf4bfc950bed36f2701d699f3dec82f8c
[ "MIT" ]
null
null
null
#pragma once #include "stdafx.h" struct World { vector<void*> blocks; vector<void*> balls; vector<void*> powerups; void* vaus; int* life; }; class IArkanoidPhysics { public: IArkanoidPhysics(World* world) : world(world) {}; virtual ~IArkanoidPhysics() {}; virtual void PhysicsUpdate() = 0; virtual void Update(D3DXMATRIX& V, D3DXMATRIX& P) { animation->Update(V, P); } virtual void Render() { animation->Render(); } virtual bool CheckCollision(IArkanoidPhysics* b) { return GetSprite()->AABB(b->GetSprite()); } virtual Sprite* GetSprite() { return animation->GetSprite(); } virtual D3DXVECTOR2 Position() const { return animation->Position(); } virtual void Position(float x, float y) { Position(D3DXVECTOR2(x, y)); } virtual void Position(D3DXVECTOR2 vec) { animation->Position(vec); } virtual D3DXVECTOR2 Scale() const { return animation->Scale(); } virtual void Scale(float x, float y) { Scale(D3DXVECTOR2(x, y)); } virtual void Scale(D3DXVECTOR2 vec) { animation->Scale(vec); } //Arkanoid Objects never rotates. virtual D3DXVECTOR2 Size() const { return animation->TextureSize(); } virtual D3DXVECTOR2 HalfSize() const { return animation->TextureSize()*0.5f; } // These two method only used by ball and vaus relation virtual void TryAttaching(IArkanoidPhysics* ball) {}; virtual void SetVelocity(D3DXVECTOR2 vec) {}; virtual void Reflect(D3DXVECTOR2 normal) {}; virtual void Feed(int type) {}; protected: World* world; Animation* animation; };
32.282609
95
0.721212
[ "render", "vector" ]
16bccbf6d3b2be4738eda64aaf3378834df14984
7,952
h
C
apps/covid_sonif_app.h
CS126SP20/final-project-renzol2
5803a1eaa8a27e9f1288946d34f34dedb10c2fa0
[ "MIT" ]
null
null
null
apps/covid_sonif_app.h
CS126SP20/final-project-renzol2
5803a1eaa8a27e9f1288946d34f34dedb10c2fa0
[ "MIT" ]
null
null
null
apps/covid_sonif_app.h
CS126SP20/final-project-renzol2
5803a1eaa8a27e9f1288946d34f34dedb10c2fa0
[ "MIT" ]
1
2021-02-01T23:13:57.000Z
2021-02-01T23:13:57.000Z
// Copyright (c) 2020 CS126SP20. All rights reserved. #ifndef FINALPROJECT_APPS_MYAPP_H_ #define FINALPROJECT_APPS_MYAPP_H_ #include "cinder/app/App.h" #include "cinder/app/RendererGl.h" #include "cinder/gl/gl.h" #include "cinder/Log.h" #include "cinder/params/Params.h" // According to the project guide, backtracking through the directory is // supposedly incorrect. Need to figure what to do about my directory structure #include "cinder/audio/audio.h" #include "../blocks/Cinder-Stk/src/cistk/CinderStk.h" #include "../include/coviddata/dataset.h" #include <string> #include <vector> namespace covidsonifapp { /** * Application that allows sonification and visualization of COVID-19 data about * confirmed cases, deaths, and testing courtesy of Our World In Data. * * Audio synthesis using source code from the StkTestApp: * https://github.com/richardeakin/Cinder-Stk/blob/master/samples/StkTest/src/StkTestApp.cpp */ class CovidSonificationApp : public cinder::app::App { /** * Constructor and Cinder Application Overriden functions */ public: CovidSonificationApp(); void setup() override; void update() override; void draw() override; void mouseDown(cinder::app::MouseEvent event) override; void mouseDrag(cinder::app::MouseEvent event) override; void mouseUp(cinder::app::MouseEvent event) override; /** * Public functions */ public: void SetupParams(); void MakeNote(const cinder::vec2& pos); void MakeNoteFromAmount(float amount, float max_amount); float QuantizePitch(const cinder::vec2 &pos); float QuantizePitchFromAmount(float amount, float max_amount); void StopNote(); void HandleInstrumentsSelected(); void HandleEffectSelected(); bool HandleInstrumentSpecificNote(const cinder::vec2& pos); void HandleDataSelected(); void HandleRegionSelected(); void HandleScaleSelected(); void HandleUpperBoundSelected(); void SonifyData(); static void PrintAudioGraph(); void DisplayDirections(); void DisplayPitch(); void DisplayCurrentDataset(); void DisplayCurrentNoteData(); void DisplayVisualizationToggle(); void DrawNoteData(); /** * Private helper functions */ private: void SetupMasterGain(); void SetupInstruments(); void SetupEffects(); void SetupData(); void SetupRegions(); void SetupMaxMidiPitchParam(); void SetMaxPitch(size_t new_pitch); void SetupMinMidiPitchParam(); void SetMinPitch(size_t new_pitch); void SetupScale(); void SetupBpm(); void SetupUpperBound(); void SetupVisualizationScaling(); void SetupRgba(); void SetupVisualizeButton(); void SetupSonifyButton(); void AssignBpm(size_t set_bpm); void AssignHeightScaling(float new_scaling); void AssignWidthScaling(float new_scaling); void SetupDataSonificationParams(); void RemoveDataSonificationParams(); void HandleNote(float freq, float gain); static void ShowText(const std::string& text, const cinder::Color& color, const cinder::ivec2& size, const cinder::vec2& loc); static float GetHighestRegionalAmount(const coviddata::RegionData& rd); static float GetHighestAmountInData(const coviddata::DataSet &ds, bool include_world); static int ConvertBpmToMilliseconds(int bpm); cinder::vec2 ConvertDataPointToPosition(size_t date_index, float amount); /** * Internal structure class for scales */ private: struct Scale { std::string scale_name; std::vector<float> scale_degrees; size_t scale_length; }; /** * Instance variables */ private: ci::audio::GainNodeRef master_gain_; cistk::InstrumentNodeRef instrument_; cistk::EffectNodeRef effect_; Scale current_scale_; coviddata::DataSet current_data_; coviddata::RegionData current_region_; cinder::params::InterfaceGlRef params_; // Instance variables for COVID-19 Data std::vector<std::string> region_names_; float max_amount_ = 0; std::string current_date_ = {}; float current_amount_ = coviddata::kNullAmount; size_t current_date_index_ = 0; size_t current_midi_pitch_; // Variables for sonification parameters (set to initial values) size_t max_midi_pitch_ = 96; size_t min_midi_pitch_ = 36; int bpm_ = 999; std::chrono::milliseconds interval; // Visualization parameters float visualization_height_scaling_ = 1.0f; float visualization_width_scaling_ = 1.0f; float red_ = 1.0f; float green_ = 0.0f; float blue_ = 0.0f; float opacity_ = 0.75f; bool in_sonification_playback = false; bool finished_playback = false; bool is_visualizing = true; // Audio synthesis params (set to initial values) size_t instrument_selection_ = 4; size_t effect_enum_selection = 0; size_t dataset_selection_ = 0; size_t region_selection_ = 0; size_t scale_selection_ = 4; size_t max_value_selection_ = 1; float last_freq_ = 0; /** * Names for parameters */ private: const std::string kMaxPitchParamName = "Max pitch (MIDI)"; const std::string kMinPitchParamName = "Min pitch (MIDI)"; const std::vector<std::string> kInstrumentNames = { "none", "BandedWG", "BlowHole", "Bowed", "Clarinet", "Mandolin", "Plucked", "Saxofony" }; const std::vector<std::string> kEffectNames = { "PRCRev", "JCRev", "NRev" }; const std::vector<std::string> kDatasetFilepaths = { getAssetPath("data/total_cases.csv").string(), getAssetPath("data/total_deaths.csv").string(), getAssetPath("data/new_cases.csv").string(), getAssetPath("data/new_deaths.csv").string(), getAssetPath("data/cumulative_total_tests.csv").string(), getAssetPath("data/daily_change_in_cumulative_total.csv").string(), getAssetPath("data/total_cases_per_million.csv").string(), getAssetPath("data/total_deaths_per_million.csv").string(), getAssetPath("data/new_cases_per_million.csv").string(), getAssetPath("data/new_deaths_per_million.csv").string(), getAssetPath("data/cumulative_total_per_thousand.csv").string(), getAssetPath("data/daily_change_in_cumulative_total_per_thousand.csv") .string() }; const std::vector<std::string> kDatasetNames = { "none", "Total COVID-19 cases", "Total COVID-19 deaths", "Daily increase of COVID-19 cases", "Daily increase of COVID-19 deaths", "Cumulative total tests", "Daily change in total tests", "Total cases per million", "Total deaths per million", "Daily increase of cases per million", "Daily increase of deaths per million", "Cumulative total tests per thousand", "Daily change in total tests per thousand" }; const size_t kRegionalMax = 0; const size_t kInternationalMax = 1; const size_t kCumulativeMax = 2; const std::vector<std::string> kMaxValueSettingNames = { "Regional maximum", "International maximum", "Cumulative maximum" }; /** * Scale information */ private: const std::vector<std::string> kScaleNames = { "Major", "Minor", "Pentatonic", "Whole tone", "Chromatic" }; const std::vector<float> kMajorScale = {0, 2, 4, 5, 7, 9, 11}; const std::vector<float> kMinorScale = {0, 2, 3, 5, 7, 8, 10}; const std::vector<float> kPentatonicScale = {0, 2, 4, 7, 9}; const std::vector<float> kWholeToneScale = {0, 2, 4, 6, 8, 10}; const std::vector<float> kChromaticScale = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}; const std::vector<covidsonifapp::CovidSonificationApp::Scale> kScales = { {kScaleNames.at(0), kMajorScale, kMajorScale.size()}, {kScaleNames.at(1), kMinorScale, kMinorScale.size()}, {kScaleNames.at(2), kPentatonicScale, kPentatonicScale.size()}, {kScaleNames.at(3), kWholeToneScale, kWholeToneScale.size()}, {kScaleNames.at(4), kChromaticScale, kChromaticScale.size()} }; }; } // namespace covidsonifapp #endif // FINALPROJECT_APPS_MYAPP_H_
30.584615
92
0.706615
[ "vector" ]
16be5792d1bfd0d48510e68640c5f71e06095a7b
6,386
c
C
usr/src/sys/arch/mvme88k/mvme88k/m187_machdep.c
sizeofvoid/ifconfigd
bdff4b2cec6d572c1450cb44f32c0bdab1b49e5f
[ "BSD-2-Clause" ]
2
2020-04-15T13:39:01.000Z
2020-08-28T01:27:00.000Z
usr/src/sys/arch/mvme88k/mvme88k/m187_machdep.c
sizeofvoid/ifconfigd
bdff4b2cec6d572c1450cb44f32c0bdab1b49e5f
[ "BSD-2-Clause" ]
null
null
null
usr/src/sys/arch/mvme88k/mvme88k/m187_machdep.c
sizeofvoid/ifconfigd
bdff4b2cec6d572c1450cb44f32c0bdab1b49e5f
[ "BSD-2-Clause" ]
1
2020-08-28T01:25:41.000Z
2020-08-28T01:25:41.000Z
/* $OpenBSD: m187_machdep.c,v 1.22 2010/12/31 21:38:08 miod Exp $ */ /* * Copyright (c) 1998, 1999, 2000, 2001 Steve Murphree, Jr. * Copyright (c) 1996 Nivas Madhur * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by Nivas Madhur. * 4. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ /* * Mach Operating System * Copyright (c) 1993-1991 Carnegie Mellon University * Copyright (c) 1991 OMRON Corporation * All Rights Reserved. * * Permission to use, copy, modify and distribute this software and its * documentation is hereby granted, provided that both the copyright * notice and this permission notice appear in all copies of the * software, derivative works or modified versions, and any portions * thereof, and that both notices appear in supporting documentation. * */ #include <sys/param.h> #include <sys/systm.h> #include <sys/kernel.h> #include <sys/errno.h> #include <uvm/uvm_extern.h> #include <machine/asm_macro.h> #include <machine/cmmu.h> #include <machine/cpu.h> #include <machine/reg.h> #include <machine/trap.h> #include <machine/m88100.h> #include <machine/mvme187.h> #include <mvme88k/dev/memcreg.h> #include <mvme88k/dev/pcctworeg.h> #include <mvme88k/mvme88k/clockvar.h> void m187_bootstrap(void); void m187_ext_int(struct trapframe *); u_int m187_getipl(void); vaddr_t m187_memsize(void); u_int m187_raiseipl(u_int); u_int m187_setipl(u_int); /* * Figure out how much memory is available, by querying the memory controllers. */ vaddr_t m187_memsize() { struct memcreg *memc; vaddr_t x; memc = (struct memcreg *)MEM_CTLR; x = MEMC_MEMCONF_RTOB(memc->memc_memconf); memc = (struct memcreg *)(MEM_CTLR + 0x100); if (!badaddr((vaddr_t)&memc->memc_memconf, 1)) x += MEMC_MEMCONF_RTOB(memc->memc_memconf); return x; } /* * Device interrupt handler for MVME187 */ void m187_ext_int(struct trapframe *eframe) { int level; struct intrhand *intr; intrhand_t *list; int ret; vaddr_t ivec; u_int8_t vec; level = *(u_int8_t *)M187_ILEVEL & 0x07; /* generate IACK and get the vector */ ivec = M187_IACK + (level << 2) + 0x03; vec = *(volatile u_int8_t *)ivec; #ifdef MULTIPROCESSOR if (eframe->tf_mask < IPL_SCHED) __mp_lock(&kernel_lock); #endif uvmexp.intrs++; /* block interrupts at level or lower */ m187_setipl(level); flush_pipeline(); set_psr(get_psr() & ~PSR_IND); list = &intr_handlers[vec]; if (SLIST_EMPTY(list)) { /* increment intr counter */ printf("Spurious interrupt (level %x and vec %x)\n", level, vec); } else { #ifdef DEBUG intr = SLIST_FIRST(list); if (intr->ih_ipl != level) { panic("Handler ipl %x not the same as level %x. " "vec = 0x%x", intr->ih_ipl, level, vec); } #endif /* * Walk through all interrupt handlers in the chain for the * given vector, calling each handler in turn, till some handler * returns a value != 0. */ ret = 0; SLIST_FOREACH(intr, list, ih_link) { if (intr->ih_wantframe != 0) ret = (*intr->ih_fn)((void *)eframe); else ret = (*intr->ih_fn)(intr->ih_arg); if (ret != 0) { intr->ih_count.ec_count++; break; } } if (ret == 0) { printf("Unclaimed interrupt (level %x and vec %x)\n", level, vec); } } /* * process any remaining data access exceptions before * returning to assembler */ if (eframe->tf_dmt0 & DMT_VALID) m88100_trap(T_DATAFLT, eframe); /* * Disable interrupts before returning to assembler, the spl will * be restored later. */ set_psr(get_psr() | PSR_IND); #ifdef MULTIPROCESSOR if (eframe->tf_mask < IPL_SCHED) __mp_unlock(&kernel_lock); #endif } u_int m187_getipl(void) { return *(u_int8_t *)M187_IMASK & 0x07; } u_int m187_setipl(u_int level) { u_int curspl, psr; psr = get_psr(); set_psr(psr | PSR_IND); curspl = *(u_int8_t *)M187_IMASK & 0x07; *(u_int8_t *)M187_IMASK = level; /* * We do not flush the pipeline here, because interrupts are disabled, * and set_psr() will synchronize the pipeline. */ set_psr(psr); return curspl; } u_int m187_raiseipl(u_int level) { u_int curspl, psr; psr = get_psr(); set_psr(psr | PSR_IND); curspl = *(u_int8_t *)M187_IMASK & 0x07; if (curspl < level) *(u_int8_t *)M187_IMASK = level; /* * We do not flush the pipeline here, because interrupts are disabled, * and set_psr() will synchronize the pipeline. */ set_psr(psr); return curspl; } void m187_bootstrap() { extern int cpuspeed; extern struct cmmu_p cmmu8820x; /* * Find out the processor speed, from the PCC2 prescaler * adjust register. */ cpuspeed = 256 - *(volatile u_int8_t *)(PCC2_BASE + PCCTWO_PSCALEADJ); cmmu = &cmmu8820x; md_interrupt_func_ptr = m187_ext_int; md_getipl = m187_getipl; md_setipl = m187_setipl; md_raiseipl = m187_raiseipl; md_init_clocks = m1x7_init_clocks; md_delay = m1x7_delay; #ifdef MULTIPROCESSOR md_smp_setup = m88100_smp_setup; #endif }
25.95935
79
0.711557
[ "vector" ]
16bf0b68e558064e75a94b37f1ca8e678f7adf3d
5,330
h
C
bcftools/call.h
heavywatal/pysam
482e887e67ce035e8a9e8fe1ec55be6c80d3e5dc
[ "MIT" ]
553
2015-01-02T15:04:03.000Z
2022-03-31T18:14:11.000Z
bcftools/call.h
heavywatal/pysam
482e887e67ce035e8a9e8fe1ec55be6c80d3e5dc
[ "MIT" ]
940
2015-01-05T05:12:07.000Z
2022-03-30T17:09:19.000Z
bcftools/call.h
heavywatal/pysam
482e887e67ce035e8a9e8fe1ec55be6c80d3e5dc
[ "MIT" ]
287
2015-01-04T22:46:07.000Z
2022-03-23T20:37:25.000Z
/* call.h -- variant calling declarations. Copyright (C) 2013-2015, 2019-2020 Genome Research Ltd. Author: Petr Danecek <pd3@sanger.ac.uk> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef __CALL_H__ #define __CALL_H__ #include <htslib/vcf.h> #include <htslib/synced_bcf_reader.h> #include "vcmp.h" #define CALL_KEEPALT 1 #define CALL_VARONLY (1<<1) #define CALL_CONSTR_TRIO (1<<2) #define CALL_CONSTR_ALLELES (1<<3) // #define CALL_FMT_PV4 (1<<5) #define CALL_FMT_GQ (1<<6) #define CALL_FMT_GP (1<<7) #define FATHER 0 #define MOTHER 1 #define CHILD 2 typedef struct { char *name; int sample[3]; // father, mother, child int type; // see FTYPE_* definitions in mcall.c } family_t; // For the single-sample and grouped -G calling typedef struct { double ref_lk, max_lk, lk_sum; float *qsum; // QS(quality sum) values int nqsum; uint32_t *smpl, nsmpl; uint32_t nals, als; } smpl_grp_t; // For the `-C alleles -i` constrained calling typedef struct { uint32_t n:31, used:1; char **allele; } tgt_als_t; typedef struct _ccall_t ccall_t; typedef struct { // mcall only int npdg; int *als_map, nals_map; // mapping from full set of alleles to trimmed set of alleles (old -> new) int *pl_map, npl_map; // same as above for PLs, but reverse (new -> old) char **als; // array to hold the trimmed set of alleles to appear on output int nals; // size of the als array int als_new, nals_new; // bitmask with final alleles and their number family_t *fams; // list of families and samples for trio calling int nfams, mfams; int ntrio[5][5]; // possible trio genotype combinations and their counts; first idx: uint16_t *trio[5][5]; // family type, second index: allele count (2-4, first two are unused) double *GLs; float *GPs; // FORMAT/GP: posterior probabilities int32_t *GQs, *ADs; // FORMAT/GQ: genotype qualities; AD: allelic depth for -G int32_t *itmp; // temporary int array, used for new PLs with CALL_CONSTR_ALLELES int n_itmp, nGPs, nADs; vcmp_t *vcmp; double trio_Pm_SNPs, trio_Pm_del, trio_Pm_ins; // P(mendelian) for trio calling, see mcall_call_trio_genotypes() int32_t *ugts, *cgts; // unconstraind and constrained GTs uint32_t output_tags; char *prior_AN, *prior_AC; // reference panel AF tags (AF=AC/AN) tgt_als_t *tgt_als; // for CALL_CONSTR_ALLELES char *sample_groups; // for single-sample or grouped calling with -G char *sample_groups_tag; // for -G [AD|QS:] smpl_grp_t *smpl_grp; int nsmpl_grp; // ccall only double indel_frac, min_perm_p, min_lrt; double prior_type, pref; int ngrp1_samples, n_perm; char *prior_file; ccall_t *cdat; // shared bcf_srs_t *srs; // BCF synced readers holding target alleles for CALL_CONSTR_ALLELES bcf1_t *rec; bcf_hdr_t *hdr; uint32_t flag; // One or more of the CALL_* flags defined above uint8_t *ploidy, all_diploid, unseen; double pl2p[256]; // PL to 10^(-PL/10) table int32_t *PLs; // VCF PL likelihoods (rw) int nPLs, mPLs, nac; int32_t *gts, *ac; // GTs and AC (w) double *pdg; // PLs converted to P(D|G) float *anno16; int n16; // see anno[16] in bam2bcf.h double theta; // prior } call_t; void error(const char *format, ...); /* * call() - return -1 value on critical error; -2 to skip the site; or the number of non-reference * alleles on success. */ int mcall(call_t *call, bcf1_t *rec); // multiallic and rare-variant calling model int ccall(call_t *call, bcf1_t *rec); // the default consensus calling model int qcall(call_t *call, bcf1_t *rec); // QCall output void mcall_init(call_t *call); void ccall_init(call_t *call); void qcall_init(call_t *call); void mcall_destroy(call_t *call); void ccall_destroy(call_t *call); void qcall_destroy(call_t *call); void call_init_pl2p(call_t *call); uint32_t *call_trio_prep(int is_x, int is_son); void init_allele_trimming_maps(call_t *call, int nals_ori, int als_out); void mcall_trim_and_update_numberR(call_t *call, bcf1_t *rec, int nals_ori, int nals_new); #endif
35.533333
121
0.687805
[ "model" ]
16c2e56889a05dc1990a6dc17b5e0942a8a6bb02
7,692
h
C
components/download/internal/background_service/stats.h
sarang-apps/darshan_browser
173649bb8a7c656dc60784d19e7bb73e07c20daa
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
null
null
null
components/download/internal/background_service/stats.h
sarang-apps/darshan_browser
173649bb8a7c656dc60784d19e7bb73e07c20daa
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
null
null
null
components/download/internal/background_service/stats.h
sarang-apps/darshan_browser
173649bb8a7c656dc60784d19e7bb73e07c20daa
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
null
null
null
// Copyright 2017 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef COMPONENTS_DOWNLOAD_INTERNAL_BACKGROUND_SERVICE_STATS_H_ #define COMPONENTS_DOWNLOAD_INTERNAL_BACKGROUND_SERVICE_STATS_H_ #include "base/files/file.h" #include "base/optional.h" #include "components/download/internal/background_service/controller.h" #include "components/download/internal/background_service/download_blockage_status.h" #include "components/download/internal/background_service/driver_entry.h" #include "components/download/internal/background_service/entry.h" #include "components/download/public/background_service/clients.h" #include "components/download/public/background_service/download_params.h" #include "components/download/public/task/download_task_types.h" namespace download { struct StartupStatus; namespace stats { // Please follow the following rules for all enums: // 1. Keep them in sync with the corresponding entry in enums.xml. // 2. Treat them as append only. // 3. Do not remove any enums. Only mark them as deprecated. // Enum used to track download service start up result and failure reasons. // Most of the fields should map to StartupStatus. // Failure reasons are not mutually exclusive. enum class StartUpResult { // Download service successfully started. SUCCESS = 0, // Download service start up failed. FAILURE = 1, // Download driver is not ready. FAILURE_REASON_DRIVER = 2, // Database layer failed to initialized. FAILURE_REASON_MODEL = 3, // File monitor failed to start. FAILURE_REASON_FILE_MONITOR = 4, // The count of entries for the enum. COUNT = 5, }; // Enum used by UMA metrics to track which actions a Client is taking on the // service. enum class ServiceApiAction { // Represents a call to DownloadService::StartDownload. START_DOWNLOAD = 0, // Represents a call to DownloadService::PauseDownload. PAUSE_DOWNLOAD = 1, // Represents a call to DownloadService::ResumeDownload. RESUME_DOWNLOAD = 2, // Represents a call to DownloadService::CancelDownload. CANCEL_DOWNLOAD = 3, // Represents a call to DownloadService::ChangeCriteria. CHANGE_CRITERIA = 4, // The count of entries for the enum. COUNT = 5, }; // Enum used by UMA metrics to tie to specific actions taken on a Model. This // can be used to track failure events. enum class ModelAction { // Represents an attempt to initialize the Model. INITIALIZE = 0, // Represents an attempt to add an Entry to the Model. ADD = 1, // Represents an attempt to update an Entry in the Model. UPDATE = 2, // Represents an attempt to remove an Entry from the Model. REMOVE = 3, // The count of entries for the enum. COUNT = 4, }; // Enum used by UMA metrics to log the status of scheduled tasks. enum class ScheduledTaskStatus { // Startup failed and the task was not run. ABORTED_ON_FAILED_INIT = 0, // OnStopScheduledTask() was received before the task could be fired. CANCELLED_ON_STOP = 1, // Callback was run successfully after completion of the task. COMPLETED_NORMALLY = 2, // The count of entries for the enum. COUNT = 3, }; // Enum used by UMA metrics to track various types of cleanup actions taken by // the service. enum class FileCleanupReason { // The file was deleted by the service after timeout. TIMEOUT = 0, // The database entry for the file was found not associated with any // registered client. ORPHANED = 1, // At startup, the file was found not being associated with any model entry or // driver entry. UNKNOWN = 2, // We're trying to remove all files as part of a hard recovery attempt. HARD_RECOVERY = 3, // The count of entries for the enum. COUNT = 4, }; // Enum used by UMA metrics to log a type of download event that occurred in the // Controller. enum class DownloadEvent { // The Controller started a download. START = 0, // The Controller resumed a download (we assume this is a light weight // resumption that does not require a complete download restart). RESUME = 1, // The Controller is retrying a download (we assume this is a heavy weight // resumption that requires a complete download restart). RETRY = 2, // The Controller suspended an active download due to priorities, device // activity, or a request from the Client (see LogDownloadPauseReason). SUSPEND = 3, // The count of entries for the enum. COUNT = 4, }; // Logs the results of starting up the Controller. Will log each failure reason // if |status| contains more than one initialization failure. void LogControllerStartupStatus(bool in_recovery, const StartupStatus& status); // Logs an action taken on the service API. void LogServiceApiAction(DownloadClient client, ServiceApiAction action); // Logs the result of a StartDownload() attempt on the service. void LogStartDownloadResult(DownloadClient client, DownloadParams::StartResult result); // Logs recovery operations that happened when we had to move from one state // to another on startup. void LogRecoveryOperation(Entry::State to_state); // Logs download completion event, download time, and the file size. void LogDownloadCompletion(CompletionType type, uint64_t file_size_bytes); // Logs various pause reasons for download. The reasons are not mutually // exclusive. void LogDownloadPauseReason(const DownloadBlockageStatus& blockage_status, bool on_upload_data_received); void LogEntryRemovedWhileWaitingForUploadResponse(); // Logs statistics about the result of a model operation. Used to track failure // cases. void LogModelOperationResult(ModelAction action, bool success); // Logs the total number of all entries, and the number of entries in each // state after the model is initialized. void LogEntries(std::map<Entry::State, uint32_t>& entries_count); // Log statistics about the status of a TaskFinishedCallback. void LogScheduledTaskStatus(DownloadTaskType task_type, ScheduledTaskStatus status); // Logs download files directory creation error. void LogsFileDirectoryCreationError(base::File::Error error); // Logs statistics about the reasons of a file cleanup. void LogFileCleanupStatus(FileCleanupReason reason, int succeeded_cleanups, int failed_cleanups, int external_cleanups); // Logs the file life time for successfully completed download. void LogFileLifeTime(const base::TimeDelta& file_life_time); // Logs the total disk space utilized by download files. // This includes the total size of all the files in |file_dir|. // This function is costly and should be called only once. void LogFileDirDiskUtilization(int64_t total_disk_space, int64_t free_disk_space, int64_t files_size); // Logs if the final download file path is different from the requested file // path. void LogFilePathRenamed(bool renamed); // Logs an action the Controller takes on an active download. void LogEntryEvent(DownloadEvent event); // At the time of a retry, logs which retry attempt count this is. void LogEntryRetryCount(uint32_t retry_count); // Records whether the entry was an upload. void LogHasUploadData(DownloadClient client, bool has_upload_data); // Records count of reduced mode to full browser transitions requested by each // client. void LogDownloadClientInflatedFullBrowser(DownloadClient client); } // namespace stats } // namespace download #endif // COMPONENTS_DOWNLOAD_INTERNAL_BACKGROUND_SERVICE_STATS_H_
33.885463
85
0.74623
[ "model" ]
16c6a321a61dd006495687264aba211a473fae1d
2,067
h
C
src/types/base/hexable.h
supaiku0/cpp-crypto
cb2fce1288a336c0a173dd841eee8b553d3afb65
[ "MIT" ]
null
null
null
src/types/base/hexable.h
supaiku0/cpp-crypto
cb2fce1288a336c0a173dd841eee8b553d3afb65
[ "MIT" ]
null
null
null
src/types/base/hexable.h
supaiku0/cpp-crypto
cb2fce1288a336c0a173dd841eee8b553d3afb65
[ "MIT" ]
null
null
null
#ifndef HEXABLE_H #define HEXABLE_H #include "utilities/platform.h" #include "utilities/formatting.h" #include "types/base/byteable.h" #include <vector> #include <memory> template <size_t COUNT> class Hexable : public Printable, virtual Byteable<COUNT> { public: /************************************************** * Constructor * @brief: default empty constructor **************************************************/ Hexable() { this->bytes_[0] = '\0'; }; /*************************************************/ /************************************************** * Constructor * @param: const char *const newHash * @brief: also checks if Hash is empty before storage **************************************************/ Hexable(const char *const newValue) { (ARK::Formatting::isHex(newValue)) ? void( std::memmove(this->bytes_, &ARK::Formatting::ParseHex(newValue).data()[0], COUNT) ) : void(this->bytes_[0] = '\0'); }; /*************************************************/ /************************************************** * @brief: returns vector of hex-string representation of stored bytes **************************************************/ const inline std::vector<char> vHex() const { return (this->bytes_[0] != '\0') ? std::vector<char>(this->hex().c_str()) : std::vector<char>(1); }; /*************************************************/ /************************************************** * @brief: return hex-cstring of Hexable type **************************************************/ const char* c_str() const { return (this->bytes_[0] != '\0') ? ARK::Formatting::BytesToHex(this->bytes_, this->bytes_ + COUNT).c_str() : std::string("").c_str(); }; /************************************************** * @param: Print& p * @brief: prints Hexable object **************************************************/ virtual size_t printTo(Print& p) const { size_t size = 0; size += p.print( this->c_str() ); return size; }; /*************************************************/ }; #endif
28.315068
94
0.4209
[ "object", "vector" ]
5bd695d5763baa914d460c6a0d1b69326d8770be
12,748
c
C
openbsd/sys/arch/sparc/dev/bwtwo.c
MarginC/kame
2ef74fe29e4cca9b4a87a1d5041191a9e2e8be30
[ "BSD-3-Clause" ]
91
2015-01-05T15:18:31.000Z
2022-03-11T16:43:28.000Z
openbsd/sys/arch/sparc/dev/bwtwo.c
MarginC/kame
2ef74fe29e4cca9b4a87a1d5041191a9e2e8be30
[ "BSD-3-Clause" ]
1
2016-02-25T15:57:55.000Z
2016-02-25T16:01:02.000Z
openbsd/sys/arch/sparc/dev/bwtwo.c
MarginC/kame
2ef74fe29e4cca9b4a87a1d5041191a9e2e8be30
[ "BSD-3-Clause" ]
21
2015-02-07T08:23:07.000Z
2021-12-14T06:01:49.000Z
/* $OpenBSD: bwtwo.c,v 1.15 1998/11/20 15:57:21 deraadt Exp $ */ /* $NetBSD: bwtwo.c,v 1.33 1997/05/24 20:16:02 pk Exp $ */ /* * Copyright (c) 1996 Jason R. Thorpe. All rights reserved. * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. * * This software was developed by the Computer Systems Engineering group * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and * contributed to Berkeley. * * All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the University of * California, Lawrence Berkeley Laboratory. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)bwtwo.c 8.1 (Berkeley) 6/11/93 */ /* * black&white display (bwtwo) driver. * * Does not handle interrupts, even though they can occur. * * P4 and overlay plane support by Jason R. Thorpe <thorpej@NetBSD.ORG>. * Overlay plane handling hints and ideas provided by Brad Spencer. */ #include <sys/param.h> #include <sys/systm.h> #include <sys/device.h> #include <sys/ioctl.h> #include <sys/malloc.h> #include <sys/mman.h> #include <sys/tty.h> #include <sys/conf.h> #include <vm/vm.h> #include <machine/fbio.h> #include <machine/autoconf.h> #include <machine/pmap.h> #include <machine/fbvar.h> #include <machine/eeprom.h> #include <machine/ctlreg.h> #include <machine/conf.h> #include <sparc/sparc/asm.h> #include <sparc/dev/btreg.h> #include <sparc/dev/bwtworeg.h> #include <sparc/dev/sbusvar.h> #if defined(SUN4) #include <sparc/dev/pfourreg.h> #endif /* per-display variables */ struct bwtwo_softc { struct device sc_dev; /* base device */ struct sbusdev sc_sd; /* sbus device */ struct fbdevice sc_fb; /* frame buffer device */ volatile struct fbcontrol *sc_reg;/* control registers */ struct rom_reg sc_phys; /* phys address description */ int sc_bustype; /* type of bus we live on */ int sc_pixeloffset; /* offset to framebuffer */ #if defined(SUN4) /* * Additional overlay plane goo. */ int sc_ovtype; /* what kind of color fb? */ #define BWO_NONE 0x00 #define BWO_CGFOUR 0x01 #define BWO_CGEIGHT 0x02 #endif }; /* autoconfiguration driver */ static void bwtwoattach __P((struct device *, struct device *, void *)); static int bwtwomatch __P((struct device *, void *, void *)); static void bwtwounblank __P((struct device *)); static void bwtwo_set_video __P((struct bwtwo_softc *, int)); static int bwtwo_get_video __P((struct bwtwo_softc *)); /* cdevsw prototypes */ cdev_decl(bwtwo); struct cfattach bwtwo_ca = { sizeof(struct bwtwo_softc), bwtwomatch, bwtwoattach }; struct cfdriver bwtwo_cd = { NULL, "bwtwo", DV_DULL }; /* XXX we do not handle frame buffer interrupts (do not know how) */ /* frame buffer generic driver */ static struct fbdriver bwtwofbdriver = { bwtwounblank, bwtwoopen, bwtwoclose, bwtwoioctl, bwtwommap }; extern int fbnode; extern struct tty *fbconstty; /* * Match a bwtwo. */ int bwtwomatch(parent, vcf, aux) struct device *parent; void *vcf, *aux; { struct cfdata *cf = vcf; struct confargs *ca = aux; struct romaux *ra = &ca->ca_ra; if (CPU_ISSUN4 && cf->cf_unit != 0) return (0); if (strcmp(cf->cf_driver->cd_name, ra->ra_name)) return (0); /* * Mask out invalid flags from the user. */ cf->cf_flags &= FB_USERMASK; if (ca->ca_bustype == BUS_SBUS) return(1); /* * Make sure there's hardware there. */ if (probeget(ra->ra_vaddr, 4) == -1) return (0); #if defined(SUN4) if (CPU_ISSUN4 && (ca->ca_bustype == BUS_OBIO)) { /* * Check for a pfour framebuffer. */ switch (fb_pfour_id(ra->ra_vaddr)) { case PFOUR_ID_BW: case PFOUR_ID_COLOR8P1: /* bwtwo in ... */ case PFOUR_ID_COLOR24: /* ...overlay plane */ cf->cf_flags |= FB_PFOUR; /* FALLTHROUGH */ case PFOUR_NOTPFOUR: return (1); default: return (0); } } #endif return (0); } /* * Attach a display. We need to notice if it is the console, too. */ void bwtwoattach(parent, self, args) struct device *parent, *self; void *args; { register struct bwtwo_softc *sc = (struct bwtwo_softc *)self; register struct confargs *ca = args; register int node = ca->ca_ra.ra_node, ramsize; struct fbdevice *fb = &sc->sc_fb; int isconsole = 0; int sbus = 1; char *nam = NULL; fb->fb_driver = &bwtwofbdriver; fb->fb_device = &sc->sc_dev; fb->fb_type.fb_type = FBTYPE_SUN2BW; fb->fb_flags = sc->sc_dev.dv_cfdata->cf_flags; /* * Map the control register. */ if (fb->fb_flags & FB_PFOUR) { fb->fb_pfour = (volatile u_int32_t *) mapiodev(ca->ca_ra.ra_reg, 0, sizeof(u_int32_t)); sc->sc_reg = NULL; } else { sc->sc_reg = (volatile struct fbcontrol *) mapiodev(ca->ca_ra.ra_reg, BWREG_REG, sizeof(struct fbcontrol)); fb->fb_pfour = NULL; } /* Set up default pixel offset. May be changed below. */ sc->sc_pixeloffset = BWREG_MEM; switch (ca->ca_bustype) { case BUS_OBIO: if (CPU_ISSUN4M) /* 4m has framebuffer on obio */ goto obp_name; sbus = node = 0; #if defined(SUN4) if (fb->fb_flags & FB_PFOUR) { nam = "bwtwo/p4"; /* * Notice if this is an overlay plane on a color * framebuffer. Note that PFOUR_COLOR_OFF_OVERLAY * is the same as PFOUR_BW_OFF, but we use the * different names anyway. */ switch (PFOUR_ID(*fb->fb_pfour)) { case PFOUR_ID_COLOR8P1: sc->sc_ovtype = BWO_CGFOUR; sc->sc_pixeloffset = PFOUR_COLOR_OFF_OVERLAY; break; case PFOUR_ID_COLOR24: sc->sc_ovtype = BWO_CGEIGHT; sc->sc_pixeloffset = PFOUR_COLOR_OFF_OVERLAY; break; default: sc->sc_ovtype = BWO_NONE; sc->sc_pixeloffset = PFOUR_BW_OFF; break; } } else #endif nam = "bwtwo"; break; case BUS_VME32: case BUS_VME16: sbus = node = 0; nam = "bwtwo"; break; case BUS_SBUS: obp_name: #if defined(SUN4C) || defined(SUN4M) nam = getpropstring(node, "model"); #endif break; } sc->sc_phys = ca->ca_ra.ra_reg[0]; sc->sc_bustype = ca->ca_bustype; fb->fb_type.fb_depth = 1; fb_setsize(fb, fb->fb_type.fb_depth, 1152, 900, node, ca->ca_bustype); ramsize = fb->fb_type.fb_height * fb->fb_linebytes; fb->fb_type.fb_cmsize = 0; fb->fb_type.fb_size = ramsize; printf(": %s, %d x %d", nam, fb->fb_type.fb_width, fb->fb_type.fb_height); #if defined(SUN4) if (CPU_ISSUN4) { struct eeprom *eep = (struct eeprom *)eeprom_va; int constype = (fb->fb_flags & FB_PFOUR) ? EE_CONS_P4OPT : EE_CONS_BW; /* * Assume this is the console if there's no eeprom info * to be found. */ if (eep == NULL || eep->eeConsole == constype) isconsole = (fbconstty != NULL); else isconsole = 0; } #endif if (CPU_ISSUN4COR4M) isconsole = node == fbnode && fbconstty != NULL; /* * When the ROM has mapped in a bwtwo display, the address * maps only the video RAM, hence we always map the control * registers ourselves. We only need the video RAM if we are * going to print characters via rconsole. */ if ((fb->fb_pixels = ca->ca_ra.ra_vaddr) == NULL && isconsole) { /* this probably cannot happen (on sun4c), but what the heck */ fb->fb_pixels = mapiodev(ca->ca_ra.ra_reg, sc->sc_pixeloffset, ramsize); } /* Insure video is enabled */ bwtwo_set_video(sc, 1); if (isconsole) { printf(" (console)\n"); #ifdef RASTERCONSOLE #if defined(SUN4) /* * XXX rcons doesn't seem to work properly on the overlay * XXX plane. This is a temporary kludge until someone * XXX fixes it. */ if ((fb->fb_flags & FB_PFOUR) == 0 || (sc->sc_ovtype == BWO_NONE)) #endif fbrcons_init(fb); #endif } else printf("\n"); #if defined(SUN4C) || defined(SUN4M) if (sbus) sbus_establish(&sc->sc_sd, &sc->sc_dev); #endif #if defined(SUN4) if ((fb->fb_flags & FB_PFOUR) && (sc->sc_ovtype != BWO_NONE)) { char *ovnam; switch (sc->sc_ovtype) { case BWO_CGFOUR: ovnam = "cgfour"; break; case BWO_CGEIGHT: ovnam = "cgeight"; break; default: ovnam = "unknown"; break; } printf("%s: %s overlay plane\n", sc->sc_dev.dv_xname, ovnam); } #endif if (CPU_ISSUN4 || node == fbnode) { #if defined(SUN4) /* * If we're on an overlay plane of a color framebuffer, * then we don't force the issue in fb_attach() because * we'd like the color framebuffer to actually be the * "console framebuffer". We're only around to speed * up rconsole. */ if ((fb->fb_flags & FB_PFOUR) && (sc->sc_ovtype != BWO_NONE )) fb_attach(fb, 0); else #endif fb_attach(fb, isconsole); } } int bwtwoopen(dev, flags, mode, p) dev_t dev; int flags, mode; struct proc *p; { int unit = minor(dev); if (unit >= bwtwo_cd.cd_ndevs || bwtwo_cd.cd_devs[unit] == NULL) return (ENXIO); return (0); } int bwtwoclose(dev, flags, mode, p) dev_t dev; int flags, mode; struct proc *p; { return (0); } int bwtwoioctl(dev, cmd, data, flags, p) dev_t dev; u_long cmd; caddr_t data; int flags; struct proc *p; { struct bwtwo_softc *sc = bwtwo_cd.cd_devs[minor(dev)]; switch (cmd) { case FBIOGTYPE: *(struct fbtype *)data = sc->sc_fb.fb_type; break; case FBIOGVIDEO: *(int *)data = bwtwo_get_video(sc); break; case FBIOSVIDEO: bwtwo_set_video(sc, (*(int *)data)); break; default: return (ENOTTY); } return (0); } static void bwtwounblank(dev) struct device *dev; { struct bwtwo_softc *sc = (struct bwtwo_softc *)dev; bwtwo_set_video(sc, 1); } /* * Return the address that would map the given device at the given * offset, allowing for the given protection, or return -1 for error. */ int bwtwommap(dev, off, prot) dev_t dev; int off, prot; { register struct bwtwo_softc *sc = bwtwo_cd.cd_devs[minor(dev)]; if (off & PGOFSET) panic("bwtwommap"); if (off < 0) return (-1); if ((unsigned)off >= sc->sc_fb.fb_type.fb_size) return (-1); /* * I turned on PMAP_NC here to disable the cache as I was * getting horribly broken behaviour with it on. */ return (REG2PHYS(&sc->sc_phys, sc->sc_pixeloffset + off) | PMAP_NC); } static int bwtwo_get_video(sc) struct bwtwo_softc *sc; { #if defined(SUN4) if (CPU_ISSUN4 && (sc->sc_bustype == BUS_OBIO)) { if (sc->sc_fb.fb_flags & FB_PFOUR) { /* * This handles the overlay plane case, too. */ return (fb_pfour_get_video(&sc->sc_fb)); } else return ((lduba(AC_SYSENABLE, ASI_CONTROL) & SYSEN_VIDEO) != 0); } #endif return ((sc->sc_reg->fbc_ctrl & FBC_VENAB) != 0); } static void bwtwo_set_video(sc, enable) struct bwtwo_softc *sc; int enable; { #if defined(SUN4) if (CPU_ISSUN4 && (sc->sc_bustype == BUS_OBIO)) { if (sc->sc_fb.fb_flags & FB_PFOUR) { /* * This handles the overlay plane case, too. */ fb_pfour_set_video(&sc->sc_fb, enable); return; } if (enable) stba(AC_SYSENABLE, ASI_CONTROL, lduba(AC_SYSENABLE, ASI_CONTROL) | SYSEN_VIDEO); else stba(AC_SYSENABLE, ASI_CONTROL, lduba(AC_SYSENABLE, ASI_CONTROL) & ~SYSEN_VIDEO); return; } #endif if (enable) sc->sc_reg->fbc_ctrl |= FBC_VENAB; else sc->sc_reg->fbc_ctrl &= ~FBC_VENAB; }
24.421456
77
0.682146
[ "model" ]
5bd95ab2da70353bc5beeedc5596d95a736988bf
16,400
h
C
sumo/src/utils/vehicle/AStarRouter.h
iltempe/osmosi
c0f54ecdbb7c7b5602d587768617d0dc50f1d75d
[ "MIT" ]
null
null
null
sumo/src/utils/vehicle/AStarRouter.h
iltempe/osmosi
c0f54ecdbb7c7b5602d587768617d0dc50f1d75d
[ "MIT" ]
null
null
null
sumo/src/utils/vehicle/AStarRouter.h
iltempe/osmosi
c0f54ecdbb7c7b5602d587768617d0dc50f1d75d
[ "MIT" ]
2
2017-12-14T16:41:59.000Z
2020-10-16T17:51:27.000Z
/****************************************************************************/ /// @file AStarRouter.h /// @author Jakob Erdmann /// @author Daniel Krajzewicz /// @author Michael Behrisch /// @date January 2012 /// @version $Id$ /// // A* Algorithm using euclidean distance heuristic. // Based on DijkstraRouterTT. For routing by effort a novel heuristic would be needed. /****************************************************************************/ // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ // Copyright (C) 2012-2017 DLR (http://www.dlr.de/) and contributors /****************************************************************************/ // // This file is part of SUMO. // SUMO is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // /****************************************************************************/ #ifndef AStarRouter_h #define AStarRouter_h // =========================================================================== // included modules // =========================================================================== #ifdef _MSC_VER #include <windows_config.h> #else #include <config.h> #endif #include <cassert> #include <string> #include <functional> #include <vector> #include <set> #include <limits> #include <algorithm> #include <iterator> #include <map> #include <iostream> #include <utils/common/MsgHandler.h> #include <utils/common/StringTokenizer.h> #include <utils/common/TplConvert.h> #include <utils/common/StdDefs.h> #include <utils/common/ToString.h> #include <utils/iodevices/BinaryInputDevice.h> #include <utils/iodevices/OutputDevice.h> #include "AStarLookupTable.h" #include "SUMOAbstractRouter.h" #define UNREACHABLE (std::numeric_limits<double>::max() / 1000.0) //#define ASTAR_DEBUG_QUERY //#define ASTAR_DEBUG_QUERY_FOLLOWERS //#define ASTAR_DEBUG_QUERY_PERF //#define ASTAR_DEBUG_VISITED //#define ASTAR_DEBUG_LOOKUPTABLE //#define ASTAR_DEBUG_LOOKUPTABLE_FROM "disabled" //#define ASTAR_DEBUG_UNREACHABLE // =========================================================================== // class definitions // =========================================================================== /** * @class AStarRouter * @brief Computes the shortest path through a network using the A* algorithm. * * The template parameters are: * @param E The edge class to use (MSEdge/ROEdge) * @param V The vehicle class to use (MSVehicle/ROVehicle) * @param PF The prohibition function to use (prohibited_withPermissions/noProhibitions) * @param EC The class to retrieve the effort for an edge from * * The router is edge-based. It must know the number of edges for internal reasons * and whether a missing connection between two given edges (unbuild route) shall * be reported as an error or as a warning. * */ template<class E, class V, class PF> class AStarRouter : public SUMOAbstractRouter<E, V>, public PF { public: typedef AbstractLookupTable<E, V> LookupTable; typedef FullLookupTable<E, V> FLT; typedef LandmarkLookupTable<E, V> LMLT; typedef double(* Operation)(const E* const, const V* const, double); /** * @struct EdgeInfo * A definition about a route's edge with the effort needed to reach it and * the information about the previous edge. */ class EdgeInfo { public: /// Constructor EdgeInfo(const E* e) : edge(e), traveltime(std::numeric_limits<double>::max()), heuristicTime(std::numeric_limits<double>::max()), prev(0), visited(false) { } /// The current edge const E* edge; /// Effort to reach the edge double traveltime; /// Estimated time to reach the edge (traveltime + lower bound on remaining time) double heuristicTime; /// The previous edge EdgeInfo* prev; /// The previous edge bool visited; inline void reset() { // heuristicTime is set before adding to the frontier, thus no reset is needed traveltime = std::numeric_limits<double>::max(); visited = false; } }; /** * @class EdgeInfoComparator * Class to compare (and so sort) nodes by their effort */ class EdgeInfoComparator { public: /// Comparing method bool operator()(const EdgeInfo* nod1, const EdgeInfo* nod2) const { if (nod1->heuristicTime == nod2->heuristicTime) { return nod1->edge->getNumericalID() > nod2->edge->getNumericalID(); } return nod1->heuristicTime > nod2->heuristicTime; } }; /// Constructor AStarRouter(const std::vector<E*>& edges, bool unbuildIsWarning, Operation operation, const LookupTable* const lookup = 0): SUMOAbstractRouter<E, V>(operation, "AStarRouter"), myErrorMsgHandler(unbuildIsWarning ? MsgHandler::getWarningInstance() : MsgHandler::getErrorInstance()), myLookupTable(lookup), myMaxSpeed(NUMERICAL_EPS) { for (typename std::vector<E*>::const_iterator i = edges.begin(); i != edges.end(); ++i) { myEdgeInfos.push_back(EdgeInfo(*i)); myMaxSpeed = MAX2(myMaxSpeed, (*i)->getSpeedLimit() * MAX2(1.0, (*i)->getLengthGeometryFactor())); } } AStarRouter(const std::vector<EdgeInfo>& edgeInfos, bool unbuildIsWarning, Operation operation, const LookupTable* const lookup = 0): SUMOAbstractRouter<E, V>(operation, "AStarRouter"), myErrorMsgHandler(unbuildIsWarning ? MsgHandler::getWarningInstance() : MsgHandler::getErrorInstance()), myLookupTable(lookup), myMaxSpeed(NUMERICAL_EPS) { for (typename std::vector<EdgeInfo>::const_iterator i = edgeInfos.begin(); i != edgeInfos.end(); ++i) { myEdgeInfos.push_back(EdgeInfo(i->edge)); myMaxSpeed = MAX2(myMaxSpeed, i->edge->getSpeedLimit() * i->edge->getLengthGeometryFactor()); } } /// Destructor virtual ~AStarRouter() {} virtual SUMOAbstractRouter<E, V>* clone() { return new AStarRouter<E, V, PF>(myEdgeInfos, myErrorMsgHandler == MsgHandler::getWarningInstance(), this->myOperation, myLookupTable); } void init() { // all EdgeInfos touched in the previous query are either in myFrontierList or myFound: clean those up for (typename std::vector<EdgeInfo*>::iterator i = myFrontierList.begin(); i != myFrontierList.end(); i++) { (*i)->reset(); } myFrontierList.clear(); for (typename std::vector<EdgeInfo*>::iterator i = myFound.begin(); i != myFound.end(); i++) { (*i)->reset(); } myFound.clear(); } /** @brief Builds the route between the given edges using the minimum travel time */ virtual bool compute(const E* from, const E* to, const V* const vehicle, SUMOTime msTime, std::vector<const E*>& into) { assert(from != 0 && to != 0); // check whether from and to can be used if (PF::operator()(from, vehicle)) { myErrorMsgHandler->inform("Vehicle '" + vehicle->getID() + "' is not allowed on source edge '" + from->getID() + "'."); return false; } if (PF::operator()(to, vehicle)) { myErrorMsgHandler->inform("Vehicle '" + vehicle->getID() + "' is not allowed on destination edge '" + to->getID() + "'."); return false; } this->startQuery(); #ifdef ASTAR_DEBUG_QUERY std::cout << "DEBUG: starting search for '" << vehicle->getID() << "' speed: " << MIN2(vehicle->getMaxSpeed(), myMaxSpeed * vehicle->getChosenSpeedFactor()) << " time: " << STEPS2TIME(msTime) << "\n"; #endif const SUMOVehicleClass vClass = vehicle == 0 ? SVC_IGNORING : vehicle->getVClass(); const double time = STEPS2TIME(msTime); if (this->myBulkMode) { const EdgeInfo& toInfo = myEdgeInfos[to->getNumericalID()]; if (toInfo.visited) { buildPathFrom(&toInfo, into); this->endQuery(1); return true; } } else { init(); // add begin node EdgeInfo* const fromInfo = &(myEdgeInfos[from->getNumericalID()]); fromInfo->traveltime = 0; fromInfo->prev = 0; myFrontierList.push_back(fromInfo); } // loop int num_visited = 0; const bool mayRevisit = myLookupTable != 0 && !myLookupTable->consistent(); const double speed = MIN2(vehicle->getMaxSpeed(), myMaxSpeed * vehicle->getChosenSpeedFactor()); while (!myFrontierList.empty()) { num_visited += 1; // use the node with the minimal length EdgeInfo* const minimumInfo = myFrontierList.front(); const E* const minEdge = minimumInfo->edge; // check whether the destination node was already reached if (minEdge == to) { buildPathFrom(minimumInfo, into); this->endQuery(num_visited); #ifdef ASTAR_DEBUG_QUERY_PERF std::cout << "visited " + toString(num_visited) + " edges (final path length=" + toString(into.size()) + " time=" + toString(recomputeCosts(into, vehicle, msTime)) + " edges=" + toString(into) + ")\n"; #endif #ifdef ASTAR_DEBUG_VISITED OutputDevice& dev = OutputDevice::getDevice(vehicle->getID() + "_" + time2string(msTime) + "_" + from->getID() + "_" + to->getID()); for (typename std::vector<EdgeInfo>::const_iterator i = myEdgeInfos.begin(); i != myEdgeInfos.end(); ++i) { if (i->visited) { dev << "edge:" << i->edge->getID() << "\n"; } } dev.close(); #endif return true; } pop_heap(myFrontierList.begin(), myFrontierList.end(), myComparator); myFrontierList.pop_back(); myFound.push_back(minimumInfo); minimumInfo->visited = true; #ifdef ASTAR_DEBUG_QUERY std::cout << "DEBUG: hit=" << minEdge->getID() << " TT=" << minimumInfo->traveltime << " EF=" << this->getEffort(minEdge, vehicle, time + minimumInfo->traveltime) << " HT=" << minimumInfo->heuristicTime << " Q(TT,HT,Edge)="; for (typename std::vector<EdgeInfo*>::iterator it = myFrontierList.begin(); it != myFrontierList.end(); it++) { std::cout << (*it)->traveltime << "," << (*it)->heuristicTime << "," << (*it)->edge->getID() << " "; } std::cout << "\n"; #endif const double traveltime = minimumInfo->traveltime + this->getEffort(minEdge, vehicle, time + minimumInfo->traveltime); // admissible A* heuristic: straight line distance at maximum speed const double heuristic_remaining = (myLookupTable == 0 ? minEdge->getDistanceTo(to) / speed : myLookupTable->lowerBound(minEdge, to, speed, vehicle->getChosenSpeedFactor(), minEdge->getMinimumTravelTime(0), to->getMinimumTravelTime(0))); if (heuristic_remaining == UNREACHABLE) { continue; } // check all ways from the node with the minimal length const std::vector<E*>& successors = minEdge->getSuccessors(vClass); for (typename std::vector<E*>::const_iterator it = successors.begin(); it != successors.end(); ++it) { const E* const follower = *it; EdgeInfo* const followerInfo = &(myEdgeInfos[follower->getNumericalID()]); // check whether it can be used if (PF::operator()(follower, vehicle)) { continue; } const double oldEffort = followerInfo->traveltime; if ((!followerInfo->visited || mayRevisit) && traveltime < oldEffort) { followerInfo->traveltime = traveltime; followerInfo->heuristicTime = traveltime + heuristic_remaining; /* the code below results in fewer edges being looked up but is more costly due to the effort calculations. Overall it resulted in a slowdown in the Berlin tests but could be made configurable someday. followerInfo->heuristicTime = traveltime; if (follower != to) { if (myLookupTable == 0) { // admissible A* heuristic: straight line distance at maximum speed followerInfo->heuristicTime += this->getEffort(follower, vehicle, time + traveltime) + follower->getDistanceTo(to) / speed; } else { followerInfo->heuristicTime += this->getEffort(follower, vehicle, time + traveltime) + (*myLookupTable)[follower->getNumericalID()][to->getNumericalID()] / vehicle->getChosenSpeedFactor(); } }*/ #ifdef ASTAR_DEBUG_QUERY_FOLLOWERS std::cout << " follower=" << followerInfo->edge->getID() << " OEF=" << oldEffort << " TT=" << traveltime << " HR=" << heuristic_remaining << " HT=" << followerInfo->heuristicTime << "\n"; #endif followerInfo->prev = minimumInfo; if (oldEffort == std::numeric_limits<double>::max()) { myFrontierList.push_back(followerInfo); push_heap(myFrontierList.begin(), myFrontierList.end(), myComparator); } else { typename std::vector<EdgeInfo*>::iterator fi = find(myFrontierList.begin(), myFrontierList.end(), followerInfo); if (fi == myFrontierList.end()) { assert(mayRevisit); myFrontierList.push_back(followerInfo); push_heap(myFrontierList.begin(), myFrontierList.end(), myComparator); } else { push_heap(myFrontierList.begin(), fi + 1, myComparator); } } } } } this->endQuery(num_visited); #ifdef ASTAR_DEBUG_QUERY_PERF std::cout << "visited " + toString(num_visited) + " edges (unsuccesful path length: " + toString(into.size()) + ")\n"; #endif myErrorMsgHandler->inform("No connection between edge '" + from->getID() + "' and edge '" + to->getID() + "' found."); return false; } double recomputeCosts(const std::vector<const E*>& edges, const V* const v, SUMOTime msTime) const { const double time = STEPS2TIME(msTime); double costs = 0; for (typename std::vector<const E*>::const_iterator i = edges.begin(); i != edges.end(); ++i) { if (PF::operator()(*i, v)) { return -1; } costs += this->getEffort(*i, v, time + costs); } return costs; } public: /// Builds the path from marked edges void buildPathFrom(const EdgeInfo* rbegin, std::vector<const E*>& edges) { std::vector<const E*> tmp; while (rbegin != 0) { tmp.push_back(rbegin->edge); rbegin = rbegin->prev; } std::copy(tmp.rbegin(), tmp.rend(), std::back_inserter(edges)); } protected: /// The container of edge information std::vector<EdgeInfo> myEdgeInfos; /// A container for reusage of the min edge heap std::vector<EdgeInfo*> myFrontierList; /// @brief list of visited Edges (for resetting) std::vector<EdgeInfo*> myFound; EdgeInfoComparator myComparator; /// @brief the handler for routing errors MsgHandler* const myErrorMsgHandler; /// @brief the lookup table for travel time heuristics const LookupTable* const myLookupTable; /// @brief maximum speed in the network double myMaxSpeed; }; #endif /****************************************************************************/
43.271768
216
0.568659
[ "vector" ]
5bef1c03a3b784f2366b5a1e19c3ce53d6c4c115
1,546
h
C
world_spells/world_spell_data.h
blockspacer/entity_spell_system
6b2c97df9a7a9f1d7c8ecb9f80006b0c471cb80d
[ "MIT" ]
null
null
null
world_spells/world_spell_data.h
blockspacer/entity_spell_system
6b2c97df9a7a9f1d7c8ecb9f80006b0c471cb80d
[ "MIT" ]
null
null
null
world_spells/world_spell_data.h
blockspacer/entity_spell_system
6b2c97df9a7a9f1d7c8ecb9f80006b0c471cb80d
[ "MIT" ]
1
2020-01-08T12:55:20.000Z
2020-01-08T12:55:20.000Z
#ifndef WORLD_SPELL_DATA_H #define WORLD_SPELL_DATA_H #include "core/resource.h" #include "core/vector.h" #include "scene/resources/packed_scene.h" #include "../spell_enums.h" class WorldSpellData : public Resource { GDCLASS(WorldSpellData, Resource); public: int get_id(); void set_id(int value); SpellEnums::ColliderType get_collider_type(); void set_collider_type(SpellEnums::ColliderType value); Vector3 get_collider_box_extents(); void set_collider_box_extents(Vector3 value); float get_collider_sphere_radius(); void set_collider_sphere_radius(float value); SpellEnums::TargetType get_target_type(); void set_target_type(SpellEnums::TargetType value); int get_target_bone_id(); void set_target_bone_id(int value); bool get_move(); void set_move(bool value); float get_movement_speed(); void set_movement_speed(float value); Vector3 get_movement_dir(); void set_movement_dir(Vector3 value); float get_max_dist(); void set_max_dist(float value); Ref<PackedScene> get_effect(); void set_effect(Ref<PackedScene> value); Vector3 get_effect_offset(); void set_effect_offset(Vector3 value); WorldSpellData(); ~WorldSpellData(); protected: static void _bind_methods(); private: int _id; SpellEnums::ColliderType _collider_type; Vector3 _collider_box_extents; float _collider_sphere_radius; SpellEnums::TargetType _target_type; int _target_bone_id; bool _move; float _movement_speed; Vector3 _movement_dir; float _max_dist; Ref<PackedScene> _effect; Vector3 _effect_offset; }; #endif
19.820513
56
0.78784
[ "vector" ]
5bef383f236ce6e8d7e0c1ae2b646afd3f25c8d8
2,853
h
C
src/globalinclude/sdkCallback/TaskCommonCallback.h
tangtgithub/common_robotframe
f098d688bde1d2b2d5d6fac430c98b952621b7c1
[ "MIT" ]
5
2021-07-21T11:38:09.000Z
2021-11-26T03:16:09.000Z
src/globalinclude/sdkCallback/TaskCommonCallback.h
tangtgithub/common_robotframe
f098d688bde1d2b2d5d6fac430c98b952621b7c1
[ "MIT" ]
null
null
null
src/globalinclude/sdkCallback/TaskCommonCallback.h
tangtgithub/common_robotframe
f098d688bde1d2b2d5d6fac430c98b952621b7c1
[ "MIT" ]
null
null
null
#ifndef __TASKCOMMON_CALLBACK_H #define __TASKCOMMON_CALLBACK_H #include <string> #include <vector> #include <unistd.h> #include "commondefine.h" #include "taskdefine.h" #include "mapdefine.h" namespace taskcommon{ /**************点、线、区域******************/ const uint32_t kArea = 1; const uint32_t kLine = 2; const uint32_t kPoint = 3; /**************任务事件******************/ const uint32_t kTaskPauseEvent = 1; const uint32_t kTaskResumeEvent = 2; const uint32_t kTaskCancelEvent = 3; /**************运行结果*****************/ const uint32_t kRunSuccess = 1; const uint32_t kRunFail = 2; //plrId:点、线、区域id,status:运行结果 1:成功 2:失败 typedef std::function<void (uint32_t plrId, uint8_t status)> RunEndCallback; //任务入口回调 typedef std::function<void (uint32_t taskId)> TaskEntryCallback; //任务事件回调:取消、暂停、继续 typedef std::function<void (uint32_t)> TaskEventCallback; }; class TaskCommonCallback { public: static TaskCommonCallback* getDeriveInstance(); virtual void init() { } virtual void start() { } /* 创建任务 * parameter1 TASK_BASIC_INFO 任务基础信息 */ virtual void createTask(const task::TaskBasicInfo& taskBasicInfo) {} /* 取消任务 * parameter1 TASK_BASIC_INFO 任务基础信息 */ virtual void cancelTask(uint32_t reason=0) {} /* 暂停任务 * parameter1 TASK_BASIC_INFO 任务基础信息 */ virtual void pauseTask(uint32_t reason=0) {} /* 继续任务 * parameter1 TASK_BASIC_INFO 任务基础信息 */ virtual void resumeTask(uint32_t reason=0) {} /* 点、线、区域导航结果通知回调 * parameter1 uint32_t 任务id * parameter2 uint32_t 点、线、区域id * parameter3 uint32_t 导航结果 1:成功 2:失败 */ virtual void navicatResCallback(uint32_t taskId, uint32_t rangeId, uint8_t status) {} /* 注册点、路径、区域运行结束时的回调函数 * parameter1 RunEndCallback 回调函数原型 */ virtual void registerRunEndCb(taskcommon::RunEndCallback rangeEndCb) {} /* 注册任务入口回调函数 * parameter1 TaskEntryCallback 回调函数原型 */ virtual void registerTaskEntryCb(taskcommon::TaskEntryCallback taskEntryCb) {} /* 注册任务事件回调,如任务暂停、继续和取消等 * parameter1 TaskEventCallback 回调函数原型 */ virtual void registerTaskEventCb(uint32_t eventType, taskcommon::TaskEventCallback taskEventCb) {} /* 或跑一个点,或跑一条路径,或跑一个区域(先在区域内规划路径,再跑这条规划路径) * returnValue int 成功返回0 失败返回-1 * parameter1 uint32_t 或点id,或路径id,或区域id * parameter2 uint32_t 1:区域 2:路径 3:点 */ virtual int run(uint32_t id, uint32_t type) {return 0;} virtual int runPath(uint32_t id, const std::vector<globalmap::CommonPoint>& pointList) {return 0;} /* 暂停 * returnValue int 成功返回0 失败返回-1 */ virtual int pause() {return 0;} /* 继续 * returnValue int 成功返回0 失败返回-1 */ virtual int resume() {return 0;} /* 取消 * returnValue int 成功返回0 失败返回-1 */ virtual int cancel() {return 0;} }; #endif
23.385246
102
0.66176
[ "vector" ]
5bf2b8f79bae68e280f2f51eb560e4fbf00e17d1
6,812
h
C
gpudb/protocol/revoke_permission_datasource.h
GPUdb/gpudb-api-cpp
cabab17bf84c56386e2d74caffaec041c2abeace
[ "MIT" ]
1
2018-07-13T17:18:02.000Z
2018-07-13T17:18:02.000Z
gpudb/protocol/revoke_permission_datasource.h
GPUdb/gpudb-api-cpp
cabab17bf84c56386e2d74caffaec041c2abeace
[ "MIT" ]
2
2018-05-16T19:16:22.000Z
2018-05-17T20:28:06.000Z
gpudb/protocol/revoke_permission_datasource.h
GPUdb/gpudb-api-cpp
cabab17bf84c56386e2d74caffaec041c2abeace
[ "MIT" ]
3
2018-07-13T17:18:04.000Z
2021-07-29T14:04:11.000Z
/* * This file was autogenerated by the GPUdb schema processor. * * DO NOT EDIT DIRECTLY. */ #ifndef __REVOKE_PERMISSION_DATASOURCE_H__ #define __REVOKE_PERMISSION_DATASOURCE_H__ namespace gpudb { /** * A set of input parameters for {@link * #revokePermissionDatasource(const RevokePermissionDatasourceRequest&) const}. * <p> * Revokes a <a href="../../../concepts/data_sources/" target="_top">data * source</a> permission from a user or role. */ struct RevokePermissionDatasourceRequest { /** * Constructs a RevokePermissionDatasourceRequest object with default * parameter values. */ RevokePermissionDatasourceRequest() : name(std::string()), permission(std::string()), datasourceName(std::string()), options(std::map<std::string, std::string>()) { } /** * Constructs a RevokePermissionDatasourceRequest object with the * specified parameters. * * @param[in] name_ Name of the user or role from which the permission * will be revoked. Must be an existing user or role. * @param[in] permission_ Permission to revoke from the user or role * <ul> * <li> * gpudb::revoke_permission_datasource_connect: * Connect access on the given data source * </ul> * @param[in] datasourceName_ Name of the data source on which the * permission will be revoked. Must be an * existing data source, or an empty string * to revoke permission from all data * sources. * @param[in] options_ Optional parameters. * */ RevokePermissionDatasourceRequest(const std::string& name_, const std::string& permission_, const std::string& datasourceName_, const std::map<std::string, std::string>& options_): name( name_ ), permission( permission_ ), datasourceName( datasourceName_ ), options( options_ ) { } std::string name; std::string permission; std::string datasourceName; std::map<std::string, std::string> options; }; } namespace avro { template<> struct codec_traits<gpudb::RevokePermissionDatasourceRequest> { static void encode(Encoder& e, const gpudb::RevokePermissionDatasourceRequest& v) { ::avro::encode(e, v.name); ::avro::encode(e, v.permission); ::avro::encode(e, v.datasourceName); ::avro::encode(e, v.options); } static void decode(Decoder& d, gpudb::RevokePermissionDatasourceRequest& v) { if (::avro::ResolvingDecoder *rd = dynamic_cast< ::avro::ResolvingDecoder*>(&d)) { const std::vector<size_t> fo = rd->fieldOrder(); for (std::vector<size_t>::const_iterator it = fo.begin(); it != fo.end(); ++it) { switch (*it) { case 0: ::avro::decode(d, v.name); break; case 1: ::avro::decode(d, v.permission); break; case 2: ::avro::decode(d, v.datasourceName); break; case 3: ::avro::decode(d, v.options); break; default: break; } } } else { ::avro::decode(d, v.name); ::avro::decode(d, v.permission); ::avro::decode(d, v.datasourceName); ::avro::decode(d, v.options); } } }; } namespace gpudb { /** * A set of output parameters for {@link * #revokePermissionDatasource(const RevokePermissionDatasourceRequest&) const}. * <p> * Revokes a <a href="../../../concepts/data_sources/" target="_top">data * source</a> permission from a user or role. */ struct RevokePermissionDatasourceResponse { /** * Constructs a RevokePermissionDatasourceResponse object with default * parameter values. */ RevokePermissionDatasourceResponse() : name(std::string()), permission(std::string()), datasourceName(std::string()), info(std::map<std::string, std::string>()) { } std::string name; std::string permission; std::string datasourceName; std::map<std::string, std::string> info; }; } namespace avro { template<> struct codec_traits<gpudb::RevokePermissionDatasourceResponse> { static void encode(Encoder& e, const gpudb::RevokePermissionDatasourceResponse& v) { ::avro::encode(e, v.name); ::avro::encode(e, v.permission); ::avro::encode(e, v.datasourceName); ::avro::encode(e, v.info); } static void decode(Decoder& d, gpudb::RevokePermissionDatasourceResponse& v) { if (::avro::ResolvingDecoder *rd = dynamic_cast< ::avro::ResolvingDecoder*>(&d)) { const std::vector<size_t> fo = rd->fieldOrder(); for (std::vector<size_t>::const_iterator it = fo.begin(); it != fo.end(); ++it) { switch (*it) { case 0: ::avro::decode(d, v.name); break; case 1: ::avro::decode(d, v.permission); break; case 2: ::avro::decode(d, v.datasourceName); break; case 3: ::avro::decode(d, v.info); break; default: break; } } } else { ::avro::decode(d, v.name); ::avro::decode(d, v.permission); ::avro::decode(d, v.datasourceName); ::avro::decode(d, v.info); } } }; } #endif
32.438095
188
0.468438
[ "object", "vector" ]
5bf6f35db8cf0ed0c5ce840bfaf02b5aa8a128e1
12,296
h
C
tdmq/include/tencentcloud/tdmq/v20200217/model/RocketMQGroup.h
suluner/tencentcloud-sdk-cpp
a56c73cc3f488c4d1e10755704107bb15c5e000d
[ "Apache-2.0" ]
null
null
null
tdmq/include/tencentcloud/tdmq/v20200217/model/RocketMQGroup.h
suluner/tencentcloud-sdk-cpp
a56c73cc3f488c4d1e10755704107bb15c5e000d
[ "Apache-2.0" ]
null
null
null
tdmq/include/tencentcloud/tdmq/v20200217/model/RocketMQGroup.h
suluner/tencentcloud-sdk-cpp
a56c73cc3f488c4d1e10755704107bb15c5e000d
[ "Apache-2.0" ]
null
null
null
/* * Copyright (c) 2017-2019 THL A29 Limited, a Tencent company. All Rights Reserved. * * 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. */ #ifndef TENCENTCLOUD_TDMQ_V20200217_MODEL_ROCKETMQGROUP_H_ #define TENCENTCLOUD_TDMQ_V20200217_MODEL_ROCKETMQGROUP_H_ #include <string> #include <vector> #include <map> #include <tencentcloud/core/utils/rapidjson/document.h> #include <tencentcloud/core/utils/rapidjson/writer.h> #include <tencentcloud/core/utils/rapidjson/stringbuffer.h> #include <tencentcloud/core/AbstractModel.h> namespace TencentCloud { namespace Tdmq { namespace V20200217 { namespace Model { /** * RocketMQ消费组信息 */ class RocketMQGroup : public AbstractModel { public: RocketMQGroup(); ~RocketMQGroup() = default; void ToJsonObject(rapidjson::Value &value, rapidjson::Document::AllocatorType& allocator) const; CoreInternalOutcome Deserialize(const rapidjson::Value &value); /** * 获取消费组名称 * @return Name 消费组名称 */ std::string GetName() const; /** * 设置消费组名称 * @param Name 消费组名称 */ void SetName(const std::string& _name); /** * 判断参数 Name 是否已赋值 * @return Name 是否已赋值 */ bool NameHasBeenSet() const; /** * 获取在线消费者数量 * @return ConsumerNum 在线消费者数量 */ uint64_t GetConsumerNum() const; /** * 设置在线消费者数量 * @param ConsumerNum 在线消费者数量 */ void SetConsumerNum(const uint64_t& _consumerNum); /** * 判断参数 ConsumerNum 是否已赋值 * @return ConsumerNum 是否已赋值 */ bool ConsumerNumHasBeenSet() const; /** * 获取消费TPS * @return TPS 消费TPS */ uint64_t GetTPS() const; /** * 设置消费TPS * @param TPS 消费TPS */ void SetTPS(const uint64_t& _tPS); /** * 判断参数 TPS 是否已赋值 * @return TPS 是否已赋值 */ bool TPSHasBeenSet() const; /** * 获取总堆积数量 * @return TotalAccumulative 总堆积数量 */ int64_t GetTotalAccumulative() const; /** * 设置总堆积数量 * @param TotalAccumulative 总堆积数量 */ void SetTotalAccumulative(const int64_t& _totalAccumulative); /** * 判断参数 TotalAccumulative 是否已赋值 * @return TotalAccumulative 是否已赋值 */ bool TotalAccumulativeHasBeenSet() const; /** * 获取0表示集群消费模式,1表示广播消费模式,-1表示未知 * @return ConsumptionMode 0表示集群消费模式,1表示广播消费模式,-1表示未知 */ int64_t GetConsumptionMode() const; /** * 设置0表示集群消费模式,1表示广播消费模式,-1表示未知 * @param ConsumptionMode 0表示集群消费模式,1表示广播消费模式,-1表示未知 */ void SetConsumptionMode(const int64_t& _consumptionMode); /** * 判断参数 ConsumptionMode 是否已赋值 * @return ConsumptionMode 是否已赋值 */ bool ConsumptionModeHasBeenSet() const; /** * 获取是否允许消费 * @return ReadEnabled 是否允许消费 */ bool GetReadEnabled() const; /** * 设置是否允许消费 * @param ReadEnabled 是否允许消费 */ void SetReadEnabled(const bool& _readEnabled); /** * 判断参数 ReadEnabled 是否已赋值 * @return ReadEnabled 是否已赋值 */ bool ReadEnabledHasBeenSet() const; /** * 获取重试队列分区数 注意:此字段可能返回 null,表示取不到有效值。 * @return RetryPartitionNum 重试队列分区数 注意:此字段可能返回 null,表示取不到有效值。 */ uint64_t GetRetryPartitionNum() const; /** * 设置重试队列分区数 注意:此字段可能返回 null,表示取不到有效值。 * @param RetryPartitionNum 重试队列分区数 注意:此字段可能返回 null,表示取不到有效值。 */ void SetRetryPartitionNum(const uint64_t& _retryPartitionNum); /** * 判断参数 RetryPartitionNum 是否已赋值 * @return RetryPartitionNum 是否已赋值 */ bool RetryPartitionNumHasBeenSet() const; /** * 获取创建时间,以毫秒为单位 * @return CreateTime 创建时间,以毫秒为单位 */ uint64_t GetCreateTime() const; /** * 设置创建时间,以毫秒为单位 * @param CreateTime 创建时间,以毫秒为单位 */ void SetCreateTime(const uint64_t& _createTime); /** * 判断参数 CreateTime 是否已赋值 * @return CreateTime 是否已赋值 */ bool CreateTimeHasBeenSet() const; /** * 获取修改时间,以毫秒为单位 * @return UpdateTime 修改时间,以毫秒为单位 */ uint64_t GetUpdateTime() const; /** * 设置修改时间,以毫秒为单位 * @param UpdateTime 修改时间,以毫秒为单位 */ void SetUpdateTime(const uint64_t& _updateTime); /** * 判断参数 UpdateTime 是否已赋值 * @return UpdateTime 是否已赋值 */ bool UpdateTimeHasBeenSet() const; /** * 获取客户端协议 * @return ClientProtocol 客户端协议 */ std::string GetClientProtocol() const; /** * 设置客户端协议 * @param ClientProtocol 客户端协议 */ void SetClientProtocol(const std::string& _clientProtocol); /** * 判断参数 ClientProtocol 是否已赋值 * @return ClientProtocol 是否已赋值 */ bool ClientProtocolHasBeenSet() const; /** * 获取说明信息 注意:此字段可能返回 null,表示取不到有效值。 * @return Remark 说明信息 注意:此字段可能返回 null,表示取不到有效值。 */ std::string GetRemark() const; /** * 设置说明信息 注意:此字段可能返回 null,表示取不到有效值。 * @param Remark 说明信息 注意:此字段可能返回 null,表示取不到有效值。 */ void SetRemark(const std::string& _remark); /** * 判断参数 Remark 是否已赋值 * @return Remark 是否已赋值 */ bool RemarkHasBeenSet() const; /** * 获取消费者类型,枚举值ACTIVELY, PASSIVELY 注意:此字段可能返回 null,表示取不到有效值。 * @return ConsumerType 消费者类型,枚举值ACTIVELY, PASSIVELY 注意:此字段可能返回 null,表示取不到有效值。 */ std::string GetConsumerType() const; /** * 设置消费者类型,枚举值ACTIVELY, PASSIVELY 注意:此字段可能返回 null,表示取不到有效值。 * @param ConsumerType 消费者类型,枚举值ACTIVELY, PASSIVELY 注意:此字段可能返回 null,表示取不到有效值。 */ void SetConsumerType(const std::string& _consumerType); /** * 判断参数 ConsumerType 是否已赋值 * @return ConsumerType 是否已赋值 */ bool ConsumerTypeHasBeenSet() const; /** * 获取是否开启广播消费 * @return BroadcastEnabled 是否开启广播消费 */ bool GetBroadcastEnabled() const; /** * 设置是否开启广播消费 * @param BroadcastEnabled 是否开启广播消费 */ void SetBroadcastEnabled(const bool& _broadcastEnabled); /** * 判断参数 BroadcastEnabled 是否已赋值 * @return BroadcastEnabled 是否已赋值 */ bool BroadcastEnabledHasBeenSet() const; private: /** * 消费组名称 */ std::string m_name; bool m_nameHasBeenSet; /** * 在线消费者数量 */ uint64_t m_consumerNum; bool m_consumerNumHasBeenSet; /** * 消费TPS */ uint64_t m_tPS; bool m_tPSHasBeenSet; /** * 总堆积数量 */ int64_t m_totalAccumulative; bool m_totalAccumulativeHasBeenSet; /** * 0表示集群消费模式,1表示广播消费模式,-1表示未知 */ int64_t m_consumptionMode; bool m_consumptionModeHasBeenSet; /** * 是否允许消费 */ bool m_readEnabled; bool m_readEnabledHasBeenSet; /** * 重试队列分区数 注意:此字段可能返回 null,表示取不到有效值。 */ uint64_t m_retryPartitionNum; bool m_retryPartitionNumHasBeenSet; /** * 创建时间,以毫秒为单位 */ uint64_t m_createTime; bool m_createTimeHasBeenSet; /** * 修改时间,以毫秒为单位 */ uint64_t m_updateTime; bool m_updateTimeHasBeenSet; /** * 客户端协议 */ std::string m_clientProtocol; bool m_clientProtocolHasBeenSet; /** * 说明信息 注意:此字段可能返回 null,表示取不到有效值。 */ std::string m_remark; bool m_remarkHasBeenSet; /** * 消费者类型,枚举值ACTIVELY, PASSIVELY 注意:此字段可能返回 null,表示取不到有效值。 */ std::string m_consumerType; bool m_consumerTypeHasBeenSet; /** * 是否开启广播消费 */ bool m_broadcastEnabled; bool m_broadcastEnabledHasBeenSet; }; } } } } #endif // !TENCENTCLOUD_TDMQ_V20200217_MODEL_ROCKETMQGROUP_H_
31.937662
116
0.409239
[ "vector", "model" ]
5bf7ee51fe1f2898950bc42566174d2da2d2ce31
6,934
h
C
modules/assimp/editor_scene_importer_assimp.h
Linuxydable/Godot_STL
4722a86627793818a53f53bcb533545a1a1d4eeb
[ "CC-BY-3.0", "Apache-2.0", "MIT" ]
null
null
null
modules/assimp/editor_scene_importer_assimp.h
Linuxydable/Godot_STL
4722a86627793818a53f53bcb533545a1a1d4eeb
[ "CC-BY-3.0", "Apache-2.0", "MIT" ]
null
null
null
modules/assimp/editor_scene_importer_assimp.h
Linuxydable/Godot_STL
4722a86627793818a53f53bcb533545a1a1d4eeb
[ "CC-BY-3.0", "Apache-2.0", "MIT" ]
null
null
null
/*************************************************************************/ /* editor_scene_importer_assimp.h */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ /* "Software"), to deal in the Software without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of the Software, and to */ /* permit persons to whom the Software is furnished to do so, subject to */ /* the following conditions: */ /* */ /* The above copyright notice and this permission notice shall be */ /* included in all copies or substantial portions of the Software. */ /* */ /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ #ifndef EDITOR_SCENE_IMPORTER_ASSIMP_H #define EDITOR_SCENE_IMPORTER_ASSIMP_H #include <vector> #ifdef TOOLS_ENABLED #include "core/bind/core_bind.h" #include "core/io/resource_importer.h" #include "editor/import/resource_importer_scene.h" #include "editor/project_settings_editor.h" #include "scene/3d/mesh_instance.h" #include "scene/3d/skeleton.h" #include "scene/3d/spatial.h" #include "scene/animation/animation_player.h" #include "scene/resources/animation.h" #include "scene/resources/surface_tool.h" #include <assimp/matrix4x4.h> #include <assimp/scene.h> #include <assimp/types.h> #include <assimp/DefaultLogger.hpp> #include <assimp/LogStream.hpp> #include <assimp/Logger.hpp> #include "import_state.h" #include "import_utils.h" using namespace AssimpImporter; class AssimpStream : public Assimp::LogStream { public: // Constructor AssimpStream() {} // Destructor ~AssimpStream() {} // Write something using your own functionality void write(const char *message) { print_verbose(String("Open Asset Import: ") + String(message).strip_edges()); } }; class EditorSceneImporterAssimp : public EditorSceneImporter { private: GDCLASS(EditorSceneImporterAssimp, EditorSceneImporter); const String ASSIMP_FBX_KEY = "_$AssimpFbx$"; struct AssetImportAnimation { enum Interpolation { INTERP_LINEAR, INTERP_STEP, INTERP_CATMULLROMSPLINE, INTERP_CUBIC_SPLINE }; }; struct BoneInfo { uint32_t bone; float weight; }; struct SkeletonHole { //nodes may be part of the skeleton by used by vertex String name; String parent; Transform pose; const aiNode *node; }; void _calc_tangent_from_mesh(const aiMesh *ai_mesh, int i, int tri_index, int index, PoolColorArray::Write &w); void _set_texture_mapping_mode(aiTextureMapMode *map_mode, Ref<Texture> texture); Ref<Mesh> _generate_mesh_from_surface_indices(ImportState &state, const std::vector<int> &p_surface_indices, const aiNode *assimp_node, Skeleton *p_skeleton = NULL); // utility for node creation void attach_new_node(ImportState &state, Spatial *new_node, const aiNode *node, Node *parent_node, String Name, Transform &transform); // simple object creation functions void create_light(ImportState &state, RecursiveState &recursive_state); void create_camera(ImportState &state, RecursiveState &recursive_state); void create_bone(ImportState &state, RecursiveState &recursive_state); // non recursive - linear so must not use recursive arguments void create_mesh(ImportState &state, const aiNode *assimp_node, const String &node_name, Node *current_node, Node *parent_node, Transform node_transform); // recursive node generator void _generate_node(ImportState &state, Skeleton *skeleton, const aiNode *assimp_node, Node *parent_node); // runs after _generate_node as it must then use pre-created godot skeleton. void generate_mesh_phase_from_skeletal_mesh(ImportState &state); void _insert_animation_track(ImportState &scene, const aiAnimation *assimp_anim, int p_track, int p_bake_fps, Ref<Animation> animation, float ticks_per_second, Skeleton *p_skeleton, const NodePath &p_path, const String &p_name); void _import_animation(ImportState &state, int p_animation_index, int p_bake_fps); Spatial *_generate_scene(const String &p_path, aiScene *scene, const uint32_t p_flags, int p_bake_fps, const int32_t p_max_bone_weights); String _assimp_anim_string_to_string(const aiString &p_string) const; String _assimp_raw_string_to_string(const aiString &p_string) const; float _get_fbx_fps(int32_t time_mode, const aiScene *p_scene); template <class T> T _interpolate_track(const std::vector<float> &p_times, const std::vector<T> &p_values, float p_time, AssetImportAnimation::Interpolation p_interp); void _register_project_setting_import(const String generic, const String import_setting_string, const std::vector<String> &exts, List<String> *r_extensions, const bool p_enabled) const; struct ImportFormat { std::vector<String> extensions; bool is_default; }; protected: static void _bind_methods(); public: EditorSceneImporterAssimp() { Assimp::DefaultLogger::create("", Assimp::Logger::VERBOSE); unsigned int severity = Assimp::Logger::Info | Assimp::Logger::Err | Assimp::Logger::Warn; Assimp::DefaultLogger::get()->attachStream(new AssimpStream(), severity); } ~EditorSceneImporterAssimp() { Assimp::DefaultLogger::kill(); } virtual void get_extensions(List<String> *r_extensions) const; virtual uint32_t get_import_flags() const; virtual Node *import_scene(const String &p_path, uint32_t p_flags, int p_bake_fps, List<String> *r_missing_deps, Error *r_err = NULL); Ref<Image> load_image(ImportState &state, const aiScene *p_scene, String p_path); }; #endif #endif
44.735484
229
0.678973
[ "mesh", "object", "vector", "transform", "3d" ]
750168bb76d3b3911253c83bba333fd6b4c642c7
4,479
h
C
even_odd_map/even_odd_map.h
yoniks/c-c-plus-plus-
50f9e24a95fcfb61839cfd8bc2b0755828b7bed0
[ "MIT" ]
null
null
null
even_odd_map/even_odd_map.h
yoniks/c-c-plus-plus-
50f9e24a95fcfb61839cfd8bc2b0755828b7bed0
[ "MIT" ]
null
null
null
even_odd_map/even_odd_map.h
yoniks/c-c-plus-plus-
50f9e24a95fcfb61839cfd8bc2b0755828b7bed0
[ "MIT" ]
null
null
null
// // even_odd_map.h // even_odd_map // // Created by yo on 5/23/22. // #ifndef even_odd_map_h #define even_odd_map_h #include <typeinfo> #include <map> using namespace std; template<typename K, typename V> class even_odd_map { friend void IntervalMapTest(); V m_valBegin; int SIZE=0,size_array=10,size_counter=0; int *counter= new int[size_array]; std::map<K,V> m_map; //NOTE keeping private if you not call to fun from main //print the k and v void IntervalMapTest(){ std::cout<<"the new size of map: " <<m_map.size()<<"\n"; std::cout<<"you added to map: " <<size_array<< " times"<<"\n"; //if the array going to be full grow it by new allocate if(size_array<m_map.size()+SIZE){ SIZE*=2; size_array+= SIZE; int *p_new_value=new int[size_array];//Allocate for free memore for(int i=0;i<size_array;i++){ p_new_value[i]= counter[i]; } delete [] counter;// DELETE THE OLD MEMORY AND POINTER TO NEW counter=p_new_value;// counter pointer to new size now } } public: ~even_odd_map(){ delete [] counter; } // constructor associates whole range of K with val even_odd_map(V const& val): m_valBegin(val) { // if the value type is not char if( typeid(val).name()!=typeid(char).name()){// it mean the type not int throw "the type of variable should to be char"; } } V getMValBegin(){ return m_valBegin; } void assign( K const& keyBegin, K const& keyEnd, V val ) { std::map<int, char>::iterator itr; //IF THE VALUE IS in scope A-Z OR a-z //(keyBegin<keyEnd) if(((val>64&&val<91) || (val>96&&val<123))&&keyBegin<keyEnd){ /* the fun print the key and value and if the size of array not enough so we grow dynamic the array, */ SIZE=keyEnd-keyBegin; IntervalMapTest(); int index_map=(int)m_map.size(); cout<<"size: "<<index_map; for(int i=keyBegin;i<=keyEnd; i++){//x1 to x2 initialzion /* for example if the map has 16 objects 0 to 15, and we sent next 20 to 25 as key so i have 15 to 20 empty object i should fill it, and than i will add to right keys 20 to 25. */ if(!m_map.empty()){ if((int)m_map.size()<keyBegin){ for(int j=(int)m_map.size();j<keyBegin; j++){ m_map.insert(std::pair<int, char>(j,val)); } } } /* if index map is not even grow the value BY assci in one step else do nothing */ if(index_map%2!=0){ val+=1; } if(val>=123){ val=(char)65; } m_map.insert(std::pair<int, char>(i,val)); ++index_map; /* keeping the v in array, array grow dynamic allocate */ counter[size_counter]=val; size_counter++; } } /* print */ for(std::map<int, char>::iterator itr= m_map.begin(), end= m_map.end();itr!=end;++itr ){ std::cout << itr->first << " --> " << itr->second << std::endl; } } // look-up of the value associated with key V const& operator[]( K const& key ) const { auto it=m_map.upper_bound(key); if(it==m_map.begin()) { return m_valBegin; } else { return (--it)->second; } } }; #endif /* even_odd_map_h */
29.27451
108
0.431346
[ "object" ]