type
stringclasses
5 values
content
stringlengths
9
163k
defines
#define Map_VALUE_TYPE struct Ping*
defines
#define Map_NAME OutstandingPings
structs
struct Ping { struct Pinger_Ping pub; struct Pinger* pinger; struct Timeout* timeout; String* data; int64_t timeSent; uint64_t cookie; Pinger_SEND_PING(sendPing); Pinger_ON_RESPONSE(onResponse); Identity };
structs
struct Pinger { struct Map_OutstandingPings outstandingPings; struct EventBase* eventBase; struct Random* rand; struct Log* logger; struct Allocator* allocator; /** Make all handles for different pingers wildly different to simplify debugging. */ uint32_t baseHandle; };
functions
void callback(String* data, struct Ping* ping) { uint32_t now = Time_currentTimeMilliseconds(ping->pinger->eventBase); ping->onResponse(data, now - ping->timeSent, ping->pub.context); // Flag the freePing function to tell it that the ping was not terminated by the user... ping->timeSent = 0; Alloc...
functions
void timeoutCallback(void* vping) { struct Ping* p = Identity_check((struct Ping*) vping); if (!p->timeSent) { // The ping came in at the same time that the timeout was scheduled to happen. return; }
functions
int freePing(struct Allocator_OnFreeJob* job) { struct Ping* p = Identity_check((struct Ping*) job->userData); if (p->timeSent) { //Log_debug(p->pinger->logger, "Ping cancelled [%u]", p->pub.handle); }
functions
void asyncSendPing(void* vping) { struct Ping* p = Identity_check((struct Ping*) vping); //Log_debug(p->pinger->logger, "Sending ping [%u]", p->pub.handle); p->sendPing(p->data, p->pub.context); }
functions
void Pinger_pongReceived(String* data, struct Pinger* pinger) { if (data->len < 12) { Log_debug(pinger->logger, "Invalid ping response, too short"); return; }
defines
#define ptOUTPUT 0x07
defines
#define ptALL_OFF 0x07
defines
#define ptNUM_LEDS 3
functions
void vParTestInitialise( void ) { /* Bottom 3 LEDs output. */ TRISD = TRISD & ~ptOUTPUT; PORTD = PORTD & ~ptALL_OFF; }
functions
void vParTestSetLED( unsigned portBASE_TYPE uxLED, signed portBASE_TYPE xValue ) { unsigned portBASE_TYPE uxLEDBit; if( uxLED < ptNUM_LEDS ) { /* Which port A bit is being modified? */ uxLEDBit = 1 << uxLED; if( xValue != 0 ) { /* Turn the LED on. Use of the PORTASET register removes the need to use...
functions
void vParTestToggleLED( unsigned portBASE_TYPE uxLED ) { unsigned portBASE_TYPE uxLEDBit; if( uxLED < ptNUM_LEDS ) { uxLEDBit = 1 << uxLED; /* Use of the PORTAINV register removes the need to use a critical section. */ PORTDINV = uxLEDBit; }
functions
bool Asn1PrimitivaValue_compare(Asn1PrimitiveValue* self, Asn1PrimitiveValue* otherValue) { if (self->size == otherValue->size) { if (memcmp(self->octets, otherValue->octets, self->size) == 0) return true; else return false; }
functions
int Asn1PrimitiveValue_getSize(Asn1PrimitiveValue* self) { return self->size; }
functions
int Asn1PrimitiveValue_getMaxSize(Asn1PrimitiveValue* self) { return self->maxSize; }
functions
void Asn1PrimitiveValue_destroy(Asn1PrimitiveValue* self) { free(self->octets); free(self); }
includes
#include <stdio.h>
includes
#include <alsa/asoundlib.h>
includes
#include <alsa/pcm_rate.h>
structs
struct rate_src { struct AVResampleContext *context; int in_rate; int out_rate; int stored; int point; int16_t **out; int16_t **in; unsigned int channels; };
functions
snd_pcm_uframes_t input_frames(void *obj, snd_pcm_uframes_t frames) { return frames; }
functions
snd_pcm_uframes_t output_frames(void *obj, snd_pcm_uframes_t frames) { return frames; }
functions
void pcm_src_free(void *obj) { struct rate_src *rate = obj; int i; if (rate->out) { for (i=0; i<rate->channels; i++) { free(rate->out[i]); }
functions
int pcm_src_init(void *obj, snd_pcm_rate_info_t *info) { struct rate_src *rate = obj; int i, ir, or; if (! rate->context || rate->channels != info->channels) { pcm_src_free(rate); rate->channels = info->channels; ir = rate->in_rate = info->in.rate; or = rate->out_rate = info->out.rate; i = gcd(or, ir); ...
functions
int pcm_src_adjust_pitch(void *obj, snd_pcm_rate_info_t *info) { struct rate_src *rate = obj; if (info->out.rate != rate->out_rate || info->in.rate != rate->in_rate) pcm_src_init(obj, info); return 0; }
functions
void pcm_src_reset(void *obj) { struct rate_src *rate = obj; rate->stored = 0; }
functions
void deinterleave(const int16_t *src, int16_t **dst, unsigned int frames, unsigned int chans, int overflow) { int i, j; if (chans == 1) { memcpy(dst + overflow, src, frames*sizeof(int16_t)); }
functions
else if (chans == 2) { for (j=overflow; j<(frames + overflow); j++) { dst[0][j] = *(src++); dst[1][j] = *(src++); }
functions
void reinterleave(int16_t **src, int16_t *dst, unsigned int frames, unsigned int chans) { int i, j; if (chans == 1) { memcpy(dst, src, frames*sizeof(int16_t)); }
functions
else if (chans == 2) { for (j=0; j<frames; j++) { *(dst++) = src[0][j]; *(dst++) = src[1][j]; }
functions
void pcm_src_convert_s16(void *obj, int16_t *dst, unsigned int dst_frames, const int16_t *src, unsigned int src_frames) { struct rate_src *rate = obj; int consumed = 0, chans=rate->channels, ret=0, i; int total_in = rate->stored + src_frames, new_stored; deinterleave(src, rate->in, src_frames, chans, rate->point)...
functions
void pcm_src_close(void *obj) { pcm_src_free(obj); }
functions
int get_supported_rates(void *obj, unsigned int *rate_min, unsigned int *rate_max) { *rate_min = *rate_max = 0; /* both unlimited */ return 0; }
functions
void dump(void *obj, snd_output_t *out) { snd_output_printf(out, "Converter: liblavc\n"); }
functions
int pcm_src_open(unsigned int version, void **objp, snd_pcm_rate_ops_t *ops) { struct rate_src *rate; #if SND_PCM_RATE_PLUGIN_VERSION < 0x010002 if (version != SND_PCM_RATE_PLUGIN_VERSION) { fprintf(stderr, "Invalid rate plugin version %x\n", version); return -EINVAL; }
includes
#include <string.h>
includes
#include <stdlib.h>
defines
#define GST_CAT_DEFAULT (rtpgstdepay_debug)
defines
#define gst_rtp_gst_depay_parent_class parent_class
functions
void gst_rtp_gst_depay_class_init (GstRtpGSTDepayClass * klass) { GObjectClass *gobject_class; GstElementClass *gstelement_class; GstRTPBaseDepayloadClass *gstrtpbasedepayload_class; GST_DEBUG_CATEGORY_INIT (rtpgstdepay_debug, "rtpgstdepay", 0, "Gstreamer RTP Depayloader"); gobject_class = (GObjectCla...
functions
void gst_rtp_gst_depay_init (GstRtpGSTDepay * rtpgstdepay) { rtpgstdepay->adapter = gst_adapter_new (); }
functions
void gst_rtp_gst_depay_finalize (GObject * object) { GstRtpGSTDepay *rtpgstdepay; rtpgstdepay = GST_RTP_GST_DEPAY (object); gst_rtp_gst_depay_reset (rtpgstdepay, TRUE); g_object_unref (rtpgstdepay->adapter); G_OBJECT_CLASS (parent_class)->finalize (object); }
functions
void store_cache (GstRtpGSTDepay * rtpgstdepay, guint CV, GstCaps * caps) { if (rtpgstdepay->CV_cache[CV]) gst_caps_unref (rtpgstdepay->CV_cache[CV]); rtpgstdepay->CV_cache[CV] = caps; }
functions
void gst_rtp_gst_depay_reset (GstRtpGSTDepay * rtpgstdepay, gboolean full) { guint i; gst_adapter_clear (rtpgstdepay->adapter); if (full) { rtpgstdepay->current_CV = 0; for (i = 0; i < 8; i++) store_cache (rtpgstdepay, i, NULL); g_free (rtpgstdepay->stream_id); rtpgstdepay->stream_id = NULL...
functions
gboolean gst_rtp_gst_depay_setcaps (GstRTPBaseDepayload * depayload, GstCaps * caps) { GstRtpGSTDepay *rtpgstdepay; GstStructure *structure; gint clock_rate; gboolean res; const gchar *capsenc; rtpgstdepay = GST_RTP_GST_DEPAY (depayload); structure = gst_caps_get_structure (caps, 0); if (!gst_structu...
functions
gboolean read_length (GstRtpGSTDepay * rtpgstdepay, guint8 * data, guint size, guint * length, guint * skip) { guint b, len, offset; /* start reading the length, we need this to skip to the data later */ len = offset = 0; do { if (offset >= size) return FALSE; b = data[offset++]; len = (l...
functions
void store_event (GstRtpGSTDepay * rtpgstdepay, GstEvent * event) { gboolean do_push = FALSE; switch (GST_EVENT_TYPE (event)) { case GST_EVENT_TAG: { GstTagList *old, *tags; gst_event_parse_tag (event, &tags); old = rtpgstdepay->tags; if (!old || !gst_tag_list_is_equal (old, tags)...
functions
gboolean gst_rtp_gst_depay_handle_event (GstRTPBaseDepayload * depay, GstEvent * event) { GstRtpGSTDepay *rtpgstdepay; rtpgstdepay = GST_RTP_GST_DEPAY (depay); switch (GST_EVENT_TYPE (event)) { case GST_EVENT_FLUSH_STOP: gst_rtp_gst_depay_reset (rtpgstdepay, FALSE); break; default: bre...
functions
GstStateChangeReturn gst_rtp_gst_depay_change_state (GstElement * element, GstStateChange transition) { GstRtpGSTDepay *rtpgstdepay; GstStateChangeReturn ret; rtpgstdepay = GST_RTP_GST_DEPAY (element); switch (transition) { case GST_STATE_CHANGE_READY_TO_PAUSED: gst_rtp_gst_depay_reset (rtpgstdepay,...
functions
gboolean gst_rtp_gst_depay_plugin_init (GstPlugin * plugin) { return gst_element_register (plugin, "rtpgstdepay", GST_RANK_MARGINAL, GST_TYPE_RTP_GST_DEPAY); }
includes
#include <stdio.h>
includes
#include <stdlib.h>
includes
#include <string.h>
includes
#include <assert.h>
includes
#include <errno.h>
includes
#include <sys/stat.h>
includes
#include <limits.h>
includes
#include <windows.h>
includes
#include <winreg.h>
includes
#include <direct.h>
structs
struct _sc_driver_entry { const char *name; void *(*func)(void); };
structs
struct _sc_ctx_options { struct _sc_driver_entry cdrv[SC_MAX_CARD_DRIVERS]; int ccount; char *forced_card_driver; };
functions
int _sc_add_reader(sc_context_t *ctx, sc_reader_t *reader) { assert(reader != NULL); reader->ctx = ctx; list_append(&ctx->readers, reader); return SC_SUCCESS; }
functions
int _sc_delete_reader(sc_context_t *ctx, sc_reader_t *reader) { assert(reader != NULL); if (reader->ops->release) reader->ops->release(reader); if (reader->name) free(reader->name); list_delete(&ctx->readers, reader); free(reader); return SC_SUCCESS; }
functions
int reader_list_seeker(const void *el, const void *key) { const struct sc_reader *reader = (struct sc_reader *)el; if ((el == NULL) || (key == NULL)) return 0; if (strcmp(reader->name, (char*)key) == 0) return 1; return 0; }
functions
void del_drvs(struct _sc_ctx_options *opts) { struct _sc_driver_entry *lst; int *cp, i; lst = opts->cdrv; cp = &opts->ccount; for (i = 0; i < *cp; i++) { free((void *)lst[i].name); }
functions
void add_drv(struct _sc_ctx_options *opts, const char *name) { struct _sc_driver_entry *lst; int *cp, max, i; lst = opts->cdrv; cp = &opts->ccount; max = SC_MAX_CARD_DRIVERS; if (*cp == max) /* No space for more drivers... */ return; for (i = 0; i < *cp; i++) if (strcmp(name, lst[i].name) == 0) return; ...
functions
void add_internal_drvs(struct _sc_ctx_options *opts) { const struct _sc_driver_entry *lst; int i; lst = internal_card_drivers; i = 0; while (lst[i].name != NULL) { add_drv(opts, lst[i].name); i++; }
functions
void set_defaults(sc_context_t *ctx, struct _sc_ctx_options *opts) { ctx->debug = 0; if (ctx->debug_file && (ctx->debug_file != stderr && ctx->debug_file != stdout)) fclose(ctx->debug_file); ctx->debug_file = stderr; ctx->flags = 0; #ifdef __APPLE__ /* Override the default debug log for OpenSC.tokend to be diff...
functions
int sc_ctx_log_to_file(sc_context_t *ctx, const char* filename) { /* Close any existing handles */ if (ctx->debug_file && (ctx->debug_file != stderr && ctx->debug_file != stdout)) { fclose(ctx->debug_file); ctx->debug_file = NULL; }
functions
int load_parameters(sc_context_t *ctx, scconf_block *block, struct _sc_ctx_options *opts) { int err = 0; const scconf_list *list; const char *val, *s_internal = "internal"; int debug; int reopen; #ifdef _WIN32 char expanded_val[PATH_MAX]; DWORD expanded_len; #endif reopen = scconf_get_bool(block, "reopen_debug...
functions
void load_reader_driver_options(sc_context_t *ctx) { struct sc_reader_driver *driver = ctx->reader_driver; scconf_block *conf_block = NULL; sc_reader_t *reader; int max_send_size; int max_recv_size; conf_block = sc_get_conf_block(ctx, "reader_driver", driver->short_name, 1); if (conf_block != NULL) { max_sen...
functions
int load_card_driver_options(sc_context_t *ctx, struct sc_card_driver *driver) { scconf_block **blocks, *blk; int i; for (i = 0; ctx->conf_blocks[i]; i++) { blocks = scconf_find_blocks(ctx->conf, ctx->conf_blocks[i], "card_driver", driver->short_name); if (!blocks) continue; blk = blocks[0]; ...
functions
int load_card_drivers(sc_context_t *ctx, struct _sc_ctx_options *opts) { const struct _sc_driver_entry *ent; int drv_count; int i; for (drv_count = 0; ctx->card_drivers[drv_count] != NULL; drv_count++) ; for (i = 0; i < opts->ccount; i++) { struct sc_card_driver *(*func)(void) = NULL; struct sc_car...
functions
int load_card_atrs(sc_context_t *ctx) { struct sc_card_driver *driver; scconf_block **blocks; int i, j, k; for (i = 0; ctx->conf_blocks[i] != NULL; i++) { blocks = scconf_find_blocks(ctx->conf, ctx->conf_blocks[i], "card_atr", NULL); if (!blocks) continue; for (j = 0; blocks[j] != NULL; j++) { scconf_b...
functions
void process_config_file(sc_context_t *ctx, struct _sc_ctx_options *opts) { int i, r, count = 0; scconf_block **blocks; const char *conf_path = NULL; const char *debug = NULL; #ifdef _WIN32 char temp_path[PATH_MAX]; DWORD temp_len; long rc; HKEY hKey; #endif /* Takes effect even when no config around */ debu...
functions
endif if (r < 1) { /* A negative return value means the config file isn't * there, which is not an error. Nevertheless log this * fact. */ if (r < 0) sc_log(ctx, "scconf_parse failed: %s", ctx->conf->errmsg); else sc_log(ctx, "scconf_parse failed: %s", ctx->conf->errmsg); scconf_free(ctx->conf); ...
functions
int sc_ctx_detect_readers(sc_context_t *ctx) { int r = 0; const struct sc_reader_driver *drv = ctx->reader_driver; sc_mutex_lock(ctx, ctx->mutex); if (drv->ops->detect_readers != NULL) r = drv->ops->detect_readers(ctx); sc_mutex_unlock(ctx, ctx->mutex); return r; }
functions
int sc_ctx_get_reader_count(sc_context_t *ctx) { return list_size(&ctx->readers); }
functions
int sc_establish_context(sc_context_t **ctx_out, const char *app_name) { sc_context_param_t ctx_param; memset(&ctx_param, 0, sizeof(sc_context_param_t)); ctx_param.ver = 0; ctx_param.app_name = app_name; return sc_context_create(ctx_out, &ctx_param); }
functions
int sc_context_repair(sc_context_t **ctx_out) { /* Must already exist */ if ((ctx_out == NULL) || (*ctx_out == NULL) || ((*ctx_out)->app_name == NULL)) return SC_ERROR_INVALID_ARGUMENTS; /* The only thing that should be shared across different contexts are the * card drivers - so rebuild the ATR's */ lo...
functions
int sc_context_create(sc_context_t **ctx_out, const sc_context_param_t *parm) { sc_context_t *ctx; struct _sc_ctx_options opts; int r; if (ctx_out == NULL || parm == NULL) return SC_ERROR_INVALID_ARGUMENTS; ctx = calloc(1, sizeof(sc_context_t)); if (ctx == NULL) return SC_ERROR_OUT_OF_MEMORY; memset(&op...
functions
int sc_ctx_use_reader(sc_context_t *ctx, void *pcsc_context_handle, void *pcsc_card_handle) { SC_FUNC_CALLED(ctx, SC_LOG_DEBUG_NORMAL); if (ctx->reader_driver->ops->use_reader != NULL) return ctx->reader_driver->ops->use_reader(ctx, pcsc_context_handle, pcsc_card_handle); return SC_ERROR_NOT_SUPPORTED; }
functions
int sc_cancel(sc_context_t *ctx) { SC_FUNC_CALLED(ctx, SC_LOG_DEBUG_NORMAL); if (ctx->reader_driver->ops->cancel != NULL) return ctx->reader_driver->ops->cancel(ctx); return SC_ERROR_NOT_SUPPORTED; }
functions
int sc_wait_for_event(sc_context_t *ctx, unsigned int event_mask, sc_reader_t **event_reader, unsigned int *event, int timeout, void **reader_states) { SC_FUNC_CALLED(ctx, SC_LOG_DEBUG_NORMAL); if (ctx->reader_driver->ops->wait_for_event != NULL) return ctx->reader_driver->ops->wait_for_event(ctx, event_mask, event...
functions
int sc_release_context(sc_context_t *ctx) { unsigned int i; assert(ctx != NULL); SC_FUNC_CALLED(ctx, SC_LOG_DEBUG_VERBOSE); while (list_size(&ctx->readers)) { sc_reader_t *rdr = (sc_reader_t *) list_get_at(&ctx->readers, 0); _sc_delete_reader(ctx, rdr); }
functions
int sc_set_card_driver(sc_context_t *ctx, const char *short_name) { int i = 0, match = 0; sc_mutex_lock(ctx, ctx->mutex); if (short_name == NULL) { ctx->forced_driver = NULL; match = 1; }
functions
else while (i < SC_MAX_CARD_DRIVERS && ctx->card_drivers[i] != NULL) { struct sc_card_driver *drv = ctx->card_drivers[i]; if (strcmp(short_name, drv->short_name) == 0) { ctx->forced_driver = drv; match = 1; break; }
functions
int sc_get_cache_dir(sc_context_t *ctx, char *buf, size_t bufsize) { char *homedir; const char *cache_dir; scconf_block *conf_block = NULL; #ifdef _WIN32 char temp_path[PATH_MAX]; #endif conf_block = sc_get_conf_block(ctx, "framework", "pkcs15", 1); cache_dir = scconf_get_str(conf_block, "file_cache_dir", ...
functions
int sc_make_cache_dir(sc_context_t *ctx) { char dirname[PATH_MAX], *sp; int r; size_t j, namelen; if ((r = sc_get_cache_dir(ctx, dirname, sizeof(dirname))) < 0) return r; namelen = strlen(dirname); while (1) { #ifdef _WIN32 if (mkdir(dirname) >= 0) #else if (mkdir(dirname, 0700) >= 0) #endif break; ...
includes
#include <jni.h>
includes
#include <string.h>
includes
#include <stdlib.h>
includes
#include <stdio.h>
includes
#include <ltdl.h>
main
int main(void) { JavaVMInitArgs vmargs; JavaVM *vm; void *env; JNIEnv* jni_env; JavaVMOption myoptions[2]; jclass cls, scls; jarray args; jmethodID mainid; /* set up libtool/libltdl dlopen emulation */ LTDL_SET_PRELOADED_SYMBOLS(); myoptions[0].optionString = concatString("-Xbootclasspath:", g...
includes
#include <sys/ioctl.h>