repo_name
stringlengths 6
97
| path
stringlengths 3
341
| text
stringlengths 8
1.02M
|
---|---|---|
mlvhub/MPEGDASH-iOS-Player | DASH Player/DASH Player/Model/ProgramInformation.h | //
// ProgramInformation.h
// DASH Player
//
// Created by DataArt Apps on 28.07.14.
// Copyright (c) 2014 DataArt Apps. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface ProgramInformation : NSObject
@property (nonatomic, strong) NSString *title;
@property (nonatomic, strong) NSString *source;
@end
|
mlvhub/MPEGDASH-iOS-Player | DASH Player/DASH Player/ANDrawingPlayerView.h | <reponame>mlvhub/MPEGDASH-iOS-Player
//
// ANGLKPlayerView.h
// DASH Player
//
// Created by DataArt Apps on 03.09.14.
// Copyright (c) 2014 DataArt Apps. All rights reserved.
//
#import <UIKit/UIKit.h>
#import <GLKit/GLKit.h>
#import "ANVideoDecoder.h"
#pragma mark - renderer protocol
@protocol ANMovieGLRenderer
- (BOOL) isValid;
- (NSString *) fragmentShader;
- (void) resolveUniforms: (GLuint) program;
- (void) setFrame: (id) frame;
- (BOOL) prepareRender;
@end
enum {
ATTRIBUTE_VERTEX,
ATTRIBUTE_TEXCOORD,
};
@interface ANDrawingPlayerView : UIView
@property (nonatomic, assign) CGSize videoSize;
@property (weak, nonatomic) IBOutlet UIButton *playButton;
- (void) render: (ANVideoFrameYUV *) frame;
- (void) clear;
@end
@interface ANMovieGLRenderer_YUV : NSObject <ANMovieGLRenderer> {
GLint _uniformSamplers[3];
GLuint _textures[3];
}
@end |
mlvhub/MPEGDASH-iOS-Player | DASH Player/DASH Player/ANPacketQueue.h | //
// ANPacketQueue.h
// DASH Player
//
// Created by DataArt Apps on 18.08.14.
// Copyright (c) 2014 DataArt Apps. All rights reserved.
//
#import <Foundation/Foundation.h>
#include "libavformat/avformat.h"
#include "libswscale/swscale.h"
@interface ANPacketQueue : NSObject {
}
- (int) putPacket:(AVPacket *) pkt;
- (int) getPacket:(AVPacket*) pkt block:(int) block;
- (void) endOfQueue;
@end
|
mlvhub/MPEGDASH-iOS-Player | DASH Player/DASH Player/Model/SegmentTemplate.h | <filename>DASH Player/DASH Player/Model/SegmentTemplate.h
//
// SegmentTemplate.h
// DASH Player
//
// Created by DataArt Apps on 28.07.14.
// Copyright (c) 2014 DataArt Apps. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "SegmentTimeline.h"
@interface SegmentTemplate : NSObject
@property (nonatomic, strong) NSString *media;
@property (nonatomic, strong) NSString *initialization;
@property (nonatomic, assign) NSTimeInterval presentationTimeOffset;
@property (nonatomic, assign) NSInteger timescale;
@property (nonatomic, assign) NSUInteger startNumber;
@property (nonatomic, assign) NSUInteger duration;
@property (nonatomic, strong) SegmentTimeline *segmentTimeline;
- (void)setPresentationTimeOffsetFromString:(NSString *)stringValue;
- (void)setTimescaleFromString:(NSString *)stringValue;
- (void)setStartNumberFromString:(NSString *)stringValue;
- (void)setDurationFromString:(NSString *)stringValue;
@end
|
mlvhub/MPEGDASH-iOS-Player | DASH Player/DASH Player/ANHistoryViewController.h | //
// ANHistoryViewController.h
// DASH Player
//
// Created by DataArt Apps on 20.10.14.
// Copyright (c) 2014 DataArt Apps. All rights reserved.
//
#import <UIKit/UIKit.h>
@protocol ANHistoryViewControllerDelegate;
@interface ANHistoryViewController : UIViewController
@property (nonatomic, weak) id <ANHistoryViewControllerDelegate> delegate;
@end
@protocol ANHistoryViewControllerDelegate <NSObject>
@optional
- (void)historyViewControllerDidCancel:(ANHistoryViewController *)controller;
- (void)historyViewController:(ANHistoryViewController *)controller didSelectUrlString:(NSString *)urlString;
@end |
mlvhub/MPEGDASH-iOS-Player | DASH Player/DASH Player/ANVideoPicturesList.h | <gh_stars>10-100
//
// ANVideoPicturesList.h
// DASH Player
//
// Created by DataArt Apps on 20.08.14.
// Copyright (c) 2014 DataArt Apps. All rights reserved.
//
#import <Foundation/Foundation.h>
#include "libavcodec/avcodec.h"
#include "libavformat/avformat.h"
@class ANPicturesListElement;
@class ANVideoFrameYUV;
@interface ANPicturesListElement : NSObject {
ANVideoFrameYUV *yuvFrame;
ANPicturesListElement *next;
}
@property (nonatomic, strong) ANPicturesListElement *next;
@property (nonatomic, strong) ANVideoFrameYUV *yuvFrame;
@end
@interface ANVideoPicturesList : NSObject
@property (nonatomic, assign) NSUInteger count;
- (void)putPictureElement:(ANPicturesListElement *)videoPicture;
- (ANPicturesListElement *)getPictureElement;
- (void)endOfList;
- (BOOL)isEndOfList;
@end
|
mlvhub/MPEGDASH-iOS-Player | DASH Player/DASH Player/ANMultimediaData.h | <filename>DASH Player/DASH Player/ANMultimediaData.h
//
// ANMultimediaData.h
// DASH Player
//
// Created by DataArt Apps on 05.09.14.
// Copyright (c) 2014 DataArt Apps. All rights reserved.
//
#import <Foundation/Foundation.h>
#include "libavutil/rational.h"
@interface ANMultimediaData : NSObject
@property (nonatomic, strong) NSData *mediaData;
@property (nonatomic, assign) NSUInteger mediaDuration;
@property (nonatomic, assign) NSUInteger timescale;
@property (nonatomic, assign) double mediaDurationScaled;
@property (nonatomic, assign) NSUInteger segmentNumber;
@property (nonatomic, assign) BOOL isLastSegmentNumber;
@property (nonatomic, strong) NSData *initialData;
@end
|
mlvhub/MPEGDASH-iOS-Player | DASH Player/DASH Player/ANSupport.h | //
// ANSupport.h
// DASH Player
//
// Created by DataArt Apps on 06.08.14.
// Copyright (c) 2014 DataArt Apps. All rights reserved.
//
#import <Foundation/Foundation.h>
typedef void (^ANSuccessWithResponseCompletionBlock)(id response);
typedef void (^ANCompletionBlockWithData)(BOOL success, NSError* error, id data);
typedef void (^ANCompletionBlock)(BOOL success, NSError* error);
typedef void (^ANFailureCompletionBlock)(NSError *error);
typedef unsigned long long int ANTimeInterval;
void mat4f_LoadOrtho(float left, float right, float bottom, float top, float near, float far, float* mout);
GLuint compileShader(GLenum type, NSString *shaderString);
BOOL validateProgram(GLuint prog);
static double const ANTimerIntervalLagreValue = 1024.0;
static NSString * const ANUserDefaultsHistoryKey = @"ANUsegDefaultsHistoryKey";
@interface ANSupport : NSObject
+ (void)showInfoAlertWithMessage:(NSString *)message;
@end
|
mlvhub/MPEGDASH-iOS-Player | DASH Player/DASH Player/Model/ANXsdDurationParser.h | //
// ANXsdDurationParser.h
// DASH Player
//
// Created by DataArt Apps on 29.07.14.
// Copyright (c) 2014 DataArt Apps. All rights reserved.
//
#import <Foundation/Foundation.h>
typedef enum {
ANXsdStateBegin = 0,
ANXsdStateDigit,
ANXsdStateYear,
ANXsdStateMonth,
ANXsdStateDay,
ANXsdStateT,
ANXsdStateHours,
ANXsdStateMinutes,
ANXsdStateSeconds,
ANXsdStateDot
} ANXsdState;
@interface ANXsdDurationParser : NSObject
- (NSTimeInterval)timeIntervalFromString:(NSString *)string;
@end
|
mlvhub/MPEGDASH-iOS-Player | DASH Player/DASH Player/ANDownloadOperation.h | //
// ANDownloadOperation.h
// DASH Player
//
// Created by DataArt Apps on 07.08.14.
// Copyright (c) 2014 DataArt Apps. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "ANOperation.h"
@interface ANDownloadOperation : NSObject
-(id)initWithUrl:(NSURL *)url;
@property (nonatomic, strong) ANSuccessWithResponseCompletionBlock success;
@property (nonatomic, strong) ANFailureCompletionBlock failure;
@property (nonatomic, strong) void (^statisticBlock)();
@property (nonatomic, strong) NSCondition *condition;
@property (nonatomic, assign) NSUInteger bytesDownloaded;
@property (nonatomic, assign) double timeForDownload;
@property (nonatomic, strong) NSMutableURLRequest *urlRequest;
- (void)lauchDownloading;
- (void)cancelDownloading;
@end
|
mlvhub/MPEGDASH-iOS-Player | DASH Player/DASH Player/ANVideoDecoder.h | <reponame>mlvhub/MPEGDASH-iOS-Player<filename>DASH Player/DASH Player/ANVideoDecoder.h
#import <Foundation/Foundation.h>
#include "libavcodec/avcodec.h"
#include "libavformat/avformat.h"
#include "libswscale/swscale.h"
#include "libavutil/time.h"
@class ANVideoPicturesList;
@class ANVideoData;
@protocol ANVideoDecoderDelegate;
static NSString *const ANRuleAskNext = @"ANRuleAskNext";
static NSString *const ANRuleEndDecode = @"ANRuleEndDecode";
typedef enum {
ANMovieFrameTypeAudio = 0,
ANMovieFrameTypeVideo,
ANMovieFrameTypeArtwork,
ANMovieFrameTypeSubtitle,
} ANMovieFrameType;
typedef enum {
ANVideoFrameFormatRGB,
ANVideoFrameFormatYUV,
} ANVideoFrameFormat;
#pragma mark - ANVideoFrameYUV
@interface ANVideoFrameYUV : NSObject
@property (nonatomic) float pts;
@property (nonatomic) NSUInteger width;
@property (nonatomic) NSUInteger height;
@property (nonatomic, assign) Byte *luma;
@property (nonatomic, assign) Byte *chromaB;
@property (nonatomic, assign) Byte *chromaR;
@property (nonatomic, assign) NSUInteger lumaLength;
@property (nonatomic, assign) NSUInteger chromaBLength;
@property (nonatomic, assign) NSUInteger chromaRLength;
@end
#pragma mark - VideoFrameExtractor
@interface ANVideoDecoder : NSObject {
AVFormatContext *formatContex;
AVCodecContext *codecContext;
AVFrame *pFrame;
AVPacket packet;
AVPicture picture;
BOOL quit;
int bytesRead;
int bytesLeft;
}
@property (nonatomic, strong, readonly) ANVideoData *videoData;
@property (nonatomic, assign, readonly) NSInteger framesCount;
@property (nonatomic, assign, getter = isVideoFinished) BOOL videoIsFinished;
@property (nonatomic, strong) ANVideoPicturesList *videoPicturesList;
@property (nonatomic, weak) id <ANVideoDecoderDelegate> delegate;
@property (nonatomic, readonly) int sourceWidth, sourceHeight;
@property (nonatomic, readonly) double duration;
- (id)initWithVideoData:(ANVideoData *)videoData;
- (AVRational)movieFramerate;
- (void)startWork;
- (void)quit;
@end
@protocol ANVideoDecoderDelegate <NSObject>
- (void)decoderDidFinishDecoding:(ANVideoDecoder *)video;
@end |
mlvhub/MPEGDASH-iOS-Player | DASH Player/DASH Player/ANOperation.h | <filename>DASH Player/DASH Player/ANOperation.h
//
// ANOperation.h
// DASH Player
//
// Created by DataArt Apps on 07.08.14.
// Copyright (c) 2014 DataArt Apps. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface ANOperation : NSOperation {
BOOL finished;
BOOL executing;
}
- (void)completeOperation;
@end
|
mlvhub/MPEGDASH-iOS-Player | DASH Player/DASH Player/Model/Representation.h | <reponame>mlvhub/MPEGDASH-iOS-Player
//
// Representation.h
// DASH Player
//
// Created by DataArt Apps on 28.07.14.
// Copyright (c) 2014 DataArt Apps. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "SegmentTemplate.h"
#import "SegmentBase.h"
@interface Representation : NSObject
@property (nonatomic, strong) NSString *id;
@property (nonatomic, strong) NSString *mimeType;
@property (nonatomic, strong) NSString *codecs;
@property (nonatomic, assign) NSUInteger audioSamplingRate;
@property (nonatomic, assign) NSUInteger bandwidth;
@property (nonatomic, assign) NSUInteger height;
@property (nonatomic, assign) NSUInteger width;
@property (nonatomic, strong) SegmentTemplate *segmentTemplate;
@property (nonatomic, strong) NSString *baseUrlString;
@property (nonatomic, strong) SegmentBase *segmentBase;
@property (nonatomic, assign, readonly) double supposedDownloadTime;
@property (nonatomic, assign) double downloadingSpeed;
- (void)setAudioSamplingRateFromString:(NSString *)valueString;
- (void)setBandwidthFromString:(NSString *)valueString;
- (void)setHeightFromString:(NSString *)valueString;
- (void)setWidthFromString:(NSString *)valueString;
@end
|
mlvhub/MPEGDASH-iOS-Player | DASH Player/DASH Player/ANAudioData.h | <filename>DASH Player/DASH Player/ANAudioData.h
//
// ANAudioData.h
// DASH Player
//
// Created by DataArt Apps on 05.09.14.
// Copyright (c) 2014 DataArt Apps. All rights reserved.
//
#import "ANMultimediaData.h"
@interface ANAudioData : ANMultimediaData
// on this value in seconds decoder should shift video decoding to synchronize audio and video playback
@property (nonatomic, assign) double diffFromVideo;
@end
|
mlvhub/MPEGDASH-iOS-Player | DASH Player/DASH Player/Model/Period.h | <gh_stars>10-100
//
// Period.h
// DASH Player
//
// Created by DataArt Apps on 28.07.14.
// Copyright (c) 2014 DataArt Apps. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "AdaptationSet.h"
@interface Period : NSObject
@property (nonatomic, assign) NSTimeInterval duration;
@property (nonatomic, assign) NSTimeInterval start;
@property (nonatomic, strong) NSString *id;
@property (nonatomic, strong) NSArray *adaptationSet;
- (void)setDurationFromString:(NSString *)durationString;
- (void)setStartFromString:(NSString *)startString;
- (void)addAdaptationSetElement:(AdaptationSet *)adaptionSetElement;
@end
|
mlvhub/MPEGDASH-iOS-Player | DASH Player/DASH Player/ANVideoData.h | //
// ANVideoData.h
// DASH Player
//
// Created by DataArt Apps on 05.09.14.
// Copyright (c) 2014 DataArt Apps. All rights reserved.
//
#import "ANMultimediaData.h"
@interface ANVideoData : ANMultimediaData
@property (nonatomic, assign, readonly) NSInteger expectedFramesNumber;
@property (nonatomic, assign) AVRational framerate;
@property (nonatomic, assign) ANTimeInterval duration;
@property (nonatomic, assign) NSTimeInterval timeSinceMediaBeginning;
@end
|
mlvhub/MPEGDASH-iOS-Player | DASH Player/DASH Player/Model/ContentComponent.h | //
// ContentComponent.h
// DASH Player
//
// Created by DataArt Apps on 28.07.14.
// Copyright (c) 2014 DataArt Apps. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface ContentComponent : NSObject
@property (nonatomic, strong) NSString *id;
@property (nonatomic, strong) NSString *contentType;
@end
|
mlvhub/MPEGDASH-iOS-Player | DASH Player/DASH Player/ANVideoPicture.h | <filename>DASH Player/DASH Player/ANVideoPicture.h<gh_stars>10-100
//
// ANVideoPicture.h
// DASH Player
//
// Created by DataArt Apps on 24.07.14.
// Copyright (c) 2014 DataArt Apps. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface ANVideoPicture : NSObject {
// SDL_Surface* screen;
// SDL_Overlay* bmp;
double pts;
int ready;
NSCondition *cond;
NSLock *mutexLock;
// SDL_mutex* mutex;
// SDL_cond* cond;
}
@property (nonatomic, assign) double pts;
@property (nonatomic, assign) int ready;
//@property (nonatomic, strong) NSCondition *cond;
//@property (nonatomic, strong) NSLock *mutexLock;
@property (nonatomic, strong) UIImage *image;
@end
|
mlvhub/MPEGDASH-iOS-Player | DASH Player/DASH Player/ANSourceInputView.h | <reponame>mlvhub/MPEGDASH-iOS-Player
//
// ANSourceInputView.h
// DASH Player
//
// Created by DataArt Apps on 29.09.14.
// Copyright (c) 2014 DataArt Apps. All rights reserved.
//
// http://rdmedia.bbc.co.uk/dash/ondemand/bbb/avc1/1/client_manifest.mpd
// http://yt-dash-mse-test.commondatastorage.googleapis.com/media/car-20120827-manifest.mpd
// http://yt-dash-mse-test.commondatastorage.googleapis.com/media/feelings_vp9-20130806-manifest.mpd
#import <UIKit/UIKit.h>
@protocol ANSourceInputViewDelegate;
@interface ANSourceInputView : UIView <UITextFieldDelegate>
@property (weak, nonatomic) IBOutlet UIButton *sourceInputViewDoneButton;
@property (weak, nonatomic) IBOutlet UITextField *sourceInputViewTextField;
@property (nonatomic, weak) id <ANSourceInputViewDelegate> delegate;
@end
@protocol ANSourceInputViewDelegate <NSObject>
@optional
- (void)sourceInputView:(ANSourceInputView *)view didGetUrlString:(NSString *)urlString;
- (void)sourceInputViewDidCancel:(ANSourceInputView *)view;
@end |
mlvhub/MPEGDASH-iOS-Player | DASH Player/DASH Player/Model/SegmentTimeline.h | //
// SegmentTimeline.h
// DASH Player
//
// Created by DataArt Apps on 28.07.14.
// Copyright (c) 2014 DataArt Apps. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "Segment.h"
@interface SegmentTimeline : NSObject
@property (nonatomic, strong) NSArray *segmentArray;
- (void)addSegmentElement:(Segment *)segment;
@end
|
mlvhub/MPEGDASH-iOS-Player | DASH Player/DASH Player/Model/Segment.h | //
// Segment.h
// DASH Player
//
// Created by DataArt Apps on 28.07.14.
// Copyright (c) 2014 DataArt Apps. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface Segment : NSObject
@property (nonatomic, assign) NSUInteger t;
@property (nonatomic, assign) NSUInteger d;
- (void)setTimeFromString:(NSString *)stringValue;
- (void)setDurationFromString:(NSString *)stringValue;
@end
|
mlvhub/MPEGDASH-iOS-Player | DASH Player/DASH Player/Model/AdaptationSet.h | <gh_stars>10-100
//
// AdaptationSet.h
// DASH Player
//
// Created by DataArt Apps on 28.07.14.
// Copyright (c) 2014 DataArt Apps. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "ContentComponent.h"
#import "Representation.h"
#import "SegmentTemplate.h"
#import "AudioChannelConfiguration.h"
@interface AdaptationSet : NSObject
@property (nonatomic, strong) NSString *id;
@property (nonatomic, strong) NSString *lang;
@property (nonatomic, strong) NSString *mimeType;
@property (nonatomic, assign) BOOL segmentAlignment;
@property (nonatomic, assign) NSUInteger maxWidth;
@property (nonatomic, assign) NSUInteger maxHeight;
@property (nonatomic, assign) NSUInteger maxFrameRate;
@property (nonatomic, assign) NSUInteger audioSamplingRate;
@property (nonatomic, strong) ContentComponent *contentComponent;
@property (nonatomic, strong) SegmentTemplate *segmentTemplate;
@property (nonatomic, strong) NSArray *representationArray;
@property (nonatomic, strong) AudioChannelConfiguration *audioChannelConfiguration;
- (void)setSegmentAlignmentFromString:(NSString *)valueString;
- (void)setMaxWidthString:(NSString *)valueString;
- (void)setMaxHeightFromString:(NSString *)valueString;
- (void)setMaxFrameRateFromString:(NSString *)valueString;
- (void)setAudioSamplingRateFromString:(NSString *)valueString;
- (void)addRepresentation:(Representation *)representation;
@end
|
mlvhub/MPEGDASH-iOS-Player | DASH Player/DASH Player/Model/ANMpdManager.h | //
// ANSegmentLoader.h
// DASH Player
//
// Created by DataArt Apps on 28.07.14.
// Copyright (c) 2014 DataArt Apps. All rights reserved.
//
#import <Foundation/Foundation.h>
@class MPD;
@class ANHttpClient;
@protocol ANMpdManagerDelegate;
@interface ANMpdManager : NSObject
@property (nonatomic, weak) id<ANMpdManagerDelegate> delegate;
@property (nonatomic, strong) NSThread *currentThread;
- (id)initWithMpdUrl:(NSURL *)mpdUrl;
- (id)initWithMpdUrl:(NSURL *)mpdUrl parserThread:(NSThread *)thread;
- (void)checkMpdWithCompletionBlock:(ANCompletionBlock)completion;
- (void)updateMpd;
- (BOOL)isVideoRanged;
@end
@protocol ANMpdManagerDelegate <NSObject>
@optional
-(void)mpdManager:(ANMpdManager *)manager didFinishParsingMpdFile:(MPD *)mpd;
@end |
mlvhub/MPEGDASH-iOS-Player | DASH Player/DASH Player/ANControlPanelView.h | //
// ANControlPanelView.h
// DASH Player
//
// Created by DataArt Apps on 29.09.14.
// Copyright (c) 2014 DataArt Apps. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "ANSourceInputView.h"
@protocol ANControlPanelViewDelegate;
@interface ANControlPanelView : UIView <ANSourceInputViewDelegate>
@property (weak, nonatomic) IBOutlet UIButton *addSourceButton;
@property (weak, nonatomic) IBOutlet UIButton *stopButton;
@property (weak, nonatomic) IBOutlet UIButton *playButton;
@property (weak, nonatomic) IBOutlet UISlider *timeSlider;
@property (weak, nonatomic) IBOutlet UILabel *timeLabel;
@property (weak, nonatomic) IBOutlet UIButton *historyListButton;
@property (nonatomic, strong) ANSourceInputView *sourceInputView;
@property (nonatomic, strong) NSString *urlString;
@property (nonatomic, weak) id <ANControlPanelViewDelegate> delegate;
@property (nonatomic, assign) BOOL playButtonEnabled;
@property (nonatomic, assign) BOOL timeSliderEnabled;
@property (nonatomic, assign) double timeSliderValue;
@property (nonatomic, assign) double totalMediaDuration;
@property (nonatomic, strong) NSString *playButtonTitle;
@property (nonatomic, assign) BOOL sliderIsSliding;
- (void)reset;
- (void)enableButtons:(BOOL)enable;
@end
@protocol ANControlPanelViewDelegate <NSObject>
@optional
- (void)controlPanelView:(ANControlPanelView *)theView didGetUrlString:(NSString *)urlString;
- (void)controlPanelViewPlayButtonActioin:(ANControlPanelView *)theView;
- (void)controlPanelView:(ANControlPanelView *)theView sliderDidSlideToPosition:(CGFloat)pos;
- (void)controlPanelViewStopAction:(ANControlPanelView *)theView;
- (void)controlPanelView:(ANControlPanelView *)theView sliderDidStartSliding:(UISlider *)slider;
- (void)controlPanelViewShowHistoryListButtonAction:(ANControlPanelView *)theView;
@end
|
mlvhub/MPEGDASH-iOS-Player | DASH Player/DASH Player/Sidx.h | <reponame>mlvhub/MPEGDASH-iOS-Player<gh_stars>10-100
//
// sidx.h
// DASH Player
//
// Created by DataArt Apps on 09.11.14.
// Copyright (c) 2014 DataArt Apps. All rights reserved.
//
#import <Foundation/Foundation.h>
static NSString *const ANSidxConstantSize = @"size";
static NSString *const ANSidxConstantType = @"type";
static NSString *const ANSidxConstantOffset = @"offset";
static NSString *const ANSidxConstantDuration = @"duration";
static NSString *const ANSidxConstantTime = @"time";
static NSString *const ANSidxConstantTimescale = @"timescale";
@interface Sidx : NSObject
@property (nonatomic, assign) uint8_t version;
@property (nonatomic, assign) uint32_t timescale;
@property (nonatomic, assign) uint32_t earliestPresentationTime;
@property (nonatomic, assign) uint32_t firstOffset;
@property (nonatomic, assign) uint16_t referenceCount;
@property (nonatomic, strong) NSArray *references;
@property (nonatomic, strong) NSError *error;
- (NSTimeInterval)scaledDurationForReferenceNumber:(NSUInteger)referenceNumber;
-(instancetype)parseSidx:(NSData *)sidxData withFirstByteOffset:(uint32_t)byteOffset;
@end
|
mlvhub/MPEGDASH-iOS-Player | DASH Player/DASH Player/MainViewController.h | //
// MainViewController.h
// RawAudioDataPlayer
//
// Created by SamYou on 12-8-18.
// Copyright (c) 2012 SamYou. All rights reserved.
//
#import <UIKit/UIKit.h>
#import <AudioToolbox/AudioToolbox.h>
#define QUEUE_BUFFER_SIZE 4 //
#define EVERY_READ_LENGTH 10000 //
#define MIN_SIZE_PER_FRAME 20000 //
@interface MainViewController : UIViewController
{
AudioStreamBasicDescription audioDescription;///
AudioQueueRef audioQueue;//
AudioQueueBufferRef audioQueueBuffers[QUEUE_BUFFER_SIZE];//
NSLock *synlock ;///
Byte *pcmDataBuffer;//pcm
FILE *file;//pcm
}
static void AudioPlayerAQInputCallback(void *input, AudioQueueRef inQ, AudioQueueBufferRef outQB);
-(void)onbutton1clicked;
-(void)onbutton2clicked;
-(void)initAudio;
-(void)readPCMAndPlay:(AudioQueueRef)outQ buffer:(AudioQueueBufferRef)outQB;
-(void)checkUsedQueueBuffer:(AudioQueueBufferRef) qbuf;
@end |
mlvhub/MPEGDASH-iOS-Player | DASH Player/DASH Player/ANHistoryTableViewCell.h | <gh_stars>10-100
//
// ANHistoryTableViewCell.h
// DASH Player
//
// Created by DataArt Apps on 20.10.14.
// Copyright (c) 2014 DataArt Apps. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface ANHistoryTableViewCell : UITableViewCell
@property (weak, nonatomic) IBOutlet UILabel *urlLabel;
- (NSString *)reuseIdentifier;
+ (NSString *)reuseIdentifier;
@end
|
mlvhub/MPEGDASH-iOS-Player | DASH Player/DASH Player/Model/MPD.h | // MPD.h
// DASH Player
//
// Created by DataArt Apps on 28.07.14.
// Copyright (c) 2014 DataArt Apps. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "ANDashMultimediaManager.h"
#import "ProgramInformation.h"
#import "Period.h"
@interface MPD : NSObject
@property (nonatomic, strong) NSString *type;
@property (nonatomic, strong) NSDate *availabilityStartTime;
@property (nonatomic, strong) NSDate *availabilityEndTime;
@property (nonatomic, assign) NSInteger minimumUpdatePeriod;
@property (nonatomic, assign) NSInteger minBufferTime;
@property (nonatomic, assign) NSTimeInterval mediaPresentationDuration;
@property (nonatomic, assign) NSTimeInterval timeShiftBufferDepth;
@property (nonatomic, strong) Period *period;
@property (nonatomic, strong) ProgramInformation *programInformation;
@property (nonatomic, assign, getter=isVideoRanged) BOOL videoIsRanged;
- (void) setAvailabilityStartTimeFromString:(NSString *)availabilityStartTimeString;
- (void) setAvailabilityEndTimeFromString:(NSString *)availabilityEndTimeString;
- (void) setMinimumUpdatePeriodFromString:(NSString *)minimumUpdatePeriodString;
- (void) setMinBufferTimeFromString:(NSString *)minBufferTimeString;
- (void) setMediaPresentationDurationFromString:(NSString *)mediaPresentationDurationString;
- (void) setTimeShiftBufferDepthFromString:(NSString *)timeShiftBufferDepthString;
- (NSTimeInterval)updatePeriod;
- (SegmentTemplate *)audioSegmentTemplate;
- (SegmentTemplate *)videoSegmentTemplate;
- (ANStreamType)streamType;
- (AdaptationSet *)videoAdaptionSet;
- (AdaptationSet *)audioAdaptionSet;
@end
|
clean-code-craft-tcq-2/well-named-in-c-MohaseenaAkbar | ColorCodeMain.h | <reponame>clean-code-craft-tcq-2/well-named-in-c-MohaseenaAkbar
#ifndef COLORCODEMAIN_H
#define COLORCODEMAIN_H
#include <stdio.h>
#include <assert.h>
enum MajorColor {WHITE, RED, BLACK, YELLOW, VIOLET};
enum MinorColor {BLUE, ORANGE, GREEN, BROWN, SLATE};
extern const char* MajorColorNames[];
extern const char* MinorColorNames[];
extern const int MAX_COLORPAIR_NAME_CHARS;
extern int numberOfMinorColors;
extern int numberOfMajorColors;
typedef struct {
enum MajorColor majorColor;
enum MinorColor minorColor;
} ColorPair;
ColorPair GetColorFromPairNumber(int);
void testNumberToPair(int pairNumber,enum MajorColor,enum MinorColor);
void testPairToNumber(enum MajorColor,enum MinorColor,int);
int GetPairNumberFromColor(const ColorPair*);
void ColorPairToString(const ColorPair*, char*) ;
void ColorCodeReferenceManual(void);
#endif
|
clean-code-craft-tcq-2/well-named-in-c-MohaseenaAkbar | ColorCodeRefManual.c | <reponame>clean-code-craft-tcq-2/well-named-in-c-MohaseenaAkbar
#include "ColorCodeMain.h"
void ColorCodeReferenceManual()
{
int Pair_Num=1;
printf("\nColorCode\tMajorColor\tMinorColor");
for(int MajorColor=0;MajorColor<numberOfMajorColors;MajorColor++)
{
for(int MinorColor=0;MinorColor<numberOfMinorColors;MinorColor++,Pair_Num++)
{
printf("\n%d\t\t%s\t\t%s",Pair_Num,MajorColorNames[MajorColor],MinorColorNames[MinorColor]);
}
}
}
|
ayushmankumar7/Write-a-Arduino-Library | src/first.h | <reponame>ayushmankumar7/Write-a-Arduino-Library
#ifndef first_h
#define first_h
#include <Arduino.h>
#define ON true
#define OFF false
class First{
public:
First(int pin);
void blink(bool value);
private:
uint8_t pinNumber;
};
#endif
|
Bogdacutu/android_device_nvidia_shieldtablet_twrp | multirom/mr_hooks.c | #include <unistd.h>
#include <log.h>
#include <trampoline/devices.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/mount.h>
#include <pthread.h>
#include <fcntl.h>
#include <linux/watchdog.h>
#define WATCHDOG_INTERVAL 1
#define WATCHDOG_MARGIN 20
#define PID_TOUCH "/touch.pid"
static void write_pid(const char* path, int pid) {
FILE* f = fopen(path, "w");
int num = fprintf(f, "%d\n", pid);
fclose(f);
}
static void kill_pid(const char* path) {
int pid;
FILE *f = fopen(path, "r");
if (f == NULL)
return;
fscanf(f, "%d", &pid);
fclose(f);
kill(pid, SIGKILL);
unlink(path);
}
static void ts_thread() {
symlink("/realdata/media/0/multirom/touchscreen", "/sbin/touchscreen");
wait_for_file("/dev/touch", 10);
wait_for_file("/realdata/media/0/multirom", 10);
ERROR("Starting rm-wrapper...\n");
char* argv[] = {"/sbin/touchscreen/rm-wrapper", NULL};
char* envp[] = {"LD_LIBRARY_PATH=/sbin/touchscreen", NULL};
execve(argv[0], &argv[0], envp);
}
int mrom_hook_after_android_mounts(const char *busybox_path, const char *base_path, int type) {
mrom_hook_before_fb_close();
return 0;
}
void mrom_hook_before_fb_close() {
kill_pid(PID_TOUCH);
}
void tramp_hook_before_device_init() {
signal(SIGCHLD, SIG_IGN);
if (fork() == 0) {
write_pid(PID_TOUCH, getpid());
ts_thread();
_exit(0);
}
}
|
fecaridade/Teimoso | lib/Galaxias/Cronometro.h | <reponame>fecaridade/Teimoso<filename>lib/Galaxias/Cronometro.h
#include <Arduino.h>
class Cronometro
{
public:
Cronometro();
~Cronometro();
void configurarTempo(unsigned int ms);
void iniciarContagem();
bool finalizouContagem();
unsigned int obtertempoRestante();
unsigned int obterTempoDecorrido();
private:
unsigned long tempoDeInicio = 0, tempoDeTermino = 0;
unsigned int intervalo = 0;
bool contando = false;
}; |
fecaridade/Teimoso | lib/Galaxias/Galaxias.h | <filename>lib/Galaxias/Galaxias.h
#ifndef Galaxias_h
#define Galaxias_h
#include "Cabecalhos.h"
#include "Motor.h"
#include "SensoresDeFaixa.h"
#include "Cronometro.h"
Cronometro cronometro_1;
SensoresDeFaixa sensoresDeFaixa;
SensorDeToque sensorToqueFrontal(B);
SensorDeDistancia sensorDistanciaEsquerdo (L1);
SensorDeDistancia sensorDistanciaDireito (L2);
Botao botaoStart(23);
Botao botaoClear(25);
Motor motorDireito (M1);
Motor motorEsquerdo (M2);
#define esperar delay
#endif
|
fecaridade/Teimoso | lib/Galaxias/SensoresDeFaixa.h | <reponame>fecaridade/Teimoso<filename>lib/Galaxias/SensoresDeFaixa.h
#include "Arduino.h"
#include "CosmosNV2.h"
#define CRUZAMENTO_TOTAL 1
#define CRUZAMENTO_COM_PRETO_NA_ESQUERDA 2
#define CRUZAMENTO_COM_PRETO_NA_DIREITA 3
#define CRUZAMENTO_T 4
#define CURVA_DE_NOVENTA_GRAUS_PARA_A_ESQUERDA 5
#define CURVA_DE_NOVENTA_GRAUS_PARA_A_DIREITA 6
#define CURVA_SIMPLES_PARA_A_ESQUERDA 7
#define CURVA_SIMPLES_PARA_A_DIREITA 8
#define GAP 9
#define LINHA_RETA 10
#define RETORNO_PARA_A_LINHA_PELA_ESQUERDA 11
#define RETORNO_PARA_A_LINHA_PELA_DIREITA 12
class SensoresDeFaixa {
public:
SensoresDeFaixa();
void configurarModo(byte modo);
byte ler();
int lerSensorFrontal();
int lerSensorCentral();
private:
byte modo;
const int limite = 500;
const int _limite = 150;
SensorDeRefletancia sensor_esquerdo_extremo;
SensorDeRefletancia sensor_esquerdo_centro;
SensorDeRefletancia sensor_frontal;
SensorDeRefletancia sensor_central;
SensorDeRefletancia sensor_direito_centro;
SensorDeRefletancia sensor_direito_extremo;
};
|
fecaridade/Teimoso | lib/Galaxias/Cabecalhos.h | <gh_stars>1-10
void irParaFrente();
void irParaTras();
void virarParaEsquerda();
void virarParaDireita();
void girarNoventaGrausParaEsquerda();
void girarNoventaGrausParaDireita();
void retornarParaLinhaPelaEsquerda();
void retornarParaLinhaPelaDireita();
void parar();
void configurarVelocidadeDosMotores(byte, byte);
// ----------------------------------------------------------------------------------------- //
void iniciarModulos();
void buscarModoNaEEPROM();
void esperarBotaoStartSerPressionado();
// ----------------------------------------------------------------------------------------- //
void modoAreaDePercurso();
void seguirFaixa();
void procurarObstaculosNaPista();
void desviarObtaculo();
void verificarChegadaNarampa();
// ----------------------------------------------------------------------------------------- //
void modoRampa();
void seguirFaixaDaRampa();
void verificarChegadaNaAreaDeReagate();
// ----------------------------------------------------------------------------------------- //
void modoAreaDeResgate();
|
rirwin/sandbox | scratch/cython-scratch/sort_phonebook.c | #include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
const int DEBUG = 0;
void read_file_create_bit_vector(uint32_t* bvp, FILE* ifp);
int main() {
FILE *ifp; // in file pointer
FILE *ofp; // out file pointer
char infile_name[] = "unsorted_phonebook.txt";
char outfile_name[] = "sorted_phonebook_c.txt";
// 10M / 32 1-000-0000 (big enough for 7 digits)
int bv_size = 312500;
int *ph_num;
int bit = 0;
int idx = 0;
uint32_t comp_int = 0; // int used for computation / setting bit
// bit vector
uint32_t *bvp = (uint32_t*)malloc(bv_size*sizeof(uint32_t));
// clear bit vector
for (idx = 0; idx < bv_size; idx++) {
bvp[idx] = 0;
}
ifp = fopen(infile_name, "r");
if (ifp == NULL) {
fprintf(stderr, "Can't open input file in.list!\n");
exit(1);
}
ofp = fopen(outfile_name, "w");
if (ofp == NULL) {
fprintf(stderr, "Can't open output file %s!\n",
outfile_name);
exit(1);
}
// ---- reads file and sets bits in bit vector ----
while (fscanf(ifp, "%d", ph_num) != EOF) {
idx = *ph_num/32; // calc which int in bv to set
bit = *ph_num % 32; // calc which bit in int to set
comp_int = 1;
comp_int<<=bit;
*(bvp + idx) = (*(bvp + idx) | comp_int); // set bit
}
// ---- outputs sorted numbers in file ----
for (idx = 0; idx < bv_size; idx++) {
comp_int = 1;
if (*(bvp + idx) > 0) { // small optimization
for (bit = 0; bit < 32; bit++) {
if (comp_int & *(bvp + idx))
fprintf(ofp,"%d\n",idx*32+bit);
comp_int<<=1;
}
}
}
fclose(ifp);
fclose(ofp);
return 0;
}
|
jimgrundy/s2n-tls | tls/s2n_cipher_preferences.c | <filename>tls/s2n_cipher_preferences.c
/*
* Copyright Amazon.com, Inc. or its affiliates. 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.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
#include "tls/s2n_cipher_preferences.h"
#include <s2n.h>
#include <stdint.h>
#include <strings.h>
#include "tls/s2n_config.h"
#include "tls/s2n_kem.h"
#include "tls/s2n_kex.h"
#include "error/s2n_errno.h"
#include "utils/s2n_safety.h"
/* clang-format off */
/* TLS 1.3 cipher suites, in order of preference.
* Can be added to other ciphers suite lists to enable
* TLS1.3 compatibility. */
#define S2N_TLS13_CIPHER_SUITES_20190801 \
&s2n_tls13_aes_256_gcm_sha384, \
&s2n_tls13_aes_128_gcm_sha256, \
&s2n_tls13_chacha20_poly1305_sha256
#define S2N_TLS13_CLOUDFRONT_CIPHER_SUITES_20200716 \
&s2n_tls13_aes_128_gcm_sha256, \
&s2n_tls13_aes_256_gcm_sha384, \
&s2n_tls13_chacha20_poly1305_sha256
/* s2n's list of cipher suites, in order of preferences, as of 2019-08-01 */
struct s2n_cipher_suite *cipher_suites_20190801[] = {
S2N_TLS13_CIPHER_SUITES_20190801,
&s2n_ecdhe_rsa_with_aes_128_gcm_sha256,
&s2n_ecdhe_rsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_rsa_with_chacha20_poly1305_sha256,
&s2n_ecdhe_rsa_with_aes_128_cbc_sha,
&s2n_ecdhe_rsa_with_aes_128_cbc_sha256,
&s2n_ecdhe_rsa_with_aes_256_cbc_sha,
&s2n_rsa_with_aes_128_gcm_sha256,
&s2n_rsa_with_aes_128_cbc_sha256,
&s2n_rsa_with_aes_128_cbc_sha
};
const struct s2n_cipher_preferences cipher_preferences_20190801 = {
.count = s2n_array_len(cipher_suites_20190801),
.suites = cipher_suites_20190801,
};
/* s2n's list of cipher suites, in order of preference, as of 2014-06-01 */
struct s2n_cipher_suite *cipher_suites_20140601[] = {
&s2n_dhe_rsa_with_aes_128_cbc_sha256,
&s2n_dhe_rsa_with_aes_128_cbc_sha,
&s2n_dhe_rsa_with_3des_ede_cbc_sha,
&s2n_rsa_with_aes_128_cbc_sha256,
&s2n_rsa_with_aes_128_cbc_sha,
&s2n_rsa_with_3des_ede_cbc_sha,
&s2n_rsa_with_rc4_128_sha,
&s2n_rsa_with_rc4_128_md5
};
const struct s2n_cipher_preferences cipher_preferences_20140601 = {
.count = s2n_array_len(cipher_suites_20140601),
.suites = cipher_suites_20140601,
};
/* Disable SSLv3 due to POODLE */
const struct s2n_cipher_preferences cipher_preferences_20141001 = {
.count = s2n_array_len(cipher_suites_20140601),
.suites = cipher_suites_20140601,
};
/* Disable RC4 */
struct s2n_cipher_suite *cipher_suites_20150202[] = {
&s2n_dhe_rsa_with_aes_128_cbc_sha256,
&s2n_dhe_rsa_with_aes_128_cbc_sha,
&s2n_dhe_rsa_with_3des_ede_cbc_sha,
&s2n_rsa_with_aes_128_cbc_sha256,
&s2n_rsa_with_aes_128_cbc_sha,
&s2n_rsa_with_3des_ede_cbc_sha
};
const struct s2n_cipher_preferences cipher_preferences_20150202 = {
.count = s2n_array_len(cipher_suites_20150202),
.suites = cipher_suites_20150202,
};
/* Support AES-GCM modes */
struct s2n_cipher_suite *cipher_suites_20150214[] = {
&s2n_dhe_rsa_with_aes_128_gcm_sha256,
&s2n_dhe_rsa_with_aes_128_cbc_sha256,
&s2n_dhe_rsa_with_aes_128_cbc_sha,
&s2n_dhe_rsa_with_3des_ede_cbc_sha,
&s2n_rsa_with_aes_128_gcm_sha256,
&s2n_rsa_with_aes_128_cbc_sha256,
&s2n_rsa_with_aes_128_cbc_sha,
&s2n_rsa_with_3des_ede_cbc_sha
};
const struct s2n_cipher_preferences cipher_preferences_20150214 = {
.count = s2n_array_len(cipher_suites_20150214),
.suites = cipher_suites_20150214,
};
/* Make a CBC cipher #1 to avoid negotiating GCM with buggy Java clients */
struct s2n_cipher_suite *cipher_suites_20160411[] = {
&s2n_ecdhe_rsa_with_aes_128_cbc_sha,
&s2n_ecdhe_rsa_with_aes_128_gcm_sha256,
&s2n_ecdhe_rsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_rsa_with_aes_128_cbc_sha256,
&s2n_ecdhe_rsa_with_aes_256_cbc_sha,
&s2n_ecdhe_rsa_with_aes_256_cbc_sha384,
&s2n_rsa_with_aes_128_cbc_sha,
&s2n_rsa_with_aes_128_gcm_sha256,
&s2n_rsa_with_aes_256_gcm_sha384,
&s2n_rsa_with_aes_128_cbc_sha256,
&s2n_rsa_with_aes_256_cbc_sha,
&s2n_rsa_with_aes_256_cbc_sha256,
&s2n_rsa_with_3des_ede_cbc_sha,
};
const struct s2n_cipher_preferences cipher_preferences_20160411 = {
.count = s2n_array_len(cipher_suites_20160411),
.suites = cipher_suites_20160411,
};
/* Use ECDHE instead of plain DHE. Prioritize ECDHE in favour of non ECDHE; GCM in favour of CBC; AES128 in favour of AES256. */
struct s2n_cipher_suite *cipher_suites_20150306[] = {
&s2n_ecdhe_rsa_with_aes_128_gcm_sha256,
&s2n_ecdhe_rsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_rsa_with_aes_128_cbc_sha,
&s2n_ecdhe_rsa_with_aes_128_cbc_sha256,
&s2n_ecdhe_rsa_with_3des_ede_cbc_sha,
&s2n_ecdhe_rsa_with_aes_256_cbc_sha,
&s2n_rsa_with_aes_128_gcm_sha256,
&s2n_rsa_with_aes_128_cbc_sha256,
&s2n_rsa_with_aes_128_cbc_sha,
&s2n_rsa_with_3des_ede_cbc_sha
};
const struct s2n_cipher_preferences cipher_preferences_20150306 = {
.count = s2n_array_len(cipher_suites_20150306),
.suites = cipher_suites_20150306,
};
struct s2n_cipher_suite *cipher_suites_20160804[] = {
&s2n_ecdhe_rsa_with_aes_128_gcm_sha256,
&s2n_ecdhe_rsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_rsa_with_aes_128_cbc_sha,
&s2n_ecdhe_rsa_with_aes_128_cbc_sha256,
&s2n_ecdhe_rsa_with_aes_256_cbc_sha,
&s2n_ecdhe_rsa_with_aes_256_cbc_sha384,
&s2n_rsa_with_aes_128_gcm_sha256,
&s2n_rsa_with_aes_256_gcm_sha384,
&s2n_rsa_with_aes_128_cbc_sha,
&s2n_rsa_with_aes_128_cbc_sha256,
&s2n_rsa_with_aes_256_cbc_sha,
&s2n_rsa_with_aes_256_cbc_sha256,
&s2n_rsa_with_3des_ede_cbc_sha
};
const struct s2n_cipher_preferences cipher_preferences_20160804 = {
.count = s2n_array_len(cipher_suites_20160804),
.suites = cipher_suites_20160804,
};
struct s2n_cipher_suite *cipher_suites_20160824[] = {
&s2n_ecdhe_rsa_with_aes_128_gcm_sha256,
&s2n_ecdhe_rsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_rsa_with_aes_128_cbc_sha,
&s2n_ecdhe_rsa_with_aes_128_cbc_sha256,
&s2n_ecdhe_rsa_with_aes_256_cbc_sha,
&s2n_rsa_with_aes_128_gcm_sha256,
&s2n_rsa_with_aes_128_cbc_sha256,
&s2n_rsa_with_aes_128_cbc_sha
};
const struct s2n_cipher_preferences cipher_preferences_20160824 = {
.count = s2n_array_len(cipher_suites_20160824),
.suites = cipher_suites_20160824,
};
/* Add ChaCha20 suite */
struct s2n_cipher_suite *cipher_suites_20170210[] = {
&s2n_ecdhe_rsa_with_aes_128_gcm_sha256,
&s2n_ecdhe_rsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_rsa_with_chacha20_poly1305_sha256,
&s2n_ecdhe_rsa_with_aes_128_cbc_sha,
&s2n_ecdhe_rsa_with_aes_128_cbc_sha256,
&s2n_ecdhe_rsa_with_aes_256_cbc_sha,
&s2n_rsa_with_aes_128_gcm_sha256,
&s2n_rsa_with_aes_128_cbc_sha256,
&s2n_rsa_with_aes_128_cbc_sha
};
const struct s2n_cipher_preferences cipher_preferences_20170210 = {
.count = s2n_array_len(cipher_suites_20170210),
.suites = cipher_suites_20170210,
};
/* Same as 20160411, but with ChaCha20 added as 1st in Preference List */
struct s2n_cipher_suite *cipher_suites_20190122[] = {
&s2n_ecdhe_rsa_with_chacha20_poly1305_sha256,
&s2n_ecdhe_rsa_with_aes_128_cbc_sha,
&s2n_ecdhe_rsa_with_aes_128_gcm_sha256,
&s2n_ecdhe_rsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_rsa_with_aes_128_cbc_sha256,
&s2n_ecdhe_rsa_with_aes_256_cbc_sha,
&s2n_ecdhe_rsa_with_aes_256_cbc_sha384,
&s2n_rsa_with_aes_128_cbc_sha,
&s2n_rsa_with_aes_128_gcm_sha256,
&s2n_rsa_with_aes_256_gcm_sha384,
&s2n_rsa_with_aes_128_cbc_sha256,
&s2n_rsa_with_aes_256_cbc_sha,
&s2n_rsa_with_aes_256_cbc_sha256,
&s2n_rsa_with_3des_ede_cbc_sha,
};
const struct s2n_cipher_preferences cipher_preferences_20190122 = {
.count = s2n_array_len(cipher_suites_20190122),
.suites = cipher_suites_20190122,
};
/* Same as 20160804, but with ChaCha20 added as 2nd in Preference List */
struct s2n_cipher_suite *cipher_suites_20190121[] = {
&s2n_ecdhe_rsa_with_aes_128_gcm_sha256,
&s2n_ecdhe_rsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_rsa_with_chacha20_poly1305_sha256,
&s2n_ecdhe_rsa_with_aes_128_cbc_sha,
&s2n_ecdhe_rsa_with_aes_128_cbc_sha256,
&s2n_ecdhe_rsa_with_aes_256_cbc_sha,
&s2n_ecdhe_rsa_with_aes_256_cbc_sha384,
&s2n_rsa_with_aes_128_gcm_sha256,
&s2n_rsa_with_aes_256_gcm_sha384,
&s2n_rsa_with_aes_128_cbc_sha,
&s2n_rsa_with_aes_128_cbc_sha256,
&s2n_rsa_with_aes_256_cbc_sha,
&s2n_rsa_with_aes_256_cbc_sha256,
&s2n_rsa_with_3des_ede_cbc_sha
};
const struct s2n_cipher_preferences cipher_preferences_20190121 = {
.count = s2n_array_len(cipher_suites_20190121),
.suites = cipher_suites_20190121,
};
/* Same as 20160411, but with ChaCha20 in 3rd Place after CBC and GCM */
struct s2n_cipher_suite *cipher_suites_20190120[] = {
&s2n_ecdhe_rsa_with_aes_128_cbc_sha,
&s2n_ecdhe_rsa_with_aes_128_gcm_sha256,
&s2n_ecdhe_rsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_rsa_with_chacha20_poly1305_sha256,
&s2n_ecdhe_rsa_with_aes_128_cbc_sha256,
&s2n_ecdhe_rsa_with_aes_256_cbc_sha,
&s2n_ecdhe_rsa_with_aes_256_cbc_sha384,
&s2n_rsa_with_aes_128_cbc_sha,
&s2n_rsa_with_aes_128_gcm_sha256,
&s2n_rsa_with_aes_256_gcm_sha384,
&s2n_rsa_with_aes_128_cbc_sha256,
&s2n_rsa_with_aes_256_cbc_sha,
&s2n_rsa_with_aes_256_cbc_sha256,
&s2n_rsa_with_3des_ede_cbc_sha,
};
const struct s2n_cipher_preferences cipher_preferences_20190120 = {
.count = s2n_array_len(cipher_suites_20190120),
.suites = cipher_suites_20190120,
};
/* Preferences optimized for interop, includes ECDSA priortitized. DHE and 3DES are added(at the lowest preference). */
struct s2n_cipher_suite *cipher_suites_20190214[] = {
&s2n_ecdhe_ecdsa_with_aes_128_cbc_sha,
&s2n_ecdhe_rsa_with_aes_128_cbc_sha,
&s2n_ecdhe_ecdsa_with_aes_128_gcm_sha256,
&s2n_ecdhe_rsa_with_aes_128_gcm_sha256,
&s2n_ecdhe_ecdsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_rsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_ecdsa_with_aes_128_cbc_sha256,
&s2n_ecdhe_rsa_with_aes_128_cbc_sha256,
&s2n_ecdhe_ecdsa_with_aes_256_cbc_sha,
&s2n_ecdhe_rsa_with_aes_256_cbc_sha,
&s2n_ecdhe_ecdsa_with_aes_256_cbc_sha384,
&s2n_ecdhe_rsa_with_aes_256_cbc_sha384,
&s2n_rsa_with_aes_128_cbc_sha,
&s2n_rsa_with_aes_128_gcm_sha256,
&s2n_rsa_with_aes_256_gcm_sha384,
&s2n_rsa_with_aes_128_cbc_sha256,
&s2n_rsa_with_aes_256_cbc_sha,
&s2n_rsa_with_aes_256_cbc_sha256,
&s2n_rsa_with_3des_ede_cbc_sha,
&s2n_dhe_rsa_with_aes_128_cbc_sha,
&s2n_dhe_rsa_with_aes_128_gcm_sha256,
&s2n_dhe_rsa_with_aes_256_gcm_sha384,
&s2n_dhe_rsa_with_aes_128_cbc_sha256,
&s2n_dhe_rsa_with_aes_256_cbc_sha,
&s2n_dhe_rsa_with_aes_256_cbc_sha256,
};
const struct s2n_cipher_preferences cipher_preferences_20190214 = {
.count = s2n_array_len(cipher_suites_20190214),
.suites = cipher_suites_20190214,
};
/* 20190214 with aes-gcm prioritized above aes-cbc */
struct s2n_cipher_suite *cipher_suites_20190214_gcm[] = {
&s2n_ecdhe_ecdsa_with_aes_128_gcm_sha256,
&s2n_ecdhe_rsa_with_aes_128_gcm_sha256,
&s2n_ecdhe_ecdsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_rsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_ecdsa_with_aes_128_cbc_sha,
&s2n_ecdhe_rsa_with_aes_128_cbc_sha,
&s2n_ecdhe_ecdsa_with_aes_128_cbc_sha256,
&s2n_ecdhe_rsa_with_aes_128_cbc_sha256,
&s2n_ecdhe_ecdsa_with_aes_256_cbc_sha,
&s2n_ecdhe_rsa_with_aes_256_cbc_sha,
&s2n_ecdhe_ecdsa_with_aes_256_cbc_sha384,
&s2n_ecdhe_rsa_with_aes_256_cbc_sha384,
&s2n_rsa_with_aes_128_gcm_sha256,
&s2n_rsa_with_aes_256_gcm_sha384,
&s2n_rsa_with_aes_128_cbc_sha,
&s2n_rsa_with_aes_128_cbc_sha256,
&s2n_rsa_with_aes_256_cbc_sha,
&s2n_rsa_with_aes_256_cbc_sha256,
&s2n_rsa_with_3des_ede_cbc_sha,
&s2n_dhe_rsa_with_aes_128_gcm_sha256,
&s2n_dhe_rsa_with_aes_256_gcm_sha384,
&s2n_dhe_rsa_with_aes_128_cbc_sha,
&s2n_dhe_rsa_with_aes_128_cbc_sha256,
&s2n_dhe_rsa_with_aes_256_cbc_sha,
&s2n_dhe_rsa_with_aes_256_cbc_sha256,
};
const struct s2n_cipher_preferences cipher_preferences_20190214_gcm = {
.count = s2n_array_len(cipher_suites_20190214_gcm),
.suites = cipher_suites_20190214_gcm,
};
struct s2n_cipher_suite *cipher_suites_null[] = {
&s2n_null_cipher_suite
};
const struct s2n_cipher_preferences cipher_preferences_null = {
.count = s2n_array_len(cipher_suites_null),
.suites = cipher_suites_null,
};
/* Preferences optimized for interop. DHE and 3DES are added(at the lowest preference). */
struct s2n_cipher_suite *cipher_suites_20170328[] = {
&s2n_ecdhe_rsa_with_aes_128_cbc_sha,
&s2n_ecdhe_rsa_with_aes_128_gcm_sha256,
&s2n_ecdhe_rsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_rsa_with_aes_128_cbc_sha256,
&s2n_ecdhe_rsa_with_aes_256_cbc_sha,
&s2n_ecdhe_rsa_with_aes_256_cbc_sha384,
&s2n_rsa_with_aes_128_cbc_sha,
&s2n_rsa_with_aes_128_gcm_sha256,
&s2n_rsa_with_aes_256_gcm_sha384,
&s2n_rsa_with_aes_128_cbc_sha256,
&s2n_rsa_with_aes_256_cbc_sha,
&s2n_rsa_with_aes_256_cbc_sha256,
&s2n_rsa_with_3des_ede_cbc_sha,
&s2n_dhe_rsa_with_aes_128_cbc_sha,
&s2n_dhe_rsa_with_aes_128_gcm_sha256,
&s2n_dhe_rsa_with_aes_256_gcm_sha384,
&s2n_dhe_rsa_with_aes_128_cbc_sha256,
&s2n_dhe_rsa_with_aes_256_cbc_sha,
&s2n_dhe_rsa_with_aes_256_cbc_sha256,
};
const struct s2n_cipher_preferences cipher_preferences_20170328 = {
.count = s2n_array_len(cipher_suites_20170328),
.suites = cipher_suites_20170328,
};
/* Equivalent to cipher_suites_20170328 with aes-gcm prioritized above aes-cbc */
struct s2n_cipher_suite *cipher_suites_20170328_gcm[] = {
&s2n_ecdhe_rsa_with_aes_128_gcm_sha256,
&s2n_ecdhe_rsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_rsa_with_aes_128_cbc_sha,
&s2n_ecdhe_rsa_with_aes_128_cbc_sha256,
&s2n_ecdhe_rsa_with_aes_256_cbc_sha,
&s2n_ecdhe_rsa_with_aes_256_cbc_sha384,
&s2n_rsa_with_aes_128_gcm_sha256,
&s2n_rsa_with_aes_256_gcm_sha384,
&s2n_rsa_with_aes_128_cbc_sha,
&s2n_rsa_with_aes_128_cbc_sha256,
&s2n_rsa_with_aes_256_cbc_sha,
&s2n_rsa_with_aes_256_cbc_sha256,
&s2n_rsa_with_3des_ede_cbc_sha,
&s2n_dhe_rsa_with_aes_128_gcm_sha256,
&s2n_dhe_rsa_with_aes_256_gcm_sha384,
&s2n_dhe_rsa_with_aes_128_cbc_sha,
&s2n_dhe_rsa_with_aes_128_cbc_sha256,
&s2n_dhe_rsa_with_aes_256_cbc_sha,
&s2n_dhe_rsa_with_aes_256_cbc_sha256,
};
const struct s2n_cipher_preferences cipher_preferences_20170328_gcm = {
.count = s2n_array_len(cipher_suites_20170328_gcm),
.suites = cipher_suites_20170328_gcm,
};
/* Preferences optimized for FIPS compatibility. */
struct s2n_cipher_suite *cipher_suites_20170405[] = {
&s2n_ecdhe_rsa_with_aes_128_cbc_sha256,
&s2n_ecdhe_rsa_with_aes_256_cbc_sha384,
&s2n_ecdhe_rsa_with_aes_128_gcm_sha256,
&s2n_ecdhe_rsa_with_aes_256_gcm_sha384,
&s2n_rsa_with_aes_128_cbc_sha,
&s2n_rsa_with_aes_128_gcm_sha256,
&s2n_rsa_with_aes_256_gcm_sha384,
&s2n_rsa_with_aes_128_cbc_sha256,
&s2n_rsa_with_aes_256_cbc_sha,
&s2n_rsa_with_aes_256_cbc_sha256,
&s2n_rsa_with_3des_ede_cbc_sha,
};
const struct s2n_cipher_preferences cipher_preferences_20170405 = {
.count = s2n_array_len(cipher_suites_20170405),
.suites = cipher_suites_20170405,
};
/* Preferences optimized for FIPS compatibility with GCM prioritized */
struct s2n_cipher_suite *cipher_suites_20170405_gcm[] = {
&s2n_ecdhe_rsa_with_aes_128_gcm_sha256,
&s2n_ecdhe_rsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_rsa_with_aes_128_cbc_sha256,
&s2n_ecdhe_rsa_with_aes_256_cbc_sha384,
&s2n_rsa_with_aes_128_gcm_sha256,
&s2n_rsa_with_aes_256_gcm_sha384,
&s2n_rsa_with_aes_128_cbc_sha,
&s2n_rsa_with_aes_128_cbc_sha256,
&s2n_rsa_with_aes_256_cbc_sha,
&s2n_rsa_with_aes_256_cbc_sha256,
&s2n_rsa_with_3des_ede_cbc_sha,
};
const struct s2n_cipher_preferences cipher_preferences_20170405_gcm = {
.count = s2n_array_len(cipher_suites_20170405_gcm),
.suites = cipher_suites_20170405_gcm,
};
/* Equivalent to cipher_suite_20160411 with 3DES removed.
* Make a CBC cipher #1 to avoid negotiating GCM with buggy Java clients. */
struct s2n_cipher_suite *cipher_suites_20170718[] = {
&s2n_ecdhe_rsa_with_aes_128_cbc_sha,
&s2n_ecdhe_rsa_with_aes_128_gcm_sha256,
&s2n_ecdhe_rsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_rsa_with_aes_128_cbc_sha256,
&s2n_ecdhe_rsa_with_aes_256_cbc_sha,
&s2n_ecdhe_rsa_with_aes_256_cbc_sha384,
&s2n_rsa_with_aes_128_cbc_sha,
&s2n_rsa_with_aes_128_gcm_sha256,
&s2n_rsa_with_aes_256_gcm_sha384,
&s2n_rsa_with_aes_128_cbc_sha256,
&s2n_rsa_with_aes_256_cbc_sha,
&s2n_rsa_with_aes_256_cbc_sha256,
};
const struct s2n_cipher_preferences cipher_preferences_20170718 = {
.count = s2n_array_len(cipher_suites_20170718),
.suites = cipher_suites_20170718,
};
/* Equivalent to cipher_suites_20170718 with aes-gcm prioritized above aes-cbc */
struct s2n_cipher_suite *cipher_suites_20170718_gcm[] = {
&s2n_ecdhe_rsa_with_aes_128_gcm_sha256,
&s2n_ecdhe_rsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_rsa_with_aes_128_cbc_sha,
&s2n_ecdhe_rsa_with_aes_128_cbc_sha256,
&s2n_ecdhe_rsa_with_aes_256_cbc_sha,
&s2n_ecdhe_rsa_with_aes_256_cbc_sha384,
&s2n_rsa_with_aes_128_gcm_sha256,
&s2n_rsa_with_aes_256_gcm_sha384,
&s2n_rsa_with_aes_128_cbc_sha,
&s2n_rsa_with_aes_128_cbc_sha256,
&s2n_rsa_with_aes_256_cbc_sha,
&s2n_rsa_with_aes_256_cbc_sha256,
};
const struct s2n_cipher_preferences cipher_preferences_20170718_gcm = {
.count = s2n_array_len(cipher_suites_20170718_gcm),
.suites = cipher_suites_20170718_gcm,
};
struct s2n_cipher_suite *cipher_suites_elb_security_policy_2015_04[] = {
&s2n_ecdhe_ecdsa_with_aes_128_gcm_sha256,
&s2n_ecdhe_rsa_with_aes_128_gcm_sha256,
&s2n_ecdhe_ecdsa_with_aes_128_cbc_sha256,
&s2n_ecdhe_rsa_with_aes_128_cbc_sha256,
&s2n_ecdhe_ecdsa_with_aes_128_cbc_sha,
&s2n_ecdhe_rsa_with_aes_128_cbc_sha,
&s2n_ecdhe_ecdsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_rsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_ecdsa_with_aes_256_cbc_sha384,
&s2n_ecdhe_rsa_with_aes_256_cbc_sha384,
&s2n_ecdhe_rsa_with_aes_256_cbc_sha,
&s2n_ecdhe_ecdsa_with_aes_256_cbc_sha,
&s2n_rsa_with_aes_128_gcm_sha256,
&s2n_rsa_with_aes_128_cbc_sha256,
&s2n_rsa_with_aes_128_cbc_sha,
&s2n_rsa_with_aes_256_gcm_sha384,
&s2n_rsa_with_aes_256_cbc_sha256,
&s2n_rsa_with_aes_256_cbc_sha,
&s2n_rsa_with_3des_ede_cbc_sha,
};
const struct s2n_cipher_preferences elb_security_policy_2015_04 = {
.count = s2n_array_len(cipher_suites_elb_security_policy_2015_04),
.suites = cipher_suites_elb_security_policy_2015_04,
};
struct s2n_cipher_suite *cipher_suites_elb_security_policy_2016_08[] = {
&s2n_ecdhe_ecdsa_with_aes_128_gcm_sha256,
&s2n_ecdhe_rsa_with_aes_128_gcm_sha256,
&s2n_ecdhe_ecdsa_with_aes_128_cbc_sha256,
&s2n_ecdhe_rsa_with_aes_128_cbc_sha256,
&s2n_ecdhe_ecdsa_with_aes_128_cbc_sha,
&s2n_ecdhe_rsa_with_aes_128_cbc_sha,
&s2n_ecdhe_ecdsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_rsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_ecdsa_with_aes_256_cbc_sha384,
&s2n_ecdhe_rsa_with_aes_256_cbc_sha384,
&s2n_ecdhe_rsa_with_aes_256_cbc_sha,
&s2n_ecdhe_ecdsa_with_aes_256_cbc_sha,
&s2n_rsa_with_aes_128_gcm_sha256,
&s2n_rsa_with_aes_128_cbc_sha256,
&s2n_rsa_with_aes_128_cbc_sha,
&s2n_rsa_with_aes_256_gcm_sha384,
&s2n_rsa_with_aes_256_cbc_sha256,
&s2n_rsa_with_aes_256_cbc_sha,
};
const struct s2n_cipher_preferences elb_security_policy_2016_08 = {
.count = s2n_array_len(cipher_suites_elb_security_policy_2016_08),
.suites = cipher_suites_elb_security_policy_2016_08,
};
struct s2n_cipher_suite *cipher_suites_elb_security_policy_tls_1_2_2017_01[] = {
&s2n_ecdhe_ecdsa_with_aes_128_gcm_sha256,
&s2n_ecdhe_rsa_with_aes_128_gcm_sha256,
&s2n_ecdhe_ecdsa_with_aes_128_cbc_sha256,
&s2n_ecdhe_rsa_with_aes_128_cbc_sha256,
&s2n_ecdhe_ecdsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_rsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_ecdsa_with_aes_256_cbc_sha384,
&s2n_ecdhe_rsa_with_aes_256_cbc_sha384,
&s2n_rsa_with_aes_128_gcm_sha256,
&s2n_rsa_with_aes_128_cbc_sha256,
&s2n_rsa_with_aes_256_gcm_sha384,
&s2n_rsa_with_aes_256_cbc_sha256,
};
const struct s2n_cipher_preferences elb_security_policy_tls_1_2_2017_01 = {
.count = s2n_array_len(cipher_suites_elb_security_policy_tls_1_2_2017_01),
.suites = cipher_suites_elb_security_policy_tls_1_2_2017_01,
};
struct s2n_cipher_suite *cipher_suites_elb_security_policy_tls_1_1_2017_01[] = {
&s2n_ecdhe_ecdsa_with_aes_128_gcm_sha256,
&s2n_ecdhe_rsa_with_aes_128_gcm_sha256,
&s2n_ecdhe_ecdsa_with_aes_128_cbc_sha256,
&s2n_ecdhe_rsa_with_aes_128_cbc_sha256,
&s2n_ecdhe_ecdsa_with_aes_128_cbc_sha,
&s2n_ecdhe_rsa_with_aes_128_cbc_sha,
&s2n_ecdhe_ecdsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_rsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_ecdsa_with_aes_256_cbc_sha384,
&s2n_ecdhe_rsa_with_aes_256_cbc_sha384,
&s2n_ecdhe_rsa_with_aes_256_cbc_sha,
&s2n_ecdhe_ecdsa_with_aes_256_cbc_sha,
&s2n_rsa_with_aes_128_gcm_sha256,
&s2n_rsa_with_aes_128_cbc_sha256,
&s2n_rsa_with_aes_128_cbc_sha,
&s2n_rsa_with_aes_256_gcm_sha384,
&s2n_rsa_with_aes_256_cbc_sha256,
&s2n_rsa_with_aes_256_cbc_sha,
};
const struct s2n_cipher_preferences elb_security_policy_tls_1_1_2017_01 = {
.count = s2n_array_len(cipher_suites_elb_security_policy_tls_1_1_2017_01),
.suites = cipher_suites_elb_security_policy_tls_1_1_2017_01,
};
struct s2n_cipher_suite *cipher_suites_elb_security_policy_tls_1_2_ext_2018_06[] = {
&s2n_ecdhe_ecdsa_with_aes_128_gcm_sha256,
&s2n_ecdhe_rsa_with_aes_128_gcm_sha256,
&s2n_ecdhe_ecdsa_with_aes_128_cbc_sha256,
&s2n_ecdhe_rsa_with_aes_128_cbc_sha256,
&s2n_ecdhe_ecdsa_with_aes_128_cbc_sha,
&s2n_ecdhe_rsa_with_aes_128_cbc_sha,
&s2n_ecdhe_ecdsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_rsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_ecdsa_with_aes_256_cbc_sha384,
&s2n_ecdhe_rsa_with_aes_256_cbc_sha384,
&s2n_ecdhe_rsa_with_aes_256_cbc_sha,
&s2n_ecdhe_ecdsa_with_aes_256_cbc_sha,
&s2n_rsa_with_aes_128_gcm_sha256,
&s2n_rsa_with_aes_128_cbc_sha256,
&s2n_rsa_with_aes_128_cbc_sha,
&s2n_rsa_with_aes_256_gcm_sha384,
&s2n_rsa_with_aes_256_cbc_sha256,
&s2n_rsa_with_aes_256_cbc_sha,
};
const struct s2n_cipher_preferences elb_security_policy_tls_1_2_ext_2018_06 = {
.count = s2n_array_len(cipher_suites_elb_security_policy_tls_1_2_ext_2018_06),
.suites = cipher_suites_elb_security_policy_tls_1_2_ext_2018_06,
};
struct s2n_cipher_suite *cipher_suites_elb_security_policy_fs_2018_06[] = {
&s2n_ecdhe_ecdsa_with_aes_128_gcm_sha256,
&s2n_ecdhe_rsa_with_aes_128_gcm_sha256,
&s2n_ecdhe_ecdsa_with_aes_128_cbc_sha256,
&s2n_ecdhe_rsa_with_aes_128_cbc_sha256,
&s2n_ecdhe_ecdsa_with_aes_128_cbc_sha,
&s2n_ecdhe_rsa_with_aes_128_cbc_sha,
&s2n_ecdhe_ecdsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_rsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_ecdsa_with_aes_256_cbc_sha384,
&s2n_ecdhe_rsa_with_aes_256_cbc_sha384,
&s2n_ecdhe_rsa_with_aes_256_cbc_sha,
&s2n_ecdhe_ecdsa_with_aes_256_cbc_sha,
};
const struct s2n_cipher_preferences elb_security_policy_fs_2018_06 = {
.count = s2n_array_len(cipher_suites_elb_security_policy_fs_2018_06),
.suites = cipher_suites_elb_security_policy_fs_2018_06,
};
struct s2n_cipher_suite *cipher_suites_elb_security_policy_fs_1_2_2019_08[] = {
&s2n_ecdhe_ecdsa_with_aes_128_gcm_sha256,
&s2n_ecdhe_rsa_with_aes_128_gcm_sha256,
&s2n_ecdhe_ecdsa_with_aes_128_cbc_sha256,
&s2n_ecdhe_rsa_with_aes_128_cbc_sha256,
&s2n_ecdhe_ecdsa_with_aes_128_cbc_sha,
&s2n_ecdhe_rsa_with_aes_128_cbc_sha,
&s2n_ecdhe_ecdsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_rsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_ecdsa_with_aes_256_cbc_sha384,
&s2n_ecdhe_rsa_with_aes_256_cbc_sha384,
&s2n_ecdhe_rsa_with_aes_256_cbc_sha,
&s2n_ecdhe_ecdsa_with_aes_256_cbc_sha,
};
const struct s2n_cipher_preferences elb_security_policy_fs_1_2_2019_08 = {
.count = s2n_array_len(cipher_suites_elb_security_policy_fs_1_2_2019_08),
.suites = cipher_suites_elb_security_policy_fs_1_2_2019_08,
};
struct s2n_cipher_suite *cipher_suites_elb_security_policy_fs_1_1_2019_08[] = {
&s2n_ecdhe_ecdsa_with_aes_128_gcm_sha256,
&s2n_ecdhe_rsa_with_aes_128_gcm_sha256,
&s2n_ecdhe_ecdsa_with_aes_128_cbc_sha256,
&s2n_ecdhe_rsa_with_aes_128_cbc_sha256,
&s2n_ecdhe_ecdsa_with_aes_128_cbc_sha,
&s2n_ecdhe_rsa_with_aes_128_cbc_sha,
&s2n_ecdhe_ecdsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_rsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_ecdsa_with_aes_256_cbc_sha384,
&s2n_ecdhe_rsa_with_aes_256_cbc_sha384,
&s2n_ecdhe_rsa_with_aes_256_cbc_sha,
&s2n_ecdhe_ecdsa_with_aes_256_cbc_sha,
};
const struct s2n_cipher_preferences elb_security_policy_fs_1_1_2019_08 = {
.count = s2n_array_len(cipher_suites_elb_security_policy_fs_1_1_2019_08),
.suites = cipher_suites_elb_security_policy_fs_1_1_2019_08,
};
struct s2n_cipher_suite *cipher_suites_elb_security_policy_fs_1_2_Res_2019_08[] = {
&s2n_ecdhe_ecdsa_with_aes_128_gcm_sha256,
&s2n_ecdhe_rsa_with_aes_128_gcm_sha256,
&s2n_ecdhe_ecdsa_with_aes_128_cbc_sha256,
&s2n_ecdhe_rsa_with_aes_128_cbc_sha256,
&s2n_ecdhe_ecdsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_rsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_ecdsa_with_aes_256_cbc_sha384,
&s2n_ecdhe_rsa_with_aes_256_cbc_sha384,
};
const struct s2n_cipher_preferences elb_security_policy_fs_1_2_Res_2019_08 = {
.count = s2n_array_len(cipher_suites_elb_security_policy_fs_1_2_Res_2019_08),
.suites = cipher_suites_elb_security_policy_fs_1_2_Res_2019_08,
};
struct s2n_cipher_suite *cipher_suites_cloudfront_upstream[] = {
&s2n_ecdhe_ecdsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_rsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_ecdsa_with_aes_128_gcm_sha256,
&s2n_ecdhe_rsa_with_aes_128_gcm_sha256,
&s2n_ecdhe_ecdsa_with_aes_256_cbc_sha384,
&s2n_ecdhe_rsa_with_aes_256_cbc_sha384,
&s2n_ecdhe_ecdsa_with_aes_256_cbc_sha,
&s2n_ecdhe_rsa_with_aes_256_cbc_sha,
&s2n_ecdhe_ecdsa_with_aes_128_cbc_sha256,
&s2n_ecdhe_rsa_with_aes_128_cbc_sha256,
&s2n_ecdhe_ecdsa_with_aes_128_cbc_sha,
&s2n_ecdhe_rsa_with_aes_128_cbc_sha,
&s2n_rsa_with_aes_256_gcm_sha384,
&s2n_rsa_with_aes_128_gcm_sha256,
&s2n_rsa_with_aes_256_cbc_sha,
&s2n_rsa_with_aes_128_cbc_sha256,
&s2n_rsa_with_aes_128_cbc_sha,
&s2n_rsa_with_3des_ede_cbc_sha,
&s2n_rsa_with_rc4_128_md5
};
const struct s2n_cipher_preferences cipher_preferences_cloudfront_upstream = {
.count = s2n_array_len(cipher_suites_cloudfront_upstream),
.suites = cipher_suites_cloudfront_upstream,
};
/* CloudFront viewer facing (with TLS 1.3) */
struct s2n_cipher_suite *cipher_suites_cloudfront_ssl_v_3[] = {
S2N_TLS13_CLOUDFRONT_CIPHER_SUITES_20200716,
&s2n_ecdhe_rsa_with_aes_128_gcm_sha256,
&s2n_ecdhe_rsa_with_aes_128_cbc_sha256,
&s2n_ecdhe_rsa_with_aes_128_cbc_sha,
&s2n_ecdhe_rsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_rsa_with_chacha20_poly1305_sha256,
&s2n_ecdhe_rsa_with_aes_256_cbc_sha384,
&s2n_ecdhe_rsa_with_aes_256_cbc_sha,
&s2n_rsa_with_aes_128_gcm_sha256,
&s2n_rsa_with_aes_256_gcm_sha384,
&s2n_rsa_with_aes_128_cbc_sha256,
&s2n_rsa_with_aes_256_cbc_sha,
&s2n_rsa_with_aes_128_cbc_sha,
&s2n_rsa_with_3des_ede_cbc_sha,
&s2n_rsa_with_rc4_128_md5
};
const struct s2n_cipher_preferences cipher_preferences_cloudfront_ssl_v_3 = {
.count = s2n_array_len(cipher_suites_cloudfront_ssl_v_3),
.suites = cipher_suites_cloudfront_ssl_v_3,
};
struct s2n_cipher_suite *cipher_suites_cloudfront_tls_1_0_2014[] = {
S2N_TLS13_CLOUDFRONT_CIPHER_SUITES_20200716,
&s2n_ecdhe_ecdsa_with_aes_128_gcm_sha256,
&s2n_ecdhe_rsa_with_aes_128_gcm_sha256,
&s2n_ecdhe_ecdsa_with_aes_128_cbc_sha256,
&s2n_ecdhe_rsa_with_aes_128_cbc_sha256,
&s2n_ecdhe_ecdsa_with_aes_128_cbc_sha,
&s2n_ecdhe_rsa_with_aes_128_cbc_sha,
&s2n_ecdhe_ecdsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_rsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_ecdsa_with_chacha20_poly1305_sha256,
&s2n_ecdhe_rsa_with_chacha20_poly1305_sha256,
&s2n_ecdhe_ecdsa_with_aes_256_cbc_sha384,
&s2n_ecdhe_rsa_with_aes_256_cbc_sha384,
&s2n_ecdhe_ecdsa_with_aes_256_cbc_sha,
&s2n_ecdhe_rsa_with_aes_256_cbc_sha,
&s2n_rsa_with_aes_128_gcm_sha256,
&s2n_rsa_with_aes_256_gcm_sha384,
&s2n_rsa_with_aes_128_cbc_sha256,
&s2n_rsa_with_aes_256_cbc_sha,
&s2n_rsa_with_aes_128_cbc_sha,
&s2n_rsa_with_3des_ede_cbc_sha,
};
const struct s2n_cipher_preferences cipher_preferences_cloudfront_tls_1_0_2014 = {
.count = s2n_array_len(cipher_suites_cloudfront_tls_1_0_2014),
.suites = cipher_suites_cloudfront_tls_1_0_2014,
};
struct s2n_cipher_suite *cipher_suites_cloudfront_tls_1_0_2016[] = {
S2N_TLS13_CLOUDFRONT_CIPHER_SUITES_20200716,
&s2n_ecdhe_ecdsa_with_aes_128_gcm_sha256,
&s2n_ecdhe_rsa_with_aes_128_gcm_sha256,
&s2n_ecdhe_ecdsa_with_aes_128_cbc_sha256,
&s2n_ecdhe_rsa_with_aes_128_cbc_sha256,
&s2n_ecdhe_ecdsa_with_aes_128_cbc_sha,
&s2n_ecdhe_rsa_with_aes_128_cbc_sha,
&s2n_ecdhe_ecdsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_rsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_ecdsa_with_chacha20_poly1305_sha256,
&s2n_ecdhe_rsa_with_chacha20_poly1305_sha256,
&s2n_ecdhe_ecdsa_with_aes_256_cbc_sha384,
&s2n_ecdhe_rsa_with_aes_256_cbc_sha384,
&s2n_ecdhe_ecdsa_with_aes_256_cbc_sha,
&s2n_ecdhe_rsa_with_aes_256_cbc_sha,
&s2n_rsa_with_aes_128_gcm_sha256,
&s2n_rsa_with_aes_256_gcm_sha384,
&s2n_rsa_with_aes_128_cbc_sha256,
&s2n_rsa_with_aes_256_cbc_sha,
&s2n_rsa_with_aes_128_cbc_sha
};
const struct s2n_cipher_preferences cipher_preferences_cloudfront_tls_1_0_2016 = {
.count = s2n_array_len(cipher_suites_cloudfront_tls_1_0_2016),
.suites = cipher_suites_cloudfront_tls_1_0_2016,
};
struct s2n_cipher_suite *cipher_suites_cloudfront_tls_1_1_2016[] = {
S2N_TLS13_CLOUDFRONT_CIPHER_SUITES_20200716,
&s2n_ecdhe_ecdsa_with_aes_128_gcm_sha256,
&s2n_ecdhe_rsa_with_aes_128_gcm_sha256,
&s2n_ecdhe_ecdsa_with_aes_128_cbc_sha256,
&s2n_ecdhe_rsa_with_aes_128_cbc_sha256,
&s2n_ecdhe_ecdsa_with_aes_128_cbc_sha,
&s2n_ecdhe_rsa_with_aes_128_cbc_sha,
&s2n_ecdhe_ecdsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_rsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_ecdsa_with_chacha20_poly1305_sha256,
&s2n_ecdhe_rsa_with_chacha20_poly1305_sha256,
&s2n_ecdhe_ecdsa_with_aes_256_cbc_sha384,
&s2n_ecdhe_rsa_with_aes_256_cbc_sha384,
&s2n_ecdhe_ecdsa_with_aes_256_cbc_sha,
&s2n_ecdhe_rsa_with_aes_256_cbc_sha,
&s2n_rsa_with_aes_128_gcm_sha256,
&s2n_rsa_with_aes_256_gcm_sha384,
&s2n_rsa_with_aes_128_cbc_sha256,
&s2n_rsa_with_aes_256_cbc_sha,
&s2n_rsa_with_aes_128_cbc_sha
};
const struct s2n_cipher_preferences cipher_preferences_cloudfront_tls_1_1_2016 = {
.count = s2n_array_len(cipher_suites_cloudfront_tls_1_1_2016),
.suites = cipher_suites_cloudfront_tls_1_1_2016,
};
struct s2n_cipher_suite *cipher_suites_cloudfront_tls_1_2_2018[] = {
S2N_TLS13_CLOUDFRONT_CIPHER_SUITES_20200716,
&s2n_ecdhe_ecdsa_with_aes_128_gcm_sha256,
&s2n_ecdhe_rsa_with_aes_128_gcm_sha256,
&s2n_ecdhe_ecdsa_with_aes_128_cbc_sha256,
&s2n_ecdhe_rsa_with_aes_128_cbc_sha256,
&s2n_ecdhe_ecdsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_rsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_ecdsa_with_chacha20_poly1305_sha256,
&s2n_ecdhe_rsa_with_chacha20_poly1305_sha256,
&s2n_ecdhe_ecdsa_with_aes_256_cbc_sha384,
&s2n_ecdhe_rsa_with_aes_256_cbc_sha384,
&s2n_rsa_with_aes_128_gcm_sha256,
&s2n_rsa_with_aes_256_gcm_sha384,
&s2n_rsa_with_aes_128_cbc_sha256
};
const struct s2n_cipher_preferences cipher_preferences_cloudfront_tls_1_2_2018 = {
.count = s2n_array_len(cipher_suites_cloudfront_tls_1_2_2018),
.suites = cipher_suites_cloudfront_tls_1_2_2018,
};
/* CloudFront viewer facing legacy TLS 1.2 policies */
struct s2n_cipher_suite *cipher_suites_cloudfront_ssl_v_3_legacy[] = {
&s2n_ecdhe_ecdsa_with_aes_128_gcm_sha256,
&s2n_ecdhe_rsa_with_aes_128_gcm_sha256,
&s2n_ecdhe_ecdsa_with_aes_128_cbc_sha256,
&s2n_ecdhe_rsa_with_aes_128_cbc_sha256,
&s2n_ecdhe_ecdsa_with_aes_128_cbc_sha,
&s2n_ecdhe_rsa_with_aes_128_cbc_sha,
&s2n_ecdhe_ecdsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_rsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_ecdsa_with_aes_256_cbc_sha384,
&s2n_ecdhe_rsa_with_aes_256_cbc_sha384,
&s2n_ecdhe_ecdsa_with_aes_256_cbc_sha,
&s2n_ecdhe_rsa_with_aes_256_cbc_sha,
&s2n_rsa_with_aes_128_gcm_sha256,
&s2n_rsa_with_aes_256_gcm_sha384,
&s2n_rsa_with_aes_128_cbc_sha256,
&s2n_rsa_with_aes_256_cbc_sha,
&s2n_rsa_with_aes_128_cbc_sha,
&s2n_rsa_with_3des_ede_cbc_sha,
&s2n_rsa_with_rc4_128_md5
};
const struct s2n_cipher_preferences cipher_preferences_cloudfront_ssl_v_3_legacy = {
.count = s2n_array_len(cipher_suites_cloudfront_ssl_v_3_legacy),
.suites = cipher_suites_cloudfront_ssl_v_3_legacy,
};
struct s2n_cipher_suite *cipher_suites_cloudfront_tls_1_0_2014_legacy[] = {
&s2n_ecdhe_ecdsa_with_aes_128_gcm_sha256,
&s2n_ecdhe_rsa_with_aes_128_gcm_sha256,
&s2n_ecdhe_ecdsa_with_aes_128_cbc_sha256,
&s2n_ecdhe_rsa_with_aes_128_cbc_sha256,
&s2n_ecdhe_ecdsa_with_aes_128_cbc_sha,
&s2n_ecdhe_rsa_with_aes_128_cbc_sha,
&s2n_ecdhe_ecdsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_rsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_ecdsa_with_aes_256_cbc_sha384,
&s2n_ecdhe_rsa_with_aes_256_cbc_sha384,
&s2n_ecdhe_ecdsa_with_aes_256_cbc_sha,
&s2n_ecdhe_rsa_with_aes_256_cbc_sha,
&s2n_rsa_with_aes_128_gcm_sha256,
&s2n_rsa_with_aes_256_gcm_sha384,
&s2n_rsa_with_aes_128_cbc_sha256,
&s2n_rsa_with_aes_256_cbc_sha,
&s2n_rsa_with_aes_128_cbc_sha,
&s2n_rsa_with_3des_ede_cbc_sha,
};
const struct s2n_cipher_preferences cipher_preferences_cloudfront_tls_1_0_2014_legacy = {
.count = s2n_array_len(cipher_suites_cloudfront_tls_1_0_2014_legacy),
.suites = cipher_suites_cloudfront_tls_1_0_2014_legacy,
};
struct s2n_cipher_suite *cipher_suites_cloudfront_tls_1_0_2016_legacy[] = {
&s2n_ecdhe_ecdsa_with_aes_128_gcm_sha256,
&s2n_ecdhe_rsa_with_aes_128_gcm_sha256,
&s2n_ecdhe_ecdsa_with_aes_128_cbc_sha256,
&s2n_ecdhe_rsa_with_aes_128_cbc_sha256,
&s2n_ecdhe_ecdsa_with_aes_128_cbc_sha,
&s2n_ecdhe_rsa_with_aes_128_cbc_sha,
&s2n_ecdhe_ecdsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_rsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_ecdsa_with_aes_256_cbc_sha384,
&s2n_ecdhe_rsa_with_aes_256_cbc_sha384,
&s2n_ecdhe_ecdsa_with_aes_256_cbc_sha,
&s2n_ecdhe_rsa_with_aes_256_cbc_sha,
&s2n_rsa_with_aes_128_gcm_sha256,
&s2n_rsa_with_aes_256_gcm_sha384,
&s2n_rsa_with_aes_128_cbc_sha256,
&s2n_rsa_with_aes_256_cbc_sha,
&s2n_rsa_with_aes_128_cbc_sha
};
const struct s2n_cipher_preferences cipher_preferences_cloudfront_tls_1_0_2016_legacy = {
.count = s2n_array_len(cipher_suites_cloudfront_tls_1_0_2016_legacy),
.suites = cipher_suites_cloudfront_tls_1_0_2016_legacy,
};
struct s2n_cipher_suite *cipher_suites_cloudfront_tls_1_1_2016_legacy[] = {
&s2n_ecdhe_ecdsa_with_aes_128_gcm_sha256,
&s2n_ecdhe_rsa_with_aes_128_gcm_sha256,
&s2n_ecdhe_ecdsa_with_aes_128_cbc_sha256,
&s2n_ecdhe_rsa_with_aes_128_cbc_sha256,
&s2n_ecdhe_ecdsa_with_aes_128_cbc_sha,
&s2n_ecdhe_rsa_with_aes_128_cbc_sha,
&s2n_ecdhe_ecdsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_rsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_ecdsa_with_aes_256_cbc_sha384,
&s2n_ecdhe_rsa_with_aes_256_cbc_sha384,
&s2n_ecdhe_ecdsa_with_aes_256_cbc_sha,
&s2n_ecdhe_rsa_with_aes_256_cbc_sha,
&s2n_rsa_with_aes_128_gcm_sha256,
&s2n_rsa_with_aes_256_gcm_sha384,
&s2n_rsa_with_aes_128_cbc_sha256,
&s2n_rsa_with_aes_256_cbc_sha,
&s2n_rsa_with_aes_128_cbc_sha
};
const struct s2n_cipher_preferences cipher_preferences_cloudfront_tls_1_1_2016_legacy = {
.count = s2n_array_len(cipher_suites_cloudfront_tls_1_1_2016_legacy),
.suites = cipher_suites_cloudfront_tls_1_1_2016_legacy,
};
struct s2n_cipher_suite *cipher_suites_cloudfront_tls_1_2_2018_legacy[] = {
&s2n_ecdhe_ecdsa_with_aes_128_gcm_sha256,
&s2n_ecdhe_rsa_with_aes_128_gcm_sha256,
&s2n_ecdhe_ecdsa_with_aes_128_cbc_sha256,
&s2n_ecdhe_rsa_with_aes_128_cbc_sha256,
&s2n_ecdhe_ecdsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_rsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_ecdsa_with_aes_256_cbc_sha384,
&s2n_ecdhe_rsa_with_aes_256_cbc_sha384,
&s2n_rsa_with_aes_128_gcm_sha256,
&s2n_rsa_with_aes_256_gcm_sha384,
&s2n_rsa_with_aes_128_cbc_sha256
};
const struct s2n_cipher_preferences cipher_preferences_cloudfront_tls_1_2_2018_legacy = {
.count = s2n_array_len(cipher_suites_cloudfront_tls_1_2_2018_legacy),
.suites = cipher_suites_cloudfront_tls_1_2_2018_legacy,
};
struct s2n_cipher_suite *cipher_suites_cloudfront_tls_1_2_2019_legacy[] = {
&s2n_ecdhe_ecdsa_with_aes_128_gcm_sha256,
&s2n_ecdhe_rsa_with_aes_128_gcm_sha256,
&s2n_ecdhe_ecdsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_rsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_ecdsa_with_aes_256_cbc_sha384,
&s2n_ecdhe_rsa_with_aes_256_cbc_sha384,
&s2n_ecdhe_ecdsa_with_aes_128_cbc_sha256,
&s2n_ecdhe_rsa_with_aes_128_cbc_sha256
};
const struct s2n_cipher_preferences cipher_preferences_cloudfront_tls_1_2_2019_legacy = {
.count = s2n_array_len(cipher_suites_cloudfront_tls_1_2_2019_legacy),
.suites = cipher_suites_cloudfront_tls_1_2_2019_legacy,
};
/* CloudFront upstream */
struct s2n_cipher_suite *cipher_suites_cloudfront_upstream_tls10[] = {
&s2n_ecdhe_ecdsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_rsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_ecdsa_with_aes_128_gcm_sha256,
&s2n_ecdhe_rsa_with_aes_128_gcm_sha256,
&s2n_ecdhe_ecdsa_with_aes_256_cbc_sha384,
&s2n_ecdhe_rsa_with_aes_256_cbc_sha384,
&s2n_ecdhe_ecdsa_with_aes_256_cbc_sha,
&s2n_ecdhe_rsa_with_aes_256_cbc_sha,
&s2n_ecdhe_ecdsa_with_aes_128_cbc_sha256,
&s2n_ecdhe_rsa_with_aes_128_cbc_sha256,
&s2n_ecdhe_ecdsa_with_aes_128_cbc_sha,
&s2n_ecdhe_rsa_with_aes_128_cbc_sha,
&s2n_rsa_with_aes_256_gcm_sha384,
&s2n_rsa_with_aes_128_gcm_sha256,
&s2n_rsa_with_aes_256_cbc_sha,
&s2n_rsa_with_aes_128_cbc_sha256,
&s2n_rsa_with_aes_128_cbc_sha,
&s2n_rsa_with_3des_ede_cbc_sha,
&s2n_rsa_with_rc4_128_md5
};
const struct s2n_cipher_preferences cipher_preferences_cloudfront_upstream_tls10 = {
.count = s2n_array_len(cipher_suites_cloudfront_upstream_tls10),
.suites = cipher_suites_cloudfront_upstream_tls10,
};
struct s2n_cipher_suite *cipher_suites_cloudfront_upstream_tls11[] = {
&s2n_ecdhe_ecdsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_rsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_ecdsa_with_aes_128_gcm_sha256,
&s2n_ecdhe_rsa_with_aes_128_gcm_sha256,
&s2n_ecdhe_ecdsa_with_aes_256_cbc_sha384,
&s2n_ecdhe_rsa_with_aes_256_cbc_sha384,
&s2n_ecdhe_ecdsa_with_aes_256_cbc_sha,
&s2n_ecdhe_rsa_with_aes_256_cbc_sha,
&s2n_ecdhe_ecdsa_with_aes_128_cbc_sha256,
&s2n_ecdhe_rsa_with_aes_128_cbc_sha256,
&s2n_ecdhe_ecdsa_with_aes_128_cbc_sha,
&s2n_ecdhe_rsa_with_aes_128_cbc_sha,
&s2n_rsa_with_aes_256_gcm_sha384,
&s2n_rsa_with_aes_128_gcm_sha256,
&s2n_rsa_with_aes_256_cbc_sha,
&s2n_rsa_with_aes_128_cbc_sha256,
&s2n_rsa_with_aes_128_cbc_sha,
&s2n_rsa_with_3des_ede_cbc_sha,
&s2n_rsa_with_rc4_128_md5
};
const struct s2n_cipher_preferences cipher_preferences_cloudfront_upstream_tls11 = {
.count = s2n_array_len(cipher_suites_cloudfront_upstream_tls11),
.suites = cipher_suites_cloudfront_upstream_tls11,
};
struct s2n_cipher_suite *cipher_suites_cloudfront_upstream_tls12[] = {
&s2n_ecdhe_ecdsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_rsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_ecdsa_with_aes_128_gcm_sha256,
&s2n_ecdhe_rsa_with_aes_128_gcm_sha256,
&s2n_ecdhe_ecdsa_with_aes_256_cbc_sha384,
&s2n_ecdhe_rsa_with_aes_256_cbc_sha384,
&s2n_ecdhe_ecdsa_with_aes_256_cbc_sha,
&s2n_ecdhe_rsa_with_aes_256_cbc_sha,
&s2n_ecdhe_ecdsa_with_aes_128_cbc_sha256,
&s2n_ecdhe_rsa_with_aes_128_cbc_sha256,
&s2n_ecdhe_ecdsa_with_aes_128_cbc_sha,
&s2n_ecdhe_rsa_with_aes_128_cbc_sha,
&s2n_rsa_with_aes_256_gcm_sha384,
&s2n_rsa_with_aes_128_gcm_sha256,
&s2n_rsa_with_aes_256_cbc_sha,
&s2n_rsa_with_aes_128_cbc_sha256,
&s2n_rsa_with_aes_128_cbc_sha,
&s2n_rsa_with_3des_ede_cbc_sha,
&s2n_rsa_with_rc4_128_md5
};
const struct s2n_cipher_preferences cipher_preferences_cloudfront_upstream_tls12 = {
.count = s2n_array_len(cipher_suites_cloudfront_upstream_tls12),
.suites = cipher_suites_cloudfront_upstream_tls12,
};
struct s2n_cipher_suite *cipher_suites_cloudfront_tls_1_2_2019[] = {
S2N_TLS13_CLOUDFRONT_CIPHER_SUITES_20200716,
&s2n_ecdhe_ecdsa_with_aes_128_gcm_sha256,
&s2n_ecdhe_rsa_with_aes_128_gcm_sha256,
&s2n_ecdhe_ecdsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_rsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_ecdsa_with_chacha20_poly1305_sha256,
&s2n_ecdhe_rsa_with_chacha20_poly1305_sha256,
&s2n_ecdhe_ecdsa_with_aes_256_cbc_sha384,
&s2n_ecdhe_rsa_with_aes_256_cbc_sha384,
&s2n_ecdhe_ecdsa_with_aes_128_cbc_sha256,
&s2n_ecdhe_rsa_with_aes_128_cbc_sha256
};
const struct s2n_cipher_preferences cipher_preferences_cloudfront_tls_1_2_2019 = {
.count = s2n_array_len(cipher_suites_cloudfront_tls_1_2_2019),
.suites = cipher_suites_cloudfront_tls_1_2_2019,
};
struct s2n_cipher_suite *cipher_suites_cloudfront_tls_1_2_2021[] = {
S2N_TLS13_CLOUDFRONT_CIPHER_SUITES_20200716,
&s2n_ecdhe_ecdsa_with_aes_128_gcm_sha256,
&s2n_ecdhe_rsa_with_aes_128_gcm_sha256,
&s2n_ecdhe_ecdsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_rsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_ecdsa_with_chacha20_poly1305_sha256,
&s2n_ecdhe_rsa_with_chacha20_poly1305_sha256
};
const struct s2n_cipher_preferences cipher_preferences_cloudfront_tls_1_2_2021 = {
.count = s2n_array_len(cipher_suites_cloudfront_tls_1_2_2021),
.suites = cipher_suites_cloudfront_tls_1_2_2021,
};
struct s2n_cipher_suite *cipher_suites_kms_tls_1_0_2018_10[] = {
&s2n_ecdhe_rsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_rsa_with_aes_128_gcm_sha256,
&s2n_ecdhe_rsa_with_aes_256_cbc_sha384,
&s2n_ecdhe_rsa_with_aes_256_cbc_sha,
&s2n_ecdhe_rsa_with_aes_128_cbc_sha256,
&s2n_ecdhe_rsa_with_3des_ede_cbc_sha,
&s2n_dhe_rsa_with_aes_256_cbc_sha256,
&s2n_dhe_rsa_with_aes_128_cbc_sha256,
&s2n_dhe_rsa_with_aes_256_cbc_sha,
&s2n_dhe_rsa_with_aes_128_cbc_sha,
};
const struct s2n_cipher_preferences cipher_preferences_kms_tls_1_0_2018_10 = {
.count = s2n_array_len(cipher_suites_kms_tls_1_0_2018_10),
.suites = cipher_suites_kms_tls_1_0_2018_10,
};
struct s2n_cipher_suite *cipher_suites_kms_pq_tls_1_0_2019_06[] = {
&s2n_ecdhe_bike_rsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_sike_rsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_rsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_rsa_with_aes_128_gcm_sha256,
&s2n_ecdhe_rsa_with_aes_256_cbc_sha384,
&s2n_ecdhe_rsa_with_aes_256_cbc_sha,
&s2n_ecdhe_rsa_with_aes_128_cbc_sha256,
&s2n_ecdhe_rsa_with_3des_ede_cbc_sha,
&s2n_dhe_rsa_with_aes_256_cbc_sha256,
&s2n_dhe_rsa_with_aes_128_cbc_sha256,
&s2n_dhe_rsa_with_aes_256_cbc_sha,
&s2n_dhe_rsa_with_aes_128_cbc_sha,
};
/* Includes only round 1 PQ KEM params */
const struct s2n_cipher_preferences cipher_preferences_kms_pq_tls_1_0_2019_06 = {
.count = s2n_array_len(cipher_suites_kms_pq_tls_1_0_2019_06),
.suites = cipher_suites_kms_pq_tls_1_0_2019_06,
};
/* Includes round 1 and round 2 PQ KEM params. The cipher suite list is the same
* as in cipher_preferences_kms_pq_tls_1_0_2019_06.*/
const struct s2n_cipher_preferences cipher_preferences_kms_pq_tls_1_0_2020_02 = {
.count = s2n_array_len(cipher_suites_kms_pq_tls_1_0_2019_06),
.suites = cipher_suites_kms_pq_tls_1_0_2019_06,
};
struct s2n_cipher_suite *cipher_suites_pq_sike_test_tls_1_0_2019_11[] = {
&s2n_ecdhe_sike_rsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_rsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_rsa_with_aes_128_gcm_sha256,
&s2n_ecdhe_rsa_with_aes_256_cbc_sha384,
&s2n_ecdhe_rsa_with_aes_256_cbc_sha,
&s2n_ecdhe_rsa_with_aes_128_cbc_sha256,
&s2n_ecdhe_rsa_with_3des_ede_cbc_sha,
&s2n_dhe_rsa_with_aes_256_cbc_sha256,
&s2n_dhe_rsa_with_aes_128_cbc_sha256,
&s2n_dhe_rsa_with_aes_256_cbc_sha,
&s2n_dhe_rsa_with_aes_128_cbc_sha,
};
/* Includes only SIKE round 1 (for integration tests) */
const struct s2n_cipher_preferences cipher_preferences_pq_sike_test_tls_1_0_2019_11 = {
.count = s2n_array_len(cipher_suites_pq_sike_test_tls_1_0_2019_11),
.suites = cipher_suites_pq_sike_test_tls_1_0_2019_11,
};
/* Includes only SIKE round 1 and round 2 (for integration tests). The cipher suite list
* is the same as in cipher_preferences_pq_sike_test_tls_1_0_2019_11. */
const struct s2n_cipher_preferences cipher_preferences_pq_sike_test_tls_1_0_2020_02 = {
.count = s2n_array_len(cipher_suites_pq_sike_test_tls_1_0_2019_11),
.suites = cipher_suites_pq_sike_test_tls_1_0_2019_11,
};
/* Includes Kyber, BIKE, and SIKE PQ Ciphers */
struct s2n_cipher_suite *cipher_suites_kms_pq_tls_1_0_2020_07[] = {
&s2n_ecdhe_kyber_rsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_bike_rsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_sike_rsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_rsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_rsa_with_aes_128_gcm_sha256,
&s2n_ecdhe_rsa_with_aes_256_cbc_sha384,
&s2n_ecdhe_rsa_with_aes_256_cbc_sha,
&s2n_ecdhe_rsa_with_aes_128_cbc_sha256,
&s2n_ecdhe_rsa_with_3des_ede_cbc_sha,
&s2n_dhe_rsa_with_aes_256_cbc_sha256,
&s2n_dhe_rsa_with_aes_128_cbc_sha256,
&s2n_dhe_rsa_with_aes_256_cbc_sha,
&s2n_dhe_rsa_with_aes_128_cbc_sha,
};
const struct s2n_cipher_preferences cipher_preferences_kms_pq_tls_1_0_2020_07 = {
.count = s2n_array_len(cipher_suites_kms_pq_tls_1_0_2020_07),
.suites = cipher_suites_kms_pq_tls_1_0_2020_07,
};
struct s2n_cipher_suite *cipher_suites_pq_tls_1_0_2020_12[] = {
S2N_TLS13_CIPHER_SUITES_20190801,
&s2n_ecdhe_kyber_rsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_bike_rsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_sike_rsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_rsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_rsa_with_aes_128_gcm_sha256,
&s2n_ecdhe_rsa_with_aes_256_cbc_sha384,
&s2n_ecdhe_rsa_with_aes_256_cbc_sha,
&s2n_ecdhe_rsa_with_aes_128_cbc_sha256,
&s2n_ecdhe_rsa_with_3des_ede_cbc_sha,
&s2n_dhe_rsa_with_aes_256_cbc_sha256,
&s2n_dhe_rsa_with_aes_128_cbc_sha256,
&s2n_dhe_rsa_with_aes_256_cbc_sha,
&s2n_dhe_rsa_with_aes_128_cbc_sha,
};
const struct s2n_cipher_preferences cipher_preferences_pq_tls_1_0_2020_12 = {
.count = s2n_array_len(cipher_suites_pq_tls_1_0_2020_12),
.suites = cipher_suites_pq_tls_1_0_2020_12,
};
/* Same as ELBSecurityPolicy-TLS-1-1-2017-01, but with PQ Ciphers appended to top of preference list */
struct s2n_cipher_suite *cipher_suites_pq_tls_1_1_2021_05_17[] = {
&s2n_ecdhe_kyber_rsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_bike_rsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_sike_rsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_ecdsa_with_aes_128_gcm_sha256,
&s2n_ecdhe_rsa_with_aes_128_gcm_sha256,
&s2n_ecdhe_ecdsa_with_aes_128_cbc_sha256,
&s2n_ecdhe_rsa_with_aes_128_cbc_sha256,
&s2n_ecdhe_ecdsa_with_aes_128_cbc_sha,
&s2n_ecdhe_rsa_with_aes_128_cbc_sha,
&s2n_ecdhe_ecdsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_rsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_ecdsa_with_aes_256_cbc_sha384,
&s2n_ecdhe_rsa_with_aes_256_cbc_sha384,
&s2n_ecdhe_rsa_with_aes_256_cbc_sha,
&s2n_ecdhe_ecdsa_with_aes_256_cbc_sha,
&s2n_rsa_with_aes_128_gcm_sha256,
&s2n_rsa_with_aes_128_cbc_sha256,
&s2n_rsa_with_aes_128_cbc_sha,
&s2n_rsa_with_aes_256_gcm_sha384,
&s2n_rsa_with_aes_256_cbc_sha256,
&s2n_rsa_with_aes_256_cbc_sha,
};
const struct s2n_cipher_preferences cipher_preferences_pq_tls_1_1_2021_05_17 = {
.count = s2n_array_len(cipher_suites_pq_tls_1_1_2021_05_17),
.suites = cipher_suites_pq_tls_1_1_2021_05_17,
};
/* Same as cipher_preferences_20190214, but with PQ Ciphers appended to top of preference list */
struct s2n_cipher_suite *cipher_suites_pq_tls_1_0_2021_05_18[] = {
&s2n_ecdhe_kyber_rsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_bike_rsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_sike_rsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_ecdsa_with_aes_128_cbc_sha,
&s2n_ecdhe_rsa_with_aes_128_cbc_sha,
&s2n_ecdhe_ecdsa_with_aes_128_gcm_sha256,
&s2n_ecdhe_rsa_with_aes_128_gcm_sha256,
&s2n_ecdhe_ecdsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_rsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_ecdsa_with_aes_128_cbc_sha256,
&s2n_ecdhe_rsa_with_aes_128_cbc_sha256,
&s2n_ecdhe_ecdsa_with_aes_256_cbc_sha,
&s2n_ecdhe_rsa_with_aes_256_cbc_sha,
&s2n_ecdhe_ecdsa_with_aes_256_cbc_sha384,
&s2n_ecdhe_rsa_with_aes_256_cbc_sha384,
&s2n_rsa_with_aes_128_cbc_sha,
&s2n_rsa_with_aes_128_gcm_sha256,
&s2n_rsa_with_aes_256_gcm_sha384,
&s2n_rsa_with_aes_128_cbc_sha256,
&s2n_rsa_with_aes_256_cbc_sha,
&s2n_rsa_with_aes_256_cbc_sha256,
&s2n_rsa_with_3des_ede_cbc_sha,
&s2n_dhe_rsa_with_aes_128_cbc_sha,
&s2n_dhe_rsa_with_aes_128_gcm_sha256,
&s2n_dhe_rsa_with_aes_256_gcm_sha384,
&s2n_dhe_rsa_with_aes_128_cbc_sha256,
&s2n_dhe_rsa_with_aes_256_cbc_sha,
&s2n_dhe_rsa_with_aes_256_cbc_sha256,
};
const struct s2n_cipher_preferences cipher_preferences_pq_tls_1_0_2021_05_18 = {
.count = s2n_array_len(cipher_suites_pq_tls_1_0_2021_05_18),
.suites = cipher_suites_pq_tls_1_0_2021_05_18,
};
/* Same as ELBSecurityPolicy-2016-08, but with PQ Ciphers appended to top of preference list */
struct s2n_cipher_suite *cipher_suites_pq_tls_1_0_2021_05_19[] = {
&s2n_ecdhe_kyber_rsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_bike_rsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_sike_rsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_ecdsa_with_aes_128_gcm_sha256,
&s2n_ecdhe_rsa_with_aes_128_gcm_sha256,
&s2n_ecdhe_ecdsa_with_aes_128_cbc_sha256,
&s2n_ecdhe_rsa_with_aes_128_cbc_sha256,
&s2n_ecdhe_ecdsa_with_aes_128_cbc_sha,
&s2n_ecdhe_rsa_with_aes_128_cbc_sha,
&s2n_ecdhe_ecdsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_rsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_ecdsa_with_aes_256_cbc_sha384,
&s2n_ecdhe_rsa_with_aes_256_cbc_sha384,
&s2n_ecdhe_rsa_with_aes_256_cbc_sha,
&s2n_ecdhe_ecdsa_with_aes_256_cbc_sha,
&s2n_rsa_with_aes_128_gcm_sha256,
&s2n_rsa_with_aes_128_cbc_sha256,
&s2n_rsa_with_aes_128_cbc_sha,
&s2n_rsa_with_aes_256_gcm_sha384,
&s2n_rsa_with_aes_256_cbc_sha256,
&s2n_rsa_with_aes_256_cbc_sha,
};
const struct s2n_cipher_preferences cipher_preferences_pq_tls_1_0_2021_05_19 = {
.count = s2n_array_len(cipher_suites_pq_tls_1_0_2021_05_19),
.suites = cipher_suites_pq_tls_1_0_2021_05_19,
};
/* Same as ELBSecurityPolicy-TLS-1-1-2017-01, but with TLS 1.3 and PQ Ciphers appended to top of preference list */
struct s2n_cipher_suite *cipher_suites_pq_tls_1_1_2021_05_21[] = {
/* TLS 1.3 Ciphers don't specify their Key exchange method, allowing for Hybrid PQ KEMs to be negotiated separately */
S2N_TLS13_CLOUDFRONT_CIPHER_SUITES_20200716,
&s2n_ecdhe_kyber_rsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_bike_rsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_sike_rsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_ecdsa_with_aes_128_gcm_sha256,
&s2n_ecdhe_rsa_with_aes_128_gcm_sha256,
&s2n_ecdhe_ecdsa_with_aes_128_cbc_sha256,
&s2n_ecdhe_rsa_with_aes_128_cbc_sha256,
&s2n_ecdhe_ecdsa_with_aes_128_cbc_sha,
&s2n_ecdhe_rsa_with_aes_128_cbc_sha,
&s2n_ecdhe_ecdsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_rsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_ecdsa_with_aes_256_cbc_sha384,
&s2n_ecdhe_rsa_with_aes_256_cbc_sha384,
&s2n_ecdhe_rsa_with_aes_256_cbc_sha,
&s2n_ecdhe_ecdsa_with_aes_256_cbc_sha,
&s2n_rsa_with_aes_128_gcm_sha256,
&s2n_rsa_with_aes_128_cbc_sha256,
&s2n_rsa_with_aes_128_cbc_sha,
&s2n_rsa_with_aes_256_gcm_sha384,
&s2n_rsa_with_aes_256_cbc_sha256,
&s2n_rsa_with_aes_256_cbc_sha,
};
const struct s2n_cipher_preferences cipher_preferences_pq_tls_1_1_2021_05_21 = {
.count = s2n_array_len(cipher_suites_pq_tls_1_1_2021_05_21),
.suites = cipher_suites_pq_tls_1_1_2021_05_21,
};
/* Same as cipher_preferences_20190214, but with TLS 1.3 and PQ Ciphers appended to top of preference list */
struct s2n_cipher_suite *cipher_suites_pq_tls_1_0_2021_05_22[] = {
/* TLS 1.3 Ciphers don't specify their Key exchange method, allowing for Hybrid PQ KEMs to be negotiated separately */
S2N_TLS13_CLOUDFRONT_CIPHER_SUITES_20200716,
&s2n_ecdhe_kyber_rsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_bike_rsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_sike_rsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_ecdsa_with_aes_128_cbc_sha,
&s2n_ecdhe_rsa_with_aes_128_cbc_sha,
&s2n_ecdhe_ecdsa_with_aes_128_gcm_sha256,
&s2n_ecdhe_rsa_with_aes_128_gcm_sha256,
&s2n_ecdhe_ecdsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_rsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_ecdsa_with_aes_128_cbc_sha256,
&s2n_ecdhe_rsa_with_aes_128_cbc_sha256,
&s2n_ecdhe_ecdsa_with_aes_256_cbc_sha,
&s2n_ecdhe_rsa_with_aes_256_cbc_sha,
&s2n_ecdhe_ecdsa_with_aes_256_cbc_sha384,
&s2n_ecdhe_rsa_with_aes_256_cbc_sha384,
&s2n_rsa_with_aes_128_cbc_sha,
&s2n_rsa_with_aes_128_gcm_sha256,
&s2n_rsa_with_aes_256_gcm_sha384,
&s2n_rsa_with_aes_128_cbc_sha256,
&s2n_rsa_with_aes_256_cbc_sha,
&s2n_rsa_with_aes_256_cbc_sha256,
&s2n_rsa_with_3des_ede_cbc_sha,
&s2n_dhe_rsa_with_aes_128_cbc_sha,
&s2n_dhe_rsa_with_aes_128_gcm_sha256,
&s2n_dhe_rsa_with_aes_256_gcm_sha384,
&s2n_dhe_rsa_with_aes_128_cbc_sha256,
&s2n_dhe_rsa_with_aes_256_cbc_sha,
&s2n_dhe_rsa_with_aes_256_cbc_sha256,
};
const struct s2n_cipher_preferences cipher_preferences_pq_tls_1_0_2021_05_22 = {
.count = s2n_array_len(cipher_suites_pq_tls_1_0_2021_05_22),
.suites = cipher_suites_pq_tls_1_0_2021_05_22,
};
/* Same as ELBSecurityPolicy-2016-08, but with TLS 1.3 and PQ Ciphers appended to top of preference list */
struct s2n_cipher_suite *cipher_suites_pq_tls_1_0_2021_05_23[] = {
/* TLS 1.3 Ciphers don't specify their Key exchange method, allowing for Hybrid PQ KEMs to be negotiated separately */
S2N_TLS13_CLOUDFRONT_CIPHER_SUITES_20200716,
&s2n_ecdhe_kyber_rsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_bike_rsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_sike_rsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_ecdsa_with_aes_128_gcm_sha256,
&s2n_ecdhe_rsa_with_aes_128_gcm_sha256,
&s2n_ecdhe_ecdsa_with_aes_128_cbc_sha256,
&s2n_ecdhe_rsa_with_aes_128_cbc_sha256,
&s2n_ecdhe_ecdsa_with_aes_128_cbc_sha,
&s2n_ecdhe_rsa_with_aes_128_cbc_sha,
&s2n_ecdhe_ecdsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_rsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_ecdsa_with_aes_256_cbc_sha384,
&s2n_ecdhe_rsa_with_aes_256_cbc_sha384,
&s2n_ecdhe_rsa_with_aes_256_cbc_sha,
&s2n_ecdhe_ecdsa_with_aes_256_cbc_sha,
&s2n_rsa_with_aes_128_gcm_sha256,
&s2n_rsa_with_aes_128_cbc_sha256,
&s2n_rsa_with_aes_128_cbc_sha,
&s2n_rsa_with_aes_256_gcm_sha384,
&s2n_rsa_with_aes_256_cbc_sha256,
&s2n_rsa_with_aes_256_cbc_sha,
};
const struct s2n_cipher_preferences cipher_preferences_pq_tls_1_0_2021_05_23 = {
.count = s2n_array_len(cipher_suites_pq_tls_1_0_2021_05_23),
.suites = cipher_suites_pq_tls_1_0_2021_05_23,
};
/* Same as cipher_preferences_kms_pq_tls_1_0_2020_07, but with TLS 1.3 appended to top of preference list */
struct s2n_cipher_suite *cipher_suites_pq_tls_1_0_2021_05_24[] = {
/* TLS 1.3 Ciphers don't specify their Key exchange method, allowing for Hybrid PQ KEMs to be negotiated separately */
S2N_TLS13_CIPHER_SUITES_20190801,
&s2n_ecdhe_kyber_rsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_bike_rsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_sike_rsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_rsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_rsa_with_aes_128_gcm_sha256,
&s2n_ecdhe_rsa_with_aes_256_cbc_sha384,
&s2n_ecdhe_rsa_with_aes_256_cbc_sha,
&s2n_ecdhe_rsa_with_aes_128_cbc_sha256,
&s2n_ecdhe_rsa_with_3des_ede_cbc_sha,
&s2n_dhe_rsa_with_aes_256_cbc_sha256,
&s2n_dhe_rsa_with_aes_128_cbc_sha256,
&s2n_dhe_rsa_with_aes_256_cbc_sha,
&s2n_dhe_rsa_with_aes_128_cbc_sha,
};
const struct s2n_cipher_preferences cipher_preferences_pq_tls_1_0_2021_05_24 = {
.count = s2n_array_len(cipher_suites_pq_tls_1_0_2021_05_24),
.suites = cipher_suites_pq_tls_1_0_2021_05_24,
};
/* Same as 20190214_gcm, but with PQ Ciphers appended to top of preference list */
struct s2n_cipher_suite *cipher_suites_pq_tls_1_0_2021_05_25[] = {
&s2n_ecdhe_kyber_rsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_bike_rsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_sike_rsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_ecdsa_with_aes_128_gcm_sha256,
&s2n_ecdhe_rsa_with_aes_128_gcm_sha256,
&s2n_ecdhe_ecdsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_rsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_ecdsa_with_aes_128_cbc_sha,
&s2n_ecdhe_rsa_with_aes_128_cbc_sha,
&s2n_ecdhe_ecdsa_with_aes_128_cbc_sha256,
&s2n_ecdhe_rsa_with_aes_128_cbc_sha256,
&s2n_ecdhe_ecdsa_with_aes_256_cbc_sha,
&s2n_ecdhe_rsa_with_aes_256_cbc_sha,
&s2n_ecdhe_ecdsa_with_aes_256_cbc_sha384,
&s2n_ecdhe_rsa_with_aes_256_cbc_sha384,
&s2n_rsa_with_aes_128_gcm_sha256,
&s2n_rsa_with_aes_256_gcm_sha384,
&s2n_rsa_with_aes_128_cbc_sha,
&s2n_rsa_with_aes_128_cbc_sha256,
&s2n_rsa_with_aes_256_cbc_sha,
&s2n_rsa_with_aes_256_cbc_sha256,
&s2n_rsa_with_3des_ede_cbc_sha,
&s2n_dhe_rsa_with_aes_128_gcm_sha256,
&s2n_dhe_rsa_with_aes_256_gcm_sha384,
&s2n_dhe_rsa_with_aes_128_cbc_sha,
&s2n_dhe_rsa_with_aes_128_cbc_sha256,
&s2n_dhe_rsa_with_aes_256_cbc_sha,
&s2n_dhe_rsa_with_aes_256_cbc_sha256,
};
const struct s2n_cipher_preferences cipher_preferences_pq_tls_1_0_2021_05_25 = {
.count = s2n_array_len(cipher_suites_pq_tls_1_0_2021_05_25),
.suites = cipher_suites_pq_tls_1_0_2021_05_25,
};
/* Same as 20190214_gcm, but with TLS 1.3 and PQ Ciphers appended to top of preference list */
struct s2n_cipher_suite *cipher_suites_pq_tls_1_0_2021_05_26[] = {
/* TLS 1.3 Ciphers don't specify their Key exchange method, allowing for Hybrid PQ KEMs to be negotiated separately */
S2N_TLS13_CLOUDFRONT_CIPHER_SUITES_20200716,
&s2n_ecdhe_kyber_rsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_bike_rsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_sike_rsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_ecdsa_with_aes_128_gcm_sha256,
&s2n_ecdhe_rsa_with_aes_128_gcm_sha256,
&s2n_ecdhe_ecdsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_rsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_ecdsa_with_aes_128_cbc_sha,
&s2n_ecdhe_rsa_with_aes_128_cbc_sha,
&s2n_ecdhe_ecdsa_with_aes_128_cbc_sha256,
&s2n_ecdhe_rsa_with_aes_128_cbc_sha256,
&s2n_ecdhe_ecdsa_with_aes_256_cbc_sha,
&s2n_ecdhe_rsa_with_aes_256_cbc_sha,
&s2n_ecdhe_ecdsa_with_aes_256_cbc_sha384,
&s2n_ecdhe_rsa_with_aes_256_cbc_sha384,
&s2n_rsa_with_aes_128_gcm_sha256,
&s2n_rsa_with_aes_256_gcm_sha384,
&s2n_rsa_with_aes_128_cbc_sha,
&s2n_rsa_with_aes_128_cbc_sha256,
&s2n_rsa_with_aes_256_cbc_sha,
&s2n_rsa_with_aes_256_cbc_sha256,
&s2n_rsa_with_3des_ede_cbc_sha,
&s2n_dhe_rsa_with_aes_128_gcm_sha256,
&s2n_dhe_rsa_with_aes_256_gcm_sha384,
&s2n_dhe_rsa_with_aes_128_cbc_sha,
&s2n_dhe_rsa_with_aes_128_cbc_sha256,
&s2n_dhe_rsa_with_aes_256_cbc_sha,
&s2n_dhe_rsa_with_aes_256_cbc_sha256,
};
const struct s2n_cipher_preferences cipher_preferences_pq_tls_1_0_2021_05_26 = {
.count = s2n_array_len(cipher_suites_pq_tls_1_0_2021_05_26),
.suites = cipher_suites_pq_tls_1_0_2021_05_26,
};
struct s2n_cipher_suite *cipher_suites_kms_fips_tls_1_2_2018_10[] = {
&s2n_ecdhe_rsa_with_aes_256_gcm_sha384,
&s2n_ecdhe_rsa_with_aes_128_gcm_sha256,
&s2n_ecdhe_rsa_with_aes_256_cbc_sha384,
&s2n_ecdhe_rsa_with_aes_128_cbc_sha256,
&s2n_dhe_rsa_with_aes_256_cbc_sha256,
&s2n_dhe_rsa_with_aes_128_cbc_sha256,
};
const struct s2n_cipher_preferences cipher_preferences_kms_fips_tls_1_2_2018_10 = {
.count = s2n_array_len(cipher_suites_kms_fips_tls_1_2_2018_10),
.suites = cipher_suites_kms_fips_tls_1_2_2018_10,
};
/* clang-format on */
|
Brandon2255p/EM4100_Tx | src/Manchester.h | #ifndef MANCHESTER_h
#define MANCHESTER_h
//timer scaling factors for different transmission speeds
#define MAN_300 0
#define MAN_600 1
#define MAN_1200 2
#define MAN_2400 3
#define MAN_4800 4
#define MAN_9600 5
#define MAN_19200 6
#define MAN_38400 7
#define SYNC_PULSE_DEF 9
//setup timing for receiver
#define MinCount 33 //pulse lower count limit on capture
#define MaxCount 65 //pulse higher count limit on capture
#define MinLongCount 66 //pulse lower count on double pulse
#define MaxLongCount 129 //pulse higher count on double pulse
//setup timing for transmitter
#define HALF_BIT_INTERVAL 3072 //(=48 * 1024 * 1000000 / 16000000Hz) microseconds for speed factor 0 (300baud)
#define TimeOutDefault -1 //the timeout in msec default blocks
#if defined(ARDUINO) && ARDUINO >= 100
#include "Arduino.h"
#else
#include "WProgram.h"
#include <pins_arduino.h>
#endif
class Manchester
{
public:
Manchester(); //the constructor
void setTxPin(uint8_t pin); //set the arduino digital pin for transmit.
void workAround1MhzTinyCore(uint8_t a = 1); //apply workaround for defect in tiny Core library for 1Mhz
void setupTransmit(uint8_t pin, uint8_t SF = MAN_1200); //set up transmission
void transmitEM4100(uint8_t *data); // transmit array of bytes
void SetDelay_us(uint16_t delay_us);
//wrappers for global functions
private:
uint8_t TxPin;
uint8_t speedFactor;
uint16_t delay1;
uint16_t delay2;
void sendZero(void);
void sendOne(void);
uint8_t applyWorkAround1Mhz;
bool reverseManchester;
void sendEvenParity(int numHighBits);
void sendLowHigh();
void sendHighLow();
};//end of class Manchester
extern Manchester man;
#endif
|
enzow13/carlos | carlosmain.c | #include <cs50.h>
#include <stdio.h>
#include <stdin.h>
int main(void){
printf('Hello World');
}
|
bs135/i2c_keypad | firmware/i2ckeypad/i2c_keymatrix/i2c_keymatrix.c | /*
* i2c_keymatrix.c
*
* Created: 19/10/2016 1:34:18 AM
* Author: Hai
*/
#include <avr/io.h>
#include "i2c_keymatrix.h"
#include "../i2c/i2c_master.h"
uint8_t i2c_keymatrix_write(uint8_t port0, uint8_t port1)
{
if (i2c_start(I2C_SLAVE_ADDR | I2C_WRITE)) return 1;
if (i2c_write(port0)) return 1;
if (i2c_write(port1)) return 1;
i2c_stop();
return 0;
}
uint16_t i2c_keymatrix_read(void)
{
uint8_t port0;
uint8_t port1;
if (i2c_start(I2C_SLAVE_ADDR | I2C_READ)) return 1;
port0 = i2c_read_ack();
port1 = i2c_read_nack();
i2c_stop();
return (port0 << 8) | port1;
}
void i2c_keymatrix_unselect_rows(void)
{
i2c_keymatrix_write(0xff, 0xff);
}
void i2c_keymatrix_select_row(uint8_t row)
{
i2c_keymatrix_write(0xff, ~_BV(row));
}
uint8_t i2c_keymatrix_read_cols(void)
{
uint8_t port0;
if (i2c_start(I2C_SLAVE_ADDR | I2C_READ)) return 1;
port0 = i2c_read_ack();
i2c_read_nack();//port1
i2c_stop();
return ~(port0 & 0x0f);
}
//uint32_t i2c_keymatrix_scan(void)
//{
//uint8_t row;
//uint8_t col;
//uint8_t col_val;
//uint32_t matrix = 0;
//for (row = 0; row < 5; row++)
//{
//i2c_keymatrix_unselect_rows();
//i2c_keymatrix_select_row(row);
//col_val = i2c_keymatrix_read_cols();
//for (col = 0; col < 4; col++)
//{
//matrix = matrix<<1;
//if (col_val & _BV(col))
//{
//matrix = matrix | 1;
//}
//}
//}
//
//return matrix;
//} |
bs135/i2c_keypad | firmware/i2ckeypad/config.h | /*
* config.h
*
* Created: 15/10/2016 12:51:23 AM
* Author: Hai
*/
#ifndef F_CPU
#define F_CPU 16000000UL
#endif
#ifndef BAUD
#define BAUD 19200UL
#endif
#ifndef F_SCL
#define F_SCL 100000UL // SCL frequency
#endif
#define UART_DEBUG |
bs135/i2c_keypad | firmware/i2ckeypad/main.c | <gh_stars>0
/*
* i2ckeypad.c
*
* Created: 29/08/2016 4:07:06 PM
* Author : BS135
*/
#include "config.h"
#include <avr/io.h>
#include <util/delay.h>
#include <stdio.h>
#include "main.h"
#include "uart/uart.h"
#include "i2c/i2c_master.h"
#include "i2c_keymatrix/i2c_keymatrix.h"
int main(void)
{
uart_init();
i2c_init();
#ifdef UART_DEBUG
stdout = &uart_output;
stdin = &uart_input;
#endif // UART_DEBUG
#ifdef UART_DEBUG
char input;
uint16_t portRead;
uint8_t row;
uint8_t col;
uint8_t col_val;
puts("Hello world!");
puts("Welcome to i2ckeypad project.");
while(1) {
input = getchar();
printf("%c\n", input);
switch (input)
{
case 'w':// write
puts("I2C_WRITE");
i2c_keymatrix_write(0xbe, 0xef);
break;
case 'r':
puts("I2C_READ");
portRead = 0x0000;
portRead=i2c_keymatrix_read();
printf("%x\n", portRead);
break;
case '1':
puts("Select row 1");
i2c_keymatrix_write(0xff, ~_BV(0));
break;
case '2':
puts("Select row 2");
i2c_keymatrix_write(0xff, ~_BV(1));
break;
case '3':
puts("Select row 3");
i2c_keymatrix_write(0xff, ~_BV(2));
break;
case '4':
puts("Select row 4");
i2c_keymatrix_write(0xff, ~_BV(3));
break;
case '5':
puts("Select row 5");
i2c_keymatrix_write(0xff, ~_BV(4));
break;
case 's':
puts("Scan result:");
for (row = 0; row < 5; row++)
{
i2c_keymatrix_unselect_rows();
i2c_keymatrix_select_row(row);
col_val = i2c_keymatrix_read_cols();
for (col = 0; col < 4; col++)
{
if (col_val & _BV(col))
{
putchar('1');
}
else
{
putchar('0');
}
}
putchar('\n');
}
break;
default:
puts("Hello All!");
break;
}
}
#endif // UART_DEBUG
DDRB |= _BV(DDB5); // PB5=Out
PORTB &= ~_BV(PORTB5);
while (1)
{
PORTB &= ~_BV(PORTB5);
_delay_ms(200);
PORTB |= _BV(PORTB5);
_delay_ms(100);
}
return 0;
}
|
bs135/i2c_keypad | firmware/i2ckeypad/uart/uart.c | /*
* uart.c
*
* Created: 09/10/2016 10:43:47 AM
* Author: BS135
*/
#include "../config.h"
#include <avr/io.h>
#include <util/setbaud.h>
#include "uart.h"
#ifdef UART_DEBUG
FILE uart_output = FDEV_SETUP_STREAM(uart_stream_putchar, NULL, _FDEV_SETUP_WRITE);
FILE uart_input = FDEV_SETUP_STREAM(NULL, uart_stream_getchar, _FDEV_SETUP_READ);
#endif // UART_DEBUG
void uart_init(){
UBRR0H = UBRRH_VALUE;
UBRR0L = UBRRL_VALUE;
#if USE_2X
UCSR0A |= _BV(U2X0);
#else
UCSR0A &= ~(_BV(U2X0));
#endif
UCSR0C = _BV(UCSZ01) | _BV(UCSZ00); /* 8-bit data */
UCSR0B = _BV(RXEN0) | _BV(TXEN0); /* Enable RX and TX */
}
void uart_putchar(char c) {
loop_until_bit_is_set(UCSR0A, UDRE0); /* Wait until data register empty. */
UDR0 = c;
loop_until_bit_is_set(UCSR0A, TXC0); /* Wait until transmission ready. */
}
char uart_getchar(void) {
loop_until_bit_is_set(UCSR0A, RXC0); /* Wait until data exists. */
return UDR0;
}
#ifdef UART_DEBUG
int uart_stream_putchar(char c, FILE *stream) {
if (c == '\n') {
uart_stream_putchar('\r', stream);
}
loop_until_bit_is_set(UCSR0A, UDRE0);
UDR0 = c;
return 0;
}
int uart_stream_getchar(FILE *stream) {
loop_until_bit_is_set(UCSR0A, RXC0);
return UDR0;
}
#endif // UART_DEBUG |
bs135/i2c_keypad | firmware/i2ckeypad/uart/uart.h | /*
* uart.h
*
* Created: 09/10/2016 10:41:35 AM
* Author: BS135
*/
#include <stdio.h>
#ifndef UART_H_
#define UART_H_
void uart_init();
void uart_putchar(char c);
char uart_getchar(void);
#ifdef UART_DEBUG
int uart_stream_putchar(char c, FILE *stream);
int uart_stream_getchar(FILE *stream);
extern FILE uart_output;
extern FILE uart_input;
#endif // UART_DEBUG
#endif /* UART_H_ */ |
bs135/i2c_keypad | firmware/i2ckeypad/i2c_keymatrix/i2c_keymatrix.h | /*
* i2c_keymatrix.h
*
* Created: 19/10/2016 1:34:28 AM
* Author: Hai
*/
#ifndef I2C_KEYMATRIX_H_
#define I2C_KEYMATRIX_H_
// PCF8575 address
#define I2C_SLAVE_ADDR 0x40
uint8_t i2c_keymatrix_write(uint8_t port0, uint8_t port1);
uint16_t i2c_keymatrix_read(void);
void i2c_keymatrix_unselect_rows(void);
void i2c_keymatrix_select_row(uint8_t row);
uint8_t i2c_keymatrix_read_cols(void);
//uint32_t i2c_keymatrix_scan(void);
#endif /* I2C_KEYMATRIX_H_ */ |
bs135/i2c_keypad | firmware/i2ckeypad/main.h | /*
* main.h
*
* Created: 15/10/2016 1:39:59 AM
* Author: Hai
*/
#ifndef MAIN_H_
#define MAIN_H_
int main(void);
#endif /* MAIN_H_ */ |
bitzenyPlus/BitZenyPlus | src/crypto/yespower-bitzeny.c | /*-
* Copyright 2018 bitzenyPlus Developers
* 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.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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.
*
* This file was originally written by bitzenyPlus Developers as part of the bitzenyPlus.
*/
#include <stdlib.h>
#include "yespower/yespower.h"
static const yespower_params_t yespower_0_5_bitzeny = {YESPOWER_0_5, 2048, 8, "Client Key", 10};
// WARNING DO NOT USE THIS IN yespower_hash YET. For later HF to yespower 1.0
// TODO Find HF solution using unixtime or blockheight(recommended)
/*
Parameter selection for yespower 1.0.
For new uses of yespower, set the requested version to the highest
supported, and set N*r to the highest you can reasonably afford in terms
of proof verification time (which might in turn be determined by desired
share rate per mining pool server), using one of the following options:
1 MiB: N = 1024, r = 8
2 MiB: N = 2048, r = 8 (current bitzeny-yescrypt0.5)
4 MiB: N = 1024, r = 32
8 MiB: N = 2048, r = 32 (recommended settings)
16 MiB: N = 4096, r = 32 (It might increase resistance against future GPUs)
and so on for higher N keeping r=32.
You may also set the personalization string to your liking, but that is
not required (you can set its pointer to NULL and its length to 0). Its
support is provided mostly for compatibility with existing modifications
of yescrypt 0.5.
*/
// solardiz recommended yespower 1.0 settings of at least N=2048 r=32 (8 MiB)
static const yespower_params_t yespower_1_0_bitzeny = {YESPOWER_1_0, 2048, 32, NULL, 0};
// yespower 0.5 only
void yespower_hash(const char *input, char *output){
if (yespower_tls(input, 80, &yespower_0_5_bitzeny, (yespower_binary_t *) output))
abort();
}
|
sda-ab/lab-03-tasks | src/main.c | #include "list.h"
#include "utils.h"
int main()
{
}
|
sda-ab/lab-03-tasks | src/cerinta3.c | <gh_stars>0
#include "list.h"
#include "utils.h"
/**
* @brief Functie ce creaza un nod prin alocare dinamica
* si returneaza pointerul nodului creat.
*
* @param number - numarul pe care il are copilul
* @param name - numele copilului
* @param next - adresa urmatorului nod
* @return childNode* - nou nod creat
*/
childNode *makeChildNode(int number, const char *name, childNode *next)
{
//TODO3.1: primul pas in implementarea cerintei 3
}
/**
* @brief Functie ce returneaza o lista nou creata cu ajutorul
* datelor citite din fisier-ul file primit ca parametru
*
* Hint:
* * folositi-va de metoda makeChildNode pentru a crea lista
* * fscanf returneaza EOF in cazul in care se ajunge la
* sfarsitul fisierului => while(fscanf(...)!=EOF) va va
* ajuta sa parcurgeti fisierul
*
* @param file - fisierul ce trebuie citit
* @return childNode*
*/
childNode *makeCircularList(FILE *file)
{
//TODO2.2: al doilea pas in implementarea cerintei 3
}
/**
* @brief Functie ce
*
* @param head - capul listei ce reprezinta cercul de copii
* @param p - pasul ce va fi luat pentru eliminarea copiilor
* @return childNode*
*/
childNode *playJosephGame(childNode *head, int p)
{
// TODO3.3: se va return o lista creata prin adaugarea
// cu complexitatea O(1) a copiilor in ordinea in care
// sunt eliminati
} |
sda-ab/lab-03-tasks | src/cerinta2.c | #include "list.h"
#include "utils.h"
/**
* @brief Functie ce elimina elementele cu informatii duplicate
* Hint:
* * parcurgeti lista si modificati nodurile a.i sa elimi-
* nati duplicatele
* * daca capul listei nu se modifica va trebuii
* sa il returnati
*
* @param list - capul listei ce trebuie sa fie procesata
* @return node* - returneaza capul listei
*/
node *removeDuplicates(node *list)
{
//TODO2: metoda ce realizeaza eliminarea de noduri duplicate
}
|
sda-ab/lab-03-tasks | src/cerinta1.c | <reponame>sda-ab/lab-03-tasks
#include "list.h"
#include "utils.h"
/**
* @brief Functie ce creaza un nod prin alocare dinamica
* si returneaza pointerul nodului creat.
*
* @param data - informatia nodului respectiv
* @param next - adresa urmatorului nod
* @return node* nou nod creat
*/
node *makeNode(int data, node *next)
{
//TODO1.1: primul pas in implementarea cerintei 1
}
/**
* @brief Functie ce returneaza o lista nou creata cu ajutorul
* datelor citite din fisier-ul file primit ca parametru
*
* Hint:
* * folositi-va de metoda makeNode pentru a crea lista
* * fscanf returneaza EOF in cazul in care se ajunge la
* sfarsitul fisierului => while(fscanf(...)!=EOF) va va
* ajuta sa parcurgeti fisierul
*
* @param file - fisierul ce trebuie citit
* @return node*
*/
node *makeList(FILE *file)
{
//TODO1.2: al doilea pas in implementarea cerintei 1
}
/**
* @brief Functie ce afiseaza toate elementele unei liste
*
* @param head - capul listei de afisat
*/
void print(node *head)
{
// Nice to have - pentru testare locala in main
} |
sda-ab/lab-03-tasks | src/libs/list.h | #pragma once
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
typedef struct node
{
int data;
struct node *next;
} node;
typedef struct child
{
char *name;
int number;
struct child *next;
} childNode;
/**
* @brief Functie ce creaza un nod prin alocare dinamica
* si returneaza pointerul nodului creat.
*
* @param data - informatia nodului respectiv
* @param next - adresa urmatorului nod
* @return node* nou nod creat
*/
node *makeNode(int data, node *next);
/**
* @brief Functie ce afiseaza toate elementele unei liste
*
* @param head - capul listei de afisat
*/
void print(node *head);
/**
* @brief Functie ce returneaza o lista nou creata cu ajutorul
* datelor citite din fisier-ul file primit ca parametru
*
* Hint:
* * folositi-va de metoda makeNode pentru a crea lista
*
* @param file - fisierul ce trebuie citit
* @return node*
*/
node *makeList(FILE *file);
/**
* @brief
*
* @param list
* @return node* the head of the list
*/
node *removeDuplicates(node *list);
/**
* @brief
*
* @param number
* @param name
* @param next
* @return childNode*
*/
childNode *makeChildNode(int number, const char *name, childNode *next);
/**
* @brief
*
* @param file
* @return childNode*
*/
childNode *makeCircularList(FILE *file);
/**
* @brief
*
* @param head
* @param p
* @return childNode*
*/
childNode *playJosephGame(childNode *head, int p); |
BlakeBoxberger/SendSeparately | Interfaces.h | <filename>Interfaces.h
#import "UIBackdropView.h"
@interface CKComposeRecipientSelectionController : UIViewController
- (void)addRecipient:(id)arg1;
- (void)removeRecipient:(id)arg1;
@end
@interface CKComposition : NSObject
@end
@interface CKChatController : UIViewController
@property (nonatomic,retain) CKComposition *composition;
- (void)sendComposition:(CKComposition *)arg1;
@end
@interface CKComposeChatController : CKChatController
@property (nonatomic, retain) UISwitch *sendSeparatelySwitch; // NEW
@property (nonatomic, retain) UILabel *sendSeparatelyLabel; // NEW
@property (nonatomic, retain) UIStackView *sendSeparatelyStackView; // NEW
@property (nonatomic, readonly) NSArray *proposedRecipients;
@property (nonatomic,retain) UIBarButtonItem * composeCancelItem;
@property (nonatomic, retain) CKComposeRecipientSelectionController *composeRecipientSelectionController;
- (void)initializeSendSeparatelyView; // NEW
- (BOOL)shouldShowSendSeparatelyStackView; // NEW
- (void)cancelButtonTapped:(UIBarButtonItem *)arg1;
@end
@interface MFHeaderLabelView : UILabel
+ (UIColor *)_defaultColor;
@end
@interface MFComposeRecipient : NSObject
- (NSString *)rawAddress;
@end
@interface CKEntity : NSObject
- (NSString *)rawAddress;
@end
@interface CKConversation : NSObject
- (id)messageWithComposition:(CKComposition *)arg1;
- (void)sendMessage:(id)arg1 newComposition:(BOOL)arg2;
- (CKEntity *)recipient;
@end
@interface CKConversationList : NSObject
+ (CKConversationList *)sharedConversationList;
- (NSArray *)conversations;
@end
|
vapier/liblzw | tests/uncompress.c | <reponame>vapier/liblzw<filename>tests/uncompress.c<gh_stars>1-10
/* Simple app to show how to uncompress an entire file. Same thing
* as running: uncompress -d -c file
*
* Written by <NAME> <<EMAIL>>
* Released into the public domain.
*/
#include "tests.h"
int main(int argc, char *argv[])
{
size_t numread;
unsigned char buf[1024];
lzwFile *lzw;
if (argc != 2)
err("Usage: uncompress <file>");
lzw = lzw_open(argv[1], O_RDONLY | O_BINARY);
if (lzw == NULL)
err("could not open file");
while ((numread = lzw_read(lzw, buf, sizeof(buf))) > 0)
if (fwrite(buf, 1, numread, stdout) != numread)
errp("fwrite() failed");
if (lzw_close(lzw))
err("could not close file");
return 0;
}
|
vapier/liblzw | lzw.c | <reponame>vapier/liblzw
/*
* Original code was ripped from ncompress:
* https://github.com/vapier/ncompress
* It is all public domain code, so have fun.
*
* Librarification by <NAME> <<EMAIL>>
*
* (N)compress42.c - File compression ala IEEE Computer, Mar 1992.
*
* Authors:
* <NAME> (decvax!harpo!utah-cs!utah-gr!thomas)
* <NAME> (decvax!mcvax!jim)
* <NAME> (decvax!vax135!petsd!peora!srd)
* <NAME> (decvax!decwrl!turtlevax!ken)
* <NAME> (decvax!ihnp4!ames!jaw)
* <NAME> (decvax!vax135!petsd!joe)
* <NAME> (<EMAIL>)
* <NAME>, Network Communication Systems
* (<EMAIL>)
*/
#ifdef __IN_LIBSTDF
# include <libstdf.h>
# define hidden_in_another_lib stdf_attribute_hidden
#else
# include "lzw_internal.h"
# define hidden_in_another_lib
#endif
/*
* Misc common define cruft.
*/
#define BUFSIZE 4
#define IN_BUFSIZE (BUFSIZE + 64)
#define OUT_BUFSIZE (BUFSIZE + 2048)
#define BITS 16
#define INIT_BITS 9 /* initial number of bits/code */
#define MAXCODE(n) (1L << (n))
#define FIRST 257 /* first free entry */
#define CLEAR 256 /* table clear output code */
/*
* Open LZW file.
*/
hidden_in_another_lib
lzwFile *lzw_fdopen(int fd)
{
lzwFile *ret;
unsigned char buf[3];
if (read(fd, buf, 3) != 3)
goto err_out;
if (buf[0] != LZW_MAGIC_1 || buf[1] != LZW_MAGIC_2 || buf[2] & 0x60)
goto err_out;
if ((ret = malloc(sizeof(*ret))) == NULL)
goto err_out;
memset(ret, 0x00, sizeof(*ret));
ret->fd = fd;
ret->eof = 0;
ret->inbuf = malloc(sizeof(unsigned char) * IN_BUFSIZE);
ret->outbuf = malloc(sizeof(unsigned char) * OUT_BUFSIZE);
ret->stackp = NULL;
ret->insize = 3; /* we read three bytes above */
ret->outpos = 0;
ret->rsize = 0;
ret->flags = buf[2];
ret->maxbits = ret->flags & 0x1f; /* Mask for 'number of compresssion bits' */
ret->block_mode = ret->flags & 0x80;
ret->n_bits = INIT_BITS;
ret->maxcode = MAXCODE(INIT_BITS) - 1;
ret->bitmask = (1<<INIT_BITS)-1;
ret->oldcode = -1;
ret->finchar = 0;
ret->posbits = 3<<3;
ret->free_ent = ((ret->block_mode) ? FIRST : 256);
/* initialize the first 256 entries in the table */
memset(ret->codetab, 0x00, sizeof(ret->codetab));
for (ret->code = 255; ret->code >= 0; --ret->code)
ret->htab[ret->code] = ret->code;
if (ret->inbuf == NULL || ret->outbuf == NULL) {
errno = ENOMEM;
goto err_out_free;
}
if (ret->maxbits > BITS) {
errno = EINVAL;
goto err_out_free;
}
return ret;
err_out:
errno = EINVAL;
return NULL;
err_out_free:
if (ret->inbuf) free(ret->inbuf);
if (ret->outbuf) free(ret->outbuf);
free(ret);
return NULL;
}
hidden_in_another_lib
lzwFile *lzw_open(const char *pathname, int flags, ...)
{
/*
* NB: This would be mode_t, but that tends to be 16-bit, and va_arg wants
* register-sized variables like int. On some compilers, passing a smaller
* value to va_arg triggers an undefined behavior warning. On the upside,
* I'm not aware of any system that matters where int doesn't work.
*/
int mode = 0;
int fd;
if (flags & O_CREAT) {
va_list ap;
va_start(ap, flags);
mode = va_arg(ap, int);
va_end(ap);
}
fd = open(pathname, flags, mode);
if (fd == -1)
return NULL;
return lzw_fdopen(fd);
}
/*
* Close LZW file.
*/
hidden_in_another_lib
int lzw_close(lzwFile *lzw)
{
int ret;
if (lzw == NULL)
return -1;
ret = close(lzw->fd);
free(lzw->inbuf);
free(lzw->outbuf);
free(lzw);
return ret;
}
/*
* Misc read-specific define cruft.
*/
#define input(b,o,c,n,m) \
do { \
unsigned char *p = &(b)[(o)>>3]; \
(c) = ((((long)(p[0]))|((long)(p[1])<<8)| \
((long)(p[2])<<16))>>((o)&0x7))&(m); \
(o) += (n); \
} while (0)
#define de_stack ((unsigned char *)&(lzw->htab[HSIZE-1]))
/*
* Read LZW file.
*/
hidden_in_another_lib
ssize_t lzw_read(lzwFile *lzw, void *readbuf, size_t count)
{
size_t count_left = count;
unsigned char *inbuf = lzw->inbuf;
unsigned char *outbuf = lzw->outbuf;
long int maxmaxcode = MAXCODE(lzw->maxbits);
if (!count || lzw->eof)
return 0;
if (lzw->stackp != NULL) {
if (lzw->outpos) {
if (lzw->outpos >= count) {
outbuf = lzw->unreadbuf;
goto empty_existing_buffer;
} else /*if (lzw->outpos < count)*/ {
memcpy(readbuf, lzw->unreadbuf, lzw->outpos);
goto resume_partial_reading;
}
}
goto resume_reading;
}
do {
resetbuf:
{
size_t i, e, o;
o = lzw->posbits >> 3;
e = o <= lzw->insize ? lzw->insize - o : 0;
for (i = 0; i < e; ++i)
inbuf[i] = inbuf[i+o];
lzw->insize = e;
lzw->posbits = 0;
}
if (lzw->insize < IN_BUFSIZE-BUFSIZE) {
if ((lzw->rsize = read(lzw->fd, inbuf+lzw->insize, BUFSIZE)) < 0)
return -1;
lzw->insize += lzw->rsize;
}
lzw->inbits = ((lzw->rsize > 0) ? (lzw->insize - lzw->insize%lzw->n_bits)<<3 :
(lzw->insize<<3) - (lzw->n_bits-1));
while (lzw->inbits > lzw->posbits) {
if (lzw->free_ent > lzw->maxcode) {
lzw->posbits = ((lzw->posbits-1) + ((lzw->n_bits<<3) -
(lzw->posbits-1 + (lzw->n_bits<<3)) % (lzw->n_bits<<3)));
++lzw->n_bits;
if (lzw->n_bits == lzw->maxbits)
lzw->maxcode = maxmaxcode;
else
lzw->maxcode = MAXCODE(lzw->n_bits)-1;
lzw->bitmask = (1 << lzw->n_bits) - 1;
goto resetbuf;
}
input(inbuf,lzw->posbits,lzw->code,lzw->n_bits,lzw->bitmask);
if (lzw->oldcode == -1) {
if (lzw->code >= 256) return -1; /* error("corrupt input."); */
outbuf[lzw->outpos++] = lzw->finchar = lzw->oldcode = lzw->code;
continue;
}
if (lzw->code == CLEAR && lzw->block_mode) {
memset(lzw->codetab, 0x00, sizeof(lzw->codetab));
lzw->free_ent = FIRST - 1;
lzw->posbits = ((lzw->posbits-1) + ((lzw->n_bits<<3) -
(lzw->posbits-1 + (lzw->n_bits<<3)) % (lzw->n_bits<<3)));
lzw->maxcode = MAXCODE(lzw->n_bits = INIT_BITS)-1;
lzw->bitmask = (1 << lzw->n_bits) - 1;
goto resetbuf;
}
lzw->incode = lzw->code;
lzw->stackp = de_stack;
/* Special case for KwKwK string.*/
if (lzw->code >= lzw->free_ent) {
if (lzw->code > lzw->free_ent) {
errno = EINVAL;
return -1;
}
*--lzw->stackp = lzw->finchar;
lzw->code = lzw->oldcode;
}
/* Generate output characters in reverse order */
while (lzw->code >= 256) {
*--lzw->stackp = lzw->htab[lzw->code];
lzw->code = lzw->codetab[lzw->code];
}
*--lzw->stackp = (lzw->finchar = lzw->htab[lzw->code]);
/* And put them out in forward order */
{
lzw->stackp_diff = de_stack - lzw->stackp;
if (lzw->outpos+lzw->stackp_diff >= BUFSIZE) {
do {
if (lzw->stackp_diff > BUFSIZE-lzw->outpos)
lzw->stackp_diff = BUFSIZE-lzw->outpos;
if (lzw->stackp_diff > 0) {
memcpy(outbuf+lzw->outpos, lzw->stackp, lzw->stackp_diff);
lzw->outpos += lzw->stackp_diff;
}
if (lzw->outpos >= BUFSIZE) {
if (lzw->outpos < count_left) {
memcpy(readbuf, outbuf, lzw->outpos);
resume_partial_reading:
readbuf += lzw->outpos;
count_left -= lzw->outpos;
} else {
empty_existing_buffer:
lzw->outpos -= count_left;
memcpy(readbuf, outbuf, count_left);
lzw->unreadbuf = outbuf + count_left;
return count;
}
resume_reading:
lzw->outpos = 0;
}
lzw->stackp += lzw->stackp_diff;
} while ((lzw->stackp_diff = (de_stack-lzw->stackp)) > 0);
} else {
memcpy(outbuf+lzw->outpos, lzw->stackp, lzw->stackp_diff);
lzw->outpos += lzw->stackp_diff;
}
}
/* Generate the new entry. */
if ((lzw->code = lzw->free_ent) < maxmaxcode) {
lzw->codetab[lzw->code] = lzw->oldcode;
lzw->htab[lzw->code] = lzw->finchar;
lzw->free_ent = lzw->code+1;
}
lzw->oldcode = lzw->incode; /* Remember previous code. */
}
} while (lzw->rsize != 0);
if (lzw->outpos < count_left) {
lzw->eof = 1;
memcpy(readbuf, outbuf, lzw->outpos);
count_left -= lzw->outpos;
return (count - count_left);
} else {
goto empty_existing_buffer;
}
}
|
vapier/liblzw | lzw_internal.h | <reponame>vapier/liblzw
/*
* Written by <NAME> <<EMAIL>>
* Released into the public domain.
*/
#ifndef _LIBLZW_INTERNAL_H
#define _LIBLZW_INTERNAL_H
#include "headers.h"
#define __IN_LIBLZW
#include <lzw.h>
#include "helpers.h"
#endif /* _LIBLZW_INTERNAL_H */
|
vapier/liblzw | tests/simple2.c | /*
* Written by <NAME> <<EMAIL>>
* Released into the public domain.
*/
#include "tests.h"
int main(int argc, char *argv[])
{
size_t cnt;
size_t numread;
char buf[1024];
lzwFile *lzw = lzw_open(argc == 2 ? argv[1] : "simple2.Z", O_RDONLY | O_BINARY);
if (lzw == NULL)
err("could not open file");
for (cnt=0; cnt<20; ++cnt) {
memset(buf, 0x41, sizeof(buf));
numread = lzw_read(lzw, buf, 10);
if (numread <= 0) {
printf("EOF\n");
break;
}
buf[12] = '\0';
printf("%zi: %s\n", numread, buf);
if (numread != 10)
printf("short read!\n");
}
if (lzw_close(lzw))
err("could not close file");
return 0;
}
|
vapier/liblzw | headers.h | /*
* Written by <NAME> <<EMAIL>>
* Released into the public domain
*/
#ifndef _LIBLZW_HEADERS_H
#define _LIBLZW_HEADERS_H
#include "config.h"
#if defined(HAVE_STDINT_H)
# include <stdint.h>
#endif
#if defined(HAVE_INTTYPES_H)
# include <inttypes.h>
#endif
#if defined(HAVE_SYS_TYPES_H)
# include <sys/types.h>
#endif
#if defined(HAVE_SYS_STAT_H)
# include <sys/stat.h>
#endif
#if defined(HAVE_CTYPE_H)
# include <ctype.h>
#endif
#if defined(HAVE_ERRNO_H)
# include <errno.h>
#else
extern int errno;
#endif
#if defined(HAVE_UNISTD_H)
# include <unistd.h>
#endif
#if defined(HAVE_FCNTL_H)
# include <fcntl.h>
#endif
#if defined(HAVE_STDIO_H)
# include <stdio.h>
#endif
#if defined(HAVE_STDLIB_H)
# include <stdlib.h>
#endif
#if defined(HAVE_TIME_H)
# include <time.h>
#endif
#if defined(HAVE_STRING_H)
# include <string.h>
#endif
#if defined(HAVE_FEATURES_H)
# include <features.h>
#endif
#if defined(HAVE_STDARG_H)
# include <stdarg.h>
#endif
#if defined(HAVE_SYS_CDEFS_H)
# include <sys/cdefs.h>
#endif
#if defined(HAVE_ASSERT_H)
# include <assert.h>
#endif
/* i'll see you in hell windows */
#if !defined(O_BINARY)
# define O_BINARY 0x00
#endif
#endif /* _LIBLZW_HEADERS_H */
|
vapier/liblzw | tests/tests.h | /*
* Written by <NAME> <<EMAIL>>
* Released into the public domain.
*/
#include "headers.h"
#include "helpers.h"
#include <lzw.h>
#define err(fmt, args...) do { warn(fmt "\n", ## args); exit(-1); } while (0)
#define errp(fmt, args...) err(fmt ": %s", strerror(errno), ## args)
|
vapier/liblzw | helpers.h | /*
* Written by <NAME> <<EMAIL>>
* Released into the public domain
*/
#ifndef _LIBLZW_HELPERS_H
#define _LIBLZW_HELPERS_H
#define _warn(fmt, args...) fprintf(stderr, fmt , ## args)
#define warn(fmt, args...) _warn("liblzw: " fmt "\n" , ## args)
#define warnf(fmt, args...) warn("%s(): " fmt, __FUNCTION__ , ## args)
#define warnp(fmt, args...) warn(fmt ": %s" , ## args , strerror(errno))
#define warnfp(fmt, args...) warnp("%s(): " fmt, __FUNCTION__ , ## args)
#define dumphex(buf, cnt) \
do { \
size_t i = 0; \
_warn("dumphex: "); \
while (i < cnt) \
_warn("%2.2X ", buf[i++]); \
_warn("\n"); \
} while (0)
#endif /* _LIBLZW_HELPERS_H */
|
vapier/liblzw | tests/lot.c | <reponame>vapier/liblzw
/*
* Written by <NAME> <<EMAIL>>
* Released into the public domain.
*/
#include "tests.h"
int main(int argc, char *argv[])
{
size_t cnt;
size_t numread;
char buf[1024];
lzwFile *lzw = lzw_open(argc == 2 ? argv[1] : "lot.Z", O_RDONLY | O_BINARY);
if (lzw == NULL)
err("could not open file");
while ((numread = lzw_read(lzw, buf, 50)) > 0) {
for (cnt=0; cnt<numread; ++cnt)
printf("%2.2X", (unsigned char)buf[cnt]);
printf("\n");
}
if (lzw_close(lzw))
err("could not close file");
return 0;
}
|
tomoyuki-nakabayashi/CppDesignPatternCatalog | behavioral/active_object/src/command.h | <gh_stars>0
#ifndef DESIGN_PATTERN_CATALOG_BEHAVIORAL_ACTIVE_OBJECT_COMMAND_H_
#define DESIGN_PATTERN_CATALOG_BEHAVIORAL_ACTIVE_OBJECT_COMMAND_H_
namespace active_object {
class Command {
public:
Command() = default;
virtual ~Command() = default;
virtual void Execute() = 0;
};
} // namespace active_object
#endif // DESIGN_PATTERN_CATALOG_BEHAVIORAL_ACTIVE_OBJECT_COMMAND_H_ |
tomoyuki-nakabayashi/CppDesignPatternCatalog | behavioral/active_object/src/active_object_engine.h | // Copyright <2018> Tomoyuki-Nakabayashi
// This software is released under the MIT License, see LICENSE.
#ifndef DESIGN_PATTERN_CATALOG_BEHAVIORAL_ACTIVE_OBJECT_ENGINE_H_
#define DESIGN_PATTERN_CATALOG_BEHAVIORAL_ACTIVE_OBJECT_ENGINE_H_
#include <vector>
#include <command.h>
namespace active_object {
class ActiveObjectEngine {
public:
ActiveObjectEngine() = default;
void AddCommand(Command *c);
void Run();
private:
std::vector<Command*> commands_;
};
} // namespace active_object
#endif // DESIGN_PATTERN_CATALOG_BEHAVIORAL_ACTIVE_OBJECT_ENGINE_H_s |
tomoyuki-nakabayashi/CppDesignPatternCatalog | behavioral/active_object/src/sleep_command.h | // Copyright <2018> Tomoyuki-Nakabayashi
// This software is released under the MIT License, see LICENSE.
#ifndef BEHAVIORAL_ACTIVE_OBJECT_SLEEP_COMMAND_H_
#define BEHAVIORAL_ACTIVE_OBJECT_SLEEP_COMMAND_H_
#include <command.h>
#include <active_object_engine.h>
#include <chrono>
#include <functional>
namespace active_object {
class WakeUpCommand : public Command {
public:
WakeUpCommand() : executed {false} {}
~WakeUpCommand() = default;
void Execute() override { executed = true; }
bool IsExecuted() { return executed; }
private:
bool executed;
};
using time_point = std::chrono::system_clock::time_point;
class SleepCommand : public Command {
public:
explicit SleepCommand(ActiveObjectEngine* = nullptr,
Command* = nullptr,
const int ms = 0);
~SleepCommand() = default;
void Execute() override;
private:
void ExecuteAtStart();
void ExecuteAfterStarted();
private:
std::function<void()> executor_;
ActiveObjectEngine *engine_;
Command *wakeup_command_;
const int sleep_time_;
time_point start_time_;
};
} // namespace active_object
#endif // BEHAVIORAL_ACTIVE_OBJECT_SLEEP_COMMAND_H_ |
bbessemer/little-programs | commentize.c | /*
* This software is hereby released into the public domain.
* You are free to use it in any way whatsoever.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
enum comment_style {
STYLE_C,
STYLE_C_ALT,
STYLE_PYTHON
};
struct options {
const char *inpath;
const char *outpath; /* stdout if NULL */
int style;
int linelen;
};
static struct options args = {
NULL,
NULL,
STYLE_C,
80
};
static const char* exename;
static void usage () {
printf("Usage: %s <input file> [-s | --style] [c | c-alt | python]\n"
"[-o | --output <output file>] [-n | --line-length <characters>]\n",
exename);
exit(-1);
}
static int parse_args (const char **remaining) {
const char *first, *second;
first = *remaining;
if (first[0] == '-') {
switch (first[1]) {
case 's': goto STYLE;
case 'o': goto OUTFILE;
case 'n': goto LINELEN;
case '-': {
if (!strcmp(first, "--style"))
goto STYLE;
else if (!strcmp(first, "--output"))
goto OUTFILE;
else if (!strcmp(first, "--line-length"))
goto LINELEN;
break;
}
case 0:
return 1;
default:
usage();
return 0;
}
} else {
args.inpath = first;
return 1;
}
STYLE:
second = remaining[1];
if (!strcmp(second, "c"))
args.style = STYLE_C;
else if (!strcmp(second, "c-alt"))
args.style = STYLE_C_ALT;
else if (!strcmp(second, "python"))
args.style = STYLE_PYTHON;
else
usage();
return 2;
OUTFILE:
args.outpath = remaining[1];
return 2;
LINELEN:
args.linelen = atoi(remaining[1]);
return 2;
}
void commentize (int argc, const char **argv) {
if (!argc) usage();
while (argc) {
int args_read = parse_args(argv);
argc -= args_read;
argv += args_read;
}
const char *beginning, *ending, *prefix;
switch (args.style) {
case STYLE_C:
beginning = "/*\n";
ending = " */\n";
prefix = " * %s\n";
break;
case STYLE_C_ALT:
beginning = "";
ending = "";
prefix = "// %s\n";
break;
case STYLE_PYTHON:
beginning = "###\n";
ending = "###\n";
prefix = "# %s\n";
break;
default:
break;
}
FILE *infile = (args.inpath ? fopen(args.inpath, "r") : stdin);
FILE *outfile = (args.outpath ? fopen(args.outpath, "w") : stdout);
fputs(beginning, outfile);
static char buffer[128];
char *lastspace = NULL;
int bufpos = 0;
int linelen = args.linelen - strlen(prefix);
int cons_newlines = 0;
while (1) {
int cc = fgetc(infile);
if (cc == ' ' || cc == 0) {
buffer[bufpos] = 0;
if (lastspace) *lastspace = ' ';
lastspace = buffer + bufpos;
cons_newlines = 0;
bufpos++;
} else if (cc == EOF) {
*lastspace = ' ';
buffer[bufpos] = 0;
fprintf(outfile, prefix, buffer);
break;
} else if (bufpos > linelen) {
//buffer[bufpos] = 0;
fprintf(outfile, prefix, buffer);
int start = strlen(++lastspace);
memmove(buffer, lastspace, start + 1);
bufpos = start;
if (cc != '\n' && cc != '\r') {
buffer[bufpos++] = cc;
cons_newlines = 0;
} else cons_newlines++;
lastspace = NULL;
} else if (cc == '\n') {
buffer[bufpos] = 0;
if (++cons_newlines == 1) {
if (lastspace) *lastspace = ' ';
lastspace = buffer + bufpos;
bufpos++;
} else if (cons_newlines == 2) {
fprintf(outfile, prefix, buffer);
fprintf(outfile, prefix, "");
bufpos = 0;
lastspace = NULL;
} else {
fprintf(outfile, prefix, "");
bufpos = 0;
lastspace = NULL;
}
} else if (cc != '\r') {
buffer[bufpos++] = cc;
cons_newlines = 0;
}
}
fputs(ending, outfile);
}
int main (int argc, const char **argv) {
exename = argv[0];
commentize(argc - 1, argv + 1);
return 0;
}
|
lshdfp726/TransitionAnimation | OCNavigation/SecondViewController.h | //
// SecondViewController.h
// OCNavigation
//
// Created by 刘松洪 on 2020/7/13.
// Copyright © 2020 刘松洪. All rights reserved.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface SecondViewController : UIViewController
@end
NS_ASSUME_NONNULL_END
|
lshdfp726/TransitionAnimation | OCNavigation/VCAnimationManager.h | //
// VCAnimationManager.h
// OCNavigation
//
// Created by 刘松洪 on 2020/7/13.
// Copyright © 2020 刘松洪. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import "LshInterActive.h"
NS_ASSUME_NONNULL_BEGIN
/**
* 专场动画处理manager,从VC剥离专场动画到此类
*/
@interface VCAnimationManager : NSObject <UINavigationControllerDelegate,UIViewControllerInteractiveTransitioning,UIViewControllerAnimatedTransitioning>
+ (instancetype)shareInstance;
@property (nonatomic, weak) LshInterActive *interactiveTransition;
@end
NS_ASSUME_NONNULL_END
|
lshdfp726/TransitionAnimation | OCNavigation/LshInterActive.h | <reponame>lshdfp726/TransitionAnimation<filename>OCNavigation/LshInterActive.h
//
// LshInterActive.h
// OCNavigation
//
// Created by 刘松洪 on 2020/7/14.
// Copyright © 2020 刘松洪. All rights reserved.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
/**
* 重写系统的交互处理类,为了把交互代码从VC里面剥离到这里
*/
@interface LshInterActive : UIPercentDrivenInteractiveTransition
- (void)setVC:(UIViewController *)vc;
@property (nonatomic, assign) BOOL isSwipe;//是否是滑动返回
@end
NS_ASSUME_NONNULL_END
|
cabustillo13/Control-Robot-by-AVR | Robot/UART.c | <reponame>cabustillo13/Control-Robot-by-AVR
/*
Biblioteca de funciones basicas de UART y manejo de interrupcion por recepcion de dato.
*/
#include "main.h"
#include "UART.h"
//Declara un parametro tipo stream de E/S:
FILE uart_io = FDEV_SETUP_STREAM(mi_putchar, mi_getchar, _FDEV_SETUP_RW);
void configurarUART(uint32_t baudRate, uint8_t intRx, uint8_t intTx) {
stdout = stdin = &uart_io; //El stream (FILE) uart_io es la E/S estandar, es decir para fputc y fgetc.
//Parametros de la comunicacion:
UBRR0 = F_CPU/16/baudRate-1; //Configuracion baudrate
UCSR0A &=~ (1<<U2X0); //Velocidad simple (1 para doble)
UCSR0B |= (1<<RXEN0); //Habilita recepcion
UCSR0B |= (1<<TXEN0); //Habilita transmision
UCSR0C |= (1<<USBS0); //1 bit de STOP
UCSR0C |= (3<<UCSZ00); //8 bits de dato
if(intRx) {
UCSR0A &=~ (1<<RXC0); //Apaga flag de interrupcion por Recepcion Completa
UCSR0B |= (1<<RXCIE0); //Habilita interrupcion RX
}
if(intTx) {
UCSR0A &=~ (1<<TXC0); //Apaga flag de interrupcion por Transmision Completa
UCSR0B |= (1<<TXCIE0); //Habilita interrupcion TX
}
}
int mi_putchar(char c, FILE *stream) {
while(!(UCSR0A & (1<<UDRE0)) ); //Espera mientras buffer de transmision este ocupado
UDR0 = c; //UDR0 recibe el nuevo dato c a transmitir.
return 0;
}
int mi_getchar(FILE *stream) {
while ( !(UCSR0A & (1<<RXC0)) ); //Espera mientras la recepcion no esta completa.
return UDR0; //Cuando se completa, se lee UDR0.
}
//-----------------------------------------------------------------------------------------//
// Rutina de Servicio de Interrupcion: //
//-----------------------------------------------------------------------------------------//
/* Rutina de Servicio de Interrupcion por recepcion de datos en UART
Espera mensajes del tipo [:][comando][\r] y lo guarda en buffer comando[]
limpiando delimitadores y agregando NULL al final del mismo para poder usar atoi*/
ISR(USART_RX_vect) { //Rutina de servicio de Interrupcion por Rx:
char dato;
switch(Estado) {
case E_desactivado:
#ifdef HabilitarPrintf
if (bandera) printf("\nEl Estado se encuentra Desactivado\n\n");
#endif
bandera=0;
dato = fgetc(); //No se usa el char dato, solamente es para limpiar el flag RXC0 de
//dato recibido, antes de salir de la ISR.
break;
case E_activado:
bandera=1;
dato = fgetc();
//printf("echo: %c\r\n",dato);
switch(dato) {
case ':': //Delimitador de inicio
indcom=0; //Inicializa indice de buffer de recepcion
flagcom = 1; //Comando en curso
break;
case 8: //Basckspace
if(indcom>0) indcom--;
break;
case '\r': //Delimitador de final (Retorno de Carro)
if(flagcom==1) { //Si hay comando en curso
comando[indcom] = 0; //Coloca NULL luego de ultimo caracter recibido
interpretarComando(); //Interpreta comando recibido
flagcom = 0; //Fin de comando en curso
}
break;
default: //Todo lo que este entre delimitadores
if(indcom<30) //Guarda en elemento del buffer e incrementa indcom:
comando[indcom++] = dato;
}
break;
}
UCSR0A &=~ (1<<RXC0); //Apaga el flag de interrupcion por RX
} |
cabustillo13/Control-Robot-by-AVR | Robot/Timers.h | <filename>Robot/Timers.h
/*
Define tipos y declara funciones para configurar los modulos de timer del Atmega328
y sus interrupciones:
El Atmega328 tiene dos timers de 8 bits (TIMER0 y TIMER2) y un timer de 16 (TIMER1)
Los modos de trabajo de TIMER0 y TIMER2 son iguales entre si, pero difieren respecto
a los del TIMER1 (este tiene mas modos).
Las opciones de prescaler de TIMER0 y TIMER1 son iguales entre si, pero difieren de
las del prescaler del TIMER2 (este no tiene los modos externos, y agrega dos modos
internos x32 y x128).
*/
#ifndef TIMERS_H_
#define TIMERS_H_
typedef enum {
Normal = 0,
PWM_PC_8b = 1,
CTC_OCRA = 2,
FAST_PWM_8b = 3,
PWM_PC_OCR = 5,
FAST_PWM_OCR = 7
}tT0y2modo; //Tipo modos de trabajo para TIMER0 y TIMER2
typedef enum {
Normal1 = 0,
PWM_PC1_8b = 1,
PWM_PC1_9b = 2,
PWM_PC1_10b = 3,
CTC_OCR1A = 4,
FAST_PWM1_8b = 5,
FAST_PWM1_9b = 6,
FAST_PWM1_10b = 7,
PWM_PyFC_ICR1 = 8,
PWM_PyFC_OCR1A = 9,
PWM_PC_ICR1 = 10,
PWM_PC_OCR1A = 11,
CTC_ICR1 = 12,
FAST_PWM_ICR1 = 14,
FAST_PWM_OCR1A = 15
}tT1modo; //Tipo modos de trabajo para TIMER1
typedef enum {
des = 0,
prex1 = 1,
prex8 = 2,
prex64 = 3,
prex256 = 4,
prex1024 = 5,
Ext_Fneg = 6,
Ext_Fpos = 7
}tT0y1pre; //Tipo prescaler para TIMER0 y TIMER1
typedef enum {
des2 = 0,
pre2x1 = 1,
pre2x8 = 2,
pre2x32 = 3,
pre2x64 = 4,
pre2x128 = 5,
pre2x256 = 6,
pre2x1024 = 7
}tT2pre; //Tipo prescaler para TIMER2
typedef enum {
sNo = 0,
sToggle = 1,
sClear = 2,
sSet = 3
}tTsalida; //Tipo salida para todos los timers
//Aqui se definen las estructuras con todos los Parametros de Configuracion
//de TIMER0, TIMER1 y TIMER2. Son estructura con campos de diversos tipos enumerados.
typedef struct {
tT0y2modo modo; //estos campos son los anteriormente definidos
tT0y1pre pre;
tTsalida OCA;
tTsalida OCB;
}tT0config;
typedef struct {
tT1modo modo;
tT0y1pre pre;
tTsalida OCA;
tTsalida OCB;
}tT1config;
typedef struct {
tT0y2modo modo;
tT2pre pre;
tTsalida OCA;
tTsalida OCB;
}tT2config;
// Aqui se definen las estructuras para activar interrupciones de
// TIMER0, TIMER1 y TIMER2.
typedef struct {
bool IT_ovf:1; //Estos campos son simplemente booleanos.
bool IT_compa:1;
bool IT_compb:1;
}tT0INTconfig;
typedef struct {
bool IT_ovf:1; //Al usar booleanos lo ideal es especificar su longitud para que
bool IT_compa:1; //sea de 1 Byte (con :1), sino genera una longitud de 3 Bytes;
bool IT_compb:1; //aunque no es necesariamente fundamental, si es que se cuenta con
bool IT_ic:1; //un Uc que dispone de mucha mas memoria de la que se necesita.
}tT1INTconfig;
typedef struct { //Esta estructura es igual a la de TIMER0
bool IT_ovf:1;
bool IT_compa:1;
bool IT_compb:1;
}tT2INTconfig;
// Declaracion de variables:
#define T_ms 16.32 //Periodo fijo [en ms]
#define ANCHO_PULSO_INICIAL 1.500 //Pulso Inicial [en ms]
#define ANCHO_PULSO_INICIAL_G 2.100 //Pulso Inicial servo Giro gripper [en ms]
#define ANCHO_PULSO_INICIAL_A 2.500 //Pulso Inicial servo Altura gripper [en ms]
#define ANCHO_PULSO_INICIAL_C 0.250 //Pulso Inicial servo Cierre-apertura gripper [en ms]
uint16_t valorPrescaler__T0;
uint16_t valorPrescaler__T1;
uint16_t valorPrescaler__T2;
tT0config T0cfg;
tT1config T1cfg;
tT2config T2cfg;
// Declaracion de las funciones:
void T0_Init(tT0config *Tcfg);
void T0_deInit(tT0config *Tcfg); //Funcion que pone parametros de estructura Tcfg
//en valores por defecto.
void T1_Init(tT1config *Tcfg);
void T1_deInit(tT1config *Tcfg); //Funcion que pone parametros de estructura Tcfg
//en valores por defecto.
void T2_Init(tT2config *Tcfg);
void T2_deInit(tT2config *Tcfg); //Funcion que pone parametros de estructura Tcfg
//en valores por defecto.
void T0_Interrupts(tT0INTconfig *Tintcfg);
void T1_Interrupts(tT1INTconfig *Tintcfg);
void T2_Interrupts(tT2INTconfig *Tintcfg);
void configurarTimer0(tT0y2modo modoOperacionT0, tT0y1pre prescalerT0, tTsalida modoSalidaA,
tTsalida modoSalidaB);
void configurarTimer1(tT1modo modoOperacionT1, tT0y1pre prescalerT1, tTsalida modoSalidaA,
tTsalida modoSalidaB);
void configurarTimer2(tT0y2modo modoOperacionT2, tT2pre prescalerT2, tTsalida modoSalidaA,
tTsalida modoSalidaB);
uint16_t valorPrescalerT0y1(tT0y1pre prescalerT0y1);
uint16_t valorPrescalerT2(tT2pre prescalerT2);
#endif /* TIMERS_H_ */ |
cabustillo13/Control-Robot-by-AVR | Robot/main.h | <reponame>cabustillo13/Control-Robot-by-AVR
#ifndef MAIN_H_
#define MAIN_H_
#define F_CPU 16000000 // para biblioteca delay y funcion de usuario de UART
#include <math.h> //
#include <stdio.h> // para UART como dispositivo estandar (printf(""), etc.)
#include <stdlib.h> // para atoi(), etc.
#include <util/delay.h> // para funcion delay
#include <avr/io.h> // definicion de regitro y bits de micro
#include <avr/interrupt.h> // definicion de vectores de interr
#include <stdbool.h> // para tipo bool en timer.h
#include "InterrupcionesINT.h"
#include "UART.h"
#include "Timers.h"
#define HabilitarPrintf //Descomentar esta linea para habilitar los printf()
//#define EstadoInicialActivado //Descomentar esta linea para iniciar con Estado Activado
#define EstadoInicialDesactivado //DesComentar esta linea para iniciar con Estado Desactivado
enum estado {E_desactivado, E_activado};
enum estado Estado;
#define ApagarTodosLosPines (PORTB &= (0<<0)) //Colocamos en estado bajo todos los pines del puerto B
//para evitar errores por ruido electromagnetico.
#define C2_OUT (DDRC |= (1<<DDC2)) //PC2 (Pin A2 arduino nano) como SALIDA
#define C3_OUT (DDRC |= (1<<DDC3)) //PC3 (Pin A3 arduino nano) como SALIDA
#define C4_OUT (DDRC |= (1<<DDC4)) //PC4 (Pin A4 arduino nano) como SALIDA
#define LedAmarilloC2_OFF (PORTC &= ~(1<<PORTC2)) //Definimos: Apagar pin 2 del puerto C
#define LedVerdeC3_OFF (PORTC &= ~(1<<PORTC3)) //Definimos: Apagar pin 3 del puerto C
#define LedRojoC4_OFF (PORTC &= ~(1<<PORTC4)) //Definimos: Apagar pin 4 del puerto C
#define LedAmarilloC2_ON (PORTC |= (1<<PORTC2)) //Definimos: Encender pin 2 del puerto C
#define LedVerdeC3_ON (PORTC |= (1<<PORTC3)) //Definimos: Encender pin 3 del puerto C
#define LedRojoC4_ON (PORTC |= (1<<PORTC4)) //Definimos: Encender pin 4 del puerto C
//_________________________________InterrupcionesINT___________________________________//
#define D2_IN (DDRD &= ~(1<<DDD2)) //PD3 [INT0] (Pin D2 arduino nano) como ENTRADA
#define D3_IN (DDRD &= ~(1<<DDD3)) //PD2 [INT1] (Pin D3 arduino nano) como ENTRADA
//_____________________________________________________________________________________//
//______________________________________UART___________________________________________//
uint16_t anguloB_CONSIGNA; //angulo servo Base
uint16_t anguloM_CONSIGNA; //anguloservo Medio
uint16_t anguloG_CONSIGNA; //angulo sevo Giro gripper
uint16_t anguloA_CONSIGNA; //angulo sevo Altura gripper
uint16_t anguloC_CONSIGNA; //angulo sevo Cierre gripper
float duracionPulsoB; //Duraciones de Pulsos en ms:
float duracionPulsoM;
float duracionPulsoG;
float duracionPulsoA;
float duracionPulsoC;
void interpretarComando(void);
//_____________________________________________________________________________________//
//______________________________________Timers_________________________________________//
#define B1_SERVO_BASE (DDRB |= (1<<DDB1)) //PB1 [OC1A] (Pin D9 arduino nano) como SALIDA
#define B2_SERVO_MEDIO (DDRB |= (1<<DDB2)) //PB2 [OC1B] (Pin D10 arduino nano) como SALIDA
#define D5_SERVO_GIRO_GRIPPER (DDRD |= (1<<DDD5)) //PD5 [OC0B] (Pin D5 arduino nano) como SALIDA
#define D6_SERVO_ALTURA_GRIPPER (DDRD |= (1<<DDD6)) //PD6 [OC0A] (Pin D6 arduino nano) como SALIDA
#define B3_SERVO_CIERRE_GRIPPER (DDRB |= (1<<DDB3)) //PB3 [OC2A] (Pin D11 arduino nano) como SALIDA
//_____________________________________________________________________________________//
#endif /* MAIN_H_ */ |
cabustillo13/Control-Robot-by-AVR | Robot/InterrupcionesINT.h | <gh_stars>0
#ifndef INTERRUPCIONESINT_H_
#define INTERRUPCIONESINT_H_
#define INT0_ON (EIMSK |= (1<<INT0)) //Habilita la interrupcion externa en INT0 (Pin Digital 2)
#define INT0_OFF (EIMSK &=~ (1<<INT0)) //-
#define flagINT0_OFF (EIFR &=~ (1<<INTF0)) //Apaga el Flag de la interrupcion externa en INT0 (Pin Digital 2)
#define INT0_test (PIND & (1<<PIND2)) //Verifica si INT0 (Pin Digital 2) se encuentra en alto
#define INT0_nivelBajo (EICRA &=~ (3<<ISC00)) //-
#define INT0_cualquierFlanco (EICRA |= (1<<ISC00)) //-
#define INT0_flancoBajada (EICRA |= (2<<ISC00)) //-
#define INT0_flancoSubida (EICRA |= (3<<ISC00)) //Elige el evento 'Flanco de Subida' para la activacion del flag de INT0
#define INT1_ON (EIMSK |= (1<<INT1)) //Habilita la interrupcion externa en INT1 (Pin Digital 3)
#define INT1_OFF (EIMSK &=~ (1<<INT1)) //-
#define flagINT1_OFF (EIFR &=~ (1<<INTF1)) //Apaga el Flag de la interrupcion externa en INT1 (Pin Digital 3)
#define INT1_test (PIND & (1<<PIND3)) //Verifica si INT1 (Pin Digital 3) se encuentra en alto
#define INT1_nivelBajo (EICRA &=~ (3<<ISC10)) //-
#define INT1_cualquierFlanco (EICRA |= (1<<ISC10)) //-
#define INT1_flancoBajada (EICRA |= (2<<ISC10)) //-
#define INT1_flancoSubida (EICRA |= (3<<ISC10)) //Elige el evento 'Flanco de Subida' para la activacion del flag de INT1
void configurarINT0(void);
void configurarINT1(void);
#endif /* INTERRUPCIONESINT_H_ */ |
cabustillo13/Control-Robot-by-AVR | Robot/InterrupcionesINT.c | <reponame>cabustillo13/Control-Robot-by-AVR
#include "main.h"
#include "InterrupcionesINT.h"
void configurarINT0(void) {
INT0_flancoSubida; //Elige el evento 'Flanco de Subida' para la activacion del flag de INT0.
flagINT0_OFF; //Es una buena practica apagar el flag de la interrupcion antes de habilitarla.
INT0_ON; //Habilita la interrupcion externa INT0.
}
void configurarINT1(void) {
INT1_flancoSubida; //Elige el evento 'Flanco de Subida' para la activacion del flag de INT1.
flagINT1_OFF; //Es una buena practica apagar el flag de la interrupcion antes de habilitarla.
INT1_ON; //Habilita la interrupcion externa INT1.
}
|
cabustillo13/Control-Robot-by-AVR | Robot/Timers.c | <reponame>cabustillo13/Control-Robot-by-AVR
#include "main.h"
#include "Timers.h"
//Incializa estructura Tcfg de forma que T0_Init configure
//al TIMER0 con los valores de Reset (no modifica registros):
void T0_deInit(tT0config * Tcfg) {
Tcfg->modo=Normal;
Tcfg->pre=des;
Tcfg->OCA=sNo;
Tcfg->OCB=sNo;
}
//Incializa estructura Tcfg de forma que T1_Init configure
//al TIMER1 con los valores de Reset (no modifica registros):
void T1_deInit(tT1config * Tcfg) {
Tcfg->modo=Normal1;
Tcfg->pre=des;
Tcfg->OCA=sNo;
Tcfg->OCB=sNo;
}
//Incializa estructura Tcfg de forma que T2_Init configure
//al TIMER2 con los valores de Reset (no modifica registros):
void T2_deInit(tT2config * Tcfg) {
Tcfg->modo=Normal;
Tcfg->pre=des2;
Tcfg->OCA=sNo;
Tcfg->OCB=sNo;
}
//Configura pines como salidas, y sus Modos de Salida: toggle, clear o set (1, 2 o 3):
void T0_Init(tT0config * Tcfg) {
if (Tcfg->OCA) DDRD|=(1<<DDB6); //OC0A es PD6 en Atmega328
if (Tcfg->OCB) DDRD|=(1<<DDB5); //OC2B es PD5
//Los tipos enumerados son tipo int.
TCCR0A = (Tcfg->OCA <<COM0A0)|(Tcfg->OCB<<COM0B0)|(Tcfg->modo&0x03); //Configura Modo Operacional,..
TCCR0B = (((Tcfg->modo)<<1)&8)|Tcfg->pre; //..Prescaler y Modo de Salida en los dos registros TCCR.
}
void T1_Init(tT1config * Tcfg) {
if (Tcfg->OCA) DDRB|=(1<<DDB1); //OC1A es PB1
if (Tcfg->OCB) DDRB|=(1<<DDB2); //OC1B es PB2
TCCR1A = (Tcfg->OCA <<COM1A0)|(Tcfg->OCB<<COM1B0)|(Tcfg->modo&0x03);
TCCR1B = (((Tcfg->modo)<<1)&0x18)|(Tcfg->pre);
}
void T2_Init(tT2config * Tcfg) {
if (Tcfg->OCA) DDRB|=(1<<DDB3); //OC2A es PB3
if (Tcfg->OCB) DDRD|=(1<<DDB3); //OC2B es PD3
TCCR2A = (Tcfg->OCA <<COM2A0)|(Tcfg->OCB<<COM2B0)|(Tcfg->modo&0x03);
TCCR2B = (((Tcfg->modo)<<1)&8)|Tcfg->pre;
}
//Habilitacion de interrupciones de software de los timers:
void T0_Interrupts(tT0INTconfig *T0i) {
TIMSK0=(T0i->IT_compb)<<OCIE0B|(T0i->IT_compa)<<OCIE0A|(T0i->IT_ovf)<<TOIE0;
TIFR0=(T0i->IT_compb)<<OCF0B|(T0i->IT_compa)<<OCF0A|(T0i->IT_ovf)<<TOV0; //apagado de flag
}
void T1_Interrupts(tT1INTconfig *T1i) {
TIMSK1=(T1i->IT_ic)<<ICIE1|(T1i->IT_compb)<<OCIE1B|(T1i->IT_compa)<<OCIE1A|(T1i->IT_ovf)<<TOIE1;
TIFR1=(T1i->IT_ic)<<ICF1|(T1i->IT_compb)<<OCF1B|(T1i->IT_compa)<<OCF1A|(T1i->IT_ovf)<<TOV1;
}
void T2_Interrupts(tT2INTconfig *T2i) {
TIMSK2=(T2i->IT_compb)<<OCIE2B|(T2i->IT_compa)<<OCIE2A|(T2i->IT_ovf)<<TOIE2;
TIFR2=(T2i->IT_compb)<<OCF2B|(T2i->IT_compa)<<OCF2A|(T2i->IT_ovf)<<TOV2; //borra solo..
} //..los flags de int habilitadas
void configurarTimer0(tT0y2modo modoOperacionT0, tT0y1pre prescalerT0, tTsalida modoSalidaA, tTsalida modoSalidaB) {
T0_deInit(&T0cfg);
T0cfg.modo = modoOperacionT0;
#ifdef EstadoInicialActivado
T0cfg.pre = prescalerT0;
#endif
#ifdef EstadoInicialDesactivado
T0cfg.pre = des; //TIMER0 comienza en Estado Desactivado
#endif
T0cfg.OCA = modoSalidaA;
T0cfg.OCB = modoSalidaB;
T0_Init(&T0cfg);
valorPrescaler__T0=valorPrescalerT0y1(prescalerT0);
OCR0A = (uint16_t)( (ANCHO_PULSO_INICIAL_A/1000)*(F_CPU/valorPrescaler__T0) +1 ); //Servo A
OCR0B = (uint16_t)( (ANCHO_PULSO_INICIAL_G/1000)*(F_CPU/valorPrescaler__T0) +1 ); //Servo G
}
void configurarTimer1(tT1modo modoOperacionT1, tT0y1pre prescalerT1, tTsalida modoSalidaA,
tTsalida modoSalidaB) {
/* Config Timer1:
T1cfg esta declarada en Timers.h como variable tipo tT1config
tT1config esta definida en Timers.h como una estructura con campos
de diversos tipos enumerados, lo que facilita su llenado.*/
T1_deInit(&T1cfg); //Incializa estructura de forma que T1_Init configure al TIMER1 con los valores
//de Reset (buena practica), aunque no es necesario si llenamos todos los parametros.
T1cfg.modo = modoOperacionT1;
#ifdef EstadoInicialActivado
T1cfg.pre = prescalerT1;
#endif
#ifdef EstadoInicialDesactivado
T1cfg.pre = des; //TIMER1 comienza en Estado Desactivado
#endif
T1cfg.OCA = modoSalidaA;
T1cfg.OCB = modoSalidaB;
// Hasta aqui solamente se ha cargado la variable T1cfg con datos, no se ha
// modificado ningun registro del Timer1 del micro.
T1_Init(&T1cfg); // Llama a la funcion que va a configurar al Timer1 con los
// parametros cargados en T1cfg.
valorPrescaler__T1=valorPrescalerT0y1(prescalerT1);
ICR1 = (uint16_t)( (T_ms/1000)*(F_CPU/valorPrescaler__T1) +1 ); //Controla Periodo de los PWM en Timer1
OCR1A = (uint16_t)( (ANCHO_PULSO_INICIAL/1000)*(F_CPU/valorPrescaler__T1) +1 ); //Servo B
OCR1B = (uint16_t)( (ANCHO_PULSO_INICIAL/1000)*(F_CPU/valorPrescaler__T1) +1 ); //Servo M
}
void configurarTimer2(tT0y2modo modoOperacionT0y2,tT2pre prescalerT2, tTsalida modoSalidaA,
tTsalida modoSalidaB) {
T2_deInit(&T2cfg);
T2cfg.modo = modoOperacionT0y2;
#ifdef EstadoInicialActivado
T2cfg.pre = prescalerT2;
#endif
#ifdef EstadoInicialDesactivado
T2cfg.pre = des2; //TIMER2 comienza en Estado Desactivado
#endif
T2cfg.OCA = modoSalidaA;
T2cfg.OCB = modoSalidaB;
T2_Init(&T2cfg);
valorPrescaler__T2=valorPrescalerT2(prescalerT2);
OCR2A = (uint16_t)( (ANCHO_PULSO_INICIAL_C/1000)*(F_CPU/valorPrescaler__T2) +1 ); //Servo C
//OCR2B = (uint16_t)( (ANCHO_PULSO_INICIAL/1000)*(F_CPU/valorPrescaler__T2) +1 );
}
uint16_t valorPrescalerT0y1(tT0y1pre prescalerT0y1) { //Valor numerico del prescaler para TIMER0 y TIMER1
switch(prescalerT0y1) {
case des:
return 0;
break;
case prex1:
return 1;
break;
case prex8:
return 8;
break;
case prex64:
return 64;
break;
case prex256:
return 256;
break;
case prex1024:
return 1024;
break;
case Ext_Fneg:
return 0;
break;
case Ext_Fpos:
return 0;
break;
default:
return 0;
break;
}
}
uint16_t valorPrescalerT2(tT2pre prescalerT2) { //Valor numerico del prescaler para TIMER2
switch(prescalerT2) {
case des2:
return 0;
break;
case pre2x1:
return 1;
break;
case pre2x8:
return 8;
break;
case pre2x32:
return 32;
break;
case pre2x64:
return 64;
break;
case pre2x128:
return 128;
break;
case pre2x256:
return 256;
break;
case pre2x1024:
return 1024;
break;
default:
return 0;
break;
}
} |
junohkubo/Koopman_from_equations | dual_computation.c | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <time.h>
//--- The following constants can be changed to obtain more accurate results while a longer computational time is needed.
#define MAX_STATE_RANGE 30 // Perform cutoff for the state over MAX_STATE_RANGE for each dimension.
#define MAX_M 50 // Perform the resolvent calculation up to MAX_M.
#define CONV_DICIMAL_PLACE 5 // Evaluate the result with convergence at the decimal place CONV_DICIMAL_PLACE.
#define MAX_ID 10000
#define MAX_LEN_STR 4096
#define TRUE 1
#define FALSE 0
typedef long long int int64; // 64 bit integer
// Declare global variables from .inp files.
// *** NOTE:
// *** ori_event: The original events in the input file
// *** event: Events with the same state change (but different rate constants)
static int NUM_ORI_EVENT; // The number of ori_events
static int NUM_EVENT; // The number of events (without state-change dupilication)
static int DIM_STATE; // The dimension of state (the number of components)
static int NUM_CONSTANT; // The number of constants in the input file
//--- The followings are used for the correspondence between ori_events and events.
static int **ORI_EVENT;
static int **EVENT;
static double *ORI_RATE;
static int **ORI_INDEX4RATE;
static int **ORI_INDEX4CONST;
static int *LIST_LEN_E2ORI;
static int *LIST_START_INDEX_E2ORI;
//--- The followings are needed to calculate entities of the resolvent.
static int ID_DIAGONAL_EVENT;
static double *PRUNING_COEFF_POS;
static double *PRUNING_COEFF_NEG;
static double FINAL_TIME;
static int *INITIAL_STATE;
static int *TARGET_STATE;
static double *CONSTS;
// Declare working global variables.
static double *ORI_COEFF;
static int **ORI_STATE;
static double *ORI_EVENT_CONST_RATE;
static double *COEFF;
static int **STATE;
// Declare subroutines for the evaluation.
void load_event_file(char *filename);
void load_parameter_file(char *filename);
void initialize_settings_for_dual_comp(void);
void set_pruning_coeffs(void);
void set_state_from_str(int *state, char *str);
//int is_pruned(int *current, int length);
int is_pruned(int *current, int *target, int length);
int is_out_of_range(int *current);
double evaluate_resolvent_for_1st(double *c, double dt, int *target);
double evaluate_resolvent(double dt);
void calculate_rate_coeffs(void);
double occur_event(int event, int *index, double dt_M);
void aitken(double *seq, int len);
// Declare subroutines for file open and memory allocations.
FILE *f_open(const char *path, const char *mode);
void *clear_alloc(size_t size, size_t nobj);
void **clear_alloc_2d( size_t size, size_t row, size_t column);
#define free_2d(p) {free(p[0]);free(p);}
void free_memories_allocated_in_load_event_file(void);
int main(int argc, char *argv[]){
if(argc != 3){
fprintf(stderr, "Usage: ./app_dual_computation event_input_file parameter_input_file\n" );
fprintf(stderr, "example: ./analysis tmp_event.inp tmp_parameters.inp\n" );
exit(1);
}
clock_t start_clock, end_clock;
start_clock = clock();
// Load the .inp files (event and parameter).
load_event_file(argv[1]);
INITIAL_STATE = (int*)clear_alloc(sizeof(int), DIM_STATE);
TARGET_STATE = (int*)clear_alloc(sizeof(int), DIM_STATE);
CONSTS = (double*)clear_alloc(sizeof(double), NUM_CONSTANT);
load_parameter_file(argv[2]);
// Initialize settings.
initialize_settings_for_dual_comp();
// Perform the main calculation.
double comp = evaluate_resolvent(FINAL_TIME);
printf("%e\n", comp);
// Output the CPU time.
end_clock = clock();
double cpu_time;
cpu_time = (double)(end_clock - start_clock) / CLOCKS_PER_SEC;
fprintf(stderr, "CPU TIME: %f\n", cpu_time);
// Free the allocated memories.
free(ORI_EVENT_CONST_RATE);
free_2d(ORI_STATE);
free_2d(STATE);
free(ORI_COEFF);
free(COEFF);
free_memories_allocated_in_load_event_file();
free(PRUNING_COEFF_NEG);
free(PRUNING_COEFF_POS);
free(CONSTS);
free(TARGET_STATE);
free(INITIAL_STATE);
return 0;
}
// -----------------------------------------------------------
// Subroutines
// -----------------------------------------------------------
void load_event_file(char *filename){
FILE *fp;
char buf[MAX_LEN_STR];
char str_state_changes[MAX_LEN_STR];
char str_state_changes_previous[MAX_LEN_STR];
char str_rate_coeff[MAX_LEN_STR];
char str_rate_factors[MAX_LEN_STR];
char str_rate_constants[MAX_LEN_STR];
fp = f_open(filename, "r");
// -- Skip the first line.
fgets(buf, sizeof(buf), fp);
// -- Read parameters.
fscanf(fp, "%d %d %d %d\n", &NUM_ORI_EVENT, &NUM_EVENT, &DIM_STATE, &NUM_CONSTANT);
// -- Skip the third line.
fgets(buf, sizeof(buf), fp);
// Allocate memories.
ORI_EVENT = (int**)clear_alloc_2d(sizeof(int), NUM_ORI_EVENT, DIM_STATE);
EVENT = (int**)clear_alloc_2d(sizeof(int), NUM_EVENT, DIM_STATE);
ORI_RATE = (double*)clear_alloc(sizeof(double), NUM_ORI_EVENT);
ORI_INDEX4RATE = (int**)clear_alloc_2d(sizeof(int), NUM_ORI_EVENT, DIM_STATE);
ORI_INDEX4CONST = (int**)clear_alloc_2d(sizeof(int), NUM_ORI_EVENT, NUM_CONSTANT);
LIST_LEN_E2ORI = (int*)clear_alloc(sizeof(int), NUM_EVENT + 1); // '+1' is needed for the case in which the diagonal part is zero.
LIST_START_INDEX_E2ORI = (int*)clear_alloc(sizeof(int), NUM_EVENT);
for(int i = 0; i < NUM_EVENT+1; i++){
LIST_LEN_E2ORI[i] = 0;
}
int e = 0;
int ori_e = 0;
int is_there_a_diagonal_event = FALSE;
strcpy(str_state_changes_previous, "");
while(fgets(buf, sizeof(buf), fp) != NULL){
char str_tmp[4096];
if(*buf == '\n' || buf[0] == ' ') continue;
sscanf(buf,"%[^/] / %[^/] / %[^/] / %[^#]", str_state_changes, str_rate_coeff, str_rate_factors, str_rate_constants);
{
// Read state_change.
if(strcmp(str_state_changes, str_state_changes_previous) != 0){
// Set EVENT and ORI_EVENT.
char tmp[4096];
strcpy(tmp, str_state_changes);
char *tp;
int c = 0;
int is_zero_change = TRUE;
tp = strtok(tmp, " ,[]");
ORI_EVENT[ori_e][c] = atoi(tp);
EVENT[e][c] = atoi(tp);
if(EVENT[e][c] != 0){
is_zero_change = FALSE;
}
c++;
while(tp != NULL){
tp = strtok(NULL," ,[]");
if (tp != NULL){
ORI_EVENT[ori_e][c] = atoi(tp);
EVENT[e][c] = atoi(tp);
if(EVENT[e][c] != 0){
is_zero_change = FALSE;
}
c++;
}
}
// Set the correspondence from the event to the ori_event.
LIST_START_INDEX_E2ORI[e] = ori_e;
LIST_LEN_E2ORI[e]++;
// Check whether there is an no-state-change event or not.
if(is_zero_change == TRUE){
is_there_a_diagonal_event = TRUE;
ID_DIAGONAL_EVENT = e;
}
e++;
}else{
// Set only ORI_EVENT.
char tmp[4096];
strcpy(tmp, str_state_changes);
char *tp;
int c = 0;
int is_zero_change = TRUE;
tp = strtok(tmp, " ,[]");
ORI_EVENT[ori_e][c] = atoi(tp);
c++;
while(tp != NULL){
tp = strtok(NULL," ,[]");
if (tp != NULL){
ORI_EVENT[ori_e][c] = atoi(tp);
c++;
}
}
// Set the correspondence from the event to the ori_event.
LIST_LEN_E2ORI[e-1]++;
}
strcpy(str_state_changes_previous, str_state_changes);
{
// Read rate_coeff.
ORI_RATE[ori_e] = atof(str_rate_coeff);
}
{
// Read rate_factors.
char *tp;
int c = 0;
tp = strtok(str_rate_factors, " ,[]");
ORI_INDEX4RATE[ori_e][c] = atoi(tp);
c++;
while(tp != NULL){
tp = strtok(NULL," ,[]");
if (tp != NULL){
ORI_INDEX4RATE[ori_e][c] = atoi(tp);
c++;
}
}
}
{
// Read index for constant.
char *tp;
int c = 0;
tp = strtok(str_rate_constants, " ,[]");
ORI_INDEX4CONST[ori_e][c] = atoi(tp);
c++;
while(tp != NULL){
tp = strtok(NULL," ,[]");
if (tp != NULL){
ORI_INDEX4CONST[ori_e][c] = atoi(tp);
c++;
}
}
}
ori_e++;
}
}
fclose(fp);
if(is_there_a_diagonal_event == FALSE){
ID_DIAGONAL_EVENT = NUM_EVENT;
}
}
void load_parameter_file(char *filename){
FILE *fp;
char buf[MAX_LEN_STR];
fp = f_open(filename, "r");
// -- Read the final time.
fgets(buf, sizeof(buf), fp); // Skip a comment.
fgets(buf, sizeof(buf), fp);
sscanf(buf, "%lf ", &FINAL_TIME);
// -- Read the initial state.
fgets(buf, sizeof(buf), fp); // Skip a comment.
fgets(buf, sizeof(buf), fp);
set_state_from_str(INITIAL_STATE, buf);
// -- Read the target state.
fgets(buf, sizeof(buf), fp); // Skip a comment.
fgets(buf, sizeof(buf), fp);
set_state_from_str(TARGET_STATE, buf);
// -- Read the parameters.
fgets(buf, sizeof(buf), fp); // Skip a comment.
for(int i=0; i<NUM_CONSTANT; i++){
fgets(buf, sizeof(buf), fp);
double comp;
sscanf(buf, "%lf ", &comp);
CONSTS[i] = comp;
}
fclose(fp);
}
void free_memories_allocated_in_load_event_file(void){
free_2d(ORI_EVENT);
free_2d(EVENT);
free(ORI_RATE);
free_2d(ORI_INDEX4RATE);
free_2d(ORI_INDEX4CONST);
free(LIST_LEN_E2ORI);
free(LIST_START_INDEX_E2ORI);
}
void initialize_settings_for_dual_comp(void){
/// Set coefficients for the pruning.
set_pruning_coeffs();
// Memory allocation.
COEFF = (double*)clear_alloc(sizeof(double), MAX_ID);
ORI_COEFF = (double*)clear_alloc(sizeof(double), MAX_ID);
STATE = (int**)clear_alloc_2d(sizeof(int), MAX_ID, DIM_STATE);
ORI_STATE = (int**)clear_alloc_2d(sizeof(int), MAX_ID, DIM_STATE);
ORI_EVENT_CONST_RATE = (double*)clear_alloc(sizeof(double), NUM_ORI_EVENT);
}
void set_pruning_coeffs(void){
// Find the maximum step in the positive and negative directions in each dimension.
PRUNING_COEFF_POS = (double*)clear_alloc(sizeof(double), DIM_STATE);
PRUNING_COEFF_NEG = (double*)clear_alloc(sizeof(double), DIM_STATE);
for(int d = 0; d < DIM_STATE; d++){
int max = 0;
int min = 0;
for(int e = 0; e < NUM_EVENT; e++){
if(EVENT[e][d] > max){
max = EVENT[e][d];
}
if(EVENT[e][d] < min){
min = EVENT[e][d];
}
}
if(max != 0){
PRUNING_COEFF_POS[d] = 1.0/(double)max;
}else{
fprintf(stderr, "There is no event with positive direction in %d th dimension.", d);
}
if(min != 0){
PRUNING_COEFF_NEG[d] = 1.0/(double)min;
}else{
fprintf(stderr, "There is no event with negative direction in %d th dimension.", d);
}
}
}
void set_state_from_str(int *state, char *str){
char *tp;
int d = 0;
tp = strtok(str, " ,'\"");
state[d] = atoi(tp);
d++;
while (tp != NULL){
tp = strtok(NULL," ,'\"");
if (tp != NULL){
state[d] = atoi(tp);
d++;
}
}
if(d != DIM_STATE){
fprintf(stderr, "The dimension of initial states is not adequate!\n");
exit(1);
}
}
int is_pruned(int *current, int *target, int length){
// Calculate the number of steps required in each dimension and take the sum of them.
double dist;
for(int d = 0; d < DIM_STATE; d++){
double comp = (double)(current[d]-target[d]);
if(comp >= 0.0){
double comp_pos = PRUNING_COEFF_POS[d] * comp;
if(dist < comp_pos){
dist = comp_pos;
}
}else{
double comp_neg = PRUNING_COEFF_NEG[d] * comp;
if(dist < comp_neg){
dist = comp_neg;
}
}
}
// Judge whether the distance is over the length or not.
if(dist <= length){
return FALSE; // not to be pruned
}else{
return TRUE; // to be pruned
}
}
int is_out_of_range(int *current){
for(int d = 0; d < DIM_STATE; d++){
if(current[d] > MAX_STATE_RANGE){
return TRUE;
}
}
return FALSE;
}
double evaluate_resolvent(double dt){
int M;
int64 num_of_terms, pre_num_of_terms;
double pre_result;
double current_result;
double working_coeffs;
int *working_state;
working_state = (int*)clear_alloc(sizeof(int), DIM_STATE);
// Evalate constant rates (coefficients).
for(int e = 0; e < NUM_ORI_EVENT; e++){
double comp = ORI_RATE[e];
for(int i = 0; i < NUM_CONSTANT; i++){
comp = comp * pow(CONSTS[i], (double)ORI_INDEX4CONST[e][i]);
}
ORI_EVENT_CONST_RATE[e] = comp;
}
// Prepare sequences of differentials.
// NOTE: To evaluate the extrapolation from the resolvent calculation, sequences of differentials are evaluated.
// The weighted sum is evaluated as the final result.
int num_diff = 4; // Calculate the sequences of differentials up to the order num_diff.
double **seq;
seq = (double**)clear_alloc_2d(sizeof(double), num_diff, MAX_M+1);
M = num_diff;
// Prepare the temporal output file for the sequences of differentials.
FILE *fp;
fp = f_open("seq.dat", "w");
int is_conv = FALSE;
while(M <= MAX_M && is_conv == FALSE){
double dt_M = dt / (double)M;
double first_rate, final_rate;
{
// Calculate the first and final rates. These are multiplied in the final result.
double rate = 0.0;
for(int j = 0; j < LIST_LEN_E2ORI[ID_DIAGONAL_EVENT]; j++){
int pre_e = LIST_START_INDEX_E2ORI[ID_DIAGONAL_EVENT] + j;
double state_dependent_rate = 1.0;
for(int d = 0; d < DIM_STATE; d++){
for(int fact = 0; fact < ORI_INDEX4RATE[pre_e][d]; fact++){
state_dependent_rate = state_dependent_rate * (double)(INITIAL_STATE[d] - fact);
}
}
rate = rate + state_dependent_rate * ORI_EVENT_CONST_RATE[pre_e];
}
first_rate = 1.0 - dt_M*rate;
// Thr followings are not needed when the diagonal part does not include a constant.
rate = 0.0;
for(int j = 0; j < LIST_LEN_E2ORI[ID_DIAGONAL_EVENT]; j++){
int pre_e = LIST_START_INDEX_E2ORI[ID_DIAGONAL_EVENT] + j;
double state_dependent_rate = 1.0;
for(int d = 0; d < DIM_STATE; d++){
for(int fact = 0; fact < ORI_INDEX4RATE[pre_e][d]; fact++){
state_dependent_rate = state_dependent_rate * (double)(TARGET_STATE[d] - fact);
}
}
rate = rate + state_dependent_rate * ORI_EVENT_CONST_RATE[pre_e];
}
final_rate = 1.0/(1.0 - dt_M*rate);
}
// Perform the initialization for each M.
for(int d = 0; d < DIM_STATE; d++){
STATE[0][d] = INITIAL_STATE[d];
}
COEFF[0] = 1.0;
num_of_terms = 1;
// Calculate coefficients and states iteratively.
for(int depth = 1; depth <= M; depth++){
// Copy the obtained states in the previous calculation.
pre_num_of_terms = num_of_terms;
for(int64 i = 0; i < pre_num_of_terms; i++){
ORI_COEFF[i] = COEFF[i];
for(int d = 0; d < DIM_STATE; d++){
ORI_STATE[i][d] = STATE[i][d];
}
}
num_of_terms = 0;
for(int64 i = 0; i < pre_num_of_terms; i++){
for(int e = 0; e < NUM_EVENT; e++){
for(int d = 0; d < DIM_STATE; d++){
working_state[d] = ORI_STATE[i][d];
}
working_coeffs = occur_event(e, working_state, dt_M);
if(working_coeffs == 0.0){
continue;
}
// Check whether the new state is a candidate or not.
if(is_pruned(working_state, TARGET_STATE, M-depth+1) == TRUE){
continue;
}
if(is_out_of_range(working_state) == TRUE){
continue;
}
// Check whether the state has already appeared or not.
int is_already_appeared = FALSE;
int64 detected_index;
for(int64 j = 0; j < num_of_terms; j++){
int is_different = FALSE;
for(int d = 0; d < DIM_STATE; d++){
if(working_state[d] != STATE[j][d]){
is_different = TRUE;
break;
}
}
if(is_different == TRUE){
continue;
}else{
is_already_appeared = TRUE;
detected_index = j;
break;
}
}
if(is_already_appeared == TRUE){
// Revise the obtained coefficients.
// [CAUTION] This code could cause the problem of "cancellation of significant digits"...
COEFF[detected_index] = COEFF[detected_index] + ORI_COEFF[i]*working_coeffs;
}else{
// Add the new index.
COEFF[num_of_terms] = ORI_COEFF[i]*working_coeffs;
for(int d = 0; d < DIM_STATE; d++){
STATE[num_of_terms][d] = working_state[d];
}
num_of_terms += 1;
if(num_of_terms >= MAX_ID){
fprintf(stderr, "ERROR: The number of IDs is insufficient. Use larger MAX_ID.\n");
exit(1);
}
}
}
}
}
// Check the convergence.
for(int i = 0; i < num_of_terms; i++){
// Check whether the state is the target one or not.
int is_target_state = TRUE;
for(int d = 0; d < DIM_STATE; d++){
if(STATE[i][d] != TARGET_STATE[d]){
is_target_state = FALSE;
break;
}
}
if(is_target_state == TRUE){
seq[0][M] = first_rate * COEFF[i] * final_rate;
double coeff, intercept;
// Evaluate the intercept (iteratively).
for(int i_extra = 0; i_extra < num_diff-1; i_extra++){
coeff = (seq[i_extra][M] - seq[i_extra][M-1])/(1.0/(double)M - 1.0/(double)(M-1));
intercept = seq[i_extra][M] - coeff*(1.0/(double)M);
seq[i_extra+1][M] = intercept;
}
// Check whether a sequence of differentials is converged or not.
// NOTE: The original sequence is excluded.
for(int i_extra = 1; i_extra < num_diff; i_extra++){
char str1[256], str2[256];
sprintf(str1, "%+.10e", seq[i_extra][M]);
sprintf(str2, "%+.10e", seq[i_extra][M-1]);
int is_same = TRUE;
for(int ch = 0; ch <= CONV_DICIMAL_PLACE+2; ch++){
if(str1[ch] != str2[ch]){
is_same = FALSE;
}
}
if(is_same == TRUE){
is_conv = TRUE;
}
}
//fprintf(fp, "%3d", M);
fprintf(fp, "%3d %e", M, 1/(double)M);
for(int i = 0; i < num_diff; i++){
fprintf(fp, " %+.10e", seq[i][M]);
}
fprintf(fp, "\n");
break;
}
}
M += 1;
}
M = M-1;
// Evaluate the weighted sum.
// NOTE: The original sequence is excluded.
double *w;
w = (double*)clear_alloc(sizeof(double), num_diff+1);
double eps = 1.0e-5;
int start = 1;
for(int i = start; i < num_diff; i++){
w[i] = 1.0/(fabs(seq[i][M] - seq[i][M-1]) + eps);
}
double sum = 0.0;
for(int i = start; i < num_diff; i++){
sum += w[i];
}
for(int i = start; i < num_diff; i++){
w[i] = w[i]/sum;
}
double total_result = 0.0;
for(int i = start; i < num_diff; i++){
total_result += w[i]*seq[i][M];
}
fclose(fp);
free(w);
free(working_state);
free_2d(seq);
return total_result;
}
double occur_event(int event, int *state, double dt_M){
// Make the next state caused by the event.
int is_valid_next_state = TRUE;
for(int d = 0; d < DIM_STATE; d++){
// If the next state is in the negative region, it is not valid.
if(state[d] + EVENT[event][d] < 0){
is_valid_next_state = FALSE;
break;
}
}
if(is_valid_next_state == FALSE){
return 0.0;
}
// Calculate the denominator.
double rate = 0.0;
for(int j = 0; j < LIST_LEN_E2ORI[ID_DIAGONAL_EVENT]; j++){
int pre_e = LIST_START_INDEX_E2ORI[ID_DIAGONAL_EVENT] + j;
double state_dependent_rate = 1.0;
for(int d = 0; d < DIM_STATE; d++){
for(int fact = 0; fact < ORI_INDEX4RATE[pre_e][d]; fact++){
state_dependent_rate = state_dependent_rate * (double)(state[d] - fact);
}
}
rate = rate + state_dependent_rate * ORI_EVENT_CONST_RATE[pre_e];
}
double denom_inv;
denom_inv = 1.0/(1.0 - dt_M*rate);
if(event == ID_DIAGONAL_EVENT){
return denom_inv;
}else{
denom_inv = denom_inv*denom_inv;
rate = 0.0;
for(int j = 0; j < LIST_LEN_E2ORI[event]; j++){
int pre_e = LIST_START_INDEX_E2ORI[event] + j;
double state_dependent_rate = 1.0;
for(int d = 0; d < DIM_STATE; d++){
for(int fact = 0; fact < ORI_INDEX4RATE[pre_e][d]; fact++){
state_dependent_rate = state_dependent_rate * (double)(state[d] - fact);
}
}
rate = rate + state_dependent_rate * ORI_EVENT_CONST_RATE[pre_e];
}
double numer;
numer = - dt_M*rate;
for(int d = 0; d < DIM_STATE; d++){
state[d] += EVENT[event][d];
}
return - numer * denom_inv;
}
return rate;
}
// -----------------------------------------------------------
// Subroutines for file open and memory allocation
// -----------------------------------------------------------
FILE *f_open(const char *path, const char *mode){
static FILE *pf_ret;
pf_ret = fopen(path, mode);
if( pf_ret == NULL ){
fprintf( stderr, "can't open a file, %s.\n", path );
exit( EXIT_FAILURE );
}
return pf_ret;
}
void *clear_alloc(size_t size, size_t nobj){
void *pret;
pret = calloc(nobj, size);
if (pret == NULL) {
fprintf(stderr,"memory allocation failure!");
exit(0);
}
return pret;
}
void **clear_alloc_2d(size_t size, size_t row, size_t column){
void **ppret = NULL;
size_t i;
ppret = (void **) clear_alloc(sizeof(void *), row);
ppret[0] = (void *) clear_alloc(size, row * column);
for (i = 0; i < row; i++) {
ppret[i] = (void *) ((size_t) ppret[0] + i * size * column);
}
return ppret;
}
|
harrisonsj/GeoFirestore-iOS | Example/build/Intermediates/Pods.build/Debug-iphonesimulator/nanopb.build/DerivedSources/nanopb_vers.c | extern const unsigned char nanopbVersionString[];
extern const double nanopbVersionNumber;
const unsigned char nanopbVersionString[] __attribute__ ((used)) = "@(#)PROGRAM:nanopb PROJECT:Pods-1" "\n";
const double nanopbVersionNumber __attribute__ ((used)) = (double)1.;
|
harrisonsj/GeoFirestore-iOS | Example/build/Intermediates/Pods.build/Debug-iphonesimulator/Geofirestore.build/DerivedSources/Geofirestore_vers.c | extern const unsigned char GeofirestoreVersionString[];
extern const double GeofirestoreVersionNumber;
const unsigned char GeofirestoreVersionString[] __attribute__ ((used)) = "@(#)PROGRAM:Geofirestore PROJECT:Pods-1" "\n";
const double GeofirestoreVersionNumber __attribute__ ((used)) = (double)1.;
|
harrisonsj/GeoFirestore-iOS | Example/build/Intermediates/Pods.build/Debug-iphonesimulator/gRPC-Core.build/DerivedSources/grpc_vers.c | <gh_stars>1-10
extern const unsigned char grpcVersionString[];
extern const double grpcVersionNumber;
const unsigned char grpcVersionString[] __attribute__ ((used)) = "@(#)PROGRAM:grpc PROJECT:Pods-1" "\n";
const double grpcVersionNumber __attribute__ ((used)) = (double)1.;
|
harrisonsj/GeoFirestore-iOS | Example/build/Intermediates/Pods.build/Debug-iphonesimulator/gRPC-RxLibrary.build/DerivedSources/RxLibrary_vers.c | extern const unsigned char RxLibraryVersionString[];
extern const double RxLibraryVersionNumber;
const unsigned char RxLibraryVersionString[] __attribute__ ((used)) = "@(#)PROGRAM:RxLibrary PROJECT:Pods-1" "\n";
const double RxLibraryVersionNumber __attribute__ ((used)) = (double)1.;
|
harrisonsj/GeoFirestore-iOS | Example/build/Intermediates/Pods.build/Debug-iphonesimulator/FirebaseDatabase.build/DerivedSources/FirebaseDatabase_vers.c | extern const unsigned char FirebaseDatabaseVersionString[];
extern const double FirebaseDatabaseVersionNumber;
const unsigned char FirebaseDatabaseVersionString[] __attribute__ ((used)) = "@(#)PROGRAM:FirebaseDatabase PROJECT:Pods-1" "\n";
const double FirebaseDatabaseVersionNumber __attribute__ ((used)) = (double)1.;
|
harrisonsj/GeoFirestore-iOS | Example/build/Intermediates/Pods.build/Debug-iphonesimulator/Pods-Geofirestore_Example.build/DerivedSources/Pods_Geofirestore_Example_vers.c | <filename>Example/build/Intermediates/Pods.build/Debug-iphonesimulator/Pods-Geofirestore_Example.build/DerivedSources/Pods_Geofirestore_Example_vers.c
extern const unsigned char Pods_Geofirestore_ExampleVersionString[];
extern const double Pods_Geofirestore_ExampleVersionNumber;
const unsigned char Pods_Geofirestore_ExampleVersionString[] __attribute__ ((used)) = "@(#)PROGRAM:Pods_Geofirestore_Example PROJECT:Pods-1" "\n";
const double Pods_Geofirestore_ExampleVersionNumber __attribute__ ((used)) = (double)1.;
|
harrisonsj/GeoFirestore-iOS | Example/build/Intermediates/Pods.build/Debug-iphonesimulator/gRPC.build/DerivedSources/GRPCClient_vers.c | extern const unsigned char GRPCClientVersionString[];
extern const double GRPCClientVersionNumber;
const unsigned char GRPCClientVersionString[] __attribute__ ((used)) = "@(#)PROGRAM:GRPCClient PROJECT:Pods-1" "\n";
const double GRPCClientVersionNumber __attribute__ ((used)) = (double)1.;
|
harrisonsj/GeoFirestore-iOS | Example/build/Intermediates/Pods.build/Debug-iphonesimulator/gRPC-ProtoRPC.build/DerivedSources/ProtoRPC_vers.c | <gh_stars>1-10
extern const unsigned char ProtoRPCVersionString[];
extern const double ProtoRPCVersionNumber;
const unsigned char ProtoRPCVersionString[] __attribute__ ((used)) = "@(#)PROGRAM:ProtoRPC PROJECT:Pods-1" "\n";
const double ProtoRPCVersionNumber __attribute__ ((used)) = (double)1.;
|
harrisonsj/GeoFirestore-iOS | Example/build/Intermediates/Pods.build/Debug-iphonesimulator/Pods-Geofirestore_Tests.build/DerivedSources/Pods_Geofirestore_Tests_vers.c | extern const unsigned char Pods_Geofirestore_TestsVersionString[];
extern const double Pods_Geofirestore_TestsVersionNumber;
const unsigned char Pods_Geofirestore_TestsVersionString[] __attribute__ ((used)) = "@(#)PROGRAM:Pods_Geofirestore_Tests PROJECT:Pods-1" "\n";
const double Pods_Geofirestore_TestsVersionNumber __attribute__ ((used)) = (double)1.;
|
harrisonsj/GeoFirestore-iOS | Example/build/Intermediates/Pods.build/Debug-iphonesimulator/Quick.build/DerivedSources/Quick_vers.c | extern const unsigned char QuickVersionString[];
extern const double QuickVersionNumber;
const unsigned char QuickVersionString[] __attribute__ ((used)) = "@(#)PROGRAM:Quick PROJECT:Pods-1" "\n";
const double QuickVersionNumber __attribute__ ((used)) = (double)1.;
|
harrisonsj/GeoFirestore-iOS | Example/build/Intermediates/Pods.build/Debug-iphonesimulator/Protobuf.build/DerivedSources/Protobuf_vers.c | <gh_stars>1-10
extern const unsigned char ProtobufVersionString[];
extern const double ProtobufVersionNumber;
const unsigned char ProtobufVersionString[] __attribute__ ((used)) = "@(#)PROGRAM:Protobuf PROJECT:Pods-1" "\n";
const double ProtobufVersionNumber __attribute__ ((used)) = (double)1.;
|
harrisonsj/GeoFirestore-iOS | Example/Pods/BoringSSL/crypto/fipsmodule/modes/ccm.c | /* ====================================================================
* Copyright (c) 2011 The OpenSSL Project. 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 acknowledgment:
* "This product includes software developed by the OpenSSL Project
* for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
*
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
* endorse or promote products derived from this software without
* prior written permission. For written permission, please contact
* <EMAIL>.
*
* 5. Products derived from this software may not be called "OpenSSL"
* nor may "OpenSSL" appear in their names without prior written
* permission of the OpenSSL Project.
*
* 6. Redistributions of any form whatsoever must retain the following
* acknowledgment:
* "This product includes software developed by the OpenSSL Project
* for use in the OpenSSL Toolkit (http://www.openssl.org/)"
*
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
* EXPRESSED 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 OpenSSL PROJECT OR
* ITS 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.
* ====================================================================
*/
#include <assert.h>
#include <string.h>
#include <openssl/cpu.h>
#include <openssl/mem.h>
#include "../../internal.h"
#include "internal.h"
struct ccm128_state {
union {
uint64_t u[2];
uint8_t c[16];
} nonce, cmac;
};
int CRYPTO_ccm128_init(CCM128_CONTEXT *ctx, const void *key, block128_f block,
ctr128_f ctr, unsigned M, unsigned L) {
if (M < 4 || M > 16 || (M & 1) != 0 || L < 2 || L > 8) {
return 0;
}
ctx->block = block;
ctx->ctr = ctr;
ctx->M = M;
ctx->L = L;
return 1;
}
size_t CRYPTO_ccm128_max_input(const CCM128_CONTEXT *ctx) {
return ctx->L >= sizeof(size_t) ? (size_t)-1
: (((size_t)1) << (ctx->L * 8)) - 1;
}
static int ccm128_init_state(const CCM128_CONTEXT *ctx,
struct ccm128_state *state, const void *key,
const uint8_t *nonce, size_t nonce_len,
const uint8_t *aad, size_t aad_len,
size_t plaintext_len) {
const block128_f block = ctx->block;
const unsigned M = ctx->M;
const unsigned L = ctx->L;
// |L| determines the expected |nonce_len| and the limit for |plaintext_len|.
if (plaintext_len > CRYPTO_ccm128_max_input(ctx) ||
nonce_len != 15 - L) {
return 0;
}
// Assemble the first block for computing the MAC.
OPENSSL_memset(state, 0, sizeof(*state));
state->nonce.c[0] = (uint8_t)((L - 1) | ((M - 2) / 2) << 3);
if (aad_len != 0) {
state->nonce.c[0] |= 0x40; // Set AAD Flag
}
OPENSSL_memcpy(&state->nonce.c[1], nonce, nonce_len);
for (unsigned i = 0; i < L; i++) {
state->nonce.c[15 - i] = (uint8_t)(plaintext_len >> (8 * i));
}
(*block)(state->nonce.c, state->cmac.c, key);
size_t blocks = 1;
if (aad_len != 0) {
unsigned i;
// Cast to u64 to avoid the compiler complaining about invalid shifts.
uint64_t aad_len_u64 = aad_len;
if (aad_len_u64 < 0x10000 - 0x100) {
state->cmac.c[0] ^= (uint8_t)(aad_len_u64 >> 8);
state->cmac.c[1] ^= (uint8_t)aad_len_u64;
i = 2;
} else if (aad_len_u64 <= 0xffffffff) {
state->cmac.c[0] ^= 0xff;
state->cmac.c[1] ^= 0xfe;
state->cmac.c[2] ^= (uint8_t)(aad_len_u64 >> 24);
state->cmac.c[3] ^= (uint8_t)(aad_len_u64 >> 16);
state->cmac.c[4] ^= (uint8_t)(aad_len_u64 >> 8);
state->cmac.c[5] ^= (uint8_t)aad_len_u64;
i = 6;
} else {
state->cmac.c[0] ^= 0xff;
state->cmac.c[1] ^= 0xff;
state->cmac.c[2] ^= (uint8_t)(aad_len_u64 >> 56);
state->cmac.c[3] ^= (uint8_t)(aad_len_u64 >> 48);
state->cmac.c[4] ^= (uint8_t)(aad_len_u64 >> 40);
state->cmac.c[5] ^= (uint8_t)(aad_len_u64 >> 32);
state->cmac.c[6] ^= (uint8_t)(aad_len_u64 >> 24);
state->cmac.c[7] ^= (uint8_t)(aad_len_u64 >> 16);
state->cmac.c[8] ^= (uint8_t)(aad_len_u64 >> 8);
state->cmac.c[9] ^= (uint8_t)aad_len_u64;
i = 10;
}
do {
for (; i < 16 && aad_len != 0; i++) {
state->cmac.c[i] ^= *aad;
aad++;
aad_len--;
}
(*block)(state->cmac.c, state->cmac.c, key);
blocks++;
i = 0;
} while (aad_len != 0);
}
// Per RFC 3610, section 2.6, the total number of block cipher operations done
// must not exceed 2^61. There are two block cipher operations remaining per
// message block, plus one block at the end to encrypt the MAC.
size_t remaining_blocks = 2 * ((plaintext_len + 15) / 16) + 1;
if (plaintext_len + 15 < plaintext_len ||
remaining_blocks + blocks < blocks ||
// Silence Clang's unhelpful -Wtautological-constant-out-of-range-compare
// warning.
(sizeof(size_t) > 4 && remaining_blocks + blocks > UINT64_C(1) << 61)) {
return 0;
}
// Assemble the first block for encrypting and decrypting. The bottom |L|
// bytes are replaced with a counter and all bit the encoding of |L| is
// cleared in the first byte.
state->nonce.c[0] &= 7;
return 1;
}
static int ccm128_encrypt(const CCM128_CONTEXT *ctx, struct ccm128_state *state,
const void *key, uint8_t *out, const uint8_t *in,
size_t len) {
// The counter for encryption begins at one.
for (unsigned i = 0; i < ctx->L; i++) {
state->nonce.c[15 - i] = 0;
}
state->nonce.c[15] = 1;
uint8_t partial_buf[16];
unsigned num = 0;
if (ctx->ctr != NULL) {
CRYPTO_ctr128_encrypt_ctr32(in, out, len, key, state->nonce.c, partial_buf,
&num, ctx->ctr);
} else {
CRYPTO_ctr128_encrypt(in, out, len, key, state->nonce.c, partial_buf, &num,
ctx->block);
}
return 1;
}
static int ccm128_compute_mac(const CCM128_CONTEXT *ctx,
struct ccm128_state *state, const void *key,
uint8_t *out_tag, size_t tag_len,
const uint8_t *in, size_t len) {
block128_f block = ctx->block;
if (tag_len != ctx->M) {
return 0;
}
// Incorporate |in| into the MAC.
union {
uint64_t u[2];
uint8_t c[16];
} tmp;
while (len >= 16) {
OPENSSL_memcpy(tmp.c, in, 16);
state->cmac.u[0] ^= tmp.u[0];
state->cmac.u[1] ^= tmp.u[1];
(*block)(state->cmac.c, state->cmac.c, key);
in += 16;
len -= 16;
}
if (len > 0) {
for (size_t i = 0; i < len; i++) {
state->cmac.c[i] ^= in[i];
}
(*block)(state->cmac.c, state->cmac.c, key);
}
// Encrypt the MAC with counter zero.
for (unsigned i = 0; i < ctx->L; i++) {
state->nonce.c[15 - i] = 0;
}
(*block)(state->nonce.c, tmp.c, key);
state->cmac.u[0] ^= tmp.u[0];
state->cmac.u[1] ^= tmp.u[1];
OPENSSL_memcpy(out_tag, state->cmac.c, tag_len);
return 1;
}
int CRYPTO_ccm128_encrypt(const CCM128_CONTEXT *ctx, const void *key,
uint8_t *out, uint8_t *out_tag, size_t tag_len,
const uint8_t *nonce, size_t nonce_len,
const uint8_t *in, size_t len, const uint8_t *aad,
size_t aad_len) {
struct ccm128_state state;
return ccm128_init_state(ctx, &state, key, nonce, nonce_len, aad, aad_len,
len) &&
ccm128_compute_mac(ctx, &state, key, out_tag, tag_len, in, len) &&
ccm128_encrypt(ctx, &state, key, out, in, len);
}
int CRYPTO_ccm128_decrypt(const CCM128_CONTEXT *ctx, const void *key,
uint8_t *out, uint8_t *out_tag, size_t tag_len,
const uint8_t *nonce, size_t nonce_len,
const uint8_t *in, size_t len, const uint8_t *aad,
size_t aad_len) {
struct ccm128_state state;
return ccm128_init_state(ctx, &state, key, nonce, nonce_len, aad, aad_len,
len) &&
ccm128_encrypt(ctx, &state, key, out, in, len) &&
ccm128_compute_mac(ctx, &state, key, out_tag, tag_len, out, len);
}
|
harrisonsj/GeoFirestore-iOS | Example/build/Intermediates/Pods.build/Debug-iphonesimulator/BoringSSL.build/DerivedSources/openssl_vers.c | <filename>Example/build/Intermediates/Pods.build/Debug-iphonesimulator/BoringSSL.build/DerivedSources/openssl_vers.c
extern const unsigned char opensslVersionString[];
extern const double opensslVersionNumber;
const unsigned char opensslVersionString[] __attribute__ ((used)) = "@(#)PROGRAM:openssl PROJECT:Pods-1" "\n";
const double opensslVersionNumber __attribute__ ((used)) = (double)1.;
|
harrisonsj/GeoFirestore-iOS | Example/build/Intermediates/Pods.build/Debug-iphonesimulator/GeoFire.build/DerivedSources/GeoFire_vers.c | extern const unsigned char GeoFireVersionString[];
extern const double GeoFireVersionNumber;
const unsigned char GeoFireVersionString[] __attribute__ ((used)) = "@(#)PROGRAM:GeoFire PROJECT:Pods-1" "\n";
const double GeoFireVersionNumber __attribute__ ((used)) = (double)1.;
|
harrisonsj/GeoFirestore-iOS | Example/Pods/FirebaseFirestore/Firestore/Source/Remote/FSTOnlineStateTracker.h | /*
* Copyright 2018 Google
*
* 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 <Foundation/Foundation.h>
#import "Firestore/Source/Core/FSTTypes.h"
@class FSTDispatchQueue;
@protocol FSTOnlineStateDelegate;
NS_ASSUME_NONNULL_BEGIN
/**
* A component used by the FSTRemoteStore to track the FSTOnlineState (that is, whether or not the
* client as a whole should be considered to be online or offline), implementing the appropriate
* heuristics.
*
* In particular, when the client is trying to connect to the backend, we allow up to
* kMaxWatchStreamFailures within kOnlineStateTimeout for a connection to succeed. If we have too
* many failures or the timeout elapses, then we set the FSTOnlineState to Offline, and
* the client will behave as if it is offline (getDocument() calls will return cached data, etc.).
*/
@interface FSTOnlineStateTracker : NSObject
- (instancetype)initWithWorkerDispatchQueue:(FSTDispatchQueue *)queue;
- (instancetype)init NS_UNAVAILABLE;
/** A delegate to be notified on FSTOnlineState changes. */
@property(nonatomic, weak) id<FSTOnlineStateDelegate> onlineStateDelegate;
/**
* Called by FSTRemoteStore when a watch stream is started (including on each backoff attempt).
*
* If this is the first attempt, it sets the FSTOnlineState to Unknown and starts the
* onlineStateTimer.
*/
- (void)handleWatchStreamStart;
/**
* Called by FSTRemoteStore when a watch stream fails.
*
* Updates our FSTOnlineState as appropriate. The first failure moves us to FSTOnlineStateUnknown.
* We then may allow multiple failures (based on kMaxWatchStreamFailures) before we actually
* transition to FSTOnlineStateOffline.
*/
- (void)handleWatchStreamFailure:(NSError *)error;
/**
* Explicitly sets the FSTOnlineState to the specified state.
*
* Note that this resets the timers / failure counters, etc. used by our Offline heuristics, so
* it must not be used in place of handleWatchStreamStart and handleWatchStreamFailure.
*/
- (void)updateState:(FSTOnlineState)newState;
@end
NS_ASSUME_NONNULL_END
|
harrisonsj/GeoFirestore-iOS | Example/build/Intermediates/Pods.build/Debug-iphonesimulator/GoogleToolboxForMac.build/DerivedSources/GoogleToolboxForMac_vers.c | extern const unsigned char GoogleToolboxForMacVersionString[];
extern const double GoogleToolboxForMacVersionNumber;
const unsigned char GoogleToolboxForMacVersionString[] __attribute__ ((used)) = "@(#)PROGRAM:GoogleToolboxForMac PROJECT:Pods-1" "\n";
const double GoogleToolboxForMacVersionNumber __attribute__ ((used)) = (double)1.;
|
harrisonsj/GeoFirestore-iOS | Example/build/Intermediates/Pods.build/Debug-iphonesimulator/leveldb-library.build/DerivedSources/leveldb_vers.c | extern const unsigned char leveldbVersionString[];
extern const double leveldbVersionNumber;
const unsigned char leveldbVersionString[] __attribute__ ((used)) = "@(#)PROGRAM:leveldb PROJECT:Pods-1" "\n";
const double leveldbVersionNumber __attribute__ ((used)) = (double)1.;
|
harrisonsj/GeoFirestore-iOS | Example/build/Intermediates/Pods.build/Debug-iphonesimulator/FirebaseFirestore.build/DerivedSources/FirebaseFirestore_vers.c | extern const unsigned char FirebaseFirestoreVersionString[];
extern const double FirebaseFirestoreVersionNumber;
const unsigned char FirebaseFirestoreVersionString[] __attribute__ ((used)) = "@(#)PROGRAM:FirebaseFirestore PROJECT:Pods-1" "\n";
const double FirebaseFirestoreVersionNumber __attribute__ ((used)) = (double)1.;
|
harrisonsj/GeoFirestore-iOS | Example/Pods/FirebaseFirestore/Firestore/core/src/firebase/firestore/local/local_serializer.h | <reponame>harrisonsj/GeoFirestore-iOS
/*
* Copyright 2018 Google
*
* 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 FIRESTORE_CORE_SRC_FIREBASE_FIRESTORE_LOCAL_LOCAL_SERIALIZER_H_
#define FIRESTORE_CORE_SRC_FIREBASE_FIRESTORE_LOCAL_LOCAL_SERIALIZER_H_
#include <memory>
#include <vector>
#include "Firestore/core/src/firebase/firestore/model/maybe_document.h"
#include "Firestore/core/src/firebase/firestore/nanopb/reader.h"
#include "Firestore/core/src/firebase/firestore/nanopb/writer.h"
#include "Firestore/core/src/firebase/firestore/remote/serializer.h"
#include "Firestore/core/src/firebase/firestore/util/status.h"
namespace firebase {
namespace firestore {
namespace local {
/**
* @brief Serializer for values stored in the LocalStore.
*
* Note that local::LocalSerializer currently delegates to the
* remote::Serializer (for the Firestore v1beta1 RPC protocol) to save
* implementation time and code duplication. We'll need to revisit this when the
* RPC protocol we use diverges from local storage.
*/
class LocalSerializer {
public:
explicit LocalSerializer(const remote::Serializer& rpc_serializer)
: rpc_serializer_(rpc_serializer) {
}
/**
* @brief Encodes a MaybeDocument model to the equivalent bytes for local
* storage.
*
* @param maybe_doc the model to convert.
* @param[out] out_bytes A buffer to place the output. The bytes will be
* appended to this vector.
* @return A Status, which if not ok(), indicates what went wrong. Note that
* errors during encoding generally indicate a serious/fatal error.
*/
// TODO(rsgowman): If we never support any output except to a vector, it may
// make sense to have LocalSerializer own the vector and provide an accessor
// rather than asking the user to create it first.
util::Status EncodeMaybeDocument(const model::MaybeDocument& maybe_doc,
std::vector<uint8_t>* out_bytes) const;
/**
* @brief Decodes bytes representing a MaybeDocument proto to the equivalent
* model.
*
* @param bytes The bytes to convert. It's assumed that exactly all of the
* bytes will be used by this conversion.
* @return The model equivalent of the bytes or a Status indicating what went
* wrong.
*/
util::StatusOr<std::unique_ptr<model::MaybeDocument>> DecodeMaybeDocument(
const uint8_t* bytes, size_t length) const;
/**
* @brief Decodes bytes representing a MaybeDocument proto to the equivalent
* model.
*
* @param bytes The bytes to convert. It's assumed that exactly all of the
* bytes will be used by this conversion.
* @return The model equivalent of the bytes or a Status indicating what went
* wrong.
*/
util::StatusOr<std::unique_ptr<model::MaybeDocument>> DecodeMaybeDocument(
const std::vector<uint8_t>& bytes) const {
return DecodeMaybeDocument(bytes.data(), bytes.size());
}
private:
void EncodeMaybeDocument(nanopb::Writer* writer,
const model::MaybeDocument& maybe_doc) const;
std::unique_ptr<model::MaybeDocument> DecodeMaybeDocument(
nanopb::Reader* reader) const;
/**
* Encodes a Document for local storage. This differs from the v1beta1 RPC
* serializer for Documents in that it preserves the updateTime, which is
* considered an output only value by the server.
*/
void EncodeDocument(nanopb::Writer* writer, const model::Document& doc) const;
const remote::Serializer& rpc_serializer_;
};
} // namespace local
} // namespace firestore
} // namespace firebase
#endif // FIRESTORE_CORE_SRC_FIREBASE_FIRESTORE_LOCAL_LOCAL_SERIALIZER_H_
|
anji-plus/flutter_plugin | aj_flutter_appsp/ios/Classes/AjFlutterAppspPlugin.h | <reponame>anji-plus/flutter_plugin
#import <Flutter/Flutter.h>
@interface AjFlutterAppspPlugin : NSObject<FlutterPlugin>
@end
|
anji-plus/flutter_plugin | image_picker/ios/Classes/UIImage+AJScale.h | //
// UIImage+AJScale.h
// image_picker
//
// Created by Black on 2019/9/4.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface UIImage (AJScale)
//图片调整方向
- (UIImage *)fixOrientation;
//偏转
- (UIImage *)rotate:(CGFloat)rotate;
- (UIImage *)scaleWithMinWidth:(CGFloat)minWidth minHeight:(CGFloat)minHeight;
@end
NS_ASSUME_NONNULL_END
|
anji-plus/flutter_plugin | aj_flutter_scan/ios/Classes/QRHelper.h | //
// QRHelper.h
// aj_flutter_scan
//
// Created by kean_qi on 2019/7/17.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface QRHelper : NSObject
+ (void)playAudioWithSoundName:(NSString *)soundName;
@end
NS_ASSUME_NONNULL_END
|
anji-plus/flutter_plugin | aj_flutter_scan/ios/Classes/BackButton.h | <filename>aj_flutter_scan/ios/Classes/BackButton.h<gh_stars>0
//
// BackButton.h
// aj_flutter_scan
//
// Created by kean_qi on 2019/7/18.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface BackButton : UIButton
@end
NS_ASSUME_NONNULL_END
|
anji-plus/flutter_plugin | image_picker/ios/Classes/FLTImagePickerImageUtil.h | <filename>image_picker/ios/Classes/FLTImagePickerImageUtil.h
// Copyright 2019 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.
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface GIFInfo : NSObject
@property(strong, nonatomic, readonly) NSArray<UIImage *> *images;
@property(assign, nonatomic, readonly) NSTimeInterval interval;
- (instancetype)initWithImages:(NSArray<UIImage *> *)images interval:(NSTimeInterval)interval;
@end
@interface FLTImagePickerImageUtil : NSObject
+ (UIImage *)scaledImage:(UIImage *)image
maxWidth:(NSNumber *)maxWidth
maxHeight:(NSNumber *)maxHeight;
// Resize all gif animation frames.
+ (GIFInfo *)scaledGIFImage:(NSData *)data
maxWidth:(NSNumber *)maxWidth
maxHeight:(NSNumber *)maxHeight;
//压缩图片指定大小 单位kb; 如果外部传入尺寸不需要调整大小
+ (UIImage *)compressImage:(UIImage *)image
maxDataSizeKBytes:(double)maxSize
needChangeSize: (BOOL)needChange;
@end
NS_ASSUME_NONNULL_END
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.