type
stringclasses
5 values
content
stringlengths
9
163k
functions
int add_pkcs11_encrypted_key( JsonVariant **v, const char *uri, const void *encrypted_key, size_t encrypted_key_size, const void *decrypted_key, size_t decrypted_key_size) { _cleanup_(json_variant_unrefp) JsonVariant *l = NULL, *w = NULL, *e = NUL...
functions
int add_pkcs11_token_uri(JsonVariant **v, const char *uri) { _cleanup_(json_variant_unrefp) JsonVariant *w = NULL; _cleanup_strv_free_ char **l = NULL; int r; assert(v); assert(uri); w = json_variant_ref(json_variant_by_key(*v, "pkcs11TokenUri")); if (w) { ...
functions
int identity_add_token_pin(JsonVariant **v, const char *pin) { _cleanup_(json_variant_unrefp) JsonVariant *w = NULL, *l = NULL; _cleanup_(strv_free_erasep) char **pins = NULL; int r; assert(v); if (isempty(pin)) return 0; w = json_variant_ref(json_varia...
functions
int identity_add_pkcs11_key_data(JsonVariant **v, const char *uri) { _cleanup_(erase_and_freep) void *decrypted_key = NULL, *encrypted_key = NULL; _cleanup_(erase_and_freep) char *pin = NULL; size_t decrypted_key_size, encrypted_key_size; _cleanup_(X509_freep) X509 *cert = NULL; ...
functions
int list_callback( CK_FUNCTION_LIST *m, CK_SESSION_HANDLE session, CK_SLOT_ID slot_id, const CK_SLOT_INFO *slot_info, const CK_TOKEN_INFO *token_info, P11KitUri *uri, void *userdata) { _cleanup_free_...
functions
int list_pkcs11_tokens(void) { #if HAVE_P11KIT _cleanup_(table_unrefp) Table *t = NULL; int r; t = table_new("uri", "label", "manufacturer", "model"); if (!t) return log_oom(); r = pkcs11_find_token(NULL, list_callback, t); if (r < 0 && r != -EAGAIN) ...
functions
int auto_callback( CK_FUNCTION_LIST *m, CK_SESSION_HANDLE session, CK_SLOT_ID slot_id, const CK_SLOT_INFO *slot_info, const CK_TOKEN_INFO *token_info, P11KitUri *uri, void *userdata) { _cleanup_(p11_...
functions
int find_pkcs11_token_auto(char **ret) { #if HAVE_P11KIT int r; r = pkcs11_find_token(NULL, auto_callback, ret); if (r == -EAGAIN) return log_error_errno(SYNTHETIC_ERRNO(ENODEV), "No suitable PKCS#11 tokens found."); if (r < 0) return r; return 0...
includes
#include <linux/serial.h>
includes
#include <linux/serial_reg.h>
includes
#include <linux/slab.h>
defines
#define MAX_MODEM_BUF 256
defines
#define WAKEUP_CHARS (MAX_MODEM_BUF/2)
defines
#define RS_ISR_PASS_LIMIT 256
defines
#define BASE_BAUD ( 1843200 / 16 )
defines
#define RCV_DELAY 20
defines
#define RCV_DELAY 20
functions
int serial_in(struct IsdnCardState *cs, int offset) { #ifdef SERIAL_DEBUG_REG u_int val = inb(cs->hw.elsa.base + 8 + offset); debugl1(cs,"in %s %02x",ModemIn[offset], val); return(val); #else return inb(cs->hw.elsa.base + 8 + offset); #endif }
functions
int serial_inp(struct IsdnCardState *cs, int offset) { #ifdef SERIAL_DEBUG_REG #ifdef ELSA_SERIAL_NOPAUSE_IO u_int val = inb(cs->hw.elsa.base + 8 + offset); debugl1(cs,"inp %s %02x",ModemIn[offset], val); #else u_int val = inb_p(cs->hw.elsa.base + 8 + offset); debugl1(cs,"inP %s %02x",ModemIn[offset], val); #endi...
functions
void serial_out(struct IsdnCardState *cs, int offset, int value) { #ifdef SERIAL_DEBUG_REG debugl1(cs,"out %s %02x",ModemOut[offset], value); #endif outb(value, cs->hw.elsa.base + 8 + offset); }
functions
void serial_outp(struct IsdnCardState *cs, int offset, int value) { #ifdef SERIAL_DEBUG_REG #ifdef ELSA_SERIAL_NOPAUSE_IO debugl1(cs,"outp %s %02x",ModemOut[offset], value); #else debugl1(cs,"outP %s %02x",ModemOut[offset], value); #endif #endif #ifdef ELSA_SERIAL_NOPAUSE_IO outb(value, cs->hw.elsa.base + ...
functions
void change_speed(struct IsdnCardState *cs, int baud) { int quot = 0, baud_base; unsigned cval, fcr = 0; int bits; /* byte size and parity */ cval = 0x03; bits = 10; /* Determine divisor based on baud rate */ baud_base = BASE_BAUD; quot = baud_base / baud; /* If the quotient is ever zero, default to 9600 bps...
functions
int mstartup(struct IsdnCardState *cs) { int retval=0; /* * Clear the FIFO buffers and disable them * (they will be reenabled in change_speed()) */ serial_outp(cs, UART_FCR, (UART_FCR_CLEAR_RCVR | UART_FCR_CLEAR_XMIT)); /* * At this point there's no way the LSR could still be 0xFF; * if it is, then bail...
functions
void mshutdown(struct IsdnCardState *cs) { #ifdef SERIAL_DEBUG_OPEN printk(KERN_DEBUG"Shutting down serial ...."); #endif /* * clear delta_msr_wait queue to avoid mem leaks: we may free the irq * here so the queue might never be waken up */ cs->hw.elsa.IER = 0; serial_outp(cs, UART_IER, 0x00); /* disable ...
functions
int write_modem(struct BCState *bcs) { int ret=0; struct IsdnCardState *cs = bcs->cs; int count, len, fp; if (!bcs->tx_skb) return 0; if (bcs->tx_skb->len <= 0) return 0; len = bcs->tx_skb->len; if (len > MAX_MODEM_BUF - cs->hw.elsa.transcnt) len = MAX_MODEM_BUF - cs->hw.elsa.transcnt; fp = cs->hw.elsa....
functions
void modem_fill(struct BCState *bcs) { if (bcs->tx_skb) { if (bcs->tx_skb->len) { write_modem(bcs); return; }
functions
void receive_chars(struct IsdnCardState *cs, int *status) { unsigned char ch; struct sk_buff *skb; do { ch = serial_in(cs, UART_RX); if (cs->hw.elsa.rcvcnt >= MAX_MODEM_BUF) break; cs->hw.elsa.rcvbuf[cs->hw.elsa.rcvcnt++] = ch; #ifdef SERIAL_DEBUG_INTR printk("DR%02x:%02x...", ch, *status); #endif ...
functions
void transmit_chars(struct IsdnCardState *cs, int *intr_done) { int count; debugl1(cs, "transmit_chars: p(%x) cnt(%x)", cs->hw.elsa.transp, cs->hw.elsa.transcnt); if (cs->hw.elsa.transcnt <= 0) { cs->hw.elsa.IER &= ~UART_IER_THRI; serial_out(cs, UART_IER, cs->hw.elsa.IER); return; }
functions
void rs_interrupt_elsa(struct IsdnCardState *cs) { int status, iir, msr; int pass_counter = 0; #ifdef SERIAL_DEBUG_INTR printk(KERN_DEBUG "rs_interrupt_single(%d)...", cs->irq); #endif do { status = serial_inp(cs, UART_LSR); debugl1(cs,"rs LSR %02x", status); #ifdef SERIAL_DEBUG_INTR printk("status = %x......
functions
void close_elsastate(struct BCState *bcs) { modehscx(bcs, 0, bcs->channel); if (test_and_clear_bit(BC_FLG_INIT, &bcs->Flag)) { if (bcs->hw.hscx.rcvbuf) { if (bcs->mode != L1_MODE_MODEM) kfree(bcs->hw.hscx.rcvbuf); bcs->hw.hscx.rcvbuf = NULL; }
functions
void modem_write_cmd(struct IsdnCardState *cs, u_char *buf, int len) { int count, fp; u_char *msg = buf; if (!len) return; if (len > (MAX_MODEM_BUF - cs->hw.elsa.transcnt)) { return; }
functions
void modem_set_init(struct IsdnCardState *cs) { int timeout; modem_write_cmd(cs, MInit_1, strlen(MInit_1)); timeout = 1000; while(timeout-- && cs->hw.elsa.transcnt) udelay(1000); debugl1(cs, "msi tout=%d", timeout); mdelay(RCV_DELAY); modem_write_cmd(cs, MInit_2, strlen(MInit_2)); timeout = 1000; while(time...
functions
void modem_set_dial(struct IsdnCardState *cs, int outgoing) { int timeout; modem_write_cmd(cs, MInit_speed28800, strlen(MInit_speed28800)); timeout = 1000; while(timeout-- && cs->hw.elsa.transcnt) udelay(1000); debugl1(cs, "msi tout=%d", timeout); mdelay(RCV_DELAY); if (outgoing) modem_write_cmd(cs, MInit_...
functions
void modem_l2l1(struct PStack *st, int pr, void *arg) { struct BCState *bcs = st->l1.bcs; struct sk_buff *skb = arg; u_long flags; if (pr == (PH_DATA | REQUEST)) { spin_lock_irqsave(&bcs->cs->lock, flags); if (bcs->tx_skb) { skb_queue_tail(&bcs->squeue, skb); }
functions
int setstack_elsa(struct PStack *st, struct BCState *bcs) { bcs->channel = st->l1.bc; switch (st->l1.mode) { case L1_MODE_HDLC: case L1_MODE_TRANS: if (open_hscxstate(st->l1.hardware, bcs)) return (-1); st->l2.l2l1 = hscx_l2l1; break; case L1_MODE_MODEM: bcs->mode = L1_MODE_MODEM; if (!test_...
functions
void init_modem(struct IsdnCardState *cs) { cs->bcs[0].BC_SetStack = setstack_elsa; cs->bcs[1].BC_SetStack = setstack_elsa; cs->bcs[0].BC_Close = close_elsastate; cs->bcs[1].BC_Close = close_elsastate; if (!(cs->hw.elsa.rcvbuf = kmalloc(MAX_MODEM_BUF, GFP_ATOMIC))) { printk(KERN_WARNING "Elsa: No modem mem...
functions
void release_modem(struct IsdnCardState *cs) { cs->hw.elsa.MFlag = 0; if (cs->hw.elsa.transbuf) { if (cs->hw.elsa.rcvbuf) { mshutdown(cs); kfree(cs->hw.elsa.rcvbuf); cs->hw.elsa.rcvbuf = NULL; }
includes
#include <stdarg.h>
includes
#include <unistd.h>
includes
#include <fcntl.h>
includes
#include <sys/ioctl.h>
includes
#include <sys/poll.h>
includes
#include <errno.h>
includes
#include <sys/time.h>
includes
#include <time.h>
includes
#include <sys/types.h>
includes
#include <sys/socket.h>
includes
#include <sys/wait.h>
includes
#include <netinet/in.h>
includes
#include <arpa/inet.h>
includes
#include <netdb.h>
includes
#include <signal.h>
includes
#include <dlfcn.h>
defines
#define HAVE_AV_CONFIG_H
defines
#define HTTP_MAX_CONNECTIONS 2000
defines
#define IOBUFFER_INIT_SIZE 8192
defines
#define AVG_COEF 0.9
defines
#define HTTP_REQUEST_TIMEOUT (15 * 1000)
defines
#define RTSP_REQUEST_TIMEOUT (3600 * 24 * 1000)
defines
#define SYNC_TIMEOUT (10 * 1000)
defines
#define SHORT_TERM_BANDWIDTH 8000000
defines
#define DEF(n, c, s) case c: str = s; break;
defines
#define CHECK_CODEC(x) (ccf->x != ccs->x)
functions
long gettime_ms(void) { struct timeval tv; gettimeofday(&tv,NULL); return (long long)tv.tv_sec * 1000 + (tv.tv_usec / 1000); }
functions
void log_connection(HTTPContext *c) { char buf2[32]; if (c->suppress_log) return; http_log("%s - - [%s] \"%s %s %s\" %d %lld\n", inet_ntoa(c->from_addr.sin_addr), ctime1(buf2), c->method, c->url, c->protocol, (c->http_error ? c->http_error : 200), c->data...
functions
void update_datarate(DataRateData *drd, int64_t count) { if (!drd->time1 && !drd->count1) { drd->time1 = drd->time2 = cur_time; drd->count1 = drd->count2 = count; }
functions
int compute_datarate(DataRateData *drd, int64_t count) { if (cur_time == drd->time1) return 0; return ((count - drd->count1) * 1000) / (cur_time - drd->time1); }
functions
int get_longterm_datarate(DataRateData *drd, int64_t count) { /* You get the first 3 seconds flat out */ if (cur_time - drd->time1 < 3000) return 0; return compute_datarate(drd, count); }
functions
void start_children(FFStream *feed) { if (no_launch) return; for (; feed; feed = feed->next) { if (feed->child_argv && !feed->pid) { feed->pid_start = time(0); feed->pid = fork(); if (feed->pid < 0) { fprintf(stderr, "Unable to create childr...
functions
int socket_open_listen(struct sockaddr_in *my_addr) { int server_fd, tmp; server_fd = socket(AF_INET,SOCK_STREAM,0); if (server_fd < 0) { perror ("socket"); return -1; }
functions
void start_multicast(void) { FFStream *stream; char session_id[32]; HTTPContext *rtp_c; struct sockaddr_in dest_addr; int default_port, stream_index; default_port = 6000; for(stream = first_stream; stream != NULL; stream = stream->next) { if (stream->is_multicast) { /* o...
functions
int http_server(void) { int server_fd, ret, rtsp_server_fd, delay, delay1; struct pollfd poll_table[HTTP_MAX_CONNECTIONS + 2], *poll_entry; HTTPContext *c, *c_next; server_fd = socket_open_listen(&my_http_addr); if (server_fd < 0) return -1; rtsp_server_fd = socket_open_listen(&my_rtsp...
functions
void start_wait_request(HTTPContext *c, int is_rtsp) { c->buffer_ptr = c->buffer; c->buffer_end = c->buffer + c->buffer_size - 1; /* leave room for '\0' */ if (is_rtsp) { c->timeout = cur_time + RTSP_REQUEST_TIMEOUT; c->state = RTSPSTATE_WAIT_REQUEST; }
functions
void new_connection(int server_fd, int is_rtsp) { struct sockaddr_in from_addr; int fd, len; HTTPContext *c = NULL; len = sizeof(from_addr); fd = accept(server_fd, (struct sockaddr *)&from_addr, &len); if (fd < 0) return; fcntl(fd, F_SETFL, O_NONBLOCK); /* XXX:...
functions
void close_connection(HTTPContext *c) { HTTPContext **cp, *c1; int i, nb_streams; AVFormatContext *ctx; URLContext *h; AVStream *st; /* remove connection from list */ cp = &first_http_ctx; while ((*cp) != NULL) { c1 = *cp; if (c1 == c) { *cp = c->next; ...
functions
int handle_connection(HTTPContext *c) { int len, ret; switch(c->state) { case HTTPSTATE_WAIT_REQUEST: case RTSPSTATE_WAIT_REQUEST: /* timeout ? */ if ((c->timeout - cur_time) < 0) return -1; if (c->poll_entry->revents & (POLLERR | POLLHUP)) return -1;...
functions
else if (len == 0) { return -1; }
functions
else if (ptr >= c->buffer_end) { /* request too long: cannot do anything */ return -1; }
functions
int extract_rates(char *rates, int ratelen, const char *request) { const char *p; for (p = request; *p && *p != '\r' && *p != '\n'; ) { if (strncasecmp(p, "Pragma:", 7) == 0) { const char *q = p + 7; while (*q && *q != '\n' && isspace(*q)) q++; if (...
functions
int find_stream_in_feed(FFStream *feed, AVCodecContext *codec, int bit_rate) { int i; int best_bitrate = 100000000; int best = -1; for (i = 0; i < feed->nb_streams; i++) { AVCodecContext *feed_codec = &feed->streams[i]->codec; if (feed_codec->codec_id != codec->codec_id || ...
functions
int modify_current_stream(HTTPContext *c, char *rates) { int i; FFStream *req = c->stream; int action_required = 0; /* Not much we can do for a feed */ if (!req->feed) return 0; for (i = 0; i < req->nb_streams; i++) { AVCodecContext *codec = &req->streams[i]->codec; sw...
functions
void do_switch_stream(HTTPContext *c, int i) { if (c->switch_feed_streams[i] >= 0) { #ifdef PHILIP c->feed_streams[i] = c->switch_feed_streams[i]; #endif /* Now update the stream */ }
functions
void skip_spaces(const char **pp) { const char *p; p = *pp; while (*p == ' ' || *p == '\t') p++; *pp = p; }
functions
void get_word(char *buf, int buf_size, const char **pp) { const char *p; char *q; p = *pp; skip_spaces(&p); q = buf; while (!isspace(*p) && *p != '\0') { if ((q - buf) < buf_size - 1) *q++ = *p; p++; }
functions
int validate_acl(FFStream *stream, HTTPContext *c) { enum IPAddressAction last_action = IP_DENY; IPAddressACL *acl; struct in_addr *src = &c->from_addr.sin_addr; unsigned long src_addr = ntohl(src->s_addr); for (acl = stream->acl; acl; acl = acl->next) { if (src_addr >= acl->first.s_addr &&...
functions
void compute_real_filename(char *filename, int max_size) { char file1[1024]; char file2[1024]; char *p; FFStream *stream; /* compute filename by matching without the file extensions */ pstrcpy(file1, sizeof(file1), filename); p = strrchr(file1, '.'); if (p) *p = '\0'; for(st...
functions
int http_parse_request(HTTPContext *c) { char *p; int post; enum RedirType redir_type; char cmd[32]; char info[1024], *filename; char url[1024], *q; char protocol[32]; char msg[1024]; const char *mime_type; FFStream *stream; int i; char ratebuf[32]; char *useragent = ...
functions
void fmt_bytecount(ByteIOContext *pb, int64_t count) { static const char *suffix = " kMGTP"; const char *s; for (s = suffix; count >= 100000 && s[1]; count /= 1000, s++) { }
functions
void compute_stats(HTTPContext *c) { HTTPContext *c1; FFStream *stream; char *p; time_t ti; int i, len; ByteIOContext pb1, *pb = &pb1; if (url_open_dyn_buf(pb) < 0) { /* XXX: return an error ? */ c->buffer_ptr = c->buffer; c->buffer_end = c->buffer; return; ...
functions
else if (stream->fmt == &rtp_mux) { /* generate a sample RTSP director if unicast. Generate an SDP redirector if multicast */ eosf = strrchr(sfilename, '.'); if (!eosf) eosf = sfilename + st...
functions
void open_parser(AVFormatContext *s, int i) { AVStream *st = s->streams[i]; AVCodec *codec; if (!st->codec.codec) { codec = avcodec_find_decoder(st->codec.codec_id); if (codec && (codec->capabilities & CODEC_CAP_PARSE_ONLY)) { st->codec.parse_only = 1; if (avcodec_op...
functions
int open_input_stream(HTTPContext *c, const char *info) { char buf[128]; char input_filename[1024]; AVFormatContext *s; int buf_size, i; int64_t stream_pos; /* find file name */ if (c->stream->feed) { strcpy(input_filename, c->stream->feed->feed_filename); buf_size = FFM_PAC...
functions
0 if (c->fmt_in->iformat->read_seek) { c->fmt_in->iformat->read_seek(c->fmt_in, stream_pos); }
functions
int64_t get_server_clock(HTTPContext *c) { /* compute current pts value from system time */ return (int64_t)(cur_time - c->start_time) * 1000LL; }
functions
int64_t get_packet_send_clock(HTTPContext *c) { int bytes_left, bytes_sent, frame_bytes; frame_bytes = c->cur_frame_bytes; if (frame_bytes <= 0) { return c->cur_pts; }
functions
int http_prepare_data(HTTPContext *c) { int i, len, ret; AVFormatContext *ctx; av_freep(&c->pb_buffer); switch(c->state) { case HTTPSTATE_SEND_DATA_HEADER: memset(&c->fmt_ctx, 0, sizeof(c->fmt_ctx)); pstrcpy(c->fmt_ctx.author, sizeof(c->fmt_ctx.author), c->stream->a...
functions
int http_send_data(HTTPContext *c) { int len, ret; for(;;) { if (c->buffer_ptr >= c->buffer_end) { ret = http_prepare_data(c); if (ret < 0) return -1; else if (ret != 0) { /* state change requested */ break; ...
functions
int http_start_receive_data(HTTPContext *c) { int fd; if (c->stream->feed_opened) return -1; /* Don't permit writing to this one */ if (c->stream->readonly) return -1; /* open feed */ fd = open(c->stream->feed_filename, O_RDWR); if (fd < 0) return -1; c->feed_f...
functions
int http_receive_data(HTTPContext *c) { HTTPContext *c1; if (c->buffer_end > c->buffer_ptr) { int len; len = read(c->fd, c->buffer_ptr, c->buffer_end - c->buffer_ptr); if (len < 0) { if (errno != EAGAIN && errno != EINTR) { /* error : close connection */ ...
functions
else if (len == 0) { /* end of connection : close it */ goto fail; }