code string | repo_name string | path string | language string | license string | size int64 |
|---|---|---|---|---|---|
#ifndef KU6_HASH_H
#define KU6_HASH_H 1
//#include <stdint.h>
//#include <string.h>
//#include <stdlib.h>
//#include <sys/types.h>
//#include "block_queue.h"
typedef struct hash_elt_t {
queue_t queue;
void *data;
char *name;
} hash_elt_t;
typedef struct hash_t {
queue_t **buckets;
unsigned int size;
... | zy-code-unp | trunk/ku6/ku6downloader/include/hash.h | C | bsd | 1,457 |
#ifndef KU6_BLOCK_QUEUE_H
#define KU6_BLOCK_QUEUE_H 1
#include <pthread.h>
#include <stddef.h>
typedef void (*free_func)(void *);
typedef struct queue_t {
struct queue_t *prev;
struct queue_t *next;
} queue_t;
typedef struct block_queue_t {
queue_t queue;
int size;
int max_size;
unsigned s... | zy-code-unp | trunk/ku6/ku6downloader/include/block_queue.h | C | bsd | 2,652 |
#ifndef KU6_THREAD_POOL_H
#define KU6_THREAD_POOL_H 1
#include <stdint.h>
#include <inttypes.h>
#ifdef __cplusplus
extern "C" {
#endif
struct pool_t;
int thread_key_create(void (*destructor)(void*));
int thread_setspecific(void *opaque);
void thread_init_pools(int threads, int size);
void thread_destroy_pools();
vo... | zy-code-unp | trunk/ku6/ku6downloader/include/thread_pool.h | C | bsd | 650 |
#ifndef _NGX_ARRAY_H_INCLUDED_
#define _NGX_ARRAY_H_INCLUDED_
//typedef unsigned int size_t;
typedef struct array_s array_t;
struct array_s {
void *elts;
size_t nelts;
size_t size;
size_t nalloc;
pool_t *pool;
};
#ifdef __cplusplus
extern "C" {
#endif
array_t *ar... | zy-code-unp | trunk/ku6/ku6downloader/include/array.h | C | bsd | 538 |
//
// JSDownloader_New.cpp : Defines the entry point for the console application.
// code style: TAB is forbidden, the indent is 2 whitespace in this file
//
#if defined(_MSC_VER)
// Specifies that the minimum required platform is Windows XP.
#ifndef _WIN32_WINNT
#define _WIN32_WINNT 0x0501
#endif
#define _CRT_SECURE... | zy-code-unp | trunk/ku6/ku6downloader/JSDownloader_New.cpp | C++ | bsd | 52,315 |
#include <ngx_config.h>
#include <ngx_core.h>
#include <ngx_http.h>
typedef struct tail_timer_data{
ngx_str_t *path;
ngx_open_file_info_t *of;
ngx_http_request_t *r;
ngx_buf_t *b;
size_t file_size;
}tail_timer_data;
static char *ngx_http_tailfile(ng... | zy-code-unp | trunk/ku6/ngx_http_tail_file_module/ngx_module_tailfile.c | C | bsd | 12,269 |
#ifndef _RTMP_H
#define _RTMP_H
#include "mp4util.h"
#include <rtmp.h>
#include <log.h>
#include <sys/time.h>
#include <math.h>
typedef struct naluunit_s {
int type;
int size;
u_char *data;
} naluunit_t;
typedef struct rtmpmetadata_s {
uint32_t width;
uint32_t ... | zy-code-unp | trunk/av/mp4/sendrtmp.h | C | bsd | 752 |
#include "sendrtmp.h"
#define msleep(x) usleep(x*1000)
int
sendpacket(RTMP *rtmp, unsigned int packettype, unsigned char *data, unsigned int size, unsigned int mtimestamp)
{
int ret = -1;
if (rtmp == NULL) return -1;
RTMPPacket packet;
RTMPPacket_Reset(&packet);
RTMPPacket_Alloc(&packet, s... | zy-code-unp | trunk/av/mp4/sendflvtortmp.c | C | bsd | 5,851 |
VPATH=.:lib
CC=gcc
CXX=g++
INCLUDES=-I./ -Iinclude/librtmp
#CFLAGS=-Wall -Wno-unused-function -g -o2 -DTEST_MP4 $(INCLUDES)
CFLAGS=-Wall -Wno-unused-function -g -o2 $(INCLUDES)
LDFLAGS=
DEPLIBS=`pkg-config --libs librtmp`
TARGET = sendrtmp sendflvtortmp
TARGET_g:=$(foreach t,$(TARGET),$(t)_g)
SOURCES=$(foreach... | zy-code-unp | trunk/av/mp4/Makefile | Makefile | bsd | 881 |
#include "mp4util.h"
typedef struct {
char *name;
int (*handler)(mp4u_file_t *mp4,
uint64_t atom_data_size);
} mp4u_atom_handler_t;
#define mp4u_mp4_atom_header(mp4) (mp4->buffer_pos - 8)
#define mp4u_mp4_atom_data(mp4) mp4->buffer_pos
#define mp... | zy-code-unp | trunk/av/mp4/mp4util.c | C | bsd | 72,318 |
#include "sendrtmp.h"
#define msleep(x) usleep(x*1000)
static char* TRAK_TYPE_NAME[] = {
"AUDIO",
"VIDEO"
};
static int fd = -1;
int
appendflvhead(int fd)
{
static const char HEAD[] = {0x46, 0x4C, 0x56, 0x01, 0x05, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00};
static const char META[]... | zy-code-unp | trunk/av/mp4/sendrtmp.c | C | bsd | 19,881 |
#ifndef _MP4U_H
#define _MP4U_H
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <unistd.h>
#include <inttypes.h>
#include <errno.h>
#define BUFFERSIZE 512*1024
#define MAX_BUFFERSIZE 1024*1024
#define M... | zy-code-unp | trunk/av/mp4/mp4util.h | C | bsd | 12,436 |
public class HelloWorld
{
public native void SayHello();
static
{
System.loadLibrary("my");
}
public static void main(String [] argv)
{
HelloWorld hello = new HelloWorld();
hello.SayHello();
}
}
| zy-code-unp | trunk/java/jni/HelloWorld.java | Java | bsd | 250 |
#include "HelloWorld.h"
#include <stdio.h>
#include <string.h>
//void JNICALL Java_HelloWorld_SayHello(JNIEnv *env, jobject obj, jstring str)
void JNICALL Java_HelloWorld_SayHello(JNIEnv *env, jobject obj)
{
/*jboolean b = 1;
char s[80];
memset(s, 0, sizeof(s));
strcpy_s(s ,(char*)env->GetStringUTFChar... | zy-code-unp | trunk/java/jni/my.c | C | bsd | 438 |
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include "logger.h"
#include "str.h"
#define FILE_MODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH)
int main(int argc ,char * argv[])
{
//FATAL("de:%d",2);
set_log_level(LOGL_DEBUG);
DEBUG("de2:%d",2);
INFO("de2:%d",2);
char * ... | zy-code-unp | trunk/msgDeliver/t.c | C | bsd | 1,039 |
OBJS=objs
default: build
clean:
rm -rf objs
ifeq ($(OBJS), $(wildcard $(OBJS)))
build:
$(MAKE) -f objs/Makefile
else
build:
@mkdir objs
@cp -f objs_makefile objs/Makefile
@$(MAKE) -f objs/Makefile
endif
| zy-code-unp | trunk/msgDeliver/Makefile | Makefile | bsd | 214 |
//copy from ngx
#include <config.h>
#include <core.h>
/*
* The red-black tree code is based on the algorithm described in
* the "Introduction to Algorithms" by Cormen, Leiserson and Rivest.
*/
static inline void msgd_rbtree_left_rotate(msgd_rbtree_node_t **root, msgd_rbtree_node_t *sentinel, msgd_rbtree_node_t *... | zy-code-unp | trunk/msgDeliver/src/msgd_rbtree.c | C | bsd | 9,035 |
#include <config.h>
#include <core.h>
msgd_global_t global;
int main(int argc ,char * argv[]){
set_log_level(LOGL_DEBUG);
if(argc >= 2){
int log_fd = open(argv[1],O_WRONLY|O_APPEND|O_CREAT,FILE_MODE);
if(log_fd < 0 )
ERROR("log_fd error");
INFO("log_fd :%d",log_fd);
set_log_fd(log_fd);
... | zy-code-unp | trunk/msgDeliver/src/msgDeliver.c | C | bsd | 936 |
#include <config.h>
#include <core.h>
pool_t * create_pool(size_t size){
unsigned int space_len = size + sizeof(pool_t);
pool_t *pool = malloc(space_len);
if(!pool)
return NULL;
pool->d.end = (char*)pool + space_len;
pool->d.last = (char*)pool + sizeof(pool_t);
pool->d.next = NULL;... | zy-code-unp | trunk/msgDeliver/src/mem_pool.c | C | bsd | 7,773 |
#include <config.h>
#include <core.h>
//#define DEBUG DEBUG
queue_t * queue_middle(queue_t *queue){
queue_t *middle, *next;
middle = queue_head(queue);
if (middle == queue_last(queue)) {
return middle;
}
next = queue_head(queue);
for ( ;; ) {
middle = queue_next(middle);... | zy-code-unp | trunk/msgDeliver/src/block_queue.c | C | bsd | 4,643 |
#include <config.h>
#include <core.h>
void msgd_init_connection_tcp(msgd_connection_t *c){
INFO("tcp new connection: fd:%d",c->fd);
}
| zy-code-unp | trunk/msgDeliver/src/protocol/msgd_protocol_tcp.c | C | bsd | 139 |
#include <config.h>
#include <core.h>
void msgd_init_connection_http(msgd_connection_t *c){
//INFO("http new connection:%s fd:%d",c->listening->addr_text,c->fd);
INFO("http new connection fd:%d",c->fd);
}
| zy-code-unp | trunk/msgDeliver/src/protocol/msgd_protocol_http.c | C | bsd | 214 |
#ifndef MY_SHMTX_H
#define MY_SHMTX_H 1
#include <config.h>
#include <core.h>
typedef struct {
msgd_atomic_t lock;
msgd_atomic_t wait;
} msgd_shmtx_sh_t;
typedef struct {
msgd_atomic_t *lock;
msgd_atomic_t *wait;
msgd_uint_t semaphore;
sem_t sem;
msgd_uint_t spi... | zy-code-unp | trunk/msgDeliver/src/msgd_shmtx.h | C | bsd | 685 |
#include <config.h>
#include <core.h>
msgd_rbtree_t msgd_event_timer_rbtree;
static msgd_rbtree_node_t msgd_event_timer_sentinel;
pthread_mutex_t *msgd_event_timer_mutex;
msgd_int_t msgd_event_timer_init(void)
{
msgd_rbtree_init(&msgd_event_timer_rbtree, &msgd_event_timer_sen... | zy-code-unp | trunk/msgDeliver/src/event/msgd_event_timer.c | C | bsd | 3,284 |
#include <config.h>
#include <core.h>
extern msgd_event_t *msgd_posted_events;
//extern block_queue_t msgd_posted_events_queue;
static msgd_int_t msgd_epoll_add_event(msgd_event_t *ev, msgd_int_t event, msgd_int_t flags);
static msgd_int_t msgd_epoll_del_event(msgd_event_t *ev, msgd_int_t event, msgd_int_t fl... | zy-code-unp | trunk/msgDeliver/src/event/epoll_event.c | C | bsd | 7,987 |
#ifndef MSGD_EVENT_H
#define MSGD_EVENT_H 1
struct msgd_event_s {
void * data;
msgd_event_t *next;
msgd_event_t **prev;
queue_t queue;
msgd_rbtree_node_t timer;
msgd_atomic_t *lock;
unsigned write:1;
unsigned accept:1;
unsigned active:1;
unsigned disable:1;
unsigned timedout:1;
un... | zy-code-unp | trunk/msgDeliver/src/event/msgd_event.h | C | bsd | 2,982 |
#include <config.h>
#include <core.h>
volatile msgd_uint_t msgd_current_msec;
block_queue_t msgd_posted_events_queue;
extern msgd_int_t msgd_accept_disabled;
void msgd_event_accept(msgd_event_t *ev)
{
int save_err;
msgd_uint_t available , socketlen;
msgd_listening_t *ls;
msgd... | zy-code-unp | trunk/msgDeliver/src/event/msgd_event.c | C | bsd | 2,857 |
#ifndef MSGD_TIMER_H
#define MSGD_TIMER_H 1
#include <config.h>
#include <core.h>
#define MSGD_TIMER_INFINITE (msgd_int_t)-1
#define MSGD_MAX_DELAY_TIME 300
extern msgd_rbtree_t msgd_event_timer_rbtree;
extern pthread_mutex_t *msgd_event_timer_mutex;
#ifdef __plusplus
extern "C" {
#endif
msg... | zy-code-unp | trunk/msgDeliver/src/event/msgd_event_timer.h | C | bsd | 1,524 |
#ifndef MSGD_EPOLL_EVENT_H
#define MSGD_EPOLL_EVENT_H 1
#define MSGD_PROCESS_EVENT_UPDATE_TIME 1 //for msgd_epoll_process_events
#define MSGD_PROCESS_EVENT_POST_EVENTS 2 //for msgd_epoll_process_events
#define MSGD_PROCESS_EVENT_POST_THREAD_EVENTS 4 //for msgd_epoll_process_events
#define MSGD_CLOSE... | zy-code-unp | trunk/msgDeliver/src/event/epoll_event.h | C | bsd | 997 |
#ifndef MY_MEM_POOL_H
#define MY_MEM_POOL_H 1
#include <config.h>
#include <core.h>
typedef struct pool_data_t {
char *end;
char *last;
struct pool_t *next;
size_t failed;
} pool_data_t;
typedef struct pool_large_t {
void *alloc;
struct pool... | zy-code-unp | trunk/msgDeliver/src/mem_pool.h | C | bsd | 1,767 |
#include <config.h>
#include <core.h>
void msgd_read_xhead_request_line (msgd_event_t *ev)
{
DEBUG("read request line :%p",ev);
//sleep(2);
return ;
}
void msgd_test_reading(msgd_event_t *ev)
{
DEBUG("test reading request data :%p",ev);
return ;
}
| zy-code-unp | trunk/msgDeliver/src/xhead/msgd_xhead.c | C | bsd | 267 |
#ifndef MSGD_XHEAD_H
#define MSGD_XHEAD_H 1
#include <config.h>
#include <core.h>
struct xhead_s {
msgd_uint_t ver:2;
msgd_uint_t total_len;
u_char *op;
u_char *name;
msgd_uint_t arg_len;
char *arg;
char *msg;
};
struct xhead_arg_s {
char interface_type[3];
char ... | zy-code-unp | trunk/msgDeliver/src/xhead/msgd_xhead.h | C | bsd | 782 |
#include <config.h>
#include <core.h>
int log_daemon_flags;
char *log_colores[] = {FATAL_COLOR,ERROR_COLOR,WARNING_COLOR,INFO_COLOR,DEBUG_COLOR,FINE_COLOR,FINEST_COLOR,NORMAL_COLOR};
char *log_level_str[] = {"FATAL","ERROR","WARN","INFO","DEBUG","FINE","FINEST"};
int log_fd = STDOUT_FILENO;
int log_level = LO... | zy-code-unp | trunk/msgDeliver/src/logger.c | C | bsd | 2,108 |
#ifndef MY_FILE_UTIL_H
#define MY_FILE_UTIL_H 1
#ifdef __cplusplus
extern "C" {
#endif
int filesize(char *filename);
int readfile(char *filename,char **buff);
int readfile_by_pool(char *filename,char **buf,pool_t *pool);
int readfile_by_fd(int fd,char **buff,int len);
int writetofile(char *filename,char *buff,in... | zy-code-unp | trunk/msgDeliver/src/fileutil.h | C | bsd | 383 |
#include <config.h>
#include <core.h>
static int32_t decode_base64_internal(u_char *dst, u_char *src, size_t src_len, const u_char *basis);
void strlow(u_char *dst , u_char *src , size_t n){
while (n) {
*dst = tolower(*src);
dst++;
src++;
n--;
}
}
u_char *
cpystrn(u_char ... | zy-code-unp | trunk/msgDeliver/src/str.c | C | bsd | 14,487 |
#ifndef MY_LOGGER_H
#define MY_LOGGER_H 1
#define ERR_MAX_LINE 2048
#define FATAL_COLOR "\033[01;31m"
#define ERROR_COLOR "\033[22;31m"
#define WARNING_COLOR "\033[01;33m"
#define INFO_COLOR "\033[22;36m"
#define DEBUG_COLOR "\033[01;37m"
#define FINE_COLOR "\033[22;37m"
#define FINEST_COLOR "\033[22;37m"
#define N... | zy-code-unp | trunk/msgDeliver/src/logger.h | C | bsd | 1,679 |
#include <config.h>
#include <core.h>
static void msgd_shmtx_wakeup(msgd_shmtx_t *mtx);
msgd_int_t
msgd_shmtx_create(msgd_shmtx_t *mtx, msgd_shmtx_sh_t *addr)
{
mtx->lock = &addr->lock;
if (mtx->spin == (msgd_uint_t) -1) {
return MSGD_OK;
}
mtx->spin = 2048;
mtx->wait = &addr->wait;
... | zy-code-unp | trunk/msgDeliver/src/msgd_shmtx.c | C | bsd | 2,937 |
#ifndef MY_STR_H
#define MY_STR_H 1
#define cpymem(dst, src, n) (((u_char *) memcpy(dst, src, n)) + (n))
#define tolower(c) (u_char) ((c >= 'A' && c <= 'Z') ? (c | 0x20) : c)
#define toupper(c) (u_char) ((c >= 'a' && c <= 'z') ? (c & ~0x20) : c)
void strlow(u_char *dst, u_char *src, size_t n);
u_char... | zy-code-unp | trunk/msgDeliver/src/str.h | C | bsd | 1,657 |
#include <config.h>
#include <core.h>
static pthread_key_t key;
//mem pool for per thread
static pool_t **pools;
static int pool_num;
// MUST be called firstly
int thread_key_create(void (*destructor)(void*))
{
return pthread_key_create(&key,destructor);
}
int thread_setspecific(void *opaque)
{
return... | zy-code-unp | trunk/msgDeliver/src/thread_pool.c | C | bsd | 1,876 |
#include <config.h>
#include <core.h>
static void msgd_drain_connection(void)
{
msgd_uint_t i;
for(i=0; i<32; i++){
if(queue_empty(&global.reusable_connections_queue)){
break;
}
queue_t *q = queue_last(&global.reusable_connections_queue);
msgd_connection_t *c = queue_data(q,ms... | zy-code-unp | trunk/msgDeliver/src/msgd_connection.c | C | bsd | 4,924 |
/// copy from ngx
#ifndef MY_LINUX_CONFIG_H
#define MY_LINUX_CONFIG_H 1
#ifndef _GNU_SOURCE
#define _GNU_SOURCE /* pread(), pwrite(), gethostname() */
#endif
#define _FILE_OFFSET_BITS 64
#include <assert.h>
#include <sys/types.h>
#include <sys/time.h>
#include <unistd.h>
#include <stdarg.h>
#include <s... | zy-code-unp | trunk/msgDeliver/src/linux_config.h | C | bsd | 1,540 |
#include <config.h>
#include <core.h>
int filesize(char *filename)
{
int fd = open(filename,O_RDONLY);
if(fd < 0){
ERROR("cant open %s:",filename);
return fd;
}
int len = lseek(fd,0,SEEK_END);
lseek(fd,0,SEEK_CUR);
close(fd);
return len;
}
int readfile(char *filename,char **buff)
{
... | zy-code-unp | trunk/msgDeliver/src/fileutil.c | C | bsd | 1,235 |
#include "logger.h"
#include "mem_pool.h"
#include "inet.h"
#define MSG_W 0200
#define MSG_R 0400
#define FILE_MODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH)
#define MSG_MODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH)
| zy-code-unp | trunk/msgDeliver/src/msgDeliver.h | C | bsd | 242 |
#ifndef MSGD_BLOCK_QUEUE_H
#define MSGD_BLOCK_QUEUE_H 1
#include <config.h>
#include <core.h>
typedef void (*free_func)(void *);
typedef struct queue_t {
struct queue_t *prev;
struct queue_t *next;
} queue_t;
typedef struct block_queue_t {
queue_t queue;
int size;
int max_size;
unsigned sho... | zy-code-unp | trunk/msgDeliver/src/block_queue.h | C | bsd | 2,652 |
#define MSG_SMP 1
#if (MSG_SMP)
#define MSG_SMP_LOCK "lock;"
#else
#define MSG_SMP_LOCK
#endif
/*
* "cmpxchgl r, [m]":
*
* if (eax == [m]) {
* zf = 1;
* [m] = r;
* } else {
* zf = 0;
* eax = [m];
* }
*
*
* The "r" means the general register.
* The "=a" and "... | zy-code-unp | trunk/msgDeliver/src/os/unix/gcc_atomic_x86.h | C | bsd | 2,599 |
//copy from ngx
#ifndef MY_ATOMIC_H
#define MY_ATOMIC_H
#include <config.h>
#include <core.h>
#if (MSGD_HAVE_SCHED_YIELD)
#define msgd_sched_yield() sched_yield()
#else
#define msgd_sched_yield() usleep(1)
#endif
#if ( __i386__ || __i386 )
typedef int32_t msgd_atomic_int_t;
typed... | zy-code-unp | trunk/msgDeliver/src/os/unix/atomic.h | C | bsd | 1,565 |
#ifndef MY_CHANNEL_H
#define MY_CHANNEL_H 1
#define MSGD_CMD_OPEN_CHANNEL 1
#define MSGD_CMD_CLOSE_CHANNEL 2
#define MSGD_CMD_QUIT 3
#define MSGD_CMD_TERMINATE 4
#define MSGD_CMD_REOPEN 5
typedef struct {
msgd_uint_t command;
msgd_int_t slot;
pid_t pid;
int fd;
} msgd... | zy-code-unp | trunk/msgDeliver/src/os/unix/msgd_channel.h | C | bsd | 651 |
#ifndef MSGD_THREAD_H
#define MSGD_THREAD_H 1
typedef void * msgd_thread_value_t;
typedef pthread_mutex_t msgd_mutex_t;
typedef pthread_cond_t msgd_cond_t;
#ifdef __plusplus
extern "C"{
#endif
msgd_int_t msgd_init_threads(int n, size_t size);
msgd_int_t msgd_create_thread(pthread_t *tid, msgd_thread_value_t (*fu... | zy-code-unp | trunk/msgDeliver/src/os/unix/msgd_thread.h | C | bsd | 700 |
#include <config.h>
#include <core.h>
#ifndef MSGD_HAVE_MSGHDR_MSG_CONTROL
#define MSGD_HAVE_MSGHDR_MSG_CONTROL 1
#endif
msgd_int_t msgd_write_channel(int fd , msgd_channel_t *ch, size_t size)
{
struct iovec vec[1];
struct msghdr msg;
msgd_int_t n , err;
#ifdef MSGD_HAVE_MSGHDR_MSG_CONTROL
union... | zy-code-unp | trunk/msgDeliver/src/os/unix/msgd_channel.c | C | bsd | 3,428 |
#ifndef MSGD_SHMEM_H
#define MSGD_SHMEM_H 1
typedef struct {
void *addr;
size_t size;
msgd_uint_t exists;
} msgd_shm_t;
msgd_int_t msgd_shm_alloc(msgd_shm_t *shm);
void msgd_shm_free(msgd_shm_t *shm);
#endif //MSGD_SHMEM_H
| zy-code-unp | trunk/msgDeliver/src/os/unix/msgd_shmem.h | C | bsd | 258 |
#include <config.h>
#include <core.h>
static msgd_uint_t nthreads;
static msgd_uint_t max_threads;
static msgd_uint_t msgd_threaded = 0;
static pthread_attr_t thr_attr;
msgd_int_t
msgd_create_thread(pthread_t *tid, msgd_thread_value_t (*func)(void *arg),
void *arg)
{
int err;
err = pthread_cr... | zy-code-unp | trunk/msgDeliver/src/os/unix/msgd_pthread_thread.c | C | bsd | 3,696 |
#include <config.h>
#include <core.h>
#include <sys/ipc.h>
#include <sys/shm.h>
msgd_int_t msgd_shm_alloc(msgd_shm_t *shm)
{
int fd;
fd = shmget(IPC_PRIVATE,shm->size,(SHM_R|SHM_W|IPC_CREAT));
if(fd == -1 ){
ERROR("shmget failed");
return MSGD_ERROR;
}
shm->addr = shmat(fd,NULL,0... | zy-code-unp | trunk/msgDeliver/src/os/unix/msgd_shmem.c | C | bsd | 641 |
#ifndef MSGD_CORE_H
#define MSGD_CORE_H 1
typedef struct msgd_listening_s msgd_listening_t;
typedef struct msgd_event_s msgd_event_t;
typedef struct msgd_connection_s msgd_connection_t;
typedef struct msgd_global_s msgd_global_t;
typedef void (*msgd_event_handler_pt)(msgd_event_t *ev);
typedef void (*msgd... | zy-code-unp | trunk/msgDeliver/src/core.h | C | bsd | 1,896 |
#ifndef MSGD_INET_H
#define MSGD_INET_H 1
#include <config.h>
#include <core.h>
struct msgd_listening_s {
void *data;
void *next;
int fd;
struct sockaddr *sockaddr;
msgd_uint_t socklen; /* size of sockaddr */
size_t addr_t... | zy-code-unp | trunk/msgDeliver/src/msgd_connection.h | C | bsd | 1,668 |
#ifndef MY_THREAD_POOL_H
#define MY_THREAD_POOL_H 1
#ifdef __cplusplus
extern "C" {
#endif
struct pool_t;
int thread_key_create(void (*destructor)(void*));
int thread_setspecific(void *opaque);
void thread_init_pools(int threads, int size);
void thread_destroy_pools();
void destroy_pools();
pool_t *thread_mem_pool()... | zy-code-unp | trunk/msgDeliver/src/thread_pool.h | C | bsd | 604 |
#include <config.h>
#include <core.h>
static void msgd_worker_process_cycle(void *data);
static msgd_int_t msgd_worker_process_init();
static void * thread_worker_cycle(void *arg);
static msgd_int_t msgd_trylock_accept_mutex();
static msgd_int_t msgd_enable_accept_events();
static msgd_int_t msgd_disable_accept_eve... | zy-code-unp | trunk/msgDeliver/src/process/msgd_process.c | C | bsd | 8,042 |
#ifndef MY_SET_PROCESS_TITLE_H
#define MY_SET_PROCESS_TITLE_H 1
#if __cplusplus
extern "C" {
#endif
int32_t save_argv(int argc , char ** argv);
int32_t init_setproctitle();
void set_proctitle(u_char * title);
#if __cplusplus
}
#endif
#endif //MY_SET_PROCESS_TITLE_H
| zy-code-unp | trunk/msgDeliver/src/process/set_process_title.h | C | bsd | 275 |
#include <config.h>
#include <core.h>
char ** copy_argv;
char ** os_environ;
char ** os_argv;
int os_argc;
static char * last_argv;
int32_t save_argv(int argc , char ** argv)
{
os_argc = argc;
os_argv = argv;
os_environ = environ;
copy_argv = malloc((argc+1)*sizeof(char*));
if(copy_argv == N... | zy-code-unp | trunk/msgDeliver/src/process/set_process_title.c | C | bsd | 1,730 |
#ifndef MY_PROCESS_H
#define MY_PROCESS_H 1
#define MSGD_MAX_PROCESS_NUM 1024
typedef void (*msgd_worker_process_cycle_pt)(void *data);
typedef struct {
pid_t pid;
msgd_int_t status;
int channel[2];
} msgd_process_t;
msgd_int_t msgd_init_process_environ();
void msgd_start_worker_processes... | zy-code-unp | trunk/msgDeliver/src/process/msgd_process.h | C | bsd | 473 |
#ifndef MSGD_GLOBAL_H
#define MSGD_GLOBAL_H 1
#include <config.h>
#include <core.h>
struct msgd_global_s {
msgd_listening_t *listenings;
msgd_uint_t listenings_n;
msgd_connection_t *connections;
msgd_uint_t connections_n;
msgd_event_t *read_events;
msgd_event_t *write_ev... | zy-code-unp | trunk/msgDeliver/src/msgd_global.h | C | bsd | 659 |
#ifndef MY_CONFIG_H
#define MY_CONFIG_H 1
#include <linux_config.h>
typedef intptr_t msgd_int_t;
typedef uintptr_t msgd_uint_t;
typedef intptr_t msgd_flag_t;
#endif //MY_CONFIG_H
| zy-code-unp | trunk/msgDeliver/src/config.h | C | bsd | 204 |
//copy from ngx
#ifndef MSGD_RBTREE_H
#define MSGD_RBTREE_H 1
#include <config.h>
#include <core.h>
typedef msgd_uint_t msgd_rbtree_key_t;
typedef msgd_int_t msgd_rbtree_key_int_t;
typedef struct msgd_rbtree_node_s msgd_rbtree_node_t;
struct msgd_rbtree_node_s {
msgd_rbtree_key_t key;
msgd_rbtre... | zy-code-unp | trunk/msgDeliver/src/msgd_rbtree.h | C | bsd | 2,169 |
#include <config.h>
#include <core.h>
#define CURR_WORK_DIR_SIZE 1024
//extern char ** copy_argv;
//char curr_work_dir[CURR_WORK_DIR_SIZE] = {'\0'};
#if 0
static msgd_int_t get_exe_dir(char *buf,size_t size,const char *argv0);
static msgd_int_t get_exe_dir(char *buf,size_t size,const char *argv0)
{
if(buf == N... | zy-code-unp | trunk/msgDeliver/src/msgd_global.c | C | bsd | 4,250 |
configuration={
rootDirectory="./",
daemon=false,
log = {
level="INFO",
file="/tmp/msgd_log_xxxx.log"
},
centerStorage={
_type="redis", --file redis
file="",
addr="127.0.0.1:8485"
},
listen={
host="127.0.0.1",
port="8383",
--outFormat="json", -- pb js... | zy-code-unp | trunk/msgDeliver/config/msgDeliver.lua | Lua | bsd | 1,108 |
package.path = package.path .. ';/usr/local/openresty/lualib/weibo/?.lua'
package.cpath = package.cpath .. ';/usr/local/openresty/lualib/weibo/?.so'
local weibo_redis = require "weibo_redis"
| zy-code-unp | trunk/weibo/redis_init.lua | Lua | bsd | 195 |
local base = _G
local string = require "string"
local http = require "socket.http"
local redis = require "resty.redis"
local ngx = ngx
module("weibo.util")
UUID_URL="http://192.168.5.23/idgenerator"
default_node = {
["path"] = "unix:/tmp/redis.sock",
["host"] = "127.0.0.1",
["port"] = 6379
}
function getUU... | zy-code-unp | trunk/weibo/util.lua | Lua | bsd | 2,103 |
local base = _G
local string = string
local os = os
local redis = redis
local call = redis.call
local pcall = redis.pcall
module("weibo_redis",package.seeall)
local commands = {
"append", "auth", "bgrewriteaof",
"bgsave", "blpop", "brpop",
"brpoplpu... | zy-code-unp | trunk/weibo/weibo_redis.lua | Lua | bsd | 16,985 |
--package.path = "../weibo/?.lua;weibo/?.lua;" .. package.path
--package.cpath = "../weibo/?.lua;weibo/?.lua;" .. package.cpath
local ngx = ngx
local base = _G
local string = string
local util = require "weibo.util"
local cjson = require "cjson"
module("weibo")
local page_size = 30
local function _split(str,de... | zy-code-unp | trunk/weibo/weibo_ngx.lua | Lua | bsd | 7,179 |
#include <ngx_config.h>
#include <ngx_core.h>
#include <ngx_http.h>
typedef struct tail_timer_data{
ngx_str_t *path;
ngx_open_file_info_t *of;
ngx_http_request_t *r;
ngx_buf_t *b;
size_t file_size;
}tail_timer_data;
static char *ngx_http_tailfile(ng... | zy-code-unp | trunk/nginx/ngx_module_tailfile/ngx_module_tailfile.c | C | bsd | 12,269 |
#ifndef PARSE_ABST_H
#define PARSE_ABST_H 1
#include <string.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#include <uuid/uuid.h>
#include <sys/stat.h>
//static const char *BOX_TYPE_UUID = "uuid";
//static const char *BOX_TYPE_ABST = "abst"; ... | zy-code-unp | trunk/nginx/livecache/parseAbst.h | C | bsd | 3,909 |
#!/bin/bash
sleep_sec=4d
logs="./nohup.out /usr/local/nginx/logs/error.log /usr/local/nginx/logs/error_l2.log /usr/local/nginx/logs/error_liverobot.log /usr/local/nginx/logs/access.log"
for log in $logs
do
echo "echo \"\" >$log"
echo "" > $log
done
cmd=$0
p=${cmd:0:1}
if [ "$p" = "." ] ; then
curpath=`pwd`... | zy-code-unp | trunk/nginx/livecache/.svn/text-base/cleanlog.sh.svn-base | Shell | bsd | 553 |
#!/bin/bash
expire_date=2
sleep_sec=8
CURL_CMD="curl -s --connect-timeout 5 --max-time 20 "
cache_home="/data/proxy_cache_dir"
temp_home="/data/proxy_temp_dir"
vod_file_home="/data/proxy_vod_dir/vod"
f4m_file_home="/data/proxy_f4m_dir"
m3u8_file_home="/data/proxy_m3u8_dir"
hostbase="http://127.0.0.1"
parse_hostbase=... | zy-code-unp | trunk/nginx/livecache/.svn/text-base/liverobot.sh.svn-base | Shell | bsd | 6,514 |
#!/bin/bash
sleep_sec=4d
logs="./nohup.out /usr/local/nginx/logs/error.log /usr/local/nginx/logs/error_l2.log /usr/local/nginx/logs/error_liverobot.log /usr/local/nginx/logs/access.log"
for log in $logs
do
echo "echo \"\" >$log"
echo "" > $log
done
cmd=$0
p=${cmd:0:1}
if [ "$p" = "." ] ; then
curpath=`pwd`... | zy-code-unp | trunk/nginx/livecache/cleanlog.sh | Shell | bsd | 553 |
#include "parseAbst.h"
#if defined(MAIN) && (MAIN)
#else
#define printf myprintf
int myprintf (__const char *__restrict __format, ...)
{
return 0;
}
#endif
static char * generte_uuid()
{
uuid_t uuid;
uuid_generate(uuid);
char *uuid_str = (char*)malloc(37);
if(!uuid_str) return NULL;
memset(uuid_str,0,... | zy-code-unp | trunk/nginx/livecache/parseAbst.c | C | bsd | 21,071 |
#include <stdio.h>
#include <sys/types.h>
static char *uint2buff(char *buff,u_int32_t n)
{
u_int8_t *p = (u_int8_t*)buff;
*p++ = (n >> 24) & 0xFF;
printf("%x",*(--p));
*p++ = (n >> 16) & 0xFF;
printf("%x",*(--p));
*p++ = (n >> 8) & 0xFF;
printf("%x",*(--p));
*p++ = n & 0xFF;
printf("%x",*(--p));
re... | zy-code-unp | trunk/nginx/livecache/big.c | C | bsd | 760 |
#include <ngx_config.h>
#include <ngx_core.h>
#include <ngx_http.h>
static ngx_int_t ngx_http_sub_output(ngx_http_request_t *r,
ngx_http_sub_ctx_t *ctx);
static ngx_int_t ngx_http_sub_parse(ngx_http_request_t *r,
ngx_http_sub_ctx_t *ctx);
static char * ngx_http_sub_filter(ngx_conf_t *cf, ngx_command_t *cmd,
... | zy-code-unp | trunk/nginx/livecache/ngx_http_liveclient_filter_module.c | C | bsd | 17,424 |
#!/bin/bash
expire_date=2
sleep_sec=8
CURL_CMD="curl -s --connect-timeout 5 --max-time 20 "
cache_home="/data/proxy_cache_dir"
temp_home="/data/proxy_temp_dir"
vod_file_home="/data/proxy_vod_dir/vod"
f4m_file_home="/data/proxy_f4m_dir"
m3u8_file_home="/data/proxy_m3u8_dir"
hostbase="http://127.0.0.1"
parse_hostbase=... | zy-code-unp | trunk/nginx/livecache/liverobot.sh | Shell | bsd | 6,514 |
#include <ngx_config.h>
#include <ngx_core.h>
#include <ngx_http.h>
#include <ngx_md5.h>
#include "parseAbst.c"
#define NGX_HTTP_CACHEPROXY_DEFAULT_SHM_SIZE 67108864 // 64 megs
#define MAX_TOKEN_LIMIT 1000000 // for million token user to take same time for playlist
#define MAX_SHM_URI_ITEM_LIMIT 15
#define MAX_SHM_... | zy-code-unp | trunk/nginx/livecache/ngx_http_cacheproxy_module.c | C | bsd | 94,416 |
/**
*
*/
package com.test;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
/**... | zxcteststruts | trunk/teststruts/src/com/test/regester.java | Java | asf20 | 865 |
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base... | zxcteststruts | trunk/teststruts/WebRoot/index.jsp | Java Server Pages | asf20 | 1,216 |
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base... | zxcteststruts | trunk/teststruts/WebRoot/res.jsp | Java Server Pages | asf20 | 1,088 |
package com.nyist.sale;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
public class MD5 {
public static String getMD5(String content) {
try {
MessageDigest digest = MessageDigest.getInstance("MD5");
digest.update(content.getBytes());
return getHashString(digest);
... | zyandroidtest | YingshiDemo/src/com/nyist/sale/MD5.java | Java | gpl3 | 742 |
package com.nyist.sale;
import android.app.Activity;
public class SacleDetial extends Activity {
}
| zyandroidtest | YingshiDemo/src/com/nyist/sale/SacleDetial.java | Java | gpl3 | 102 |
package com.nyist.sale;
public class Contact {
public int id;
public String name;
public String image;
public Contact(int id, String name, String image) {
this.id = id;
this.name = name;
this.image = image;
}
public Contact(){}
}
| zyandroidtest | YingshiDemo/src/com/nyist/sale/Contact.java | Java | gpl3 | 243 |
package com.nyist.privilege;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import javax.xml.parsers.SAXParserFactory;
import org.xml.sax.InputSource;
import org.xml.sax.XMLReader;
import com.nyist.activity.R;
import com.nyist.privilege.PrivilegeGroupActivity.Myadpter;
import com.ny... | zyandroidtest | YingshiDemo/src/com/nyist/privilege/PrivilegeCardActivity.java | Java | gpl3 | 4,081 |
package com.nyist.privilege;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import javax.xml.parsers.SAXParserFactory;
import org.xml.sax.InputSource;
import org.xml.sax.XMLReader;
import com.nyist.activity.R;
import com.nyist.privilege_member.privilege_info;
import com.nyist.xmlf... | zyandroidtest | YingshiDemo/src/com/nyist/privilege/PrivilegeGroupActivity.java | Java | gpl3 | 4,011 |
package com.nyist.privilege;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import javax.xml.parsers.SAXParserFactory;
import org.xml.sax.InputSource;
import org.xml.sax.XMLReader;
import com.nyist.activity.R;
import com.nyist.privilege.PrivilegeCardActivity.Myadpter;
import com.nyi... | zyandroidtest | YingshiDemo/src/com/nyist/privilege/PrivilegeStuActivity.java | Java | gpl3 | 4,119 |
package com.nyist.start_member;
public class start_info
{
private String name;
private String brief;
public start_info()
{
super();
}
public start_info(String name,String brief)
{
this.name=name;
this.brief=brief;
}
public void setname(String name)
{
this.name=name;
... | zyandroidtest | YingshiDemo/src/com/nyist/start_member/start_info.java | Java | gpl3 | 512 |
package com.nyist.xmlfactory;
import java.util.List;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;
import com.nyist.start_member.start_info;
public class XmlStartFactory extends DefaultHandler {
private List<start_info> filmhotInfos;
private start_in... | zyandroidtest | YingshiDemo/src/com/nyist/xmlfactory/XmlStartFactory.java | Java | gpl3 | 1,537 |
package com.nyist.xmlfactory;
import java.util.List;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;
import com.nyist.privilege_member.privilege_info;
public class XmlPrivilegeFactory extends DefaultHandler {
private List<privilege_info> filmhotInfos;
... | zyandroidtest | YingshiDemo/src/com/nyist/xmlfactory/XmlPrivilegeFactory.java | Java | gpl3 | 1,569 |
package com.nyist.start;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import javax.xml.parsers.SAXParserFactory;
import org.xml.sax.InputSource;
import org.xml.sax.XMLReader;
import com.nyist.activity.R;
import com.nyist.start.FilmCirActivity.Myadpter;
import com.nyist.start.Star... | zyandroidtest | YingshiDemo/src/com/nyist/start/FilmBriActivity.java | Java | gpl3 | 4,026 |
package com.nyist.start;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import javax.xml.parsers.SAXParserFactory;
import org.xml.sax.InputSource;
import org.xml.sax.XMLReader;
import com.nyist.activity.R;
import com.nyist.start.StartFaceActivity.Myadpter;
import com.nyist.start.St... | zyandroidtest | YingshiDemo/src/com/nyist/start/FilmCirActivity.java | Java | gpl3 | 3,983 |
package com.nyist.start;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import javax.xml.parsers.SAXParserFactory;
import org.xml.sax.InputSource;
import org.xml.sax.XMLReader;
import com.nyist.activity.R;
import com.nyist.start_member.start_info;
import com.nyist.xmlfactory.XmlS... | zyandroidtest | YingshiDemo/src/com/nyist/start/StartFaceActivity.java | Java | gpl3 | 3,937 |
package com.nyist.privilege_member;
public class privilege_info
{
private String name;
private String brief;
public privilege_info()
{
super();
}
public privilege_info(String name,String brief)
{
this.name=name;
this.brief=brief;
}
public void setname(String name)
{
this... | zyandroidtest | YingshiDemo/src/com/nyist/privilege_member/privilege_info.java | Java | gpl3 | 528 |
package com.nyist.test;
public class film_info
{
private String name;
private String brief;
private String price;
private String time;
public film_info()
{
super();
}
public film_info(String name,String brief,String time,String price)
{
this.name=name;
this.brief=brief;
th... | zyandroidtest | YingshiDemo/src/com/nyist/test/film_info.java | Java | gpl3 | 864 |
package com.nyist.test;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import javax.xml.parsers.SAXParserFactory;
import org.xml.sax.InputSource;
import org.xml.sax.XMLReader;
import com.nyist.activity.R;
import android.R.integer;
import android.app.Activity;
import android.con... | zyandroidtest | YingshiDemo/src/com/nyist/test/FilmHotActivity.java | Java | gpl3 | 4,089 |
package com.nyist.test;
import java.util.List;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;
public class XmlFilmFactory extends DefaultHandler {
private List<film_info> filmhotInfos;
private film_info tInfo;
private String tagname;
@Override
publ... | zyandroidtest | YingshiDemo/src/com/nyist/test/XmlFilmFactory.java | Java | gpl3 | 1,621 |
package com.nyist.test;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import javax.xml.parsers.SAXParserFactory;
import org.xml.sax.InputSource;
import org.xml.sax.XMLReader;
import com.nyist.activity.R;
import android.app.Activity;
import android.content.Intent;
import android.os.... | zyandroidtest | YingshiDemo/src/com/nyist/test/FilmWillActivity.java | Java | gpl3 | 4,046 |
package com.nyist.test;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import javax.xml.parsers.SAXParserFactory;
import org.xml.sax.InputSource;
import org.xml.sax.XMLReader;
import com.nyist.activity.R;
import android.app.Activity;
import android.content.Intent;
import android.os.... | zyandroidtest | YingshiDemo/src/com/nyist/test/FilmTeActivity.java | Java | gpl3 | 4,063 |
/***
Copyright (c) 2008-2009 CommonsWare, LLC
Portions (c) 2009 Google, Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may
not use this file except in compliance with the License. You may obtain
a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by ap... | zyqm86-001 | src/com/commonsware/cwac/sacklist/SackOfViewsAdapter.java | Java | asf20 | 4,627 |