code
stringlengths
3
1.05M
repo_name
stringlengths
4
116
path
stringlengths
3
942
language
stringclasses
30 values
license
stringclasses
15 values
size
int32
3
1.05M
line_mean
float64
0.5
100
line_max
int64
1
1k
alpha_frac
float64
0.25
1
autogenerated
bool
1 class
/* * YAFFS: Yet another Flash File System . A NAND-flash specific file system. * * Copyright (C) 2002-2007 Aleph One Ltd. * for Toby Churchill Ltd and Brightstar Engineering * * Created by Charles Manning <charles@aleph1.co.uk> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 2.1 as * published by the Free Software Foundation. * * Note: Only YAFFS headers are LGPL, YAFFS C code is covered by GPL. */ /* This is used to pack YAFFS2 tags, not YAFFS1tags. */ #ifndef __YAFFS_PACKEDTAGS2_H__ #define __YAFFS_PACKEDTAGS2_H__ #include "yaffs_guts.h" #include "yaffs_ecc.h" typedef struct { unsigned sequenceNumber; unsigned objectId; unsigned chunkId; unsigned byteCount; } yaffs_PackedTags2TagsPart; typedef struct{ yaffs_PackedTags2TagsPart t; yaffs_ECCOther ecc; } yaffs_PackedTags2; /* Full packed tags with ECC, used for oob tags */ void yaffs_PackTags2(yaffs_PackedTags2 * pt, const yaffs_ExtendedTags * t); void yaffs_UnpackTags2(yaffs_ExtendedTags * t, yaffs_PackedTags2 * pt); /* Only the tags part (no ECC for use with inband tags */ void yaffs_PackTags2TagsPart(yaffs_PackedTags2TagsPart * pt, const yaffs_ExtendedTags * t); void yaffs_UnpackTags2TagsPart(yaffs_ExtendedTags * t, yaffs_PackedTags2TagsPart * pt); #endif
xtreamerdev/linux-xtr
fs/yaffs2/yaffs_packedtags2.h
C
gpl-2.0
1,350
30.395349
91
0.748148
false
/* * Multiple format streaming server * Copyright (c) 2000, 2001, 2002 Fabrice Bellard * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #define HAVE_AV_CONFIG_H #include "avformat.h" #include <stdarg.h> #include <unistd.h> #include <fcntl.h> #include <sys/ioctl.h> #include <sys/poll.h> #include <errno.h> #include <sys/time.h> #undef time //needed because HAVE_AV_CONFIG_H is defined on top #include <time.h> #include <sys/types.h> #include <sys/socket.h> #include <sys/wait.h> #include <netinet/in.h> #include <arpa/inet.h> #include <netdb.h> #include <signal.h> #ifdef CONFIG_HAVE_DLFCN #include <dlfcn.h> #endif #include "ffserver.h" /* maximum number of simultaneous HTTP connections */ #define HTTP_MAX_CONNECTIONS 2000 enum HTTPState { HTTPSTATE_WAIT_REQUEST, HTTPSTATE_SEND_HEADER, HTTPSTATE_SEND_DATA_HEADER, HTTPSTATE_SEND_DATA, /* sending TCP or UDP data */ HTTPSTATE_SEND_DATA_TRAILER, HTTPSTATE_RECEIVE_DATA, HTTPSTATE_WAIT_FEED, /* wait for data from the feed */ HTTPSTATE_READY, RTSPSTATE_WAIT_REQUEST, RTSPSTATE_SEND_REPLY, RTSPSTATE_SEND_PACKET, }; const char *http_state[] = { "HTTP_WAIT_REQUEST", "HTTP_SEND_HEADER", "SEND_DATA_HEADER", "SEND_DATA", "SEND_DATA_TRAILER", "RECEIVE_DATA", "WAIT_FEED", "READY", "RTSP_WAIT_REQUEST", "RTSP_SEND_REPLY", "RTSP_SEND_PACKET", }; #define IOBUFFER_INIT_SIZE 8192 /* coef for exponential mean for bitrate estimation in statistics */ #define AVG_COEF 0.9 /* timeouts are in ms */ #define HTTP_REQUEST_TIMEOUT (15 * 1000) #define RTSP_REQUEST_TIMEOUT (3600 * 24 * 1000) #define SYNC_TIMEOUT (10 * 1000) typedef struct { int64_t count1, count2; long time1, time2; } DataRateData; /* context associated with one connection */ typedef struct HTTPContext { enum HTTPState state; int fd; /* socket file descriptor */ struct sockaddr_in from_addr; /* origin */ struct pollfd *poll_entry; /* used when polling */ long timeout; uint8_t *buffer_ptr, *buffer_end; int http_error; struct HTTPContext *next; int got_key_frame; /* stream 0 => 1, stream 1 => 2, stream 2=> 4 */ int64_t data_count; /* feed input */ int feed_fd; /* input format handling */ AVFormatContext *fmt_in; long start_time; /* In milliseconds - this wraps fairly often */ int64_t first_pts; /* initial pts value */ int64_t cur_pts; /* current pts value from the stream in us */ int64_t cur_frame_duration; /* duration of the current frame in us */ int cur_frame_bytes; /* output frame size, needed to compute the time at which we send each packet */ int pts_stream_index; /* stream we choose as clock reference */ int64_t cur_clock; /* current clock reference value in us */ /* output format handling */ struct FFStream *stream; /* -1 is invalid stream */ int feed_streams[MAX_STREAMS]; /* index of streams in the feed */ int switch_feed_streams[MAX_STREAMS]; /* index of streams in the feed */ int switch_pending; AVFormatContext fmt_ctx; /* instance of FFStream for one user */ int last_packet_sent; /* true if last data packet was sent */ int suppress_log; DataRateData datarate; int wmp_client_id; char protocol[16]; char method[16]; char url[128]; int buffer_size; uint8_t *buffer; int is_packetized; /* if true, the stream is packetized */ int packet_stream_index; /* current stream for output in state machine */ /* RTSP state specific */ uint8_t *pb_buffer; /* XXX: use that in all the code */ ByteIOContext *pb; int seq; /* RTSP sequence number */ /* RTP state specific */ enum RTSPProtocol rtp_protocol; char session_id[32]; /* session id */ AVFormatContext *rtp_ctx[MAX_STREAMS]; /* RTP/UDP specific */ URLContext *rtp_handles[MAX_STREAMS]; /* RTP/TCP specific */ struct HTTPContext *rtsp_c; uint8_t *packet_buffer, *packet_buffer_ptr, *packet_buffer_end; } HTTPContext; static AVFrame dummy_frame; /* each generated stream is described here */ enum StreamType { STREAM_TYPE_LIVE, STREAM_TYPE_STATUS, STREAM_TYPE_REDIRECT, }; enum IPAddressAction { IP_ALLOW = 1, IP_DENY, }; typedef struct IPAddressACL { struct IPAddressACL *next; enum IPAddressAction action; /* These are in host order */ struct in_addr first; struct in_addr last; } IPAddressACL; /* description of each stream of the ffserver.conf file */ typedef struct FFStream { enum StreamType stream_type; char filename[1024]; /* stream filename */ struct FFStream *feed; /* feed we are using (can be null if coming from file) */ AVFormatParameters *ap_in; /* input parameters */ AVInputFormat *ifmt; /* if non NULL, force input format */ AVOutputFormat *fmt; IPAddressACL *acl; int nb_streams; int prebuffer; /* Number of millseconds early to start */ long max_time; /* Number of milliseconds to run */ int send_on_key; AVStream *streams[MAX_STREAMS]; int feed_streams[MAX_STREAMS]; /* index of streams in the feed */ char feed_filename[1024]; /* file name of the feed storage, or input file name for a stream */ char author[512]; char title[512]; char copyright[512]; char comment[512]; pid_t pid; /* Of ffmpeg process */ time_t pid_start; /* Of ffmpeg process */ char **child_argv; struct FFStream *next; int bandwidth; /* bandwidth, in kbits/s */ /* RTSP options */ char *rtsp_option; /* multicast specific */ int is_multicast; struct in_addr multicast_ip; int multicast_port; /* first port used for multicast */ int multicast_ttl; int loop; /* if true, send the stream in loops (only meaningful if file) */ /* feed specific */ int feed_opened; /* true if someone is writing to the feed */ int is_feed; /* true if it is a feed */ int readonly; /* True if writing is prohibited to the file */ int conns_served; int64_t bytes_served; int64_t feed_max_size; /* maximum storage size */ int64_t feed_write_index; /* current write position in feed (it wraps round) */ int64_t feed_size; /* current size of feed */ struct FFStream *next_feed; } FFStream; typedef struct FeedData { long long data_count; float avg_frame_size; /* frame size averraged over last frames with exponential mean */ } FeedData; struct sockaddr_in my_http_addr; struct sockaddr_in my_rtsp_addr; char logfilename[1024]; HTTPContext *first_http_ctx; FFStream *first_feed; /* contains only feeds */ FFStream *first_stream; /* contains all streams, including feeds */ static void new_connection(int server_fd, int is_rtsp); static void close_connection(HTTPContext *c); /* HTTP handling */ static int handle_connection(HTTPContext *c); static int http_parse_request(HTTPContext *c); static int http_send_data(HTTPContext *c); static void compute_stats(HTTPContext *c); static int open_input_stream(HTTPContext *c, const char *info); static int http_start_receive_data(HTTPContext *c); static int http_receive_data(HTTPContext *c); /* RTSP handling */ static int rtsp_parse_request(HTTPContext *c); static void rtsp_cmd_describe(HTTPContext *c, const char *url); static void rtsp_cmd_options(HTTPContext *c, const char *url); static void rtsp_cmd_setup(HTTPContext *c, const char *url, RTSPHeader *h); static void rtsp_cmd_play(HTTPContext *c, const char *url, RTSPHeader *h); static void rtsp_cmd_pause(HTTPContext *c, const char *url, RTSPHeader *h); static void rtsp_cmd_teardown(HTTPContext *c, const char *url, RTSPHeader *h); /* SDP handling */ static int prepare_sdp_description(FFStream *stream, uint8_t **pbuffer, struct in_addr my_ip); /* RTP handling */ static HTTPContext *rtp_new_connection(struct sockaddr_in *from_addr, FFStream *stream, const char *session_id, enum RTSPProtocol rtp_protocol); static int rtp_new_av_stream(HTTPContext *c, int stream_index, struct sockaddr_in *dest_addr, HTTPContext *rtsp_c); static const char *my_program_name; static const char *my_program_dir; static int ffserver_debug; static int ffserver_daemon; static int no_launch; static int need_to_start_children; int nb_max_connections; int nb_connections; int max_bandwidth; int current_bandwidth; static long cur_time; // Making this global saves on passing it around everywhere static long gettime_ms(void) { struct timeval tv; gettimeofday(&tv,NULL); return (long long)tv.tv_sec * 1000 + (tv.tv_usec / 1000); } static FILE *logfile = NULL; static void __attribute__ ((format (printf, 1, 2))) http_log(const char *fmt, ...) { va_list ap; va_start(ap, fmt); if (logfile) { vfprintf(logfile, fmt, ap); fflush(logfile); } va_end(ap); } static char *ctime1(char *buf2) { time_t ti; char *p; ti = time(NULL); p = ctime(&ti); strcpy(buf2, p); p = buf2 + strlen(p) - 1; if (*p == '\n') *p = '\0'; return buf2; } static 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_count); } static void update_datarate(DataRateData *drd, int64_t count) { if (!drd->time1 && !drd->count1) { drd->time1 = drd->time2 = cur_time; drd->count1 = drd->count2 = count; } else { if (cur_time - drd->time2 > 5000) { drd->time1 = drd->time2; drd->count1 = drd->count2; drd->time2 = cur_time; drd->count2 = count; } } } /* In bytes per second */ static int compute_datarate(DataRateData *drd, int64_t count) { if (cur_time == drd->time1) return 0; return ((count - drd->count1) * 1000) / (cur_time - drd->time1); } static 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); } static 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 children\n"); exit(1); } if (!feed->pid) { /* In child */ char pathname[1024]; char *slash; int i; for (i = 3; i < 256; i++) { close(i); } if (!ffserver_debug) { i = open("/dev/null", O_RDWR); if (i) dup2(i, 0); dup2(i, 1); dup2(i, 2); if (i) close(i); } pstrcpy(pathname, sizeof(pathname), my_program_name); slash = strrchr(pathname, '/'); if (!slash) { slash = pathname; } else { slash++; } strcpy(slash, "ffmpeg"); /* This is needed to make relative pathnames work */ chdir(my_program_dir); signal(SIGPIPE, SIG_DFL); execvp(pathname, feed->child_argv); _exit(1); } } } } /* open a listening socket */ static 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; } tmp = 1; setsockopt(server_fd, SOL_SOCKET, SO_REUSEADDR, &tmp, sizeof(tmp)); if (bind (server_fd, (struct sockaddr *) my_addr, sizeof (*my_addr)) < 0) { char bindmsg[32]; snprintf(bindmsg, sizeof(bindmsg), "bind(port %d)", ntohs(my_addr->sin_port)); perror (bindmsg); close(server_fd); return -1; } if (listen (server_fd, 5) < 0) { perror ("listen"); close(server_fd); return -1; } fcntl(server_fd, F_SETFL, O_NONBLOCK); return server_fd; } /* start all multicast streams */ static 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) { /* open the RTP connection */ snprintf(session_id, sizeof(session_id), "%08x%08x", (int)random(), (int)random()); /* choose a port if none given */ if (stream->multicast_port == 0) { stream->multicast_port = default_port; default_port += 100; } dest_addr.sin_family = AF_INET; dest_addr.sin_addr = stream->multicast_ip; dest_addr.sin_port = htons(stream->multicast_port); rtp_c = rtp_new_connection(&dest_addr, stream, session_id, RTSP_PROTOCOL_RTP_UDP_MULTICAST); if (!rtp_c) { continue; } if (open_input_stream(rtp_c, "") < 0) { fprintf(stderr, "Could not open input stream for stream '%s'\n", stream->filename); continue; } /* open each RTP stream */ for(stream_index = 0; stream_index < stream->nb_streams; stream_index++) { dest_addr.sin_port = htons(stream->multicast_port + 2 * stream_index); if (rtp_new_av_stream(rtp_c, stream_index, &dest_addr, NULL) < 0) { fprintf(stderr, "Could not open output stream '%s/streamid=%d'\n", stream->filename, stream_index); exit(1); } } /* change state to send data */ rtp_c->state = HTTPSTATE_SEND_DATA; } } } /* main loop of the http server */ static 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_addr); if (rtsp_server_fd < 0) return -1; http_log("ffserver started.\n"); start_children(first_feed); first_http_ctx = NULL; nb_connections = 0; start_multicast(); for(;;) { poll_entry = poll_table; poll_entry->fd = server_fd; poll_entry->events = POLLIN; poll_entry++; poll_entry->fd = rtsp_server_fd; poll_entry->events = POLLIN; poll_entry++; /* wait for events on each HTTP handle */ c = first_http_ctx; delay = 1000; while (c != NULL) { int fd; fd = c->fd; switch(c->state) { case HTTPSTATE_SEND_HEADER: case RTSPSTATE_SEND_REPLY: case RTSPSTATE_SEND_PACKET: c->poll_entry = poll_entry; poll_entry->fd = fd; poll_entry->events = POLLOUT; poll_entry++; break; case HTTPSTATE_SEND_DATA_HEADER: case HTTPSTATE_SEND_DATA: case HTTPSTATE_SEND_DATA_TRAILER: if (!c->is_packetized) { /* for TCP, we output as much as we can (may need to put a limit) */ c->poll_entry = poll_entry; poll_entry->fd = fd; poll_entry->events = POLLOUT; poll_entry++; } else { /* when ffserver is doing the timing, we work by looking at which packet need to be sent every 10 ms */ delay1 = 10; /* one tick wait XXX: 10 ms assumed */ if (delay1 < delay) delay = delay1; } break; case HTTPSTATE_WAIT_REQUEST: case HTTPSTATE_RECEIVE_DATA: case HTTPSTATE_WAIT_FEED: case RTSPSTATE_WAIT_REQUEST: /* need to catch errors */ c->poll_entry = poll_entry; poll_entry->fd = fd; poll_entry->events = POLLIN;/* Maybe this will work */ poll_entry++; break; default: c->poll_entry = NULL; break; } c = c->next; } /* wait for an event on one connection. We poll at least every second to handle timeouts */ do { ret = poll(poll_table, poll_entry - poll_table, delay); if (ret < 0 && errno != EAGAIN && errno != EINTR) return -1; } while (ret <= 0); cur_time = gettime_ms(); if (need_to_start_children) { need_to_start_children = 0; start_children(first_feed); } /* now handle the events */ for(c = first_http_ctx; c != NULL; c = c_next) { c_next = c->next; if (handle_connection(c) < 0) { /* close and free the connection */ log_connection(c); close_connection(c); } } poll_entry = poll_table; /* new HTTP connection request ? */ if (poll_entry->revents & POLLIN) { new_connection(server_fd, 0); } poll_entry++; /* new RTSP connection request ? */ if (poll_entry->revents & POLLIN) { new_connection(rtsp_server_fd, 1); } } } /* start waiting for a new HTTP/RTSP request */ static 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; } else { c->timeout = cur_time + HTTP_REQUEST_TIMEOUT; c->state = HTTPSTATE_WAIT_REQUEST; } } static 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: should output a warning page when coming close to the connection limit */ if (nb_connections >= nb_max_connections) goto fail; /* add a new connection */ c = av_mallocz(sizeof(HTTPContext)); if (!c) goto fail; c->fd = fd; c->poll_entry = NULL; c->from_addr = from_addr; c->buffer_size = IOBUFFER_INIT_SIZE; c->buffer = av_malloc(c->buffer_size); if (!c->buffer) goto fail; c->next = first_http_ctx; first_http_ctx = c; nb_connections++; start_wait_request(c, is_rtsp); return; fail: if (c) { av_free(c->buffer); av_free(c); } close(fd); } static 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; } else { cp = &c1->next; } } /* remove references, if any (XXX: do it faster) */ for(c1 = first_http_ctx; c1 != NULL; c1 = c1->next) { if (c1->rtsp_c == c) c1->rtsp_c = NULL; } /* remove connection associated resources */ if (c->fd >= 0) close(c->fd); if (c->fmt_in) { /* close each frame parser */ for(i=0;i<c->fmt_in->nb_streams;i++) { st = c->fmt_in->streams[i]; if (st->codec.codec) { avcodec_close(&st->codec); } } av_close_input_file(c->fmt_in); } /* free RTP output streams if any */ nb_streams = 0; if (c->stream) nb_streams = c->stream->nb_streams; for(i=0;i<nb_streams;i++) { ctx = c->rtp_ctx[i]; if (ctx) { av_write_trailer(ctx); av_free(ctx); } h = c->rtp_handles[i]; if (h) { url_close(h); } } ctx = &c->fmt_ctx; if (!c->last_packet_sent) { if (ctx->oformat) { /* prepare header */ if (url_open_dyn_buf(&ctx->pb) >= 0) { av_write_trailer(ctx); url_close_dyn_buf(&ctx->pb, &c->pb_buffer); } } } for(i=0; i<ctx->nb_streams; i++) av_free(ctx->streams[i]) ; if (c->stream) current_bandwidth -= c->stream->bandwidth; av_freep(&c->pb_buffer); av_freep(&c->packet_buffer); av_free(c->buffer); av_free(c); nb_connections--; } static 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; /* no need to read if no events */ if (!(c->poll_entry->revents & POLLIN)) return 0; /* read the data */ read_loop: len = read(c->fd, c->buffer_ptr, 1); if (len < 0) { if (errno != EAGAIN && errno != EINTR) return -1; } else if (len == 0) { return -1; } else { /* search for end of request. */ uint8_t *ptr; c->buffer_ptr += len; ptr = c->buffer_ptr; if ((ptr >= c->buffer + 2 && !memcmp(ptr-2, "\n\n", 2)) || (ptr >= c->buffer + 4 && !memcmp(ptr-4, "\r\n\r\n", 4))) { /* request found : parse it and reply */ if (c->state == HTTPSTATE_WAIT_REQUEST) { ret = http_parse_request(c); } else { ret = rtsp_parse_request(c); } if (ret < 0) return -1; } else if (ptr >= c->buffer_end) { /* request too long: cannot do anything */ return -1; } else goto read_loop; } break; case HTTPSTATE_SEND_HEADER: if (c->poll_entry->revents & (POLLERR | POLLHUP)) return -1; /* no need to write if no events */ if (!(c->poll_entry->revents & POLLOUT)) return 0; len = write(c->fd, c->buffer_ptr, c->buffer_end - c->buffer_ptr); if (len < 0) { if (errno != EAGAIN && errno != EINTR) { /* error : close connection */ av_freep(&c->pb_buffer); return -1; } } else { c->buffer_ptr += len; if (c->stream) c->stream->bytes_served += len; c->data_count += len; if (c->buffer_ptr >= c->buffer_end) { av_freep(&c->pb_buffer); /* if error, exit */ if (c->http_error) { return -1; } /* all the buffer was sent : synchronize to the incoming stream */ c->state = HTTPSTATE_SEND_DATA_HEADER; c->buffer_ptr = c->buffer_end = c->buffer; } } break; case HTTPSTATE_SEND_DATA: case HTTPSTATE_SEND_DATA_HEADER: case HTTPSTATE_SEND_DATA_TRAILER: /* for packetized output, we consider we can always write (the input streams sets the speed). It may be better to verify that we do not rely too much on the kernel queues */ if (!c->is_packetized) { if (c->poll_entry->revents & (POLLERR | POLLHUP)) return -1; /* no need to read if no events */ if (!(c->poll_entry->revents & POLLOUT)) return 0; } if (http_send_data(c) < 0) return -1; break; case HTTPSTATE_RECEIVE_DATA: /* no need to read if no events */ if (c->poll_entry->revents & (POLLERR | POLLHUP)) return -1; if (!(c->poll_entry->revents & POLLIN)) return 0; if (http_receive_data(c) < 0) return -1; break; case HTTPSTATE_WAIT_FEED: /* no need to read if no events */ if (c->poll_entry->revents & (POLLIN | POLLERR | POLLHUP)) return -1; /* nothing to do, we'll be waken up by incoming feed packets */ break; case RTSPSTATE_SEND_REPLY: if (c->poll_entry->revents & (POLLERR | POLLHUP)) { av_freep(&c->pb_buffer); return -1; } /* no need to write if no events */ if (!(c->poll_entry->revents & POLLOUT)) return 0; len = write(c->fd, c->buffer_ptr, c->buffer_end - c->buffer_ptr); if (len < 0) { if (errno != EAGAIN && errno != EINTR) { /* error : close connection */ av_freep(&c->pb_buffer); return -1; } } else { c->buffer_ptr += len; c->data_count += len; if (c->buffer_ptr >= c->buffer_end) { /* all the buffer was sent : wait for a new request */ av_freep(&c->pb_buffer); start_wait_request(c, 1); } } break; case RTSPSTATE_SEND_PACKET: if (c->poll_entry->revents & (POLLERR | POLLHUP)) { av_freep(&c->packet_buffer); return -1; } /* no need to write if no events */ if (!(c->poll_entry->revents & POLLOUT)) return 0; len = write(c->fd, c->packet_buffer_ptr, c->packet_buffer_end - c->packet_buffer_ptr); if (len < 0) { if (errno != EAGAIN && errno != EINTR) { /* error : close connection */ av_freep(&c->packet_buffer); return -1; } } else { c->packet_buffer_ptr += len; if (c->packet_buffer_ptr >= c->packet_buffer_end) { /* all the buffer was sent : wait for a new request */ av_freep(&c->packet_buffer); c->state = RTSPSTATE_WAIT_REQUEST; } } break; case HTTPSTATE_READY: /* nothing to do */ break; default: return -1; } return 0; } static 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 (strncasecmp(q, "stream-switch-entry=", 20) == 0) { int stream_no; int rate_no; q += 20; memset(rates, 0xff, ratelen); while (1) { while (*q && *q != '\n' && *q != ':') q++; if (sscanf(q, ":%d:%d", &stream_no, &rate_no) != 2) { break; } stream_no--; if (stream_no < ratelen && stream_no >= 0) { rates[stream_no] = rate_no; } while (*q && *q != '\n' && !isspace(*q)) q++; } return 1; } } p = strchr(p, '\n'); if (!p) break; p++; } return 0; } static 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 || feed_codec->sample_rate != codec->sample_rate || feed_codec->width != codec->width || feed_codec->height != codec->height) { continue; } /* Potential stream */ /* We want the fastest stream less than bit_rate, or the slowest * faster than bit_rate */ if (feed_codec->bit_rate <= bit_rate) { if (best_bitrate > bit_rate || feed_codec->bit_rate > best_bitrate) { best_bitrate = feed_codec->bit_rate; best = i; } } else { if (feed_codec->bit_rate < best_bitrate) { best_bitrate = feed_codec->bit_rate; best = i; } } } return best; } static 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; switch(rates[i]) { case 0: c->switch_feed_streams[i] = req->feed_streams[i]; break; case 1: c->switch_feed_streams[i] = find_stream_in_feed(req->feed, codec, codec->bit_rate / 2); break; case 2: /* Wants off or slow */ c->switch_feed_streams[i] = find_stream_in_feed(req->feed, codec, codec->bit_rate / 4); #ifdef WANTS_OFF /* This doesn't work well when it turns off the only stream! */ c->switch_feed_streams[i] = -2; c->feed_streams[i] = -2; #endif break; } if (c->switch_feed_streams[i] >= 0 && c->switch_feed_streams[i] != c->feed_streams[i]) action_required = 1; } return action_required; } static 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 */ } c->switch_feed_streams[i] = -1; } /* XXX: factorize in utils.c ? */ /* XXX: take care with different space meaning */ static void skip_spaces(const char **pp) { const char *p; p = *pp; while (*p == ' ' || *p == '\t') p++; *pp = p; } static 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++; } if (buf_size > 0) *q = '\0'; *pp = p; } static 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 && src_addr <= acl->last.s_addr) { return (acl->action == IP_ALLOW) ? 1 : 0; } last_action = acl->action; } /* Nothing matched, so return not the last action */ return (last_action == IP_DENY) ? 1 : 0; } /* compute the real filename of a file by matching it without its extensions to all the stream filenames */ static 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(stream = first_stream; stream != NULL; stream = stream->next) { pstrcpy(file2, sizeof(file2), stream->filename); p = strrchr(file2, '.'); if (p) *p = '\0'; if (!strcmp(file1, file2)) { pstrcpy(filename, max_size, stream->filename); break; } } } enum RedirType { REDIR_NONE, REDIR_ASX, REDIR_RAM, REDIR_ASF, REDIR_RTSP, REDIR_SDP, }; /* parse http request and prepare header */ static 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 = 0; p = c->buffer; get_word(cmd, sizeof(cmd), (const char **)&p); pstrcpy(c->method, sizeof(c->method), cmd); if (!strcmp(cmd, "GET")) post = 0; else if (!strcmp(cmd, "POST")) post = 1; else return -1; get_word(url, sizeof(url), (const char **)&p); pstrcpy(c->url, sizeof(c->url), url); get_word(protocol, sizeof(protocol), (const char **)&p); if (strcmp(protocol, "HTTP/1.0") && strcmp(protocol, "HTTP/1.1")) return -1; pstrcpy(c->protocol, sizeof(c->protocol), protocol); /* find the filename and the optional info string in the request */ p = url; if (*p == '/') p++; filename = p; p = strchr(p, '?'); if (p) { pstrcpy(info, sizeof(info), p); *p = '\0'; } else { info[0] = '\0'; } for (p = c->buffer; *p && *p != '\r' && *p != '\n'; ) { if (strncasecmp(p, "User-Agent:", 11) == 0) { useragent = p + 11; if (*useragent && *useragent != '\n' && isspace(*useragent)) useragent++; break; } p = strchr(p, '\n'); if (!p) break; p++; } redir_type = REDIR_NONE; if (match_ext(filename, "asx")) { redir_type = REDIR_ASX; filename[strlen(filename)-1] = 'f'; } else if (match_ext(filename, "asf") && (!useragent || strncasecmp(useragent, "NSPlayer", 8) != 0)) { /* if this isn't WMP or lookalike, return the redirector file */ redir_type = REDIR_ASF; } else if (match_ext(filename, "rpm,ram")) { redir_type = REDIR_RAM; strcpy(filename + strlen(filename)-2, "m"); } else if (match_ext(filename, "rtsp")) { redir_type = REDIR_RTSP; compute_real_filename(filename, sizeof(url) - 1); } else if (match_ext(filename, "sdp")) { redir_type = REDIR_SDP; compute_real_filename(filename, sizeof(url) - 1); } stream = first_stream; while (stream != NULL) { if (!strcmp(stream->filename, filename) && validate_acl(stream, c)) break; stream = stream->next; } if (stream == NULL) { snprintf(msg, sizeof(msg), "File '%s' not found", url); goto send_error; } c->stream = stream; memcpy(c->feed_streams, stream->feed_streams, sizeof(c->feed_streams)); memset(c->switch_feed_streams, -1, sizeof(c->switch_feed_streams)); if (stream->stream_type == STREAM_TYPE_REDIRECT) { c->http_error = 301; q = c->buffer; q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "HTTP/1.0 301 Moved\r\n"); q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "Location: %s\r\n", stream->feed_filename); q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "Content-type: text/html\r\n"); q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "\r\n"); q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "<html><head><title>Moved</title></head><body>\r\n"); q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "You should be <a href=\"%s\">redirected</a>.\r\n", stream->feed_filename); q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "</body></html>\r\n"); /* prepare output buffer */ c->buffer_ptr = c->buffer; c->buffer_end = q; c->state = HTTPSTATE_SEND_HEADER; return 0; } /* If this is WMP, get the rate information */ if (extract_rates(ratebuf, sizeof(ratebuf), c->buffer)) { if (modify_current_stream(c, ratebuf)) { for (i = 0; i < sizeof(c->feed_streams) / sizeof(c->feed_streams[0]); i++) { if (c->switch_feed_streams[i] >= 0) do_switch_stream(c, i); } } } if (post == 0 && stream->stream_type == STREAM_TYPE_LIVE) { current_bandwidth += stream->bandwidth; } if (post == 0 && max_bandwidth < current_bandwidth) { c->http_error = 200; q = c->buffer; q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "HTTP/1.0 200 Server too busy\r\n"); q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "Content-type: text/html\r\n"); q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "\r\n"); q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "<html><head><title>Too busy</title></head><body>\r\n"); q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "The server is too busy to serve your request at this time.<p>\r\n"); q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "The bandwidth being served (including your stream) is %dkbit/sec, and this exceeds the limit of %dkbit/sec\r\n", current_bandwidth, max_bandwidth); q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "</body></html>\r\n"); /* prepare output buffer */ c->buffer_ptr = c->buffer; c->buffer_end = q; c->state = HTTPSTATE_SEND_HEADER; return 0; } if (redir_type != REDIR_NONE) { char *hostinfo = 0; for (p = c->buffer; *p && *p != '\r' && *p != '\n'; ) { if (strncasecmp(p, "Host:", 5) == 0) { hostinfo = p + 5; break; } p = strchr(p, '\n'); if (!p) break; p++; } if (hostinfo) { char *eoh; char hostbuf[260]; while (isspace(*hostinfo)) hostinfo++; eoh = strchr(hostinfo, '\n'); if (eoh) { if (eoh[-1] == '\r') eoh--; if (eoh - hostinfo < sizeof(hostbuf) - 1) { memcpy(hostbuf, hostinfo, eoh - hostinfo); hostbuf[eoh - hostinfo] = 0; c->http_error = 200; q = c->buffer; switch(redir_type) { case REDIR_ASX: q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "HTTP/1.0 200 ASX Follows\r\n"); q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "Content-type: video/x-ms-asf\r\n"); q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "\r\n"); q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "<ASX Version=\"3\">\r\n"); //q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "<!-- Autogenerated by ffserver -->\r\n"); q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "<ENTRY><REF HREF=\"http://%s/%s%s\"/></ENTRY>\r\n", hostbuf, filename, info); q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "</ASX>\r\n"); break; case REDIR_RAM: q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "HTTP/1.0 200 RAM Follows\r\n"); q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "Content-type: audio/x-pn-realaudio\r\n"); q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "\r\n"); q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "# Autogenerated by ffserver\r\n"); q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "http://%s/%s%s\r\n", hostbuf, filename, info); break; case REDIR_ASF: q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "HTTP/1.0 200 ASF Redirect follows\r\n"); q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "Content-type: video/x-ms-asf\r\n"); q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "\r\n"); q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "[Reference]\r\n"); q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "Ref1=http://%s/%s%s\r\n", hostbuf, filename, info); break; case REDIR_RTSP: { char hostname[256], *p; /* extract only hostname */ pstrcpy(hostname, sizeof(hostname), hostbuf); p = strrchr(hostname, ':'); if (p) *p = '\0'; q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "HTTP/1.0 200 RTSP Redirect follows\r\n"); /* XXX: incorrect mime type ? */ q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "Content-type: application/x-rtsp\r\n"); q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "\r\n"); q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "rtsp://%s:%d/%s\r\n", hostname, ntohs(my_rtsp_addr.sin_port), filename); } break; case REDIR_SDP: { uint8_t *sdp_data; int sdp_data_size, len; struct sockaddr_in my_addr; q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "HTTP/1.0 200 OK\r\n"); q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "Content-type: application/sdp\r\n"); q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "\r\n"); len = sizeof(my_addr); getsockname(c->fd, (struct sockaddr *)&my_addr, &len); /* XXX: should use a dynamic buffer */ sdp_data_size = prepare_sdp_description(stream, &sdp_data, my_addr.sin_addr); if (sdp_data_size > 0) { memcpy(q, sdp_data, sdp_data_size); q += sdp_data_size; *q = '\0'; av_free(sdp_data); } } break; default: av_abort(); break; } /* prepare output buffer */ c->buffer_ptr = c->buffer; c->buffer_end = q; c->state = HTTPSTATE_SEND_HEADER; return 0; } } } snprintf(msg, sizeof(msg), "ASX/RAM file not handled"); goto send_error; } stream->conns_served++; /* XXX: add there authenticate and IP match */ if (post) { /* if post, it means a feed is being sent */ if (!stream->is_feed) { /* However it might be a status report from WMP! Lets log the data * as it might come in handy one day */ char *logline = 0; int client_id = 0; for (p = c->buffer; *p && *p != '\r' && *p != '\n'; ) { if (strncasecmp(p, "Pragma: log-line=", 17) == 0) { logline = p; break; } if (strncasecmp(p, "Pragma: client-id=", 18) == 0) { client_id = strtol(p + 18, 0, 10); } p = strchr(p, '\n'); if (!p) break; p++; } if (logline) { char *eol = strchr(logline, '\n'); logline += 17; if (eol) { if (eol[-1] == '\r') eol--; http_log("%.*s\n", (int) (eol - logline), logline); c->suppress_log = 1; } } #ifdef DEBUG_WMP http_log("\nGot request:\n%s\n", c->buffer); #endif if (client_id && extract_rates(ratebuf, sizeof(ratebuf), c->buffer)) { HTTPContext *wmpc; /* Now we have to find the client_id */ for (wmpc = first_http_ctx; wmpc; wmpc = wmpc->next) { if (wmpc->wmp_client_id == client_id) break; } if (wmpc) { if (modify_current_stream(wmpc, ratebuf)) { wmpc->switch_pending = 1; } } } snprintf(msg, sizeof(msg), "POST command not handled"); c->stream = 0; goto send_error; } if (http_start_receive_data(c) < 0) { snprintf(msg, sizeof(msg), "could not open feed"); goto send_error; } c->http_error = 0; c->state = HTTPSTATE_RECEIVE_DATA; return 0; } #ifdef DEBUG_WMP if (strcmp(stream->filename + strlen(stream->filename) - 4, ".asf") == 0) { http_log("\nGot request:\n%s\n", c->buffer); } #endif if (c->stream->stream_type == STREAM_TYPE_STATUS) goto send_stats; /* open input stream */ if (open_input_stream(c, info) < 0) { snprintf(msg, sizeof(msg), "Input stream corresponding to '%s' not found", url); goto send_error; } /* prepare http header */ q = c->buffer; q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "HTTP/1.0 200 OK\r\n"); mime_type = c->stream->fmt->mime_type; if (!mime_type) mime_type = "application/x-octet_stream"; q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "Pragma: no-cache\r\n"); /* for asf, we need extra headers */ if (!strcmp(c->stream->fmt->name,"asf_stream")) { /* Need to allocate a client id */ c->wmp_client_id = random() & 0x7fffffff; q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "Server: Cougar 4.1.0.3923\r\nCache-Control: no-cache\r\nPragma: client-id=%d\r\nPragma: features=\"broadcast\"\r\n", c->wmp_client_id); } q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "Content-Type: %s\r\n", mime_type); q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "\r\n"); /* prepare output buffer */ c->http_error = 0; c->buffer_ptr = c->buffer; c->buffer_end = q; c->state = HTTPSTATE_SEND_HEADER; return 0; send_error: c->http_error = 404; q = c->buffer; q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "HTTP/1.0 404 Not Found\r\n"); q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "Content-type: %s\r\n", "text/html"); q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "\r\n"); q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "<HTML>\n"); q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "<HEAD><TITLE>404 Not Found</TITLE></HEAD>\n"); q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "<BODY>%s</BODY>\n", msg); q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "</HTML>\n"); /* prepare output buffer */ c->buffer_ptr = c->buffer; c->buffer_end = q; c->state = HTTPSTATE_SEND_HEADER; return 0; send_stats: compute_stats(c); c->http_error = 200; /* horrible : we use this value to avoid going to the send data state */ c->state = HTTPSTATE_SEND_HEADER; return 0; } static 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++) { } url_fprintf(pb, "%lld%c", count, *s); } static 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; } url_fprintf(pb, "HTTP/1.0 200 OK\r\n"); url_fprintf(pb, "Content-type: %s\r\n", "text/html"); url_fprintf(pb, "Pragma: no-cache\r\n"); url_fprintf(pb, "\r\n"); url_fprintf(pb, "<HEAD><TITLE>FFServer Status</TITLE>\n"); if (c->stream->feed_filename) { url_fprintf(pb, "<link rel=\"shortcut icon\" href=\"%s\">\n", c->stream->feed_filename); } url_fprintf(pb, "</HEAD>\n<BODY>"); url_fprintf(pb, "<H1>FFServer Status</H1>\n"); /* format status */ url_fprintf(pb, "<H2>Available Streams</H2>\n"); url_fprintf(pb, "<TABLE cellspacing=0 cellpadding=4>\n"); url_fprintf(pb, "<TR><Th valign=top>Path<th align=left>Served<br>Conns<Th><br>bytes<Th valign=top>Format<Th>Bit rate<br>kbits/s<Th align=left>Video<br>kbits/s<th><br>Codec<Th align=left>Audio<br>kbits/s<th><br>Codec<Th align=left valign=top>Feed\n"); stream = first_stream; while (stream != NULL) { char sfilename[1024]; char *eosf; if (stream->feed != stream) { pstrcpy(sfilename, sizeof(sfilename) - 10, stream->filename); eosf = sfilename + strlen(sfilename); if (eosf - sfilename >= 4) { if (strcmp(eosf - 4, ".asf") == 0) { strcpy(eosf - 4, ".asx"); } else if (strcmp(eosf - 3, ".rm") == 0) { strcpy(eosf - 3, ".ram"); } 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 + strlen(sfilename); if (stream->is_multicast) strcpy(eosf, ".sdp"); else strcpy(eosf, ".rtsp"); } } url_fprintf(pb, "<TR><TD><A HREF=\"/%s\">%s</A> ", sfilename, stream->filename); url_fprintf(pb, "<td align=right> %d <td align=right> ", stream->conns_served); fmt_bytecount(pb, stream->bytes_served); switch(stream->stream_type) { case STREAM_TYPE_LIVE: { int audio_bit_rate = 0; int video_bit_rate = 0; const char *audio_codec_name = ""; const char *video_codec_name = ""; const char *audio_codec_name_extra = ""; const char *video_codec_name_extra = ""; for(i=0;i<stream->nb_streams;i++) { AVStream *st = stream->streams[i]; AVCodec *codec = avcodec_find_encoder(st->codec.codec_id); switch(st->codec.codec_type) { case CODEC_TYPE_AUDIO: audio_bit_rate += st->codec.bit_rate; if (codec) { if (*audio_codec_name) audio_codec_name_extra = "..."; audio_codec_name = codec->name; } break; case CODEC_TYPE_VIDEO: video_bit_rate += st->codec.bit_rate; if (codec) { if (*video_codec_name) video_codec_name_extra = "..."; video_codec_name = codec->name; } break; case CODEC_TYPE_DATA: video_bit_rate += st->codec.bit_rate; break; default: av_abort(); } } url_fprintf(pb, "<TD align=center> %s <TD align=right> %d <TD align=right> %d <TD> %s %s <TD align=right> %d <TD> %s %s", stream->fmt->name, stream->bandwidth, video_bit_rate / 1000, video_codec_name, video_codec_name_extra, audio_bit_rate / 1000, audio_codec_name, audio_codec_name_extra); if (stream->feed) { url_fprintf(pb, "<TD>%s", stream->feed->filename); } else { url_fprintf(pb, "<TD>%s", stream->feed_filename); } url_fprintf(pb, "\n"); } break; default: url_fprintf(pb, "<TD align=center> - <TD align=right> - <TD align=right> - <td><td align=right> - <TD>\n"); break; } } stream = stream->next; } url_fprintf(pb, "</TABLE>\n"); stream = first_stream; while (stream != NULL) { if (stream->feed == stream) { url_fprintf(pb, "<h2>Feed %s</h2>", stream->filename); if (stream->pid) { url_fprintf(pb, "Running as pid %d.\n", stream->pid); #if defined(linux) && !defined(CONFIG_NOCUTILS) { FILE *pid_stat; char ps_cmd[64]; /* This is somewhat linux specific I guess */ snprintf(ps_cmd, sizeof(ps_cmd), "ps -o \"%%cpu,cputime\" --no-headers %d", stream->pid); pid_stat = popen(ps_cmd, "r"); if (pid_stat) { char cpuperc[10]; char cpuused[64]; if (fscanf(pid_stat, "%10s %64s", cpuperc, cpuused) == 2) { url_fprintf(pb, "Currently using %s%% of the cpu. Total time used %s.\n", cpuperc, cpuused); } fclose(pid_stat); } } #endif url_fprintf(pb, "<p>"); } url_fprintf(pb, "<table cellspacing=0 cellpadding=4><tr><th>Stream<th>type<th>kbits/s<th align=left>codec<th align=left>Parameters\n"); for (i = 0; i < stream->nb_streams; i++) { AVStream *st = stream->streams[i]; AVCodec *codec = avcodec_find_encoder(st->codec.codec_id); const char *type = "unknown"; char parameters[64]; parameters[0] = 0; switch(st->codec.codec_type) { case CODEC_TYPE_AUDIO: type = "audio"; break; case CODEC_TYPE_VIDEO: type = "video"; snprintf(parameters, sizeof(parameters), "%dx%d, q=%d-%d, fps=%d", st->codec.width, st->codec.height, st->codec.qmin, st->codec.qmax, st->codec.frame_rate / st->codec.frame_rate_base); break; default: av_abort(); } url_fprintf(pb, "<tr><td align=right>%d<td>%s<td align=right>%d<td>%s<td>%s\n", i, type, st->codec.bit_rate/1000, codec ? codec->name : "", parameters); } url_fprintf(pb, "</table>\n"); } stream = stream->next; } #if 0 { float avg; AVCodecContext *enc; char buf[1024]; /* feed status */ stream = first_feed; while (stream != NULL) { url_fprintf(pb, "<H1>Feed '%s'</H1>\n", stream->filename); url_fprintf(pb, "<TABLE>\n"); url_fprintf(pb, "<TR><TD>Parameters<TD>Frame count<TD>Size<TD>Avg bitrate (kbits/s)\n"); for(i=0;i<stream->nb_streams;i++) { AVStream *st = stream->streams[i]; FeedData *fdata = st->priv_data; enc = &st->codec; avcodec_string(buf, sizeof(buf), enc); avg = fdata->avg_frame_size * (float)enc->rate * 8.0; if (enc->codec->type == CODEC_TYPE_AUDIO && enc->frame_size > 0) avg /= enc->frame_size; url_fprintf(pb, "<TR><TD>%s <TD> %d <TD> %Ld <TD> %0.1f\n", buf, enc->frame_number, fdata->data_count, avg / 1000.0); } url_fprintf(pb, "</TABLE>\n"); stream = stream->next_feed; } } #endif /* connection status */ url_fprintf(pb, "<H2>Connection Status</H2>\n"); url_fprintf(pb, "Number of connections: %d / %d<BR>\n", nb_connections, nb_max_connections); url_fprintf(pb, "Bandwidth in use: %dk / %dk<BR>\n", current_bandwidth, max_bandwidth); url_fprintf(pb, "<TABLE>\n"); url_fprintf(pb, "<TR><th>#<th>File<th>IP<th>Proto<th>State<th>Target bits/sec<th>Actual bits/sec<th>Bytes transferred\n"); c1 = first_http_ctx; i = 0; while (c1 != NULL) { int bitrate; int j; bitrate = 0; if (c1->stream) { for (j = 0; j < c1->stream->nb_streams; j++) { if (!c1->stream->feed) { bitrate += c1->stream->streams[j]->codec.bit_rate; } else { if (c1->feed_streams[j] >= 0) { bitrate += c1->stream->feed->streams[c1->feed_streams[j]]->codec.bit_rate; } } } } i++; p = inet_ntoa(c1->from_addr.sin_addr); url_fprintf(pb, "<TR><TD><B>%d</B><TD>%s%s<TD>%s<TD>%s<TD>%s<td align=right>", i, c1->stream ? c1->stream->filename : "", c1->state == HTTPSTATE_RECEIVE_DATA ? "(input)" : "", p, c1->protocol, http_state[c1->state]); fmt_bytecount(pb, bitrate); url_fprintf(pb, "<td align=right>"); fmt_bytecount(pb, compute_datarate(&c1->datarate, c1->data_count) * 8); url_fprintf(pb, "<td align=right>"); fmt_bytecount(pb, c1->data_count); url_fprintf(pb, "\n"); c1 = c1->next; } url_fprintf(pb, "</TABLE>\n"); /* date */ ti = time(NULL); p = ctime(&ti); url_fprintf(pb, "<HR size=1 noshade>Generated at %s", p); url_fprintf(pb, "</BODY>\n</HTML>\n"); len = url_close_dyn_buf(pb, &c->pb_buffer); c->buffer_ptr = c->pb_buffer; c->buffer_end = c->pb_buffer + len; } /* check if the parser needs to be opened for stream i */ static 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_open(&st->codec, codec) < 0) { st->codec.parse_only = 0; } } } } static 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_PACKET_SIZE; /* compute position (absolute time) */ if (find_info_tag(buf, sizeof(buf), "date", info)) { stream_pos = parse_date(buf, 0); } else if (find_info_tag(buf, sizeof(buf), "buffer", info)) { int prebuffer = strtol(buf, 0, 10); stream_pos = av_gettime() - prebuffer * (int64_t)1000000; } else { stream_pos = av_gettime() - c->stream->prebuffer * (int64_t)1000; } } else { strcpy(input_filename, c->stream->feed_filename); buf_size = 0; /* compute position (relative time) */ if (find_info_tag(buf, sizeof(buf), "date", info)) { stream_pos = parse_date(buf, 1); } else { stream_pos = 0; } } if (input_filename[0] == '\0') return -1; #if 0 { time_t when = stream_pos / 1000000; http_log("Stream pos = %lld, time=%s", stream_pos, ctime(&when)); } #endif /* open stream */ if (av_open_input_file(&s, input_filename, c->stream->ifmt, buf_size, c->stream->ap_in) < 0) { http_log("%s not found", input_filename); return -1; } c->fmt_in = s; /* open each parser */ for(i=0;i<s->nb_streams;i++) open_parser(s, i); /* choose stream as clock source (we favorize video stream if present) for packet sending */ c->pts_stream_index = 0; for(i=0;i<c->stream->nb_streams;i++) { if (c->pts_stream_index == 0 && c->stream->streams[i]->codec.codec_type == CODEC_TYPE_VIDEO) { c->pts_stream_index = i; } } #if 0 if (c->fmt_in->iformat->read_seek) { c->fmt_in->iformat->read_seek(c->fmt_in, stream_pos); } #endif /* set the start time (needed for maxtime and RTP packet timing) */ c->start_time = cur_time; c->first_pts = AV_NOPTS_VALUE; return 0; } /* return the server clock (in us) */ static int64_t get_server_clock(HTTPContext *c) { /* compute current pts value from system time */ return (int64_t)(cur_time - c->start_time) * 1000LL; } /* return the estimated time at which the current packet must be sent (in us) */ static 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; } else { bytes_left = c->buffer_end - c->buffer_ptr; bytes_sent = frame_bytes - bytes_left; return c->cur_pts + (c->cur_frame_duration * bytes_sent) / frame_bytes; } } static 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->author); pstrcpy(c->fmt_ctx.comment, sizeof(c->fmt_ctx.comment), c->stream->comment); pstrcpy(c->fmt_ctx.copyright, sizeof(c->fmt_ctx.copyright), c->stream->copyright); pstrcpy(c->fmt_ctx.title, sizeof(c->fmt_ctx.title), c->stream->title); /* open output stream by using specified codecs */ c->fmt_ctx.oformat = c->stream->fmt; c->fmt_ctx.nb_streams = c->stream->nb_streams; for(i=0;i<c->fmt_ctx.nb_streams;i++) { AVStream *st; AVStream *src; st = av_mallocz(sizeof(AVStream)); c->fmt_ctx.streams[i] = st; /* if file or feed, then just take streams from FFStream struct */ if (!c->stream->feed || c->stream->feed == c->stream) src = c->stream->streams[i]; else src = c->stream->feed->streams[c->stream->feed_streams[i]]; *st = *src; st->priv_data = 0; st->codec.frame_number = 0; /* XXX: should be done in AVStream, not in codec */ /* I'm pretty sure that this is not correct... * However, without it, we crash */ st->codec.coded_frame = &dummy_frame; } c->got_key_frame = 0; /* prepare header and save header data in a stream */ if (url_open_dyn_buf(&c->fmt_ctx.pb) < 0) { /* XXX: potential leak */ return -1; } c->fmt_ctx.pb.is_streamed = 1; av_set_parameters(&c->fmt_ctx, NULL); av_write_header(&c->fmt_ctx); len = url_close_dyn_buf(&c->fmt_ctx.pb, &c->pb_buffer); c->buffer_ptr = c->pb_buffer; c->buffer_end = c->pb_buffer + len; c->state = HTTPSTATE_SEND_DATA; c->last_packet_sent = 0; break; case HTTPSTATE_SEND_DATA: /* find a new packet */ { AVPacket pkt; /* read a packet from the input stream */ if (c->stream->feed) { ffm_set_write_index(c->fmt_in, c->stream->feed->feed_write_index, c->stream->feed->feed_size); } if (c->stream->max_time && c->stream->max_time + c->start_time - cur_time < 0) { /* We have timed out */ c->state = HTTPSTATE_SEND_DATA_TRAILER; } else { redo: if (av_read_frame(c->fmt_in, &pkt) < 0) { if (c->stream->feed && c->stream->feed->feed_opened) { /* if coming from feed, it means we reached the end of the ffm file, so must wait for more data */ c->state = HTTPSTATE_WAIT_FEED; return 1; /* state changed */ } else { if (c->stream->loop) { av_close_input_file(c->fmt_in); c->fmt_in = NULL; if (open_input_stream(c, "") < 0) goto no_loop; goto redo; } else { no_loop: /* must send trailer now because eof or error */ c->state = HTTPSTATE_SEND_DATA_TRAILER; } } } else { /* update first pts if needed */ if (c->first_pts == AV_NOPTS_VALUE) { c->first_pts = pkt.dts; c->start_time = cur_time; } /* send it to the appropriate stream */ if (c->stream->feed) { /* if coming from a feed, select the right stream */ if (c->switch_pending) { c->switch_pending = 0; for(i=0;i<c->stream->nb_streams;i++) { if (c->switch_feed_streams[i] == pkt.stream_index) { if (pkt.flags & PKT_FLAG_KEY) { do_switch_stream(c, i); } } if (c->switch_feed_streams[i] >= 0) { c->switch_pending = 1; } } } for(i=0;i<c->stream->nb_streams;i++) { if (c->feed_streams[i] == pkt.stream_index) { pkt.stream_index = i; if (pkt.flags & PKT_FLAG_KEY) { c->got_key_frame |= 1 << i; } /* See if we have all the key frames, then * we start to send. This logic is not quite * right, but it works for the case of a * single video stream with one or more * audio streams (for which every frame is * typically a key frame). */ if (!c->stream->send_on_key || ((c->got_key_frame + 1) >> c->stream->nb_streams)) { goto send_it; } } } } else { AVCodecContext *codec; send_it: /* specific handling for RTP: we use several output stream (one for each RTP connection). XXX: need more abstract handling */ if (c->is_packetized) { AVStream *st; /* compute send time and duration */ st = c->fmt_in->streams[pkt.stream_index]; c->cur_pts = pkt.dts; if (st->start_time != AV_NOPTS_VALUE) c->cur_pts -= st->start_time; c->cur_frame_duration = pkt.duration; #if 0 printf("index=%d pts=%0.3f duration=%0.6f\n", pkt.stream_index, (double)c->cur_pts / AV_TIME_BASE, (double)c->cur_frame_duration / AV_TIME_BASE); #endif /* find RTP context */ c->packet_stream_index = pkt.stream_index; ctx = c->rtp_ctx[c->packet_stream_index]; if(!ctx) { av_free_packet(&pkt); break; } codec = &ctx->streams[0]->codec; /* only one stream per RTP connection */ pkt.stream_index = 0; } else { ctx = &c->fmt_ctx; /* Fudge here */ codec = &ctx->streams[pkt.stream_index]->codec; } codec->coded_frame->key_frame = ((pkt.flags & PKT_FLAG_KEY) != 0); if (c->is_packetized) { int max_packet_size; if (c->rtp_protocol == RTSP_PROTOCOL_RTP_TCP) max_packet_size = RTSP_TCP_MAX_PACKET_SIZE; else max_packet_size = url_get_max_packet_size(c->rtp_handles[c->packet_stream_index]); ret = url_open_dyn_packet_buf(&ctx->pb, max_packet_size); } else { ret = url_open_dyn_buf(&ctx->pb); } if (ret < 0) { /* XXX: potential leak */ return -1; } if (av_write_frame(ctx, &pkt)) { c->state = HTTPSTATE_SEND_DATA_TRAILER; } len = url_close_dyn_buf(&ctx->pb, &c->pb_buffer); c->cur_frame_bytes = len; c->buffer_ptr = c->pb_buffer; c->buffer_end = c->pb_buffer + len; codec->frame_number++; if (len == 0) goto redo; } av_free_packet(&pkt); } } } break; default: case HTTPSTATE_SEND_DATA_TRAILER: /* last packet test ? */ if (c->last_packet_sent || c->is_packetized) return -1; ctx = &c->fmt_ctx; /* prepare header */ if (url_open_dyn_buf(&ctx->pb) < 0) { /* XXX: potential leak */ return -1; } av_write_trailer(ctx); len = url_close_dyn_buf(&ctx->pb, &c->pb_buffer); c->buffer_ptr = c->pb_buffer; c->buffer_end = c->pb_buffer + len; c->last_packet_sent = 1; break; } return 0; } /* in bit/s */ #define SHORT_TERM_BANDWIDTH 8000000 /* should convert the format at the same time */ /* send data starting at c->buffer_ptr to the output connection (either UDP or TCP connection) */ static 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; } } else { if (c->is_packetized) { /* RTP data output */ len = c->buffer_end - c->buffer_ptr; if (len < 4) { /* fail safe - should never happen */ fail1: c->buffer_ptr = c->buffer_end; return 0; } len = (c->buffer_ptr[0] << 24) | (c->buffer_ptr[1] << 16) | (c->buffer_ptr[2] << 8) | (c->buffer_ptr[3]); if (len > (c->buffer_end - c->buffer_ptr)) goto fail1; if ((get_packet_send_clock(c) - get_server_clock(c)) > 0) { /* nothing to send yet: we can wait */ return 0; } c->data_count += len; update_datarate(&c->datarate, c->data_count); if (c->stream) c->stream->bytes_served += len; if (c->rtp_protocol == RTSP_PROTOCOL_RTP_TCP) { /* RTP packets are sent inside the RTSP TCP connection */ ByteIOContext pb1, *pb = &pb1; int interleaved_index, size; uint8_t header[4]; HTTPContext *rtsp_c; rtsp_c = c->rtsp_c; /* if no RTSP connection left, error */ if (!rtsp_c) return -1; /* if already sending something, then wait. */ if (rtsp_c->state != RTSPSTATE_WAIT_REQUEST) { break; } if (url_open_dyn_buf(pb) < 0) goto fail1; interleaved_index = c->packet_stream_index * 2; /* RTCP packets are sent at odd indexes */ if (c->buffer_ptr[1] == 200) interleaved_index++; /* write RTSP TCP header */ header[0] = '$'; header[1] = interleaved_index; header[2] = len >> 8; header[3] = len; put_buffer(pb, header, 4); /* write RTP packet data */ c->buffer_ptr += 4; put_buffer(pb, c->buffer_ptr, len); size = url_close_dyn_buf(pb, &c->packet_buffer); /* prepare asynchronous TCP sending */ rtsp_c->packet_buffer_ptr = c->packet_buffer; rtsp_c->packet_buffer_end = c->packet_buffer + size; c->buffer_ptr += len; /* send everything we can NOW */ len = write(rtsp_c->fd, rtsp_c->packet_buffer_ptr, rtsp_c->packet_buffer_end - rtsp_c->packet_buffer_ptr); if (len > 0) { rtsp_c->packet_buffer_ptr += len; } if (rtsp_c->packet_buffer_ptr < rtsp_c->packet_buffer_end) { /* if we could not send all the data, we will send it later, so a new state is needed to "lock" the RTSP TCP connection */ rtsp_c->state = RTSPSTATE_SEND_PACKET; break; } else { /* all data has been sent */ av_freep(&c->packet_buffer); } } else { /* send RTP packet directly in UDP */ c->buffer_ptr += 4; url_write(c->rtp_handles[c->packet_stream_index], c->buffer_ptr, len); c->buffer_ptr += len; /* here we continue as we can send several packets per 10 ms slot */ } } else { /* TCP data output */ len = write(c->fd, c->buffer_ptr, c->buffer_end - c->buffer_ptr); if (len < 0) { if (errno != EAGAIN && errno != EINTR) { /* error : close connection */ return -1; } else { return 0; } } else { c->buffer_ptr += len; } c->data_count += len; update_datarate(&c->datarate, c->data_count); if (c->stream) c->stream->bytes_served += len; break; } } } /* for(;;) */ return 0; } static 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_fd = fd; c->stream->feed_write_index = ffm_read_write_index(fd); c->stream->feed_size = lseek(fd, 0, SEEK_END); lseek(fd, 0, SEEK_SET); /* init buffer input */ c->buffer_ptr = c->buffer; c->buffer_end = c->buffer + FFM_PACKET_SIZE; c->stream->feed_opened = 1; return 0; } static 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 */ goto fail; } } else if (len == 0) { /* end of connection : close it */ goto fail; } else { c->buffer_ptr += len; c->data_count += len; update_datarate(&c->datarate, c->data_count); } } if (c->buffer_ptr - c->buffer >= 2 && c->data_count > FFM_PACKET_SIZE) { if (c->buffer[0] != 'f' || c->buffer[1] != 'm') { http_log("Feed stream has become desynchronized -- disconnecting\n"); goto fail; } } if (c->buffer_ptr >= c->buffer_end) { FFStream *feed = c->stream; /* a packet has been received : write it in the store, except if header */ if (c->data_count > FFM_PACKET_SIZE) { // printf("writing pos=0x%Lx size=0x%Lx\n", feed->feed_write_index, feed->feed_size); /* XXX: use llseek or url_seek */ lseek(c->feed_fd, feed->feed_write_index, SEEK_SET); write(c->feed_fd, c->buffer, FFM_PACKET_SIZE); feed->feed_write_index += FFM_PACKET_SIZE; /* update file size */ if (feed->feed_write_index > c->stream->feed_size) feed->feed_size = feed->feed_write_index; /* handle wrap around if max file size reached */ if (feed->feed_write_index >= c->stream->feed_max_size) feed->feed_write_index = FFM_PACKET_SIZE; /* write index */ ffm_write_write_index(c->feed_fd, feed->feed_write_index); /* wake up any waiting connections */ for(c1 = first_http_ctx; c1 != NULL; c1 = c1->next) { if (c1->state == HTTPSTATE_WAIT_FEED && c1->stream->feed == c->stream->feed) { c1->state = HTTPSTATE_SEND_DATA; } } } else { /* We have a header in our hands that contains useful data */ AVFormatContext s; AVInputFormat *fmt_in; ByteIOContext *pb = &s.pb; int i; memset(&s, 0, sizeof(s)); url_open_buf(pb, c->buffer, c->buffer_end - c->buffer, URL_RDONLY); pb->buf_end = c->buffer_end; /* ?? */ pb->is_streamed = 1; /* use feed output format name to find corresponding input format */ fmt_in = av_find_input_format(feed->fmt->name); if (!fmt_in) goto fail; if (fmt_in->priv_data_size > 0) { s.priv_data = av_mallocz(fmt_in->priv_data_size); if (!s.priv_data) goto fail; } else s.priv_data = NULL; if (fmt_in->read_header(&s, 0) < 0) { av_freep(&s.priv_data); goto fail; } /* Now we have the actual streams */ if (s.nb_streams != feed->nb_streams) { av_freep(&s.priv_data); goto fail; } for (i = 0; i < s.nb_streams; i++) { memcpy(&feed->streams[i]->codec, &s.streams[i]->codec, sizeof(AVCodecContext)); } av_freep(&s.priv_data); } c->buffer_ptr = c->buffer; } return 0; fail: c->stream->feed_opened = 0; close(c->feed_fd); return -1; } /********************************************************************/ /* RTSP handling */ static void rtsp_reply_header(HTTPContext *c, enum RTSPStatusCode error_number) { const char *str; time_t ti; char *p; char buf2[32]; switch(error_number) { #define DEF(n, c, s) case c: str = s; break; #include "rtspcodes.h" #undef DEF default: str = "Unknown Error"; break; } url_fprintf(c->pb, "RTSP/1.0 %d %s\r\n", error_number, str); url_fprintf(c->pb, "CSeq: %d\r\n", c->seq); /* output GMT time */ ti = time(NULL); p = ctime(&ti); strcpy(buf2, p); p = buf2 + strlen(p) - 1; if (*p == '\n') *p = '\0'; url_fprintf(c->pb, "Date: %s GMT\r\n", buf2); } static void rtsp_reply_error(HTTPContext *c, enum RTSPStatusCode error_number) { rtsp_reply_header(c, error_number); url_fprintf(c->pb, "\r\n"); } static int rtsp_parse_request(HTTPContext *c) { const char *p, *p1, *p2; char cmd[32]; char url[1024]; char protocol[32]; char line[1024]; ByteIOContext pb1; int len; RTSPHeader header1, *header = &header1; c->buffer_ptr[0] = '\0'; p = c->buffer; get_word(cmd, sizeof(cmd), &p); get_word(url, sizeof(url), &p); get_word(protocol, sizeof(protocol), &p); pstrcpy(c->method, sizeof(c->method), cmd); pstrcpy(c->url, sizeof(c->url), url); pstrcpy(c->protocol, sizeof(c->protocol), protocol); c->pb = &pb1; if (url_open_dyn_buf(c->pb) < 0) { /* XXX: cannot do more */ c->pb = NULL; /* safety */ return -1; } /* check version name */ if (strcmp(protocol, "RTSP/1.0") != 0) { rtsp_reply_error(c, RTSP_STATUS_VERSION); goto the_end; } /* parse each header line */ memset(header, 0, sizeof(RTSPHeader)); /* skip to next line */ while (*p != '\n' && *p != '\0') p++; if (*p == '\n') p++; while (*p != '\0') { p1 = strchr(p, '\n'); if (!p1) break; p2 = p1; if (p2 > p && p2[-1] == '\r') p2--; /* skip empty line */ if (p2 == p) break; len = p2 - p; if (len > sizeof(line) - 1) len = sizeof(line) - 1; memcpy(line, p, len); line[len] = '\0'; rtsp_parse_line(header, line); p = p1 + 1; } /* handle sequence number */ c->seq = header->seq; if (!strcmp(cmd, "DESCRIBE")) { rtsp_cmd_describe(c, url); } else if (!strcmp(cmd, "OPTIONS")) { rtsp_cmd_options(c, url); } else if (!strcmp(cmd, "SETUP")) { rtsp_cmd_setup(c, url, header); } else if (!strcmp(cmd, "PLAY")) { rtsp_cmd_play(c, url, header); } else if (!strcmp(cmd, "PAUSE")) { rtsp_cmd_pause(c, url, header); } else if (!strcmp(cmd, "TEARDOWN")) { rtsp_cmd_teardown(c, url, header); } else { rtsp_reply_error(c, RTSP_STATUS_METHOD); } the_end: len = url_close_dyn_buf(c->pb, &c->pb_buffer); c->pb = NULL; /* safety */ if (len < 0) { /* XXX: cannot do more */ return -1; } c->buffer_ptr = c->pb_buffer; c->buffer_end = c->pb_buffer + len; c->state = RTSPSTATE_SEND_REPLY; return 0; } /* XXX: move that to rtsp.c, but would need to replace FFStream by AVFormatContext */ static int prepare_sdp_description(FFStream *stream, uint8_t **pbuffer, struct in_addr my_ip) { ByteIOContext pb1, *pb = &pb1; int i, payload_type, port, private_payload_type, j; const char *ipstr, *title, *mediatype; AVStream *st; if (url_open_dyn_buf(pb) < 0) return -1; /* general media info */ url_fprintf(pb, "v=0\n"); ipstr = inet_ntoa(my_ip); url_fprintf(pb, "o=- 0 0 IN IP4 %s\n", ipstr); title = stream->title; if (title[0] == '\0') title = "No Title"; url_fprintf(pb, "s=%s\n", title); if (stream->comment[0] != '\0') url_fprintf(pb, "i=%s\n", stream->comment); if (stream->is_multicast) { url_fprintf(pb, "c=IN IP4 %s\n", inet_ntoa(stream->multicast_ip)); } /* for each stream, we output the necessary info */ private_payload_type = RTP_PT_PRIVATE; for(i = 0; i < stream->nb_streams; i++) { st = stream->streams[i]; if (st->codec.codec_id == CODEC_ID_MPEG2TS) { mediatype = "video"; } else { switch(st->codec.codec_type) { case CODEC_TYPE_AUDIO: mediatype = "audio"; break; case CODEC_TYPE_VIDEO: mediatype = "video"; break; default: mediatype = "application"; break; } } /* NOTE: the port indication is not correct in case of unicast. It is not an issue because RTSP gives it */ payload_type = rtp_get_payload_type(&st->codec); if (payload_type < 0) payload_type = private_payload_type++; if (stream->is_multicast) { port = stream->multicast_port + 2 * i; } else { port = 0; } url_fprintf(pb, "m=%s %d RTP/AVP %d\n", mediatype, port, payload_type); if (payload_type >= RTP_PT_PRIVATE) { /* for private payload type, we need to give more info */ switch(st->codec.codec_id) { case CODEC_ID_MPEG4: { uint8_t *data; url_fprintf(pb, "a=rtpmap:%d MP4V-ES/%d\n", payload_type, 90000); /* we must also add the mpeg4 header */ data = st->codec.extradata; if (data) { url_fprintf(pb, "a=fmtp:%d config=", payload_type); for(j=0;j<st->codec.extradata_size;j++) { url_fprintf(pb, "%02x", data[j]); } url_fprintf(pb, "\n"); } } break; default: /* XXX: add other codecs ? */ goto fail; } } url_fprintf(pb, "a=control:streamid=%d\n", i); } return url_close_dyn_buf(pb, pbuffer); fail: url_close_dyn_buf(pb, pbuffer); av_free(*pbuffer); return -1; } static void rtsp_cmd_options(HTTPContext *c, const char *url) { // rtsp_reply_header(c, RTSP_STATUS_OK); url_fprintf(c->pb, "RTSP/1.0 %d %s\r\n", RTSP_STATUS_OK, "OK"); url_fprintf(c->pb, "CSeq: %d\r\n", c->seq); url_fprintf(c->pb, "Public: %s\r\n", "OPTIONS, DESCRIBE, SETUP, TEARDOWN, PLAY, PAUSE"); url_fprintf(c->pb, "\r\n"); } static void rtsp_cmd_describe(HTTPContext *c, const char *url) { FFStream *stream; char path1[1024]; const char *path; uint8_t *content; int content_length, len; struct sockaddr_in my_addr; /* find which url is asked */ url_split(NULL, 0, NULL, 0, NULL, 0, NULL, path1, sizeof(path1), url); path = path1; if (*path == '/') path++; for(stream = first_stream; stream != NULL; stream = stream->next) { if (!stream->is_feed && stream->fmt == &rtp_mux && !strcmp(path, stream->filename)) { goto found; } } /* no stream found */ rtsp_reply_error(c, RTSP_STATUS_SERVICE); /* XXX: right error ? */ return; found: /* prepare the media description in sdp format */ /* get the host IP */ len = sizeof(my_addr); getsockname(c->fd, (struct sockaddr *)&my_addr, &len); content_length = prepare_sdp_description(stream, &content, my_addr.sin_addr); if (content_length < 0) { rtsp_reply_error(c, RTSP_STATUS_INTERNAL); return; } rtsp_reply_header(c, RTSP_STATUS_OK); url_fprintf(c->pb, "Content-Type: application/sdp\r\n"); url_fprintf(c->pb, "Content-Length: %d\r\n", content_length); url_fprintf(c->pb, "\r\n"); put_buffer(c->pb, content, content_length); } static HTTPContext *find_rtp_session(const char *session_id) { HTTPContext *c; if (session_id[0] == '\0') return NULL; for(c = first_http_ctx; c != NULL; c = c->next) { if (!strcmp(c->session_id, session_id)) return c; } return NULL; } static RTSPTransportField *find_transport(RTSPHeader *h, enum RTSPProtocol protocol) { RTSPTransportField *th; int i; for(i=0;i<h->nb_transports;i++) { th = &h->transports[i]; if (th->protocol == protocol) return th; } return NULL; } static void rtsp_cmd_setup(HTTPContext *c, const char *url, RTSPHeader *h) { FFStream *stream; int stream_index, port; char buf[1024]; char path1[1024]; const char *path; HTTPContext *rtp_c; RTSPTransportField *th; struct sockaddr_in dest_addr; RTSPActionServerSetup setup; /* find which url is asked */ url_split(NULL, 0, NULL, 0, NULL, 0, NULL, path1, sizeof(path1), url); path = path1; if (*path == '/') path++; /* now check each stream */ for(stream = first_stream; stream != NULL; stream = stream->next) { if (!stream->is_feed && stream->fmt == &rtp_mux) { /* accept aggregate filenames only if single stream */ if (!strcmp(path, stream->filename)) { if (stream->nb_streams != 1) { rtsp_reply_error(c, RTSP_STATUS_AGGREGATE); return; } stream_index = 0; goto found; } for(stream_index = 0; stream_index < stream->nb_streams; stream_index++) { snprintf(buf, sizeof(buf), "%s/streamid=%d", stream->filename, stream_index); if (!strcmp(path, buf)) goto found; } } } /* no stream found */ rtsp_reply_error(c, RTSP_STATUS_SERVICE); /* XXX: right error ? */ return; found: /* generate session id if needed */ if (h->session_id[0] == '\0') { snprintf(h->session_id, sizeof(h->session_id), "%08x%08x", (int)random(), (int)random()); } /* find rtp session, and create it if none found */ rtp_c = find_rtp_session(h->session_id); if (!rtp_c) { /* always prefer UDP */ th = find_transport(h, RTSP_PROTOCOL_RTP_UDP); if (!th) { th = find_transport(h, RTSP_PROTOCOL_RTP_TCP); if (!th) { rtsp_reply_error(c, RTSP_STATUS_TRANSPORT); return; } } rtp_c = rtp_new_connection(&c->from_addr, stream, h->session_id, th->protocol); if (!rtp_c) { rtsp_reply_error(c, RTSP_STATUS_BANDWIDTH); return; } /* open input stream */ if (open_input_stream(rtp_c, "") < 0) { rtsp_reply_error(c, RTSP_STATUS_INTERNAL); return; } } /* test if stream is OK (test needed because several SETUP needs to be done for a given file) */ if (rtp_c->stream != stream) { rtsp_reply_error(c, RTSP_STATUS_SERVICE); return; } /* test if stream is already set up */ if (rtp_c->rtp_ctx[stream_index]) { rtsp_reply_error(c, RTSP_STATUS_STATE); return; } /* check transport */ th = find_transport(h, rtp_c->rtp_protocol); if (!th || (th->protocol == RTSP_PROTOCOL_RTP_UDP && th->client_port_min <= 0)) { rtsp_reply_error(c, RTSP_STATUS_TRANSPORT); return; } /* setup default options */ setup.transport_option[0] = '\0'; dest_addr = rtp_c->from_addr; dest_addr.sin_port = htons(th->client_port_min); /* add transport option if needed */ if (ff_rtsp_callback) { setup.ipaddr = ntohl(dest_addr.sin_addr.s_addr); if (ff_rtsp_callback(RTSP_ACTION_SERVER_SETUP, rtp_c->session_id, (char *)&setup, sizeof(setup), stream->rtsp_option) < 0) { rtsp_reply_error(c, RTSP_STATUS_TRANSPORT); return; } dest_addr.sin_addr.s_addr = htonl(setup.ipaddr); } /* setup stream */ if (rtp_new_av_stream(rtp_c, stream_index, &dest_addr, c) < 0) { rtsp_reply_error(c, RTSP_STATUS_TRANSPORT); return; } /* now everything is OK, so we can send the connection parameters */ rtsp_reply_header(c, RTSP_STATUS_OK); /* session ID */ url_fprintf(c->pb, "Session: %s\r\n", rtp_c->session_id); switch(rtp_c->rtp_protocol) { case RTSP_PROTOCOL_RTP_UDP: port = rtp_get_local_port(rtp_c->rtp_handles[stream_index]); url_fprintf(c->pb, "Transport: RTP/AVP/UDP;unicast;" "client_port=%d-%d;server_port=%d-%d", th->client_port_min, th->client_port_min + 1, port, port + 1); break; case RTSP_PROTOCOL_RTP_TCP: url_fprintf(c->pb, "Transport: RTP/AVP/TCP;interleaved=%d-%d", stream_index * 2, stream_index * 2 + 1); break; default: break; } if (setup.transport_option[0] != '\0') { url_fprintf(c->pb, ";%s", setup.transport_option); } url_fprintf(c->pb, "\r\n"); url_fprintf(c->pb, "\r\n"); } /* find an rtp connection by using the session ID. Check consistency with filename */ static HTTPContext *find_rtp_session_with_url(const char *url, const char *session_id) { HTTPContext *rtp_c; char path1[1024]; const char *path; char buf[1024]; int s; rtp_c = find_rtp_session(session_id); if (!rtp_c) return NULL; /* find which url is asked */ url_split(NULL, 0, NULL, 0, NULL, 0, NULL, path1, sizeof(path1), url); path = path1; if (*path == '/') path++; if(!strcmp(path, rtp_c->stream->filename)) return rtp_c; for(s=0; s<rtp_c->stream->nb_streams; ++s) { snprintf(buf, sizeof(buf), "%s/streamid=%d", rtp_c->stream->filename, s); if(!strncmp(path, buf, sizeof(buf))) { // XXX: Should we reply with RTSP_STATUS_ONLY_AGGREGATE if nb_streams>1? return rtp_c; } } return NULL; } static void rtsp_cmd_play(HTTPContext *c, const char *url, RTSPHeader *h) { HTTPContext *rtp_c; rtp_c = find_rtp_session_with_url(url, h->session_id); if (!rtp_c) { rtsp_reply_error(c, RTSP_STATUS_SESSION); return; } if (rtp_c->state != HTTPSTATE_SEND_DATA && rtp_c->state != HTTPSTATE_WAIT_FEED && rtp_c->state != HTTPSTATE_READY) { rtsp_reply_error(c, RTSP_STATUS_STATE); return; } #if 0 /* XXX: seek in stream */ if (h->range_start != AV_NOPTS_VALUE) { printf("range_start=%0.3f\n", (double)h->range_start / AV_TIME_BASE); av_seek_frame(rtp_c->fmt_in, -1, h->range_start); } #endif rtp_c->state = HTTPSTATE_SEND_DATA; /* now everything is OK, so we can send the connection parameters */ rtsp_reply_header(c, RTSP_STATUS_OK); /* session ID */ url_fprintf(c->pb, "Session: %s\r\n", rtp_c->session_id); url_fprintf(c->pb, "\r\n"); } static void rtsp_cmd_pause(HTTPContext *c, const char *url, RTSPHeader *h) { HTTPContext *rtp_c; rtp_c = find_rtp_session_with_url(url, h->session_id); if (!rtp_c) { rtsp_reply_error(c, RTSP_STATUS_SESSION); return; } if (rtp_c->state != HTTPSTATE_SEND_DATA && rtp_c->state != HTTPSTATE_WAIT_FEED) { rtsp_reply_error(c, RTSP_STATUS_STATE); return; } rtp_c->state = HTTPSTATE_READY; rtp_c->first_pts = AV_NOPTS_VALUE; /* now everything is OK, so we can send the connection parameters */ rtsp_reply_header(c, RTSP_STATUS_OK); /* session ID */ url_fprintf(c->pb, "Session: %s\r\n", rtp_c->session_id); url_fprintf(c->pb, "\r\n"); } static void rtsp_cmd_teardown(HTTPContext *c, const char *url, RTSPHeader *h) { HTTPContext *rtp_c; rtp_c = find_rtp_session_with_url(url, h->session_id); if (!rtp_c) { rtsp_reply_error(c, RTSP_STATUS_SESSION); return; } /* abort the session */ close_connection(rtp_c); if (ff_rtsp_callback) { ff_rtsp_callback(RTSP_ACTION_SERVER_TEARDOWN, rtp_c->session_id, NULL, 0, rtp_c->stream->rtsp_option); } /* now everything is OK, so we can send the connection parameters */ rtsp_reply_header(c, RTSP_STATUS_OK); /* session ID */ url_fprintf(c->pb, "Session: %s\r\n", rtp_c->session_id); url_fprintf(c->pb, "\r\n"); } /********************************************************************/ /* RTP handling */ static HTTPContext *rtp_new_connection(struct sockaddr_in *from_addr, FFStream *stream, const char *session_id, enum RTSPProtocol rtp_protocol) { HTTPContext *c = NULL; const char *proto_str; /* XXX: should output a warning page when coming close to the connection limit */ if (nb_connections >= nb_max_connections) goto fail; /* add a new connection */ c = av_mallocz(sizeof(HTTPContext)); if (!c) goto fail; c->fd = -1; c->poll_entry = NULL; c->from_addr = *from_addr; c->buffer_size = IOBUFFER_INIT_SIZE; c->buffer = av_malloc(c->buffer_size); if (!c->buffer) goto fail; nb_connections++; c->stream = stream; pstrcpy(c->session_id, sizeof(c->session_id), session_id); c->state = HTTPSTATE_READY; c->is_packetized = 1; c->rtp_protocol = rtp_protocol; /* protocol is shown in statistics */ switch(c->rtp_protocol) { case RTSP_PROTOCOL_RTP_UDP_MULTICAST: proto_str = "MCAST"; break; case RTSP_PROTOCOL_RTP_UDP: proto_str = "UDP"; break; case RTSP_PROTOCOL_RTP_TCP: proto_str = "TCP"; break; default: proto_str = "???"; break; } pstrcpy(c->protocol, sizeof(c->protocol), "RTP/"); pstrcat(c->protocol, sizeof(c->protocol), proto_str); current_bandwidth += stream->bandwidth; c->next = first_http_ctx; first_http_ctx = c; return c; fail: if (c) { av_free(c->buffer); av_free(c); } return NULL; } /* add a new RTP stream in an RTP connection (used in RTSP SETUP command). If RTP/TCP protocol is used, TCP connection 'rtsp_c' is used. */ static int rtp_new_av_stream(HTTPContext *c, int stream_index, struct sockaddr_in *dest_addr, HTTPContext *rtsp_c) { AVFormatContext *ctx; AVStream *st; char *ipaddr; URLContext *h; uint8_t *dummy_buf; char buf2[32]; int max_packet_size; /* now we can open the relevant output stream */ ctx = av_alloc_format_context(); if (!ctx) return -1; ctx->oformat = &rtp_mux; st = av_mallocz(sizeof(AVStream)); if (!st) goto fail; ctx->nb_streams = 1; ctx->streams[0] = st; if (!c->stream->feed || c->stream->feed == c->stream) { memcpy(st, c->stream->streams[stream_index], sizeof(AVStream)); } else { memcpy(st, c->stream->feed->streams[c->stream->feed_streams[stream_index]], sizeof(AVStream)); } /* build destination RTP address */ ipaddr = inet_ntoa(dest_addr->sin_addr); switch(c->rtp_protocol) { case RTSP_PROTOCOL_RTP_UDP: case RTSP_PROTOCOL_RTP_UDP_MULTICAST: /* RTP/UDP case */ /* XXX: also pass as parameter to function ? */ if (c->stream->is_multicast) { int ttl; ttl = c->stream->multicast_ttl; if (!ttl) ttl = 16; snprintf(ctx->filename, sizeof(ctx->filename), "rtp://%s:%d?multicast=1&ttl=%d", ipaddr, ntohs(dest_addr->sin_port), ttl); } else { snprintf(ctx->filename, sizeof(ctx->filename), "rtp://%s:%d", ipaddr, ntohs(dest_addr->sin_port)); } if (url_open(&h, ctx->filename, URL_WRONLY) < 0) goto fail; c->rtp_handles[stream_index] = h; max_packet_size = url_get_max_packet_size(h); break; case RTSP_PROTOCOL_RTP_TCP: /* RTP/TCP case */ c->rtsp_c = rtsp_c; max_packet_size = RTSP_TCP_MAX_PACKET_SIZE; break; default: goto fail; } http_log("%s:%d - - [%s] \"PLAY %s/streamid=%d %s\"\n", ipaddr, ntohs(dest_addr->sin_port), ctime1(buf2), c->stream->filename, stream_index, c->protocol); /* normally, no packets should be output here, but the packet size may be checked */ if (url_open_dyn_packet_buf(&ctx->pb, max_packet_size) < 0) { /* XXX: close stream */ goto fail; } av_set_parameters(ctx, NULL); if (av_write_header(ctx) < 0) { fail: if (h) url_close(h); av_free(ctx); return -1; } url_close_dyn_buf(&ctx->pb, &dummy_buf); av_free(dummy_buf); c->rtp_ctx[stream_index] = ctx; return 0; } /********************************************************************/ /* ffserver initialization */ static AVStream *add_av_stream1(FFStream *stream, AVCodecContext *codec) { AVStream *fst; fst = av_mallocz(sizeof(AVStream)); if (!fst) return NULL; fst->priv_data = av_mallocz(sizeof(FeedData)); memcpy(&fst->codec, codec, sizeof(AVCodecContext)); fst->codec.coded_frame = &dummy_frame; fst->index = stream->nb_streams; av_set_pts_info(fst, 33, 1, 90000); stream->streams[stream->nb_streams++] = fst; return fst; } /* return the stream number in the feed */ static int add_av_stream(FFStream *feed, AVStream *st) { AVStream *fst; AVCodecContext *av, *av1; int i; av = &st->codec; for(i=0;i<feed->nb_streams;i++) { st = feed->streams[i]; av1 = &st->codec; if (av1->codec_id == av->codec_id && av1->codec_type == av->codec_type && av1->bit_rate == av->bit_rate) { switch(av->codec_type) { case CODEC_TYPE_AUDIO: if (av1->channels == av->channels && av1->sample_rate == av->sample_rate) goto found; break; case CODEC_TYPE_VIDEO: if (av1->width == av->width && av1->height == av->height && av1->frame_rate == av->frame_rate && av1->frame_rate_base == av->frame_rate_base && av1->gop_size == av->gop_size) goto found; break; default: av_abort(); } } } fst = add_av_stream1(feed, av); if (!fst) return -1; return feed->nb_streams - 1; found: return i; } static void remove_stream(FFStream *stream) { FFStream **ps; ps = &first_stream; while (*ps != NULL) { if (*ps == stream) { *ps = (*ps)->next; } else { ps = &(*ps)->next; } } } /* specific mpeg4 handling : we extract the raw parameters */ static void extract_mpeg4_header(AVFormatContext *infile) { int mpeg4_count, i, size; AVPacket pkt; AVStream *st; const uint8_t *p; mpeg4_count = 0; for(i=0;i<infile->nb_streams;i++) { st = infile->streams[i]; if (st->codec.codec_id == CODEC_ID_MPEG4 && st->codec.extradata_size == 0) { mpeg4_count++; } } if (!mpeg4_count) return; printf("MPEG4 without extra data: trying to find header in %s\n", infile->filename); while (mpeg4_count > 0) { if (av_read_packet(infile, &pkt) < 0) break; st = infile->streams[pkt.stream_index]; if (st->codec.codec_id == CODEC_ID_MPEG4 && st->codec.extradata_size == 0) { av_freep(&st->codec.extradata); /* fill extradata with the header */ /* XXX: we make hard suppositions here ! */ p = pkt.data; while (p < pkt.data + pkt.size - 4) { /* stop when vop header is found */ if (p[0] == 0x00 && p[1] == 0x00 && p[2] == 0x01 && p[3] == 0xb6) { size = p - pkt.data; // av_hex_dump(pkt.data, size); st->codec.extradata = av_malloc(size); st->codec.extradata_size = size; memcpy(st->codec.extradata, pkt.data, size); break; } p++; } mpeg4_count--; } av_free_packet(&pkt); } } /* compute the needed AVStream for each file */ static void build_file_streams(void) { FFStream *stream, *stream_next; AVFormatContext *infile; int i; /* gather all streams */ for(stream = first_stream; stream != NULL; stream = stream_next) { stream_next = stream->next; if (stream->stream_type == STREAM_TYPE_LIVE && !stream->feed) { /* the stream comes from a file */ /* try to open the file */ /* open stream */ stream->ap_in = av_mallocz(sizeof(AVFormatParameters)); if (stream->fmt == &rtp_mux) { /* specific case : if transport stream output to RTP, we use a raw transport stream reader */ stream->ap_in->mpeg2ts_raw = 1; stream->ap_in->mpeg2ts_compute_pcr = 1; } if (av_open_input_file(&infile, stream->feed_filename, stream->ifmt, 0, stream->ap_in) < 0) { http_log("%s not found", stream->feed_filename); /* remove stream (no need to spend more time on it) */ fail: remove_stream(stream); } else { /* find all the AVStreams inside and reference them in 'stream' */ if (av_find_stream_info(infile) < 0) { http_log("Could not find codec parameters from '%s'", stream->feed_filename); av_close_input_file(infile); goto fail; } extract_mpeg4_header(infile); for(i=0;i<infile->nb_streams;i++) { add_av_stream1(stream, &infile->streams[i]->codec); } av_close_input_file(infile); } } } } /* compute the needed AVStream for each feed */ static void build_feed_streams(void) { FFStream *stream, *feed; int i; /* gather all streams */ for(stream = first_stream; stream != NULL; stream = stream->next) { feed = stream->feed; if (feed) { if (!stream->is_feed) { /* we handle a stream coming from a feed */ for(i=0;i<stream->nb_streams;i++) { stream->feed_streams[i] = add_av_stream(feed, stream->streams[i]); } } } } /* gather all streams */ for(stream = first_stream; stream != NULL; stream = stream->next) { feed = stream->feed; if (feed) { if (stream->is_feed) { for(i=0;i<stream->nb_streams;i++) { stream->feed_streams[i] = i; } } } } /* create feed files if needed */ for(feed = first_feed; feed != NULL; feed = feed->next_feed) { int fd; if (url_exist(feed->feed_filename)) { /* See if it matches */ AVFormatContext *s; int matches = 0; if (av_open_input_file(&s, feed->feed_filename, NULL, FFM_PACKET_SIZE, NULL) >= 0) { /* Now see if it matches */ if (s->nb_streams == feed->nb_streams) { matches = 1; for(i=0;i<s->nb_streams;i++) { AVStream *sf, *ss; sf = feed->streams[i]; ss = s->streams[i]; if (sf->index != ss->index || sf->id != ss->id) { printf("Index & Id do not match for stream %d (%s)\n", i, feed->feed_filename); matches = 0; } else { AVCodecContext *ccf, *ccs; ccf = &sf->codec; ccs = &ss->codec; #define CHECK_CODEC(x) (ccf->x != ccs->x) if (CHECK_CODEC(codec) || CHECK_CODEC(codec_type)) { printf("Codecs do not match for stream %d\n", i); matches = 0; } else if (CHECK_CODEC(bit_rate) || CHECK_CODEC(flags)) { printf("Codec bitrates do not match for stream %d\n", i); matches = 0; } else if (ccf->codec_type == CODEC_TYPE_VIDEO) { if (CHECK_CODEC(frame_rate) || CHECK_CODEC(frame_rate_base) || CHECK_CODEC(width) || CHECK_CODEC(height)) { printf("Codec width, height and framerate do not match for stream %d\n", i); matches = 0; } } else if (ccf->codec_type == CODEC_TYPE_AUDIO) { if (CHECK_CODEC(sample_rate) || CHECK_CODEC(channels) || CHECK_CODEC(frame_size)) { printf("Codec sample_rate, channels, frame_size do not match for stream %d\n", i); matches = 0; } } else { printf("Unknown codec type\n"); matches = 0; } } if (!matches) { break; } } } else { printf("Deleting feed file '%s' as stream counts differ (%d != %d)\n", feed->feed_filename, s->nb_streams, feed->nb_streams); } av_close_input_file(s); } else { printf("Deleting feed file '%s' as it appears to be corrupt\n", feed->feed_filename); } if (!matches) { if (feed->readonly) { printf("Unable to delete feed file '%s' as it is marked readonly\n", feed->feed_filename); exit(1); } unlink(feed->feed_filename); } } if (!url_exist(feed->feed_filename)) { AVFormatContext s1, *s = &s1; if (feed->readonly) { printf("Unable to create feed file '%s' as it is marked readonly\n", feed->feed_filename); exit(1); } /* only write the header of the ffm file */ if (url_fopen(&s->pb, feed->feed_filename, URL_WRONLY) < 0) { fprintf(stderr, "Could not open output feed file '%s'\n", feed->feed_filename); exit(1); } s->oformat = feed->fmt; s->nb_streams = feed->nb_streams; for(i=0;i<s->nb_streams;i++) { AVStream *st; st = feed->streams[i]; s->streams[i] = st; } av_set_parameters(s, NULL); av_write_header(s); /* XXX: need better api */ av_freep(&s->priv_data); url_fclose(&s->pb); } /* get feed size and write index */ fd = open(feed->feed_filename, O_RDONLY); if (fd < 0) { fprintf(stderr, "Could not open output feed file '%s'\n", feed->feed_filename); exit(1); } feed->feed_write_index = ffm_read_write_index(fd); feed->feed_size = lseek(fd, 0, SEEK_END); /* ensure that we do not wrap before the end of file */ if (feed->feed_max_size < feed->feed_size) feed->feed_max_size = feed->feed_size; close(fd); } } /* compute the bandwidth used by each stream */ static void compute_bandwidth(void) { int bandwidth, i; FFStream *stream; for(stream = first_stream; stream != NULL; stream = stream->next) { bandwidth = 0; for(i=0;i<stream->nb_streams;i++) { AVStream *st = stream->streams[i]; switch(st->codec.codec_type) { case CODEC_TYPE_AUDIO: case CODEC_TYPE_VIDEO: bandwidth += st->codec.bit_rate; break; default: break; } } stream->bandwidth = (bandwidth + 999) / 1000; } } static void get_arg(char *buf, int buf_size, const char **pp) { const char *p; char *q; int quote; p = *pp; while (isspace(*p)) p++; q = buf; quote = 0; if (*p == '\"' || *p == '\'') quote = *p++; for(;;) { if (quote) { if (*p == quote) break; } else { if (isspace(*p)) break; } if (*p == '\0') break; if ((q - buf) < buf_size - 1) *q++ = *p; p++; } *q = '\0'; if (quote && *p == quote) p++; *pp = p; } /* add a codec and set the default parameters */ static void add_codec(FFStream *stream, AVCodecContext *av) { AVStream *st; /* compute default parameters */ switch(av->codec_type) { case CODEC_TYPE_AUDIO: if (av->bit_rate == 0) av->bit_rate = 64000; if (av->sample_rate == 0) av->sample_rate = 22050; if (av->channels == 0) av->channels = 1; break; case CODEC_TYPE_VIDEO: if (av->bit_rate == 0) av->bit_rate = 64000; if (av->frame_rate == 0){ av->frame_rate = 5; av->frame_rate_base = 1; } if (av->width == 0 || av->height == 0) { av->width = 160; av->height = 128; } /* Bitrate tolerance is less for streaming */ if (av->bit_rate_tolerance == 0) av->bit_rate_tolerance = av->bit_rate / 4; if (av->qmin == 0) av->qmin = 3; if (av->qmax == 0) av->qmax = 31; if (av->max_qdiff == 0) av->max_qdiff = 3; av->qcompress = 0.5; av->qblur = 0.5; if (!av->rc_eq) av->rc_eq = "tex^qComp"; if (!av->i_quant_factor) av->i_quant_factor = -0.8; if (!av->b_quant_factor) av->b_quant_factor = 1.25; if (!av->b_quant_offset) av->b_quant_offset = 1.25; if (!av->rc_max_rate) av->rc_max_rate = av->bit_rate * 2; break; default: av_abort(); } st = av_mallocz(sizeof(AVStream)); if (!st) return; stream->streams[stream->nb_streams++] = st; memcpy(&st->codec, av, sizeof(AVCodecContext)); } static int opt_audio_codec(const char *arg) { AVCodec *p; p = first_avcodec; while (p) { if (!strcmp(p->name, arg) && p->type == CODEC_TYPE_AUDIO) break; p = p->next; } if (p == NULL) { return CODEC_ID_NONE; } return p->id; } static int opt_video_codec(const char *arg) { AVCodec *p; p = first_avcodec; while (p) { if (!strcmp(p->name, arg) && p->type == CODEC_TYPE_VIDEO) break; p = p->next; } if (p == NULL) { return CODEC_ID_NONE; } return p->id; } /* simplistic plugin support */ #ifdef CONFIG_HAVE_DLOPEN void load_module(const char *filename) { void *dll; void (*init_func)(void); dll = dlopen(filename, RTLD_NOW); if (!dll) { fprintf(stderr, "Could not load module '%s' - %s\n", filename, dlerror()); return; } init_func = dlsym(dll, "ffserver_module_init"); if (!init_func) { fprintf(stderr, "%s: init function 'ffserver_module_init()' not found\n", filename); dlclose(dll); } init_func(); } #endif static int parse_ffconfig(const char *filename) { FILE *f; char line[1024]; char cmd[64]; char arg[1024]; const char *p; int val, errors, line_num; FFStream **last_stream, *stream, *redirect; FFStream **last_feed, *feed; AVCodecContext audio_enc, video_enc; int audio_id, video_id; f = fopen(filename, "r"); if (!f) { perror(filename); return -1; } errors = 0; line_num = 0; first_stream = NULL; last_stream = &first_stream; first_feed = NULL; last_feed = &first_feed; stream = NULL; feed = NULL; redirect = NULL; audio_id = CODEC_ID_NONE; video_id = CODEC_ID_NONE; for(;;) { if (fgets(line, sizeof(line), f) == NULL) break; line_num++; p = line; while (isspace(*p)) p++; if (*p == '\0' || *p == '#') continue; get_arg(cmd, sizeof(cmd), &p); if (!strcasecmp(cmd, "Port")) { get_arg(arg, sizeof(arg), &p); my_http_addr.sin_port = htons (atoi(arg)); } else if (!strcasecmp(cmd, "BindAddress")) { get_arg(arg, sizeof(arg), &p); if (!inet_aton(arg, &my_http_addr.sin_addr)) { fprintf(stderr, "%s:%d: Invalid IP address: %s\n", filename, line_num, arg); errors++; } } else if (!strcasecmp(cmd, "NoDaemon")) { ffserver_daemon = 0; } else if (!strcasecmp(cmd, "RTSPPort")) { get_arg(arg, sizeof(arg), &p); my_rtsp_addr.sin_port = htons (atoi(arg)); } else if (!strcasecmp(cmd, "RTSPBindAddress")) { get_arg(arg, sizeof(arg), &p); if (!inet_aton(arg, &my_rtsp_addr.sin_addr)) { fprintf(stderr, "%s:%d: Invalid IP address: %s\n", filename, line_num, arg); errors++; } } else if (!strcasecmp(cmd, "MaxClients")) { get_arg(arg, sizeof(arg), &p); val = atoi(arg); if (val < 1 || val > HTTP_MAX_CONNECTIONS) { fprintf(stderr, "%s:%d: Invalid MaxClients: %s\n", filename, line_num, arg); errors++; } else { nb_max_connections = val; } } else if (!strcasecmp(cmd, "MaxBandwidth")) { get_arg(arg, sizeof(arg), &p); val = atoi(arg); if (val < 10 || val > 100000) { fprintf(stderr, "%s:%d: Invalid MaxBandwidth: %s\n", filename, line_num, arg); errors++; } else { max_bandwidth = val; } } else if (!strcasecmp(cmd, "CustomLog")) { get_arg(logfilename, sizeof(logfilename), &p); } else if (!strcasecmp(cmd, "<Feed")) { /*********************************************/ /* Feed related options */ char *q; if (stream || feed) { fprintf(stderr, "%s:%d: Already in a tag\n", filename, line_num); } else { feed = av_mallocz(sizeof(FFStream)); /* add in stream list */ *last_stream = feed; last_stream = &feed->next; /* add in feed list */ *last_feed = feed; last_feed = &feed->next_feed; get_arg(feed->filename, sizeof(feed->filename), &p); q = strrchr(feed->filename, '>'); if (*q) *q = '\0'; feed->fmt = guess_format("ffm", NULL, NULL); /* defaut feed file */ snprintf(feed->feed_filename, sizeof(feed->feed_filename), "/tmp/%s.ffm", feed->filename); feed->feed_max_size = 5 * 1024 * 1024; feed->is_feed = 1; feed->feed = feed; /* self feeding :-) */ } } else if (!strcasecmp(cmd, "Launch")) { if (feed) { int i; feed->child_argv = (char **) av_mallocz(64 * sizeof(char *)); feed->child_argv[0] = av_malloc(7); strcpy(feed->child_argv[0], "ffmpeg"); for (i = 1; i < 62; i++) { char argbuf[256]; get_arg(argbuf, sizeof(argbuf), &p); if (!argbuf[0]) break; feed->child_argv[i] = av_malloc(strlen(argbuf) + 1); strcpy(feed->child_argv[i], argbuf); } feed->child_argv[i] = av_malloc(30 + strlen(feed->filename)); snprintf(feed->child_argv[i], 256, "http://127.0.0.1:%d/%s", ntohs(my_http_addr.sin_port), feed->filename); } } else if (!strcasecmp(cmd, "ReadOnlyFile")) { if (feed) { get_arg(feed->feed_filename, sizeof(feed->feed_filename), &p); feed->readonly = 1; } else if (stream) { get_arg(stream->feed_filename, sizeof(stream->feed_filename), &p); } } else if (!strcasecmp(cmd, "File")) { if (feed) { get_arg(feed->feed_filename, sizeof(feed->feed_filename), &p); } else if (stream) { get_arg(stream->feed_filename, sizeof(stream->feed_filename), &p); } } else if (!strcasecmp(cmd, "FileMaxSize")) { if (feed) { const char *p1; double fsize; get_arg(arg, sizeof(arg), &p); p1 = arg; fsize = strtod(p1, (char **)&p1); switch(toupper(*p1)) { case 'K': fsize *= 1024; break; case 'M': fsize *= 1024 * 1024; break; case 'G': fsize *= 1024 * 1024 * 1024; break; } feed->feed_max_size = (int64_t)fsize; } } else if (!strcasecmp(cmd, "</Feed>")) { if (!feed) { fprintf(stderr, "%s:%d: No corresponding <Feed> for </Feed>\n", filename, line_num); errors++; #if 0 } else { /* Make sure that we start out clean */ if (unlink(feed->feed_filename) < 0 && errno != ENOENT) { fprintf(stderr, "%s:%d: Unable to clean old feed file '%s': %s\n", filename, line_num, feed->feed_filename, strerror(errno)); errors++; } #endif } feed = NULL; } else if (!strcasecmp(cmd, "<Stream")) { /*********************************************/ /* Stream related options */ char *q; if (stream || feed) { fprintf(stderr, "%s:%d: Already in a tag\n", filename, line_num); } else { stream = av_mallocz(sizeof(FFStream)); *last_stream = stream; last_stream = &stream->next; get_arg(stream->filename, sizeof(stream->filename), &p); q = strrchr(stream->filename, '>'); if (*q) *q = '\0'; stream->fmt = guess_stream_format(NULL, stream->filename, NULL); memset(&audio_enc, 0, sizeof(AVCodecContext)); memset(&video_enc, 0, sizeof(AVCodecContext)); audio_id = CODEC_ID_NONE; video_id = CODEC_ID_NONE; if (stream->fmt) { audio_id = stream->fmt->audio_codec; video_id = stream->fmt->video_codec; } } } else if (!strcasecmp(cmd, "Feed")) { get_arg(arg, sizeof(arg), &p); if (stream) { FFStream *sfeed; sfeed = first_feed; while (sfeed != NULL) { if (!strcmp(sfeed->filename, arg)) break; sfeed = sfeed->next_feed; } if (!sfeed) { fprintf(stderr, "%s:%d: feed '%s' not defined\n", filename, line_num, arg); } else { stream->feed = sfeed; } } } else if (!strcasecmp(cmd, "Format")) { get_arg(arg, sizeof(arg), &p); if (!strcmp(arg, "status")) { stream->stream_type = STREAM_TYPE_STATUS; stream->fmt = NULL; } else { stream->stream_type = STREAM_TYPE_LIVE; /* jpeg cannot be used here, so use single frame jpeg */ if (!strcmp(arg, "jpeg")) strcpy(arg, "singlejpeg"); stream->fmt = guess_stream_format(arg, NULL, NULL); if (!stream->fmt) { fprintf(stderr, "%s:%d: Unknown Format: %s\n", filename, line_num, arg); errors++; } } if (stream->fmt) { audio_id = stream->fmt->audio_codec; video_id = stream->fmt->video_codec; } } else if (!strcasecmp(cmd, "InputFormat")) { stream->ifmt = av_find_input_format(arg); if (!stream->ifmt) { fprintf(stderr, "%s:%d: Unknown input format: %s\n", filename, line_num, arg); } } else if (!strcasecmp(cmd, "FaviconURL")) { if (stream && stream->stream_type == STREAM_TYPE_STATUS) { get_arg(stream->feed_filename, sizeof(stream->feed_filename), &p); } else { fprintf(stderr, "%s:%d: FaviconURL only permitted for status streams\n", filename, line_num); errors++; } } else if (!strcasecmp(cmd, "Author")) { if (stream) { get_arg(stream->author, sizeof(stream->author), &p); } } else if (!strcasecmp(cmd, "Comment")) { if (stream) { get_arg(stream->comment, sizeof(stream->comment), &p); } } else if (!strcasecmp(cmd, "Copyright")) { if (stream) { get_arg(stream->copyright, sizeof(stream->copyright), &p); } } else if (!strcasecmp(cmd, "Title")) { if (stream) { get_arg(stream->title, sizeof(stream->title), &p); } } else if (!strcasecmp(cmd, "Preroll")) { get_arg(arg, sizeof(arg), &p); if (stream) { stream->prebuffer = atof(arg) * 1000; } } else if (!strcasecmp(cmd, "StartSendOnKey")) { if (stream) { stream->send_on_key = 1; } } else if (!strcasecmp(cmd, "AudioCodec")) { get_arg(arg, sizeof(arg), &p); audio_id = opt_audio_codec(arg); if (audio_id == CODEC_ID_NONE) { fprintf(stderr, "%s:%d: Unknown AudioCodec: %s\n", filename, line_num, arg); errors++; } } else if (!strcasecmp(cmd, "VideoCodec")) { get_arg(arg, sizeof(arg), &p); video_id = opt_video_codec(arg); if (video_id == CODEC_ID_NONE) { fprintf(stderr, "%s:%d: Unknown VideoCodec: %s\n", filename, line_num, arg); errors++; } } else if (!strcasecmp(cmd, "MaxTime")) { get_arg(arg, sizeof(arg), &p); if (stream) { stream->max_time = atof(arg) * 1000; } } else if (!strcasecmp(cmd, "AudioBitRate")) { get_arg(arg, sizeof(arg), &p); if (stream) { audio_enc.bit_rate = atoi(arg) * 1000; } } else if (!strcasecmp(cmd, "AudioChannels")) { get_arg(arg, sizeof(arg), &p); if (stream) { audio_enc.channels = atoi(arg); } } else if (!strcasecmp(cmd, "AudioSampleRate")) { get_arg(arg, sizeof(arg), &p); if (stream) { audio_enc.sample_rate = atoi(arg); } } else if (!strcasecmp(cmd, "AudioQuality")) { get_arg(arg, sizeof(arg), &p); if (stream) { // audio_enc.quality = atof(arg) * 1000; } } else if (!strcasecmp(cmd, "VideoBitRateRange")) { if (stream) { int minrate, maxrate; get_arg(arg, sizeof(arg), &p); if (sscanf(arg, "%d-%d", &minrate, &maxrate) == 2) { video_enc.rc_min_rate = minrate * 1000; video_enc.rc_max_rate = maxrate * 1000; } else { fprintf(stderr, "%s:%d: Incorrect format for VideoBitRateRange -- should be <min>-<max>: %s\n", filename, line_num, arg); errors++; } } } else if (!strcasecmp(cmd, "VideoBufferSize")) { if (stream) { get_arg(arg, sizeof(arg), &p); video_enc.rc_buffer_size = atoi(arg) * 1024; } } else if (!strcasecmp(cmd, "VideoBitRateTolerance")) { if (stream) { get_arg(arg, sizeof(arg), &p); video_enc.bit_rate_tolerance = atoi(arg) * 1000; } } else if (!strcasecmp(cmd, "VideoBitRate")) { get_arg(arg, sizeof(arg), &p); if (stream) { video_enc.bit_rate = atoi(arg) * 1000; } } else if (!strcasecmp(cmd, "VideoSize")) { get_arg(arg, sizeof(arg), &p); if (stream) { parse_image_size(&video_enc.width, &video_enc.height, arg); if ((video_enc.width % 16) != 0 || (video_enc.height % 16) != 0) { fprintf(stderr, "%s:%d: Image size must be a multiple of 16\n", filename, line_num); errors++; } } } else if (!strcasecmp(cmd, "VideoFrameRate")) { get_arg(arg, sizeof(arg), &p); if (stream) { video_enc.frame_rate_base= DEFAULT_FRAME_RATE_BASE; video_enc.frame_rate = (int)(strtod(arg, NULL) * video_enc.frame_rate_base); } } else if (!strcasecmp(cmd, "VideoGopSize")) { get_arg(arg, sizeof(arg), &p); if (stream) { video_enc.gop_size = atoi(arg); } } else if (!strcasecmp(cmd, "VideoIntraOnly")) { if (stream) { video_enc.gop_size = 1; } } else if (!strcasecmp(cmd, "VideoHighQuality")) { if (stream) { video_enc.mb_decision = FF_MB_DECISION_BITS; } } else if (!strcasecmp(cmd, "Video4MotionVector")) { if (stream) { video_enc.mb_decision = FF_MB_DECISION_BITS; //FIXME remove video_enc.flags |= CODEC_FLAG_4MV; } } else if (!strcasecmp(cmd, "VideoQDiff")) { get_arg(arg, sizeof(arg), &p); if (stream) { video_enc.max_qdiff = atoi(arg); if (video_enc.max_qdiff < 1 || video_enc.max_qdiff > 31) { fprintf(stderr, "%s:%d: VideoQDiff out of range\n", filename, line_num); errors++; } } } else if (!strcasecmp(cmd, "VideoQMax")) { get_arg(arg, sizeof(arg), &p); if (stream) { video_enc.qmax = atoi(arg); if (video_enc.qmax < 1 || video_enc.qmax > 31) { fprintf(stderr, "%s:%d: VideoQMax out of range\n", filename, line_num); errors++; } } } else if (!strcasecmp(cmd, "VideoQMin")) { get_arg(arg, sizeof(arg), &p); if (stream) { video_enc.qmin = atoi(arg); if (video_enc.qmin < 1 || video_enc.qmin > 31) { fprintf(stderr, "%s:%d: VideoQMin out of range\n", filename, line_num); errors++; } } } else if (!strcasecmp(cmd, "LumaElim")) { get_arg(arg, sizeof(arg), &p); if (stream) { video_enc.luma_elim_threshold = atoi(arg); } } else if (!strcasecmp(cmd, "ChromaElim")) { get_arg(arg, sizeof(arg), &p); if (stream) { video_enc.chroma_elim_threshold = atoi(arg); } } else if (!strcasecmp(cmd, "LumiMask")) { get_arg(arg, sizeof(arg), &p); if (stream) { video_enc.lumi_masking = atof(arg); } } else if (!strcasecmp(cmd, "DarkMask")) { get_arg(arg, sizeof(arg), &p); if (stream) { video_enc.dark_masking = atof(arg); } } else if (!strcasecmp(cmd, "NoVideo")) { video_id = CODEC_ID_NONE; } else if (!strcasecmp(cmd, "NoAudio")) { audio_id = CODEC_ID_NONE; } else if (!strcasecmp(cmd, "ACL")) { IPAddressACL acl; struct hostent *he; get_arg(arg, sizeof(arg), &p); if (strcasecmp(arg, "allow") == 0) { acl.action = IP_ALLOW; } else if (strcasecmp(arg, "deny") == 0) { acl.action = IP_DENY; } else { fprintf(stderr, "%s:%d: ACL action '%s' is not ALLOW or DENY\n", filename, line_num, arg); errors++; } get_arg(arg, sizeof(arg), &p); he = gethostbyname(arg); if (!he) { fprintf(stderr, "%s:%d: ACL refers to invalid host or ip address '%s'\n", filename, line_num, arg); errors++; } else { /* Only take the first */ acl.first.s_addr = ntohl(((struct in_addr *) he->h_addr_list[0])->s_addr); acl.last = acl.first; } get_arg(arg, sizeof(arg), &p); if (arg[0]) { he = gethostbyname(arg); if (!he) { fprintf(stderr, "%s:%d: ACL refers to invalid host or ip address '%s'\n", filename, line_num, arg); errors++; } else { /* Only take the first */ acl.last.s_addr = ntohl(((struct in_addr *) he->h_addr_list[0])->s_addr); } } if (!errors) { IPAddressACL *nacl = (IPAddressACL *) av_mallocz(sizeof(*nacl)); IPAddressACL **naclp = 0; *nacl = acl; nacl->next = 0; if (stream) { naclp = &stream->acl; } else if (feed) { naclp = &feed->acl; } else { fprintf(stderr, "%s:%d: ACL found not in <stream> or <feed>\n", filename, line_num); errors++; } if (naclp) { while (*naclp) naclp = &(*naclp)->next; *naclp = nacl; } } } else if (!strcasecmp(cmd, "RTSPOption")) { get_arg(arg, sizeof(arg), &p); if (stream) { av_freep(&stream->rtsp_option); /* XXX: av_strdup ? */ stream->rtsp_option = av_malloc(strlen(arg) + 1); if (stream->rtsp_option) { strcpy(stream->rtsp_option, arg); } } } else if (!strcasecmp(cmd, "MulticastAddress")) { get_arg(arg, sizeof(arg), &p); if (stream) { if (!inet_aton(arg, &stream->multicast_ip)) { fprintf(stderr, "%s:%d: Invalid IP address: %s\n", filename, line_num, arg); errors++; } stream->is_multicast = 1; stream->loop = 1; /* default is looping */ } } else if (!strcasecmp(cmd, "MulticastPort")) { get_arg(arg, sizeof(arg), &p); if (stream) { stream->multicast_port = atoi(arg); } } else if (!strcasecmp(cmd, "MulticastTTL")) { get_arg(arg, sizeof(arg), &p); if (stream) { stream->multicast_ttl = atoi(arg); } } else if (!strcasecmp(cmd, "NoLoop")) { if (stream) { stream->loop = 0; } } else if (!strcasecmp(cmd, "</Stream>")) { if (!stream) { fprintf(stderr, "%s:%d: No corresponding <Stream> for </Stream>\n", filename, line_num); errors++; } if (stream->feed && stream->fmt && strcmp(stream->fmt->name, "ffm") != 0) { if (audio_id != CODEC_ID_NONE) { audio_enc.codec_type = CODEC_TYPE_AUDIO; audio_enc.codec_id = audio_id; add_codec(stream, &audio_enc); } if (video_id != CODEC_ID_NONE) { video_enc.codec_type = CODEC_TYPE_VIDEO; video_enc.codec_id = video_id; if (!video_enc.rc_buffer_size) { video_enc.rc_buffer_size = 40 * 1024; } add_codec(stream, &video_enc); } } stream = NULL; } else if (!strcasecmp(cmd, "<Redirect")) { /*********************************************/ char *q; if (stream || feed || redirect) { fprintf(stderr, "%s:%d: Already in a tag\n", filename, line_num); errors++; } else { redirect = av_mallocz(sizeof(FFStream)); *last_stream = redirect; last_stream = &redirect->next; get_arg(redirect->filename, sizeof(redirect->filename), &p); q = strrchr(redirect->filename, '>'); if (*q) *q = '\0'; redirect->stream_type = STREAM_TYPE_REDIRECT; } } else if (!strcasecmp(cmd, "URL")) { if (redirect) { get_arg(redirect->feed_filename, sizeof(redirect->feed_filename), &p); } } else if (!strcasecmp(cmd, "</Redirect>")) { if (!redirect) { fprintf(stderr, "%s:%d: No corresponding <Redirect> for </Redirect>\n", filename, line_num); errors++; } if (!redirect->feed_filename[0]) { fprintf(stderr, "%s:%d: No URL found for <Redirect>\n", filename, line_num); errors++; } redirect = NULL; } else if (!strcasecmp(cmd, "LoadModule")) { get_arg(arg, sizeof(arg), &p); #ifdef CONFIG_HAVE_DLOPEN load_module(arg); #else fprintf(stderr, "%s:%d: Module support not compiled into this version: '%s'\n", filename, line_num, arg); errors++; #endif } else { fprintf(stderr, "%s:%d: Incorrect keyword: '%s'\n", filename, line_num, cmd); errors++; } } fclose(f); if (errors) return -1; else return 0; } #if 0 static void write_packet(FFCodec *ffenc, uint8_t *buf, int size) { PacketHeader hdr; AVCodecContext *enc = &ffenc->enc; uint8_t *wptr; mk_header(&hdr, enc, size); wptr = http_fifo.wptr; fifo_write(&http_fifo, (uint8_t *)&hdr, sizeof(hdr), &wptr); fifo_write(&http_fifo, buf, size, &wptr); /* atomic modification of wptr */ http_fifo.wptr = wptr; ffenc->data_count += size; ffenc->avg_frame_size = ffenc->avg_frame_size * AVG_COEF + size * (1.0 - AVG_COEF); } #endif static void show_banner(void) { printf("ffserver version " FFMPEG_VERSION ", Copyright (c) 2000-2003 Fabrice Bellard\n"); } static void show_help(void) { show_banner(); printf("usage: ffserver [-L] [-h] [-f configfile]\n" "Hyper fast multi format Audio/Video streaming server\n" "\n" "-L : print the LICENSE\n" "-h : this help\n" "-f configfile : use configfile instead of /etc/ffserver.conf\n" ); } static void show_license(void) { show_banner(); printf( "This library is free software; you can redistribute it and/or\n" "modify it under the terms of the GNU Lesser General Public\n" "License as published by the Free Software Foundation; either\n" "version 2 of the License, or (at your option) any later version.\n" "\n" "This library is distributed in the hope that it will be useful,\n" "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n" "Lesser General Public License for more details.\n" "\n" "You should have received a copy of the GNU Lesser General Public\n" "License along with this library; if not, write to the Free Software\n" "Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\n" ); } static void handle_child_exit(int sig) { pid_t pid; int status; while ((pid = waitpid(-1, &status, WNOHANG)) > 0) { FFStream *feed; for (feed = first_feed; feed; feed = feed->next) { if (feed->pid == pid) { int uptime = time(0) - feed->pid_start; feed->pid = 0; fprintf(stderr, "%s: Pid %d exited with status %d after %d seconds\n", feed->filename, pid, status, uptime); if (uptime < 30) { /* Turn off any more restarts */ feed->child_argv = 0; } } } } need_to_start_children = 1; } int main(int argc, char **argv) { const char *config_filename; int c; struct sigaction sigact; av_register_all(); config_filename = "/etc/ffserver.conf"; my_program_name = argv[0]; my_program_dir = getcwd(0, 0); ffserver_daemon = 1; for(;;) { c = getopt(argc, argv, "ndLh?f:"); if (c == -1) break; switch(c) { case 'L': show_license(); exit(1); case '?': case 'h': show_help(); exit(1); case 'n': no_launch = 1; break; case 'd': ffserver_debug = 1; ffserver_daemon = 0; break; case 'f': config_filename = optarg; break; default: exit(2); } } putenv("http_proxy"); /* Kill the http_proxy */ srandom(gettime_ms() + (getpid() << 16)); /* address on which the server will handle HTTP connections */ my_http_addr.sin_family = AF_INET; my_http_addr.sin_port = htons (8080); my_http_addr.sin_addr.s_addr = htonl (INADDR_ANY); /* address on which the server will handle RTSP connections */ my_rtsp_addr.sin_family = AF_INET; my_rtsp_addr.sin_port = htons (5454); my_rtsp_addr.sin_addr.s_addr = htonl (INADDR_ANY); nb_max_connections = 5; max_bandwidth = 1000; first_stream = NULL; logfilename[0] = '\0'; memset(&sigact, 0, sizeof(sigact)); sigact.sa_handler = handle_child_exit; sigact.sa_flags = SA_NOCLDSTOP | SA_RESTART; sigaction(SIGCHLD, &sigact, 0); if (parse_ffconfig(config_filename) < 0) { fprintf(stderr, "Incorrect config file - exiting.\n"); exit(1); } build_file_streams(); build_feed_streams(); compute_bandwidth(); /* put the process in background and detach it from its TTY */ if (ffserver_daemon) { int pid; pid = fork(); if (pid < 0) { perror("fork"); exit(1); } else if (pid > 0) { /* parent : exit */ exit(0); } else { /* child */ setsid(); chdir("/"); close(0); open("/dev/null", O_RDWR); if (strcmp(logfilename, "-") != 0) { close(1); dup(0); } close(2); dup(0); } } /* signal init */ signal(SIGPIPE, SIG_IGN); /* open log file if needed */ if (logfilename[0] != '\0') { if (!strcmp(logfilename, "-")) logfile = stdout; else logfile = fopen(logfilename, "w"); } if (http_server() < 0) { fprintf(stderr, "Could not start server\n"); exit(1); } return 0; }
sofian/drone
lib/ffmpeg/ffserver.c
C
gpl-2.0
152,555
32.499122
254
0.46673
false
''' Ohm's law is a simple equation describing electrical circuits. It states that the voltage V through a resistor is equal to the current (I) times the resistance: V = I * R The units of these are volts, ampheres (or "amps"), and ohms, respectively. In real circuits, often R is actually measured in kiloohms (10**3 ohms) and I in milliamps (10**-3 amps). Let's create a Resistor class that models this behavior. The constructor takes two arguments - the resistance in ohms, and the voltage in volts: >>> resistor = Resistor(800, 5.5) >>> resistor.resistance 800 >>> resistor.voltage 5.5 The current is derived from these two using Ohm's law: (Hint: use @property) >>> resistor.current 0.006875 Since we may want the value in milliamps, let's make another property to provide that: >>> resistor.current_in_milliamps 6.875 Let's set it up so that we can change the current, and doing so will correspondingly modify the voltage (but keep the resistance constant). >>> resistor.current_in_milliamps = 3.5 >>> resistor.resistance 800 >>> round(resistor.voltage, 2) 2.8 >>> resistor.current = .006875 >>> round(resistor.voltage, 2) 5.5 >>> resistor.resistance 800 Also, we've made a design decision that a Resistor cannot change its resistance value once created: >>> resistor.resistance = 8200 Traceback (most recent call last): AttributeError: can't set attribute ''' # Write your code here: class Resistor: def __init__(self, resistance, voltage): self._resistance = resistance self.voltage = voltage @property def resistance(self): return self._resistance @property def current(self): return self.voltage / self.resistance @current.setter def current(self, value): self.voltage = self.resistance * value @property def current_in_milliamps(self): return self.current * 1000 @current_in_milliamps.setter def current_in_milliamps(self, value): self.current = value / 1000 # Do not edit any code below this line! if __name__ == '__main__': import doctest count, _ = doctest.testmod() if count == 0: print('*** ALL TESTS PASS ***\nGive someone a HIGH FIVE!') # Copyright 2015-2018 Aaron Maxwell. All rights reserved.
ketan-analytics/learnpython
Safaribookonline-Python/courseware-btb/solutions/py3/patterns/properties_extra.py
Python
gpl-2.0
2,255
23.51087
70
0.699778
false
--- layout: post title: 从垃圾回收算法到Object Pool description: "Just about everything you'll need to style in the theme: headings, paragraphs, blockquotes, tables, code blocks, and more." modified: 2014-02-28 tags: [javascript, GC] image: feature: abstract-3.jpg credit: dargadgetz creditlink: http://www.dargadgetz.com/ios-7-abstract-wallpaper-pack-for-iphone-5-and-ipod-touch-retina/ comments: true share: true --- 前言:这本是一篇InfoQ的投稿,编辑给我的修改意见是把前半部分的GC算法的去掉。因为这些算法在JVM和其它平台的几乎是一致,甚至只是子集(事实确实如此,这篇文章参考了的文章大部分是Javas虚拟机的GC算法)。但还是暂时保留下来作为1.0 版本吧,将来打算和其它的优化内容合在一起,重新发布。 ------ 浏览器的脚本引擎有一个不足之处是,你无法通过javascript语法强制让脚本引擎进行垃圾回收(Garbage Collection,在文中以GC代替)和内存释放。虽然你可以在脚本中执行 `delete someVariable` 或者 `someVariable = null` 又或者 `someVariable = void 0`。但事实上你做的都只是删除了变量对某个对象的引用而已,至于被删除引用的对象是否能够被回收,又何时能否被回收,这就只能由脚本引擎说得算了。 这会留下一个性能上的隐患,因为GC也是要消耗浏览器资源的。理想的状态应该是在浏览器进程空闲的时候进行GC,相反如果GC发生的同时也有许多脚本需要处理,这务必会影响程序的性能。为了保证良好的用户体验,我们要尽可能让程序的刷新率靠近每秒60帧。换而言之,你必须在16.7ms之内执行完每一帧的所有脚本。 这篇文章主要分为两部分,一是关于浏览器的脚本引擎如何进行垃圾回收;二是如何使用Object Pool解决GC引起性能问题。 ## 脚本引擎的垃圾回收算法 ### Reference Counting 早在Javascript 1.1版本和Netscape 3中(甚至在早期火狐中),一个对象是否被回收是由这个对象的被引用次数决定的。对象一旦被创建并被一个变量引用,那么它的引用次数便是1,如果该对象又被赋值给了另一个变量,那么引用便增为2.一旦某变量删除了对该对象的引用或者另被赋值,那么该对象的引用便又降为1.理论上来说,当一个对象的被引用次数降为0时,表示没有任何变量在引用该对象了,它已经毫无用处可以被回收从内存中释放了。 但是这个算法有一个缺陷,比如当存在如下图循环引用的情况时: {% highlight javascript %} A<-------| C----->X | | D----->Y |------->B E----->Z {% endhighlight %} A与B互相引用,A和B的被引用次数都不为0,按照算法规则是不会被垃圾回收。但实际情况是A与B成了座“孤岛”,没有任何以外的变量引用他们。他们不会被回收,又不会再被发现和引用,这便造成了内存泄露。 实际的例子是在IE6、7中,DOM对象的回收使用的就是Reference Counting算法,比如下面这个例子 {% highlight javascript %} var div = document.createElement("div"); div.onclick = function handler(){ doSomething(); }; {% endhighlight %} 引用的情况是: - div通过onclick属性对函数handler进行引用 - 函数对div也进行了引用,因为在handler的作用域中可以访问div 这样的循环会导致两个对象都没有办法被垃圾回收,引起内存泄露。 ### Mark-and-Sweep 目前大部分浏览器使用的是这一个垃圾回收算法,或是在这个算法上的变形。这个算法以图的形式将所有的对象连接起来,就像算法名称所示,回收过程分为两个阶段: 1. 标记(Mark):它首先假设存在一些根(root)节点(比如Javascript中的全局对象),从根节点出发,试图去访问其它的每一个与它相连的节点。在Javascript中,如果访问到的节点是基本数据类型(Primitive type),则对这个节点进行标记,如果不是基本数据类型,也就是Object或者Array,则对这个非基本类型递归这一过程,直到访问到所有节点。 2. 清除(Sweep):经过上面的步骤之后,那么那些存在但没有被标记的对象,则进行回收。 ![Alt text](http://www.html5rocks.com/en/tutorials/memory/effectivemanagement/images/image03.png) 如果说Reference Counting的回收条件是“当某个对象不再被需要”,那么Mark-and-Sweep的回收条件则是“当某个对象不再能被访问”。 同时我们再回过头来看在前一个算法中会造成内存泄露的例子,很明显如果将算法换成Mark-and-Sweep,即使A与B互相引用,但是从根节点出发无法被访问,那么还是会对他们进行回收。 ### V8 实际情况会比我们想象的复杂的多,比如V8引擎就一共使用了三种垃圾回收算法。 #### Two Generational Collector(分代收集算法) 分代收集算法实际只能算三色标记算法(Tri-color marking)的一种策略。该算法的依据是:根据对大量计算机程序进行统计,发现最新被分配内存空间的对象通常活的时间都不会太长。这也被称作“弱代假说”(infant mortality or the generational hypothesis)。 这个算法将内存空间分为两代(generation),年青一代(young generation)和老一代(old generation)。在年青一代区域内存的分配和回收频繁并且迅速,老一代的区域内存的分配缓慢并且次数较少。一个对象被划分为“年青”和“老”的依据是,它从出生到存活至今被分配的字节数。 V8引擎的最外层使用的是这个算法,但是在年青一代和老一代的内存空间中又有独立的垃圾回收算法。年青一代使用的是切尼算法(Cheney's algorithm),而老一代使用的是标记压缩(Mark-compact)算法。 #### Cheney's algorithm(切尼算法) 切尼算法将堆(heap)分为相等的两个空间,分别命名为from和to,新增对象的内存空间分配是从名为to的那一部分开始的。当to空间的内存不够分配时,年青一代的GC便被触发。首先GC会交换from和to,并对新的from空间(原来的to)进行扫描,所有“活着”的对象都面临着选择:是被复制到to空间还是被分配到老一代内存中。一般来说这样一个过程不会超过10毫秒。 假设我们已经将from和to空间互相交换过了,接下来需要做的如何找到“活着”的对象,并且将活着的对象转移到新的to空间上去: - 算法依次扫描被栈(stack)引用的堆(heap) 上的对象(至于栈和堆的关系,可以参考C#:在C#中数据类型被分为两种,值类型和引用类型,值类型只需要一段单独的内存,用于存储实际的数据,存储在栈上;引用类型需要两段内存,第一段存储实际的数据,它总是位于堆上,第二段是一个引用指向数据在堆中存放的位置,位于栈上): - 如果对象还没有被转移到新的to空间上,那么就在to空间创建一份拷贝,并且将当前from空间的该对象修改为一个指向to空间拷贝的指针。并更新栈上引用,指向新的拷贝; - 如果对象已经被转移到了新的to空间上,那么把栈上指向from的指针改为指向to上的新拷贝即可 - 算法依次扫描已经转移到to上的对象,并且检查它们在from空间上的引用,重复上面的步骤 #### Mark-compact algorithm(标记压缩算法) 标记压缩算法是标记清除算法的一种变形,它主要解决的是标记清除之后内存空间空间碎片化不连续的问题。以基于表(Table-based)的标记压缩算法为例: 1. 标记与清除过程与Mark-and-sweep算法相同 2. 压缩过程从堆的底部(低位)向头部(高位)进行,每当扫描到一个被标记的对象,将它转移至第一个可用低位。并且将当前的移动记录插入至表(break table)中,该记录包括对象重置的位置,以及重置位置与原位置的差别。表的位置就放在压缩的堆中,但是该位置对其他对象来说是未被使用的。 3. 随着压缩的进行,被标记的对象不断的向低位移动,因此表占用的空间可会被征用,需要转移到新的空间 4. 等到压缩完毕,堆中幸存的对象需要根据表的记录,来更新对其他对象的指针引用 需要注意的是,表可能是不连续的(break),因此在第三步中表可能只是某一部分在堆中移动。这样会导致表里的记录不是按堆中对象的顺序排列的。所以在压缩之后,需要对表进行一次排序。 为了更好的理解压缩过程,可以将堆比作书架的一格,其中一部分放满了不同厚度的图书。空闲空间就是图书之间的空隙。压缩就是将所有图书朝一个方向推移,以弥合所有空隙。它从最靠近隔板的图书开始,将它推向隔板,然后将离隔板第二近的图书推向第一本图书,接着将第三本图书推向第二本图书,依此类推。最后,所有图书在一端,所有空闲空间在另一端。 ## Object Pool 在文章的开头,我提到GC也是会占用资源影响到性能的。让我们来看一个实际的例子。 首先我来模拟一个场景,想象一个街机平面射击游戏,玩家控制飞船不断的发射子弹攻击BOSS,每一轮发射10000颗子弹,同时每一轮发射的时候只有10%的子弹会击中BOSS而损失掉: {% highlight javascript %} // 子弹 var Bullet = function () {}; var gun = []; // 射击 var shoot = function () { var num = 100 * 100; for (var i = 0; i < num; i++) { gun.push(new Bullet()); } }; var shootAgain = function () { // 每次射击都会损失10%的子弹 for (var i = 0, len = parseInt(gun.length * 0.1); i < len ;i++) { gun.shift(); } shoot(); console.log("TOTAL LEN------>", gun.length); }; // 无限执行下去 (function repeat() { setTimeout(function () { shootAgain(); repeat(); }, 100); })(); {% endhighlight %} 如果你在Chrome中执行代码,并且在devtools中timeline中查看内存(memory标签下)的使用情况,你会看到类似于下图的锯齿图: ![Alt text](http://www.html5rocks.com/en/tutorials/speed/static-mem-pools/fig1.jpg) 每一次峰值意味着使用的内存不断的增长,同时峰值之后的回落意味着一个GC的发生,将无用的内存进行回收。 ![Alt text](http://www.html5rocks.com/en/tutorials/speed/static-mem-pools/fig2.jpg) 就像开头说的那样,GC会影响你的性能,如何运行GC是由引擎自己决定的,你没有控制权,GC可以发生在代码执行的任何时候,并且会中断你的代码执行知道GC完成。 如上图那样锯齿状的原因是因为频繁的创建和销毁对象,为了阻止这样的事情发生,其中一个办法就是延长对象的寿命,尽可能的不去触发GC。因此我们可以利用Object Pool模式。 Object Pool采取的是这样一种策略,在程序初始化时一次性创建相当数量的对象,存放在“池(pool)”中,当需要使用时不是在创建新的对象,而是从池中获取,当对象使用完毕后,还回池中,以上面的子弹代码为例,我们可以增加两个关于“池”的方法: {% highlight javascript %} // 使用中的子弹 var activeBullets = []; // 池子 object pool var bulletPool = []; // 初始化创建20颗子弹,存入池中 for (var i=0; i < 20; i++) bulletPool.push( new Bullet() ); // 获得子弹 function getNewBullet() { var b = null; if (bulletPool.length > 0) b = bulletPool.pop(); else // 如果池中对象不够用了,再增加新的对象 b = new Bullet(); // 使用子弹 activeBullets.push(b); return b; } // 释放对象,还回池中 function freeBullet(b) { for (var i=0, l=activeBullets.length; i < l; i++) if (activeBullets[i] == b) array.slice(i, 1); bulletPool.push(b); } {% endhighlight %} 我们可以进一步的将Object Pool模式抽象出来,封装成一个lib: {% highlight javascript %} var ObjectPool = (function() { var ObjectPool = function(Cls) { // 池子里的对象必须是同一类, // 所以你首先要传入一个构造函数 this.cls = Cls; // metrics用于记录pool的当前状态 // 比如 totalalloc(总已分配数)、 totalfree(可用) this.metrics = {}; // 重置池子 this._clearMetrics(); this._objpool = []; }; ObjectPool.prototype = { // 分配 alloc: function () { var obj; // 如果池中已无对象可供分配 if (this._objpool.length == 0) { obj = new this.cls(); this.metrics.totalalloc++; } else { obj = this._objpool.pop(); this.metrics.totalfree--; } obj.init.apply(obj, arguments); return obj; }, // 释放对象 free: function(obj) { var k; this._objpool.push(obj); this.metrics.totalfree++; // 对象还回池中后, // 还需要对对象进行清理,清除脏数据 for (k in obj) { delete obj[k]; } // 重新初始化 obj.init.call(obj); }, // 垃圾回收 // 在Object Pool模式下,垃圾回收便显得多余了 // 如果有需求的话,还是提供这样一个接口 collect: function () { this._objpool = []; var inUse = this.metrics.totalalloc - this.metrics.totalfree; // 记录下当前未被回收但已分配的个数 this._clearMetrics(inUse); }, _clearMetrics: function (allocated) { this.metrics.totalalloc = allocated || 0; this.metrics.totalfree = 0; } } return ObjectPool })(); {% endhighlight %} 有了上面的类库,我的子弹代码可以继续改进: {% highlight javascript %} // 子弹类 var Bullet = function () {}; // 创建 Object Pool var bulletPool = new ObjectPool(Bullet); // 新的子弹 var bullet = bulletPool.alloc(); // 销毁子弹 bullPool.free(bullet) {% endhighlight %} 最后要说明的是Object Pool并非万能。如果对于一些性能要求较高的大型应用,预先的一次性创建大批对象同样是一种代价;而对于小型应用,因为Object Pool基本不会对内存进行回收,所以会长时间大量占用内存,这同样是值得商榷的。使用Object Pool之后内存的使用情况应该如下图所示: ![Alt text](http://www.html5rocks.com/en/tutorials/speed/static-mem-pools/fig3.jpg) 参考资料 - [Effectively managing memory at Gmail scale - HTML5 Rocks](http://www.html5rocks.com/en/tutorials/memory/effectivemanagement/) - [Static Memory Javascript with Object Pools - HTML5 Rocks](http://www.html5rocks.com/en/tutorials/speed/static-mem-pools/) - [High-Performance, Garbage-Collector-Friendly Code - Build New Games](http://buildnewgames.com/garbage-collector-friendly-code/) - [Garbage Collection (JavaScript: The Definitive Guide, 4th Edition)](http://docstore.mik.ua/orelly/webprog/jscript/ch11_03.htm) - [Mark-compact algorithm - Wikipedia, the free encyclopedia](http://en.wikipedia.org/wiki/Mark-compact_algorithm) - [Cheney's algorithm - Wikipedia, the free encyclopedia](http://en.wikipedia.org/wiki/Cheney%27s_algorithm) - [Garbage collection (computer science) - Wikipedia, the free encyclopedia](http://en.wikipedia.org/wiki/Garbage_collection_(computer_science)) - [Memory Management - JavaScript](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Memory_Management)
hh54188/jekyll-blog
_posts/2014-02-28-from-GC-algorithm-to-ObjectPool.md
Markdown
gpl-2.0
16,139
28.843949
236
0.715932
false
set(PROCESSORS 4) set(CMAKE_RELEASE_DIRECTORY /Users/kitware/CMakeReleaseDirectory) # set(USER_OVERRIDE "set(CMAKE_CXX_LINK_EXECUTABLE \\\"gcc <FLAGS> <CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES> -shared-libgcc -lstdc++-static\\\")") set(INSTALL_PREFIX /) set(HOST dashmacmini5) set(MAKE_PROGRAM "make") set(MAKE "${MAKE_PROGRAM} -j5") set(CPACK_BINARY_GENERATORS "PackageMaker TGZ TZ") set(CPACK_SOURCE_GENERATORS "TGZ TZ") set(INITIAL_CACHE " CMAKE_BUILD_TYPE:STRING=Release CMAKE_OSX_ARCHITECTURES:STRING=x86_64;i386 CMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.5 CMAKE_SKIP_BOOTSTRAP_TEST:STRING=TRUE CPACK_SYSTEM_NAME:STRING=Darwin64-universal BUILD_QtDialog:BOOL=TRUE QT_QMAKE_EXECUTABLE:FILEPATH=/Users/kitware/Support/qt-4.7.4/install/bin/qmake ") get_filename_component(path "${CMAKE_CURRENT_LIST_FILE}" PATH) include(${path}/release_cmake.cmake)
DDTChen/CookieVLC
vlc/extras/tools/cmake/Utilities/Release/dashmacmini5_release.cmake
CMake
gpl-2.0
882
43.1
182
0.770975
false
@(contestId: Long, form: Form[org.iatoki.judgels.uriel.forms.ContestAnnouncementUpsertForm]) @import play.i18n.Messages @import org.iatoki.judgels.uriel.controllers.routes @import org.iatoki.judgels.play.views.html.formErrorView @import org.iatoki.judgels.uriel.views.html.contest.announcement.upsertAnnouncementView @import org.iatoki.judgels.uriel.views.html.contest.supervisorjs @implicitFieldConstructor = @{ b3.horizontal.fieldConstructor("col-md-3", "col-md-9") } @formErrorView(form) @b3.form(routes.ContestAnnouncementController.postCreateAnnouncement(contestId)) { @upsertAnnouncementView(form) @b3.submit('class -> "btn btn-primary") { @Messages.get("commons.create") } } @supervisorjs(contestId)
ia-toki/judgels-uriel
app/org/iatoki/judgels/uriel/views/contest/announcement/createAnnouncementView.scala.html
HTML
gpl-2.0
721
35.1
92
0.793343
false
using UnityEngine; using System.Collections; public class Metrics : MonoBehaviour { // Use this for initialization void Start () { } // Update is called once per frame void Update () { } }
JoeProgram/monster
Assets/Scripts/Metrics.cs
C#
gpl-2.0
206
12.6
38
0.676471
false
<?php declare(strict_types=1); namespace PoPCMSSchema\QueriedObject\TypeResolvers\InterfaceType; use PoP\ComponentModel\TypeResolvers\InterfaceType\AbstractInterfaceTypeResolver; class QueryableInterfaceTypeResolver extends AbstractInterfaceTypeResolver { public function getTypeName(): string { return 'Queryable'; } public function getTypeDescription(): ?string { return $this->__('Entities that can be queried through an URL', 'queriedobject'); } }
leoloso/PoP
layers/CMSSchema/packages/queriedobject/src/TypeResolvers/InterfaceType/QueryableInterfaceTypeResolver.php
PHP
gpl-2.0
497
23.85
89
0.746479
false
*, *:before, *:after { -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; } span.grid_module { width: 10em; overflow: hidden; display: inline-block; vertical-align: bottom; text-overflow: ellipsis; } #tblda th,#tblda td { display: block; text-align: left; } #tblda th.thda { font-family: font_strong; font-size: 24px; color: #322F31; text-transform: uppercase; font-weight: normal; margin-bottom: 10px; } #blsd_padding table td { white-space: pre-wrap; } div#login-box { background-color: #fff; height: 235px; width: 380px; font-size: 14px; overflow: hidden; position: absolute; z-index: 99999; top: 25%; left: 35%; display: none; } .menu .tinnhan { padding: 10px; } .menu li h4 { margin-top: 0; } .clearfix::after { visibility: hidden; display: block; font-size: 0; content: " "; clear: both; height: 0; } * html .clearfix { zoom: 1; } /* IE6 */ *:first-child + html .clearfix { zoom: 1; } /* IE7 */ body { font-family: 'Open Sans', sans-serif; font-size: 13px; /* color: #322F31; */ min-width: 970px; line-height: 20px; margin: 0px; background-color: #f4f4f4; -webkit-font-smoothing: antialiased; } .cddt { position: relative; height: 100%; } ul li { list-style: none; } ul.menu { line-height: initial; /* margin-right: 2px; */ } .menu p { line-height: initial; } ul { padding: 0; margin: 0; } ul#top-subject li:nth-child(odd) { background-color: white; } ul#top-subject li:nth-child(even) { background-color: #faf8f1; } ul#top-subject -child {} ul#top-subject li:first-child,ul#top-subject li:last-child { background-color: white; } li.header { text-align: center; line-height: 50px; border-bottom: 1px solid #fff; } @font-face { font-family: font_strong; src: url('fonts/utm_bebas.ttf') format('truetype'), url('fonts/utm_bebas.eot#iefix') format('embedded-opentype'), url('fonts/utm_bebas.woff') format('woff'); font-weight: normal; font-style: normal; } @font-face { font-family: font_hvt; src: url('fonts/HelveticaWorld-Regular.eot'); font-weight: normal; font-style: normal; } /* Webkit override Scrollbar with CSS3 */ .box-left table { max-width: 100%; width: 100%; } .line2 { height: 1px; background: #322F31; } .line { height: 1px; background: #f4f4f4; } .linefix::before { content: ""; position: absolute; width: 100%; border-bottom: 1px solid #EEE; } .line_orn { height: 4px; background: #f4f4f4; margin-bottom: -4px; z-index: 99; position: relative; } .line_orn2 { height: 4px; background: url('/Images/orn2.png') repeat-x; } .clear { clear: both; } .main { margin: 0 auto; overflow: hidden; padding: 0; min-width: 1030px; max-width: 1030px; width: 100%; } .main2 { margin: 0 auto; /* overflow: hidden; */ padding: 0; min-width: 1030px; max-width: 1030px; width: 100%; height: 100%; } .title_path { height: 50px; background: #fff; border-radius: 0px; width: 100%; margin-top: 0px; border-bottom: 1px solid #f4f4f4; } .tileh3 { margin-top: 0px; position: absolute; color: #322F31; font-size: 18px; padding-left: 65px; line-height: 54px; float: left; font-weight: normal; background: url('/Images/iBooks-S3-icon.png') no-repeat 25px center; background-size: 30px auto; text-transform: uppercase; } /*========================Header===========================*/ .head_box { height: 60px; background: url(../Images/white95.png); z-index: 9999; position: fixed; left: 0px !important; margin: 0 auto; width: 100%; } .head_logo { width: 40px; height: 40px; background-image: url('/Images/hlogo.png'); background-size: 40px 40px; margin-top: 13px; float: left; } .head_username_box { margin-top: -3px; } .head_username_info:hover { text-decoration: none; } .head_username_info { font-size: 11px; font-weight: normal; color: #fff; text-decoration: none; } a.Link_orange:hover { color: #eee; text-decoration: none; } .head_menu_beak { background: #ddd; float: left; width: 0px; height: 20px; margin-top: 15px; } .head_menu { float: left; font-size: 22px; text-align: center; margin-top: 5px; margin-left: 20px; text-transform: uppercase; } .head_menu_item { float: left; margin-top: 15px; padding: 0px 5px; } .head_menu_text { color: #322F31; padding: 0 8px; text-decoration: none; font-family: font_strong; } a.head_menu_text:hover { color: #f7922a; } /*========================Slide + Tìm Kiếm===========================*/ input#searchinput { height: 27px; width: 220px; border: none; padding-left: 10px; outline: none; } input.search_button { position: absolute; right: 0px; top: 0px; background: url('/Images/ic_search_white_24dp.png') no-repeat 10px center #70b4de; border-left: 1px solid #eee; color: #fff; border-right: 0px; border-bottom: 0px; height: 30px; border-top: 0px; width: 100px; padding-left: 30px; cursor: pointer; } #camera_wrap { width: 100%; min-width: 1030px; display: block; margin: 0 auto; float: none; border-radius: 0px; max-height: 321px; height: 100%; min-height: 321px; background: url('/Images/ofical_banner.png') center center no-repeat #fff; z-index: -1; /* bottom: 0; */ position: absolute; margin-top: 60px; left: 0; - webkit - transition: all 1.0s ease; - moz - transition: all 1.0s ease; transition: all 1.0s ease; /* background-size: 100% auto; */ } .footer { width: 100%; min-width: 1030px; } .nddalg { z-index: 1; position: relative; margin-bottom: 55px; height: 55px; width: 230px; margin-left: -50px; } /*========================Cột bên phải===========================*/ .box_right { width: 300px; float: right; padding: 1px 1px; } .bg_right { position: relative; background-color: #fff; border-radius: 0px; border: 0px solid #eee; overflow: hidden; } .bg_title_category { background: url('/Images/iconTabArrow.gif') no-repeat 31px bottom; height: 50px; padding-left: 25px; padding-top: 18px; font-size: 18px; color: #f7922a; text-transform: uppercase; border-bottom: 1px solid #f7922a } a#tab-1 { text-indent: -9999; display: inline-block; text-indent: -9999px; background: url('/images/ic_folder_white_24dp2.png') no-repeat 0px center; width: 35px; text-decoration: none; } a#tab-2 { text-indent: -9999; display: inline-block; text-indent: -9999px; background: url('/images/ic_star_white_24dp.png') no-repeat 0px 98px; width: 35px; padding-top: 100px; text-decoration: none; margin-top: -100px; } .bg_title_category2 { background: url('/Images/ic_local_offer_white_24dp.png') no-repeat 10px center #70b4de; height: 32px; width: 265px; padding-left: 45px; padding-top: 13px; font-size: 18px; color: white; text-transform: uppercase; } .cate_link { color: #322F31; display: block; text-decoration: none; } .cate_item:hover { color: #f7922a; background-image: url('/Images/iconArrowRight_on.gif'); } .cate_item { font-weight: normal; padding: 13px 40px 13px 25px; background-image: url('/Images/iconArrowRight.gif'); background-position: right 25px top 16px; background-repeat: no-repeat; font-size: 16px; margin: 0px; } .bg_title_top { background: url('/Images/iconTabArrow.gif') no-repeat 31px bottom; height: 50px; padding-left: 25px; padding-top: 15px; font-size: 18px; color: #f7922a; text-transform: uppercase; border-bottom: 1px solid #f7922a; } .top_item { height: 120px; padding: 0 15px; border-bottom: 1px solid #f4f4f4; } .top_item:nth-child(2n) { height: 120px; width: 250px; /* padding: 0 25px; */ background-color: #fff; border-bottom: 1px solid #f4f4f4; } .top_viewall { height: 35px; text-align: right; padding: 10px 25px 0 0; } .top_img { width: auto; height: 65px; font-size: 12px; vertical-align: middle; } .anhtopdoan { width: 81px; height: 65px; float: left; overflow: hidden; background: #fff; margin-top: 15px; border-radius: 2px; border: 1px solid #f4f4f4; } .top_title_link { color: #322F31; text-decoration: none; } .top_title { overflow: hidden; white-space: nowrap; margin-top: 15px; text-overflow: ellipsis; width: 12em; height: 65px; line-height: 18px; font-weight: normal; float: right; font-size: 15px; /* margin-bottom: 0px; */ position: relative; } a.top_title_link :hover { text-decoration: none; color: #ff8401; } .top_cate { height: 20px; overflow: hidden; float: left; color: #ff8401; text-decoration: none; font-style: italic; padding-right: 5px; padding-top: 2px; width: 150px; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; } .top_view { height: 20px; overflow: hidden; float: right; color: #babcbc; padding-top: 2px; } .top_view:after { content: 'views'; color: #babcbc; } .link_bullet_next { font-style: italic; color: #babcbc; background-image: url('/Images/glyphCategoryArrow.png'); background-position: right 0px top 4px; background-repeat: no-repeat; text-decoration: none; padding-right: 15px; } a.link_bullet_next:hover { text-decoration: none; background-image: url('/Images/glyphCategoryArrow_hv.png'); color: #ff8401; } /*--================================FOOTER ==========================================*/ .footer_box { height: 285px; background: #202020; padding-top: 20px; margin-top: 50px; } .footer_logo { width: 285px; float: left; margin-top: 5px; } .footer_logo_menu { margin-top: 5px; display: inline-block; color: #f7922a; } .link_bullet_bold { background-position: right 0px top 3px; background-repeat: no-repeat; text-decoration: none; padding-right: 10px; font-size: 13px; text-transform: uppercase; color: #fff; font-weight: bold; } .footer_company { margin-left: 50px; margin-top: 6px; width: 420px; float: left; } .footer_title { font-size: 23px; color: #f7922a; margin-bottom: 30px; font-family: font_strong; font-weight: 200; word-spacing: 2px; } .footer_item { margin-top: 20px; overflow: hidden; } .footer_img { width: 65px; height: 65px; border-radius: 0px; float: left; margin-right: 15px; } .footer_text { width: 330px; float: left; color: #fff; font-weight: bold; } .footer_link { width: 275px; float: left; color: #cbcccc; margin-top: 3px; text-decoration: none; } .footer_address { margin-left: 40px; margin-top: 6px; width: 210px; float: right; color: #cbcccc; } .footer_email a { text-decoration: none !important; } .footer_address_text { margin-top: 20px; font-weight: bold; margin-bottom: 10px; color: #fff; } .footer_email { background: url('/Images/ic_email.png') no-repeat 0 5px; padding-left: 22px; color: #ff8401; margin-top: 15px; } .diachi { background: url('../Images/bg_icon_address.png') no-repeat 0px 4px; padding-left: 20px; } .footer_logo2 { background: url('/Images/hlogo.png') no-repeat 0px 0px; width: 100%; height: 40px; background-size: 40px 40px; float: left; text-align: left; font-size: 45px; color: #f7922a; margin-bottom: 15px; font-family: font_strong; font-weight: 200; word-spacing: 2px; text-decoration: none; } a.footer_logo2 { padding-top: 6px; padding-left: 50px; padding-bottom: 0px; margin-bottom: 10px; } .footer_logo p { color: #cbcccc; text-align: left; padding: 0; } a#to-top { width: 28px; height: 28px; display: block; position: fixed; bottom: 20px; right: 20px; text-indent: -9999px; border-radius: 3px; background: url(http://rgb.vn/ideas/wp-content/themes/rgb2014/images/iconArrowTop.png) no-repeat #d9d9d9; opacity: .5; filter: alpha(opacity=50); } .bottom_box { height: 73px; background: #f4f4f4; color: #322F31; font-size: 14px; } .bottom_copyright { margin-top: 18px; width: 100%; text-align: center; } .bottom_copyright p { color: #8a8a8a; margin: 0; } .bottom_author { margin-top: 15px; width: 370px; float: right; text-align: right; font-size: 11px; color: #D52026; } .bottom_link { color: #D52026; text-decoration: none; } /*--================================ CỘT BÊN TRÁI===========================================*/ .box_left { width: 690px; display: block; float: left; padding: 1px; margin: 0; margin-top: 110px; } .title_box { background-color: #fff; border-radius: 0px; height: 45px; border-bottom: 1px solid #f4f4f4; padding: 0px 5px; display: none; } /*===================================Trang chủ=================================*/ /*1. trang chu. tuy chon*/ .option_view { border-radius: 0px; border: 1px solid #70b4de; height: 30px; width: 330px; float: left; margin-top: 7px; background-color: white; margin-left: 20px; position: relative; } .option_view_small { border-radius: 0px; height: 30px; width: 60px; float: right; margin-top: 7px; background-color: white; margin-right: 20px; } .option_sort { line-height: 54px; width: 180px; float: right; margin-right: 25px; } .option_base { color: #FFB82E; background: url('/Images/ic_base1.png') 15px 7px no-repeat; width: 100px; height: 30px; border: none; padding-left: 30px; font-size: 14px; float: left; border-radius: 0px 0 0 0px; } .option_base:hover { cursor: pointer; color: white; background: url('/Images/ic_base2.png') 15px 8px no-repeat #FFB82E; } .option_base_select { color: white; background: url('/Images/ic_base2.png') 15px 7px no-repeat #FFB82E; width: 100px; height: 30px; border: none; padding-left: 30px; font-size: 14px; float: left; border-radius: 0px 0 0 0px; } .option_detail { color: #322F31; background: url('/Images/ic_detail1.png') 15px 8px no-repeat #f4f4f4; width: 100px; height: 30px; border: none; padding-left: 30px; font-size: 14px; border-radius: 0 0px 0px 0; } .option_detail:hover { cursor: pointer; color: white; background: url('/Images/ic_detail2.png') 15px 8px no-repeat #FFB82E; } .option_detail_select { color: white; background: url('/Images/ic_detail2.png') 15px 8px no-repeat #FFB82E; width: 100px; height: 30px; border: none; padding-left: 30px; font-size: 14px; border-radius: 0 0px 0px 0; } /*option small*/ .option_base_small { background: url('/Images/ic_base1.png') 8px 8px no-repeat; width: 30px; height: 30px; border: none; float: left; border-radius: 0px 0 0 0px; } .option_base_small:hover { cursor: pointer; background: url('/Images/ic_base2.png') 8px 8px no-repeat #322F31; } .option_base_select_small { background: url('/Images/ic_base2.png') 8px 8px no-repeat #322F31; width: 30px; height: 30px; border: none; float: left; border-radius: 0px 0 0 0px; } .option_detail_small { background: url('/Images/ic_detail1.png') 6px 8px no-repeat; width: 30px; height: 30px; border: none; border-radius: 0 0px 0px 0; } .option_detail_small:hover { cursor: pointer; background: url('/Images/ic_detail2.png') 6px 8px no-repeat #322F31; } .option_detail_select_small { background: url('/Images/ic_detail2.png') 6px 8px no-repeat #322F31; width: 30px; height: 30px; border: none; float: left; border-radius: 0 0px 0px 0; } /*================================Common. Control=====================================*/ /* CSS FOR dropdownlist */ .lable { padding-top: 5px; float: left; white-space: nowrap; color: #322F31; } .select_label { position: relative; } .select_label:before { right: 7px; top: -1px; background: #fff; width: 20px; height: 20px; content: ''; position: absolute; pointer-events: none; display: block; } .select_label:after { content: ''; font: 25px "Consolas", monospace; color: #babcbc; right: 10px; bottom: -3px; width: 20px; height: 20px; position: absolute; pointer-events: none; background: url('/Images/iconArrow.png') no-repeat 0px 0px #fff; } select { padding-right: 18px; } select { padding: 5px 5px 5px 15px; margin: 0; width: 50%; font-size: 15px; -webkit-border-radius: 5px; -moz-border-radius: 5px; border-radius: 5px; background: #fff; color: #babcbc; outline: none; cursor: pointer; border: 1px solid #f4f4f4; } select .dropDown { position: absolute; top: 40px; left: 0; width: 100%; border: 1px solid #32333b; border-width: 0 1px 1px; list-style: none; -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box; } /*end dropdownlist*/ /*3.control.gridview*/ .grid_box { margin: 20px 0; padding: 0px 25px; } #blsd { border: 0px solid #eee; border-radius: 0px; background: #fff; border-top: 0px solid #f9994c; } /*================CHI TIẾT ĐỒ ÁN BEGIN===================================*/ #blsd_padding { padding: 10px 25px 25px 25px; font-size: 16px; word-wrap: break-word; } #blsd_padding tr { display: list-item; list-style: none; padding-top: 20px; } tr.trdssvbc * { white-space: initial !important; } #tblda #trHome td { display: inline-block; } #tblda tr.success th,#tblda tr.success td { display: inline-block; } textarea#Content { width: 600px; height: 100px; border: 1px solid #ddd; font-size: 16px; font-family: 'Open Sans', sans-serif; padding: 10px; border-radius: 3px; } fieldset { border: 1px solid #ddd; } input[type="file"] { /* background: #fff !important; */ opacity: 0.8; padding: 5px 0px; } #trHome { display: inline-block; color: #322F31; width: 635px; height: 50px; /* padding: 0px; */ /* margin: 0px; */ overflow: hidden; /* padding-left: 45px; */ font-weight: normal; /* background: url('/Images/iBooks-S3-icon.png') no-repeat 0px 20px; */ background-size: 30px auto; border-bottom: 1px solid #eee; margin-top: -13px; } tr#trHome a { text-decoration: none; color: #322F31; white-space: nowrap; } tr#trHome a:hover { text-decoration: none; color: #f7922a; } td#tdmon { width: 220px; overflow: hidden; max-width: 220px; padding-left: 30px; white-space: nowrap; text-overflow: ellipsis !important; background: url("/Images/ic_tab_white_18dp.png") no-repeat 0px center; background-size: 20px 20px; } td#tdgv { width: 150px; overflow: hidden; max-width: 150px; white-space: nowrap; text-overflow: ellipsis !important; background: url("/Images/ic_perm_contact_cal_white_18dp.png") no-repeat 0px center; background-size: 20px 20px; padding-left: 30px; } td#nbd { /* width: 175px; */ /* max-width: 175px; */ overflow: hidden; white-space: nowrap; text-overflow: ellipsis !important; background: url("/Images/ic_query_builder_white_18dp.png") no-repeat 0px center; background-size: 20px 20px; padding-left: 30px; } td#tdtendoan { font-size: 25px; color: #f7922a; font-family: font_strong; text-transform: uppercase; font-weight: 200; /* word-spacing: 2px; */ line-height: 1.2; /* margin-top: -30px !important; */ margin-bottom: 18px; } td#tdnoidung:before { content: '1.Nội Dung'; display: list-item; text-transform: uppercase; font-family: font_strong; font-size: 24px; color: #322F31; padding-bottom: 3px; margin-bottom: 15px; } td#tdyeucau:before { content: '2.Mục tiêu'; display: list-item; text-transform: uppercase; font-family: font_strong; font-size: 24px; color: #322F31; padding-bottom: 3px; margin-bottom: 15px; } td#tdketqua:before { content: '3.Kết Quả'; display: list-item; text-transform: uppercase; font-family: font_strong; font-size: 24px; color: #322F31; padding-bottom: 3px; margin-bottom: 15px; } td#tdghichu:before { content: '4.Ghi Chú'; display: list-item; text-transform: uppercase; font-family: font_strong; font-size: 24px; color: #322F31; padding-bottom: 3px; margin-bottom: 15px; } /*==================CHI TIẾT ĐỒ ÁN END*/ /*base*/ .grid_base_item { height: 170px; padding: 15px 0; overflow: hidden; position: relative; border-bottom: 3px dashed #f0e5f5; /* background: url('/Images/iconArrowRight_on.gif') no-repeat right 20px; */ } .anhdoan { width: 180px; height: 145px; border-radius: 2px; background: #fff; float: left; margin-right: 20px; overflow: hidden; border: 1px solid #f4f4f4; } .grid_base_img { width: auto; height: 145px; border-radius: 0px; background-color: white; float: left; vertical-align: middle; } .grid_base_title_link { color: #ff8401; text-decoration: none; display: block; } .grid_base_title { width: 25em; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; font-weight: bold; font-size: 17px; vertical-align: middle; margin-top: 15px; } .grid_base_title:hover { text-decoration: none; color: #ff8401; } .grid_detail_col2 { width: 190px; float: right; overflow: hidden; position: absolute; bottom: 15px; right: 0px; list-style: none; /* background: #9c0; */ text-align: left; padding: 0px 0px; color: #babcbc; } ul.grid_detail_col2.clearfix li { padding: 2px 0px; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; } .grid_detail_col1 { width: 235px; float: left; overflow: hidden; position: absolute; bottom: 15px; left: 225px; list-style: none; /* background: #c20000; */ padding: 0px 0px; text-align: left; color: #babcbc; } ul.grid_detail_col1.clearfix li { padding: 2px 0px; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; } /* .grid_base_item:hover > .grid_base_info{ opacity: 0; -webkit-transition: opacity .25s ease-in-out; -moz-transition: opactiy .25s ease-in-out; -ms-transition: opacity .25s ease-in-out; -o-transition: opacity .25s ease-in-out; transition: opacity .25s ease-in-out; } */ .grid_base_img:hover { opacity: 0.5; -webkit-transition: opacity .25s ease-in-out; -moz-transition: opactiy .25s ease-in-out; -ms-transition: opacity .25s ease-in-out; -o-transition: opacity .25s ease-in-out; transition: opacity .25s ease-in-out; } .top_img:hover { opacity: 0.5; -webkit-transition: opacity .25s ease-in-out; -moz-transition: opactiy .25s ease-in-out; -ms-transition: opacity .25s ease-in-out; -o-transition: opacity .25s ease-in-out; transition: opacity .25s ease-in-out; } .nddalg:hover { opacity: 0.7; -webkit-transition: opacity .25s ease-in-out; -moz-transition: opactiy .25s ease-in-out; -ms-transition: opacity .25s ease-in-out; -o-transition: opacity .25s ease-in-out; transition: opacity .25s ease-in-out; } .grid_base_info { /* width: 135px; */ display: block; float: right; margin-top: 0px; /* height: 45px; */ background: #fff; } .grid_base_cate { height: 20px; overflow: hidden; color: #ff8401; text-decoration: none; font-style: italic; padding-right: 4px; position: absolute; right: 0px; white-space: nowrap; text-overflow: ellipsis; width: 190px; text-align: right; } .grid_base_view { height: 20px; overflow: hidden; float: right; color: #babcbc; margin-bottom: 5px; } .grid_base_view:after { content: ' views'; color: #babcbc; } span.grid_base_cate a { color: #ff8401; text-decoration: none; } span.grid_base_cate a:hover { color: #322F31; } /*detail*/ .grid_detai_item { overflow: hidden; padding-top: 7px; } .grid_detai_item:hover .Hover_likesave { display: block; } .grid_detail_left { width: 120px; float: left; } .grid_detail_right { width: 490px; float: right; } ul.grid_detail_col1.clearfix li a { text-decoration: none; position: relative; color: #f7922a; } ul.grid_detail_col1.clearfix li a:hover { text-decoration: none; color: #babcbc; } .grid_detail_img { width: 120px; height: 90px; margin: 10px 0; border-radius: 0px; float: left; background-image: url('/Images/img_code.jpg'); overflow: hidden; } .grid_detail_downview { width: 118px; height: 48px; border-radius: 0px; border: 1px solid #f4f4f4; color: #322F31; margin-bottom: 15px; } .grid_detail_down { width: 59px; height: 28px; font-weight: bold; background: url('/Images/ic_down.png') no-repeat 24px 7px; text-align: center; padding-top: 23px; float: left; } .grid_detail_view { width: 59px; height: 28px; font-weight: bold; background: url('/Images/ic_view.png') no-repeat 22px 9px; text-align: center; padding-top: 23px; float: right; } .grid_detail_title_link { color: #ff8401; text-decoration: none; } .grid_detail_title { margin-top: 10px; width: 490px; height: 45px; overflow: hidden; font-weight: bold; float: left; font-size: 14px; overflow: hidden; line-height: 22px; margin-bottom: 15px; } .grid_detail_title:hover { text-decoration: none; } .grid_detail_cate2 { background: url('/Images/ic_cate.png') no-repeat 2px 4px; padding-left: 20px; height: 25px; overflow: hidden; color: #d5c6ae; } .grid_detail_lang2 { background: url('/Images/ic_lang.png') no-repeat 0px 5px; padding-left: 20px; height: 25px; overflow: hidden; color: #d5c6ae; clear: both; } .grid_detail_user2 { padding-left: 20px; height: 25px; overflow: hidden; color: #d5c6ae; } .grid_detail_img2 { width: 85px; height: 85px; float: left; margin: 5px 0px 15px 0px; border-radius: 0px; box-shadow: 1px 1px 3px #ac8f79; } .grid_detail_acc { width: 150px; float: right; margin-top: 10px; } .grid_detail_acc .info { margin-top: 5px; } .grid_detail_acc .username { color: #84c52c; font-size: 15px; font-weight: bold; text-decoration: none; } .grid_detail_acc .username:hover { text-decoration: none; } .grid_detail_copyright2 { background: url('/Images/ic_copyright.png') no-repeat 0 3px; padding-left: 20px; height: 25px; overflow: hidden; color: #d5c6ae; } .grid_detail_type2 { background: url('/Images/ic_type.png') no-repeat 1px 4px; padding-left: 20px; height: 25px; overflow: hidden; color: #d5c6ae; } .grid_detail_size2 { background: url('/Images/ic_size.png') no-repeat 1px 7px; padding-left: 20px; height: 25px; overflow: hidden; color: #d5c6ae; } .grid_detail_date2 { background: url('/Images/ic_date.png') no-repeat 0 4px; padding-left: 20px; height: 25px; overflow: hidden; color: #d5c6ae; } .grid_detail_like2 { background: url('/Images/ic_like.png') no-repeat 0 6px; padding-left: 20px; height: 25px; overflow: hidden; color: #d5c6ae; } .grid_detail_cate { padding-left: 20px; height: 25px; overflow: hidden; color: #d5c6ae; } .grid_detail_user { padding-left: 20px; height: 25px; overflow: hidden; color: #d5c6ae; } .grid_detail_copyright { padding-left: 20px; height: 25px; overflow: hidden; color: #d5c6ae; } .grid_detail_type { padding-left: 20px; height: 25px; overflow: hidden; color: #d5c6ae; } .grid_detail_date { padding-left: 20px; height: 25px; overflow: hidden; color: #d5c6ae; } .grid_detail_like { padding-left: 20px; height: 25px; overflow: hidden; color: #d5c6ae; } .grid_detail_cate a, .grid_detail_user a, .grid_detail_cate2 a, .grid_detail_lang2 a, .grid_detail_user2 a { width: 140px; float: right; color: #ff8401; text-decoration: none; } .grid_detail_cate a:hover, .grid_detail_user a:hover, .grid_detail_cate2 a:hover, .grid_detail_lang2 a:hover, .grid_detail_user2 a:hover { text-decoration: none; } .grid_detail_copyright span, .grid_detail_date span, .grid_detail_type span, .grid_detail_like span { width: 140px; float: right; color: #322F31; } /*==========================================pager- phân trang==========================================================*/ .pagination { display: inline-block; padding-left: 0; margin: 30px 0; border-radius: 0px; float: right; width: 100%; background: #fff; height: 43px; max-width: 689px; border: 1px solid #dfdfdf; position: relative; display: inline-flex; } .pagination > li { display: inline; } .pagination > li > a, .pagination > li > span { position: relative; float: left; font-size: 15px; padding: 0px 10px; line-height: 43px; text-decoration: none; } .ul2 > li { display: inline-flex; } .ul2 > li > a, .ul2 > li > span { position: relative; padding: 10px 10px; font-size: 15px; text-decoration: none; } ul.ul2 { background: #fff; width: 100%; margin-right: 40px; margin-left: 10px; list-style: none; font-size: 15px; text-align: center; } .pagination > li:first-child > a, .pagination > li:first-child > span { /* border-right: 1px solid #dcdcdc; */ width: 15px; height: 43px; background: url('/Images/iconArrowLeft.gif') no-repeat center center; } .pagination > li:first-child > a:hover, .pagination > li:first-child > span:hover { /* border-right: 1px solid #dcdcdc; */ width: 15px; height: 43px; background: url('/Images/iconArrowLeft_on.gif') no-repeat center center; } /*==??==*/ .pagination > li:last-child > a, .pagination > li:last-child > span { /* border-left: 1px solid #dcdcdc; */ width: 15px; height: 43px; background: url('/Images/iconArrowRight.gif') no-repeat center center; position: absolute; right: 0px; } .pagination > li:last-child > a:hover, .pagination > li:last-child > span:hover { /* border-left: 1px solid #dcdcdc; */ width: 15px; height: 43px; background: url('/Images/iconArrowRight_on.gif') no-repeat center center; position: absolute; right: 0px; } /*===???==*/ .ul2 > li > a, .ul2 > li > span { color: #babcbc; background-color: #fff; border-color: #ddd; } .ul2 > li > a:hover, .ul2 > li > span:hover, .ul2 > li > a:focus, .ul2 > li > span:focus { color: #322F31f; background-color: #fff; border-color: #ddd; } .ul2 > .active > a, .ul2 > .active > span { z-index: 2; color: #ff8401; cursor: default; background-color: #fff; } .ul2 > .active > a:hover, .ul2 > .active > span:hover, .ul2 > .active > a:focus, .ul2 > .active > span:focus { z-index: 2; color: #ff8401; cursor: default; background-color: #fff; } .ul2 > .disabled > span, .ul2 > .disabled > a { color: #babcbc; cursor: not-allowed; background-color: #fff; } .ul2 > .disabled > span:hover, .ul2 > .disabled > span:focus, .ul2 > .disabled > a:hover, .ul2 > .disabled > a:focus { color: #322F31; cursor: not-allowed; background-color: #fff; } /*==???==*/ .pagination-lg > li > a, .pagination-lg > li > span { padding: 10px 16px; font-size: 15px; } .pagination-lg > li:first-child > a, .pagination-lg > li:first-child > span { border-top-left-radius: 6px; border-bottom-left-radius: 6px; } .pagination-lg > li:last-child > a, .pagination-lg > li:last-child > span { border-top-right-radius: 6px; border-bottom-right-radius: 6px; } .pagination-sm > li > a, .pagination-sm > li > span { padding: 5px 10px; font-size: 12px; } .pagination-sm > li:first-child > a, .pagination-sm > li:first-child > span { border-top-left-radius: 3px; border-bottom-left-radius: 3px; } .pagination-sm > li:last-child > a, .pagination-sm > li:last-child > span { border-top-right-radius: 3px; border-bottom-right-radius: 3px; } /*=================== Nút đăng đề tài ========================*/ .uploadbtn { height: 47px; border-radius: 0px; width: 300px; position: relative; background: #ff8401; display: block; } #uploadbtnlink { background: url("/Images/icm_upload2.png") no-repeat 10px 6px,url("/Images/bg_orange.jpg") repeat-x 0px 5px; color: #fff; float: left; height: 31px; width: 300px; padding-top: 15px; padding-left: 85px; text-decoration: none; font-size: 17px; border-radius: 0px; } #uploadbtnlink:hover { background: url("/Images/icm_upload2.png") no-repeat 10px 6px,url("/Images/uphv.png") no-repeat 0px 5px; } /*==============breadcrumbs=========*/ .breadcrumbs { height: 45px; width: 100%; background: #fff; border-bottom: 1px solid #eee; display: none; } ul.navigate-content { height: 45px; position: relative; display: inline-block; zoom: 1; padding: 0px 5px; width: 98%; overflow: hidden; margin-top: 0px; line-height: 45px; } ul.navigate-content li:first-child { background: none; padding-left: 0; } ul.navigate-content li { float: left; padding: 0 10px 0 30px; font-size: 111%; text-transform: uppercase; background: url("/Images/bull_navigation.png") no-repeat 10px 15px; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; position: relative; margin: 0px 0; line-height: 45px; overflow: hidden; font-family: arial, sans-serif; } ul.navigate-content li a { text-transform: uppercase; position: relative; color: #322F31; font-weight: 400; display: block; text-decoration: none; } ul.navigate-content li:hover a { color: #000; } ul.navigate-content li.active a { font-weight: bold; color: #474747; } /*DAng De Tai*/ .thumbnail { display: block; width: 150px; height: 200px; cursor: pointer; background-color: rgba(0,178,178,.7); } .thumbnail-icon { margin: 0 auto; } /*DSSV THAM GIA*/ ul.dssvtg { list-style: none; margin-left: 0px; padding-left: 0px; } a.btn.btn-primary.btn-sm.btn-flat { color: #f7922a; text-decoration: none; } a.btn.btn-primary.btn-sm.btn-flat:hover { color: #322F31; text-decoration: underline; } /*MENU BEN PHAI*/ .menubenphai { position: relative; float: right; z-index: 9999; text-align: center; font-size: 20px; color: #f7922a; min-height: 100%; display: block; right: 0; } ul.menubenphai { margin: 0; padding: 0; height: 100%; position: relative; } .menubenphai>ul { /* margin-top: 25px; */ padding: 0; margin: 0; height: 100%; /* display: block; */ } ul.menubenphai>li { display: inline-block; margin: 0 5px; height: 100%; } ul.menubenphai > li { /* display: none; */ margin: 0 5px; /* height: 60px; */ line-height: 60px; float: left; } li.userprofile img { width: 100px; height: 100px; position: relative; top: 15px; box-sizing: border-box; border-radius: 50%; text-align: center; border: 8px solid #DD770E; } li.userprofile h3 { /* float: right; */ text-decoration: none; /* margin: 0; */ margin-top: 0; } li.userprofile h2 { margin-bottom: 0; } input#dropdown-user:checked ~ .dropdown-menu { display: block; margin-top: -2px; padding-top: 0; } label[for="dropdown-user"] { cursor: pointer; } .ntk { /* position: absolute; */ /* width: 205px; */ /* right: 0px; */ z-index: 9999; /* display: none; */ } ul.dropdown-menu li.anhviet { margin-top: 5px; line-height: initial; } .anhviet a { text-decoration: none; color: #f7922a; padding: 5px 5px; } /*TIMKIEM*/ input { outline: none; } input[type=search] { -webkit-appearance: textfield; -webkit-box-sizing: content-box; font-family: inherit; font-size: 100%; } input::-webkit-search-decoration, input::-webkit-search-cancel-button { display: none; } input[type=search] { background: url('/Images/iconSearch.png') no-repeat 9px center; border: solid 1px transparent; padding: 9px 10px 9px 35px; width: 55px; -webkit-border-radius: 6px; -moz-border-radius: 6px; border-radius: 6px; -webkit-transition: all .5s; -moz-transition: all .5s; transition: all .5s; } input[type=search]:focus { width: 130px; border: 1px solid #f7922a; } input:-moz-placeholder { color: #babcbc; } input::-webkit-input-placeholder { color: #babcbc; } /* Demo 2 */ .menubenphai input[type=search] { width: 0px; color: transparent; cursor: pointer; position: absolute; right: -32px; top: 8px; /* margin-left: 30px; */ } .menubenphai input[type=search]:hover { background-color: #fff; } .menubenphai input[type=search]:focus { width: 250px; padding-right: 35px; color: #babcbc; background-color: #fff; cursor: auto; } .menubenphai input:-moz-placeholder { color: #babcbc; } .menubenphai input::-webkit-input-placeholder { color: #babcbc; } /*đăng nhập*/ #over { display: none; background: #000; position: fixed; left: 0; top: 0; width: 100%; height: 100%; opacity: 0.8; z-index: 999; } li.login { display: inline; } li.login a { display: inline; } .login .textdangnhap { font-size: 20px; padding-left: 130px; line-height: 50px; font-family: 'Open Sans', sans-serif; color: #f7922a; text-transform: uppercase; } .login .login_title { color: white; font-size: 16px; padding: 8px 0 5px 8px; text-align: left; } .login-content label { display: block; padding-bottom: 14px; } .login-content span { display: block; } .login-content .username span { padding-bottom: 7px; } .login-content .password span { padding-bottom: 7px; } .login-content { margin-left: 0px; margin-right: 0px; margin-bottom: 0px; margin-top: 5px; overflow: hidden; height: 180px; position: relative; } .login2 { margin: 0px 25px; overflow: hidden; } .img-close { float: right; margin-top: 10px; margin-right: 10px } .button { display: inline-block; width: 46px; text-align: center; color: #444; font-size: 14px; font-weight: bold; height: 36px; padding: 0px 8px; line-height: 36px; border-radius: 4px; transition: all 0.218s ease 0s; border: 1px solid #DCDCDC; background-color: #F5F5F5; background-image: -moz-linear-gradient(center top , #F5F5F5, #F1F1F1); cursor: pointer; margin-left: 120px !important; } .button:hover { border: 1px solid #DCDCDC; text-decoration: none; -moz-box-shadow: 0 1px 1px rgba(0,0,0,0.1); -webkit-box-shadow: 0 1px 1px rgba(0,0,0,0.1); box-shadow: 0 2px 2px rgba(0,0,0,0.1); } .login input { border: 1px solid #f4f4f4; color: black; height: 40px; padding: 0px 15px; word-spacing: 0.1em; width: 298px; font-size: 15px; margin: 5px 0px; } .submit-button { display: inline-block; padding: auto; margin: 15px 75px; width: 150px; } input.nutdn { position: absolute; bottom: 0px; left: 0px; margin: 0; padding: 0; width: 100%; background: #f7922a; height: 50px; border: none; color: #fff; font-size: 16px; cursor: pointer; } input.nutdn:hover { background: #f7822a } .login-content ul { list-style: none; margin: 0 auto; padding-left: 140px !important; } .login-content ul li { float: left; padding-right: 35px; } .login-content ul li a { text-decoration: none; color: #f7922a; } .login-content ul li a:hover { color: #322F31; } a.login-window { /* position: absolute; */ /* right: 0px; */ /* top: 3px; */ text-decoration: none; color: #f7922a; background: url('/Images/ic_account_circle_white_18dp.png') no-repeat 0px center; background-size: 19px; line-height: 30px; padding-left: 30px; font-size: 15px; } /*đăng nhập*/ td.action a { color: #fff; background: #f7922a; padding: 10px 40px; border-radius: 3px; text-decoration: none; font-weight: bold; margin-right: 20px; } td.action a:hover { background: #f75000; } input[type="button"] { width: 377px; background: #f7922a; padding: 0px; margin: 20px 0px; line-height: 40px; height: 40px; color: #fff; font-weight: bold; font-size: 14px; cursor: pointer; } li.lithoat { /* position: absolute; */ /* top: 10px; */ /* right: 0px; */ } .taikhoan { /* background: #9c0; */ position: relative; /* right: 0px; */ /* top: 0; */ color: #f7922a; margin-top: 3px; } .taikhoan a { text-decoration: none; color: #f7922a; font-size: 15px; line-height: 24px; } #liusername .username img { border-radius: 50%; width: 2em; height: 2em; position: relative; top: 11px; /* bottom: 30px; */ vertical-align: top; } #liusername .username strong { display: inline-block; vertical-align: middle; } .taikhoan ul { margin: 0; padding: 0; list-style: none; float: left; } .taikhoan ul li { /* display: inline-block; */ line-height: 30px; } #dropdown-messager:checked ~ .dropdown-menu { display: block; } ul.dropdown-menu.dropdown-menu-right li { border-bottom: 1px solid #fff; color: white; box-sizing: border-box; } .noactive h4, .noactive p { color: #333333; } .menu li.noactive { background-color: rgb(253, 239, 216); } ul.dropdown-menu { color: white; background-color: rgb(246, 162, 21); margin: 0; padding: 0; line-height: initial; } label[for="dropdown-messager"] { cursor: pointer; position: relative; display: block; color: #f7922a; } span#ms-count { border-radius: 50%; background-color: #5cb85c; position: absolute; top: 10px; font-size: 10px; font-weight: normal; width: 15px; height: 15px; line-height: 1em; text-align: center; padding: 2px; color: white; box-sizing: border-box; } .dssvtg ul li { list-style: none; } li.userprofile { list-style: none; /* margin-right: 20px; */ /* margin-top: 20px; */ /* float: left; */ text-align: center; background-color: #f7922a; } ul.dssvtg { list-style: none; padding-left: 0px; } ul.dssvtg li { display: inline-block; } td.tddssvbc { padding: 0; margin: 0; } tr.trdssvbc { /* background: #9c0; */ /* margin-top: -30px; */ /* display: block; */ } /*them moi*/ img.img-circle { border-radius: 50%; } input.btn.btn-default { border: 1px solid #f7922a; padding: 8px 30px; border-radius: 2px; cursor: pointer; background: #f7922a; color: #fff; font-weight: bold; } input.btn.btn-default:hover { background: #f7722a; color: #fff; } ul.list-group { list-style: none; margin-left: 0px; padding-left: 0px; /* background: #9c0; */ } li.panel.panel-default { background: #fff; border: 1px solid #eee; margin: 30px 0px; border-radius: 2px; } span.vote_td a { text-decoration: none; } header.panel-heading.clearfix { background: #f7f7f7; padding: 5px 0px; } .pull-left { float: left; padding: 5px 10px; } .pull-right { float: right; /* padding: 5px 20px; */ } .pull-right span strong { font-weight: normal; } section.panel-body { padding: 5px 20px; border-top: 1px solid #f4f4f4; } section.panel-body p { /* white-space: pre-wrap; */ word-wrap: break-word; } footer.panel-footer { background: #f7f7f7; padding: 5px 20px; } div#baocaowg { margin-top: 40px; } .pull-left strong { color: #322F31; font-weight: normal; } .hscn { padding: 20px 10px; } .dangdoanmoi legend { display: none; } .suadoanmoi fieldset,.dangdoanmoi fieldset { border: none; margin-top: 5px; margin: 0px; padding: 0px; overflow: hidden; } .suadoanmoi legend ,.dangdoanmoi legend { display: none; } img.img-thumbnail { border: 1px solid #f4f4f4; } .dangdoanmoi .editor-label,.suadoanmoi .editor-label { padding: 5px 0px; margin-top: 20px; color: #f7922a; font-weight: bold; font-size: 16px; text-transform: uppercase; } .dangdoanmoi .editor-field input,.suadoanmoi .editor-field input { /* background: #9c0; */ height: 25px; border: 1px solid #f4f4f4; width: 50%; } .dangdoanmoi input#Title,.suadoanmoi input#Title { width: 615px; padding: 5px 10px; border-radius: 2px; border: 1px solid #f4f4f4; } .dangdoanmoi img.img-thumbnail,.suadoanmoi img.img-thumbnail { border: 1px solid #f4f4f4; width: 180px; height: 145px; border-radius: 3px; } .dangdoanmoi input[type="submit"],.suadoanmoi input[type="submit"] { background: #f7922a; border: 1px solid #f7922a; color: #fff; padding: 10px 40px; border-radius: 3px; font-size: 15px; font-weight: bold; margin-top: 20px; cursor: pointer; } .dangdoanmoi input[type="submit"]:hover,.suadoanmoi input[type="submit"]:hover { background: #f7722a; } .dangdoanmoi textarea,.suadoanmoi textarea { border: 1px solid #f4f4f4; width: 615px; height: 100px; padding: 10px; font-size: 15px; border-radius: 2px; font-family: 'Open Sans', sans-serif; } .dangdoanmoi a { color: #f7922a; text-decoration: none; } .suadoanmoi a { color: #f7922a; text-decoration: none; } .hscn .display-label { color: #f7922a; margin: 5px 0px; font-weight: bold; } .hscn img.avatar.img-rounded { border-radius: 70px; } .clwbc { margin-left: -25px; margin-right: -25px; background: #f9f9f9; border-bottom: 1px solid #f0f0f0; border-top: 1px solid #f0f0f0; padding: 20px 25px; } .clwbc fieldset { border: none; padding: 0; margin: 0; } .clwbc textarea#Content { width: 620px; } .clwbc h3 { color: #f7922a; text-transform: uppercase; font-family: font_strong; font-size: 26px; font-weight: normal; } div#baocaowg h3 { color: #f7922a; text-transform: uppercase; font-family: font_strong; font-size: 26px; font-weight: normal; } .hsgvgv h3,.hshshs h3 { margin-top: -5px; color: #322F31; font-size: 18px; padding-left: 40px; line-height: 48px; font-weight: normal; background: url('/Images/ic_account_circle_white_18dp.png') no-repeat 0px center; background-size: 30px auto; text-transform: uppercase; border-bottom: 1px solid #f4f4f4; } .dangdoanmoi h3 { margin-top: -5px; color: #322F31; font-size: 18px; padding-left: 40px; line-height: 48px; font-weight: normal; background: url('/Images/ic_cloud_upload_grey600_24dp.png') no-repeat 0px center; background-size: 28px auto; text-transform: uppercase; border-bottom: 1px solid #f4f4f4; } .suadoanmoi h3 { margin-top: -5px; color: #322F31; font-size: 18px; padding-left: 40px; line-height: 48px; font-weight: normal; background: url('/Images/ic_mode_edit_grey600_36dp.png') no-repeat 0px center; background-size: 24px auto; text-transform: uppercase; border-bottom: 1px solid #f4f4f4; } footer.panel-footer a { text-decoration: none; color: #f7922a; /* background: url('/Images/ic_attachment_black_18dp.png') no-repeat 0px center; */ /* padding-left: 25px; */ } .ghtdkht { width: 600px; overflow: hidden; height: 20px; white-space: nowrap; text-overflow: ellipsis; color: #f7922a; } .trolaict:hover { background: #f7722a; } .trolaict { margin-top: -40px; background: #f7922a; width: 112px; height: 40px; line-height: 40px; padding: 0px 30px; border-radius: 2px; margin-left: 135px; color: #fff; } .trolaict a { color: #fff; font-weight: bold; font-size: 15px; display: inline; } a.username { display: block; height: 60px; position: relative; line-height: 60px; text-decoration: none; color: #f7922a; } li#liusername { float: left; position: relative; } a.halo { background: url('/images/logoff.png') no-repeat 0px 0px; width: 17px; background-size: 17px; /* line-height: 38px; */ /* margin-top: -10px !important; */ /* margin-left: 5px; */ /* text-indent: -9999px; */ display: inline-block; } .center-block { display: block; margin-right: auto; margin-left: auto; } .pull-right { float: right !important; } .btn-xacnhan a { padding: 0 20px 20px 0; } .pull-left { float: left !important; } .hide { display: none !important; } .show { display: block !important; } .invisible { visibility: hidden; } .text-hide { font: 0/0 a; color: transparent; text-shadow: none; background-color: transparent; border: 0; } .hidden { display: none; } .affix { position: fixed; } /*THONG BAO + TIN NHAN*/ .dropup, .dropdown { position: relative; } .dropdown-toggle:focus { outline: 0; } .dropdown-menu { position: absolute; top: 100%; left: 0; z-index: 1000; display: none; float: left; min-width: 160px; padding: 5px 0; margin: 2px 0 0; font-size: 14px; text-align: left; list-style: none; background-color: #fff; -webkit-background-clip: padding-box; background-clip: padding-box; /* border: 1px solid #ccc; */ /* border: 1px solid rgba(0, 0, 0, .15); */ /* border-radius: 4px; */ -webkit-box-shadow: 0 6px 12px rgba(0, 0, 0, .175); box-shadow: 0 6px 12px rgba(0, 0, 0, .175); } .dropdown-menu:after { bottom: 100%; right: 10px; border: solid transparent; content: " "; height: 0; width: 0; position: absolute; pointer-events: none; border-color: rgba(255, 255, 255, 0); border-bottom-color: rgb(247, 146, 42); border-width: 10px; margin-left: -10px; } #liusername .dropdown-menu:after { right: 20%; } #messager .dropdown-menu:after { right: 2px; } .dropdown-menu.pull-right { right: 0; left: auto; } .dropdown-menu .divider { height: 1px; margin: 9px 0; overflow: hidden; background-color: #e5e5e5; } .dropdown-menu > li > a { display: block; padding: 3px 20px; clear: both; font-weight: normal; line-height: 1.42857143; color: #333; white-space: nowrap; position: relative; text-decoration: none; } .userprofile h2, .userprofile h3 { color: #ddd; } li.anhviet a { display: inline; clear: none; } a.anh { float: right; } a.viet { float: left; /* width: 50%; */ } a.viet img { /* width: 100%; */ /* height: 100%; */ } .dropdown-menu > li > a:hover, .dropdown-menu > li > a:focus { color: #262626; text-decoration: none; /* background-color: #f5f5f5; */ } .dropdown-menu > li.profile > a:hover, .dropdown-menu > li.profile > a:focus { background-color: transparent; } .dropdown-menu > .active > a, .dropdown-menu > .active > a:hover, .dropdown-menu > .active > a:focus { color: #fff; text-decoration: none; background-color: #337ab7; outline: 0; } .dropdown-menu > .disabled > a, .dropdown-menu > .disabled > a:hover, .dropdown-menu > .disabled > a:focus { color: #777; } .dropdown-menu > .disabled > a:hover, .dropdown-menu > .disabled > a:focus { text-decoration: none; cursor: not-allowed; background-color: transparent; background-image: none; filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); } .open > .dropdown-menu { display: block; } .open > a { outline: 0; } .dropdown-menu-right { right: 0; left: auto; } .dropdown-menu-left { right: auto; left: 0; } .dropdown-header { display: block; padding: 3px 20px; font-size: 12px; line-height: 1.42857143; color: #777; white-space: nowrap; } .dropdown-backdrop { position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 990; } .pull-right > .dropdown-menu { right: 0; left: auto; } .dropup .caret, .navbar-fixed-bottom .dropdown .caret { content: ""; border-top: 0; border-bottom: 4px solid; } .dropup .dropdown-menu, .navbar-fixed-bottom .dropdown .dropdown-menu { top: auto; bottom: 100%; margin-bottom: 2px; } @media (min-width: 768px) { .navbar-right .dropdown-menu { right: 0; left: auto; } .navbar-right .dropdown-menu-left { right: auto; left: 0; } } @font-face { font-family: 'Glyphicons Halflings'; src: url('../fonts/glyphicons-halflings-regular.eot'); src: url('../fonts/glyphicons-halflings-regular.eot?#iefix') format('embedded-opentype'), url('../fonts/glyphicons-halflings-regular.woff2') format('woff2'), url('../fonts/glyphicons-halflings-regular.woff') format('woff'), url('../fonts/glyphicons-halflings-regular.ttf') format('truetype'), url('../fonts/glyphicons-halflings-regular.svg#glyphicons_halflingsregular') format('svg'); } .glyphicon { position: relative; top: 1px; display: inline-block; font-family: 'Glyphicons Halflings'; font-style: normal; font-weight: normal; line-height: 1; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; } span.glyphicon.glyphicon-time { margin-right: 3px; } #liusername span.glyphicon { color: white; } .thoat span.glyphicon { font-size: x-large; top: 0; } .thoat { text-align: center; } .thoat { } .glyphicon-asterisk:before { content: "\2a"; } .glyphicon-plus:before { content: "\2b"; } .glyphicon-euro:before, .glyphicon-eur:before { content: "\20ac"; } .glyphicon-minus:before { content: "\2212"; } .glyphicon-cloud:before { content: "\2601"; } .glyphicon-envelope:before { content: "\2709"; } .glyphicon-pencil:before { content: "\270f"; } .glyphicon-glass:before { content: "\e001"; } .glyphicon-music:before { content: "\e002"; } .glyphicon-search:before { content: "\e003"; } .glyphicon-heart:before { content: "\e005"; } .glyphicon-star:before { content: "\e006"; } .glyphicon-star-empty:before { content: "\e007"; } .glyphicon-user:before { content: "\e008"; } .glyphicon-film:before { content: "\e009"; } .glyphicon-th-large:before { content: "\e010"; } .glyphicon-th:before { content: "\e011"; } .glyphicon-th-list:before { content: "\e012"; } .glyphicon-ok:before { content: "\e013"; } .glyphicon-remove:before { content: "\e014"; } .glyphicon-zoom-in:before { content: "\e015"; } .glyphicon-zoom-out:before { content: "\e016"; } .glyphicon-off:before { content: "\e017"; } .glyphicon-signal:before { content: "\e018"; } .glyphicon-cog:before { content: "\e019"; } .glyphicon-trash:before { content: "\e020"; } .glyphicon-home:before { content: "\e021"; } .glyphicon-file:before { content: "\e022"; } .glyphicon-time:before { content: "\e023"; } .glyphicon-road:before { content: "\e024"; } .glyphicon-download-alt:before { content: "\e025"; } .glyphicon-download:before { content: "\e026"; } .glyphicon-upload:before { content: "\e027"; } .glyphicon-inbox:before { content: "\e028"; } .glyphicon-play-circle:before { content: "\e029"; } .glyphicon-repeat:before { content: "\e030"; } .glyphicon-refresh:before { content: "\e031"; } .glyphicon-list-alt:before { content: "\e032"; } .glyphicon-lock:before { content: "\e033"; } .glyphicon-flag:before { content: "\e034"; } .glyphicon-headphones:before { content: "\e035"; } .glyphicon-volume-off:before { content: "\e036"; } .glyphicon-volume-down:before { content: "\e037"; } .glyphicon-volume-up:before { content: "\e038"; } .glyphicon-qrcode:before { content: "\e039"; } .glyphicon-barcode:before { content: "\e040"; } .glyphicon-tag:before { content: "\e041"; } .glyphicon-tags:before { content: "\e042"; } .glyphicon-book:before { content: "\e043"; } .glyphicon-bookmark:before { content: "\e044"; } .glyphicon-print:before { content: "\e045"; } .glyphicon-camera:before { content: "\e046"; } .glyphicon-font:before { content: "\e047"; } .glyphicon-bold:before { content: "\e048"; } .glyphicon-italic:before { content: "\e049"; } .glyphicon-text-height:before { content: "\e050"; } .glyphicon-text-width:before { content: "\e051"; } .glyphicon-align-left:before { content: "\e052"; } .glyphicon-align-center:before { content: "\e053"; } .glyphicon-align-right:before { content: "\e054"; } .glyphicon-align-justify:before { content: "\e055"; } .glyphicon-list:before { content: "\e056"; } .glyphicon-indent-left:before { content: "\e057"; } .glyphicon-indent-right:before { content: "\e058"; } .glyphicon-facetime-video:before { content: "\e059"; } .glyphicon-picture:before { content: "\e060"; } .glyphicon-map-marker:before { content: "\e062"; } .glyphicon-adjust:before { content: "\e063"; } .glyphicon-tint:before { content: "\e064"; } .glyphicon-edit:before { content: "\e065"; } .glyphicon-share:before { content: "\e066"; } .glyphicon-check:before { content: "\e067"; } .glyphicon-move:before { content: "\e068"; } .glyphicon-step-backward:before { content: "\e069"; } .glyphicon-fast-backward:before { content: "\e070"; } .glyphicon-backward:before { content: "\e071"; } .glyphicon-play:before { content: "\e072"; } .glyphicon-pause:before { content: "\e073"; } .glyphicon-stop:before { content: "\e074"; } .glyphicon-forward:before { content: "\e075"; } .glyphicon-fast-forward:before { content: "\e076"; } .glyphicon-step-forward:before { content: "\e077"; } .glyphicon-eject:before { content: "\e078"; } .glyphicon-chevron-left:before { content: "\e079"; } .glyphicon-chevron-right:before { content: "\e080"; } .glyphicon-plus-sign:before { content: "\e081"; } .glyphicon-minus-sign:before { content: "\e082"; } .glyphicon-remove-sign:before { content: "\e083"; } .glyphicon-ok-sign:before { content: "\e084"; } .glyphicon-question-sign:before { content: "\e085"; } .glyphicon-info-sign:before { content: "\e086"; } .glyphicon-screenshot:before { content: "\e087"; } .glyphicon-remove-circle:before { content: "\e088"; } .glyphicon-ok-circle:before { content: "\e089"; } .glyphicon-ban-circle:before { content: "\e090"; } .glyphicon-arrow-left:before { content: "\e091"; } .glyphicon-arrow-right:before { content: "\e092"; } .glyphicon-arrow-up:before { content: "\e093"; } .glyphicon-arrow-down:before { content: "\e094"; } .glyphicon-share-alt:before { content: "\e095"; } .glyphicon-resize-full:before { content: "\e096"; } .glyphicon-resize-small:before { content: "\e097"; } .glyphicon-exclamation-sign:before { content: "\e101"; } .glyphicon-gift:before { content: "\e102"; } .glyphicon-leaf:before { content: "\e103"; } .glyphicon-fire:before { content: "\e104"; } .glyphicon-eye-open:before { content: "\e105"; } .glyphicon-eye-close:before { content: "\e106"; } .glyphicon-warning-sign:before { content: "\e107"; } .glyphicon-plane:before { content: "\e108"; } .glyphicon-calendar:before { content: "\e109"; } .glyphicon-random:before { content: "\e110"; } .glyphicon-comment:before { content: "\e111"; } .glyphicon-magnet:before { content: "\e112"; } .glyphicon-chevron-up:before { content: "\e113"; } .glyphicon-chevron-down:before { content: "\e114"; } .glyphicon-retweet:before { content: "\e115"; } .glyphicon-shopping-cart:before { content: "\e116"; } .glyphicon-folder-close:before { content: "\e117"; } .glyphicon-folder-open:before { content: "\e118"; } .glyphicon-resize-vertical:before { content: "\e119"; } .glyphicon-resize-horizontal:before { content: "\e120"; } .glyphicon-hdd:before { content: "\e121"; } .glyphicon-bullhorn:before { content: "\e122"; } .glyphicon-bell:before { content: "\e123"; } .glyphicon-certificate:before { content: "\e124"; } .glyphicon-thumbs-up:before { content: "\e125"; } .glyphicon-thumbs-down:before { content: "\e126"; } .glyphicon-hand-right:before { content: "\e127"; } .glyphicon-hand-left:before { content: "\e128"; } .glyphicon-hand-up:before { content: "\e129"; } .glyphicon-hand-down:before { content: "\e130"; } .glyphicon-circle-arrow-right:before { content: "\e131"; } .glyphicon-circle-arrow-left:before { content: "\e132"; } .glyphicon-circle-arrow-up:before { content: "\e133"; } .glyphicon-circle-arrow-down:before { content: "\e134"; } .glyphicon-globe:before { content: "\e135"; } .glyphicon-wrench:before { content: "\e136"; } .glyphicon-tasks:before { content: "\e137"; } .glyphicon-filter:before { content: "\e138"; } .glyphicon-briefcase:before { content: "\e139"; } .glyphicon-fullscreen:before { content: "\e140"; } .glyphicon-dashboard:before { content: "\e141"; } .glyphicon-paperclip:before { content: "\e142"; } .glyphicon-heart-empty:before { content: "\e143"; } .glyphicon-link:before { content: "\e144"; } .glyphicon-phone:before { content: "\e145"; } .glyphicon-pushpin:before { content: "\e146"; } .glyphicon-usd:before { content: "\e148"; } .glyphicon-gbp:before { content: "\e149"; } .glyphicon-sort:before { content: "\e150"; } .glyphicon-sort-by-alphabet:before { content: "\e151"; } .glyphicon-sort-by-alphabet-alt:before { content: "\e152"; } .glyphicon-sort-by-order:before { content: "\e153"; } .glyphicon-sort-by-order-alt:before { content: "\e154"; } .glyphicon-sort-by-attributes:before { content: "\e155"; } .glyphicon-sort-by-attributes-alt:before { content: "\e156"; } .glyphicon-unchecked:before { content: "\e157"; } .glyphicon-expand:before { content: "\e158"; } .glyphicon-collapse-down:before { content: "\e159"; } .glyphicon-collapse-up:before { content: "\e160"; } .glyphicon-log-in:before { content: "\e161"; } .glyphicon-flash:before { content: "\e162"; } .glyphicon-log-out:before { content: "\e163"; } .glyphicon-new-window:before { content: "\e164"; } .glyphicon-record:before { content: "\e165"; } .glyphicon-save:before { content: "\e166"; } .glyphicon-open:before { content: "\e167"; } .glyphicon-saved:before { content: "\e168"; } .glyphicon-import:before { content: "\e169"; } .glyphicon-export:before { content: "\e170"; } .glyphicon-send:before { content: "\e171"; } .glyphicon-floppy-disk:before { content: "\e172"; } .glyphicon-floppy-saved:before { content: "\e173"; } .glyphicon-floppy-remove:before { content: "\e174"; } .glyphicon-floppy-save:before { content: "\e175"; } .glyphicon-floppy-open:before { content: "\e176"; } .glyphicon-credit-card:before { content: "\e177"; } .glyphicon-transfer:before { content: "\e178"; } .glyphicon-cutlery:before { content: "\e179"; } .glyphicon-header:before { content: "\e180"; } .glyphicon-compressed:before { content: "\e181"; } .glyphicon-earphone:before { content: "\e182"; } .glyphicon-phone-alt:before { content: "\e183"; } .glyphicon-tower:before { content: "\e184"; } .glyphicon-stats:before { content: "\e185"; } .glyphicon-sd-video:before { content: "\e186"; } .glyphicon-hd-video:before { content: "\e187"; } .glyphicon-subtitles:before { content: "\e188"; } .glyphicon-sound-stereo:before { content: "\e189"; } .glyphicon-sound-dolby:before { content: "\e190"; } .glyphicon-sound-5-1:before { content: "\e191"; } .glyphicon-sound-6-1:before { content: "\e192"; } .glyphicon-sound-7-1:before { content: "\e193"; } .glyphicon-copyright-mark:before { content: "\e194"; } .glyphicon-registration-mark:before { content: "\e195"; } .glyphicon-cloud-download:before { content: "\e197"; } .glyphicon-cloud-upload:before { content: "\e198"; } .glyphicon-tree-conifer:before { content: "\e199"; } .glyphicon-tree-deciduous:before { content: "\e200"; } .glyphicon-cd:before { content: "\e201"; } .glyphicon-save-file:before { content: "\e202"; } .glyphicon-open-file:before { content: "\e203"; } .glyphicon-level-up:before { content: "\e204"; } .glyphicon-copy:before { content: "\e205"; } .glyphicon-paste:before { content: "\e206"; } .glyphicon-alert:before { content: "\e209"; } .glyphicon-equalizer:before { content: "\e210"; } .glyphicon-king:before { content: "\e211"; } .glyphicon-queen:before { content: "\e212"; } .glyphicon-pawn:before { content: "\e213"; } .glyphicon-bishop:before { content: "\e214"; } .glyphicon-knight:before { content: "\e215"; } .glyphicon-baby-formula:before { content: "\e216"; } .glyphicon-tent:before { content: "\26fa"; } .glyphicon-blackboard:before { content: "\e218"; } .glyphicon-bed:before { content: "\e219"; } .glyphicon-apple:before { content: "\f8ff"; } .glyphicon-erase:before { content: "\e221"; } .glyphicon-hourglass:before { content: "\231b"; } .glyphicon-lamp:before { content: "\e223"; } .glyphicon-duplicate:before { content: "\e224"; } .glyphicon-piggy-bank:before { content: "\e225"; } .glyphicon-scissors:before { content: "\e226"; } .glyphicon-bitcoin:before { content: "\e227"; } .glyphicon-btc:before { content: "\e227"; } .glyphicon-xbt:before { content: "\e227"; } .glyphicon-yen:before { content: "\00a5"; } .glyphicon-jpy:before { content: "\00a5"; } .glyphicon-ruble:before { content: "\20bd"; } .glyphicon-rub:before { content: "\20bd"; } .glyphicon-scale:before { content: "\e230"; } .glyphicon-ice-lolly:before { content: "\e231"; } .glyphicon-ice-lolly-tasted:before { content: "\e232"; } .glyphicon-education:before { content: "\e233"; } .glyphicon-option-horizontal:before { content: "\e234"; } .glyphicon-option-vertical:before { content: "\e235"; } .glyphicon-menu-hamburger:before { content: "\e236"; } .glyphicon-modal-window:before { content: "\e237"; } .glyphicon-oil:before { content: "\e238"; } .glyphicon-grain:before { content: "\e239"; } .glyphicon-sunglasses:before { content: "\e240"; } .glyphicon-text-size:before { content: "\e241"; } .glyphicon-text-color:before { content: "\e242"; } .glyphicon-text-background:before { content: "\e243"; } .glyphicon-object-align-top:before { content: "\e244"; } .glyphicon-object-align-bottom:before { content: "\e245"; } .glyphicon-object-align-horizontal:before { content: "\e246"; } .glyphicon-object-align-left:before { content: "\e247"; } .glyphicon-object-align-vertical:before { content: "\e248"; } .glyphicon-object-align-right:before { content: "\e249"; } .glyphicon-triangle-right:before { content: "\e250"; } .glyphicon-triangle-left:before { content: "\e251"; } .glyphicon-triangle-bottom:before { content: "\e252"; } .glyphicon-triangle-top:before { content: "\e253"; } .glyphicon-console:before { content: "\e254"; } .glyphicon-superscript:before { content: "\e255"; } .glyphicon-subscript:before { content: "\e256"; } .glyphicon-menu-left:before { content: "\e257"; } .glyphicon-menu-right:before { content: "\e258"; } .glyphicon-menu-down:before { content: "\e259"; } .glyphicon-menu-up:before { content: "\e260"; }
ltlam93/UNETI.FIT
UNETI.FIT/Content/Main.css
CSS
gpl-2.0
69,740
16.678336
388
0.607838
false
/* * Copyright (C) 2014-2017 StormCore * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2 of the License, or (at your * option) any later version. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along * with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef TRINITYCORE_TOTEM_H #define TRINITYCORE_TOTEM_H #include "TemporarySummon.h" enum TotemType { TOTEM_PASSIVE = 0, TOTEM_ACTIVE = 1, TOTEM_STATUE = 2 // copied straight from MaNGOS, may need more implementation to work }; class TC_GAME_API Totem : public Minion { public: Totem(SummonPropertiesEntry const* properties, Unit* owner); virtual ~Totem() { } void Update(uint32 time) override; void InitStats(uint32 duration) override; void InitSummon() override; void UnSummon(uint32 msTime = 0) override; uint32 GetSpell(uint8 slot = 0) const { return m_spells[slot]; } uint32 GetTotemDuration() const { return m_duration; } void SetTotemDuration(uint32 duration) { m_duration = duration; } TotemType GetTotemType() const { return m_type; } bool UpdateStats(Stats /*stat*/) override { return true; } bool UpdateAllStats() override { return true; } void UpdateResistances(uint32 /*school*/) override { } void UpdateArmor() override { } void UpdateMaxHealth() override { } void UpdateMaxPower(Powers /*power*/) override { } void UpdateAttackPowerAndDamage(bool /*ranged*/) override { } void UpdateDamagePhysical(WeaponAttackType /*attType*/) override { } bool IsImmunedToSpellEffect(SpellInfo const* spellInfo, uint32 index) const override; protected: TotemType m_type; uint32 m_duration; }; #endif
Ragebones/StormCore
src/server/game/Entities/Totem/Totem.h
C
gpl-2.0
2,197
36.237288
93
0.685025
false
#!/usr/bin/perl -w # # This script generates a C header file that maps the target device (as # indicated via the sdcc generated -Dpic18fxxx macro) to its device # family and the device families to their respective style of ADC and # USART programming for use in the SDCC PIC16 I/O library. # # Copyright 2010 Raphael Neider <rneider AT web.de> # # This file is part of SDCC. # # SDCC is free software: you can redistribute it and/or modify it under # the terms of the GNU General Public License as published by the Free # Software Foundation, either version 2 of the License, or (at your # option) any later version. # # SDCC is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License # for more details. # # You should have received a copy of the GNU General Public License # along with SDCC. If not, see <http://www.gnu.org/licenses/>. # # # Usage: perl pic18fam-h-gen.pl # # This will create pic18fam.h.gen in your current directory. # Check sanity of the file and move it to .../include/pic16/pic18fam.h. # If you assigned new I/O styles, implement them in # .../include/pic16/{adc,i2c,usart}.h and # .../lib/pic16/libio/*/*.c # use strict; my $head = '__SDCC_PIC'; my %families = (); my %adc = (); my %usart = (); my $update = "Please update your pic16/pic18fam.h manually and/or inform the maintainer."; while (<DATA>) { chomp; s/\s*#.*$//; # remove comments s/\s*//g; # strip whitespace next if (/^\s*$/); # ignore empty lines my $line = $_; my @fields = split(/:/, $line); die "Invalid record >$line<" if (4 != scalar @fields); my ($id, $memberlist, $adcstyle, $usartstyle) = @fields; # extract numeric family id $id = 0+$id; # extract family members my @arr = split(/,/, $memberlist); @arr = sort(map { uc($_); } @arr); $families{$id} = \@arr; # ADC style per device family $adcstyle = 0+$adcstyle; if (not defined $adc{$adcstyle}) { $adc{$adcstyle} = []; } # if push @{$adc{$adcstyle}}, $id; # (E)USART style per device family $usartstyle = 0+$usartstyle; if (not defined $usart{$usartstyle}) { $usart{$usartstyle} = []; } # if push @{$usart{$usartstyle}}, $id; } my $fname = "pic18fam.h.gen"; open(FH, ">", "$fname") or die "Could not open >$fname<"; print FH <<EOT /* * pic18fam.h - PIC16 families * * This file is has been generated using $0 . */ #ifndef __SDCC_PIC18FAM_H__ #define __SDCC_PIC18FAM_H__ 1 /* * Define device families. */ #undef __SDCC_PIC16_FAMILY EOT ; my $pp = "#if "; for my $id (sort keys %families) { my $list = $families{$id}; my $memb = "defined($head" . join(") \\\n || defined($head", @$list) . ")"; print FH <<EOT ${pp} ${memb} #define __SDCC_PIC16_FAMILY ${id} EOT ; $pp = "#elif "; } # for print FH <<EOT #else #warning No family associated with the target device. ${update} #endif /* * Define ADC style per device family. */ #undef __SDCC_ADC_STYLE EOT ; $pp = "#if "; for my $s (sort keys %adc) { my $fams = join (" \\\n || ", map { "(__SDCC_PIC16_FAMILY == $_)" } sort @{$adc{$s}}); print FH <<EOT ${pp} ${fams} #define __SDCC_ADC_STYLE ${s} EOT ; $pp = "#elif "; } # for print FH <<EOT #else #warning No ADC style associated with the target device. ${update} #endif /* * Define (E)USART style per device family. */ #undef __SDCC_USART_STYLE EOT ; $pp = "#if "; for my $s (sort keys %usart) { my $fams = join (" \\\n || ", map { "(__SDCC_PIC16_FAMILY == $_)" } sort @{$usart{$s}}); print FH <<EOT ${pp} ${fams} #define __SDCC_USART_STYLE ${s} EOT ; $pp = "#elif "; } # for print FH <<EOT #else #warning No (E)USART style associated with the target device. ${update} #endif EOT ; print FH <<EOT #endif /* !__SDCC_PIC18FAM_H__ */ EOT ; __END__ # # <id>:<head>{,<member>}:<adc>:<usart> # # Each line provides a colon separated list of # * a numeric family name, derived from the first family member as follows: # - 18F<num> -> printf("18%04d0", <num>) # - 18F<num1>J<num2> -> printf("18%02d%02d1", <num1>, <num2>) # - 18F<num1>K<num2> -> printf("18%02d%02d2", <num1>, <num2>) # * a comma-separated list of members of a device family, # where a family comprises all devices that share a single data sheet, # * the ADC style (numeric family name or 0, if not applicable) # * the USART style (numeric family name or 0, if not applicable) # # This data has been gathered manually from data sheets published by # Microchip Technology Inc. # 1812200:18f1220,18f1320:1812200:1812200 1812300:18f1230,18f1330:1812300:1812300 1813502:18f13k50,18f14k50:1813502:1813502 1822200:18f2220,18f2320,18f4220,18f4320:1822200:1822200 1822210:18f2221,18f2321,18f4221,18f4321:1822200:1822210 1823310:18f2331,18f2431,18f4331,18f4431:0:1822210 1823202:18f23k20,18f24k20,18f25k20,18f26k20,18f43k20,18f44k20,18f45k20,18f46k20:1822200:1822210 1823222:18f23k22,18f24k22,18f25k22,18f26k22,18f43k22,18f44k22,18f45k22,18f46k22:1823222:1822210 1824100:18f2410,18f2510,18f2515,18f2610,18f4410,18f4510,18f4515,18f4610:1822200:1822210 1802420:18f242,18f252,18f442,18f452:1802420:1822200 # TODO: verify family members and USART 1824200:18f2420,18f2520,18f4420,18f4520:1822200:1822210 1824230:18f2423,18f2523,18f4423,18f4523:1822200:1822210 1824500:18f2450,18f4450:1822200:1824500 1824550:18f2455,18f2550,18f4455,18f4550:1822200:1822210 1802480:18f248,18f258,18f448,18f458:1802420:1822200 # TODO: verify family members and USART 1824800:18f2480,18f2580,18f4480,18f4580:1822200:1824500 1824101:18f24j10,18f25j10,18f44j10,18f45j10:1822200:1822210 1824501:18f24j50,18f25j50,18f26j50,18f44j50,18f45j50,18f46j50:1824501:1824501 1825250:18f2525,18f2620,18f4525,18f4620:1822200:1822210 1825850:18f2585,18f2680,18f4585,18f4680:1822200:1824500 1826820:18f2682,18f2685,18f4682,18f4685:1822200:1824500 1865200:18f6520,18f6620,18f6720,18f8520,18f8620,18f8720:1822200:1865200 1865270:18f6527,18f6622,18f6627,18f6722,18f8527,18f8622,18f8627,18f8722:1822200:1824501 1865850:18f6585,18f6680,18f8585,18f8680:1822200:1822200 # TODO: verify family members and USART 1865501:18f65j50,18f66j50,18f66j55,18f67j50,18f85j50,18f86j50,18f86j55,18f87j50:1865501:1824501 1866601:18f66j60,18f66j65,18f67j60,18f86j60,18f86j65,18f87j60,18f96j60,18f96j65,18f97j60:1822200:1824501
atsidaev/sdcc-z80-gas
support/scripts/pic18fam-h-gen.pl
Perl
gpl-2.0
6,558
29.64486
119
0.67917
false
<?php /** * ifeelweb.de WordPress Plugin Framework * For more information see http://www.ifeelweb.de/wp-plugin-framework * * Adapter to use ZendFramework as admin application * * @author Timo Reith <timo@ifeelweb.de> * @copyright Copyright (c) ifeelweb.de * @version $Id: ZendFw.php 911603 2014-05-10 10:58:23Z worschtebrot $ * @package IfwPsn_Wp_Plugin_Application */ require_once dirname(__FILE__) . '/Interface.php'; class IfwPsn_Wp_Plugin_Application_Adapter_ZendFw implements IfwPsn_Wp_Plugin_Application_Adapter_Interface { /** * @var IfwPsn_Wp_Plugin_Manager */ protected $_pm; /** * @var IfwPsn_Zend_Application */ protected $_application; /** * @var string */ protected $_output; /** * The default error reporting level * @var int */ protected $_errorReporting; /** * @param IfwPsn_Wp_Plugin_Manager $pm */ public function __construct (IfwPsn_Wp_Plugin_Manager $pm) { $this->_pm = $pm; } /** * Loads the admin application */ public function load() { $this->_registerAutostart(); require_once $this->_pm->getPathinfo()->getRootLib() . 'IfwPsn/Zend/Application.php'; $this->_application = new IfwPsn_Zend_Application($this->_pm->getEnv()->getEnvironmet()); // set the dynamic options from php config file $this->_application->setOptions($this->_getApplicationOptions()); // run the application bootstrap $this->_pm->getLogger()->logPrefixed('Bootstrapping application...'); $this->_application->bootstrap(); } /** * */ protected function _registerAutostart() { require_once $this->_pm->getPathinfo()->getRootLib() . 'IfwPsn/Wp/Plugin/Application/Adapter/ZendFw/Autostart/EnqueueScripts.php'; require_once $this->_pm->getPathinfo()->getRootLib() . 'IfwPsn/Wp/Plugin/Application/Adapter/ZendFw/Autostart/StripSlashes.php'; require_once $this->_pm->getPathinfo()->getRootLib() . 'IfwPsn/Wp/Plugin/Application/Adapter/ZendFw/Autostart/ZendFormTranslation.php'; $result = array( new IfwPsn_Wp_Plugin_Application_Adapter_ZendFw_Autostart_EnqueueScripts($this), new IfwPsn_Wp_Plugin_Application_Adapter_ZendFw_Autostart_StripSlashes($this), new IfwPsn_Wp_Plugin_Application_Adapter_ZendFw_Autostart_ZendFormTranslation($this), ); foreach($result as $autostart) { $autostart->execute(); } } /** * Retrieves the application options * @return array */ protected function _getApplicationOptions() { $options = include $this->_pm->getPathinfo()->getRootAdminMenu() . 'configs/application.php'; if ($this->_pm->getEnv()->getEnvironmet() == 'development') { $options['resources']['FrontController']['params']['displayExceptions'] = 1; $options['phpSettings']['error_reporting'] = 6143; // E_ALL & ~E_STRICT $options['phpSettings']['display_errors'] = 1; $options['phpSettings']['display_startup_errors'] = 1; } return $options; } /** * @param $controllerName * @param string $module */ public function overwriteController($controllerName, $module = 'default') { $front = IfwPsn_Zend_Controller_Front::getInstance(); $request = new IfwPsn_Vendor_Zend_Controller_Request_Http(); $request->setParam('controller', $controllerName); $request->setParam('mod', $module); $front->setRequest($request); } /** * Inits the controller */ public function init() { $this->_activateErrorReporting(); try { // init the controller object to add actions before load-{page-id} action $this->_application->initController(); } catch (Exception $e) { $this->_handleException($e); } $this->_deactivateErrorReporting(); } /** * @return mixed|void */ public function render() { $this->_activateErrorReporting(); try { $this->_output = $this->_application->run(); } catch (Exception $e) { $this->_handleException($e); } $this->_deactivateErrorReporting(); } /** * @return mixed|void */ public function display() { $this->_activateErrorReporting(); try { echo $this->_output; } catch (Exception $e) { $this->_handleException($e); } $this->_deactivateErrorReporting(); } /** * Activates the error reporting in dev mode */ protected function _activateErrorReporting() { // store the default error level $this->_errorReporting = error_reporting(); if ($this->_pm->getEnv()->getEnvironmet() == 'development' || $this->_pm->getConfig()->debug->show_errors == '1') { // E_ALL & ~E_STRICT error_reporting(6143); } } /** * Resets the error reporting to default in dev mode */ protected function _deactivateErrorReporting() { if ($this->_pm->getEnv()->getEnvironmet() == 'development' || $this->_pm->getConfig()->debug->show_errors == '1') { error_reporting($this->_errorReporting); } } /** * @param Exception $e */ protected function _handleException(Exception $e) { $this->_pm->getLogger()->error($e->getMessage()); $request = IfwPsn_Zend_Controller_Front::getInstance()->getRequest(); // Repoint the request to the default error handler // $request->setModuleName('default'); // $request->setControllerName('Psn-ewrror'); // $request->setActionName('error'); // Set up the error handler $error = new IfwPsn_Vendor_Zend_Controller_Plugin_ErrorHandler(array( 'controller' => $this->_pm->getAbbrLower() . '-error' )); $error->type = IfwPsn_Vendor_Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_CONTROLLER; $error->request = clone($request); $error->exception = $e; $request->setParam('error_handler', $error); } /** * @return IfwPsn_Wp_Plugin_Manager */ public function getPluginManager() { return $this->_pm; } }
brasadesign/wpecotemporadas
wp-content/plugins/post-status-notifier-lite/lib/IfwPsn/Wp/Plugin/Application/Adapter/ZendFw.php
PHP
gpl-2.0
6,435
27.6
143
0.587102
false
#ifndef _FFNet_Pattern_h_ #define _FFNet_Pattern_h_ /* FFNet_Pattern.h * * Copyright (C) 1997-2011, 2015 David Weenink * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or (at * your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* djmw 19950113 djmw 20020712 GPL header djmw 20110307 Latest modification */ #include "Pattern.h" #include "FFNet.h" void FFNet_Pattern_drawActivation( FFNet me, Pattern pattern, Graphics g, long ipattern ); #endif /* _FFNet_Pattern_h_ */
motiz88/praat
FFNet/FFNet_Pattern.h
C
gpl-2.0
1,073
31.515152
90
0.738117
false
/*************************************************************************** * Project TUPITUBE DESK * * Project Contact: info@maefloresta.com * * Project Website: http://www.maefloresta.com * * Project Leader: Gustav Gonzalez <info@maefloresta.com> * * * * Developers: * * 2010: * * Gustavo Gonzalez / xtingray * * * * KTooN's versions: * * * * 2006: * * David Cuadrado * * Jorge Cuadrado * * 2003: * * Fernado Roldan * * Simena Dinas * * * * Copyright (C) 2010 Gustav Gonzalez - http://www.maefloresta.com * * License: * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program. If not, see <http://www.gnu.org/licenses/>. * ***************************************************************************/ #ifndef TUPSOUNDPLAYER_H #define TUPSOUNDPLAYER_H #include "tglobal.h" #include "timagebutton.h" #include "tapplicationproperties.h" #include "tuplibraryobject.h" #include <QFrame> #include <QBoxLayout> #include <QSlider> #include <QLabel> #include <QSpinBox> #include <QMediaPlayer> #include <QUrl> #include <QTime> #include <QCheckBox> /** * @author Gustav Gonzalez **/ class TUPITUBE_EXPORT TupSoundPlayer : public QFrame { Q_OBJECT public: TupSoundPlayer(QWidget *parent = nullptr); ~TupSoundPlayer(); QSize sizeHint() const; void setSoundParams(TupLibraryObject *sound); void stopFile(); bool isPlaying(); void reset(); QString getSoundID() const; void updateInitFrame(int frame); void enableLipSyncInterface(bool enabled, int frame); signals: void frameUpdated(int frame); void muteEnabled(bool mute); private slots: void playFile(); void startPlayer(); void positionChanged(qint64 value); void durationChanged(qint64 value); void stateChanged(QMediaPlayer::State state); void updateSoundPos(int pos); void updateLoopState(); void muteAction(); private: QLabel *frameLabel; QMediaPlayer *player; QSlider *slider; QLabel *timer; TImageButton *playButton; TImageButton *muteButton; bool playing; qint64 duration; QTime soundTotalTime; QString totalTime; QCheckBox *loopBox; bool loop; bool mute; QSpinBox *frameBox; QWidget *frameWidget; QString soundID; }; #endif
xtingray/tupitube.desk
src/components/library/tupsoundplayer.h
C
gpl-2.0
4,307
38.87963
77
0.430926
false
/* * arch/arm/mach-tegra/baseband-xmm-power.c * * Copyright (C) 2011 NVIDIA Corporation * * This software is licensed under the terms of the GNU General Public * License version 2, as published by the Free Software Foundation, and * may be copied, distributed, and modified under those terms. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * */ #include <linux/kernel.h> #include <linux/init.h> #include <linux/module.h> #include <linux/moduleparam.h> #include <linux/platform_device.h> #include <linux/gpio.h> #include <linux/interrupt.h> #include <linux/workqueue.h> #include <linux/slab.h> #include <linux/delay.h> #include <linux/fs.h> #include <linux/uaccess.h> #include <linux/wakelock.h> #include <linux/spinlock.h> #include <linux/usb.h> #include <linux/pm_runtime.h> #include <linux/suspend.h> #include <mach/usb_phy.h> #include "board.h" #include "devices.h" #include <mach/board_htc.h> #include <linux/pm_qos_params.h> #include <asm/mach-types.h> #include "gpio-names.h" #include "baseband-xmm-power.h" MODULE_LICENSE("GPL"); unsigned long modem_ver = XMM_MODEM_VER_1130; /* * HTC: version history * * v04 - bert_lin - 20111025 * 1. remove completion & wait for probe race, use nv solution instead * 2. add a attribute for host usb debugging * v05 - bert_lin - 20111026 * 1. sync patch from nv michael. re-arrange the first_time var * after flight off, device cant goes to L2 suspend * 2. modify the files to meet the coding style * v06 - bert_lin - 20111026 * 1. item 12: L0 -> flight -> suspend fail because of wakelock holding * check wakelock in L3 and release it if neccessary * v07 - bert_lin - 20111104 * workaround for item 18, AP L2->L0 fail! submit urb return -113 * add more logs on usb_chr for modem download issue * v08 - bert_lin - 20111125 * workaround, origin l3 -> host_wake -> deepsleep * after: L3 -> host_wakeup -> noirq suspend fail -> resume * v09 - bert_lin - 20111214 * autopm * v10 - bert_lin - 20111226 * log reduce */ /* HTC: macro, variables */ #include <mach/htc_hostdbg.h> #define MODULE_NAME "[XMM_v15]" unsigned int host_dbg_flag = 0; EXPORT_SYMBOL(host_dbg_flag); /* HTC: provide interface for user space to enable usb host debugging */ static ssize_t host_dbg_show(struct device *dev, struct device_attribute *attr, char *buf); static ssize_t host_dbg_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t size); static DEVICE_ATTR(host_dbg, 0664, host_dbg_show, host_dbg_store); /* HTC: Create attribute for host debug purpose */ static ssize_t host_dbg_show(struct device *dev, struct device_attribute *attr, char *buf) { int ret = -EINVAL; ret = sprintf(buf, "%x\n", host_dbg_flag); return ret; } /** * HTC: get the runtime debug flags from user. * * @buf: user strings * @size: user strings plus one 0x0a char */ static ssize_t host_dbg_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t size) { const int hedge = 2 + 8 + 1; /* hedge: "0x" 2 chars, max: 8 chars, plus one 0x0a char */ pr_info(MODULE_NAME "%s size = %d\n", __func__, size); if (size > hedge) { pr_info(MODULE_NAME "%s size > hedge:%d, return\n", __func__, hedge); return size; } host_dbg_flag = simple_strtoul(buf, NULL, 16); pr_info(MODULE_NAME "%s set host_dbg_flag as 0x%08x\n", __func__, host_dbg_flag); return size; } /*============================================================*/ struct pm_qos_request_list modem_boost_cpu_freq_req; EXPORT_SYMBOL_GPL(modem_boost_cpu_freq_req); #define BOOST_CPU_FREQ_MIN 1500000 EXPORT_SYMBOL(modem_ver); unsigned long modem_flash; EXPORT_SYMBOL(modem_flash); unsigned long modem_pm = 1; EXPORT_SYMBOL(modem_pm); unsigned long autosuspend_delay = 3000; /* 5000 msec */ EXPORT_SYMBOL(autosuspend_delay); unsigned long enum_delay_ms = 1000; /* ignored if !modem_flash */ module_param(modem_ver, ulong, 0644); MODULE_PARM_DESC(modem_ver, "baseband xmm power - modem software version"); module_param(modem_flash, ulong, 0644); MODULE_PARM_DESC(modem_flash, "baseband xmm power - modem flash (1 = flash, 0 = flashless)"); module_param(modem_pm, ulong, 0644); MODULE_PARM_DESC(modem_pm, "baseband xmm power - modem power management (1 = pm, 0 = no pm)"); module_param(enum_delay_ms, ulong, 0644); MODULE_PARM_DESC(enum_delay_ms, "baseband xmm power - delay in ms between modem on and enumeration"); module_param(autosuspend_delay, ulong, 0644); MODULE_PARM_DESC(autosuspend_delay, "baseband xmm power - autosuspend delay for autopm"); #define auto_sleep(x) \ if (in_interrupt() || in_atomic())\ mdelay(x);\ else\ msleep(x); static bool short_autosuspend; static int short_autosuspend_delay = 100; static struct usb_device_id xmm_pm_ids[] = { { USB_DEVICE(VENDOR_ID, PRODUCT_ID), .driver_info = 0 }, {} }; //for power on modem static struct gpio tegra_baseband_gpios[] = { { -1, GPIOF_OUT_INIT_LOW, "BB_RSTn" }, { -1, GPIOF_OUT_INIT_LOW, "BB_ON" }, { -1, GPIOF_OUT_INIT_LOW, "IPC_BB_WAKE" }, { -1, GPIOF_IN, "IPC_AP_WAKE" }, { -1, GPIOF_OUT_INIT_HIGH, "IPC_HSIC_ACTIVE" }, { -1, GPIOF_OUT_INIT_LOW, "IPC_HSIC_SUS_REQ" }, { -1, GPIOF_OUT_INIT_LOW, "BB_VDD_EN" }, { -1, GPIOF_OUT_INIT_LOW, "AP2BB_RST_PWRDWNn" }, { -1, GPIOF_IN, "BB2AP_RST2" }, }; /*HTC*/ //for power consumation , power off modem static struct gpio tegra_baseband_gpios_power_off_modem[] = { { -1, GPIOF_OUT_INIT_LOW, "BB_RSTn" }, { -1, GPIOF_OUT_INIT_LOW, "BB_ON" }, { -1, GPIOF_OUT_INIT_LOW, "IPC_BB_WAKE" }, { -1, GPIOF_OUT_INIT_LOW, "IPC_AP_WAKE" }, { -1, GPIOF_OUT_INIT_LOW, "IPC_HSIC_ACTIVE" }, { -1, GPIOF_OUT_INIT_LOW, "IPC_HSIC_SUS_REQ" }, { -1, GPIOF_OUT_INIT_LOW, "BB_VDD_EN" }, { -1, GPIOF_OUT_INIT_LOW, "AP2BB_RST_PWRDWNn" }, { -1, GPIOF_OUT_INIT_LOW, "BB2AP_RST2" }, }; static enum { IPC_AP_WAKE_UNINIT, IPC_AP_WAKE_IRQ_READY, IPC_AP_WAKE_INIT1, IPC_AP_WAKE_INIT2, IPC_AP_WAKE_L, IPC_AP_WAKE_H, } ipc_ap_wake_state = IPC_AP_WAKE_INIT2; enum baseband_xmm_powerstate_t baseband_xmm_powerstate; static struct workqueue_struct *workqueue; static struct work_struct init1_work; static struct work_struct init2_work; static struct work_struct L2_resume_work; //static struct delayed_work init4_work; static struct baseband_power_platform_data *baseband_power_driver_data; static int waiting_falling_flag = 0; static bool register_hsic_device; static struct wake_lock wakelock; static struct usb_device *usbdev; static bool CP_initiated_L2toL0; static bool modem_power_on; static bool first_time = true; static int power_onoff; static void baseband_xmm_power_L2_resume(void); static DEFINE_MUTEX(baseband_xmm_onoff_lock); #ifndef CONFIG_REMOVE_HSIC_L3_STATE static int baseband_xmm_power_driver_handle_resume( struct baseband_power_platform_data *data); #endif static bool wakeup_pending; static int uart_pin_pull_state=1; // 1 for UART, 0 for GPIO static bool modem_sleep_flag = false; //static struct regulator *endeavor_dsi_reg = NULL;//for avdd_csi_dsi static spinlock_t xmm_lock; static bool system_suspending; static int reenable_autosuspend; //ICS only static int htcpcbid=0; static struct workqueue_struct *workqueue_susp; static struct work_struct work_shortsusp, work_defaultsusp; static struct workqueue_struct *workqueue_debug; static struct work_struct work_reset_host_active; static int s_sku_id = 0; static const int SKU_ID_ENRC2_GLOBAL = 0x00034600; static const int SKU_ID_ENRC2_TMO = 0x00032900; static const int SKU_ID_ENDEAVORU = 0x0002F300; static struct kset *silent_reset_kset; static struct kobject *silent_reset_kobj; #ifndef MIN static inline int MIN( int x, int y ) { return x > y ? y : x; } #endif ssize_t debug_handler(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { if( !strncmp( buf, "0", MIN( count, strlen("0") ) ) ) { debug_gpio_dump(); } else if( !strncmp( buf, "1", MIN( count, strlen("1") ) ) ) { debug_gpio_dump(); trigger_radio_fatal_get_coredump(); } else if( !strncmp( buf, "2", MIN( count, strlen("2") ) ) ) { trigger_silent_reset("From User Space"); } else { pr_info("%s: do nothing\n", __func__); } return count; } EXPORT_SYMBOL_GPL(debug_handler); #define PRINT_GPIO(gpio,name) pr_info( "PRINT_GPIO %s <%d>", name, gpio_get_value(gpio) ) int debug_gpio_dump() { PRINT_GPIO( TEGRA_GPIO_PM4, "BB_VDD_EN" ); PRINT_GPIO( TEGRA_GPIO_PC1, "AP2BB_RST_PWRDWNn" ); PRINT_GPIO( TEGRA_GPIO_PN0, "AP2BB_RSTn" ); PRINT_GPIO( TEGRA_GPIO_PN3, "AP2BB_PWRON" ); PRINT_GPIO( TEGRA_GPIO_PN2, "BB2AP_RADIO_FATAL" ); PRINT_GPIO( TEGRA_GPIO_PN1, "IPC_HSIC_ACTIVE" ); PRINT_GPIO( TEGRA_GPIO_PV0, "HSIC_SUS_REQ" ); PRINT_GPIO( TEGRA_GPIO_PC6, "IPC_BB_WAKE" ); PRINT_GPIO( TEGRA_GPIO_PS2, "IPC_AP_WAKE" ); if(SKU_ID_ENDEAVORU != s_sku_id) { PRINT_GPIO( TEGRA_GPIO_PS5, "BB2AP_RST2" ); } return true; } EXPORT_SYMBOL_GPL(debug_gpio_dump); int trigger_radio_fatal_get_coredump(void) { #if 0 if (!reason) reason = "No Reason"; pr_info("Trigger Modem Fatal!! reason <%s>", reason); /*set BB2AP_SUSPEND_REQ Pin (TEGRA_GPIO_PV0) to OutPut High to trigger Modem fatal*/ int ret=gpio_direction_output(TEGRA_GPIO_PV0,1); if (ret < 0) pr_err("%s: set BB2AP_SUSPEND_REQ Pin to Output error", __func__); /* reset HOST_ACTIVE to notify modem since suspend req is not a wakeup source of modem. */ queue_work( workqueue_debug, &work_reset_host_active ); #else pr_info("Didn't trigger fatal for better user experience"); #endif return 0; } EXPORT_SYMBOL_GPL(trigger_radio_fatal_get_coredump); int trigger_silent_reset(char *reason) { #define MSIZE 30 char message[MSIZE] = "ResetReason="; char *envp[] = { message, NULL }; int left_size = MSIZE -1 -strlen(message); if (!reason) reason = "No Reason"; strncat(message, reason, MIN(strlen(reason),left_size)); pr_info("%s: message<%s>", __func__, message); if(silent_reset_kobj) { kobject_uevent_env( silent_reset_kobj, KOBJ_ADD, envp); } else { pr_err("%s: kobj is NULL.", __func__); } return 0; } EXPORT_SYMBOL_GPL(trigger_silent_reset); static DEVICE_ATTR(debug_handler, S_IRUSR | S_IWUSR | S_IRGRP, NULL, debug_handler); int Modem_is_6360() { return s_sku_id == SKU_ID_ENRC2_TMO; } EXPORT_SYMBOL_GPL(Modem_is_6360); int Modem_is_6260() { return ( s_sku_id == SKU_ID_ENRC2_GLOBAL || s_sku_id == SKU_ID_ENDEAVORU ); } EXPORT_SYMBOL_GPL(Modem_is_6260); int Modem_is_IMC(void) { return ( machine_is_enrc2b() || machine_is_endeavoru() || machine_is_enrc2u() ); } EXPORT_SYMBOL_GPL(Modem_is_IMC); static irqreturn_t radio_reset_irq(int irq, void *dev_id) { pr_err("%s: Radio reset detected!", __func__); debug_gpio_dump(); return IRQ_HANDLED; } #if 0 int enable_avdd_dsi_csi_power() { pr_info(MODULE_NAME "[xmm]%s\n",__func__); int ret=0; if (endeavor_dsi_reg == NULL) { endeavor_dsi_reg = regulator_get(NULL, "avdd_dsi_csi"); pr_info(MODULE_NAME "[xmm]%s regulator_getED\n",__func__); if (IS_ERR_OR_NULL(endeavor_dsi_reg)) { pr_err("dsi: Could not get regulator avdd_dsi_csi\n"); endeavor_dsi_reg = NULL; return PTR_ERR(endeavor_dsi_reg); } } ret = regulator_enable(endeavor_dsi_reg); if (ret < 0) { printk(KERN_ERR "DSI regulator avdd_dsi_csi couldn't be enabled\n",ret); } return ret; } int disable_avdd_dsi_csi_power() { pr_info(MODULE_NAME "[xmm]%s\n",__func__); int ret=0; if (endeavor_dsi_reg == NULL) { endeavor_dsi_reg = regulator_get(NULL, "avdd_dsi_csi"); pr_info(MODULE_NAME "[xmm]%s regulator_getED\n",__func__); if (IS_ERR_OR_NULL(endeavor_dsi_reg)) { pr_err("dsi: Could not get regulator avdd_dsi_csi\n"); endeavor_dsi_reg = NULL; return PTR_ERR(endeavor_dsi_reg); } } ret = regulator_disable(endeavor_dsi_reg); if (ret < 0) { printk(KERN_ERR "DSI regulator avdd_dsi_csi couldn't be disabled\n",ret); } endeavor_dsi_reg=NULL; return ret; } #endif int gpio_config_only_one(unsigned gpio, unsigned long flags, const char *label) { int err=0; if (flags & GPIOF_DIR_IN) err = gpio_direction_input(gpio); else err = gpio_direction_output(gpio, (flags & GPIOF_INIT_HIGH) ? 1 : 0); return err; } int gpio_config_only_array(struct gpio *array, size_t num) { int i, err=0; for (i = 0; i < num; i++, array++) { if( array->gpio != -1 ) { err = gpio_config_only_one(array->gpio, array->flags, array->label); if (err) goto err_free; } } return 0; err_free: //while (i--) //gpio_free((--array)->gpio); return err; } int gpio_request_only_one(unsigned gpio,const char *label) { int err = gpio_request(gpio, label); if (err) return err; else return 0; } int gpio_request_only_array(struct gpio *array, size_t num) { int i, err=0; for (i = 0; i < num; i++, array++) { if( array->gpio != -1 ) { err = gpio_request_only_one(array->gpio, array->label); if (err) goto err_free; } } return 0; err_free: while (i--) gpio_free((--array)->gpio); return err; } static int gpio_o_l_uart(int gpio, char* name) { int ret=0; pr_info(MODULE_NAME "%s ,name=%s gpio=%d\n", __func__,name,gpio); ret = gpio_direction_output(gpio, 0); if (ret < 0) { pr_err(" %s: gpio_direction_output failed %d\n", __func__, ret); gpio_free(gpio); return ret; } tegra_gpio_enable(gpio); gpio_export(gpio, true); return ret; } void modem_on_for_uart_config(void) { pr_info(MODULE_NAME "%s ,first_time=%s uart_pin_pull_low=%d\n", __func__,first_time?"true":"false",uart_pin_pull_state); if(uart_pin_pull_state==0){ //if uart pin pull low, then we put back to normal pr_info(MODULE_NAME "%s tegra_gpio_disable for UART\n", __func__); tegra_gpio_disable(TEGRA_GPIO_PJ7); tegra_gpio_disable(TEGRA_GPIO_PK7); tegra_gpio_disable(TEGRA_GPIO_PB0); tegra_gpio_disable(TEGRA_GPIO_PB1); uart_pin_pull_state=1;//set back to UART } } int modem_off_for_uart_config(void) { int err=0; pr_info(MODULE_NAME "%s uart_pin_pull_low=%d\n", __func__,uart_pin_pull_state); if(uart_pin_pull_state==1){ //if uart pin not pull low yet, then we pull them low+enable err=gpio_o_l_uart(TEGRA_GPIO_PJ7, "IMC_UART_TX"); err=gpio_o_l_uart(TEGRA_GPIO_PK7, "IMC_UART_RTS"); err=gpio_o_l_uart(TEGRA_GPIO_PB0 ,"IMC_UART_RX"); err=gpio_o_l_uart(TEGRA_GPIO_PB1, "IMC_UART_CTS"); uart_pin_pull_state=0;//chagne to gpio } return err; } int modem_off_for_usb_config(struct gpio *array, size_t num) { //pr_info(MODULE_NAME "%s 1219_01\n", __func__); int err=0; err = gpio_config_only_array(tegra_baseband_gpios_power_off_modem, ARRAY_SIZE(tegra_baseband_gpios_power_off_modem)); if (err < 0) { pr_err("%s - gpio_config_array gpio(s) for modem off failed\n", __func__); return -ENODEV; } return err; } #if 0 int modem_on_for_usb_config(struct gpio *array, size_t num) { pr_info(MODULE_NAME "%s \n", __func__); int err=0; err = gpio_config_only_array(tegra_baseband_gpios, ARRAY_SIZE(tegra_baseband_gpios)); if (err < 0) { pr_err("%s - gpio_config_array gpio(s) for modem off failed\n", __func__); return -ENODEV; } return err; } #endif int config_gpio_for_power_off(void) { int err=0; pr_info(MODULE_NAME "%s for power consumation 4st \n", __func__); #if 1 /* config baseband gpio(s) for modem off */ err = modem_off_for_usb_config(tegra_baseband_gpios_power_off_modem, ARRAY_SIZE(tegra_baseband_gpios_power_off_modem)); if (err < 0) { pr_err("%s - gpio_config_array gpio(s) for modem off failed\n", __func__); return -ENODEV; } #endif /* config uart gpio(s) for modem off */ err=modem_off_for_uart_config(); if (err < 0) { pr_err("%s - modem_off_for_uart_config gpio(s)\n", __func__); return -ENODEV; } return err; } #if 0 int config_gpio_for_power_on() { int err=0; pr_info(MODULE_NAME "%s for power consumation 4st \n", __func__); #if 1 /* config baseband gpio(s) for modem off */ err = modem_on_for_usb_config(tegra_baseband_gpios, ARRAY_SIZE(tegra_baseband_gpios)); if (err < 0) { pr_err("%s - gpio_config_array gpio(s) for modem off failed\n", __func__); return -ENODEV; } #endif /* config uart gpio(s) for modem off */ modem_on_for_uart_config(); return err; } #endif /*HTC--*/ extern void platfrom_set_flight_mode_onoff(bool mode_on); static int baseband_modem_power_on(struct baseband_power_platform_data *data) { /* HTC: called in atomic context */ int ret=0, i=0; pr_info("%s VP: 07/05 22.52{\n", __func__); if (!data) { pr_err("%s: data is NULL\n", __func__); return -1; } /* reset / power on sequence */ gpio_set_value(data->modem.xmm.bb_vdd_en, 1); /* give modem power */ auto_sleep(1); gpio_set_value(data->modem.xmm.bb_rst, 0); /* set to low first */ //pr_info("%s(%d)\n", __func__, __LINE__); for (i = 0; i < 7; i++) /* 5 ms BB_RST low */ udelay(1000); ret = gpio_get_value(data->modem.xmm.bb_rst_pwrdn); //pr_info("%s(%d) get AP2BB_RST_PWRDWNn=%d \n", __func__, __LINE__, ret); //pr_info("%s(%d) set AP2BB_RST_PWRDWNn=1\n", __func__, __LINE__); gpio_set_value(data->modem.xmm.bb_rst_pwrdn, 1); /* 20 ms RST_PWRDWNn high */ auto_sleep(25); /* need 20 but 40 is more safe */ //steven markded //pr_info("%s(%d) set modem.xmm.bb_rst=1\n", __func__, __LINE__); gpio_set_value(data->modem.xmm.bb_rst, 1); /* 1 ms BB_RST high */ auto_sleep(40); /* need 20 but 40 is more safe */ /* Use RST2 to identify if modem is powered on into boot rom. */ /* Fix issue of power leakage in ENRC2. */ if (machine_is_enrc2b() || machine_is_enrc2u()) { gpio_direction_input(data->modem.xmm.bb_rst2); } gpio_direction_input(data->modem.xmm.ipc_ap_wake); gpio_direction_input(TEGRA_GPIO_PN2); //pr_info("%s(%d) set modem.xmm.bb_on=1 duration is 60us\n", __func__, __LINE__); gpio_set_value(data->modem.xmm.bb_on, 1); /* power on sequence */ udelay(60); gpio_set_value(data->modem.xmm.bb_on, 0); //pr_info("%s(%d) set modem.xmm.bb_on=0\n", __func__, __LINE__); auto_sleep(10); //pr_info("%s:VP pm qos request CPU 1.5GHz\n", __func__); //pm_qos_update_request(&modem_boost_cpu_freq_req, (s32)BOOST_CPU_FREQ_MIN); /* Use RST2 to identify if modem is powered on into boot rom. */ /* Fix issue of power leakage in ENRC2. */ if (machine_is_enrc2b() || machine_is_enrc2u()) { int counter = 0; const int max_retry = 10; while (!gpio_get_value(data->modem.xmm.bb_rst2) && counter < max_retry) { counter++; mdelay(3); } if(counter == max_retry) pr_info("%s: Wait BB2AP_RST2 timeout.", __func__); } gpio_direction_output(data->modem.xmm.ipc_hsic_active, 1); modem_on_for_uart_config(); pr_info("%s }\n", __func__); return 0; } static int baseband_xmm_power_on(struct platform_device *device) { struct baseband_power_platform_data *data = (struct baseband_power_platform_data *) device->dev.platform_data; int ret; /* HTC: ENR#U wakeup src fix */ //int value; pr_info(MODULE_NAME "%s{\n", __func__); /* check for platform data */ if (!data) { pr_err("%s: !data\n", __func__); return -EINVAL; } if (baseband_xmm_powerstate != BBXMM_PS_UNINIT) { pr_err("%s: baseband_xmm_powerstate != BBXMM_PS_UNINIT\n", __func__); return -EINVAL; } #if 0 /*HTC*/ pr_info(MODULE_NAME " htc_get_pcbid_info= %d\n",htcpcbid ); if(htcpcbid < PROJECT_PHASE_XE) { enable_avdd_dsi_csi_power(); } #endif /* reset the state machine */ baseband_xmm_powerstate = BBXMM_PS_INIT; first_time = true; modem_sleep_flag = false; /* HTC use IPC_AP_WAKE_INIT2 */ if (modem_ver < XMM_MODEM_VER_1130) ipc_ap_wake_state = IPC_AP_WAKE_INIT1; else ipc_ap_wake_state = IPC_AP_WAKE_INIT2; /* pr_info("%s - %d\n", __func__, __LINE__); */ /* register usb host controller */ if (!modem_flash) { /* pr_info("%s - %d\n", __func__, __LINE__); */ /* register usb host controller only once */ if (register_hsic_device) { pr_info("%s(%d)register usb host controller\n", __func__, __LINE__); modem_power_on = true; if (data->hsic_register) data->modem.xmm.hsic_device = data->hsic_register(); else pr_err("%s: hsic_register is missing\n", __func__); register_hsic_device = false; } else { /* register usb host controller */ if (data->hsic_register) data->modem.xmm.hsic_device = data->hsic_register(); /* turn on modem */ pr_info("%s call baseband_modem_power_on\n", __func__); baseband_modem_power_on(data); } } if (machine_is_enrc2b() || machine_is_enrc2u()) { pr_info("%s: register BB2AP_RST2 handler", __func__); ret = request_irq( gpio_to_irq(TEGRA_GPIO_PS5), radio_reset_irq, IRQF_TRIGGER_FALLING, "RADIO_RESET", NULL ); if (ret < 0) pr_err("%s: register BB2AP_RST2 handler err <%d>", __func__, ret); } pr_info("%s: before enable irq wake", __func__); ret = enable_irq_wake(gpio_to_irq(data->modem.xmm.ipc_ap_wake)); if (ret < 0) pr_err("%s: enable_irq_wake ap_wake err <%d>", __func__, ret); ret = enable_irq_wake(gpio_to_irq(TEGRA_GPIO_PN2)); if (ret < 0) pr_err("%s: enable_irq_wake radio_fatal err <%d>", __func__, ret); if (machine_is_enrc2b() || machine_is_enrc2u()) { ret = enable_irq_wake(gpio_to_irq(TEGRA_GPIO_PS5)); if (ret < 0) pr_err("%s: enable_irq_wake radio_reset err <%d>", __func__, ret); } pr_info("%s }\n", __func__); return 0; } static int baseband_xmm_power_off(struct platform_device *device) { struct baseband_power_platform_data *data; int ret; /* HTC: ENR#U wakeup src fix */ unsigned long flags; pr_info("%s {\n", __func__); if (baseband_xmm_powerstate == BBXMM_PS_UNINIT) { pr_err("%s: baseband_xmm_powerstate != BBXMM_PS_UNINIT\n", __func__); return -EINVAL; } /* check for device / platform data */ if (!device) { pr_err("%s: !device\n", __func__); return -EINVAL; } data = (struct baseband_power_platform_data *) device->dev.platform_data; if (!data) { pr_err("%s: !data\n", __func__); return -EINVAL; } ipc_ap_wake_state = IPC_AP_WAKE_UNINIT; /* Set this flag to have proper flash-less first enumearation */ register_hsic_device = true; pr_info("%s: before disable irq wake", __func__); ret = disable_irq_wake(gpio_to_irq(data->modem.xmm.ipc_ap_wake)); if (ret < 0) pr_err("%s: disable_irq_wake ap_wake err <%d>", __func__, ret); ret = disable_irq_wake(gpio_to_irq(TEGRA_GPIO_PN2)); if (ret < 0) pr_err("%s: disable_irq_wake radio_fatal err <%d>", __func__, ret); if (machine_is_enrc2b() || machine_is_enrc2u()) { ret = disable_irq_wake(gpio_to_irq(TEGRA_GPIO_PS5)); if (ret < 0) pr_err("%s: disable_irq_wake radio_reset err <%d>", __func__, ret); pr_info("%s: before free radio_reset irq", __func__); free_irq( gpio_to_irq(TEGRA_GPIO_PS5), NULL ); if (ret < 0) pr_err("%s: free_irq radio_reset err <%d>", __func__, ret); } /* unregister usb host controller */ pr_info("%s: hsic device: %x\n", __func__, (unsigned int)data->modem.xmm.hsic_device); if (data->hsic_unregister && data->modem.xmm.hsic_device) { data->hsic_unregister(data->modem.xmm.hsic_device); data->modem.xmm.hsic_device = NULL; } else pr_err("%s: hsic_unregister is missing\n", __func__); /* set IPC_HSIC_ACTIVE low */ gpio_set_value(baseband_power_driver_data-> modem.xmm.ipc_hsic_active, 0); /* wait 20 ms */ msleep(20); /* drive bb_rst low */ //Sophia:0118:modem power down sequence: don't need to clear BB_RST //gpio_set_value(data->modem.xmm.bb_rst, 0); #ifdef BB_XMM_OEM1 //msleep(1); msleep(20); /* turn off the modem power */ gpio_set_value(baseband_power_driver_data->modem.xmm.bb_vdd_en, 0); msleep(68);//for IMC Modem discharge. #else /* !BB_XMM_OEM1 */ msleep(1); #endif /* !BB_XMM_OEM1 */ #if 1/*HTC*/ //for power consumation pr_info("%s config_gpio_for_power_off\n", __func__); config_gpio_for_power_off(); //err=config_gpio_for_power_off(); //if (err < 0) { // pr_err("%s - config_gpio_for_power_off gpio(s)\n", __func__); // return -ENODEV; //} #endif /* HTC: remove platfrom_set_flight_mode_onoff for ENR */ /* platfrom_set_flight_mode_onoff(true); */ baseband_xmm_powerstate = BBXMM_PS_UNINIT; modem_sleep_flag = false; CP_initiated_L2toL0 = false; spin_lock_irqsave(&xmm_lock, flags); wakeup_pending = false; system_suspending = false; spin_unlock_irqrestore(&xmm_lock, flags); register_hsic_device = true; //start reg process again for xmm on #if 0 /*HTC*/ pr_info(MODULE_NAME " htc_get_pcbid_info= %d\n", htcpcbid); if(htcpcbid< PROJECT_PHASE_XE) { disable_avdd_dsi_csi_power(); } #endif /*set Radio fatal Pin to OutPut Low*/ ret=gpio_direction_output(TEGRA_GPIO_PN2,0); if (ret < 0) pr_err("%s: set Radio fatal Pin to Output error\n", __func__); /*set BB2AP_SUSPEND_REQ Pin (TEGRA_GPIO_PV0) to OutPut Low*/ ret=gpio_direction_output(TEGRA_GPIO_PV0,0); if (ret < 0) pr_err("%s: set BB2AP_SUSPEND_REQ Pin to Output error\n", __func__); pr_info("%s }\n", __func__); return 0; } static ssize_t baseband_xmm_onoff(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { //int size; struct platform_device *device = to_platform_device(dev); mutex_lock(&baseband_xmm_onoff_lock); /* check input */ if (buf == NULL) { pr_err("%s: buf NULL\n", __func__); mutex_unlock(&baseband_xmm_onoff_lock); return -EINVAL; } /* pr_info("%s: count=%d\n", __func__, count); */ /* parse input */ #ifdef BB_XMM_OEM1 if (buf[0] == 0x01 || buf[0] == '1') { /* pr_info("%s: buf[0] = 0x%x\n", __func__, buf[0]); */ power_onoff = 1; } else power_onoff = 0; #else /* !BB_XMM_OEM1 */ size = sscanf(buf, "%d", &power_onoff); if (size != 1) { pr_err("%s: size=%d -EINVAL\n", __func__, size); mutex_unlock(&baseband_xmm_onoff_lock); return -EINVAL; } #endif /* !BB_XMM_OEM1 */ pr_info("%s power_onoff=%d count=%d, buf[0]=0x%x\n", __func__, power_onoff, count, buf[0]); if (power_onoff == 0) baseband_xmm_power_off(device); else if (power_onoff == 1) baseband_xmm_power_on(device); mutex_unlock(&baseband_xmm_onoff_lock); return count; } static DEVICE_ATTR(xmm_onoff, S_IRUSR | S_IWUSR | S_IRGRP, NULL, baseband_xmm_onoff); void baseband_xmm_set_power_status(unsigned int status) { struct baseband_power_platform_data *data = baseband_power_driver_data; //int value = 0; unsigned long flags; if (baseband_xmm_powerstate == status) return; pr_info(MODULE_NAME"%s{ status=%d\n", __func__,status); switch (status) { case BBXMM_PS_L0: if (modem_sleep_flag) { #ifdef CONFIG_REMOVE_HSIC_L3_STATE pr_info("%s, resume to L0 with modem_sleep_flag", __func__ ); #else pr_info("%s Resume from L3 without calling resume function\n", __func__); baseband_xmm_power_driver_handle_resume(data); #endif } pr_info("L0\n"); baseband_xmm_powerstate = status; /* HTC: don't hold the wakelock multiple times */ if (!wake_lock_active(&wakelock)) { pr_info("%s: wake_lock [%s] in L0\n", __func__, wakelock.name); #ifdef CONFIG_REMOVE_HSIC_L3_STATE wake_lock_timeout(&wakelock, HZ*2); #else wake_lock(&wakelock); //wake_lock_timeout(&wakelock, HZ * 5); #endif } if (modem_power_on) { modem_power_on = false; baseband_modem_power_on(data); } //pr_info("gpio host active high->\n"); /* hack to restart autosuspend after exiting LP0 * (aka re-entering L0 from L3) */ #if 0 //remove on 0305 if (usbdev) { struct usb_interface *intf; intf = usb_ifnum_to_if(usbdev, 0); //pr_info("%s - autopm_get - usbdev = %d - %d {\n", __func__, usbdev, __LINE__); //pr_info("%s: cnt %d intf=%p &intf->dev=%p kobje=%s\n", //__func__, atomic_read(&intf->dev.power.usage_count),intf,&intf->dev,kobject_name(&intf->dev.kobj)); if (usb_autopm_get_interface_async(intf) >= 0) { pr_info("get_interface_async succeeded" " - call put_interface\n"); //pr_info("%s - usb_put - usbdev = %d - %d {\n", __func__, usbdev, __LINE__); usb_autopm_put_interface_async(intf); //pr_info("%s - usb_put - usbdev = %d - %d {\n", __func__, usbdev, __LINE__); } else { pr_info("get_interface_async failed" " - do not call put_interface\n"); } } #endif break; case BBXMM_PS_L2: pr_info("L2 wake_unlock[%s]\n", wakelock.name); baseband_xmm_powerstate = status; spin_lock_irqsave(&xmm_lock, flags); if (wakeup_pending) { spin_unlock_irqrestore(&xmm_lock, flags); #ifdef CONFIG_REMOVE_HSIC_L3_STATE pr_info("%s: wakeup pending\n", __func__); #endif baseband_xmm_power_L2_resume(); } else { spin_unlock_irqrestore(&xmm_lock, flags); wake_unlock(&wakelock); modem_sleep_flag = true; } if (short_autosuspend && (&usbdev->dev)) { pr_info("autosuspend delay %d ms,disable short_autosuspend\n", (int)autosuspend_delay); queue_work(workqueue_susp, &work_defaultsusp); short_autosuspend = false; } #if 0 if (usbdev) { struct usb_interface *intf; intf = usb_ifnum_to_if(usbdev, 0); pr_info("%s: cnt %d intf=%p &intf->dev=%p kobje=%s\n", __func__, atomic_read(&intf->dev.power.usage_count),intf,&intf->dev,kobject_name(&intf->dev.kobj)); } #endif break; #ifndef CONFIG_REMOVE_HSIC_L3_STATE case BBXMM_PS_L3: if (baseband_xmm_powerstate == BBXMM_PS_L2TOL0) { pr_info("%s: baseband_xmm_powerstate == BBXMM_PS_L2TOL0\n", __func__); if (!gpio_get_value(data->modem.xmm.ipc_ap_wake)) { spin_lock_irqsave(&xmm_lock, flags); wakeup_pending = true; spin_unlock_irqrestore(&xmm_lock, flags); pr_info("%s: L2 race condition-CP wakeup pending\n", __func__); } } pr_info("L3\n"); baseband_xmm_powerstate = status; spin_lock_irqsave(&xmm_lock, flags); system_suspending = false; spin_unlock_irqrestore(&xmm_lock, flags); if (wake_lock_active(&wakelock)) { pr_info("L3 --- wake_unlock[%s]\n", wakelock.name); wake_unlock(&wakelock); } if (wakeup_pending == false) { gpio_set_value(data->modem.xmm.ipc_hsic_active, 0); waiting_falling_flag = 0; pr_info("gpio host active low->\n"); } break; #endif case BBXMM_PS_L2TOL0: pr_info("L2->L0\n"); spin_lock_irqsave(&xmm_lock, flags); system_suspending = false; wakeup_pending = false; spin_unlock_irqrestore(&xmm_lock, flags); /* do this only from L2 state */ if (baseband_xmm_powerstate == BBXMM_PS_L2) { baseband_xmm_powerstate = status; //pr_info("BB XMM POWER STATE = %d\n", status); baseband_xmm_power_L2_resume(); } else goto exit_without_state_change; default: break; } baseband_xmm_powerstate = status; pr_info("BB XMM POWER STATE = %d\n", status); return; exit_without_state_change: pr_info("BB XMM POWER STATE = %d (not change to %d)\n", baseband_xmm_powerstate, status); return; } EXPORT_SYMBOL_GPL(baseband_xmm_set_power_status); irqreturn_t baseband_xmm_power_ipc_ap_wake_irq(int irq, void *dev_id) { int value; struct baseband_power_platform_data *data = baseband_power_driver_data; /* pr_info("%s\n", __func__); */ value = gpio_get_value(data->modem.xmm.ipc_ap_wake); if (ipc_ap_wake_state < IPC_AP_WAKE_IRQ_READY) { pr_err("%s - spurious irq\n", __func__); } else if (ipc_ap_wake_state == IPC_AP_WAKE_IRQ_READY) { if (!value) { pr_info("%s - IPC_AP_WAKE_INIT1" " - got falling edge\n", __func__); if (waiting_falling_flag == 0) { pr_info("%s return because irq must get the rising event at first\n", __func__); return IRQ_HANDLED; } /* go to IPC_AP_WAKE_INIT1 state */ ipc_ap_wake_state = IPC_AP_WAKE_INIT1; /* queue work */ queue_work(workqueue, &init1_work); } else { pr_info("%s - IPC_AP_WAKE_INIT1" " - wait for falling edge\n", __func__); waiting_falling_flag = 1; } } else if (ipc_ap_wake_state == IPC_AP_WAKE_INIT1) { if (!value) { pr_info("%s - IPC_AP_WAKE_INIT2" " - wait for rising edge\n", __func__); } else { pr_info("%s - IPC_AP_WAKE_INIT2" " - got rising edge\n", __func__); /* go to IPC_AP_WAKE_INIT2 state */ ipc_ap_wake_state = IPC_AP_WAKE_INIT2; /* queue work */ queue_work(workqueue, &init2_work); } } else { if (!value) { pr_info("%s - falling\n", __func__); /* First check it a CP ack or CP wake */ if (data->pin_state == 0) { /* AP L2 to L0 wakeup */ pr_info("VP: received rising wakeup ap l2->l0\n"); data->pin_state = 1; wake_up_interruptible(&data->bb_wait); } value = gpio_get_value (data->modem.xmm.ipc_bb_wake); if (value) { pr_info("cp ack for bb_wake\n"); ipc_ap_wake_state = IPC_AP_WAKE_L; return IRQ_HANDLED; } spin_lock(&xmm_lock); wakeup_pending = true; if (system_suspending) { spin_unlock(&xmm_lock); pr_info("system_suspending=1, Just set wakup_pending flag=true\n"); } else { #ifndef CONFIG_REMOVE_HSIC_L3_STATE if (baseband_xmm_powerstate == BBXMM_PS_L3) { spin_unlock(&xmm_lock); pr_info(" CP L3 -> L0\n"); pr_info("set wakeup_pending=true, wait for no-irq-resuem if you are not under LP0 yet !.\n"); pr_info("set wakeup_pending=true, wait for system resume if you already under LP0.\n"); } else #endif if (baseband_xmm_powerstate == BBXMM_PS_L2) { CP_initiated_L2toL0 = true; spin_unlock(&xmm_lock); baseband_xmm_set_power_status (BBXMM_PS_L2TOL0); } else { CP_initiated_L2toL0 = true; spin_unlock(&xmm_lock); pr_info(" CP wakeup pending- new race condition"); } } /* save gpio state */ ipc_ap_wake_state = IPC_AP_WAKE_L; } else { pr_info("%s - rising\n", __func__); value = gpio_get_value (data->modem.xmm.ipc_hsic_active); if (!value) { pr_info("host active low: ignore request\n"); ipc_ap_wake_state = IPC_AP_WAKE_H; return IRQ_HANDLED; } value = gpio_get_value (data->modem.xmm.ipc_bb_wake); if (value) { /* Clear the slave wakeup request */ gpio_set_value (data->modem.xmm.ipc_bb_wake, 0); pr_info("set gpio slave wakeup low done ->\n"); } if (reenable_autosuspend && usbdev) { struct usb_interface *intf; reenable_autosuspend = false; intf = usb_ifnum_to_if(usbdev, 0); if( NULL != intf ){ if (usb_autopm_get_interface_async(intf) >= 0) { pr_info("get_interface_async succeeded" " - call put_interface\n"); usb_autopm_put_interface_async(intf); } else { pr_info("get_interface_async failed" " - do not call put_interface\n"); } } } if (short_autosuspend&& (&usbdev->dev)) { pr_info("set autosuspend delay %d ms\n", short_autosuspend_delay); queue_work(workqueue_susp, &work_shortsusp); } modem_sleep_flag = false; baseband_xmm_set_power_status(BBXMM_PS_L0); /* save gpio state */ ipc_ap_wake_state = IPC_AP_WAKE_H; } } return IRQ_HANDLED; } EXPORT_SYMBOL(baseband_xmm_power_ipc_ap_wake_irq); static void baseband_xmm_power_reset_host_active_work(struct work_struct *work) { /* set host_active for interrupt modem */ int value = gpio_get_value(TEGRA_GPIO_PN1); pr_info("Oringial IPC_HSIC_ACTIVE =%d", value); gpio_set_value(TEGRA_GPIO_PN1,!value); msleep(100); gpio_set_value(TEGRA_GPIO_PN1,value); } static void baseband_xmm_power_init1_work(struct work_struct *work) { int value; pr_info("%s {\n", __func__); /* check if IPC_HSIC_ACTIVE high */ value = gpio_get_value(baseband_power_driver_data-> modem.xmm.ipc_hsic_active); if (value != 1) { pr_err("%s - expected IPC_HSIC_ACTIVE high!\n", __func__); return; } /* wait 100 ms */ msleep(100); /* set IPC_HSIC_ACTIVE low */ gpio_set_value(baseband_power_driver_data-> modem.xmm.ipc_hsic_active, 0); /* wait 10 ms */ msleep(10); /* set IPC_HSIC_ACTIVE high */ gpio_set_value(baseband_power_driver_data-> modem.xmm.ipc_hsic_active, 1); /* wait 20 ms */ msleep(20); #ifdef BB_XMM_OEM1 /* set IPC_HSIC_ACTIVE low */ gpio_set_value(baseband_power_driver_data-> modem.xmm.ipc_hsic_active, 0); printk(KERN_INFO"%s merge need check set IPC_HSIC_ACTIVE low\n", __func__); #endif /* BB_XMM_OEM1 */ pr_info("%s }\n", __func__); } static void baseband_xmm_power_init2_work(struct work_struct *work) { struct baseband_power_platform_data *data = baseband_power_driver_data; pr_info("%s\n", __func__); /* check input */ if (!data) return; /* register usb host controller only once */ if (register_hsic_device) { if (data->hsic_register) data->modem.xmm.hsic_device = data->hsic_register(); else pr_err("%s: hsic_register is missing\n", __func__); register_hsic_device = false; } } /* Do the work for AP/CP initiated L2->L0 */ static void baseband_xmm_power_L2_resume(void) { struct baseband_power_platform_data *data = baseband_power_driver_data; int value; unsigned long flags; pr_info("%s\n", __func__); if (!baseband_power_driver_data) return; /* claim the wakelock here to avoid any system suspend */ if (!wake_lock_active(&wakelock)) #ifdef CONFIG_REMOVE_HSIC_L3_STATE wake_lock_timeout(&wakelock, HZ*2); #else wake_lock(&wakelock); #endif modem_sleep_flag = false; spin_lock_irqsave(&xmm_lock, flags); wakeup_pending = false; spin_unlock_irqrestore(&xmm_lock, flags); if (CP_initiated_L2toL0) { pr_info("CP L2->L0\n"); CP_initiated_L2toL0 = false; queue_work(workqueue, &L2_resume_work); #if 0 if (usbdev) { struct usb_interface *intf; intf = usb_ifnum_to_if(usbdev, 0); pr_info("%s: cnt %d intf=%p &intf->dev=%p kobje=%s\n", __func__, atomic_read(&intf->dev.power.usage_count),intf,&intf->dev,kobject_name(&intf->dev.kobj)); } #endif } else { /* set the slave wakeup request */ #ifdef CONFIG_REMOVE_HSIC_L3_STATE pr_info("AP/CP L2->L0\n"); #else pr_info("AP L2->L0\n"); #endif value = gpio_get_value(data->modem.xmm.ipc_ap_wake); if (value) { int ret=0, cptrycount=0, eresyscount=0; const int delay=200, MAXTRY=5, eredelay=3, MAX_ERETRY=100; unsigned long target_jiffies=0; data->pin_state = 0; retry_cpwake: if(cptrycount) { gpio_set_value(data->modem.xmm.ipc_bb_wake, 0); mdelay(1); debug_gpio_dump(); } target_jiffies = jiffies + msecs_to_jiffies(delay); /* wake bb */ gpio_set_value(data->modem.xmm.ipc_bb_wake, 1); retry: /* wait for cp */ pr_info("waiting for host wakeup from CP... <%d,%d>\n", cptrycount, eresyscount); ret = wait_event_interruptible_timeout( data->bb_wait, data->pin_state == 1 || (gpio_get_value(data->modem.xmm.ipc_ap_wake) == 0), MIN( (target_jiffies-jiffies), msecs_to_jiffies(delay) ) ); if (ret == 0) { pr_info("%s: wait for cp ack %d times\n", __func__, cptrycount); debug_gpio_dump(); cptrycount++; if(cptrycount == MAXTRY) { pr_err("!!AP L2->L0 Failed\n"); trigger_radio_fatal_get_coredump(); return; } goto retry_cpwake; } if (ret == -ERESTARTSYS ) { eresyscount++; pr_info("%s: caught signal, sleep and retry %d times\n", __func__, eresyscount); if(eresyscount == MAX_ERETRY) { pr_err("too many ERESTARTSYS <%d>, abort\n", eresyscount); debug_gpio_dump(); trigger_radio_fatal_get_coredump(); return; } msleep(eredelay); goto retry; } pr_info("Get gpio host wakeup low <-\n"); } else { pr_info("CP already ready\n"); } } } static void baseband_xmm_power_shortsusp(struct work_struct *work) { if (!usbdev || !&usbdev->dev) { pr_err("%s usbdev is invalid\n", __func__); return; } pm_runtime_set_autosuspend_delay(&usbdev->dev, short_autosuspend_delay); pr_info("%s set_autosuspend_delay <%d>", __func__, short_autosuspend_delay); } static void baseband_xmm_power_defaultsusp(struct work_struct *work) { if (!usbdev || !&usbdev->dev) { pr_err("%s usbdev is invalid\n", __func__); return; } pm_runtime_set_autosuspend_delay(&usbdev->dev, autosuspend_delay); //pr_info("%s set_autosuspend_delay <%d>", __func__, autosuspend_delay); } /* Do the work for CP initiated L2->L0 */ static void baseband_xmm_power_L2_resume_work(struct work_struct *work) { struct usb_interface *intf; pr_info("%s {\n", __func__); if (!usbdev) { pr_info("%s - !usbdev\n", __func__); return; } usb_lock_device(usbdev); intf = usb_ifnum_to_if(usbdev, 0); if( NULL != intf ){ if (usb_autopm_get_interface(intf) == 0) usb_autopm_put_interface(intf); } usb_unlock_device(usbdev); pr_info("} %s\n", __func__); } static void baseband_xmm_power_reset_on(void) { /* reset / power on sequence */ msleep(40); gpio_set_value(baseband_power_driver_data->modem.xmm.bb_rst, 1); msleep(1); gpio_set_value(baseband_power_driver_data->modem.xmm.bb_on, 1); udelay(40); gpio_set_value(baseband_power_driver_data->modem.xmm.bb_on, 0); } static struct baseband_xmm_power_work_t *baseband_xmm_power_work; static void baseband_xmm_power_work_func(struct work_struct *work) { struct baseband_xmm_power_work_t *bbxmm_work = (struct baseband_xmm_power_work_t *) work; pr_info("%s - work->sate=%d\n", __func__, bbxmm_work->state); switch (bbxmm_work->state) { case BBXMM_WORK_UNINIT: pr_info("BBXMM_WORK_UNINIT\n"); break; case BBXMM_WORK_INIT: pr_info("BBXMM_WORK_INIT\n"); /* go to next state */ bbxmm_work->state = (modem_flash && !modem_pm) ? BBXMM_WORK_INIT_FLASH_STEP1 : (modem_flash && modem_pm) ? BBXMM_WORK_INIT_FLASH_PM_STEP1 : (!modem_flash && modem_pm) ? BBXMM_WORK_INIT_FLASHLESS_PM_STEP1 : BBXMM_WORK_UNINIT; pr_info("Go to next state %d\n", bbxmm_work->state); queue_work(workqueue, work); break; case BBXMM_WORK_INIT_FLASH_STEP1: //pr_info("BBXMM_WORK_INIT_FLASH_STEP1\n"); /* register usb host controller */ pr_info("%s: register usb host controller\n", __func__); if (baseband_power_driver_data->hsic_register) baseband_power_driver_data->modem.xmm.hsic_device = baseband_power_driver_data->hsic_register(); else pr_err("%s: hsic_register is missing\n", __func__); break; case BBXMM_WORK_INIT_FLASH_PM_STEP1: //pr_info("BBXMM_WORK_INIT_FLASH_PM_STEP1\n"); /* [modem ver >= 1130] start with IPC_HSIC_ACTIVE low */ if (modem_ver >= XMM_MODEM_VER_1130) { pr_info("%s: ver > 1130:" " ipc_hsic_active -> 0\n", __func__); gpio_set_value(baseband_power_driver_data-> modem.xmm.ipc_hsic_active, 0); } /* reset / power on sequence */ baseband_xmm_power_reset_on(); /* set power status as on */ power_onoff = 1; /* optional delay * 0 = flashless * ==> causes next step to enumerate modem boot rom * (058b / 0041) * some delay > boot rom timeout * ==> causes next step to enumerate modem software * (1519 / 0020) * (requires modem to be flash version, not flashless * version) */ if (enum_delay_ms) msleep(enum_delay_ms); /* register usb host controller */ pr_info("%s: register usb host controller\n", __func__); if (baseband_power_driver_data->hsic_register) baseband_power_driver_data->modem.xmm.hsic_device = baseband_power_driver_data->hsic_register(); else pr_err("%s: hsic_register is missing\n", __func__); /* go to next state */ bbxmm_work->state = (modem_ver < XMM_MODEM_VER_1130) ? BBXMM_WORK_INIT_FLASH_PM_VER_LT_1130_STEP1 : BBXMM_WORK_INIT_FLASH_PM_VER_GE_1130_STEP1; queue_work(workqueue, work); pr_info("Go to next state %d\n", bbxmm_work->state); break; case BBXMM_WORK_INIT_FLASH_PM_VER_LT_1130_STEP1: pr_info("BBXMM_WORK_INIT_FLASH_PM_VER_LT_1130_STEP1\n"); break; case BBXMM_WORK_INIT_FLASH_PM_VER_GE_1130_STEP1: pr_info("BBXMM_WORK_INIT_FLASH_PM_VER_GE_1130_STEP1\n"); break; case BBXMM_WORK_INIT_FLASHLESS_PM_STEP1: //pr_info("BBXMM_WORK_INIT_FLASHLESS_PM_STEP1\n"); /* go to next state */ bbxmm_work->state = (modem_ver < XMM_MODEM_VER_1130) ? BBXMM_WORK_INIT_FLASHLESS_PM_VER_LT_1130_WAIT_IRQ : BBXMM_WORK_INIT_FLASHLESS_PM_VER_GE_1130_STEP1; queue_work(workqueue, work); break; case BBXMM_WORK_INIT_FLASHLESS_PM_VER_LT_1130_STEP1: pr_info("BBXMM_WORK_INIT_FLASHLESS_PM_VER_LT_1130_STEP1\n"); break; case BBXMM_WORK_INIT_FLASHLESS_PM_VER_GE_1130_STEP1: //pr_info("BBXMM_WORK_INIT_FLASHLESS_PM_VER_GE_1130_STEP1\n"); break; default: break; } } static void baseband_xmm_device_add_handler(struct usb_device *udev) { struct usb_interface *intf = usb_ifnum_to_if(udev, 0); const struct usb_device_id *id; pr_info("%s \n",__func__); if (intf == NULL) return; id = usb_match_id(intf, xmm_pm_ids); if (id) { pr_info("persist_enabled: %u\n", udev->persist_enabled); pr_info("Add device %d <%s %s>\n", udev->devnum, udev->manufacturer, udev->product); usbdev = udev; pm_runtime_set_autosuspend_delay(&udev->dev, autosuspend_delay);//for ICS 39kernel usb_enable_autosuspend(udev); // pr_info("enable autosuspend, timer <%d>", autosuspend_delay); } } static void baseband_xmm_device_remove_handler(struct usb_device *udev) { if (usbdev == udev) { pr_info("Remove device %d <%s %s>\n", udev->devnum, udev->manufacturer, udev->product); usbdev = 0; } } static int usb_xmm_notify(struct notifier_block *self, unsigned long action, void *blob) { switch (action) { case USB_DEVICE_ADD: baseband_xmm_device_add_handler(blob); break; case USB_DEVICE_REMOVE: baseband_xmm_device_remove_handler(blob); break; } return NOTIFY_OK; } static struct notifier_block usb_xmm_nb = { .notifier_call = usb_xmm_notify, }; static int baseband_xmm_power_pm_notifier_event(struct notifier_block *this, unsigned long event, void *ptr) { struct baseband_power_platform_data *data = baseband_power_driver_data; unsigned long flags; if (!data) return NOTIFY_DONE; pr_info("%s: event %ld\n", __func__, event); switch (event) { case PM_SUSPEND_PREPARE: pr_info("%s : PM_SUSPEND_PREPARE\n", __func__); if (wake_lock_active(&wakelock)) { pr_info("%s: wakelock was active, aborting suspend\n",__func__); return NOTIFY_STOP; } spin_lock_irqsave(&xmm_lock, flags); if (wakeup_pending) { wakeup_pending = false; spin_unlock_irqrestore(&xmm_lock, flags); pr_info("%s : XMM busy : Abort system suspend\n", __func__); return NOTIFY_STOP; } system_suspending = true; spin_unlock_irqrestore(&xmm_lock, flags); return NOTIFY_OK; case PM_POST_SUSPEND: pr_info("%s : PM_POST_SUSPEND\n", __func__); spin_lock_irqsave(&xmm_lock, flags); system_suspending = false; if (wakeup_pending && (baseband_xmm_powerstate == BBXMM_PS_L2)) { wakeup_pending = false; spin_unlock_irqrestore(&xmm_lock, flags); pr_info("%s : Service Pending CP wakeup\n", __func__); CP_initiated_L2toL0 = true; baseband_xmm_set_power_status (BBXMM_PS_L2TOL0); return NOTIFY_OK; } wakeup_pending = false; spin_unlock_irqrestore(&xmm_lock, flags); return NOTIFY_OK; } return NOTIFY_DONE; } static struct notifier_block baseband_xmm_power_pm_notifier = { .notifier_call = baseband_xmm_power_pm_notifier_event, }; static int baseband_xmm_power_driver_probe(struct platform_device *device) { struct baseband_power_platform_data *data = (struct baseband_power_platform_data *) device->dev.platform_data; struct device *dev = &device->dev; unsigned long flags; int err, ret=0; pr_info(MODULE_NAME"%s 0705 - xmm_wake_pin_miss. \n", __func__); // pr_info(MODULE_NAME"enum_delay_ms=%d\n", enum_delay_ms); htcpcbid=htc_get_pcbid_info(); pr_info(MODULE_NAME"htcpcbid=%d\n", htcpcbid); /* check for platform data */ if (!data) return -ENODEV; /* check if supported modem */ if (data->baseband_type != BASEBAND_XMM) { pr_err("unsuppported modem\n"); return -ENODEV; } /* save platform data */ baseband_power_driver_data = data; /* init wait queue */ data->pin_state = 1; init_waitqueue_head(&data->bb_wait); /* create device file */ err = device_create_file(dev, &dev_attr_xmm_onoff); if (err < 0) { pr_err("%s - device_create_file failed\n", __func__); return -ENODEV; } err = device_create_file(dev, &dev_attr_debug_handler); if (err < 0) { pr_err("%s - device_create_file failed\n", __func__); return -ENODEV; } /* HTC: create device file for host debugging */ if (device_create_file(dev,&dev_attr_host_dbg)) pr_info(MODULE_NAME"Warning: host attribute can't be created\n"); /* init wake lock */ wake_lock_init(&wakelock, WAKE_LOCK_SUSPEND, "baseband_xmm_power"); /* init spin lock */ spin_lock_init(&xmm_lock); /* request baseband gpio(s) */ tegra_baseband_gpios[0].gpio = baseband_power_driver_data ->modem.xmm.bb_rst; tegra_baseband_gpios[1].gpio = baseband_power_driver_data ->modem.xmm.bb_on; tegra_baseband_gpios[2].gpio = baseband_power_driver_data ->modem.xmm.ipc_bb_wake; tegra_baseband_gpios[3].gpio = baseband_power_driver_data ->modem.xmm.ipc_ap_wake; tegra_baseband_gpios[4].gpio = baseband_power_driver_data ->modem.xmm.ipc_hsic_active; tegra_baseband_gpios[5].gpio = baseband_power_driver_data ->modem.xmm.ipc_hsic_sus_req; tegra_baseband_gpios[6].gpio = baseband_power_driver_data ->modem.xmm.bb_vdd_en; tegra_baseband_gpios[7].gpio = baseband_power_driver_data ->modem.xmm.bb_rst_pwrdn; tegra_baseband_gpios[8].gpio = baseband_power_driver_data ->modem.xmm.bb_rst2; /*HTC request these gpio on probe only, config them when running power_on/off function*/ err = gpio_request_only_array(tegra_baseband_gpios, ARRAY_SIZE(tegra_baseband_gpios)); if (err < 0) { pr_err("%s - request gpio(s) failed\n", __func__); return -ENODEV; } #if 1/*HTC*/ //assing for usb tegra_baseband_gpios_power_off_modem[0].gpio = baseband_power_driver_data ->modem.xmm.bb_rst; tegra_baseband_gpios_power_off_modem[1].gpio = baseband_power_driver_data ->modem.xmm.bb_on; tegra_baseband_gpios_power_off_modem[2].gpio = baseband_power_driver_data ->modem.xmm.ipc_bb_wake; tegra_baseband_gpios_power_off_modem[3].gpio = baseband_power_driver_data ->modem.xmm.ipc_ap_wake; tegra_baseband_gpios_power_off_modem[4].gpio = baseband_power_driver_data ->modem.xmm.ipc_hsic_active; tegra_baseband_gpios_power_off_modem[5].gpio = baseband_power_driver_data ->modem.xmm.ipc_hsic_sus_req; tegra_baseband_gpios_power_off_modem[6].gpio = baseband_power_driver_data ->modem.xmm.bb_vdd_en; tegra_baseband_gpios_power_off_modem[7].gpio = baseband_power_driver_data ->modem.xmm.bb_rst_pwrdn; tegra_baseband_gpios_power_off_modem[8].gpio = baseband_power_driver_data ->modem.xmm.bb_rst2; //request UART pr_info("%s request UART\n", __func__); err =gpio_request(TEGRA_GPIO_PJ7, "IMC_UART_TX"); err =gpio_request(TEGRA_GPIO_PK7, "IMC_UART_RTS"); err =gpio_request(TEGRA_GPIO_PB0 ,"IMC_UART_RX"); err =gpio_request(TEGRA_GPIO_PB1, "IMC_UART_CTS"); pr_info("%s pull UART o d\n", __func__); //for power consumation //all the needed config put on power_on function pr_info("%s config_gpio_for_power_off\n", __func__); err=config_gpio_for_power_off(); if (err < 0) { pr_err("%s - config_gpio_for_power_off gpio(s)\n", __func__); return -ENODEV; } #endif/*HTC*/ /* request baseband irq(s) */ if (modem_flash && modem_pm) { pr_info("%s: request_irq IPC_AP_WAKE_IRQ\n", __func__); ipc_ap_wake_state = IPC_AP_WAKE_UNINIT; err = request_threaded_irq( gpio_to_irq(data->modem.xmm.ipc_ap_wake), baseband_xmm_power_ipc_ap_wake_irq, NULL, IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, "IPC_AP_WAKE_IRQ", NULL); if (err < 0) { pr_err("%s - request irq IPC_AP_WAKE_IRQ failed\n", __func__); return err; } ipc_ap_wake_state = IPC_AP_WAKE_IRQ_READY; if (modem_ver >= XMM_MODEM_VER_1130) { pr_info("%s: ver > 1130: AP_WAKE_INIT1\n", __func__); /* ver 1130 or later starts in INIT1 state */ ipc_ap_wake_state = IPC_AP_WAKE_INIT1; } } /* init work queue */ workqueue = create_singlethread_workqueue("baseband_xmm_power_workqueue"); if (!workqueue) { pr_err("cannot create workqueue\n"); return -1; } workqueue_susp = alloc_workqueue("baseband_xmm_power_autosusp", WQ_UNBOUND | WQ_HIGHPRI | WQ_NON_REENTRANT, 1); if (!workqueue_susp) { pr_err("cannot create workqueue_susp\n"); return -1; } workqueue_debug = create_singlethread_workqueue("baseband_xmm_power_debug"); if (!workqueue_debug) { pr_err("cannot create workqueue_debug\n"); return -1; } baseband_xmm_power_work = (struct baseband_xmm_power_work_t *) kmalloc(sizeof(struct baseband_xmm_power_work_t), GFP_KERNEL); if (!baseband_xmm_power_work) { pr_err("cannot allocate baseband_xmm_power_work\n"); return -1; } INIT_WORK((struct work_struct *) baseband_xmm_power_work, baseband_xmm_power_work_func); baseband_xmm_power_work->state = BBXMM_WORK_INIT; queue_work(workqueue, (struct work_struct *) baseband_xmm_power_work); /* init work objects */ INIT_WORK(&init1_work, baseband_xmm_power_init1_work); INIT_WORK(&init2_work, baseband_xmm_power_init2_work); INIT_WORK(&L2_resume_work, baseband_xmm_power_L2_resume_work); INIT_WORK(&work_shortsusp, baseband_xmm_power_shortsusp); INIT_WORK(&work_defaultsusp, baseband_xmm_power_defaultsusp); INIT_WORK(&work_reset_host_active, baseband_xmm_power_reset_host_active_work); /* init state variables */ register_hsic_device = true; CP_initiated_L2toL0 = false; baseband_xmm_powerstate = BBXMM_PS_UNINIT; spin_lock_irqsave(&xmm_lock, flags); wakeup_pending = false; system_suspending = false; spin_unlock_irqrestore(&xmm_lock, flags); usb_register_notify(&usb_xmm_nb); register_pm_notifier(&baseband_xmm_power_pm_notifier); /*HTC*/ /*set Radio fatal Pin PN2 to OutPut Low*/ ret=gpio_direction_output(TEGRA_GPIO_PN2,0); if (ret < 0) pr_err("%s: set Radio fatal Pin to Output error\n", __func__); /*set BB2AP_SUSPEND_REQ Pin (TEGRA_GPIO_PV0) to OutPut Low*/ ret=gpio_direction_output(TEGRA_GPIO_PV0,0); if (ret < 0) pr_err("%s: set BB2AP_SUSPEND_REQ Pin to Output error\n", __func__); //Request SIM det to wakeup Source wahtever in flight mode on/off /*For SIM det*/ pr_info("%s: request enable irq wake SIM det to wakeup source\n", __func__); ret = enable_irq_wake(gpio_to_irq(TEGRA_GPIO_PI5)); if (ret < 0) pr_err("%s: enable_irq_wake error\n", __func__); pr_info("%s: init kobj for silent reset", __func__); silent_reset_kset = kset_create_and_add("SilentResetKset", NULL, NULL); if(!silent_reset_kset) { pr_err("%s: silent_reset_kset create failure.", __func__); } else { silent_reset_kobj = kobject_create_and_add("SilentResetTrigger", kobject_get(&dev->kobj)); if(!silent_reset_kobj) { pr_err("%s: silent_reset_kobj create failure.", __func__); kset_unregister(silent_reset_kset); silent_reset_kset = NULL; } else silent_reset_kobj->kset = silent_reset_kset; } pr_info("%s }\n", __func__); return 0; } static int baseband_xmm_power_driver_remove(struct platform_device *device) { struct baseband_power_platform_data *data = (struct baseband_power_platform_data *) device->dev.platform_data; struct device *dev = &device->dev; pr_info("%s\n", __func__); /* check for platform data */ if (!data) return 0; unregister_pm_notifier(&baseband_xmm_power_pm_notifier); usb_unregister_notify(&usb_xmm_nb); /* free work structure */ kfree(baseband_xmm_power_work); baseband_xmm_power_work = (struct baseband_xmm_power_work_t *) 0; /* free baseband irq(s) */ if (modem_flash && modem_pm) { free_irq(gpio_to_irq(baseband_power_driver_data ->modem.xmm.ipc_ap_wake), NULL); } /* free baseband gpio(s) */ gpio_free_array(tegra_baseband_gpios, ARRAY_SIZE(tegra_baseband_gpios)); /* destroy wake lock */ wake_lock_destroy(&wakelock); /* delete device file */ device_remove_file(dev, &dev_attr_xmm_onoff); device_remove_file(dev, &dev_attr_debug_handler); /* HTC: delete device file */ device_remove_file(dev, &dev_attr_host_dbg); /* destroy wake lock */ destroy_workqueue(workqueue_susp); destroy_workqueue(workqueue); if(silent_reset_kset) { kset_unregister(silent_reset_kset); silent_reset_kset = NULL; } if(silent_reset_kobj) { kobject_put(silent_reset_kobj); kobject_put(&dev->kobj); } /* unregister usb host controller */ if (data->hsic_unregister && data->modem.xmm.hsic_device) { data->hsic_unregister(data->modem.xmm.hsic_device); data->modem.xmm.hsic_device = NULL; } else pr_err("%s: hsic_unregister is missing\n", __func__); return 0; } #ifndef CONFIG_REMOVE_HSIC_L3_STATE static int baseband_xmm_power_driver_handle_resume( struct baseband_power_platform_data *data) { int value; unsigned long flags; unsigned long timeout; int delay = 10000; /* maxmum delay in msec */ //pr_info("%s\n", __func__); /* check for platform data */ if (!data) return 0; /* check if modem is on */ if (power_onoff == 0) { pr_info("%s - flight mode - nop\n", __func__); return 0; } modem_sleep_flag = false; spin_lock_irqsave(&xmm_lock, flags); /* Clear wakeup pending flag */ wakeup_pending = false; spin_unlock_irqrestore(&xmm_lock, flags); /* L3->L0 */ baseband_xmm_set_power_status(BBXMM_PS_L3TOL0); value = gpio_get_value(data->modem.xmm.ipc_ap_wake); if (value) { pr_info("AP L3 -> L0\n"); pr_info("waiting for host wakeup...\n"); timeout = jiffies + msecs_to_jiffies(delay); /* wake bb */ gpio_set_value(data->modem.xmm.ipc_bb_wake, 1); pr_info("Set bb_wake high ->\n"); do { udelay(100); value = gpio_get_value(data->modem.xmm.ipc_ap_wake); if (!value) break; } while (time_before(jiffies, timeout)); if (!value) { pr_info("gpio host wakeup low <-\n"); pr_info("%s enable short_autosuspend\n", __func__); short_autosuspend = true; } else pr_info("!!AP L3->L0 Failed\n"); } else { pr_info("CP L3 -> L0\n"); } reenable_autosuspend = true; return 0; } #endif #ifdef CONFIG_PM #ifdef CONFIG_REMOVE_HSIC_L3_STATE static int baseband_xmm_power_driver_suspend(struct device *dev) { // int delay = 10000; /* maxmum delay in msec */ // struct platform_device *pdev = to_platform_device(dev); //struct baseband_power_platform_data *pdata = pdev->dev.platform_data; //pr_info("%s\n", __func__); /* check if modem is on */ if (power_onoff == 0) { pr_info("%s - flight mode - nop\n", __func__); return 0; } /* PMC is driving hsic bus * tegra_baseband_rail_off(); */ return 0; } #else static int baseband_xmm_power_driver_suspend(struct device *dev) { pr_info("%s\n", __func__); return 0; } #endif /* CONFIG_REMOVE_HSIC_L3_STATE */ static int baseband_xmm_power_driver_resume(struct device *dev) { //struct platform_device *pdev = to_platform_device(dev); //struct baseband_power_platform_data *data // = (struct baseband_power_platform_data *) // pdev->dev.platform_data; pr_info("%s\n", __func__); #ifdef CONFIG_REMOVE_HSIC_L3_STATE /* check if modem is on */ if (power_onoff == 0) { pr_info("%s - flight mode - nop\n", __func__); return 0; } /* PMC is driving hsic bus * tegra_baseband_rail_on(); */ reenable_autosuspend = true; #else baseband_xmm_power_driver_handle_resume(data); #endif return 0; } static int baseband_xmm_power_suspend_noirq(struct device *dev) { unsigned long flags; pr_info("%s\n", __func__); spin_lock_irqsave(&xmm_lock, flags); system_suspending = false; if (wakeup_pending) { wakeup_pending = false; spin_unlock_irqrestore(&xmm_lock, flags); pr_info("%s:**Abort Suspend: reason CP WAKEUP**\n", __func__); return -EBUSY; } spin_unlock_irqrestore(&xmm_lock, flags); return 0; } static int baseband_xmm_power_resume_noirq(struct device *dev) { pr_info("%s\n", __func__); return 0; } static const struct dev_pm_ops baseband_xmm_power_dev_pm_ops = { .suspend_noirq = baseband_xmm_power_suspend_noirq, .resume_noirq = baseband_xmm_power_resume_noirq, .suspend = baseband_xmm_power_driver_suspend, .resume = baseband_xmm_power_driver_resume, }; #endif static struct platform_driver baseband_power_driver = { .probe = baseband_xmm_power_driver_probe, .remove = baseband_xmm_power_driver_remove, .driver = { .name = "baseband_xmm_power", #ifdef CONFIG_PM .pm = &baseband_xmm_power_dev_pm_ops, #endif }, }; static int __init baseband_xmm_power_init(void) { /* HTC */ int mfg_mode = board_mfg_mode(); host_dbg_flag = 0; //pr_info("%s - host_dbg_flag<0x%x>, modem_ver<0x%x>, mfg_mode<%d>" // , __func__, host_dbg_flag, modem_ver, mfg_mode); if( mfg_mode ) { autosuspend_delay = 365*86400; short_autosuspend_delay = 365*86400; //pr_info("In MFG mode, autosuspend_delay <%d>, short_autosuspend_delay <%d>" // , autosuspend_delay, short_autosuspend_delay ); } s_sku_id = board_get_sku_tag(); pr_info("SKU_ID is 0x%x", s_sku_id); //printk("%s:VP adding pm qos request removed\n", __func__); //pm_qos_add_request(&modem_boost_cpu_freq_req, PM_QOS_CPU_FREQ_MIN, (s32)PM_QOS_CPU_FREQ_MIN_DEFAULT_VALUE); return platform_driver_register(&baseband_power_driver); } static void __exit baseband_xmm_power_exit(void) { pr_info("%s\n", __func__); platform_driver_unregister(&baseband_power_driver); //pm_qos_remove_request(&modem_boost_cpu_freq_req); } module_init(baseband_xmm_power_init) module_exit(baseband_xmm_power_exit)
bedalus/hxore
arch/arm/mach-tegra/baseband-xmm-power.c
C
gpl-2.0
61,756
27.134852
121
0.646512
false
include ../../../Makefile.inc CLC_ROOT = ../../../inc all: exe_src exe_src_m2s exe_bin amd_compile m2c_compile run_m2s run_native check_result exe_src: @-$(CC) $(CC_FLAG) *src.c -o exe_src $(CC_INC) $(CC_LIB) > isgreaterequal_floatfloat.exe_src.log 2>&1 exe_src_m2s: @-$(CC) $(CC_FLAG) -m32 *src.c -o exe_src_m2s $(CC_INC) $(M2S_LIB) > isgreaterequal_floatfloat.exe_src_m2s.log 2>&1 exe_bin: @-$(CC) $(CC_FLAG) *bin.c -o exe_bin $(CC_INC) $(CC_LIB) > isgreaterequal_floatfloat.exe_bin.log 2>&1 amd_compile: @-$(AMD_CC) --amd --amd-dump-all --amd-device 11 isgreaterequal_floatfloat.cl > isgreaterequal_floatfloat.amdcc.log 2>&1 @-rm -rf /tmp/*.clp && rm -rf /tmp/*_amd_files m2c_compile: @-python compile.py run_m2s: @-M2S_OPENCL_BINARY=./isgreaterequal_floatfloat.opt.bin $(M2S) --si-sim functional ./exe_src_m2s > m2s.log 2>&1 run_native: @-./exe_src > native.log 2>&1 check_result: @-diff exe_src.result exe_src_m2s.result > check.log 2>&1 clean: rm -rf exe_src exe_src_m2s exe_bin *.ll *.log *files *bin *.s *.bc *.result
xianggong/m2c_unit_test
test/relational/isgreaterequal_floatfloat/Makefile
Makefile
gpl-2.0
1,047
30.727273
121
0.655205
false
# coding=utf-8 # --------------------------------------------------------------- # Desenvolvedor: Arannã Sousa Santos # Mês: 12 # Ano: 2015 # Projeto: pagseguro_xml # e-mail: asousas@live.com # --------------------------------------------------------------- import logging from pagseguro_xml.notificacao import ApiPagSeguroNotificacao_v3, CONST_v3 logger = logging.basicConfig(level=logging.DEBUG) PAGSEGURO_API_AMBIENTE = u'sandbox' PAGSEGURO_API_EMAIL = u'seu@email.com' PAGSEGURO_API_TOKEN_PRODUCAO = u'' PAGSEGURO_API_TOKEN_SANDBOX = u'' CHAVE_NOTIFICACAO = u'AA0000-AA00A0A0AA00-AA00AA000000-AA0000' # ela éh de producao api = ApiPagSeguroNotificacao_v3(ambiente=CONST_v3.AMBIENTE.SANDBOX) PAGSEGURO_API_TOKEN = PAGSEGURO_API_TOKEN_PRODUCAO ok, retorno = api.consulta_notificacao_transacao_v3(PAGSEGURO_API_EMAIL, PAGSEGURO_API_TOKEN, CHAVE_NOTIFICACAO) if ok: print u'-' * 50 print retorno.xml print u'-' * 50 for a in retorno.alertas: print a else: print u'Motivo do erro:', retorno
arannasousa/pagseguro_xml
exemplos/testes_notificacao.py
Python
gpl-2.0
1,090
24.27907
112
0.613615
false
<?php /** * @package Mambo * @author Mambo Foundation Inc see README.php * @copyright Mambo Foundation Inc. * See COPYRIGHT.php for copyright notices and details. * @license GNU/GPL Version 2, see LICENSE.php * Mambo is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; version 2 of the License. */ /** ensure this file is being included by a parent file */ defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' ); /** * AWSTATS BROWSERS DATABASE * If you want to add a Browser to extend AWStats database detection capabilities, * you must add an entry in BrowsersSearchIDOrder and in BrowsersHashIDLib. * * * BrowsersSearchIDOrder * This list is used to know in which order to search Browsers IDs (Most * frequent one are first in this list to increase detect speed). * It contains all matching criteria to search for in log fields. * Note: Browsers IDs are in lower case and ' ' and '+' are changed into '_' */ $browserSearchOrder = array ( // Most frequent standard web browsers are first in this list "icab", "go!zilla", "konqueror", "links", "lynx", "omniweb", "opera", "msie 6\.0", "apachebench", "wget", // Other standard web browsers "22acidownload", "aol\\-iweng", "amaya", "amigavoyager", "aweb", "bpftp", "chimera", "cyberdog", "dillo", "dreamcast", "downloadagent", "ecatch", "emailsiphon", "encompass", "friendlyspider", "fresco", "galeon", "getright", "headdump", "hotjava", "ibrowse", "intergo", "k-meleon", "linemodebrowser", "lotus-notes", "macweb", "multizilla", "ncsa_mosaic", "netpositive", "nutscrape", "msfrontpageexpress", "phoenix", "firebird", "firefox", "safari", "tzgeturl", "viking", "webfetcher", "webexplorer", "webmirror", "webvcr", // Site grabbers "teleport", "webcapture", "webcopier", // Music only browsers "real", "winamp", // Works for winampmpeg and winamp3httprdr "windows-media-player", "audion", "freeamp", "itunes", "jetaudio", "mint_audio", "mpg123", "nsplayer", "sonique", "uplayer", "xmms", "xaudio", // PDA/Phonecell browsers "alcatel", // Alcatel "mot-", // Motorola "nokia", // Nokia "panasonic", // Panasonic "philips", // Philips "sonyericsson", // SonyEricsson "ericsson", // Ericsson (must be after sonyericsson "mmef", "mspie", "wapalizer", "wapsilon", "webcollage", "up\.", // Works for UP.Browser and UP.Link // PDA/Phonecell I-Mode browsers "docomo", "portalmmm", // Others (TV) "webtv", // Other kind of browsers "csscheck", "w3m", "w3c_css_validator", "w3c_validator", "wdg_validator", "webzip", "staroffice", "mozilla", // Must be at end because a lot of browsers contains mozilla in string "libwww" // Must be at end because some browser have both "browser id" and "libwww" ); $browsersAlias = array ( // Common web browsers text (IE and Netscape must not be in this list) "icab"=>"iCab", "go!zilla"=>"Go!Zilla", "konqueror"=>"Konqueror", "links"=>"Links", "lynx"=>"Lynx", "omniweb"=>"OmniWeb", "opera"=>"Opera", "msie 6\.0"=>"Microsoft Internet Explorer 6.0", "apachebench"=>"ApacheBench", "wget"=>"Wget", "22acidownload"=>"22AciDownload", "aol\\-iweng"=>"AOL-Iweng", "amaya"=>"Amaya", "amigavoyager"=>"AmigaVoyager", "aweb"=>"AWeb", "bpftp"=>"BPFTP", "chimera"=>"Chimera", "cyberdog"=>"Cyberdog", "dillo"=>"Dillo", "dreamcast"=>"Dreamcast", "downloadagent"=>"DownloadAgent", "ecatch", "eCatch", "emailsiphon"=>"EmailSiphon", "encompass"=>"Encompass", "friendlyspider"=>"FriendlySpider", "fresco"=>"ANT Fresco", "galeon"=>"Galeon", "getright"=>"GetRight", "headdump"=>"HeadDump", "hotjava"=>"Sun HotJava", "ibrowse"=>"IBrowse", "intergo"=>"InterGO", "k-meleon"=>"K-Meleon", "linemodebrowser"=>"W3C Line Mode Browser", "lotus-notes"=>"Lotus Notes web client", "macweb"=>"MacWeb", "multizilla"=>"MultiZilla", "ncsa_mosaic"=>"NCSA Mosaic", "netpositive"=>"NetPositive", "nutscrape", "Nutscrape", "msfrontpageexpress"=>"MS FrontPage Express", "phoenix"=>"Phoenix", "firebird"=>"Mozilla Firebird", "firefox"=>"Mozilla Firefox", "safari"=>"Safari", "tzgeturl"=>"TzGetURL", "viking"=>"Viking", "webfetcher"=>"WebFetcher", "webexplorer"=>"IBM-WebExplorer", "webmirror"=>"WebMirror", "webvcr"=>"WebVCR", // Site grabbers "teleport"=>"TelePort Pro", "webcapture"=>"Acrobat", "webcopier", "WebCopier", // Music only browsers "real"=>"RealAudio or compatible (media player)", "winamp"=>"WinAmp (media player)", // Works for winampmpeg and winamp3httprdr "windows-media-player"=>"Windows Media Player (media player)", "audion"=>"Audion (media player)", "freeamp"=>"FreeAmp (media player)", "itunes"=>"Apple iTunes (media player)", "jetaudio"=>"JetAudio (media player)", "mint_audio"=>"Mint Audio (media player)", "mpg123"=>"mpg123 (media player)", "nsplayer"=>"NetShow Player (media player)", "sonique"=>"Sonique (media player)", "uplayer"=>"Ultra Player (media player)", "xmms"=>"XMMS (media player)", "xaudio"=>"Some XAudio Engine based MPEG player (media player)", // PDA/Phonecell browsers "alcatel"=>"Alcatel Browser (PDA/Phone browser)", "ericsson"=>"Ericsson Browser (PDA/Phone browser)", "mot-"=>"Motorola Browser (PDA/Phone browser)", "nokia"=>"Nokia Browser (PDA/Phone browser)", "panasonic"=>"Panasonic Browser (PDA/Phone browser)", "philips"=>"Philips Browser (PDA/Phone browser)", "sonyericsson"=>"Sony/Ericsson Browser (PDA/Phone browser)", "mmef"=>"Microsoft Mobile Explorer (PDA/Phone browser)", "mspie"=>"MS Pocket Internet Explorer (PDA/Phone browser)", "wapalizer"=>"WAPalizer (PDA/Phone browser)", "wapsilon"=>"WAPsilon (PDA/Phone browser)", "webcollage"=>"WebCollage (PDA/Phone browser)", "up\."=>"UP.Browser (PDA/Phone browser)", // Works for UP.Browser and UP.Link // PDA/Phonecell I-Mode browsers "docomo"=>"I-Mode phone (PDA/Phone browser)", "portalmmm"=>"I-Mode phone (PDA/Phone browser)", // Others (TV) "webtv"=>"WebTV browser", // Other kind of browsers "csscheck"=>"WDG CSS Validator", "w3m"=>"w3m", "w3c_css_validator"=>"W3C CSS Validator", "w3c_validator"=>"W3C HTML Validator", "wdg_validator"=>"WDG HTML Validator", "webzip"=>"WebZIP", "staroffice"=>"StarOffice", "mozilla"=>"Mozilla", "libwww"=>"LibWWW", ); // BrowsersHashAreGrabber // Put here an entry for each browser in BrowsersSearchIDOrder that are grabber // browsers. //--------------------------------------------------------------------------- $BrowsersHereAreGrabbers = array ( "teleport"=>"1", "webcapture"=>"1", "webcopier"=>"1", ); // BrowsersHashIcon // Each Browsers Search ID is associated to a string that is the name of icon // file for this browser. //--------------------------------------------------------------------------- $BrowsersHashIcon = array ( // Standard web browsers "msie"=>"msie", "netscape"=>"netscape", "icab"=>"icab", "go!zilla"=>"gozilla", "konqueror"=>"konqueror", "links"=>"notavailable", "lynx"=>"lynx", "omniweb"=>"omniweb", "opera"=>"opera", "wget"=>"notavailable", "22acidownload"=>"notavailable", "aol\\-iweng"=>"notavailable", "amaya"=>"amaya", "amigavoyager"=>"notavailable", "aweb"=>"notavailable", "bpftp"=>"notavailable", "chimera"=>"chimera", "cyberdog"=>"notavailable", "dillo"=>"notavailable", "dreamcast"=>"dreamcast", "downloadagent"=>"notavailable", "ecatch"=>"notavailable", "emailsiphon"=>"notavailable", "encompass"=>"notavailable", "friendlyspider"=>"notavailable", "fresco"=>"notavailable", "galeon"=>"galeon", "getright"=>"getright", "headdump"=>"notavailable", "hotjava"=>"notavailable", "ibrowse"=>"ibrowse", "intergo"=>"notavailable", "k-meleon"=>"kmeleon", "linemodebrowser"=>"notavailable", "lotus-notes"=>"notavailable", "macweb"=>"notavailable", "multizilla"=>"multizilla", "ncsa_mosaic"=>"notavailable", "netpositive"=>"netpositive", "nutscrape"=>"notavailable", "msfrontpageexpress"=>"notavailable", "phoenix"=>"phoenix", "firebird"=>"firebird", "safari"=>"safari", "tzgeturl"=>"notavailable", "viking"=>"notavailable", "webfetcher"=>"notavailable", "webexplorer"=>"notavailable", "webmirror"=>"notavailable", "webvcr"=>"notavailable", // Site grabbers "teleport"=>"teleport", "webcapture"=>"adobe", "webcopier"=>"webcopier", // Music only browsers "real"=>"mediaplayer", "winamp"=>"mediaplayer", // Works for winampmpeg and winamp3httprdr "windows-media-player"=>"mediaplayer", "audion"=>"mediaplayer", "freeamp"=>"mediaplayer", "itunes"=>"mediaplayer", "jetaudio"=>"mediaplayer", "mint_audio"=>"mediaplayer", "mpg123"=>"mediaplayer", "nsplayer"=>"mediaplayer", "sonique"=>"mediaplayer", "uplayer"=>"mediaplayer", "xmms"=>"mediaplayer", "xaudio"=>"mediaplayer", // PDA/Phonecell browsers "alcatel"=>"pdaphone", // Alcatel "ericsson"=>"pdaphone", // Ericsson "mot-"=>"pdaphone", // Motorola "nokia"=>"pdaphone", // Nokia "panasonic"=>"pdaphone", // Panasonic "philips"=>"pdaphone", // Philips "sonyericsson"=>"pdaphone", // Sony/Ericsson "mmef"=>"pdaphone", "mspie"=>"pdaphone", "wapalizer"=>"pdaphone", "wapsilon"=>"pdaphone", "webcollage"=>"pdaphone", "up\."=>"pdaphone", // Works for UP.Browser and UP.Link // PDA/Phonecell I-Mode browsers "docomo"=>"pdaphone", "portalmmm"=>"pdaphone", // Others (TV) "webtv"=>"webtv", // Other kind of browsers "csscheck"=>"notavailable", "w3m"=>"notavailable", "w3c_css_validator"=>"notavailable", "w3c_validator"=>"notavailable", "wdg_validator"=>"notavailable", "webzip"=>"webzip", "staroffice"=>"staroffice", "mozilla"=>"mozilla", "libwww"=>"notavailable" ); // TODO // Add Gecko category -> IE / Netscape / Gecko(except Netscape) / Other // IE (based on Mosaic) // Netscape family // Gecko except Netscape (Mozilla, Firebird (was Phoenix), Galeon, AmiZilla, Dino, and few others) // Opera (Opera 6/7) // KHTML (Konqueror, Safari) ?>
chanhong/mambo
includes/agent_browser.php
PHP
gpl-2.0
9,696
25.713499
98
0.678837
false
<style type="text/css"> .ppsAdminMainLeftSide { width: 56%; float: left; } .ppsAdminMainRightSide { width: <?php echo (empty($this->optsDisplayOnMainPage) ? 100 : 40)?>%; float: left; text-align: center; } #ppsMainOccupancy { box-shadow: none !important; } </style> <section> <div class="supsystic-item supsystic-panel"> <div id="containerWrapper"> <?php _e('Main page Go here!!!!', PPS_LANG_CODE)?> </div> <div style="clear: both;"></div> </div> </section>
Sciado/whitelabelheros.com
wp-content/plugins/popup-by-supsystic/modules/options/views/tpl/optionsAdminMain.php
PHP
gpl-2.0
486
21.136364
72
0.641975
false
/*************************************************************************** * * Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, * 2010, 2011 BalaBit IT Ltd, Budapest, Hungary * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 as published * by the Free Software Foundation. * * Note that this permission is granted for only version 2 of the GPL. * * As an additional exemption you are allowed to compile & link against the * OpenSSL libraries as published by the OpenSSL project. See the file * COPYING for details. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * Author : Panther * Auditor : * Last audited version: * Notes: * ***************************************************************************/ #ifndef ZORP_ZORPADDR_H_INCLUDED #define ZORP_ZORPADDR_H_INCLUDED #include "ifcfg.h" #include "zshmem.h" #include "cfg.h" #include "stats.h" #endif
kkovaacs/zorp
zorpaddr/zorpaddr.h
C
gpl-2.0
1,392
33.8
77
0.648707
false
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"> <!--NewPage--> <HTML> <HEAD> <!-- Generated by javadoc on Sat Aug 06 17:04:40 EDT 2005 --> <TITLE> Xalan-Java 2.7.0: Uses of Class org.apache.xml.serializer.utils.SystemIDResolver </TITLE> <LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../../stylesheet.css" TITLE="Style"> </HEAD> <BODY BGCOLOR="white"> <!-- ========== START OF NAVBAR ========== --> <A NAME="navbar_top"><!-- --></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0"> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_top_firstrow"><!-- --></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3"> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../org/apache/xml/serializer/utils/SystemIDResolver.html"><FONT CLASS="NavBarFont1"><B>Class</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> &nbsp;PREV&nbsp; &nbsp;NEXT</FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../../../index.html" TARGET="_top"><B>FRAMES</B></A> &nbsp; &nbsp;<A HREF="SystemIDResolver.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD> </TR> </TABLE> <!-- =========== END OF NAVBAR =========== --> <HR> <CENTER> <H2> <B>Uses of Class<br>org.apache.xml.serializer.utils.SystemIDResolver</B></H2> </CENTER> No usage of org.apache.xml.serializer.utils.SystemIDResolver <P> <HR> <!-- ========== START OF NAVBAR ========== --> <A NAME="navbar_bottom"><!-- --></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0"> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_bottom_firstrow"><!-- --></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3"> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../org/apache/xml/serializer/utils/SystemIDResolver.html"><FONT CLASS="NavBarFont1"><B>Class</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> &nbsp;PREV&nbsp; &nbsp;NEXT</FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../../../index.html" TARGET="_top"><B>FRAMES</B></A> &nbsp; &nbsp;<A HREF="SystemIDResolver.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD> </TR> </TABLE> <!-- =========== END OF NAVBAR =========== --> <HR> Copyright © 2005 Apache XML Project. All Rights Reserved. </BODY> </HTML>
MrStaticVoid/iriverter
lib/xalan-j_2_7_0/docs/apidocs/org/apache/xml/serializer/utils/class-use/SystemIDResolver.html
HTML
gpl-2.0
4,673
48.189474
190
0.604537
false
/* * Copyright (C) 2008-2014 TrinityCore <http://www.trinitycore.org/> * Copyright (C) 2006-2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/> * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2 of the License, or (at your * option) any later version. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along * with this program. If not, see <http://www.gnu.org/licenses/>. */ /* ScriptData SDName: Npc_Taxi SD%Complete: 0% SDComment: To be used for taxi NPCs that are located globally. SDCategory: NPCs EndScriptData */ #include "ScriptMgr.h" #include "ScriptedCreature.h" #include "ScriptedGossip.h" #include "Player.h" #include "WorldSession.h" #define GOSSIP_SUSURRUS "I am ready." #define GOSSIP_NETHER_DRAKE "I'm ready to fly! Take me up, dragon!" #define GOSSIP_BRAZEN "I am ready to go to Durnholde Keep." #define GOSSIP_IRONWING "I'd like to take a flight around Stormwind Harbor." #define GOSSIP_DABIREE1 "Fly me to Murketh and Shaadraz Gateways" #define GOSSIP_DABIREE2 "Fly me to Shatter Point" #define GOSSIP_WINDBELLOW1 "Fly me to The Abyssal Shelf" #define GOSSIP_WINDBELLOW2 "Fly me to Honor Point" #define GOSSIP_BRACK1 "Fly me to Murketh and Shaadraz Gateways" #define GOSSIP_BRACK2 "Fly me to The Abyssal Shelf" #define GOSSIP_BRACK3 "Fly me to Spinebreaker Post" #define GOSSIP_IRENA "Fly me to Skettis please" #define GOSSIP_CLOUDBREAKER1 "Speaking of action, I've been ordered to undertake an air strike." #define GOSSIP_CLOUDBREAKER2 "I need to intercept the Dawnblade reinforcements." #define GOSSIP_DRAGONHAWK "<Ride the dragonhawk to Sun's Reach>" #define GOSSIP_VERONIA "Fly me to Manaforge Coruu please" #define GOSSIP_DEESAK "Fly me to Ogri'la please" #define GOSSIP_AFRASASTRASZ1 "I would like to take a flight to the ground, Lord Of Afrasastrasz." #define GOSSIP_AFRASASTRASZ2 "My Lord, I must go to the upper floor of the temple." #define GOSSIP_TARIOLSTRASZ1 "My Lord, I must go to the upper floor of the temple." #define GOSSIP_TARIOLSTRASZ2 "Can you spare a drake to travel to Lord Of Afrasastrasz, in the middle of the temple?" #define GOSSIP_TORASTRASZA1 "I would like to see Lord Of Afrasastrasz, in the middle of the temple." #define GOSSIP_TORASTRASZA2 "Yes, Please. I would like to return to the ground floor of the temple." #define GOSSIP_CRIMSONWING "<Ride the gryphons to Survey Alcaz Island>" #define GOSSIP_WILLIAMKEILAR1 "Take me to Northpass Tower." #define GOSSIP_WILLIAMKEILAR2 "Take me to Eastwall Tower." #define GOSSIP_WILLIAMKEILAR3 "Take me to Crown Guard Tower." class npc_taxi : public CreatureScript { public: npc_taxi() : CreatureScript("npc_taxi") { } bool OnGossipHello(Player* player, Creature* creature) override { if (creature->IsQuestGiver()) player->PrepareQuestMenu(creature->GetGUID()); switch (creature->GetEntry()) { case 17435: // Azuremyst Isle - Susurrus if (player->HasItemCount(23843, 1, true)) player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SUSURRUS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); break; case 20903: // Netherstorm - Protectorate Nether Drake if (player->GetQuestStatus(10438) == QUEST_STATUS_INCOMPLETE && player->HasItemCount(29778)) player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_NETHER_DRAKE, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); break; case 18725: // Old Hillsbrad Foothills - Brazen player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_BRAZEN, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); break; case 29154: // Stormwind City - Thargold Ironwing player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_IRONWING, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); break; case 19409: // Hellfire Peninsula - Wing Commander Dabir'ee //Mission: The Murketh and Shaadraz Gateways if (player->GetQuestStatus(10146) == QUEST_STATUS_INCOMPLETE) player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_DABIREE1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 4); //Shatter Point if (!player->GetQuestRewardStatus(10340)) player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_DABIREE2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 5); break; case 20235: // Hellfire Peninsula - Gryphoneer Windbellow //Mission: The Abyssal Shelf || Return to the Abyssal Shelf if (player->GetQuestStatus(10163) == QUEST_STATUS_INCOMPLETE || player->GetQuestStatus(10346) == QUEST_STATUS_INCOMPLETE) player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_WINDBELLOW1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 6); //Go to the Front if (player->GetQuestStatus(10382) != QUEST_STATUS_NONE && !player->GetQuestRewardStatus(10382)) player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_WINDBELLOW2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 7); break; case 19401: // Hellfire Peninsula - Wing Commander Brack //Mission: The Murketh and Shaadraz Gateways if (player->GetQuestStatus(10129) == QUEST_STATUS_INCOMPLETE) player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_BRACK1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 8); //Mission: The Abyssal Shelf || Return to the Abyssal Shelf if (player->GetQuestStatus(10162) == QUEST_STATUS_INCOMPLETE || player->GetQuestStatus(10347) == QUEST_STATUS_INCOMPLETE) player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_BRACK2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 9); //Spinebreaker Post if (player->GetQuestStatus(10242) == QUEST_STATUS_COMPLETE) player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_BRACK3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 10); break; case 23413: // Blade's Edge Mountains - Skyguard Handler Irena if (player->GetReputationRank(1031) >= REP_HONORED) player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_IRENA, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 11); break; case 25059: // Isle of Quel'Danas - Ayren Cloudbreaker if (player->GetQuestStatus(11532) == QUEST_STATUS_INCOMPLETE || player->GetQuestStatus(11533) == QUEST_STATUS_INCOMPLETE) player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_CLOUDBREAKER1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 12); if (player->GetQuestStatus(11542) == QUEST_STATUS_INCOMPLETE || player->GetQuestStatus(11543) == QUEST_STATUS_INCOMPLETE) player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_CLOUDBREAKER2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 13); break; case 25236: // Isle of Quel'Danas - Unrestrained Dragonhawk if (player->GetQuestStatus(11542) == QUEST_STATUS_COMPLETE || player->GetQuestStatus(11543) == QUEST_STATUS_COMPLETE) player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_DRAGONHAWK, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 14); break; case 20162: // Netherstorm - Veronia //Behind Enemy Lines if (player->GetQuestStatus(10652) != QUEST_STATUS_REWARDED) player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_VERONIA, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 15); break; case 23415: // Terokkar Forest - Skyguard Handler Deesak if (player->GetReputationRank(1031) >= REP_HONORED) player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_DEESAK, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 16); break; case 27575: // Dragonblight - Lord Afrasastrasz // middle -> ground player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_AFRASASTRASZ1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 17); // middle -> top player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_AFRASASTRASZ2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 18); break; case 26443: // Dragonblight - Tariolstrasz //need to check if quests are required before gossip available (12123, 12124) // ground -> top player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_TARIOLSTRASZ1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 19); // ground -> middle player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_TARIOLSTRASZ2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 20); break; case 26949: // Dragonblight - Torastrasza // top -> middle player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_TORASTRASZA1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 21); // top -> ground player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_TORASTRASZA2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 22); break; case 23704: // Dustwallow Marsh - Cassa Crimsonwing if (player->GetQuestStatus(11142) == QUEST_STATUS_INCOMPLETE) player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_CRIMSONWING, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+25); break; case 17209: player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_WILLIAMKEILAR1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 28); player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_WILLIAMKEILAR2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 29); player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_WILLIAMKEILAR3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 30); break; } player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID()); return true; } bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) override { player->PlayerTalkClass->ClearMenus(); switch (action) { case GOSSIP_ACTION_INFO_DEF: //spellId is correct, however it gives flight a somewhat funny effect //TaxiPath 506. player->CLOSE_GOSSIP_MENU(); player->CastSpell(player, 32474, true); break; case GOSSIP_ACTION_INFO_DEF + 1: player->CLOSE_GOSSIP_MENU(); player->ActivateTaxiPathTo(627); //TaxiPath 627 (possibly 627+628(152->153->154->155)) break; case GOSSIP_ACTION_INFO_DEF + 2: if (!player->HasItemCount(25853)) player->SEND_GOSSIP_MENU(9780, creature->GetGUID()); else { player->CLOSE_GOSSIP_MENU(); player->ActivateTaxiPathTo(534); //TaxiPath 534 } break; case GOSSIP_ACTION_INFO_DEF + 3: player->CLOSE_GOSSIP_MENU(); player->CastSpell(player, 53335, true); //TaxiPath 1041 (Stormwind Harbor) break; case GOSSIP_ACTION_INFO_DEF + 4: player->CLOSE_GOSSIP_MENU(); player->CastSpell(player, 33768, true); //TaxiPath 585 (Gateways Murket and Shaadraz) break; case GOSSIP_ACTION_INFO_DEF + 5: player->CLOSE_GOSSIP_MENU(); player->CastSpell(player, 35069, true); //TaxiPath 612 (Taxi - Hellfire Peninsula - Expedition Point to Shatter Point) break; case GOSSIP_ACTION_INFO_DEF + 6: player->CLOSE_GOSSIP_MENU(); player->CastSpell(player, 33899, true); //TaxiPath 589 (Aerial Assault Flight (Alliance)) break; case GOSSIP_ACTION_INFO_DEF + 7: player->CLOSE_GOSSIP_MENU(); player->CastSpell(player, 35065, true); //TaxiPath 607 (Taxi - Hellfire Peninsula - Shatter Point to Beach Head) break; case GOSSIP_ACTION_INFO_DEF + 8: player->CLOSE_GOSSIP_MENU(); player->CastSpell(player, 33659, true); //TaxiPath 584 (Gateways Murket and Shaadraz) break; case GOSSIP_ACTION_INFO_DEF + 9: player->CLOSE_GOSSIP_MENU(); player->CastSpell(player, 33825, true); //TaxiPath 587 (Aerial Assault Flight (Horde)) break; case GOSSIP_ACTION_INFO_DEF + 10: player->CLOSE_GOSSIP_MENU(); player->CastSpell(player, 34578, true); //TaxiPath 604 (Taxi - Reaver's Fall to Spinebreaker Ridge) break; case GOSSIP_ACTION_INFO_DEF + 11: player->CLOSE_GOSSIP_MENU(); player->CastSpell(player, 41278, true); //TaxiPath 706 break; case GOSSIP_ACTION_INFO_DEF + 12: player->CLOSE_GOSSIP_MENU(); player->CastSpell(player, 45071, true); //TaxiPath 779 break; case GOSSIP_ACTION_INFO_DEF + 13: player->CLOSE_GOSSIP_MENU(); player->CastSpell(player, 45113, true); //TaxiPath 784 break; case GOSSIP_ACTION_INFO_DEF + 14: player->CLOSE_GOSSIP_MENU(); player->CastSpell(player, 45353, true); //TaxiPath 788 break; case GOSSIP_ACTION_INFO_DEF + 15: player->CLOSE_GOSSIP_MENU(); player->CastSpell(player, 34905, true); //TaxiPath 606 break; case GOSSIP_ACTION_INFO_DEF + 16: player->CLOSE_GOSSIP_MENU(); player->CastSpell(player, 41279, true); //TaxiPath 705 (Taxi - Skettis to Skyguard Outpost) break; case GOSSIP_ACTION_INFO_DEF + 17: player->CLOSE_GOSSIP_MENU(); player->ActivateTaxiPathTo(882); break; case GOSSIP_ACTION_INFO_DEF + 18: player->CLOSE_GOSSIP_MENU(); player->ActivateTaxiPathTo(881); break; case GOSSIP_ACTION_INFO_DEF + 19: player->CLOSE_GOSSIP_MENU(); player->ActivateTaxiPathTo(878); break; case GOSSIP_ACTION_INFO_DEF + 20: player->CLOSE_GOSSIP_MENU(); player->ActivateTaxiPathTo(883); break; case GOSSIP_ACTION_INFO_DEF + 21: player->CLOSE_GOSSIP_MENU(); player->ActivateTaxiPathTo(880); break; case GOSSIP_ACTION_INFO_DEF + 22: player->CLOSE_GOSSIP_MENU(); player->ActivateTaxiPathTo(879); break; case GOSSIP_ACTION_INFO_DEF + 23: player->CLOSE_GOSSIP_MENU(); player->CastSpell(player, 43074, true); //TaxiPath 736 break; case GOSSIP_ACTION_INFO_DEF + 24: player->CLOSE_GOSSIP_MENU(); //player->ActivateTaxiPathTo(738); player->CastSpell(player, 43136, false); break; case GOSSIP_ACTION_INFO_DEF + 25: player->CLOSE_GOSSIP_MENU(); player->CastSpell(player, 42295, true); break; case GOSSIP_ACTION_INFO_DEF + 26: player->CLOSE_GOSSIP_MENU(); player->ActivateTaxiPathTo(494); break; case GOSSIP_ACTION_INFO_DEF + 27: player->CLOSE_GOSSIP_MENU(); player->ActivateTaxiPathTo(495); break; case GOSSIP_ACTION_INFO_DEF + 28: player->CLOSE_GOSSIP_MENU(); player->ActivateTaxiPathTo(496); break; } return true; } }; void AddSC_npc_taxi() { new npc_taxi; }
madisodr/legacy-core
src/server/scripts/World/npc_taxi.cpp
C++
gpl-2.0
16,513
50.926282
144
0.606371
false
/** * UGENE - Integrated Bioinformatics Tools. * Copyright (C) 2008-2022 UniPro <ugene@unipro.ru> * http://ugene.net * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301, USA. */ #include "ScriptEditorWidget.h" #include <QBoxLayout> #include <QLineEdit> #include <QSplitter> #include <QTextEdit> #include "ScriptHighlighter.h" const char* SCRIPT_TEXT_PROPERTY_NAME = "script text"; namespace U2 { ScriptEditorWidget::ScriptEditorWidget(QWidget* parent, ScriptEditorType typeOfField) : QWidget(parent) { scriptContainer = new QSplitter(Qt::Vertical, this); scriptContainer->setFocusPolicy(Qt::NoFocus); QBoxLayout* layout = new QBoxLayout(QBoxLayout::TopToBottom, this); layout->setMargin(0); layout->addWidget(scriptContainer); variablesEdit = new QTextEdit(scriptContainer); variablesEdit->setReadOnly(true); new ScriptHighlighter(variablesEdit->document()); scriptEdit = AbstractScriptEditorDelegate::createInstance(scriptContainer, typeOfField); scriptEdit->installScriptHighlighter(); connect(scriptEdit, SIGNAL(si_textChanged()), SIGNAL(si_textChanged())); connect(scriptEdit, SIGNAL(si_cursorPositionChanged()), SIGNAL(si_cursorPositionChanged())); } void ScriptEditorWidget::setVariablesText(const QString& variablesText) { variablesEdit->setText(variablesText); } QString ScriptEditorWidget::variablesText() const { return variablesEdit->toPlainText(); } void ScriptEditorWidget::setScriptText(const QString& text) { scriptEdit->setText(text); } QString ScriptEditorWidget::scriptText() const { return scriptEdit->text(); } int ScriptEditorWidget::scriptEditCursorLineNumber() const { return scriptEdit->cursorLineNumber(); } } // namespace U2
ugeneunipro/ugene
src/corelibs/U2Gui/src/util/ScriptEditorWidget.cpp
C++
gpl-2.0
2,409
31.12
96
0.750934
false
/* YUI 3.7.3 (build 5687) Copyright 2012 Yahoo! Inc. All rights reserved. Licensed under the BSD License. http://yuilibrary.com/license/ */ YUI.add('dom-class', function(Y) { var addClass, hasClass, removeClass; Y.mix(Y.DOM, { /** * Determines whether a DOM element has the given className. * @method hasClass * @for DOM * @param {HTMLElement} element The DOM element. * @param {String} className the class name to search for * @return {Boolean} Whether or not the element has the given class. */ hasClass: function(node, className) { var re = Y.DOM._getRegExp('(?:^|\\s+)' + className + '(?:\\s+|$)'); return re.test(node.className); }, /** * Adds a class name to a given DOM element. * @method addClass * @for DOM * @param {HTMLElement} element The DOM element. * @param {String} className the class name to add to the class attribute */ addClass: function(node, className) { if (!Y.DOM.hasClass(node, className)) { // skip if already present node.className = Y.Lang.trim([node.className, className].join(' ')); } }, /** * Removes a class name from a given element. * @method removeClass * @for DOM * @param {HTMLElement} element The DOM element. * @param {String} className the class name to remove from the class attribute */ removeClass: function(node, className) { if (className && hasClass(node, className)) { node.className = Y.Lang.trim(node.className.replace(Y.DOM._getRegExp('(?:^|\\s+)' + className + '(?:\\s+|$)'), ' ')); if ( hasClass(node, className) ) { // in case of multiple adjacent removeClass(node, className); } } }, /** * Replace a class with another class for a given element. * If no oldClassName is present, the newClassName is simply added. * @method replaceClass * @for DOM * @param {HTMLElement} element The DOM element * @param {String} oldClassName the class name to be replaced * @param {String} newClassName the class name that will be replacing the old class name */ replaceClass: function(node, oldC, newC) { //Y.log('replaceClass replacing ' + oldC + ' with ' + newC, 'info', 'Node'); removeClass(node, oldC); // remove first in case oldC === newC addClass(node, newC); }, /** * If the className exists on the node it is removed, if it doesn't exist it is added. * @method toggleClass * @for DOM * @param {HTMLElement} element The DOM element * @param {String} className the class name to be toggled * @param {Boolean} addClass optional boolean to indicate whether class * should be added or removed regardless of current state */ toggleClass: function(node, className, force) { var add = (force !== undefined) ? force : !(hasClass(node, className)); if (add) { addClass(node, className); } else { removeClass(node, className); } } }); hasClass = Y.DOM.hasClass; removeClass = Y.DOM.removeClass; addClass = Y.DOM.addClass; }, '3.7.3' ,{requires:['dom-core']});
artefactual-labs/trac
sites/all/libraries/yui/build/dom-class/dom-class-debug.js
JavaScript
gpl-2.0
3,423
32.928571
95
0.575226
false
import { Injectable } from '@angular/core'; import { of } from 'rxjs'; import { Resolve, ActivatedRouteSnapshot } from '@angular/router'; import { catchError } from 'rxjs/operators'; import { CatalogoService } from './catalogo.service'; @Injectable() export class EdicaoNovoResolverService implements Resolve<any> { constructor(private catalogoService: CatalogoService) {} resolve(snapshot: ActivatedRouteSnapshot) { const params = snapshot.queryParams; return this.catalogoService.getModelo(params['id']) .pipe(catchError((error) => of({error: error}))); } }
lexml/madoc
ui/src/app/service/edicao-novo.resolver.service.ts
TypeScript
gpl-2.0
589
25.772727
66
0.72326
false
package agaroyun.view; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import java.util.ArrayList; import javax.swing.JPanel; import agaroyun.Model.GameObject; import agaroyun.Model.Player; /** * draws GameObjects to panel * @author varyok * @version 1.0 */ public class GamePanel extends JPanel { private ArrayList<GameObject> gameObjects; /** * Keeps gameObjects ArrayList * @param gameObjects */ public GamePanel(ArrayList<GameObject> gameObjects) { this.gameObjects=gameObjects; } /** * draws GameObjects to panel */ @Override protected synchronized void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2d=(Graphics2D)g; //Graphics 2d daha fazla özellik sağlayabilir. daha kolaydır for (GameObject gameObject : gameObjects) { gameObject.draw(g2d); } } }
by-waryoq/LYKJava2017Basics
src/agaroyun/view/GamePanel.java
Java
gpl-2.0
916
19.288889
92
0.730559
false
package net.sf.memoranda.util; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import net.sf.memoranda.ui.AppFrame; /** * <p> * Title: * </p> * <p> * Description: * </p> * <p> * Copyright: Copyright (c) 2002 * </p> * <p> * Company: * </p> * * @author unascribed * @version 1.0 */ /* $Id: Context.java,v 1.3 2004/01/30 12:17:42 alexeya Exp $ */ public class Context { public static LoadableProperties context = new LoadableProperties(); static { CurrentStorage.get().restoreContext(); AppFrame.addExitListener(new ActionListener() { public void actionPerformed(ActionEvent e) { CurrentStorage.get().storeContext(); } }); } public static Object get(Object key) { return context.get(key); } public static void put(Object key, Object value) { context.put(key, value); } }
cst316/spring16project-Fortran
src/net/sf/memoranda/util/Context.java
Java
gpl-2.0
845
16.625
69
0.662722
false
## 1.8.0 (September 2015) - New MATERIAL DESIGN theme - Updated FILE TYPE ICONS - Preview TXT files within the app - COPY files & folders - Preview the full file/folder name from the long press menu - Set a file as FAVORITE (kept-in-sync) from the CONTEXT MENU - Updated CONFLICT RESOLUTION dialog (wording) - Images with TRANSPARENT background are previewed correctly - Hidden files are not taken into account for enforcing or not the list VIEW - Several bugs fixed ## 1.7.2 (July 2015) - New navigation drawer - Improved Passcode - Automatic grid view just for folders full of images - More characters allowed in file names - Support for servers in same domain, different path - Bugs fixed: + Frequent crashes in folder with several images + Sync error in servers with huge quota and external storage enable + Share by link error + Some other crashes and minor bugs ## 1.7.1 (April 2015) - Share link even with password enforced by server - Get the app ready for oc 8.1 servers - Added option to create new folder in uploads from external apps - Improved management of deleted users - Bugs fixed + Fixed crash on Android 2.x devices + Improvements on uploads ## 1.7.0 (February 2015) - Download full folders - Grid view for images - Remote thumbnails (OC Server 8.0+) - Added number of files and folders at the end of the list - "Open with" in contextual menu - Downloads added to Media Provider - Uploads: + Local thumbnails in section "Files" + Multiple selection in "Content from other apps" (Android 4.3+) - Gallery: + proper handling of EXIF + obey sorting in the list of files - Settings view updated - Improved subjects in e-mails - Bugs fixed
maduhu/android
CHANGELOG.md
Markdown
gpl-2.0
1,684
29.618182
76
0.749406
false
joomla_wisco_p ============== joomla .wisco.templates
pyyxx123/joomla_wisco_p
README.md
Markdown
gpl-2.0
55
12.75
23
0.581818
false
#ifndef SPRINGLOBBY_HEADERGUARD_USER_H #define SPRINGLOBBY_HEADERGUARD_USER_H #include <wx/string.h> #include <wx/colour.h> #include "utils/mixins.hh" class Server; const unsigned int SYNC_UNKNOWN = 0; const unsigned int SYNC_SYNCED = 1; const unsigned int SYNC_UNSYNCED = 2; //! @brief Struct used to store a client's status. struct UserStatus { enum RankContainer { RANK_1, RANK_2, RANK_3, RANK_4, RANK_5, RANK_6, RANK_7, RANK_8 }; bool in_game; bool away; RankContainer rank; bool moderator; bool bot; UserStatus(): in_game(false), away(false), rank(RANK_1), moderator(false), bot(false) {} wxString GetDiffString ( const UserStatus& other ) const; }; struct UserPosition { int x; int y; UserPosition(): x(-1), y(-1) {} }; struct UserBattleStatus { //!!! when adding something to this struct, also modify User::UpdateBattleStatus() !! // total 17 members here int team; int ally; wxColour colour; int color_index; int handicap; int side; unsigned int sync; bool spectator; bool ready; bool isfromdemo; UserPosition pos; // for startpos = 4 // bot-only stuff wxString owner; wxString aishortname; wxString airawname; wxString aiversion; int aitype; // for nat holepunching wxString ip; unsigned int udpport; wxString scriptPassword; bool IsBot() const { return !aishortname.IsEmpty(); } UserBattleStatus(): team(0),ally(0),colour(wxColour(0,0,0)),color_index(-1),handicap(0),side(0),sync(SYNC_UNKNOWN),spectator(false),ready(false), isfromdemo(false), aitype(-1), udpport(0) {} bool operator == ( const UserBattleStatus& s ) const { return ( ( team == s.team ) && ( colour == s.colour ) && ( handicap == s.handicap ) && ( side == s.side ) && ( sync == s.sync ) && ( spectator == s.spectator ) && ( ready == s.ready ) && ( owner == s.owner ) && ( aishortname == s.aishortname ) && ( isfromdemo == s.isfromdemo ) && ( aitype == s.aitype ) ); } bool operator != ( const UserBattleStatus& s ) const { return ( ( team != s.team ) || ( colour != s.colour ) || ( handicap != s.handicap ) || ( side != s.side ) || ( sync != s.sync ) || ( spectator != s.spectator ) || ( ready != s.ready ) || ( owner != s.owner ) || ( aishortname != s.aishortname ) || ( isfromdemo != s.isfromdemo ) || ( aitype != s.aitype ) ); } }; class ChatPanel; class Battle; struct UiUserData { UiUserData(): panel(0) {} ChatPanel* panel; }; //! parent class leaving out server related functionality class CommonUser { public: CommonUser(const wxString& nick, const wxString& country, const int& cpu) : m_nick(wxString(nick)), m_country(wxString(country)), m_cpu(cpu) {} virtual ~CommonUser(){} const wxString& GetNick() const { return m_nick; } virtual void SetNick( const wxString& nick ) { m_nick = nick; } const wxString& GetCountry() const { return m_country; } virtual void SetCountry( const wxString& country ) { m_country = country; } int GetCpu() const { return m_cpu; } void SetCpu( const int& cpu ) { m_cpu = cpu; } const wxString& GetID() const { return m_id; } void SetID( const wxString& id ) { m_id = id; } UserStatus& Status() { return m_status; } UserStatus GetStatus() const { return m_status; } virtual void SetStatus( const UserStatus& status ); UserBattleStatus& BattleStatus() { return m_bstatus; } UserBattleStatus GetBattleStatus() const { return m_bstatus; } /** Read-only variant of BattleStatus() above. */ const UserBattleStatus& BattleStatus() const { return m_bstatus; } //void SetBattleStatus( const UserBattleStatus& status );/// dont use this to avoid overwriting data like ip and port, use following method. void UpdateBattleStatus( const UserBattleStatus& status ); /* void SetUserData( void* userdata ) { m_data = userdata; } void* GetUserData() { return m_data; }*/ bool Equals( const CommonUser& other ) const { return ( m_nick == other.GetNick() ); } protected: wxString m_nick; wxString m_country; wxString m_id; int m_cpu; UserStatus m_status; UserBattleStatus m_bstatus; //void* m_data; }; //! Class containing all the information about a user class User : public CommonUser { public: mutable UiUserData uidata; User( Server& serv ); User( const wxString& nick, Server& serv ); User( const wxString& nick, const wxString& country, const int& cpu, Server& serv); User( const wxString& nick ); User( const wxString& nick, const wxString& country, const int& cpu ); User(); virtual ~User(); // User interface Server& GetServer() const { return *m_serv; } void Said( const wxString& message ) const; void Say( const wxString& message ) const; void DoAction( const wxString& message ) const; Battle* GetBattle() const; void SetBattle( Battle* battle ); void SendMyUserStatus() const; void SetStatus( const UserStatus& status ); void SetCountry( const wxString& country ); bool ExecuteSayCommand( const wxString& cmd ) const; static wxString GetRankName(UserStatus::RankContainer rank); float GetBalanceRank(); UserStatus::RankContainer GetRank(); wxString GetClan(); int GetFlagIconIndex() const { return m_flagicon_idx; } int GetRankIconIndex() const { return m_rankicon_idx; } int GetStatusIconIndex() const { return m_statusicon_idx; } //bool operator< ( const User& other ) const { return m_nick < other.GetNick() ; } //User& operator= ( const User& other ); int GetSideiconIndex() const { return m_sideicon_idx; } void SetSideiconIndex( const int idx ) { m_sideicon_idx = idx; } protected: // User variables Server* m_serv; Battle* m_battle; int m_flagicon_idx; int m_rankicon_idx; int m_statusicon_idx; int m_sideicon_idx; //! copy-semantics? }; #endif // SPRINGLOBBY_HEADERGUARD_USER_H /** This file is part of SpringLobby, Copyright (C) 2007-2011 SpringLobby is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation. SpringLobby is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with SpringLobby. If not, see <http://www.gnu.org/licenses/>. **/
N2maniac/springlobby-join-fork
src/user.h
C
gpl-2.0
6,758
28.902655
311
0.6496
false
<?php /** * * * Created on Jan 4, 2008 * * Copyright © 2008 Yuri Astrakhan <Firstname><Lastname>@gmail.com, * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * http://www.gnu.org/copyleft/gpl.html * * @file */ /** * API module to allow users to watch a page * * @ingroup API */ class ApiWatch extends ApiBase { public function __construct( $main, $action ) { parent::__construct( $main, $action ); } public function execute() { $user = $this->getUser(); if ( !$user->isLoggedIn() ) { $this->dieUsage( 'You must be logged-in to have a watchlist', 'notloggedin' ); } $params = $this->extractRequestParams(); $title = Title::newFromText( $params['title'] ); if ( !$title || $title->getNamespace() < 0 ) { $this->dieUsageMsg( array( 'invalidtitle', $params['title'] ) ); } $res = array( 'title' => $title->getPrefixedText() ); if ( $params['unwatch'] ) { $res['unwatched'] = ''; $res['message'] = wfMsgExt( 'removedwatchtext', array( 'parse' ), $title->getPrefixedText() ); $success = UnwatchAction::doUnwatch( $title, $user ); } else { $res['watched'] = ''; $res['message'] = wfMsgExt( 'addedwatchtext', array( 'parse' ), $title->getPrefixedText() ); $success = WatchAction::doWatch( $title, $user ); } if ( !$success ) { $this->dieUsageMsg( 'hookaborted' ); } $this->getResult()->addValue( null, $this->getModuleName(), $res ); } public function mustBePosted() { return true; } public function isWriteMode() { return true; } public function needsToken() { return true; } public function getTokenSalt() { return 'watch'; } public function getAllowedParams() { return array( 'title' => array( ApiBase::PARAM_TYPE => 'string', ApiBase::PARAM_REQUIRED => true ), 'unwatch' => false, 'token' => null, ); } public function getParamDescription() { return array( 'title' => 'The page to (un)watch', 'unwatch' => 'If set the page will be unwatched rather than watched', 'token' => 'A token previously acquired via prop=info', ); } public function getDescription() { return 'Add or remove a page from/to the current user\'s watchlist'; } public function getPossibleErrors() { return array_merge( parent::getPossibleErrors(), array( array( 'code' => 'notloggedin', 'info' => 'You must be logged-in to have a watchlist' ), array( 'invalidtitle', 'title' ), array( 'hookaborted' ), ) ); } public function getExamples() { return array( 'api.php?action=watch&title=Main_Page' => 'Watch the page "Main Page"', 'api.php?action=watch&title=Main_Page&unwatch=' => 'Unwatch the page "Main Page"', ); } public function getHelpUrls() { return 'https://www.mediawiki.org/wiki/API:Watch'; } public function getVersion() { return __CLASS__ . ': $Id$'; } }
ezc/mediawiki
includes/api/ApiWatch.php
PHP
gpl-2.0
3,488
26.031008
97
0.652423
false
/* -*- c -*- */ /* $Id: sha.h 6172 2011-03-27 12:40:30Z cher $ */ #ifndef __SHA_H__ #define __SHA_H__ 1 /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* This file is taken from textutils-2.1. Cher. */ /* sha.h - Declaration of functions and datatypes for SHA1 sum computing library functions. Copyright (C) 1999, Scott G. Miller */ #include "reuse_integral.h" #include <stdio.h> /* Structure to save state of computation between the single steps. */ struct sha_ctx { ruint32_t A; ruint32_t B; ruint32_t C; ruint32_t D; ruint32_t E; ruint32_t total[2]; ruint32_t buflen; char buffer[128]; }; /* Starting with the result of former calls of this function (or the initialization function update the context for the next LEN bytes starting at BUFFER. It is necessary that LEN is a multiple of 64!!! */ void sha_process_block(const void *buffer, size_t len, struct sha_ctx *ctx); /* Starting with the result of former calls of this function (or the initialization function update the context for the next LEN bytes starting at BUFFER. It is NOT required that LEN is a multiple of 64. */ void sha_process_bytes(const void *buffer, size_t len, struct sha_ctx *ctx); /* Initialize structure containing state of computation. */ void sha_init_ctx(struct sha_ctx *ctx); /* Process the remaining bytes in the buffer and put result from CTX in first 20 bytes following RESBUF. The result is always in little endian byte order, so that a byte-wise output yields to the wanted ASCII representation of the message digest. IMPORTANT: On some systems it is required that RESBUF is correctly aligned for a 32 bits value. */ void *sha_finish_ctx(struct sha_ctx *ctx, void *resbuf); /* Put result from CTX in first 20 bytes following RESBUF. The result is always in little endian byte order, so that a byte-wise output yields to the wanted ASCII representation of the message digest. IMPORTANT: On some systems it is required that RESBUF is correctly aligned for a 32 bits value. */ void *sha_read_ctx(const struct sha_ctx *ctx, void *resbuf); /* Compute SHA1 message digest for bytes read from STREAM. The resulting message digest number will be written into the 20 bytes beginning at RESBLOCK. */ int sha_stream(FILE *stream, void *resblock); /* Compute SHA1 message digest for LEN bytes beginning at BUFFER. The result is always in little endian byte order, so that a byte-wise output yields to the wanted ASCII representation of the message digest. */ void *sha_buffer(const char *buffer, size_t len, void *resblock); #endif /* __SHA_H__ */
stden/ejudge
sha.h
C
gpl-2.0
3,310
34.212766
76
0.724471
false
/* SET.C - performing :set - command * * NOTE: Edit this file with tabstop=4 ! * * 1996-02-29 created; * 1998-03-14 V 1.0.1 * 1999-01-14 V 1.1.0 * 1999-03-17 V 1.1.1 * 1999-07-02 V 1.2.0 beta * 1999-08-14 V 1.2.0 final * 2000-07-15 V 1.3.0 final * 2001-10-10 V 1.3.1 * 2003-07-03 V 1.3.2 * * Copyright 1996-2003 by Gerhard Buergmann * gerhard@puon.at * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2, or (at your option) any * later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * See file COPYING for information on distribution conditions. */ #include "bvi.h" #include "set.h" extern struct BLOCK_ data_block[BLK_COUNT]; static int from_file = 0; static FILE *ffp; static char fbuf[256]; static char buf[64]; struct { short r; short g; short b; } original_colors[8]; struct { short f; short b; } original_colorpairs[8]; struct param params[] = { {"autowrite", "aw", FALSE, "", P_BOOL}, {"columns", "cm", 16, "", P_NUM}, {"errorbells", "eb", FALSE, "", P_BOOL}, {"ignorecase", "ic", FALSE, "", P_BOOL}, {"magic", "ma", TRUE, "", P_BOOL}, {"memmove", "mm", FALSE, "", P_BOOL}, {"offset", "of", 0, "", P_NUM}, {"readonly", "ro", FALSE, "", P_BOOL}, {"scroll", "scroll", 12, "", P_NUM}, {"showmode", "mo", TRUE, "", P_BOOL}, {"term", "term", 0, "", P_TEXT}, {"terse", "terse", FALSE, "", P_BOOL}, {"unixstyle", "us", FALSE, "", P_BOOL}, {"window", "window", 25, "", P_NUM}, {"wordlength", "wl", 4, "", P_NUM}, {"wrapscan", "ws", TRUE, "", P_BOOL}, {"", "", 0, "", 0,} /* end marker */ }; struct color colors[] = { /* RGB definitions and default value, if have no support of 256 colors */ {"background", "bg", 50, 50, 50, COLOR_BLACK}, {"addresses", "addr", 335, 506, 700, COLOR_BLUE}, {"hex", "hex", 600, 600, 600, COLOR_MAGENTA}, {"data", "data", 0, 800, 400, COLOR_GREEN}, {"error", "err", 999, 350, 0, COLOR_RED}, {"status", "stat", 255, 255, 255, COLOR_WHITE}, {"command", "comm", 255, 255, 255, COLOR_WHITE}, {"window", "win", 0, 800, 900, COLOR_YELLOW}, {"addrbg", "addrbg", 0, 0, 0, COLOR_CYAN}, {"", "", 0, 0, 0, 0} /* end marker */ }; int doset(arg) char *arg; /* parameter string */ { int i; char *s; int did_window = FALSE; int state = TRUE; /* new state of boolean parms. */ char string[80]; if (arg == NULL) { showparms(FALSE); return 0; } if (!strcmp(arg, "all")) { showparms(TRUE); return 0; } if (!strncmp(arg, "no", 2)) { state = FALSE; arg += 2; } /* extract colors section */ if (!strncmp(arg, "color", 5)) { arg = substr(arg, 6, -1); for (i = 0; colors[i].fullname[0] != '\0'; i++) { s = colors[i].fullname; if (strncmp(arg, s, strlen(s)) == 0) break; s = colors[i].shortname; if (strncmp(arg, s, strlen(s)) == 0) break; } if (i == 0) { emsg("Wrong color name!"); return 0; } else { colors[i].r = atoi(substr(arg, strlen(s) + 1, 3)); colors[i].g = atoi(substr(arg, strlen(s) + 5, 3)); colors[i].b = atoi(substr(arg, strlen(s) + 9, 3)); set_palette(); repaint(); } return 0; } else { emsg(arg); return 1; } for (i = 0; params[i].fullname[0] != '\0'; i++) { s = params[i].fullname; if (strncmp(arg, s, strlen(s)) == 0) /* matched full name */ break; s = params[i].shortname; if (strncmp(arg, s, strlen(s)) == 0) /* matched short name */ break; } if (params[i].fullname[0] != '\0') { /* found a match */ if (arg[strlen(s)] == '?') { if (params[i].flags & P_BOOL) sprintf(buf, " %s%s", (params[i].nvalue ? " " : "no"), params[i].fullname); else if (params[i].flags & P_TEXT) sprintf(buf, " %s=%s", params[i].fullname, params[i].svalue); else sprintf(buf, " %s=%ld", params[i].fullname, params[i].nvalue); msg(buf); return 0; } if (!strcmp(params[i].fullname, "term")) { emsg("Can't change type of terminal from within bvi"); return 1; } if (params[i].flags & P_NUM) { if ((i == P_LI) || (i == P_OF)) did_window++; if (arg[strlen(s)] != '=' || state == FALSE) { sprintf(string, "Option %s is not a toggle", params[i].fullname); emsg(string); return 1; } else { s = arg + strlen(s) + 1; if (*s == '0') { params[i].nvalue = strtol(s, &s, 16); } else { params[i].nvalue = strtol(s, &s, 10); } params[i].flags |= P_CHANGED; if (i == P_CM) { if (((COLS - AnzAdd - 1) / 4) >= P(P_CM)) { COLUMNS_DATA = P(P_CM); } else { COLUMNS_DATA = P(P_CM) = ((COLS - AnzAdd - 1) / 4); } maxx = COLUMNS_DATA * 4 + AnzAdd + 1; COLUMNS_HEX = COLUMNS_DATA * 3; status = COLUMNS_HEX + COLUMNS_DATA - 17; screen = COLUMNS_DATA * (maxy - 1); did_window++; stuffin("H"); /* set cursor at HOME */ } } } else { /* boolean */ if (arg[strlen(s)] == '=') { emsg("Invalid set of boolean parameter"); return 1; } else { params[i].nvalue = state; params[i].flags |= P_CHANGED; } } } else { emsg("No such option@- `set all' gives all option values"); return 1; } if (did_window) { maxy = P(P_LI) - 1; new_screen(); } return 0; } /* show ALL parameters */ void showparms(all) int all; { struct param *p; int n; n = 2; msg("Parameters:\n"); for (p = &params[0]; p->fullname[0] != '\0'; p++) { if (!all && ((p->flags & P_CHANGED) == 0)) continue; if (p->flags & P_BOOL) sprintf(buf, " %s%s\n", (p->nvalue ? " " : "no"), p->fullname); else if (p->flags & P_TEXT) sprintf(buf, " %s=%s\n", p->fullname, p->svalue); else sprintf(buf, " %s=%ld\n", p->fullname, p->nvalue); msg(buf); n++; if (n == params[P_LI].nvalue) { if (wait_return(FALSE)) return; n = 1; } } wait_return(TRUE); } void save_orig_palette() { int i; for (i = 0; colors[i].fullname[0] != '\0'; i++) { color_content(colors[i].short_value, &original_colors[i].r, &original_colors[i].g, &original_colors[i].b); } for (i = 1; i < 8; i++) { pair_content(i, &original_colorpairs[i].f, &original_colorpairs[i].b); } } void load_orig_palette() { int i; for (i = 0; colors[i].fullname[0] != '\0'; i++) { init_color(colors[i].short_value, original_colors[i].r, original_colors[i].g, original_colors[i].b); } for (i = 1; i < 8; i++) { init_pair(i, original_colorpairs[i].f, original_colorpairs[i].b); } } void set_palette() { int i; if (can_change_color()) { for (i = 0; colors[i].fullname[0] != '\0'; i++) { if (init_color (colors[i].short_value, C_r(i), C_g(i), C_b(i)) == ERR) fprintf(stderr, "Failed to set [%d] color!\n", i); if (C_s(i) <= 7) { init_pair(i + 1, C_s(i), C_s(0)); } else { colors[i].short_value = COLOR_WHITE; init_pair(i + 1, C_s(i), C_s(0)); } } init_pair(C_AD + 1, C_s(C_AD), COLOR_CYAN); } else { /* if have no support of changing colors */ for (i = 0; colors[i].fullname[0] != '\0'; i++) { if (C_s(i) <= 7) { init_pair(i + 1, C_s(i), C_s(0)); } else { colors[i].short_value = COLOR_WHITE; init_pair(i + 1, C_s(i), C_s(0)); } } } } /* reads the init file (.bvirc) */ int read_rc(fn) char *fn; { if ((ffp = fopen(fn, "r")) == NULL) return -1; from_file = 1; while (fgets(fbuf, 255, ffp) != NULL) { strtok(fbuf, "\n\r"); docmdline(fbuf); } fclose(ffp); from_file = 0; return 0; } int do_logic(mode, str) int mode; char *str; { int a, b; int value; size_t n; char *err_str = "Invalid value@for bit manipulation"; if (mode == LSHIFT || mode == RSHIFT || mode == LROTATE || mode == RROTATE) { value = atoi(str); if (value < 1 || value > 8) { emsg(err_str); return 1; } } else { if (strlen(str) == 8) { value = strtol(str, NULL, 2); for (n = 0; n < 8; n++) { if (str[n] != '0' && str[n] != '1') { value = -1; break; } } } else if (str[0] == 'b' || str[0] == 'B') { value = strtol(str + 1, NULL, 2); } else if (str[0] == '0') { value = strtol(str, NULL, 16); for (n = 0; n < strlen(str); n++) { if (!isxdigit(str[n])) { value = -1; break; } } } else { value = atoi(str); } if (value < 0 || value > 255) { emsg(err_str); return 1; } } if ((undo_count = alloc_buf((off_t) (end_addr - start_addr + 1), &undo_buf))) { memcpy(undo_buf, start_addr, undo_count); } undo_start = start_addr; edits = U_EDIT; while (start_addr <= end_addr) { a = *start_addr; a &= 0xff; switch (mode) { case LSHIFT: a <<= value; break; case RSHIFT: a >>= value; break; case LROTATE: a <<= value; b = a >> 8; a |= b; break; case RROTATE: b = a << 8; a |= b; a >>= value; /* b = a << (8 - value); a >>= value; a |= b; */ break; case AND: a &= value; break; case OR: a |= value; break; case XOR: case NOT: a ^= value; break; case NEG: a ^= value; a++; /* Is this true */ break; } *start_addr++ = (char)(a & 0xff); } repaint(); return (0); } int do_logic_block(mode, str, block_number) int mode; char *str; int block_number; { int a, b; int value; size_t n; char *err_str = "Invalid value@for bit manipulation"; if ((block_number >= BLK_COUNT) & (!(data_block[block_number].pos_start < data_block[block_number].pos_end))) { emsg("Invalid block for bit manipulation!"); return 1; } if (mode == LSHIFT || mode == RSHIFT || mode == LROTATE || mode == RROTATE) { value = atoi(str); if (value < 1 || value > 8) { emsg(err_str); return 1; } } else { if (strlen(str) == 8) { value = strtol(str, NULL, 2); for (n = 0; n < 8; n++) { if (str[n] != '0' && str[n] != '1') { value = -1; break; } } } else if (str[0] == 'b' || str[0] == 'B') { value = strtol(str + 1, NULL, 2); } else if (str[0] == '0') { value = strtol(str, NULL, 16); for (n = 0; n < strlen(str); n++) { if (!isxdigit(str[n])) { value = -1; break; } } } else { value = atoi(str); } if (value < 0 || value > 255) { emsg(err_str); return 1; } } if ((undo_count = alloc_buf((off_t) (data_block[block_number].pos_end - data_block[block_number].pos_start + 1), &undo_buf))) { memcpy(undo_buf, start_addr + data_block[block_number].pos_start, undo_count); } undo_start = start_addr + data_block[block_number].pos_start; edits = U_EDIT; start_addr = start_addr + data_block[block_number].pos_start; end_addr = start_addr + data_block[block_number].pos_end - data_block[block_number].pos_start; while (start_addr <= end_addr) { a = *start_addr; a &= 0xff; switch (mode) { case LSHIFT: a <<= value; break; case RSHIFT: a >>= value; break; case LROTATE: a <<= value; b = a >> 8; a |= b; break; case RROTATE: b = a << 8; a |= b; a >>= value; /* b = a << (8 - value); a >>= value; a |= b; */ break; case AND: a &= value; break; case OR: a |= value; break; case XOR: case NOT: a ^= value; break; case NEG: a ^= value; a++; /* Is this true */ break; } *start_addr++ = (char)(a & 0xff); } repaint(); return (0); } int getcmdstr(p, x) char *p; int x; { int c; int n; char *buff, *q; attron(COLOR_PAIR(C_CM + 1)); if (from_file) { if (fgets(p, 255, ffp) != NULL) { strtok(p, "\n\r"); return 0; } else { return 1; } } signal(SIGINT, jmpproc); buff = p; move(maxy, x); do { switch (c = vgetc()) { case BVICTRL('H'): case KEY_BACKSPACE: case KEY_LEFT: if (p > buff) { p--; move(maxy, x); n = x; for (q = buff; q < p; q++) { addch(*q); n++; } addch(' '); move(maxy, n); } else { *buff = '\0'; msg(""); attroff(COLOR_PAIR(C_CM + 1)); signal(SIGINT, SIG_IGN); return 1; } break; case ESC: /* abandon command */ *buff = '\0'; msg(""); attroff(COLOR_PAIR(C_CM + 1)); signal(SIGINT, SIG_IGN); return 1; #if NL != KEY_ENTER case NL: #endif #if CR != KEY_ENTER case CR: #endif case KEY_ENTER: break; default: /* a normal character */ addch(c); *p++ = c; break; } refresh(); } while (c != NL && c != CR && c != KEY_ENTER); attroff(COLOR_PAIR(C_CM + 1)); *p = '\0'; signal(SIGINT, SIG_IGN); return 0; }
XVilka/bvim
set.c
C
gpl-2.0
12,671
20.622867
112
0.529635
false
local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end local lastSound = 0 function onThink() if lastSound < os.time() then lastSound = (os.time() + 5) if math.random(100) < 25 then Npc():say("Come into my tavern and share some stories!", TALKTYPE_SAY) end end npcHandler:onThink() end npcHandler:setMessage(MESSAGE_GREET, "Welcome to Frodo's Hut. You heard about the {news}?") npcHandler:setMessage(MESSAGE_FAREWELL, "Please come back from time to time.") npcHandler:setMessage(MESSAGE_WALKAWAY, "Please come back from time to time.") npcHandler:addModule(FocusModule:new())
Tatuy/UAServer
data/npc/FORGOTTENSERVER-ORTS/scripts/Frodo.lua
Lua
gpl-2.0
904
36.666667
91
0.772124
false
/* coff object file format Copyright 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009 Free Software Foundation, Inc. This file is part of GAS. GAS is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. GAS is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GAS; see the file COPYING. If not, write to the Free Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef OBJ_FORMAT_H #define OBJ_FORMAT_H #define OBJ_COFF 1 #include "targ-cpu.h" /* This internal_lineno crap is to stop namespace pollution from the bfd internal coff headerfile. */ #define internal_lineno bfd_internal_lineno #include "coff/internal.h" #undef internal_lineno /* CPU-specific setup: */ #ifdef TC_ARM #include "coff/arm.h" #ifndef TARGET_FORMAT #define TARGET_FORMAT "coff-arm" #endif #endif #ifdef TC_PPC #ifdef TE_PE #include "coff/powerpc.h" #else #include "coff/rs6000.h" #endif #endif #ifdef TC_SPARC #include "coff/sparc.h" #endif #ifdef TC_I386 #ifdef TE_PEP #include "coff/x86_64.h" #else #include "coff/i386.h" #endif #ifndef TARGET_FORMAT #ifdef TE_PEP #define TARGET_FORMAT "coff-x86-64" #else #define TARGET_FORMAT "coff-i386" #endif #endif #endif #ifdef TC_M68K #include "coff/m68k.h" #ifndef TARGET_FORMAT #define TARGET_FORMAT "coff-m68k" #endif #endif #ifdef TC_OR32 #include "coff/or32.h" #define TARGET_FORMAT "coff-or32-big" #endif #ifdef TC_I960 #include "coff/i960.h" #define TARGET_FORMAT "coff-Intel-little" #endif #ifdef TC_Z80 #include "coff/z80.h" #define TARGET_FORMAT "coff-z80" #endif #ifdef TC_Z8K #include "coff/z8k.h" #define TARGET_FORMAT "coff-z8k" #endif #ifdef TC_H8300 #include "coff/h8300.h" #define TARGET_FORMAT "coff-h8300" #endif #ifdef TC_H8500 #include "coff/h8500.h" #define TARGET_FORMAT "coff-h8500" #endif #ifdef TC_SH #ifdef TE_PE #define COFF_WITH_PE #endif #include "coff/sh.h" #ifdef TE_PE #define TARGET_FORMAT "pe-shl" #else #define TARGET_FORMAT \ (!target_big_endian \ ? (sh_small ? "coff-shl-small" : "coff-shl") \ : (sh_small ? "coff-sh-small" : "coff-sh")) #endif #endif #ifdef TC_MIPS #define COFF_WITH_PE #include "coff/mipspe.h" #undef TARGET_FORMAT #define TARGET_FORMAT "pe-mips" #endif #ifdef TC_TIC30 #include "coff/tic30.h" #define TARGET_FORMAT "coff-tic30" #endif #ifdef TC_TIC4X #include "coff/tic4x.h" #define TARGET_FORMAT "coff2-tic4x" #endif #ifdef TC_TIC54X #include "coff/tic54x.h" #define TARGET_FORMAT "coff1-c54x" #endif #ifdef TC_TIC6X #include "coff/tic6x.h" //#define TARGET_FORMAT "coff2-c6x" #endif #ifdef TC_MCORE #include "coff/mcore.h" #ifndef TARGET_FORMAT #define TARGET_FORMAT "pe-mcore" #endif #endif #ifdef TE_PE #define obj_set_weak_hook pecoff_obj_set_weak_hook #define obj_clear_weak_hook pecoff_obj_clear_weak_hook #endif #ifndef OBJ_COFF_MAX_AUXENTRIES #define OBJ_COFF_MAX_AUXENTRIES 1 #endif #define obj_symbol_new_hook coff_obj_symbol_new_hook #define obj_symbol_clone_hook coff_obj_symbol_clone_hook #define obj_read_begin_hook coff_obj_read_begin_hook #include "bfd/libcoff.h" #define OUTPUT_FLAVOR bfd_target_coff_flavour /* Alter the field names, for now, until we've fixed up the other references to use the new name. */ #ifdef TC_I960 #define TC_SYMFIELD_TYPE symbolS * #define sy_tc bal #endif #define OBJ_SYMFIELD_TYPE unsigned long #define sy_obj sy_obj_flags /* We can't use the predefined section symbols in bfd/section.c, as COFF symbols have extra fields. See bfd/libcoff.h:coff_symbol_type. */ #ifndef obj_sec_sym_ok_for_reloc #define obj_sec_sym_ok_for_reloc(SEC) ((SEC)->owner != 0) #endif #define SYM_AUXENT(S) \ (&coffsymbol (symbol_get_bfdsym (S))->native[1].u.auxent) #define SYM_AUXINFO(S) \ (&coffsymbol (symbol_get_bfdsym (S))->native[1]) /* The number of auxiliary entries. */ #define S_GET_NUMBER_AUXILIARY(s) \ (coffsymbol (symbol_get_bfdsym (s))->native->u.syment.n_numaux) /* The number of auxiliary entries. */ #define S_SET_NUMBER_AUXILIARY(s, v) (S_GET_NUMBER_AUXILIARY (s) = (v)) /* True if a symbol name is in the string table, i.e. its length is > 8. */ #define S_IS_STRING(s) (strlen (S_GET_NAME (s)) > 8 ? 1 : 0) /* Auxiliary entry macros. SA_ stands for symbol auxiliary. */ /* Omit the tv related fields. */ /* Accessors. */ #define SA_GET_SYM_TAGNDX(s) (SYM_AUXENT (s)->x_sym.x_tagndx.l) #define SA_GET_SYM_LNNO(s) (SYM_AUXENT (s)->x_sym.x_misc.x_lnsz.x_lnno) #define SA_GET_SYM_SIZE(s) (SYM_AUXENT (s)->x_sym.x_misc.x_lnsz.x_size) #define SA_GET_SYM_FSIZE(s) (SYM_AUXENT (s)->x_sym.x_misc.x_fsize) #define SA_GET_SYM_LNNOPTR(s) (SYM_AUXENT (s)->x_sym.x_fcnary.x_fcn.x_lnnoptr) #define SA_GET_SYM_ENDNDX(s) (SYM_AUXENT (s)->x_sym.x_fcnary.x_fcn.x_endndx) #define SA_GET_SYM_DIMEN(s,i) (SYM_AUXENT (s)->x_sym.x_fcnary.x_ary.x_dimen[(i)]) #define SA_GET_FILE_FNAME(s) (SYM_AUXENT (s)->x_file.x_fname) #define SA_GET_SCN_SCNLEN(s) (SYM_AUXENT (s)->x_scn.x_scnlen) #define SA_GET_SCN_NRELOC(s) (SYM_AUXENT (s)->x_scn.x_nreloc) #define SA_GET_SCN_NLINNO(s) (SYM_AUXENT (s)->x_scn.x_nlinno) #define SA_SET_SYM_LNNO(s,v) (SYM_AUXENT (s)->x_sym.x_misc.x_lnsz.x_lnno = (v)) #define SA_SET_SYM_SIZE(s,v) (SYM_AUXENT (s)->x_sym.x_misc.x_lnsz.x_size = (v)) #define SA_SET_SYM_FSIZE(s,v) (SYM_AUXENT (s)->x_sym.x_misc.x_fsize = (v)) #define SA_SET_SYM_LNNOPTR(s,v) (SYM_AUXENT (s)->x_sym.x_fcnary.x_fcn.x_lnnoptr = (v)) #define SA_SET_SYM_DIMEN(s,i,v) (SYM_AUXENT (s)->x_sym.x_fcnary.x_ary.x_dimen[(i)] = (v)) #define SA_SET_FILE_FNAME(s,v) strncpy (SYM_AUXENT (s)->x_file.x_fname, (v), FILNMLEN) #define SA_SET_SCN_SCNLEN(s,v) (SYM_AUXENT (s)->x_scn.x_scnlen = (v)) #define SA_SET_SCN_NRELOC(s,v) (SYM_AUXENT (s)->x_scn.x_nreloc = (v)) #define SA_SET_SCN_NLINNO(s,v) (SYM_AUXENT (s)->x_scn.x_nlinno = (v)) /* Internal use only definitions. SF_ stands for symbol flags. These values can be assigned to sy_symbol.ost_flags field of a symbolS. You'll break i960 if you shift the SYSPROC bits anywhere else. for more on the balname/callname hack, see tc-i960.h. b.out is done differently. */ #define SF_I960_MASK 0x000001ff /* Bits 0-8 are used by the i960 port. */ #define SF_SYSPROC 0x0000003f /* bits 0-5 are used to store the sysproc number. */ #define SF_IS_SYSPROC 0x00000040 /* bit 6 marks symbols that are sysprocs. */ #define SF_BALNAME 0x00000080 /* bit 7 marks BALNAME symbols. */ #define SF_CALLNAME 0x00000100 /* bit 8 marks CALLNAME symbols. */ #define SF_NORMAL_MASK 0x0000ffff /* bits 12-15 are general purpose. */ #define SF_STATICS 0x00001000 /* Mark the .text & all symbols. */ #define SF_DEFINED 0x00002000 /* Symbol is defined in this file. */ #define SF_STRING 0x00004000 /* Symbol name length > 8. */ #define SF_LOCAL 0x00008000 /* Symbol must not be emitted. */ #define SF_DEBUG_MASK 0xffff0000 /* bits 16-31 are debug info. */ #define SF_FUNCTION 0x00010000 /* The symbol is a function. */ #define SF_PROCESS 0x00020000 /* Process symbol before write. */ #define SF_TAGGED 0x00040000 /* Is associated with a tag. */ #define SF_TAG 0x00080000 /* Is a tag. */ #define SF_DEBUG 0x00100000 /* Is in debug or abs section. */ #define SF_GET_SEGMENT 0x00200000 /* Get the section of the forward symbol. */ /* All other bits are unused. */ /* Accessors. */ #define SF_GET(s) (* symbol_get_obj (s)) #define SF_GET_DEBUG(s) (symbol_get_bfdsym (s)->flags & BSF_DEBUGGING) #define SF_SET_DEBUG(s) (symbol_get_bfdsym (s)->flags |= BSF_DEBUGGING) #define SF_GET_NORMAL_FIELD(s) (SF_GET (s) & SF_NORMAL_MASK) #define SF_GET_DEBUG_FIELD(s) (SF_GET (s) & SF_DEBUG_MASK) #define SF_GET_FILE(s) (SF_GET (s) & SF_FILE) #define SF_GET_STATICS(s) (SF_GET (s) & SF_STATICS) #define SF_GET_DEFINED(s) (SF_GET (s) & SF_DEFINED) #define SF_GET_STRING(s) (SF_GET (s) & SF_STRING) #define SF_GET_LOCAL(s) (SF_GET (s) & SF_LOCAL) #define SF_GET_FUNCTION(s) (SF_GET (s) & SF_FUNCTION) #define SF_GET_PROCESS(s) (SF_GET (s) & SF_PROCESS) #define SF_GET_TAGGED(s) (SF_GET (s) & SF_TAGGED) #define SF_GET_TAG(s) (SF_GET (s) & SF_TAG) #define SF_GET_GET_SEGMENT(s) (SF_GET (s) & SF_GET_SEGMENT) #define SF_GET_I960(s) (SF_GET (s) & SF_I960_MASK) /* Used by i960. */ #define SF_GET_BALNAME(s) (SF_GET (s) & SF_BALNAME) /* Used by i960. */ #define SF_GET_CALLNAME(s) (SF_GET (s) & SF_CALLNAME) /* Used by i960. */ #define SF_GET_IS_SYSPROC(s) (SF_GET (s) & SF_IS_SYSPROC) /* Used by i960. */ #define SF_GET_SYSPROC(s) (SF_GET (s) & SF_SYSPROC) /* Used by i960. */ /* Modifiers. */ #define SF_SET(s,v) (SF_GET (s) = (v)) #define SF_SET_NORMAL_FIELD(s,v)(SF_GET (s) |= ((v) & SF_NORMAL_MASK)) #define SF_SET_DEBUG_FIELD(s,v) (SF_GET (s) |= ((v) & SF_DEBUG_MASK)) #define SF_SET_FILE(s) (SF_GET (s) |= SF_FILE) #define SF_SET_STATICS(s) (SF_GET (s) |= SF_STATICS) #define SF_SET_DEFINED(s) (SF_GET (s) |= SF_DEFINED) #define SF_SET_STRING(s) (SF_GET (s) |= SF_STRING) #define SF_SET_LOCAL(s) (SF_GET (s) |= SF_LOCAL) #define SF_CLEAR_LOCAL(s) (SF_GET (s) &= ~SF_LOCAL) #define SF_SET_FUNCTION(s) (SF_GET (s) |= SF_FUNCTION) #define SF_SET_PROCESS(s) (SF_GET (s) |= SF_PROCESS) #define SF_SET_TAGGED(s) (SF_GET (s) |= SF_TAGGED) #define SF_SET_TAG(s) (SF_GET (s) |= SF_TAG) #define SF_SET_GET_SEGMENT(s) (SF_GET (s) |= SF_GET_SEGMENT) #define SF_SET_I960(s,v) (SF_GET (s) |= ((v) & SF_I960_MASK)) /* Used by i960. */ #define SF_SET_BALNAME(s) (SF_GET (s) |= SF_BALNAME) /* Used by i960. */ #define SF_SET_CALLNAME(s) (SF_GET (s) |= SF_CALLNAME) /* Used by i960. */ #define SF_SET_IS_SYSPROC(s) (SF_GET (s) |= SF_IS_SYSPROC) /* Used by i960. */ #define SF_SET_SYSPROC(s,v) (SF_GET (s) |= ((v) & SF_SYSPROC)) /* Used by i960. */ /* Line number handling. */ extern int text_lineno_number; extern int coff_line_base; extern int coff_n_line_nos; extern symbolS *coff_last_function; #define obj_emit_lineno(WHERE, LINE, FILE_START) abort () #define obj_app_file(name, app) c_dot_file_symbol (name, app) #define obj_frob_symbol(S,P) coff_frob_symbol (S, & P) #define obj_frob_section(S) coff_frob_section (S) #define obj_frob_file_after_relocs() coff_frob_file_after_relocs () #ifndef obj_adjust_symtab #define obj_adjust_symtab() coff_adjust_symtab () #endif /* Forward the segment of a forwarded symbol, handle assignments that just copy symbol values, etc. */ #ifndef OBJ_COPY_SYMBOL_ATTRIBUTES #ifndef TE_I386AIX #define OBJ_COPY_SYMBOL_ATTRIBUTES(dest, src) \ (SF_GET_GET_SEGMENT (dest) \ ? (S_SET_SEGMENT (dest, S_GET_SEGMENT (src)), 0) \ : 0) #else #define OBJ_COPY_SYMBOL_ATTRIBUTES(dest, src) \ (SF_GET_GET_SEGMENT (dest) && S_GET_SEGMENT (dest) == SEG_UNKNOWN \ ? (S_SET_SEGMENT (dest, S_GET_SEGMENT (src)), 0) \ : 0) #endif #endif /* Sanity check. */ #ifdef TC_I960 #ifndef C_LEAFSTAT hey ! Where is the C_LEAFSTAT definition ? i960 - coff support is depending on it. #endif /* no C_LEAFSTAT */ #endif /* TC_I960 */ extern const pseudo_typeS coff_pseudo_table[]; #ifndef obj_pop_insert #define obj_pop_insert() pop_insert (coff_pseudo_table) #endif /* In COFF, if a symbol is defined using .def/.val SYM/.endef, it's OK to redefine the symbol later on. This can happen if C symbols use a prefix, and a symbol is defined both with and without the prefix, as in start/_start/__start in gcc/libgcc1-test.c. */ #define RESOLVE_SYMBOL_REDEFINITION(sym) \ (SF_GET_GET_SEGMENT (sym) \ ? (sym->sy_frag = frag_now, \ S_SET_VALUE (sym, frag_now_fix ()), \ S_SET_SEGMENT (sym, now_seg), \ 0) \ : 0) /* Stabs in a coff file go into their own section. */ #define SEPARATE_STAB_SECTIONS 1 /* We need 12 bytes at the start of the section to hold some initial information. */ #define INIT_STAB_SECTION(seg) obj_coff_init_stab_section (seg) /* Store the number of relocations in the section aux entry. */ #define SET_SECTION_RELOCS(sec, relocs, n) \ SA_SET_SCN_NRELOC (section_symbol (sec), n) #define obj_app_file(name, app) c_dot_file_symbol (name, app) extern int S_SET_DATA_TYPE (symbolS *, int); extern int S_SET_STORAGE_CLASS (symbolS *, int); extern int S_GET_STORAGE_CLASS (symbolS *); extern void SA_SET_SYM_ENDNDX (symbolS *, symbolS *); extern void coff_add_linesym (symbolS *); extern void c_dot_file_symbol (const char *, int); extern void coff_frob_symbol (symbolS *, int *); extern void coff_adjust_symtab (void); extern void coff_frob_section (segT); extern void coff_adjust_section_syms (bfd *, asection *, void *); extern void coff_frob_file_after_relocs (void); extern void coff_obj_symbol_new_hook (symbolS *); extern void coff_obj_symbol_clone_hook (symbolS *, symbolS *); extern void coff_obj_read_begin_hook (void); #ifdef TE_PE extern void pecoff_obj_set_weak_hook (symbolS *); extern void pecoff_obj_clear_weak_hook (symbolS *); #endif extern void obj_coff_section (int); extern segT obj_coff_add_segment (const char *); extern void obj_coff_section (int); extern void c_dot_file_symbol (const char *, int); extern segT s_get_segment (symbolS *); #ifndef tc_coff_symbol_emit_hook extern void tc_coff_symbol_emit_hook (symbolS *); #endif extern void obj_coff_pe_handle_link_once (void); extern void obj_coff_init_stab_section (segT); extern void c_section_header (struct internal_scnhdr *, char *, long, long, long, long, long, long, long, long); extern void obj_coff_seh_do_final (void); #ifndef obj_coff_generate_pdata #define obj_coff_generate_pdata obj_coff_seh_do_final #endif #endif /* OBJ_FORMAT_H */
WojciechMigda/binutils
gas/config/obj-coff.h
C
gpl-2.0
14,188
32.780952
89
0.674866
false
/************************************************************** * Copyright (C) 2010 STMicroelectronics. All Rights Reserved. * This file is part of the latest release of the Multicom4 project. This release * is fully functional and provides all of the original MME functionality.This * release is now considered stable and ready for integration with other software * components. * Multicom4 is a free software; you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software Foundation * version 2. * Multicom4 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU General Public License for more details. * You should have received a copy of the GNU General Public License along with Multicom4; * see the file COPYING. If not, write to the Free Software Foundation, 59 Temple Place - * Suite 330, Boston, MA 02111-1307, USA. * Written by Multicom team at STMicroelectronics in November 2010. * Contact multicom.support@st.com. **************************************************************/ /* * */ /* * sti7200 ST231 Video1 */ #include <bsp/_bsp.h> const char *bsp_cpu_name = "video1"; /* * Local Variables: * tab-width: 8 * c-indent-level: 2 * c-basic-offset: 2 * End: */
project-magpie/tdt-driver
multicom-4.0.6/src/bsp/stx7200/st231/video1/name.c
C
gpl-2.0
1,425
32.928571
93
0.663158
false
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!--NewPage--> <HTML> <HEAD> <!-- Generated by javadoc (build 1.6.0_18) on Tue Nov 02 13:16:47 CET 2010 --> <TITLE> Filter </TITLE> <META NAME="date" CONTENT="2010-11-02"> <LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../../stylesheet.css" TITLE="Style"> <SCRIPT type="text/javascript"> function windowTitle() { if (location.href.indexOf('is-external=true') == -1) { parent.document.title="Filter"; } } </SCRIPT> <NOSCRIPT> </NOSCRIPT> </HEAD> <BODY BGCOLOR="white" onload="windowTitle();"> <HR> <!-- ========= START OF TOP NAVBAR ======= --> <A NAME="navbar_top"><!-- --></A> <A HREF="#skip-navbar_top" title="Skip navigation links"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_top_firstrow"><!-- --></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> &nbsp;<A HREF="../../../../../../com/redhat/rhn/domain/monitoring/notification/Criteria.html" title="class in com.redhat.rhn.domain.monitoring.notification"><B>PREV CLASS</B></A>&nbsp; &nbsp;<A HREF="../../../../../../com/redhat/rhn/domain/monitoring/notification/FilterType.html" title="class in com.redhat.rhn.domain.monitoring.notification"><B>NEXT CLASS</B></A></FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../../../index.html?com/redhat/rhn/domain/monitoring/notification/Filter.html" target="_top"><B>FRAMES</B></A> &nbsp; &nbsp;<A HREF="Filter.html" target="_top"><B>NO FRAMES</B></A> &nbsp; &nbsp;<SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A>'); } //--> </SCRIPT> <NOSCRIPT> <A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A> </NOSCRIPT> </FONT></TD> </TR> <TR> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> DETAIL:&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_top"></A> <!-- ========= END OF TOP NAVBAR ========= --> <HR> <!-- ======== START OF CLASS DATA ======== --> <H2> <FONT SIZE="-1"> com.redhat.rhn.domain.monitoring.notification</FONT> <BR> Class Filter</H2> <PRE> java.lang.Object <IMG SRC="../../../../../../resources/inherit.gif" ALT="extended by "><B>com.redhat.rhn.domain.monitoring.notification.Filter</B> </PRE> <HR> <DL> <DT><PRE>public class <B>Filter</B><DT>extends java.lang.Object</DL> </PRE> <P> Filter - Class representation of the table rhn_redirects. <P> <P> <HR> <P> <!-- ======== CONSTRUCTOR SUMMARY ======== --> <A NAME="constructor_summary"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> <B>Constructor Summary</B></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><CODE><B><A HREF="../../../../../../com/redhat/rhn/domain/monitoring/notification/Filter.html#Filter()">Filter</A></B>()</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD> </TR> </TABLE> &nbsp; <!-- ========== METHOD SUMMARY =========== --> <A NAME="method_summary"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> <B>Method Summary</B></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;<A HREF="../../../../../../com/redhat/rhn/domain/monitoring/notification/Criteria.html" title="class in com.redhat.rhn.domain.monitoring.notification">Criteria</A></CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../../com/redhat/rhn/domain/monitoring/notification/Filter.html#addCriteria(com.redhat.rhn.domain.monitoring.notification.MatchType, java.lang.String)">addCriteria</A></B>(<A HREF="../../../../../../com/redhat/rhn/domain/monitoring/notification/MatchType.html" title="class in com.redhat.rhn.domain.monitoring.notification">MatchType</A>&nbsp;matchType, java.lang.String&nbsp;value)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Add a match criteria of the given type that matches against <code>value</code></TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;java.util.Set</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../../com/redhat/rhn/domain/monitoring/notification/Filter.html#getCriteria()">getCriteria</A></B>()</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;java.lang.String</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../../com/redhat/rhn/domain/monitoring/notification/Filter.html#getDescription()">getDescription</A></B>()</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Getter for description</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;java.util.Set</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../../com/redhat/rhn/domain/monitoring/notification/Filter.html#getEmailAddresses()">getEmailAddresses</A></B>()</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;java.util.Date</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../../com/redhat/rhn/domain/monitoring/notification/Filter.html#getExpiration()">getExpiration</A></B>()</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Getter for expiration</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;java.lang.Long</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../../com/redhat/rhn/domain/monitoring/notification/Filter.html#getId()">getId</A></B>()</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;java.util.Date</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../../com/redhat/rhn/domain/monitoring/notification/Filter.html#getLastUpdateDate()">getLastUpdateDate</A></B>()</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Getter for lastUpdateDate</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;java.lang.String</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../../com/redhat/rhn/domain/monitoring/notification/Filter.html#getLastUpdateUser()">getLastUpdateUser</A></B>()</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Getter for lastUpdateUser</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;<A HREF="../../../../../../com/redhat/rhn/domain/org/Org.html" title="class in com.redhat.rhn.domain.org">Org</A></CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../../com/redhat/rhn/domain/monitoring/notification/Filter.html#getOrg()">getOrg</A></B>()</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;java.lang.String</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../../com/redhat/rhn/domain/monitoring/notification/Filter.html#getReason()">getReason</A></B>()</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Getter for reason</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;java.lang.Boolean</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../../com/redhat/rhn/domain/monitoring/notification/Filter.html#getRecurring()">getRecurring</A></B>()</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;java.lang.Long</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../../com/redhat/rhn/domain/monitoring/notification/Filter.html#getRecurringDuration()">getRecurringDuration</A></B>()</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Get the number of minutes we want the recurring filter to run for.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;java.lang.Long</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../../com/redhat/rhn/domain/monitoring/notification/Filter.html#getRecurringDurationType()">getRecurringDurationType</A></B>()</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;java.lang.Long</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../../com/redhat/rhn/domain/monitoring/notification/Filter.html#getRecurringFrequency()">getRecurringFrequency</A></B>()</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;How often this Filter recurrs.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;java.util.Date</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../../com/redhat/rhn/domain/monitoring/notification/Filter.html#getStartDate()">getStartDate</A></B>()</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Getter for startDate</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;<A HREF="../../../../../../com/redhat/rhn/domain/monitoring/notification/FilterType.html" title="class in com.redhat.rhn.domain.monitoring.notification">FilterType</A></CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../../com/redhat/rhn/domain/monitoring/notification/Filter.html#getType()">getType</A></B>()</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;<A HREF="../../../../../../com/redhat/rhn/domain/user/User.html" title="interface in com.redhat.rhn.domain.user">User</A></CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../../com/redhat/rhn/domain/monitoring/notification/Filter.html#getUser()">getUser</A></B>()</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;void</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../../com/redhat/rhn/domain/monitoring/notification/Filter.html#setDescription(java.lang.String)">setDescription</A></B>(java.lang.String&nbsp;descriptionIn)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Setter for description</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;void</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../../com/redhat/rhn/domain/monitoring/notification/Filter.html#setExpiration(java.util.Date)">setExpiration</A></B>(java.util.Date&nbsp;expirationIn)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Setter for expiration</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;void</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../../com/redhat/rhn/domain/monitoring/notification/Filter.html#setId(java.lang.Long)">setId</A></B>(java.lang.Long&nbsp;idIn)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;void</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../../com/redhat/rhn/domain/monitoring/notification/Filter.html#setLastUpdateDate(java.util.Date)">setLastUpdateDate</A></B>(java.util.Date&nbsp;lastUpdateDateIn)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Setter for lastUpdateDate</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;void</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../../com/redhat/rhn/domain/monitoring/notification/Filter.html#setLastUpdateUser(java.lang.String)">setLastUpdateUser</A></B>(java.lang.String&nbsp;lastUpdateUserIn)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Setter for lastUpdateUser</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;void</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../../com/redhat/rhn/domain/monitoring/notification/Filter.html#setOrg(com.redhat.rhn.domain.org.Org)">setOrg</A></B>(<A HREF="../../../../../../com/redhat/rhn/domain/org/Org.html" title="class in com.redhat.rhn.domain.org">Org</A>&nbsp;orgIn)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;void</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../../com/redhat/rhn/domain/monitoring/notification/Filter.html#setReason(java.lang.String)">setReason</A></B>(java.lang.String&nbsp;reasonIn)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Setter for reason</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;void</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../../com/redhat/rhn/domain/monitoring/notification/Filter.html#setRecurring(java.lang.Boolean)">setRecurring</A></B>(java.lang.Boolean&nbsp;recurringIn)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;void</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../../com/redhat/rhn/domain/monitoring/notification/Filter.html#setRecurringDuration(java.lang.Long)">setRecurringDuration</A></B>(java.lang.Long&nbsp;recurringDurationIn)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Set the number of minutes we want the recurring filter to run for.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;void</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../../com/redhat/rhn/domain/monitoring/notification/Filter.html#setRecurringDurationType(java.lang.Long)">setRecurringDurationType</A></B>(java.lang.Long&nbsp;recurringDurationTypeIn)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;void</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../../com/redhat/rhn/domain/monitoring/notification/Filter.html#setRecurringFrequency(java.lang.Long)">setRecurringFrequency</A></B>(java.lang.Long&nbsp;recurringFrequencyIn)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;How often this Filter recurrs.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;void</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../../com/redhat/rhn/domain/monitoring/notification/Filter.html#setStartDate(java.util.Date)">setStartDate</A></B>(java.util.Date&nbsp;startDateIn)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Setter for startDate</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;void</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../../com/redhat/rhn/domain/monitoring/notification/Filter.html#setType(com.redhat.rhn.domain.monitoring.notification.FilterType)">setType</A></B>(<A HREF="../../../../../../com/redhat/rhn/domain/monitoring/notification/FilterType.html" title="class in com.redhat.rhn.domain.monitoring.notification">FilterType</A>&nbsp;typeIn)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;void</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../../com/redhat/rhn/domain/monitoring/notification/Filter.html#setUser(com.redhat.rhn.domain.user.User)">setUser</A></B>(<A HREF="../../../../../../com/redhat/rhn/domain/user/User.html" title="interface in com.redhat.rhn.domain.user">User</A>&nbsp;userIn)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD> </TR> </TABLE> &nbsp;<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"> <TH ALIGN="left"><B>Methods inherited from class java.lang.Object</B></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><CODE>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</CODE></TD> </TR> </TABLE> &nbsp; <P> <!-- ========= CONSTRUCTOR DETAIL ======== --> <A NAME="constructor_detail"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"> <B>Constructor Detail</B></FONT></TH> </TR> </TABLE> <A NAME="Filter()"><!-- --></A><H3> Filter</H3> <PRE> public <B>Filter</B>()</PRE> <DL> </DL> <!-- ============ METHOD DETAIL ========== --> <A NAME="method_detail"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"> <B>Method Detail</B></FONT></TH> </TR> </TABLE> <A NAME="addCriteria(com.redhat.rhn.domain.monitoring.notification.MatchType, java.lang.String)"><!-- --></A><H3> addCriteria</H3> <PRE> public <A HREF="../../../../../../com/redhat/rhn/domain/monitoring/notification/Criteria.html" title="class in com.redhat.rhn.domain.monitoring.notification">Criteria</A> <B>addCriteria</B>(<A HREF="../../../../../../com/redhat/rhn/domain/monitoring/notification/MatchType.html" title="class in com.redhat.rhn.domain.monitoring.notification">MatchType</A>&nbsp;matchType, java.lang.String&nbsp;value)</PRE> <DL> <DD>Add a match criteria of the given type that matches against <code>value</code> <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>matchType</CODE> - the type of match for the criteria<DD><CODE>value</CODE> - the value to match against <DT><B>Returns:</B><DD>the new criteria that has been added to this filter</DL> </DD> </DL> <HR> <A NAME="getId()"><!-- --></A><H3> getId</H3> <PRE> public java.lang.Long <B>getId</B>()</PRE> <DL> <DD><DL> <DT><B>Returns:</B><DD>Returns the id.</DL> </DD> </DL> <HR> <A NAME="setId(java.lang.Long)"><!-- --></A><H3> setId</H3> <PRE> public void <B>setId</B>(java.lang.Long&nbsp;idIn)</PRE> <DL> <DD><DL> <DT><B>Parameters:</B><DD><CODE>idIn</CODE> - The id to set.</DL> </DD> </DL> <HR> <A NAME="getDescription()"><!-- --></A><H3> getDescription</H3> <PRE> public java.lang.String <B>getDescription</B>()</PRE> <DL> <DD>Getter for description <P> <DD><DL> <DT><B>Returns:</B><DD>String to get</DL> </DD> </DL> <HR> <A NAME="setDescription(java.lang.String)"><!-- --></A><H3> setDescription</H3> <PRE> public void <B>setDescription</B>(java.lang.String&nbsp;descriptionIn)</PRE> <DL> <DD>Setter for description <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>descriptionIn</CODE> - to set</DL> </DD> </DL> <HR> <A NAME="getReason()"><!-- --></A><H3> getReason</H3> <PRE> public java.lang.String <B>getReason</B>()</PRE> <DL> <DD>Getter for reason <P> <DD><DL> <DT><B>Returns:</B><DD>String to get</DL> </DD> </DL> <HR> <A NAME="setReason(java.lang.String)"><!-- --></A><H3> setReason</H3> <PRE> public void <B>setReason</B>(java.lang.String&nbsp;reasonIn)</PRE> <DL> <DD>Setter for reason <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>reasonIn</CODE> - to set</DL> </DD> </DL> <HR> <A NAME="getExpiration()"><!-- --></A><H3> getExpiration</H3> <PRE> public java.util.Date <B>getExpiration</B>()</PRE> <DL> <DD>Getter for expiration <P> <DD><DL> <DT><B>Returns:</B><DD>Date to get</DL> </DD> </DL> <HR> <A NAME="setExpiration(java.util.Date)"><!-- --></A><H3> setExpiration</H3> <PRE> public void <B>setExpiration</B>(java.util.Date&nbsp;expirationIn)</PRE> <DL> <DD>Setter for expiration <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>expirationIn</CODE> - to set</DL> </DD> </DL> <HR> <A NAME="getLastUpdateUser()"><!-- --></A><H3> getLastUpdateUser</H3> <PRE> public java.lang.String <B>getLastUpdateUser</B>()</PRE> <DL> <DD>Getter for lastUpdateUser <P> <DD><DL> <DT><B>Returns:</B><DD>String to get</DL> </DD> </DL> <HR> <A NAME="setLastUpdateUser(java.lang.String)"><!-- --></A><H3> setLastUpdateUser</H3> <PRE> public void <B>setLastUpdateUser</B>(java.lang.String&nbsp;lastUpdateUserIn)</PRE> <DL> <DD>Setter for lastUpdateUser <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>lastUpdateUserIn</CODE> - to set</DL> </DD> </DL> <HR> <A NAME="getLastUpdateDate()"><!-- --></A><H3> getLastUpdateDate</H3> <PRE> public java.util.Date <B>getLastUpdateDate</B>()</PRE> <DL> <DD>Getter for lastUpdateDate <P> <DD><DL> <DT><B>Returns:</B><DD>Date to get</DL> </DD> </DL> <HR> <A NAME="setLastUpdateDate(java.util.Date)"><!-- --></A><H3> setLastUpdateDate</H3> <PRE> public void <B>setLastUpdateDate</B>(java.util.Date&nbsp;lastUpdateDateIn)</PRE> <DL> <DD>Setter for lastUpdateDate <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>lastUpdateDateIn</CODE> - to set</DL> </DD> </DL> <HR> <A NAME="getStartDate()"><!-- --></A><H3> getStartDate</H3> <PRE> public java.util.Date <B>getStartDate</B>()</PRE> <DL> <DD>Getter for startDate <P> <DD><DL> <DT><B>Returns:</B><DD>Date to get</DL> </DD> </DL> <HR> <A NAME="setStartDate(java.util.Date)"><!-- --></A><H3> setStartDate</H3> <PRE> public void <B>setStartDate</B>(java.util.Date&nbsp;startDateIn)</PRE> <DL> <DD>Setter for startDate <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>startDateIn</CODE> - to set</DL> </DD> </DL> <HR> <A NAME="getRecurring()"><!-- --></A><H3> getRecurring</H3> <PRE> public java.lang.Boolean <B>getRecurring</B>()</PRE> <DL> <DD><DL> <DT><B>Returns:</B><DD>Returns the recurring.</DL> </DD> </DL> <HR> <A NAME="setRecurring(java.lang.Boolean)"><!-- --></A><H3> setRecurring</H3> <PRE> public void <B>setRecurring</B>(java.lang.Boolean&nbsp;recurringIn)</PRE> <DL> <DD><DL> <DT><B>Parameters:</B><DD><CODE>recurringIn</CODE> - The recurring to set.</DL> </DD> </DL> <HR> <A NAME="getRecurringDuration()"><!-- --></A><H3> getRecurringDuration</H3> <PRE> public java.lang.Long <B>getRecurringDuration</B>()</PRE> <DL> <DD>Get the number of minutes we want the recurring filter to run for. So, if we say the filter is for 30 minutes then each time it runs, it will run for 30 minutes. <P> <DD><DL> <DT><B>Returns:</B><DD>Returns the recurringDuration.</DL> </DD> </DL> <HR> <A NAME="setRecurringDuration(java.lang.Long)"><!-- --></A><H3> setRecurringDuration</H3> <PRE> public void <B>setRecurringDuration</B>(java.lang.Long&nbsp;recurringDurationIn)</PRE> <DL> <DD>Set the number of minutes we want the recurring filter to run for. So, if we say the filter is for 30 minutes then each time it runs, it will run for 30 minutes. <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>recurringDurationIn</CODE> - The recurringDuration to set.</DL> </DD> </DL> <HR> <A NAME="getRecurringDurationType()"><!-- --></A><H3> getRecurringDurationType</H3> <PRE> public java.lang.Long <B>getRecurringDurationType</B>()</PRE> <DL> <DD><DL> <DT><B>Returns:</B><DD>Returns the recurringDurationType.</DL> </DD> </DL> <HR> <A NAME="setRecurringDurationType(java.lang.Long)"><!-- --></A><H3> setRecurringDurationType</H3> <PRE> public void <B>setRecurringDurationType</B>(java.lang.Long&nbsp;recurringDurationTypeIn)</PRE> <DL> <DD><DL> <DT><B>Parameters:</B><DD><CODE>recurringDurationTypeIn</CODE> - The recurringDurationType to set.</DL> </DD> </DL> <HR> <A NAME="getRecurringFrequency()"><!-- --></A><H3> getRecurringFrequency</H3> <PRE> public java.lang.Long <B>getRecurringFrequency</B>()</PRE> <DL> <DD>How often this Filter recurrs. These values correspond to the constants defined in java.util.Calendar: public final static int DAY_OF_YEAR = 6; public final static int WEEK_OF_YEAR = 3; public final static int MONTH = 2; <P> <DD><DL> <DT><B>Returns:</B><DD>Returns the recurringFrequency.</DL> </DD> </DL> <HR> <A NAME="setRecurringFrequency(java.lang.Long)"><!-- --></A><H3> setRecurringFrequency</H3> <PRE> public void <B>setRecurringFrequency</B>(java.lang.Long&nbsp;recurringFrequencyIn)</PRE> <DL> <DD>How often this Filter recurrs. These values correspond to the constants defined in java.util.Calendar: public final static int DAY_OF_YEAR = 6; public final static int WEEK_OF_YEAR = 3; public final static int MONTH = 2; <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>recurringFrequencyIn</CODE> - The recurringFrequency to set.</DL> </DD> </DL> <HR> <A NAME="getOrg()"><!-- --></A><H3> getOrg</H3> <PRE> public <A HREF="../../../../../../com/redhat/rhn/domain/org/Org.html" title="class in com.redhat.rhn.domain.org">Org</A> <B>getOrg</B>()</PRE> <DL> <DD><DL> <DT><B>Returns:</B><DD>Returns the org.</DL> </DD> </DL> <HR> <A NAME="setOrg(com.redhat.rhn.domain.org.Org)"><!-- --></A><H3> setOrg</H3> <PRE> public void <B>setOrg</B>(<A HREF="../../../../../../com/redhat/rhn/domain/org/Org.html" title="class in com.redhat.rhn.domain.org">Org</A>&nbsp;orgIn)</PRE> <DL> <DD><DL> <DT><B>Parameters:</B><DD><CODE>orgIn</CODE> - The org to set.</DL> </DD> </DL> <HR> <A NAME="getUser()"><!-- --></A><H3> getUser</H3> <PRE> public <A HREF="../../../../../../com/redhat/rhn/domain/user/User.html" title="interface in com.redhat.rhn.domain.user">User</A> <B>getUser</B>()</PRE> <DL> <DD><DL> <DT><B>Returns:</B><DD>Returns the user.</DL> </DD> </DL> <HR> <A NAME="setUser(com.redhat.rhn.domain.user.User)"><!-- --></A><H3> setUser</H3> <PRE> public void <B>setUser</B>(<A HREF="../../../../../../com/redhat/rhn/domain/user/User.html" title="interface in com.redhat.rhn.domain.user">User</A>&nbsp;userIn)</PRE> <DL> <DD><DL> <DT><B>Parameters:</B><DD><CODE>userIn</CODE> - The user to set.</DL> </DD> </DL> <HR> <A NAME="getType()"><!-- --></A><H3> getType</H3> <PRE> public <A HREF="../../../../../../com/redhat/rhn/domain/monitoring/notification/FilterType.html" title="class in com.redhat.rhn.domain.monitoring.notification">FilterType</A> <B>getType</B>()</PRE> <DL> <DD><DL> <DT><B>Returns:</B><DD>Returns the type.</DL> </DD> </DL> <HR> <A NAME="setType(com.redhat.rhn.domain.monitoring.notification.FilterType)"><!-- --></A><H3> setType</H3> <PRE> public void <B>setType</B>(<A HREF="../../../../../../com/redhat/rhn/domain/monitoring/notification/FilterType.html" title="class in com.redhat.rhn.domain.monitoring.notification">FilterType</A>&nbsp;typeIn)</PRE> <DL> <DD><DL> <DT><B>Parameters:</B><DD><CODE>typeIn</CODE> - The type to set.</DL> </DD> </DL> <HR> <A NAME="getCriteria()"><!-- --></A><H3> getCriteria</H3> <PRE> public java.util.Set <B>getCriteria</B>()</PRE> <DL> <DD><DL> <DT><B>Returns:</B><DD>Returns the criteria.</DL> </DD> </DL> <HR> <A NAME="getEmailAddresses()"><!-- --></A><H3> getEmailAddresses</H3> <PRE> public java.util.Set <B>getEmailAddresses</B>()</PRE> <DL> <DD><DL> <DT><B>Returns:</B><DD>Returns the emailAddresses.</DL> </DD> </DL> <!-- ========= END OF CLASS DATA ========= --> <HR> <!-- ======= START OF BOTTOM NAVBAR ====== --> <A NAME="navbar_bottom"><!-- --></A> <A HREF="#skip-navbar_bottom" title="Skip navigation links"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_bottom_firstrow"><!-- --></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> &nbsp;<A HREF="../../../../../../com/redhat/rhn/domain/monitoring/notification/Criteria.html" title="class in com.redhat.rhn.domain.monitoring.notification"><B>PREV CLASS</B></A>&nbsp; &nbsp;<A HREF="../../../../../../com/redhat/rhn/domain/monitoring/notification/FilterType.html" title="class in com.redhat.rhn.domain.monitoring.notification"><B>NEXT CLASS</B></A></FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../../../index.html?com/redhat/rhn/domain/monitoring/notification/Filter.html" target="_top"><B>FRAMES</B></A> &nbsp; &nbsp;<A HREF="Filter.html" target="_top"><B>NO FRAMES</B></A> &nbsp; &nbsp;<SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A>'); } //--> </SCRIPT> <NOSCRIPT> <A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A> </NOSCRIPT> </FONT></TD> </TR> <TR> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> DETAIL:&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_bottom"></A> <!-- ======== END OF BOTTOM NAVBAR ======= --> <HR> </BODY> </HTML>
colloquium/spacewalk
documentation/javadoc/com/redhat/rhn/domain/monitoring/notification/Filter.html
HTML
gpl-2.0
33,065
35.944134
387
0.644549
false
<?php /** * @version $Id: #component#.php 125 2012-10-09 11:09:48Z michel $ 1 2014-05-11Z FT $ * @package Kepviselojeloltek * @copyright Copyright (C) 2014, Fogler Tibor. All rights reserved. * @license #GNU/GPL */ //--No direct access defined('_JEXEC') or die('=;)'); // DS has removed from J 3.0 if(!defined('DS')) { define('DS','/'); } // Require the base controller require_once( JPATH_COMPONENT.'/controller.php' ); jimport('joomla.application.component.model'); require_once( JPATH_COMPONENT.'/models/model.php' ); jimport('joomla.application.component.helper'); JHTML::addIncludePath(JPATH_COMPONENT_ADMINISTRATOR.'/helpers' ); //set the default view $task = JRequest::getWord('task'); $config =& JComponentHelper::getParams( 'com_kepviselojeloltek' ); $controller = JRequest::getWord('view', 'kepviselojeloltek'); $ControllerConfig = array(); // Require specific controller if requested if ($controller) { $path = JPATH_COMPONENT.'/controllers/'.$controller.'.php'; $ControllerConfig = array('viewname'=>strtolower($controller),'mainmodel'=>strtolower($controller),'itemname'=>ucfirst(strtolower($controller))); if (file_exists($path)) { require_once $path; } else { $controller = ''; } } // Create the controller $classname = 'KepviselojeloltekController'.$controller; $controller = new $classname($ControllerConfig ); // Perform the Request task $controller->execute( JRequest::getVar( 'task' ) ); // Redirect if set by the controller $controller->redirect();
utopszkij/li-de
componens_telepitok/com_kepviselojeltek/site/kepviselojeloltek.php
PHP
gpl-2.0
1,527
26.781818
150
0.693517
false
package org.emulinker.kaillera.controller.v086.action; import java.util.*; import org.apache.commons.logging.*; import org.emulinker.kaillera.access.AccessManager; import org.emulinker.kaillera.controller.messaging.MessageFormatException; import org.emulinker.kaillera.controller.v086.V086Controller; import org.emulinker.kaillera.controller.v086.protocol.*; import org.emulinker.kaillera.model.exception.ActionException; import org.emulinker.kaillera.model.impl.*; import org.emulinker.kaillera.model.*; import org.emulinker.util.EmuLang; import org.emulinker.util.WildcardStringPattern; public class GameOwnerCommandAction implements V086Action { public static final String COMMAND_HELP = "/help"; //$NON-NLS-1$ public static final String COMMAND_DETECTAUTOFIRE = "/detectautofire"; //$NON-NLS-1$ private static Log log = LogFactory.getLog(GameOwnerCommandAction.class); private static final String desc = "GameOwnerCommandAction"; //$NON-NLS-1$ private static GameOwnerCommandAction singleton = new GameOwnerCommandAction(); public static GameOwnerCommandAction getInstance() { return singleton; } private int actionCount = 0; private GameOwnerCommandAction() { } public int getActionPerformedCount() { return actionCount; } public String toString() { return desc; } public void performAction(V086Message message, V086Controller.V086ClientHandler clientHandler) throws FatalActionException { GameChat chatMessage = (GameChat) message; String chat = chatMessage.getMessage(); KailleraUserImpl user = (KailleraUserImpl) clientHandler.getUser(); KailleraGameImpl game = user.getGame(); if(game == null) { throw new FatalActionException("GameOwner Command Failed: Not in a game: " + chat); //$NON-NLS-1$ } if(!user.equals(game.getOwner())) { log.warn("GameOwner Command Denied: Not game owner: " + game + ": " + user + ": " + chat); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ return; } try { if (chat.startsWith(COMMAND_HELP)) { processHelp(chat, game, user, clientHandler); } else if (chat.startsWith(COMMAND_DETECTAUTOFIRE)) { processDetectAutoFire(chat, game, user, clientHandler); } else { log.info("Unknown GameOwner Command: " + game + ": " + user + ": " + chat); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } } catch (ActionException e) { log.info("GameOwner Command Failed: " + game + ": " + user + ": " + chat); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ game.announce(EmuLang.getString("GameOwnerCommandAction.CommandFailed", e.getMessage())); //$NON-NLS-1$ } catch (MessageFormatException e) { log.error("Failed to contruct message: " + e.getMessage(), e); //$NON-NLS-1$ } } private void processHelp(String message, KailleraGameImpl game, KailleraUserImpl admin, V086Controller.V086ClientHandler clientHandler) throws ActionException, MessageFormatException { game.announce(EmuLang.getString("GameOwnerCommandAction.AvailableCommands")); //$NON-NLS-1$ game.announce(EmuLang.getString("GameOwnerCommandAction.SetAutofireDetection")); //$NON-NLS-1$ } private void autoFireHelp(KailleraGameImpl game) { int cur = game.getAutoFireDetector().getSensitivity(); game.announce(EmuLang.getString("GameOwnerCommandAction.HelpSensitivity")); //$NON-NLS-1$ game.announce(EmuLang.getString("GameOwnerCommandAction.HelpDisable")); //$NON-NLS-1$ game.announce(EmuLang.getString("GameOwnerCommandAction.HelpCurrentSensitivity", cur) + (cur == 0 ? (EmuLang.getString("GameOwnerCommandAction.HelpDisabled")) : "")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } private void processDetectAutoFire(String message, KailleraGameImpl game, KailleraUserImpl admin, V086Controller.V086ClientHandler clientHandler) throws ActionException, MessageFormatException { if(game.getStatus() != KailleraGame.STATUS_WAITING) { game.announce(EmuLang.getString("GameOwnerCommandAction.AutoFireChangeDeniedInGame")); //$NON-NLS-1$ return; } StringTokenizer st = new StringTokenizer(message, " "); //$NON-NLS-1$ if(st.countTokens() != 2) { autoFireHelp(game); return; } String command = st.nextToken(); String sensitivityStr = st.nextToken(); int sensitivity = -1; try { sensitivity = Integer.parseInt(sensitivityStr); } catch(NumberFormatException e) {} if(sensitivity > 5 || sensitivity < 0) { autoFireHelp(game); return; } game.getAutoFireDetector().setSensitivity(sensitivity); game.announce(EmuLang.getString("GameOwnerCommandAction.HelpCurrentSensitivity", sensitivity) + (sensitivity == 0 ? (EmuLang.getString("GameOwnerCommandAction.HelpDisabled")) : "")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } }
monospacesoftware/emulinker
src/org/emulinker/kaillera/controller/v086/action/GameOwnerCommandAction.java
Java
gpl-2.0
4,749
32.921429
226
0.722047
false
<?php /** * Manages the social plugins. * * @copyright 2009-2019 Vanilla Forums Inc. * @license GPL-2.0-only * @package Dashboard * @since 2.1 */ /** * Handles /social endpoint, so it must be an extrovert. */ class SocialController extends DashboardController { /** @var array Models to automatically instantiate. */ public $Uses = ['Form', 'Database']; /** * Runs before every call to this controller. */ public function initialize() { parent::initialize(); Gdn_Theme::section('Settings'); } /** * Default method. */ public function index() { redirectTo('social/manage'); } /** * Settings page. */ public function manage() { $this->permission('Garden.Settings.Manage'); $this->title("Social Connect Addons"); $this->setHighlightRoute('/social/manage'); $connections = $this->getConnections(); $this->setData('Connections', $connections); $this->render(); } /** * Find available social plugins. * * @return array|mixed * @throws Exception */ protected function getConnections() { $this->fireEvent('GetConnections'); $connections = []; $addons = Gdn::addonManager()->lookupAllByType(\Vanilla\Addon::TYPE_ADDON); foreach ($addons as $addonName => $addon) { /* @var \Vanilla\Addon $addon */ $addonInfo = $addon->getInfo(); // Limit to designated social addons. if (!array_key_exists('socialConnect', $addonInfo)) { continue; } // See if addon is enabled. $isEnabled = Gdn::addonManager()->isEnabled($addonName, \Vanilla\Addon::TYPE_ADDON); setValue('enabled', $addonInfo, $isEnabled); if (!$isEnabled && !empty($addonInfo['hidden'])) { // Don't show hidden addons unless they are enabled. continue; } // See if we can detect whether connection is configured. $isConfigured = null; if ($isEnabled) { $pluginInstance = Gdn::pluginManager()->getPluginInstance($addonName, Gdn_PluginManager::ACCESS_PLUGINNAME); if (method_exists($pluginInstance, 'isConfigured')) { $isConfigured = $pluginInstance->isConfigured(); } } setValue('configured', $addonInfo, $isConfigured); // Add the connection. $connections[$addonName] = $addonInfo; } return $connections; } }
vanilla/vanilla
applications/dashboard/controllers/class.socialcontroller.php
PHP
gpl-2.0
2,628
26.957447
124
0.555936
false
<?php // if( isset( $_POST ) ) { // echo '<code><pre>'; // var_dump( $_POST ); // echo '</pre></code>'; // } class SpeoOptions { /** * Holds the values to be used in the fields callbacks */ private $options; /** * Start up */ public function __construct() { add_action( 'admin_menu', array( $this, 'add_plugin_page' ) ); add_action( 'admin_init', array( $this, 'page_init' ) ); } /** * Add options page */ public function add_plugin_page() { // This page will be under "Settings" add_options_page( 'Settings Admin', 'Exiftool Options', 'manage_options', 'speo_exif_options', array( $this, 'create_admin_page' ) ); } /** * Options page callback */ public function create_admin_page() { // Set class property $this->options = get_option( 'speo_options' ); ?> <div class="wrap"> <?php screen_icon(); ?> <h2>Exiftools Settings</h2> <form method="post" action="options.php"> <?php // This prints out all hidden setting fields settings_fields( 'speo_options_group' ); do_settings_sections( 'speo_exif_options' ); echo '</ol>'; submit_button(); ?> </form> </div> <?php } /** * Register and add settings */ public function page_init() { register_setting( 'speo_options_group', // Option group 'speo_options', // Option name array( $this, 'sanitize' ) // Sanitize ); add_settings_section( 'speo_options_all', // ID 'Options', // Title array( $this, 'print_section_info' ), // Callback 'speo_exif_options' // Page ); //get the blog language $this_lang = get_locale(); //get the values from the list.xml $xmldoc = new DOMDocument(); $xmldoc->load( plugin_dir_path( __FILE__ ) . 'list.xml' ); $xpathvar = new Domxpath($xmldoc); $queryResult = $xpathvar->query('//tag/@name'); $possible_values = array(); foreach( $queryResult as $result ){ if( substr( $result->textContent, 0, 9 ) === 'MakerNote' ) continue; $possible_values[ $result->textContent ] = 0; ksort( $possible_values ); } foreach( $possible_values as $value => $bool ) { // $xpath = new Domxpath($xmldoc); // $descs = $xpath->query('//tag[@name="' . $value . '"]/desc[@lang="en"]'); // $titles = $xpath->query('//tag[@name="' . $value . '"]/desc[@lang="' . substr( $this_lang, 0, 2 ) . '"]'); // foreach( $descs as $desc ) { // $i=1; // $opt_title = '<li>' . $value; // foreach( $titles as $title ) { // if( $i > 1 ) // continue; // $opt_title .= '<br />(' . $title->textContent . ')'; // $i++; // } // $opt_title .= '</li>'; //add the actual setting add_settings_field( 'speo_exif_' . $value, // ID $value, // Title array( $this, 'speo_callback' ), // Callback 'speo_exif_options', // Page 'speo_options_all', // Section $value //args ); // } } } /** * Sanitize each setting field as needed * * @param array $input Contains all settings fields as array keys */ public function sanitize( $inputs ) { return $inputs; } /** * Print the Section text */ public function print_section_info() { print 'Check the values you want to retreive from images:<ol>'; } /** * Get the settings option array and print one of its values */ public function speo_callback( $value ) { // echo '<code><pre>'; // var_dump($this->options); // echo '</pre></code>'; printf( '<input type="checkbox" id="speo_exif_' . $value . '" name="speo_options[' . $value . ']" %s />', checked( isset( $this->options[$value] ), true, false ) // ( isset( $this->options[$value] ) ? $this->options[$value] : 'none' ) ); } } if( is_admin() ) $my_settings_page = new SpeoOptions();
alpipego/speo-exiftool
speo-options.php
PHP
gpl-2.0
4,439
25.740964
112
0.478486
false
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Management; using ProductMan.Utilities; using ProductMan.Win32; using System.Reflection; namespace ProductMan { public class WMIVendor : IDisposable { protected static WMIVendor instance; protected ManagementScope scope; protected ConnectionOptions conn; protected ComputerSystem computer; protected NetworkAdapterConfiguration networkAdapterConfig; protected ProductMan.Win32.OperatingSystem os; protected static volatile object syncRoot = new object(); private WMIVendor() { conn = new ConnectionOptions(); scope = new ManagementScope("\\\\localhost", conn); scope.Options.Impersonation = ImpersonationLevel.Impersonate; } public ComputerSystem GetComputerSystem() { if (computer != null) return computer; computer = new ComputerSystem(); try { ManagementObjectCollection res = Query("select * from win32_ComputerSystem"); FieldInfo[] fields = typeof(ComputerSystem).GetFields(); foreach (ManagementObject item in res) { foreach (FieldInfo info in fields) { try { info.SetValue(computer, item[info.Name]); } catch { } } break; } } catch (Exception ex) { LoggerBase.Instance.Error(ex.ToString()); } return computer; } public NetworkAdapterConfiguration GetNetworkConfig() { if (networkAdapterConfig != null) return networkAdapterConfig; networkAdapterConfig = new NetworkAdapterConfiguration(); try { ManagementObjectCollection res = Query("select * from win32_NetworkAdapterConfiguration WHERE IPEnabled = 'TRUE'"); FieldInfo[] fields = typeof(NetworkAdapterConfiguration).GetFields(); foreach (ManagementObject item in res) { foreach (FieldInfo info in fields) { try { info.SetValue(networkAdapterConfig, item[info.Name]); } catch { } } break; } } catch (Exception ex) { LoggerBase.Instance.Error(ex.ToString()); } return networkAdapterConfig; } public ProductMan.Win32.OperatingSystem GetOS() { if (os != null) return os; os = new ProductMan.Win32.OperatingSystem(); try { ManagementObjectCollection res = Query("select * from win32_OperatingSystem"); FieldInfo[] fields = typeof(ProductMan.Win32.OperatingSystem).GetFields(); foreach (ManagementObject item in res) { foreach (FieldInfo info in fields) { try { info.SetValue(os, item[info.Name]); } catch { } } break; } } catch (Exception ex) { LoggerBase.Instance.Error(ex.ToString()); } return os; } private ManagementObjectCollection Query(string queryString) { try { ObjectQuery query = new ObjectQuery(queryString); ManagementObjectSearcher searcher = new ManagementObjectSearcher(scope, query); return searcher.Get(); } catch (Exception ex) { LoggerBase.Instance.Error(ex.ToString()); } return null; } public static WMIVendor Instance { get { if (instance == null) { lock (syncRoot) { if (instance == null) instance = new WMIVendor(); } } return instance; } } #region IDisposable Members public void Dispose() { //TODO } #endregion } }
CecleCW/ProductMan
ProductMan/ProductMan/WMIVendor.cs
C#
gpl-2.0
4,918
30.130719
131
0.456672
false
/* * linux/drivers/mmc/core/core.c * * Copyright (C) 2003-2004 Russell King, All Rights Reserved. * SD support Copyright (C) 2004 Ian Molton, All Rights Reserved. * Copyright (C) 2005-2008 Pierre Ossman, All Rights Reserved. * MMCv4 support Copyright (C) 2006 Philip Langdale, All Rights Reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. */ #include <linux/module.h> #include <linux/init.h> #include <linux/interrupt.h> #include <linux/completion.h> #include <linux/device.h> #include <linux/delay.h> #include <linux/pagemap.h> #include <linux/err.h> #include <linux/leds.h> #include <linux/scatterlist.h> #include <linux/log2.h> #include <linux/regulator/consumer.h> #include <linux/pm_runtime.h> #include <linux/suspend.h> #include <linux/fault-inject.h> #include <linux/random.h> #include <linux/wakelock.h> #include <linux/pm.h> #include <linux/slab.h> #include <linux/jiffies.h> #include <linux/mmc/card.h> #include <linux/mmc/host.h> #include <linux/mmc/mmc.h> #include <linux/mmc/sd.h> #include "core.h" #include "bus.h" #include "host.h" #include "sdio_bus.h" #include "mmc_ops.h" #include "sd_ops.h" #include "sdio_ops.h" #define CREATE_TRACE_POINTS #include <trace/events/mmc.h> /* If the device is not responding */ #define MMC_CORE_TIMEOUT_MS (10 * 60 * 1000) /* 10 minute timeout */ static void mmc_clk_scaling(struct mmc_host *host, bool from_wq); /* * Background operations can take a long time, depending on the housekeeping * operations the card has to perform. */ #define MMC_BKOPS_MAX_TIMEOUT (30 * 1000) /* max time to wait in ms */ /* Flushing a large amount of cached data may take a long time. */ #define MMC_FLUSH_REQ_TIMEOUT_MS 30000 /* msec */ static struct workqueue_struct *workqueue; /* * Enabling software CRCs on the data blocks can be a significant (30%) * performance cost, and for other reasons may not always be desired. * So we allow it it to be disabled. */ bool use_spi_crc = 0; module_param(use_spi_crc, bool, 0755); /* * We normally treat cards as removed during suspend if they are not * known to be on a non-removable bus, to avoid the risk of writing * back data to a different card after resume. Allow this to be * overridden if necessary. */ #ifdef CONFIG_MMC_UNSAFE_RESUME bool mmc_assume_removable; #else bool mmc_assume_removable = 1; #endif EXPORT_SYMBOL(mmc_assume_removable); module_param_named(removable, mmc_assume_removable, bool, 0644); MODULE_PARM_DESC( removable, "MMC/SD cards are removable and may be removed during suspend"); /* * Internal function. Schedule delayed work in the MMC work queue. */ static int mmc_schedule_delayed_work(struct delayed_work *work, unsigned long delay) { return queue_delayed_work(workqueue, work, delay); } /* * Internal function. Flush all scheduled work from the MMC work queue. */ static void mmc_flush_scheduled_work(void) { flush_workqueue(workqueue); } #ifdef CONFIG_FAIL_MMC_REQUEST /* * Internal function. Inject random data errors. * If mmc_data is NULL no errors are injected. */ static void mmc_should_fail_request(struct mmc_host *host, struct mmc_request *mrq) { struct mmc_command *cmd = mrq->cmd; struct mmc_data *data = mrq->data; static const int data_errors[] = { -ETIMEDOUT, -EILSEQ, -EIO, }; if (!data) return; if (cmd->error || data->error || !should_fail(&host->fail_mmc_request, data->blksz * data->blocks)) return; data->error = data_errors[random32() % ARRAY_SIZE(data_errors)]; data->bytes_xfered = (random32() % (data->bytes_xfered >> 9)) << 9; data->fault_injected = true; } #else /* CONFIG_FAIL_MMC_REQUEST */ static inline void mmc_should_fail_request(struct mmc_host *host, struct mmc_request *mrq) { } #endif /* CONFIG_FAIL_MMC_REQUEST */ /** * mmc_request_done - finish processing an MMC request * @host: MMC host which completed request * @mrq: MMC request which request * * MMC drivers should call this function when they have completed * their processing of a request. */ void mmc_request_done(struct mmc_host *host, struct mmc_request *mrq) { struct mmc_command *cmd = mrq->cmd; int err = cmd->error; #ifdef CONFIG_MMC_PERF_PROFILING ktime_t diff; #endif if (host->card && host->clk_scaling.enable) host->clk_scaling.busy_time_us += ktime_to_us(ktime_sub(ktime_get(), host->clk_scaling.start_busy)); if (err && cmd->retries && mmc_host_is_spi(host)) { if (cmd->resp[0] & R1_SPI_ILLEGAL_COMMAND) cmd->retries = 0; } if (err && cmd->retries && !mmc_card_removed(host->card)) { /* * Request starter must handle retries - see * mmc_wait_for_req_done(). */ if (mrq->done) mrq->done(mrq); } else { mmc_should_fail_request(host, mrq); led_trigger_event(host->led, LED_OFF); pr_debug("%s: req done (CMD%u): %d: %08x %08x %08x %08x\n", mmc_hostname(host), cmd->opcode, err, cmd->resp[0], cmd->resp[1], cmd->resp[2], cmd->resp[3]); if (mrq->data) { #ifdef CONFIG_MMC_PERF_PROFILING if (host->perf_enable) { diff = ktime_sub(ktime_get(), host->perf.start); if (mrq->data->flags == MMC_DATA_READ) { host->perf.rbytes_drv += mrq->data->bytes_xfered; host->perf.rtime_drv = ktime_add(host->perf.rtime_drv, diff); } else { host->perf.wbytes_drv += mrq->data->bytes_xfered; host->perf.wtime_drv = ktime_add(host->perf.wtime_drv, diff); } } #endif pr_debug("%s: %d bytes transferred: %d\n", mmc_hostname(host), mrq->data->bytes_xfered, mrq->data->error); } if (mrq->stop) { pr_debug("%s: (CMD%u): %d: %08x %08x %08x %08x\n", mmc_hostname(host), mrq->stop->opcode, mrq->stop->error, mrq->stop->resp[0], mrq->stop->resp[1], mrq->stop->resp[2], mrq->stop->resp[3]); } if (mrq->done) mrq->done(mrq); mmc_host_clk_release(host); } } EXPORT_SYMBOL(mmc_request_done); static void mmc_start_request(struct mmc_host *host, struct mmc_request *mrq) { #ifdef CONFIG_MMC_DEBUG unsigned int i, sz; struct scatterlist *sg; #endif if (mrq->sbc) { pr_debug("<%s: starting CMD%u arg %08x flags %08x>\n", mmc_hostname(host), mrq->sbc->opcode, mrq->sbc->arg, mrq->sbc->flags); } pr_debug("%s: starting CMD%u arg %08x flags %08x\n", mmc_hostname(host), mrq->cmd->opcode, mrq->cmd->arg, mrq->cmd->flags); if (mrq->data) { pr_debug("%s: blksz %d blocks %d flags %08x " "tsac %d ms nsac %d\n", mmc_hostname(host), mrq->data->blksz, mrq->data->blocks, mrq->data->flags, mrq->data->timeout_ns / 1000000, mrq->data->timeout_clks); } if (mrq->stop) { pr_debug("%s: CMD%u arg %08x flags %08x\n", mmc_hostname(host), mrq->stop->opcode, mrq->stop->arg, mrq->stop->flags); } WARN_ON(!host->claimed); mrq->cmd->error = 0; mrq->cmd->mrq = mrq; if (mrq->data) { BUG_ON(mrq->data->blksz > host->max_blk_size); BUG_ON(mrq->data->blocks > host->max_blk_count); BUG_ON(mrq->data->blocks * mrq->data->blksz > host->max_req_size); #ifdef CONFIG_MMC_DEBUG sz = 0; for_each_sg(mrq->data->sg, sg, mrq->data->sg_len, i) sz += sg->length; BUG_ON(sz != mrq->data->blocks * mrq->data->blksz); #endif mrq->cmd->data = mrq->data; mrq->data->error = 0; mrq->data->mrq = mrq; if (mrq->stop) { mrq->data->stop = mrq->stop; mrq->stop->error = 0; mrq->stop->mrq = mrq; } #ifdef CONFIG_MMC_PERF_PROFILING if (host->perf_enable) host->perf.start = ktime_get(); #endif } mmc_host_clk_hold(host); led_trigger_event(host->led, LED_FULL); if (host->card && host->clk_scaling.enable) { /* * Check if we need to scale the clocks. Clocks * will be scaled up immediately if necessary * conditions are satisfied. Scaling down the * frequency will be done after current thread * releases host. */ mmc_clk_scaling(host, false); host->clk_scaling.start_busy = ktime_get(); } host->ops->request(host, mrq); } /** * mmc_start_delayed_bkops() - Start a delayed work to check for * the need of non urgent BKOPS * * @card: MMC card to start BKOPS on */ void mmc_start_delayed_bkops(struct mmc_card *card) { if (!card || !card->ext_csd.bkops_en || mmc_card_doing_bkops(card)) return; if (card->bkops_info.sectors_changed < card->bkops_info.min_sectors_to_queue_delayed_work) return; pr_debug("%s: %s: queueing delayed_bkops_work\n", mmc_hostname(card->host), __func__); /* * cancel_delayed_bkops_work will prevent a race condition between * fetching a request by the mmcqd and the delayed work, in case * it was removed from the queue work but not started yet */ card->bkops_info.cancel_delayed_work = false; queue_delayed_work(system_nrt_wq, &card->bkops_info.dw, msecs_to_jiffies( card->bkops_info.delay_ms)); } EXPORT_SYMBOL(mmc_start_delayed_bkops); /** * mmc_start_bkops - start BKOPS for supported cards * @card: MMC card to start BKOPS * @from_exception: A flag to indicate if this function was * called due to an exception raised by the card * * Start background operations whenever requested. * When the urgent BKOPS bit is set in a R1 command response * then background operations should be started immediately. */ void mmc_start_bkops(struct mmc_card *card, bool from_exception) { int err; BUG_ON(!card); if (!card->ext_csd.bkops_en) return; if ((card->bkops_info.cancel_delayed_work) && !from_exception) { pr_debug("%s: %s: cancel_delayed_work was set, exit\n", mmc_hostname(card->host), __func__); card->bkops_info.cancel_delayed_work = false; return; } /* In case of delayed bkops we might be in race with suspend. */ if (!mmc_try_claim_host(card->host)) return; /* * Since the cancel_delayed_work can be changed while we are waiting * for the lock we will to re-check it */ if ((card->bkops_info.cancel_delayed_work) && !from_exception) { pr_debug("%s: %s: cancel_delayed_work was set, exit\n", mmc_hostname(card->host), __func__); card->bkops_info.cancel_delayed_work = false; goto out; } if (mmc_card_doing_bkops(card)) { pr_debug("%s: %s: already doing bkops, exit\n", mmc_hostname(card->host), __func__); goto out; } if (from_exception && mmc_card_need_bkops(card)) goto out; /* * If the need BKOPS flag is set, there is no need to check if BKOPS * is needed since we already know that it does */ if (!mmc_card_need_bkops(card)) { err = mmc_read_bkops_status(card); if (err) { pr_err("%s: %s: Failed to read bkops status: %d\n", mmc_hostname(card->host), __func__, err); goto out; } if (!card->ext_csd.raw_bkops_status) goto out; pr_info("%s: %s: raw_bkops_status=0x%x, from_exception=%d\n", mmc_hostname(card->host), __func__, card->ext_csd.raw_bkops_status, from_exception); } /* * If the function was called due to exception, BKOPS will be performed * after handling the last pending request */ if (from_exception) { pr_debug("%s: %s: Level %d from exception, exit", mmc_hostname(card->host), __func__, card->ext_csd.raw_bkops_status); mmc_card_set_need_bkops(card); goto out; } pr_info("%s: %s: Starting bkops\n", mmc_hostname(card->host), __func__); err = __mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, EXT_CSD_BKOPS_START, 1, 0, false, false); if (err) { pr_warn("%s: Error %d starting bkops\n", mmc_hostname(card->host), err); goto out; } mmc_card_clr_need_bkops(card); mmc_card_set_doing_bkops(card); out: mmc_release_host(card->host); } EXPORT_SYMBOL(mmc_start_bkops); /** * mmc_start_idle_time_bkops() - check if a non urgent BKOPS is * needed * @work: The idle time BKOPS work */ void mmc_start_idle_time_bkops(struct work_struct *work) { struct mmc_card *card = container_of(work, struct mmc_card, bkops_info.dw.work); /* * Prevent a race condition between mmc_stop_bkops and the delayed * BKOPS work in case the delayed work is executed on another CPU */ if (card->bkops_info.cancel_delayed_work) return; mmc_start_bkops(card, false); } EXPORT_SYMBOL(mmc_start_idle_time_bkops); static void mmc_wait_done(struct mmc_request *mrq) { complete(&mrq->completion); } static int __mmc_start_req(struct mmc_host *host, struct mmc_request *mrq) { init_completion(&mrq->completion); mrq->done = mmc_wait_done; if (mmc_card_removed(host->card)) { mrq->cmd->error = -ENOMEDIUM; complete(&mrq->completion); return -ENOMEDIUM; } mmc_start_request(host, mrq); return 0; } static void mmc_wait_for_req_done(struct mmc_host *host, struct mmc_request *mrq) { struct mmc_command *cmd; while (1) { wait_for_completion_io(&mrq->completion); cmd = mrq->cmd; /* * If host has timed out waiting for the commands which can be * HPIed then let the caller handle the timeout error as it may * want to send the HPI command to bring the card out of * programming state. */ if (cmd->ignore_timeout && cmd->error == -ETIMEDOUT) break; if (!cmd->error || !cmd->retries || mmc_card_removed(host->card)) break; pr_debug("%s: req failed (CMD%u): %d, retrying...\n", mmc_hostname(host), cmd->opcode, cmd->error); cmd->retries--; cmd->error = 0; host->ops->request(host, mrq); } } /** * mmc_pre_req - Prepare for a new request * @host: MMC host to prepare command * @mrq: MMC request to prepare for * @is_first_req: true if there is no previous started request * that may run in parellel to this call, otherwise false * * mmc_pre_req() is called in prior to mmc_start_req() to let * host prepare for the new request. Preparation of a request may be * performed while another request is running on the host. */ static void mmc_pre_req(struct mmc_host *host, struct mmc_request *mrq, bool is_first_req) { if (host->ops->pre_req) { mmc_host_clk_hold(host); host->ops->pre_req(host, mrq, is_first_req); mmc_host_clk_release(host); } } /** * mmc_post_req - Post process a completed request * @host: MMC host to post process command * @mrq: MMC request to post process for * @err: Error, if non zero, clean up any resources made in pre_req * * Let the host post process a completed request. Post processing of * a request may be performed while another reuqest is running. */ static void mmc_post_req(struct mmc_host *host, struct mmc_request *mrq, int err) { if (host->ops->post_req) { mmc_host_clk_hold(host); host->ops->post_req(host, mrq, err); mmc_host_clk_release(host); } } /** * mmc_start_req - start a non-blocking request * @host: MMC host to start command * @areq: async request to start * @error: out parameter returns 0 for success, otherwise non zero * * Start a new MMC custom command request for a host. * If there is on ongoing async request wait for completion * of that request and start the new one and return. * Does not wait for the new request to complete. * * Returns the completed request, NULL in case of none completed. * Wait for the an ongoing request (previoulsy started) to complete and * return the completed request. If there is no ongoing request, NULL * is returned without waiting. NULL is not an error condition. */ struct mmc_async_req *mmc_start_req(struct mmc_host *host, struct mmc_async_req *areq, int *error) { int err = 0; int start_err = 0; struct mmc_async_req *data = host->areq; /* Prepare a new request */ if (areq) mmc_pre_req(host, areq->mrq, !host->areq); if (host->areq) { mmc_wait_for_req_done(host, host->areq->mrq); err = host->areq->err_check(host->card, host->areq); /* * Check BKOPS urgency for each R1 response */ if (host->card && mmc_card_mmc(host->card) && ((mmc_resp_type(host->areq->mrq->cmd) == MMC_RSP_R1) || (mmc_resp_type(host->areq->mrq->cmd) == MMC_RSP_R1B)) && (host->areq->mrq->cmd->resp[0] & R1_EXCEPTION_EVENT)) mmc_start_bkops(host->card, true); } if (!err && areq) start_err = __mmc_start_req(host, areq->mrq); if (host->areq) mmc_post_req(host, host->areq->mrq, 0); /* Cancel a prepared request if it was not started. */ if ((err || start_err) && areq) mmc_post_req(host, areq->mrq, -EINVAL); if (err) host->areq = NULL; else host->areq = areq; if (error) *error = err; return data; } EXPORT_SYMBOL(mmc_start_req); /** * mmc_wait_for_req - start a request and wait for completion * @host: MMC host to start command * @mrq: MMC request to start * * Start a new MMC custom command request for a host, and wait * for the command to complete. Does not attempt to parse the * response. */ void mmc_wait_for_req(struct mmc_host *host, struct mmc_request *mrq) { __mmc_start_req(host, mrq); mmc_wait_for_req_done(host, mrq); } EXPORT_SYMBOL(mmc_wait_for_req); bool mmc_card_is_prog_state(struct mmc_card *card) { bool rc; struct mmc_command cmd; mmc_claim_host(card->host); memset(&cmd, 0, sizeof(struct mmc_command)); cmd.opcode = MMC_SEND_STATUS; if (!mmc_host_is_spi(card->host)) cmd.arg = card->rca << 16; cmd.flags = MMC_RSP_R1 | MMC_CMD_AC; rc = mmc_wait_for_cmd(card->host, &cmd, 0); if (rc) { pr_err("%s: Get card status fail. rc=%d\n", mmc_hostname(card->host), rc); rc = false; goto out; } if (R1_CURRENT_STATE(cmd.resp[0]) == R1_STATE_PRG) rc = true; else rc = false; out: mmc_release_host(card->host); return rc; } EXPORT_SYMBOL(mmc_card_is_prog_state); /** * mmc_interrupt_hpi - Issue for High priority Interrupt * @card: the MMC card associated with the HPI transfer * * Issued High Priority Interrupt, and check for card status * until out-of prg-state. */ int mmc_interrupt_hpi(struct mmc_card *card) { int err; u32 status; BUG_ON(!card); if (!card->ext_csd.hpi_en) { pr_info("%s: HPI enable bit unset\n", mmc_hostname(card->host)); return 1; } mmc_claim_host(card->host); err = mmc_send_status(card, &status); if (err) { pr_err("%s: Get card status fail\n", mmc_hostname(card->host)); goto out; } /* * If the card status is in PRG-state, we can send the HPI command. */ if (R1_CURRENT_STATE(status) == R1_STATE_PRG) { do { /* * We don't know when the HPI command will finish * processing, so we need to resend HPI until out * of prg-state, and keep checking the card status * with SEND_STATUS. If a timeout error occurs when * sending the HPI command, we are already out of * prg-state. */ err = mmc_send_hpi_cmd(card, &status); if (err) pr_debug("%s: abort HPI (%d error)\n", mmc_hostname(card->host), err); err = mmc_send_status(card, &status); if (err) break; } while (R1_CURRENT_STATE(status) == R1_STATE_PRG); } else pr_debug("%s: Left prg-state\n", mmc_hostname(card->host)); out: mmc_release_host(card->host); return err; } EXPORT_SYMBOL(mmc_interrupt_hpi); /** * mmc_wait_for_cmd - start a command and wait for completion * @host: MMC host to start command * @cmd: MMC command to start * @retries: maximum number of retries * * Start a new MMC command for a host, and wait for the command * to complete. Return any error that occurred while the command * was executing. Do not attempt to parse the response. */ int mmc_wait_for_cmd(struct mmc_host *host, struct mmc_command *cmd, int retries) { struct mmc_request mrq = {NULL}; WARN_ON(!host->claimed); memset(cmd->resp, 0, sizeof(cmd->resp)); cmd->retries = retries; mrq.cmd = cmd; cmd->data = NULL; mmc_wait_for_req(host, &mrq); return cmd->error; } EXPORT_SYMBOL(mmc_wait_for_cmd); /** * mmc_stop_bkops - stop ongoing BKOPS * @card: MMC card to check BKOPS * * Send HPI command to stop ongoing background operations to * allow rapid servicing of foreground operations, e.g. read/ * writes. Wait until the card comes out of the programming state * to avoid errors in servicing read/write requests. * * The function should be called with host claimed. */ int mmc_stop_bkops(struct mmc_card *card) { int err = 0; BUG_ON(!card); /* * Notify the delayed work to be cancelled, in case it was already * removed from the queue, but was not started yet */ card->bkops_info.cancel_delayed_work = true; if (delayed_work_pending(&card->bkops_info.dw)) cancel_delayed_work_sync(&card->bkops_info.dw); if (!mmc_card_doing_bkops(card)) goto out; /* * If idle time bkops is running on the card, let's not get into * suspend. */ if (mmc_card_doing_bkops(card) && (card->host->parent->power.runtime_status == RPM_SUSPENDING) && mmc_card_is_prog_state(card)) { err = -EBUSY; goto out; } err = mmc_interrupt_hpi(card); /* * If err is EINVAL, we can't issue an HPI. * It should complete the BKOPS. */ if (!err || (err == -EINVAL)) { mmc_card_clr_doing_bkops(card); err = 0; } out: return err; } EXPORT_SYMBOL(mmc_stop_bkops); int mmc_read_bkops_status(struct mmc_card *card) { int err; u8 *ext_csd; /* * In future work, we should consider storing the entire ext_csd. */ ext_csd = kmalloc(512, GFP_KERNEL); if (!ext_csd) { pr_err("%s: could not allocate buffer to receive the ext_csd.\n", mmc_hostname(card->host)); return -ENOMEM; } mmc_claim_host(card->host); err = mmc_send_ext_csd(card, ext_csd); mmc_release_host(card->host); if (err) goto out; card->ext_csd.raw_bkops_status = ext_csd[EXT_CSD_BKOPS_STATUS]; card->ext_csd.raw_exception_status = ext_csd[EXT_CSD_EXP_EVENTS_STATUS]; out: kfree(ext_csd); return err; } EXPORT_SYMBOL(mmc_read_bkops_status); /** * mmc_set_data_timeout - set the timeout for a data command * @data: data phase for command * @card: the MMC card associated with the data transfer * * Computes the data timeout parameters according to the * correct algorithm given the card type. */ void mmc_set_data_timeout(struct mmc_data *data, const struct mmc_card *card) { unsigned int mult; /* * SDIO cards only define an upper 1 s limit on access. */ if (mmc_card_sdio(card)) { data->timeout_ns = 1000000000; data->timeout_clks = 0; return; } /* * SD cards use a 100 multiplier rather than 10 */ mult = mmc_card_sd(card) ? 100 : 10; /* * Scale up the multiplier (and therefore the timeout) by * the r2w factor for writes. */ if (data->flags & MMC_DATA_WRITE) mult <<= card->csd.r2w_factor; data->timeout_ns = card->csd.tacc_ns * mult; data->timeout_clks = card->csd.tacc_clks * mult; /* * SD cards also have an upper limit on the timeout. */ if (mmc_card_sd(card)) { unsigned int timeout_us, limit_us; timeout_us = data->timeout_ns / 1000; if (mmc_host_clk_rate(card->host)) timeout_us += data->timeout_clks * 1000 / (mmc_host_clk_rate(card->host) / 1000); if (data->flags & MMC_DATA_WRITE) /* * The MMC spec "It is strongly recommended * for hosts to implement more than 500ms * timeout value even if the card indicates * the 250ms maximum busy length." Even the * previous value of 300ms is known to be * insufficient for some cards. */ limit_us = 3000000; else limit_us = 100000; /* * SDHC cards always use these fixed values. */ if (timeout_us > limit_us || mmc_card_blockaddr(card)) { data->timeout_ns = limit_us * 1000; data->timeout_clks = 0; } } /* * Some cards require longer data read timeout than indicated in CSD. * Address this by setting the read timeout to a "reasonably high" * value. For the cards tested, 300ms has proven enough. If necessary, * this value can be increased if other problematic cards require this. */ if (mmc_card_long_read_time(card) && data->flags & MMC_DATA_READ) { data->timeout_ns = 300000000; data->timeout_clks = 0; } /* * Some cards need very high timeouts if driven in SPI mode. * The worst observed timeout was 900ms after writing a * continuous stream of data until the internal logic * overflowed. */ if (mmc_host_is_spi(card->host)) { if (data->flags & MMC_DATA_WRITE) { if (data->timeout_ns < 1000000000) data->timeout_ns = 1000000000; /* 1s */ } else { if (data->timeout_ns < 100000000) data->timeout_ns = 100000000; /* 100ms */ } } /* Increase the timeout values for some bad INAND MCP devices */ if (card->quirks & MMC_QUIRK_INAND_DATA_TIMEOUT) { data->timeout_ns = 4000000000u; /* 4s */ data->timeout_clks = 0; } } EXPORT_SYMBOL(mmc_set_data_timeout); /** * mmc_align_data_size - pads a transfer size to a more optimal value * @card: the MMC card associated with the data transfer * @sz: original transfer size * * Pads the original data size with a number of extra bytes in * order to avoid controller bugs and/or performance hits * (e.g. some controllers revert to PIO for certain sizes). * * Returns the improved size, which might be unmodified. * * Note that this function is only relevant when issuing a * single scatter gather entry. */ unsigned int mmc_align_data_size(struct mmc_card *card, unsigned int sz) { /* * FIXME: We don't have a system for the controller to tell * the core about its problems yet, so for now we just 32-bit * align the size. */ sz = ((sz + 3) / 4) * 4; return sz; } EXPORT_SYMBOL(mmc_align_data_size); /** * __mmc_claim_host - exclusively claim a host * @host: mmc host to claim * @abort: whether or not the operation should be aborted * * Claim a host for a set of operations. If @abort is non null and * dereference a non-zero value then this will return prematurely with * that non-zero value without acquiring the lock. Returns zero * with the lock held otherwise. */ int __mmc_claim_host(struct mmc_host *host, atomic_t *abort) { DECLARE_WAITQUEUE(wait, current); unsigned long flags; int stop; might_sleep(); add_wait_queue(&host->wq, &wait); spin_lock_irqsave(&host->lock, flags); while (1) { set_current_state(TASK_UNINTERRUPTIBLE); stop = abort ? atomic_read(abort) : 0; if (stop || !host->claimed || host->claimer == current) break; spin_unlock_irqrestore(&host->lock, flags); schedule(); spin_lock_irqsave(&host->lock, flags); } set_current_state(TASK_RUNNING); if (!stop) { host->claimed = 1; host->claimer = current; host->claim_cnt += 1; } else wake_up(&host->wq); spin_unlock_irqrestore(&host->lock, flags); remove_wait_queue(&host->wq, &wait); if (host->ops->enable && !stop && host->claim_cnt == 1) host->ops->enable(host); return stop; } EXPORT_SYMBOL(__mmc_claim_host); /** * mmc_try_claim_host - try exclusively to claim a host * @host: mmc host to claim * * Returns %1 if the host is claimed, %0 otherwise. */ int mmc_try_claim_host(struct mmc_host *host) { int claimed_host = 0; unsigned long flags; spin_lock_irqsave(&host->lock, flags); if (!host->claimed || host->claimer == current) { host->claimed = 1; host->claimer = current; host->claim_cnt += 1; claimed_host = 1; } spin_unlock_irqrestore(&host->lock, flags); if (host->ops->enable && claimed_host && host->claim_cnt == 1) host->ops->enable(host); return claimed_host; } EXPORT_SYMBOL(mmc_try_claim_host); /** * mmc_release_host - release a host * @host: mmc host to release * * Release a MMC host, allowing others to claim the host * for their operations. */ void mmc_release_host(struct mmc_host *host) { unsigned long flags; WARN_ON(!host->claimed); if (host->ops->disable && host->claim_cnt == 1) host->ops->disable(host); spin_lock_irqsave(&host->lock, flags); if (--host->claim_cnt) { /* Release for nested claim */ spin_unlock_irqrestore(&host->lock, flags); } else { host->claimed = 0; host->claimer = NULL; spin_unlock_irqrestore(&host->lock, flags); wake_up(&host->wq); } } EXPORT_SYMBOL(mmc_release_host); /* * Internal function that does the actual ios call to the host driver, * optionally printing some debug output. */ void mmc_set_ios(struct mmc_host *host) { struct mmc_ios *ios = &host->ios; pr_debug("%s: clock %uHz busmode %u powermode %u cs %u Vdd %u " "width %u timing %u\n", mmc_hostname(host), ios->clock, ios->bus_mode, ios->power_mode, ios->chip_select, ios->vdd, ios->bus_width, ios->timing); if (ios->clock > 0) mmc_set_ungated(host); host->ops->set_ios(host, ios); if (ios->old_rate != ios->clock) { if (likely(ios->clk_ts)) { char trace_info[80]; snprintf(trace_info, 80, "%s: freq_KHz %d --> %d | t = %d", mmc_hostname(host), ios->old_rate / 1000, ios->clock / 1000, jiffies_to_msecs( (long)jiffies - (long)ios->clk_ts)); trace_mmc_clk(trace_info); } ios->old_rate = ios->clock; ios->clk_ts = jiffies; } } EXPORT_SYMBOL(mmc_set_ios); /* * Control chip select pin on a host. */ void mmc_set_chip_select(struct mmc_host *host, int mode) { mmc_host_clk_hold(host); host->ios.chip_select = mode; mmc_set_ios(host); mmc_host_clk_release(host); } /* * Sets the host clock to the highest possible frequency that * is below "hz". */ static void __mmc_set_clock(struct mmc_host *host, unsigned int hz) { WARN_ON(hz < host->f_min); if (hz > host->f_max) hz = host->f_max; host->ios.clock = hz; mmc_set_ios(host); } void mmc_set_clock(struct mmc_host *host, unsigned int hz) { mmc_host_clk_hold(host); __mmc_set_clock(host, hz); mmc_host_clk_release(host); } #ifdef CONFIG_MMC_CLKGATE /* * This gates the clock by setting it to 0 Hz. */ void mmc_gate_clock(struct mmc_host *host) { unsigned long flags; WARN_ON(!host->ios.clock); spin_lock_irqsave(&host->clk_lock, flags); host->clk_old = host->ios.clock; host->ios.clock = 0; host->clk_gated = true; spin_unlock_irqrestore(&host->clk_lock, flags); mmc_set_ios(host); } /* * This restores the clock from gating by using the cached * clock value. */ void mmc_ungate_clock(struct mmc_host *host) { /* * We should previously have gated the clock, so the clock shall * be 0 here! The clock may however be 0 during initialization, * when some request operations are performed before setting * the frequency. When ungate is requested in that situation * we just ignore the call. */ if (host->clk_old) { WARN_ON(host->ios.clock); /* This call will also set host->clk_gated to false */ __mmc_set_clock(host, host->clk_old); } } void mmc_set_ungated(struct mmc_host *host) { unsigned long flags; /* * We've been given a new frequency while the clock is gated, * so make sure we regard this as ungating it. */ spin_lock_irqsave(&host->clk_lock, flags); host->clk_gated = false; spin_unlock_irqrestore(&host->clk_lock, flags); } #else void mmc_set_ungated(struct mmc_host *host) { } #endif /* * Change the bus mode (open drain/push-pull) of a host. */ void mmc_set_bus_mode(struct mmc_host *host, unsigned int mode) { mmc_host_clk_hold(host); host->ios.bus_mode = mode; mmc_set_ios(host); mmc_host_clk_release(host); } /* * Change data bus width of a host. */ void mmc_set_bus_width(struct mmc_host *host, unsigned int width) { mmc_host_clk_hold(host); host->ios.bus_width = width; mmc_set_ios(host); mmc_host_clk_release(host); } /** * mmc_vdd_to_ocrbitnum - Convert a voltage to the OCR bit number * @vdd: voltage (mV) * @low_bits: prefer low bits in boundary cases * * This function returns the OCR bit number according to the provided @vdd * value. If conversion is not possible a negative errno value returned. * * Depending on the @low_bits flag the function prefers low or high OCR bits * on boundary voltages. For example, * with @low_bits = true, 3300 mV translates to ilog2(MMC_VDD_32_33); * with @low_bits = false, 3300 mV translates to ilog2(MMC_VDD_33_34); * * Any value in the [1951:1999] range translates to the ilog2(MMC_VDD_20_21). */ static int mmc_vdd_to_ocrbitnum(int vdd, bool low_bits) { const int max_bit = ilog2(MMC_VDD_35_36); int bit; if (vdd < 1650 || vdd > 3600) return -EINVAL; if (vdd >= 1650 && vdd <= 1950) return ilog2(MMC_VDD_165_195); if (low_bits) vdd -= 1; /* Base 2000 mV, step 100 mV, bit's base 8. */ bit = (vdd - 2000) / 100 + 8; if (bit > max_bit) return max_bit; return bit; } /** * mmc_vddrange_to_ocrmask - Convert a voltage range to the OCR mask * @vdd_min: minimum voltage value (mV) * @vdd_max: maximum voltage value (mV) * * This function returns the OCR mask bits according to the provided @vdd_min * and @vdd_max values. If conversion is not possible the function returns 0. * * Notes wrt boundary cases: * This function sets the OCR bits for all boundary voltages, for example * [3300:3400] range is translated to MMC_VDD_32_33 | MMC_VDD_33_34 | * MMC_VDD_34_35 mask. */ u32 mmc_vddrange_to_ocrmask(int vdd_min, int vdd_max) { u32 mask = 0; if (vdd_max < vdd_min) return 0; /* Prefer high bits for the boundary vdd_max values. */ vdd_max = mmc_vdd_to_ocrbitnum(vdd_max, false); if (vdd_max < 0) return 0; /* Prefer low bits for the boundary vdd_min values. */ vdd_min = mmc_vdd_to_ocrbitnum(vdd_min, true); if (vdd_min < 0) return 0; /* Fill the mask, from max bit to min bit. */ while (vdd_max >= vdd_min) mask |= 1 << vdd_max--; return mask; } EXPORT_SYMBOL(mmc_vddrange_to_ocrmask); #ifdef CONFIG_REGULATOR /** * mmc_regulator_get_ocrmask - return mask of supported voltages * @supply: regulator to use * * This returns either a negative errno, or a mask of voltages that * can be provided to MMC/SD/SDIO devices using the specified voltage * regulator. This would normally be called before registering the * MMC host adapter. */ int mmc_regulator_get_ocrmask(struct regulator *supply) { int result = 0; int count; int i; count = regulator_count_voltages(supply); if (count < 0) return count; for (i = 0; i < count; i++) { int vdd_uV; int vdd_mV; vdd_uV = regulator_list_voltage(supply, i); if (vdd_uV <= 0) continue; vdd_mV = vdd_uV / 1000; result |= mmc_vddrange_to_ocrmask(vdd_mV, vdd_mV); } return result; } EXPORT_SYMBOL(mmc_regulator_get_ocrmask); /** * mmc_regulator_set_ocr - set regulator to match host->ios voltage * @mmc: the host to regulate * @supply: regulator to use * @vdd_bit: zero for power off, else a bit number (host->ios.vdd) * * Returns zero on success, else negative errno. * * MMC host drivers may use this to enable or disable a regulator using * a particular supply voltage. This would normally be called from the * set_ios() method. */ int mmc_regulator_set_ocr(struct mmc_host *mmc, struct regulator *supply, unsigned short vdd_bit) { int result = 0; int min_uV, max_uV; if (vdd_bit) { int tmp; int voltage; /* REVISIT mmc_vddrange_to_ocrmask() may have set some * bits this regulator doesn't quite support ... don't * be too picky, most cards and regulators are OK with * a 0.1V range goof (it's a small error percentage). */ tmp = vdd_bit - ilog2(MMC_VDD_165_195); if (tmp == 0) { min_uV = 1650 * 1000; max_uV = 1950 * 1000; } else { min_uV = 1900 * 1000 + tmp * 100 * 1000; max_uV = min_uV + 100 * 1000; } /* avoid needless changes to this voltage; the regulator * might not allow this operation */ voltage = regulator_get_voltage(supply); if (mmc->caps2 & MMC_CAP2_BROKEN_VOLTAGE) min_uV = max_uV = voltage; if (voltage < 0) result = voltage; else if (voltage < min_uV || voltage > max_uV) result = regulator_set_voltage(supply, min_uV, max_uV); else result = 0; if (result == 0 && !mmc->regulator_enabled) { result = regulator_enable(supply); if (!result) mmc->regulator_enabled = true; } } else if (mmc->regulator_enabled) { result = regulator_disable(supply); if (result == 0) mmc->regulator_enabled = false; } if (result) dev_err(mmc_dev(mmc), "could not set regulator OCR (%d)\n", result); return result; } EXPORT_SYMBOL(mmc_regulator_set_ocr); #endif /* CONFIG_REGULATOR */ /* * Mask off any voltages we don't support and select * the lowest voltage */ u32 mmc_select_voltage(struct mmc_host *host, u32 ocr) { int bit; ocr &= host->ocr_avail; bit = ffs(ocr); if (bit) { bit -= 1; ocr &= 3 << bit; mmc_host_clk_hold(host); host->ios.vdd = bit; mmc_set_ios(host); mmc_host_clk_release(host); } else { pr_warning("%s: host doesn't support card's voltages\n", mmc_hostname(host)); ocr = 0; } return ocr; } int mmc_set_signal_voltage(struct mmc_host *host, int signal_voltage, bool cmd11) { struct mmc_command cmd = {0}; int err = 0; BUG_ON(!host); /* * Send CMD11 only if the request is to switch the card to * 1.8V signalling. */ if ((signal_voltage != MMC_SIGNAL_VOLTAGE_330) && cmd11) { cmd.opcode = SD_SWITCH_VOLTAGE; cmd.arg = 0; cmd.flags = MMC_RSP_R1 | MMC_CMD_AC; err = mmc_wait_for_cmd(host, &cmd, 0); if (err) return err; if (!mmc_host_is_spi(host) && (cmd.resp[0] & R1_ERROR)) return -EIO; } host->ios.signal_voltage = signal_voltage; if (host->ops->start_signal_voltage_switch) { mmc_host_clk_hold(host); err = host->ops->start_signal_voltage_switch(host, &host->ios); mmc_host_clk_release(host); } return err; } /* * Select timing parameters for host. */ void mmc_set_timing(struct mmc_host *host, unsigned int timing) { mmc_host_clk_hold(host); host->ios.timing = timing; mmc_set_ios(host); mmc_host_clk_release(host); } /* * Select appropriate driver type for host. */ void mmc_set_driver_type(struct mmc_host *host, unsigned int drv_type) { mmc_host_clk_hold(host); host->ios.drv_type = drv_type; mmc_set_ios(host); mmc_host_clk_release(host); } /* * Apply power to the MMC stack. This is a two-stage process. * First, we enable power to the card without the clock running. * We then wait a bit for the power to stabilise. Finally, * enable the bus drivers and clock to the card. * * We must _NOT_ enable the clock prior to power stablising. * * If a host does all the power sequencing itself, ignore the * initial MMC_POWER_UP stage. */ void mmc_power_up(struct mmc_host *host) { int bit; mmc_host_clk_hold(host); /* If ocr is set, we use it */ if (host->ocr) bit = ffs(host->ocr) - 1; else bit = fls(host->ocr_avail) - 1; host->ios.vdd = bit; if (mmc_host_is_spi(host)) host->ios.chip_select = MMC_CS_HIGH; else { host->ios.chip_select = MMC_CS_DONTCARE; host->ios.bus_mode = MMC_BUSMODE_OPENDRAIN; } host->ios.power_mode = MMC_POWER_UP; host->ios.bus_width = MMC_BUS_WIDTH_1; host->ios.timing = MMC_TIMING_LEGACY; mmc_set_ios(host); /* * This delay should be sufficient to allow the power supply * to reach the minimum voltage. */ mmc_delay(10); host->ios.clock = host->f_init; host->ios.power_mode = MMC_POWER_ON; mmc_set_ios(host); /* * This delay must be at least 74 clock sizes, or 1 ms, or the * time required to reach a stable voltage. */ mmc_delay(10); mmc_host_clk_release(host); } void mmc_power_off(struct mmc_host *host) { mmc_host_clk_hold(host); host->ios.clock = 0; host->ios.vdd = 0; /* * Reset ocr mask to be the highest possible voltage supported for * this mmc host. This value will be used at next power up. */ host->ocr = 1 << (fls(host->ocr_avail) - 1); if (!mmc_host_is_spi(host)) { host->ios.bus_mode = MMC_BUSMODE_OPENDRAIN; host->ios.chip_select = MMC_CS_DONTCARE; } host->ios.power_mode = MMC_POWER_OFF; host->ios.bus_width = MMC_BUS_WIDTH_1; host->ios.timing = MMC_TIMING_LEGACY; mmc_set_ios(host); /* * Some configurations, such as the 802.11 SDIO card in the OLPC * XO-1.5, require a short delay after poweroff before the card * can be successfully turned on again. */ mmc_delay(1); mmc_host_clk_release(host); } /* * Cleanup when the last reference to the bus operator is dropped. */ static void __mmc_release_bus(struct mmc_host *host) { BUG_ON(!host); BUG_ON(host->bus_refs); BUG_ON(!host->bus_dead); host->bus_ops = NULL; } /* * Increase reference count of bus operator */ static inline void mmc_bus_get(struct mmc_host *host) { unsigned long flags; spin_lock_irqsave(&host->lock, flags); host->bus_refs++; spin_unlock_irqrestore(&host->lock, flags); } /* * Decrease reference count of bus operator and free it if * it is the last reference. */ static inline void mmc_bus_put(struct mmc_host *host) { unsigned long flags; spin_lock_irqsave(&host->lock, flags); host->bus_refs--; if ((host->bus_refs == 0) && host->bus_ops) __mmc_release_bus(host); spin_unlock_irqrestore(&host->lock, flags); } int mmc_resume_bus(struct mmc_host *host) { unsigned long flags; if (!mmc_bus_needs_resume(host)) return -EINVAL; printk("%s: Starting deferred resume\n", mmc_hostname(host)); spin_lock_irqsave(&host->lock, flags); host->bus_resume_flags &= ~MMC_BUSRESUME_NEEDS_RESUME; host->rescan_disable = 0; spin_unlock_irqrestore(&host->lock, flags); mmc_bus_get(host); if (host->bus_ops && !host->bus_dead) { mmc_power_up(host); BUG_ON(!host->bus_ops->resume); host->bus_ops->resume(host); } if (host->bus_ops->detect && !host->bus_dead) host->bus_ops->detect(host); mmc_bus_put(host); printk("%s: Deferred resume completed\n", mmc_hostname(host)); return 0; } EXPORT_SYMBOL(mmc_resume_bus); /* * Assign a mmc bus handler to a host. Only one bus handler may control a * host at any given time. */ void mmc_attach_bus(struct mmc_host *host, const struct mmc_bus_ops *ops) { unsigned long flags; BUG_ON(!host); BUG_ON(!ops); WARN_ON(!host->claimed); spin_lock_irqsave(&host->lock, flags); BUG_ON(host->bus_ops); BUG_ON(host->bus_refs); host->bus_ops = ops; host->bus_refs = 1; host->bus_dead = 0; spin_unlock_irqrestore(&host->lock, flags); } /* * Remove the current bus handler from a host. */ void mmc_detach_bus(struct mmc_host *host) { unsigned long flags; BUG_ON(!host); WARN_ON(!host->claimed); WARN_ON(!host->bus_ops); spin_lock_irqsave(&host->lock, flags); host->bus_dead = 1; spin_unlock_irqrestore(&host->lock, flags); mmc_bus_put(host); } /** * mmc_detect_change - process change of state on a MMC socket * @host: host which changed state. * @delay: optional delay to wait before detection (jiffies) * * MMC drivers should call this when they detect a card has been * inserted or removed. The MMC layer will confirm that any * present card is still functional, and initialize any newly * inserted. */ void mmc_detect_change(struct mmc_host *host, unsigned long delay) { #ifdef CONFIG_MMC_DEBUG unsigned long flags; spin_lock_irqsave(&host->lock, flags); WARN_ON(host->removed); spin_unlock_irqrestore(&host->lock, flags); #endif host->detect_change = 1; wake_lock(&host->detect_wake_lock); mmc_schedule_delayed_work(&host->detect, delay); } EXPORT_SYMBOL(mmc_detect_change); void mmc_init_erase(struct mmc_card *card) { unsigned int sz; if (is_power_of_2(card->erase_size)) card->erase_shift = ffs(card->erase_size) - 1; else card->erase_shift = 0; /* * It is possible to erase an arbitrarily large area of an SD or MMC * card. That is not desirable because it can take a long time * (minutes) potentially delaying more important I/O, and also the * timeout calculations become increasingly hugely over-estimated. * Consequently, 'pref_erase' is defined as a guide to limit erases * to that size and alignment. * * For SD cards that define Allocation Unit size, limit erases to one * Allocation Unit at a time. For MMC cards that define High Capacity * Erase Size, whether it is switched on or not, limit to that size. * Otherwise just have a stab at a good value. For modern cards it * will end up being 4MiB. Note that if the value is too small, it * can end up taking longer to erase. */ if (mmc_card_sd(card) && card->ssr.au) { card->pref_erase = card->ssr.au; card->erase_shift = ffs(card->ssr.au) - 1; } else if (card->ext_csd.hc_erase_size) { card->pref_erase = card->ext_csd.hc_erase_size; } else { sz = (card->csd.capacity << (card->csd.read_blkbits - 9)) >> 11; if (sz < 128) card->pref_erase = 512 * 1024 / 512; else if (sz < 512) card->pref_erase = 1024 * 1024 / 512; else if (sz < 1024) card->pref_erase = 2 * 1024 * 1024 / 512; else card->pref_erase = 4 * 1024 * 1024 / 512; if (card->pref_erase < card->erase_size) card->pref_erase = card->erase_size; else { sz = card->pref_erase % card->erase_size; if (sz) card->pref_erase += card->erase_size - sz; } } } static unsigned int mmc_mmc_erase_timeout(struct mmc_card *card, unsigned int arg, unsigned int qty) { unsigned int erase_timeout; if (arg == MMC_DISCARD_ARG || (arg == MMC_TRIM_ARG && card->ext_csd.rev >= 6)) { erase_timeout = card->ext_csd.trim_timeout; } else if (card->ext_csd.erase_group_def & 1) { /* High Capacity Erase Group Size uses HC timeouts */ if (arg == MMC_TRIM_ARG) erase_timeout = card->ext_csd.trim_timeout; else erase_timeout = card->ext_csd.hc_erase_timeout; } else { /* CSD Erase Group Size uses write timeout */ unsigned int mult = (10 << card->csd.r2w_factor); unsigned int timeout_clks = card->csd.tacc_clks * mult; unsigned int timeout_us; /* Avoid overflow: e.g. tacc_ns=80000000 mult=1280 */ if (card->csd.tacc_ns < 1000000) timeout_us = (card->csd.tacc_ns * mult) / 1000; else timeout_us = (card->csd.tacc_ns / 1000) * mult; /* * ios.clock is only a target. The real clock rate might be * less but not that much less, so fudge it by multiplying by 2. */ timeout_clks <<= 1; timeout_us += (timeout_clks * 1000) / (mmc_host_clk_rate(card->host) / 1000); erase_timeout = timeout_us / 1000; /* * Theoretically, the calculation could underflow so round up * to 1ms in that case. */ if (!erase_timeout) erase_timeout = 1; } /* Multiplier for secure operations */ if (arg & MMC_SECURE_ARGS) { if (arg == MMC_SECURE_ERASE_ARG) erase_timeout *= card->ext_csd.sec_erase_mult; else erase_timeout *= card->ext_csd.sec_trim_mult; } erase_timeout *= qty; /* * Ensure at least a 1 second timeout for SPI as per * 'mmc_set_data_timeout()' */ if (mmc_host_is_spi(card->host) && erase_timeout < 1000) erase_timeout = 1000; return erase_timeout; } static unsigned int mmc_sd_erase_timeout(struct mmc_card *card, unsigned int arg, unsigned int qty) { unsigned int erase_timeout; if (card->ssr.erase_timeout) { /* Erase timeout specified in SD Status Register (SSR) */ erase_timeout = card->ssr.erase_timeout * qty + card->ssr.erase_offset; } else { /* * Erase timeout not specified in SD Status Register (SSR) so * use 250ms per write block. */ erase_timeout = 250 * qty; } /* Must not be less than 1 second */ if (erase_timeout < 1000) erase_timeout = 1000; return erase_timeout; } static unsigned int mmc_erase_timeout(struct mmc_card *card, unsigned int arg, unsigned int qty) { if (mmc_card_sd(card)) return mmc_sd_erase_timeout(card, arg, qty); else return mmc_mmc_erase_timeout(card, arg, qty); } static int mmc_do_erase(struct mmc_card *card, unsigned int from, unsigned int to, unsigned int arg) { struct mmc_command cmd = {0}; unsigned int qty = 0; unsigned long timeout; int err; /* * qty is used to calculate the erase timeout which depends on how many * erase groups (or allocation units in SD terminology) are affected. * We count erasing part of an erase group as one erase group. * For SD, the allocation units are always a power of 2. For MMC, the * erase group size is almost certainly also power of 2, but it does not * seem to insist on that in the JEDEC standard, so we fall back to * division in that case. SD may not specify an allocation unit size, * in which case the timeout is based on the number of write blocks. * * Note that the timeout for secure trim 2 will only be correct if the * number of erase groups specified is the same as the total of all * preceding secure trim 1 commands. Since the power may have been * lost since the secure trim 1 commands occurred, it is generally * impossible to calculate the secure trim 2 timeout correctly. */ if (card->erase_shift) qty += ((to >> card->erase_shift) - (from >> card->erase_shift)) + 1; else if (mmc_card_sd(card)) qty += to - from + 1; else qty += ((to / card->erase_size) - (from / card->erase_size)) + 1; if (!mmc_card_blockaddr(card)) { from <<= 9; to <<= 9; } if (mmc_card_sd(card)) cmd.opcode = SD_ERASE_WR_BLK_START; else cmd.opcode = MMC_ERASE_GROUP_START; cmd.arg = from; cmd.flags = MMC_RSP_SPI_R1 | MMC_RSP_R1 | MMC_CMD_AC; err = mmc_wait_for_cmd(card->host, &cmd, 0); if (err) { pr_err("mmc_erase: group start error %d, " "status %#x\n", err, cmd.resp[0]); err = -EIO; goto out; } memset(&cmd, 0, sizeof(struct mmc_command)); if (mmc_card_sd(card)) cmd.opcode = SD_ERASE_WR_BLK_END; else cmd.opcode = MMC_ERASE_GROUP_END; cmd.arg = to; cmd.flags = MMC_RSP_SPI_R1 | MMC_RSP_R1 | MMC_CMD_AC; err = mmc_wait_for_cmd(card->host, &cmd, 0); if (err) { pr_err("mmc_erase: group end error %d, status %#x\n", err, cmd.resp[0]); err = -EIO; goto out; } memset(&cmd, 0, sizeof(struct mmc_command)); cmd.opcode = MMC_ERASE; cmd.arg = arg; cmd.flags = MMC_RSP_SPI_R1B | MMC_RSP_R1B | MMC_CMD_AC; cmd.cmd_timeout_ms = mmc_erase_timeout(card, arg, qty); err = mmc_wait_for_cmd(card->host, &cmd, 0); if (err) { pr_err("mmc_erase: erase error %d, status %#x\n", err, cmd.resp[0]); err = -EIO; goto out; } if (mmc_host_is_spi(card->host)) goto out; timeout = jiffies + msecs_to_jiffies(MMC_CORE_TIMEOUT_MS); do { memset(&cmd, 0, sizeof(struct mmc_command)); cmd.opcode = MMC_SEND_STATUS; cmd.arg = card->rca << 16; cmd.flags = MMC_RSP_R1 | MMC_CMD_AC; /* Do not retry else we can't see errors */ err = mmc_wait_for_cmd(card->host, &cmd, 0); if (err || (cmd.resp[0] & 0xFDF92000)) { pr_err("error %d requesting status %#x\n", err, cmd.resp[0]); err = -EIO; goto out; } /* Timeout if the device never becomes ready for data and * never leaves the program state. */ if (time_after(jiffies, timeout)) { pr_err("%s: Card stuck in programming state! %s\n", mmc_hostname(card->host), __func__); err = -EIO; goto out; } } while (!(cmd.resp[0] & R1_READY_FOR_DATA) || (R1_CURRENT_STATE(cmd.resp[0]) == R1_STATE_PRG)); out: return err; } /** * mmc_erase - erase sectors. * @card: card to erase * @from: first sector to erase * @nr: number of sectors to erase * @arg: erase command argument (SD supports only %MMC_ERASE_ARG) * * Caller must claim host before calling this function. */ int mmc_erase(struct mmc_card *card, unsigned int from, unsigned int nr, unsigned int arg) { unsigned int rem, to = from + nr; if (!(card->host->caps & MMC_CAP_ERASE) || !(card->csd.cmdclass & CCC_ERASE)) return -EOPNOTSUPP; if (!card->erase_size) return -EOPNOTSUPP; if (mmc_card_sd(card) && arg != MMC_ERASE_ARG) return -EOPNOTSUPP; if ((arg & MMC_SECURE_ARGS) && !(card->ext_csd.sec_feature_support & EXT_CSD_SEC_ER_EN)) return -EOPNOTSUPP; if ((arg & MMC_TRIM_ARGS) && !(card->ext_csd.sec_feature_support & EXT_CSD_SEC_GB_CL_EN)) return -EOPNOTSUPP; if (arg == MMC_SECURE_ERASE_ARG) { if (from % card->erase_size || nr % card->erase_size) return -EINVAL; } if (arg == MMC_ERASE_ARG) { rem = from % card->erase_size; if (rem) { rem = card->erase_size - rem; from += rem; if (nr > rem) nr -= rem; else return 0; } rem = nr % card->erase_size; if (rem) nr -= rem; } if (nr == 0) return 0; to = from + nr; if (to <= from) return -EINVAL; /* 'from' and 'to' are inclusive */ to -= 1; return mmc_do_erase(card, from, to, arg); } EXPORT_SYMBOL(mmc_erase); int mmc_can_erase(struct mmc_card *card) { if ((card->host->caps & MMC_CAP_ERASE) && (card->csd.cmdclass & CCC_ERASE) && card->erase_size) return 1; return 0; } EXPORT_SYMBOL(mmc_can_erase); int mmc_can_trim(struct mmc_card *card) { if (card->ext_csd.sec_feature_support & EXT_CSD_SEC_GB_CL_EN) return 1; return 0; } EXPORT_SYMBOL(mmc_can_trim); int mmc_can_discard(struct mmc_card *card) { /* * As there's no way to detect the discard support bit at v4.5 * use the s/w feature support filed. */ if (card->ext_csd.feature_support & MMC_DISCARD_FEATURE) return 1; return 0; } EXPORT_SYMBOL(mmc_can_discard); int mmc_can_sanitize(struct mmc_card *card) { if (!mmc_can_trim(card) && !mmc_can_erase(card)) return 0; if (card->ext_csd.sec_feature_support & EXT_CSD_SEC_SANITIZE) return 1; return 0; } EXPORT_SYMBOL(mmc_can_sanitize); int mmc_can_secure_erase_trim(struct mmc_card *card) { if (card->ext_csd.sec_feature_support & EXT_CSD_SEC_ER_EN) return 1; return 0; } EXPORT_SYMBOL(mmc_can_secure_erase_trim); int mmc_erase_group_aligned(struct mmc_card *card, unsigned int from, unsigned int nr) { if (!card->erase_size) return 0; if (from % card->erase_size || nr % card->erase_size) return 0; return 1; } EXPORT_SYMBOL(mmc_erase_group_aligned); static unsigned int mmc_do_calc_max_discard(struct mmc_card *card, unsigned int arg) { struct mmc_host *host = card->host; unsigned int max_discard, x, y, qty = 0, max_qty, timeout; unsigned int last_timeout = 0; if (card->erase_shift) max_qty = UINT_MAX >> card->erase_shift; else if (mmc_card_sd(card)) max_qty = UINT_MAX; else max_qty = UINT_MAX / card->erase_size; /* Find the largest qty with an OK timeout */ do { y = 0; for (x = 1; x && x <= max_qty && max_qty - x >= qty; x <<= 1) { timeout = mmc_erase_timeout(card, arg, qty + x); if (timeout > host->max_discard_to) break; if (timeout < last_timeout) break; last_timeout = timeout; y = x; } qty += y; } while (y); if (!qty) return 0; if (qty == 1) return 1; /* Convert qty to sectors */ if (card->erase_shift) max_discard = --qty << card->erase_shift; else if (mmc_card_sd(card)) max_discard = qty; else max_discard = --qty * card->erase_size; return max_discard; } unsigned int mmc_calc_max_discard(struct mmc_card *card) { struct mmc_host *host = card->host; unsigned int max_discard, max_trim; if (!host->max_discard_to) return UINT_MAX; /* * Without erase_group_def set, MMC erase timeout depends on clock * frequence which can change. In that case, the best choice is * just the preferred erase size. */ if (mmc_card_mmc(card) && !(card->ext_csd.erase_group_def & 1)) return card->pref_erase; max_discard = mmc_do_calc_max_discard(card, MMC_ERASE_ARG); if (mmc_can_trim(card)) { max_trim = mmc_do_calc_max_discard(card, MMC_TRIM_ARG); if (max_trim < max_discard) max_discard = max_trim; } else if (max_discard < card->erase_size) { max_discard = 0; } pr_debug("%s: calculated max. discard sectors %u for timeout %u ms\n", mmc_hostname(host), max_discard, host->max_discard_to); return max_discard; } EXPORT_SYMBOL(mmc_calc_max_discard); int mmc_set_blocklen(struct mmc_card *card, unsigned int blocklen) { struct mmc_command cmd = {0}; if (mmc_card_blockaddr(card) || mmc_card_ddr_mode(card)) return 0; cmd.opcode = MMC_SET_BLOCKLEN; cmd.arg = blocklen; cmd.flags = MMC_RSP_SPI_R1 | MMC_RSP_R1 | MMC_CMD_AC; return mmc_wait_for_cmd(card->host, &cmd, 5); } EXPORT_SYMBOL(mmc_set_blocklen); static void mmc_hw_reset_for_init(struct mmc_host *host) { if (!(host->caps & MMC_CAP_HW_RESET) || !host->ops->hw_reset) return; mmc_host_clk_hold(host); host->ops->hw_reset(host); mmc_host_clk_release(host); } int mmc_can_reset(struct mmc_card *card) { u8 rst_n_function; if (mmc_card_sdio(card)) return 0; if (mmc_card_mmc(card)) { rst_n_function = card->ext_csd.rst_n_function; if ((rst_n_function & EXT_CSD_RST_N_EN_MASK) != EXT_CSD_RST_N_ENABLED) return 0; } return 1; } EXPORT_SYMBOL(mmc_can_reset); static int mmc_do_hw_reset(struct mmc_host *host, int check) { struct mmc_card *card = host->card; if (!host->bus_ops->power_restore) return -EOPNOTSUPP; if (!(host->caps & MMC_CAP_HW_RESET) || !host->ops->hw_reset) return -EOPNOTSUPP; if (!card) return -EINVAL; if (!mmc_can_reset(card)) return -EOPNOTSUPP; mmc_host_clk_hold(host); mmc_set_clock(host, host->f_init); host->ops->hw_reset(host); /* If the reset has happened, then a status command will fail */ if (check) { struct mmc_command cmd = {0}; int err; cmd.opcode = MMC_SEND_STATUS; if (!mmc_host_is_spi(card->host)) cmd.arg = card->rca << 16; cmd.flags = MMC_RSP_SPI_R2 | MMC_RSP_R1 | MMC_CMD_AC; err = mmc_wait_for_cmd(card->host, &cmd, 0); if (!err) { mmc_host_clk_release(host); return -ENOSYS; } } host->card->state &= ~(MMC_STATE_HIGHSPEED | MMC_STATE_HIGHSPEED_DDR); if (mmc_host_is_spi(host)) { host->ios.chip_select = MMC_CS_HIGH; host->ios.bus_mode = MMC_BUSMODE_PUSHPULL; } else { host->ios.chip_select = MMC_CS_DONTCARE; host->ios.bus_mode = MMC_BUSMODE_OPENDRAIN; } host->ios.bus_width = MMC_BUS_WIDTH_1; host->ios.timing = MMC_TIMING_LEGACY; mmc_set_ios(host); mmc_host_clk_release(host); return host->bus_ops->power_restore(host); } int mmc_hw_reset(struct mmc_host *host) { return mmc_do_hw_reset(host, 0); } EXPORT_SYMBOL(mmc_hw_reset); int mmc_hw_reset_check(struct mmc_host *host) { return mmc_do_hw_reset(host, 1); } EXPORT_SYMBOL(mmc_hw_reset_check); /** * mmc_reset_clk_scale_stats() - reset clock scaling statistics * @host: pointer to mmc host structure */ void mmc_reset_clk_scale_stats(struct mmc_host *host) { host->clk_scaling.busy_time_us = 0; host->clk_scaling.window_time = jiffies; } EXPORT_SYMBOL_GPL(mmc_reset_clk_scale_stats); /** * mmc_get_max_frequency() - get max. frequency supported * @host: pointer to mmc host structure * * Returns max. frequency supported by card/host. If the * timing mode is SDR50/SDR104/HS200/DDR50 return appropriate * max. frequency in these modes else, use the current frequency. * Also, allow host drivers to overwrite the frequency in case * they support "get_max_frequency" host ops. */ unsigned long mmc_get_max_frequency(struct mmc_host *host) { unsigned long freq; if (host->ops && host->ops->get_max_frequency) { freq = host->ops->get_max_frequency(host); goto out; } switch (host->ios.timing) { case MMC_TIMING_UHS_SDR50: freq = UHS_SDR50_MAX_DTR; break; case MMC_TIMING_UHS_SDR104: freq = UHS_SDR104_MAX_DTR; break; case MMC_TIMING_MMC_HS200: freq = MMC_HS200_MAX_DTR; break; case MMC_TIMING_UHS_DDR50: freq = UHS_DDR50_MAX_DTR; break; default: mmc_host_clk_hold(host); freq = host->ios.clock; mmc_host_clk_release(host); break; } out: return freq; } EXPORT_SYMBOL_GPL(mmc_get_max_frequency); /** * mmc_get_min_frequency() - get min. frequency supported * @host: pointer to mmc host structure * * Returns min. frequency supported by card/host which doesn't impair * performance for most usecases. If the timing mode is SDR50/SDR104/HS200 * return 50MHz value. If timing mode is DDR50 return 25MHz so that * throughput would be equivalent to SDR50/SDR104 in 50MHz. Also, allow * host drivers to overwrite the frequency in case they support * "get_min_frequency" host ops. */ static unsigned long mmc_get_min_frequency(struct mmc_host *host) { unsigned long freq; if (host->ops && host->ops->get_min_frequency) { freq = host->ops->get_min_frequency(host); goto out; } switch (host->ios.timing) { case MMC_TIMING_UHS_SDR50: case MMC_TIMING_UHS_SDR104: freq = UHS_SDR25_MAX_DTR; break; case MMC_TIMING_MMC_HS200: freq = MMC_HIGH_52_MAX_DTR; break; case MMC_TIMING_UHS_DDR50: freq = UHS_DDR50_MAX_DTR / 2; break; default: mmc_host_clk_hold(host); freq = host->ios.clock; mmc_host_clk_release(host); break; } out: return freq; } /* * Scale down clocks to minimum frequency supported. * The delayed work re-arms itself in case it cannot * claim the host. */ static void mmc_clk_scale_work(struct work_struct *work) { struct mmc_host *host = container_of(work, struct mmc_host, clk_scaling.work.work); if (!host->card || !host->bus_ops || !host->bus_ops->change_bus_speed || !host->clk_scaling.enable || !host->ios.clock) goto out; if (!mmc_try_claim_host(host)) { /* retry after a timer tick */ queue_delayed_work(system_nrt_wq, &host->clk_scaling.work, 1); goto out; } mmc_clk_scaling(host, true); mmc_release_host(host); out: return; } static bool mmc_is_vaild_state_for_clk_scaling(struct mmc_host *host) { struct mmc_card *card = host->card; u32 status; bool ret = false; if (!card) goto out; if (mmc_send_status(card, &status)) { pr_err("%s: Get card status fail\n", mmc_hostname(card->host)); goto out; } switch (R1_CURRENT_STATE(status)) { case R1_STATE_TRAN: ret = true; break; default: break; } out: return ret; } static int mmc_clk_update_freq(struct mmc_host *host, unsigned long freq, enum mmc_load state) { int err = 0; if (host->ops->notify_load) { err = host->ops->notify_load(host, state); if (err) goto out; } if (freq != host->clk_scaling.curr_freq) { if (!mmc_is_vaild_state_for_clk_scaling(host)) { err = -EAGAIN; goto error; } err = host->bus_ops->change_bus_speed(host, &freq); if (!err) host->clk_scaling.curr_freq = freq; else pr_err("%s: %s: failed (%d) at freq=%lu\n", mmc_hostname(host), __func__, err, freq); } error: if (err) { /* restore previous state */ if (host->ops->notify_load) host->ops->notify_load(host, host->clk_scaling.state); } out: return err; } /** * mmc_clk_scaling() - clock scaling decision algorithm * @host: pointer to mmc host structure * @from_wq: variable that specifies the context in which * mmc_clk_scaling() is called. * * Calculate load percentage based on host busy time * and total sampling interval and decide clock scaling * based on scale up/down thresholds. * If load is greater than up threshold increase the * frequency to maximum as supported by host. Else, * if load is less than down threshold, scale down the * frequency to minimum supported by the host. Otherwise, * retain current frequency and do nothing. */ static void mmc_clk_scaling(struct mmc_host *host, bool from_wq) { int err = 0; struct mmc_card *card = host->card; unsigned long total_time_ms = 0; unsigned long busy_time_ms = 0; unsigned long freq; unsigned int up_threshold = host->clk_scaling.up_threshold; unsigned int down_threshold = host->clk_scaling.down_threshold; bool queue_scale_down_work = false; enum mmc_load state; if (!card || !host->bus_ops || !host->bus_ops->change_bus_speed) { pr_err("%s: %s: invalid entry\n", mmc_hostname(host), __func__); goto out; } /* Check if the clocks are already gated. */ if (!host->ios.clock) goto out; if (time_is_after_jiffies(host->clk_scaling.window_time + msecs_to_jiffies(host->clk_scaling.polling_delay_ms))) goto out; /* handle time wrap */ total_time_ms = jiffies_to_msecs((long)jiffies - (long)host->clk_scaling.window_time); /* Check if we re-enter during clock switching */ if (unlikely(host->clk_scaling.in_progress)) goto out; host->clk_scaling.in_progress = true; busy_time_ms = host->clk_scaling.busy_time_us / USEC_PER_MSEC; freq = host->clk_scaling.curr_freq; state = host->clk_scaling.state; /* * Note that the max. and min. frequency should be based * on the timing modes that the card and host handshake * during initialization. */ if ((busy_time_ms * 100 > total_time_ms * up_threshold)) { freq = mmc_get_max_frequency(host); state = MMC_LOAD_HIGH; } else if ((busy_time_ms * 100 < total_time_ms * down_threshold)) { if (!from_wq) queue_scale_down_work = true; freq = mmc_get_min_frequency(host); state = MMC_LOAD_LOW; } if (state != host->clk_scaling.state) { if (!queue_scale_down_work) { if (!from_wq) cancel_delayed_work_sync( &host->clk_scaling.work); err = mmc_clk_update_freq(host, freq, state); if (!err) host->clk_scaling.state = state; else if (err == -EAGAIN) goto no_reset_stats; } else { /* * We hold claim host while queueing the scale down * work, so delay atleast one timer tick to release * host and re-claim while scaling down the clocks. */ queue_delayed_work(system_nrt_wq, &host->clk_scaling.work, 1); goto no_reset_stats; } } mmc_reset_clk_scale_stats(host); no_reset_stats: host->clk_scaling.in_progress = false; out: return; } /** * mmc_disable_clk_scaling() - Disable clock scaling * @host: pointer to mmc host structure * * Disables clock scaling temporarily by setting enable * property to false. To disable completely, one also * need to set 'initialized' variable to false. */ void mmc_disable_clk_scaling(struct mmc_host *host) { cancel_delayed_work_sync(&host->clk_scaling.work); host->clk_scaling.enable = false; } EXPORT_SYMBOL_GPL(mmc_disable_clk_scaling); /** * mmc_can_scale_clk() - Check if clock scaling is initialized * @host: pointer to mmc host structure */ bool mmc_can_scale_clk(struct mmc_host *host) { return host->clk_scaling.initialized; } EXPORT_SYMBOL_GPL(mmc_can_scale_clk); /** * mmc_init_clk_scaling() - Initialize clock scaling * @host: pointer to mmc host structure * * Initialize clock scaling for supported hosts. * It is assumed that the caller ensure clock is * running at maximum possible frequency before * calling this function. */ void mmc_init_clk_scaling(struct mmc_host *host) { if (!host->card || !(host->caps2 & MMC_CAP2_CLK_SCALE)) return; INIT_DELAYED_WORK(&host->clk_scaling.work, mmc_clk_scale_work); host->clk_scaling.curr_freq = mmc_get_max_frequency(host); if (host->ops->notify_load) host->ops->notify_load(host, MMC_LOAD_HIGH); host->clk_scaling.state = MMC_LOAD_HIGH; mmc_reset_clk_scale_stats(host); host->clk_scaling.enable = true; host->clk_scaling.initialized = true; pr_debug("%s: clk scaling enabled\n", mmc_hostname(host)); } EXPORT_SYMBOL_GPL(mmc_init_clk_scaling); /** * mmc_exit_clk_scaling() - Disable clock scaling * @host: pointer to mmc host structure * * Disable clock scaling permanently. */ void mmc_exit_clk_scaling(struct mmc_host *host) { cancel_delayed_work_sync(&host->clk_scaling.work); memset(&host->clk_scaling, 0, sizeof(host->clk_scaling)); } EXPORT_SYMBOL_GPL(mmc_exit_clk_scaling); static int mmc_rescan_try_freq(struct mmc_host *host, unsigned freq) { host->f_init = freq; #ifdef CONFIG_MMC_DEBUG pr_info("%s: %s: trying to init card at %u Hz\n", mmc_hostname(host), __func__, host->f_init); #endif mmc_power_up(host); /* * Some eMMCs (with VCCQ always on) may not be reset after power up, so * do a hardware reset if possible. */ mmc_hw_reset_for_init(host); /* Initialization should be done at 3.3 V I/O voltage. */ mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_330, 0); /* * sdio_reset sends CMD52 to reset card. Since we do not know * if the card is being re-initialized, just send it. CMD52 * should be ignored by SD/eMMC cards. */ sdio_reset(host); mmc_go_idle(host); mmc_send_if_cond(host, host->ocr_avail); /* Order's important: probe SDIO, then SD, then MMC */ if (!mmc_attach_sdio(host)) return 0; if (!host->ios.vdd) mmc_power_up(host); if (!mmc_attach_sd(host)) return 0; if (!host->ios.vdd) mmc_power_up(host); if (!mmc_attach_mmc(host)) return 0; mmc_power_off(host); return -EIO; } int _mmc_detect_card_removed(struct mmc_host *host) { int ret; if ((host->caps & MMC_CAP_NONREMOVABLE) || !host->bus_ops->alive) return 0; if (!host->card || mmc_card_removed(host->card)) return 1; ret = host->bus_ops->alive(host); if (ret) { mmc_card_set_removed(host->card); pr_debug("%s: card remove detected\n", mmc_hostname(host)); } return ret; } int mmc_detect_card_removed(struct mmc_host *host) { struct mmc_card *card = host->card; int ret; WARN_ON(!host->claimed); if (!card) return 1; ret = mmc_card_removed(card); /* * The card will be considered unchanged unless we have been asked to * detect a change or host requires polling to provide card detection. */ if (!host->detect_change && !(host->caps & MMC_CAP_NEEDS_POLL) && !(host->caps2 & MMC_CAP2_DETECT_ON_ERR)) return ret; host->detect_change = 0; if (!ret) { ret = _mmc_detect_card_removed(host); if (ret && (host->caps2 & MMC_CAP2_DETECT_ON_ERR)) { /* * Schedule a detect work as soon as possible to let a * rescan handle the card removal. */ cancel_delayed_work(&host->detect); mmc_detect_change(host, 0); } } return ret; } EXPORT_SYMBOL(mmc_detect_card_removed); void mmc_rescan(struct work_struct *work) { struct mmc_host *host = container_of(work, struct mmc_host, detect.work); bool extend_wakelock = false; if (host->rescan_disable) return; mmc_bus_get(host); /* * if there is a _removable_ card registered, check whether it is * still present */ if (host->bus_ops && host->bus_ops->detect && !host->bus_dead && !(host->caps & MMC_CAP_NONREMOVABLE)) host->bus_ops->detect(host); host->detect_change = 0; /* If the card was removed the bus will be marked * as dead - extend the wakelock so userspace * can respond */ if (host->bus_dead) extend_wakelock = 1; /* If the card was removed the bus will be marked * as dead - extend the wakelock so userspace * can respond */ if (host->bus_dead) extend_wakelock = 1; /* * Let mmc_bus_put() free the bus/bus_ops if we've found that * the card is no longer present. */ mmc_bus_put(host); mmc_bus_get(host); /* if there still is a card present, stop here */ if (host->bus_ops != NULL) { mmc_bus_put(host); goto out; } /* * Only we can add a new handler, so it's safe to * release the lock here. */ mmc_bus_put(host); if (host->ops->get_cd && host->ops->get_cd(host) == 0) goto out; mmc_claim_host(host); if (!mmc_rescan_try_freq(host, host->f_min)) extend_wakelock = true; mmc_release_host(host); out: if (extend_wakelock) wake_lock_timeout(&host->detect_wake_lock, HZ / 2); else wake_unlock(&host->detect_wake_lock); if (host->caps & MMC_CAP_NEEDS_POLL) { wake_lock(&host->detect_wake_lock); mmc_schedule_delayed_work(&host->detect, HZ); } } void mmc_start_host(struct mmc_host *host) { mmc_power_off(host); mmc_detect_change(host, 0); } void mmc_stop_host(struct mmc_host *host) { #ifdef CONFIG_MMC_DEBUG unsigned long flags; spin_lock_irqsave(&host->lock, flags); host->removed = 1; spin_unlock_irqrestore(&host->lock, flags); #endif if (cancel_delayed_work_sync(&host->detect)) wake_unlock(&host->detect_wake_lock); mmc_flush_scheduled_work(); /* clear pm flags now and let card drivers set them as needed */ host->pm_flags = 0; mmc_bus_get(host); if (host->bus_ops && !host->bus_dead) { /* Calling bus_ops->remove() with a claimed host can deadlock */ if (host->bus_ops->remove) host->bus_ops->remove(host); mmc_claim_host(host); mmc_detach_bus(host); mmc_power_off(host); mmc_release_host(host); mmc_bus_put(host); return; } mmc_bus_put(host); BUG_ON(host->card); mmc_power_off(host); } int mmc_power_save_host(struct mmc_host *host) { int ret = 0; #ifdef CONFIG_MMC_DEBUG pr_info("%s: %s: powering down\n", mmc_hostname(host), __func__); #endif mmc_bus_get(host); if (!host->bus_ops || host->bus_dead || !host->bus_ops->power_restore) { mmc_bus_put(host); return -EINVAL; } if (host->bus_ops->power_save) ret = host->bus_ops->power_save(host); mmc_bus_put(host); mmc_power_off(host); return ret; } EXPORT_SYMBOL(mmc_power_save_host); int mmc_power_restore_host(struct mmc_host *host) { int ret; #ifdef CONFIG_MMC_DEBUG pr_info("%s: %s: powering up\n", mmc_hostname(host), __func__); #endif mmc_bus_get(host); if (!host->bus_ops || host->bus_dead || !host->bus_ops->power_restore) { mmc_bus_put(host); return -EINVAL; } mmc_power_up(host); ret = host->bus_ops->power_restore(host); mmc_bus_put(host); return ret; } EXPORT_SYMBOL(mmc_power_restore_host); int mmc_card_awake(struct mmc_host *host) { int err = -ENOSYS; if (host->caps2 & MMC_CAP2_NO_SLEEP_CMD) return 0; mmc_bus_get(host); if (host->bus_ops && !host->bus_dead && host->bus_ops->awake) err = host->bus_ops->awake(host); mmc_bus_put(host); return err; } EXPORT_SYMBOL(mmc_card_awake); int mmc_card_sleep(struct mmc_host *host) { int err = -ENOSYS; if (host->caps2 & MMC_CAP2_NO_SLEEP_CMD) return 0; mmc_bus_get(host); if (host->bus_ops && !host->bus_dead && host->bus_ops->sleep) err = host->bus_ops->sleep(host); mmc_bus_put(host); return err; } EXPORT_SYMBOL(mmc_card_sleep); int mmc_card_can_sleep(struct mmc_host *host) { struct mmc_card *card = host->card; if (card && mmc_card_mmc(card) && card->ext_csd.rev >= 3) return 1; return 0; } EXPORT_SYMBOL(mmc_card_can_sleep); /* * Flush the cache to the non-volatile storage. */ int mmc_flush_cache(struct mmc_card *card) { struct mmc_host *host = card->host; int err = 0, rc; if (!(host->caps2 & MMC_CAP2_CACHE_CTRL)) return err; if (mmc_card_mmc(card) && (card->ext_csd.cache_size > 0) && (card->ext_csd.cache_ctrl & 1)) { err = mmc_switch_ignore_timeout(card, EXT_CSD_CMD_SET_NORMAL, EXT_CSD_FLUSH_CACHE, 1, MMC_FLUSH_REQ_TIMEOUT_MS); if (err == -ETIMEDOUT) { pr_debug("%s: cache flush timeout\n", mmc_hostname(card->host)); rc = mmc_interrupt_hpi(card); if (rc) pr_err("%s: mmc_interrupt_hpi() failed (%d)\n", mmc_hostname(host), rc); } else if (err) { pr_err("%s: cache flush error %d\n", mmc_hostname(card->host), err); } } return err; } EXPORT_SYMBOL(mmc_flush_cache); /* * Turn the cache ON/OFF. * Turning the cache OFF shall trigger flushing of the data * to the non-volatile storage. * This function should be called with host claimed */ int mmc_cache_ctrl(struct mmc_host *host, u8 enable) { struct mmc_card *card = host->card; unsigned int timeout = card->ext_csd.generic_cmd6_time; int err = 0, rc; if (!(host->caps2 & MMC_CAP2_CACHE_CTRL) || mmc_card_is_removable(host)) return err; if (card && mmc_card_mmc(card) && (card->ext_csd.cache_size > 0)) { enable = !!enable; if (card->ext_csd.cache_ctrl ^ enable) { if (!enable) timeout = MMC_FLUSH_REQ_TIMEOUT_MS; err = mmc_switch_ignore_timeout(card, EXT_CSD_CMD_SET_NORMAL, EXT_CSD_CACHE_CTRL, enable, timeout); if (err == -ETIMEDOUT && !enable) { pr_debug("%s:cache disable operation timeout\n", mmc_hostname(card->host)); rc = mmc_interrupt_hpi(card); if (rc) pr_err("%s: mmc_interrupt_hpi() failed (%d)\n", mmc_hostname(host), rc); } else if (err) { pr_err("%s: cache %s error %d\n", mmc_hostname(card->host), enable ? "on" : "off", err); } else { card->ext_csd.cache_ctrl = enable; } } } return err; } EXPORT_SYMBOL(mmc_cache_ctrl); #ifdef CONFIG_PM /** * mmc_suspend_host - suspend a host * @host: mmc host */ int mmc_suspend_host(struct mmc_host *host) { int err = 0; if (mmc_bus_needs_resume(host)) return 0; mmc_bus_get(host); if (host->bus_ops && !host->bus_dead) { /* * A long response time is not acceptable for device drivers * when doing suspend. Prevent mmc_claim_host in the suspend * sequence, to potentially wait "forever" by trying to * pre-claim the host. * * Skip try claim host for SDIO cards, doing so fixes deadlock * conditions. The function driver suspend may again call into * SDIO driver within a different context for enabling power * save mode in the card and hence wait in mmc_claim_host * causing deadlock. */ if (!(host->card && mmc_card_sdio(host->card))) if (!mmc_try_claim_host(host)) err = -EBUSY; if (!err) { if (host->bus_ops->suspend) { err = mmc_stop_bkops(host->card); if (err) goto stop_bkops_err; err = host->bus_ops->suspend(host); } if (!(host->card && mmc_card_sdio(host->card))) mmc_release_host(host); if (err == -ENOSYS || !host->bus_ops->resume) { /* * We simply "remove" the card in this case. * It will be redetected on resume. (Calling * bus_ops->remove() with a claimed host can * deadlock.) * It will be redetected on resume. */ if (host->bus_ops->remove) host->bus_ops->remove(host); mmc_claim_host(host); mmc_detach_bus(host); mmc_power_off(host); mmc_release_host(host); host->pm_flags = 0; err = 0; } } } mmc_bus_put(host); if (!err && !mmc_card_keep_power(host)) mmc_power_off(host); return err; stop_bkops_err: if (!(host->card && mmc_card_sdio(host->card))) mmc_release_host(host); return err; } EXPORT_SYMBOL(mmc_suspend_host); /** * mmc_resume_host - resume a previously suspended host * @host: mmc host */ int mmc_resume_host(struct mmc_host *host) { int err = 0; mmc_bus_get(host); if (mmc_bus_manual_resume(host)) { host->bus_resume_flags |= MMC_BUSRESUME_NEEDS_RESUME; mmc_bus_put(host); return 0; } if (host->bus_ops && !host->bus_dead) { if (!mmc_card_keep_power(host)) { mmc_power_up(host); mmc_select_voltage(host, host->ocr); /* * Tell runtime PM core we just powered up the card, * since it still believes the card is powered off. * Note that currently runtime PM is only enabled * for SDIO cards that are MMC_CAP_POWER_OFF_CARD */ if (mmc_card_sdio(host->card) && (host->caps & MMC_CAP_POWER_OFF_CARD)) { pm_runtime_disable(&host->card->dev); pm_runtime_set_active(&host->card->dev); pm_runtime_enable(&host->card->dev); } } BUG_ON(!host->bus_ops->resume); err = host->bus_ops->resume(host); if (err) { pr_warning("%s: error %d during resume " "(card was removed?)\n", mmc_hostname(host), err); err = 0; } } host->pm_flags &= ~MMC_PM_KEEP_POWER; mmc_bus_put(host); return err; } EXPORT_SYMBOL(mmc_resume_host); /* Do the card removal on suspend if card is assumed removeable * Do that in pm notifier while userspace isn't yet frozen, so we will be able to sync the card. */ int mmc_pm_notify(struct notifier_block *notify_block, unsigned long mode, void *unused) { struct mmc_host *host = container_of( notify_block, struct mmc_host, pm_notify); unsigned long flags; int err = 0; switch (mode) { case PM_HIBERNATION_PREPARE: case PM_SUSPEND_PREPARE: if (host->card && mmc_card_mmc(host->card)) { mmc_claim_host(host); err = mmc_stop_bkops(host->card); mmc_release_host(host); if (err) { pr_err("%s: didn't stop bkops\n", mmc_hostname(host)); return err; } } spin_lock_irqsave(&host->lock, flags); if (mmc_bus_needs_resume(host)) { spin_unlock_irqrestore(&host->lock, flags); break; } host->rescan_disable = 1; spin_unlock_irqrestore(&host->lock, flags); if (cancel_delayed_work_sync(&host->detect)) wake_unlock(&host->detect_wake_lock); if (!host->bus_ops || host->bus_ops->suspend) break; /* Calling bus_ops->remove() with a claimed host can deadlock */ if (host->bus_ops->remove) host->bus_ops->remove(host); mmc_claim_host(host); mmc_detach_bus(host); mmc_power_off(host); mmc_release_host(host); host->pm_flags = 0; break; case PM_POST_SUSPEND: case PM_POST_HIBERNATION: case PM_POST_RESTORE: spin_lock_irqsave(&host->lock, flags); if (mmc_bus_manual_resume(host)) { spin_unlock_irqrestore(&host->lock, flags); break; } host->rescan_disable = 0; spin_unlock_irqrestore(&host->lock, flags); mmc_detect_change(host, 0); } return 0; } #endif #ifdef CONFIG_MMC_EMBEDDED_SDIO void mmc_set_embedded_sdio_data(struct mmc_host *host, struct sdio_cis *cis, struct sdio_cccr *cccr, struct sdio_embedded_func *funcs, int num_funcs) { host->embedded_sdio_data.cis = cis; host->embedded_sdio_data.cccr = cccr; host->embedded_sdio_data.funcs = funcs; host->embedded_sdio_data.num_funcs = num_funcs; } EXPORT_SYMBOL(mmc_set_embedded_sdio_data); #endif static int __init mmc_init(void) { int ret; workqueue = alloc_ordered_workqueue("kmmcd", 0); if (!workqueue) return -ENOMEM; ret = mmc_register_bus(); if (ret) goto destroy_workqueue; ret = mmc_register_host_class(); if (ret) goto unregister_bus; ret = sdio_register_bus(); if (ret) goto unregister_host_class; return 0; unregister_host_class: mmc_unregister_host_class(); unregister_bus: mmc_unregister_bus(); destroy_workqueue: destroy_workqueue(workqueue); return ret; } static void __exit mmc_exit(void) { sdio_unregister_bus(); mmc_unregister_host_class(); mmc_unregister_bus(); destroy_workqueue(workqueue); } subsys_initcall(mmc_init); module_exit(mmc_exit); MODULE_LICENSE("GPL");
VilleEvitaCake/android_kernel_htc_msm8960
drivers/mmc/core/core.c
C
gpl-2.0
80,989
23.850875
81
0.659052
false
var options={}; options.login=true; LoginRadius_SocialLogin.util.ready(function () { $ui = LoginRadius_SocialLogin.lr_login_settings; $ui.interfacesize = Drupal.settings.lrsociallogin.interfacesize; $ui.lrinterfacebackground=Drupal.settings.lrsociallogin.lrinterfacebackground; $ui.noofcolumns= Drupal.settings.lrsociallogin.noofcolumns; $ui.apikey = Drupal.settings.lrsociallogin.apikey; $ui.is_access_token=true; $ui.callback=Drupal.settings.lrsociallogin.location; $ui.lrinterfacecontainer ="interfacecontainerdiv"; LoginRadius_SocialLogin.init(options); }); LoginRadiusSDK.setLoginCallback(function () { var token = LoginRadiusSDK.getToken(); var form = document.createElement('form'); form.action = Drupal.settings.lrsociallogin.location; form.method = 'POST'; var hiddenToken = document.createElement('input'); hiddenToken.type = 'hidden'; hiddenToken.value = token; hiddenToken.name = 'token'; form.appendChild(hiddenToken); document.body.appendChild(form); form.submit(); });
bedesign323/aimhigh
sites/all/modules/contrib/sociallogin/js/sociallogin_interface.js
JavaScript
gpl-2.0
1,057
41.32
97
0.743614
false
<?php namespace Drupal\materialize\Plugin\Setting\General\Tables; use Drupal\materialize\Annotation\MaterializeSetting; use Drupal\materialize\Plugin\Setting\SettingBase; use Drupal\Core\Annotation\Translation; /** * The "table_bordered" theme setting. * * @ingroup plugins_setting * * @MaterializeSetting( * id = "table_bordered", * type = "checkbox", * title = @Translation("Bordered table"), * description = @Translation("Add borders on all sides of the table and cells."), * defaultValue = 0, * groups = { * "general" = @Translation("General"), * "tables" = @Translation("Tables"), * }, * ) */ class TableBordered extends SettingBase {}
sunlight25/d8
web/themes/contrib/materialize/src/Plugin/Setting/General/Tables/TableBordered.php
PHP
gpl-2.0
682
25.230769
84
0.684751
false
package net.senmori.customtextures.events; import net.senmori.customtextures.util.MovementType; import org.bukkit.entity.Player; import org.bukkit.event.player.PlayerEvent; import com.sk89q.worldguard.protection.regions.ProtectedRegion; /** * event that is triggered after a player entered a WorldGuard region * @author mewin<mewin001@hotmail.de> */ public class RegionEnteredEvent extends RegionEvent { /** * creates a new RegionEnteredEvent * @param region the region the player entered * @param player the player who triggered the event * @param movement the type of movement how the player entered the region */ public RegionEnteredEvent(ProtectedRegion region, Player player, MovementType movement, PlayerEvent parent) { super(player, region, parent, movement); } }
Senmori/CustomTextures
src/main/java/net/senmori/customtextures/events/RegionEnteredEvent.java
Java
gpl-2.0
851
30.807692
111
0.730905
false
<?php /* * @package Joomla.Framework * @copyright Copyright (C) 2005 - 2010 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt * * @component Phoca Component * @copyright Copyright (C) Jan Pavelka www.phoca.cz * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License version 2 or later; */ defined('_JEXEC') or die(); jimport('joomla.application.component.modeladmin'); phocagalleryimport('phocagallery.tag.tag'); class PhocaGalleryCpModelPhocaGalleryImg extends JModelAdmin { protected $option = 'com_phocagallery'; protected $text_prefix = 'com_phocagallery'; protected function canDelete($record) { $user = JFactory::getUser(); if ($record->catid) { return $user->authorise('core.delete', 'com_phocagallery.phocagalleryimg.'.(int) $record->catid); } else { return parent::canDelete($record); } } protected function canEditState($record) { $user = JFactory::getUser(); if ($record->catid) { return $user->authorise('core.edit.state', 'com_phocagallery.phocagalleryimg.'.(int) $record->catid); } else { return parent::canEditState($record); } } public function getTable($type = 'PhocaGallery', $prefix = 'Table', $config = array()) { return JTable::getInstance($type, $prefix, $config); } public function getForm($data = array(), $loadData = true) { $app = JFactory::getApplication(); $form = $this->loadForm('com_phocagallery.phocagalleryimg', 'phocagalleryimg', array('control' => 'jform', 'load_data' => $loadData)); if (empty($form)) { return false; } return $form; } protected function loadFormData() { // Check the session for previously entered form data. $data = JFactory::getApplication()->getUserState('com_phocagallery.edit.phocagallery.data', array()); if (empty($data)) { $data = $this->getItem(); } return $data; } public function getItem($pk = null) { if ($item = parent::getItem($pk)) { // Convert the params field to an array. $registry = new JRegistry; $registry->loadJSON($item->metadata); $item->metadata = $registry->toArray(); } return $item; } protected function prepareTable(&$table) { jimport('joomla.filter.output'); $date = JFactory::getDate(); $user = JFactory::getUser(); $table->title = htmlspecialchars_decode($table->title, ENT_QUOTES); $table->alias = JApplication::stringURLSafe($table->alias); if (empty($table->alias)) { $table->alias = JApplication::stringURLSafe($table->title); } if (empty($table->id)) { // Set the values //$table->created = $date->toMySQL(); // Set ordering to the last item if not set if (empty($table->ordering)) { $db = JFactory::getDbo(); $db->setQuery('SELECT MAX(ordering) FROM #__phocagallery WHERE catid = '.(int)$table->catid); $max = $db->loadResult(); $table->ordering = $max+1; } } else { // Set the values //$table->modified = $date->toMySQL(); //$table->modified_by = $user->get('id'); } } protected function getReorderConditions($table = null) { $condition = array(); $condition[] = 'catid = '. (int) $table->catid; //$condition[] = 'state >= 0'; return $condition; } function approve(&$pks, $value = 1) { // Initialise variables. $dispatcher = JDispatcher::getInstance(); $user = JFactory::getUser(); $table = $this->getTable('phocagallery'); $pks = (array) $pks; // Include the content plugins for the change of state event. JPluginHelper::importPlugin('content'); // Access checks. foreach ($pks as $i => $pk) { if ($table->load($pk)) { if (!$this->canEditState($table)) { // Prune items that you can't change. unset($pks[$i]); JError::raiseWarning(403, JText::_('JLIB_APPLICATION_ERROR_EDIT_STATE_NOT_PERMITTED')); } } } // Attempt to change the state of the records. if (!$table->approve($pks, $value, $user->get('id'))) { $this->setError($table->getError()); return false; } $context = $this->option.'.'.$this->name; // Trigger the onContentChangeState event. /*$result = $dispatcher->trigger($this->event_change_state, array($context, $pks, $value)); if (in_array(false, $result, true)) { $this->setError($table->getError()); return false; }*/ return true; } function save($data) { $params = &JComponentHelper::getParams( 'com_phocagallery' ); $clean_thumbnails = $params->get( 'clean_thumbnails', 0 ); $fileOriginalNotExist = 0; if ((int)$data['extid'] > 0) { $data['imgorigsize'] = 0; if ($data['title'] == '') { $data['title'] = 'External Image'; } } else { //If this file doesn't exists don't save it if (!PhocaGalleryFile::existsFileOriginal($data['filename'])) { //$this->setError('Original File does not exist'); //return false; $fileOriginalNotExist = 1; $errorMsg = JText::_('COM_PHOCAGALLERY_ORIGINAL_IMAGE_NOT_EXIST'); } $data['imgorigsize'] = PhocaGalleryFile::getFileSize($data['filename'], 0); //If there is no title and no alias, use filename as title and alias if ($data['title'] == '') { $data['title'] = PhocaGalleryFile::getTitleFromFile($data['filename']); } } if ($data['extlink1link'] != '') { $extlink1 = str_replace('http://','', $data['extlink1link']); $data['extlink1'] = $extlink1 . '|'.$data['extlink1title'].'|'.$data['extlink1target'].'|'.$data['extlink1icon']; } else { $data['extlink1'] = $data['extlink1link'] . '|'.$data['extlink1title'].'|'.$data['extlink1target'].'|'.$data['extlink1icon']; } if ($data['extlink2link'] != '') { $extlink2 = str_replace('http://','', $data['extlink2link']); $data['extlink2'] = $extlink2 . '|'.$data['extlink2title'].'|'.$data['extlink2target'].'|'.$data['extlink2icon']; } else { $data['extlink2'] = $data['extlink2link'] . '|'.$data['extlink2title'].'|'.$data['extlink2target'].'|'.$data['extlink2icon']; } // Geo if($data['longitude'] == '' || $data['latitude'] == '') { phocagalleryimport('phocagallery.geo.geo'); $coords = PhocaGalleryGeo::getGeoCoords($data['filename']); if ($data['longitude'] == '' ){ $data['longitude'] = $coords['longitude']; } if ($data['latitude'] == '' ){ $data['latitude'] = $coords['latitude']; } if ($data['latitude'] != '' && $data['longitude'] != '' && $data['zoom'] == ''){ $data['zoom'] = PhocaGallerySettings::getAdvancedSettings('geozoom'); } } if ($data['alias'] == '') { $data['alias'] = $data['title']; } //clean alias name (no bad characters) //$data['alias'] = PhocaGalleryText::getAliasName($data['alias']); // if new item, order last in appropriate group //if (!$row->id) { // $where = 'catid = ' . (int) $row->catid ; // $row->ordering = $row->getNextOrder( $where ); //} // = = = = = = = = = = // Initialise variables; $dispatcher = JDispatcher::getInstance(); $table = $this->getTable(); $pk = (!empty($data['id'])) ? $data['id'] : (int)$this->getState($this->getName().'.id'); $isNew = true; // Include the content plugins for the on save events. JPluginHelper::importPlugin('content'); // Load the row if saving an existing record. if ($pk > 0) { $table->load($pk); $isNew = false; } // Bind the data. if (!$table->bind($data)) { $this->setError($table->getError()); return false; } if(intval($table->date) == 0) { $table->date = JFactory::getDate()->toMySQL(); } // Prepare the row for saving $this->prepareTable($table); // Check the data. if (!$table->check()) { $this->setError($table->getError()); return false; } // Trigger the onContentBeforeSave event. /*$result = $dispatcher->trigger($this->event_before_save, array($this->option.'.'.$this->name, $table, $isNew)); if (in_array(false, $result, true)) { $this->setError($table->getError()); return false; }*/ // Store the data. if (!$table->store()) { $this->setError($table->getError()); return false; } // Store to ref table if (!isset($data['tags'])) { $data['tags'] = array(); } if ((int)$table->id > 0) { PhocaGalleryTag::storeTags($data['tags'], (int)$table->id); } // Clean the cache. $cache = JFactory::getCache($this->option); $cache->clean(); // Trigger the onContentAfterSave event. //$dispatcher->trigger($this->event_after_save, array($this->option.'.'.$this->name, $table, $isNew)); $pkName = $table->getKeyName(); if (isset($table->$pkName)) { $this->setState($this->getName().'.id', $table->$pkName); } $this->setState($this->getName().'.new', $isNew); // = = = = = = $task = JRequest::getVar('task'); if (isset($table->$pkName)) { $id = $table->$pkName; } if ((int)$data['extid'] > 0 || $fileOriginalNotExist == 1) { } else { // - - - - - - - - - - - - - - - - - - //Create thumbnail small, medium, large //file - abc.img, file_no - folder/abc.img //Get folder variables from Helper //Create thumbnails small, medium, large $refresh_url = 'index.php?option=com_phocagallery&task=phocagalleryimg.thumbs'; $task = JRequest::getVar('task'); if (isset($table->$pkName) && $task == 'apply') { $id = $table->$pkName; $refresh_url = 'index.php?option=com_phocagallery&task=phocagalleryimg.edit&id='.(int)$id; } if ($task = 'save2new') { // Don't create automatically thumbnails in case, we are going to add new image } else { $file_thumb = PhocaGalleryFileThumbnail::getOrCreateThumbnail($data['filename'], $refresh_url, 1, 1, 1); } //Clean Thumbs Folder if there are thumbnail files but not original file if ($clean_thumbnails == 1) { phocagalleryimport('phocagallery.file.filefolder'); PhocaGalleryFileFolder::cleanThumbsFolder(); } // - - - - - - - - - - - - - - - - - - - - - } return true; } function delete($cid = array()) { $params = &JComponentHelper::getParams( 'com_phocagallery' ); $clean_thumbnails = $params->get( 'clean_thumbnails', 0 ); $result = false; if (count( $cid )) { JArrayHelper::toInteger($cid); $cids = implode( ',', $cid ); // - - - - - - - - - - - - - // Get all filenames we want to delete from database, we delete all thumbnails from server of this file $queryd = 'SELECT filename as filename FROM #__phocagallery WHERE id IN ( '.$cids.' )'; $this->_db->setQuery($queryd); $fileObject = $this->_db->loadObjectList(); // - - - - - - - - - - - - - //Delete it from DB $query = 'DELETE FROM #__phocagallery' . ' WHERE id IN ( '.$cids.' )'; $this->_db->setQuery( $query ); if(!$this->_db->query()) { $this->setError($this->_db->getErrorMsg()); return false; } // - - - - - - - - - - - - - - // Delete thumbnails - medium and large, small from server // All id we want to delete - gel all filenames foreach ($fileObject as $key => $value) { //The file can be stored in other category - don't delete it from server because other category use it $querys = "SELECT id as id FROM #__phocagallery WHERE filename='".$value->filename."' "; $this->_db->setQuery($queryd); $sameFileObject = $this->_db->loadObject(); // same file in other category doesn't exist - we can delete it if (!$sameFileObject) { PhocaGalleryFileThumbnail::deleteFileThumbnail($value->filename, 1, 1, 1); } } // Clean Thumbs Folder if there are thumbnail files but not original file if ($clean_thumbnails == 1) { phocagalleryimport('phocagallery.file.filefolder'); PhocaGalleryFileFolder::cleanThumbsFolder(); } // - - - - - - - - - - - - - - } return true; } function recreate($cid = array(), &$message) { if (count( $cid )) { JArrayHelper::toInteger($cid); $cids = implode( ',', $cid ); $query = 'SELECT a.filename, a.extid'. ' FROM #__phocagallery AS a' . ' WHERE a.id IN ( '.$cids.' )'; $this->_db->setQuery($query); $files = $this->_db->loadObjectList(); if (isset($files) && count($files)) { foreach($files as $key => $value) { if (isset($value->extid) && ((int)$value->extid > 0)) { // Picasa cannot be recreated $message = JText::_('COM_PHOCAGALLERY_ERROR_EXT_IMG_NOT_RECREATE'); return false; } else if (isset($value->filename) && $value->filename != '') { $original = PhocaGalleryFile::existsFileOriginal($value->filename); if (!$original) { // Original does not exist - cannot generate new thumbnail $message = JText::_('COM_PHOCAGALLERY_FILEORIGINAL_NOT_EXISTS'); return false; } // Delete old thumbnails $deleteThubms = PhocaGalleryFileThumbnail::deleteFileThumbnail($value->filename, 1, 1, 1); } else { $message = JText::_('COM_PHOCAGALLERY_FILENAME_NOT_EXISTS'); return false; } if (!$deleteThubms) { $message = JText::_('COM_PHOCAGALLERY_ERROR_DELETE_THUMBNAIL'); return false; } } } else { $message = JText::_('COM_PHOCAGALLERY_ERROR_LOADING_DATA_DB'); return false; } } else { $message = JText::_('COM_PHOCAGALLERY_ERROR_ITEM_NOT_SELECTED'); return false; } return true; } /* function deletethumbs($id) { if ($id > 0) { $query = 'SELECT a.filename as filename'. ' FROM #__phocagallery AS a' . ' WHERE a.id = '.(int) $id; $this->_db->setQuery($query); $file = $this->_db->loadObject(); if (isset($file->filename) && $file->filename != '') { $deleteThubms = PhocaGalleryFileThumbnail::deleteFileThumbnail($file->filename, 1, 1, 1); if ($deleteThubms) { return true; } else { return false; } } return false; } return false; }*/ public function disableThumbs() { $component = 'com_phocagallery'; $paramsC = JComponentHelper::getParams($component) ; $paramsC->setValue('enable_thumb_creation', 0); $data['params'] = $paramsC->toArray(); $table = JTable::getInstance('extension'); $idCom = $table->find( array('element' => $component )); $table->load($idCom); if (!$table->bind($data)) { JError::raiseWarning( 500, 'Not a valid component' ); return false; } // pre-save checks if (!$table->check()) { JError::raiseWarning( 500, $table->getError('Check Problem') ); return false; } // save the changes if (!$table->store()) { JError::raiseWarning( 500, $table->getError('Store Problem') ); return false; } return true; } function rotate($id, $angle, &$errorMsg) { phocagalleryimport('phocagallery.image.imagerotate'); if ($id > 0 && $angle !='') { $query = 'SELECT a.filename as filename'. ' FROM #__phocagallery AS a' . ' WHERE a.id = '.(int) $id; $this->_db->setQuery($query); $file = $this->_db->loadObject(); if (isset($file->filename) && $file->filename != '') { $thumbNameL = PhocaGalleryFileThumbnail::getThumbnailName ($file->filename, 'large'); $thumbNameM = PhocaGalleryFileThumbnail::getThumbnailName ($file->filename, 'medium'); $thumbNameS = PhocaGalleryFileThumbnail::getThumbnailName ($file->filename, 'small'); $errorMsg = $errorMsgS = $errorMsgM = $errorMsgL =''; PhocaGalleryImageRotate::rotateImage($thumbNameL, 'large', $angle, $errorMsgS); if ($errorMsgS != '') { $errorMsg = $errorMsgS; return false; } PhocaGalleryImageRotate::rotateImage($thumbNameM, 'medium', $angle, $errorMsgM); if ($errorMsgM != '') { $errorMsg = $errorMsgM; return false; } PhocaGalleryImageRotate::rotateImage($thumbNameS, 'small', $angle, $errorMsgL); if ($errorMsgL != '') { $errorMsg = $errorMsgL; return false; } if ($errorMsgL == '' && $errorMsgM == '' && $errorMsgS == '' ) { return true; } else { $errorMsg = ' ('.$errorMsg.')'; return false; } } $errorMsg = JText::_('COM_PHOCAGALLERY_FILENAME_NOT_EXISTS'); return false; } $errorMsg = JText::_('COM_PHOCAGALLERY_ERROR_ITEM_NOT_SELECTED'); return false; } function deletethumbs($id) { if ($id > 0) { $query = 'SELECT a.filename as filename'. ' FROM #__phocagallery AS a' . ' WHERE a.id = '.(int) $id; $this->_db->setQuery($query); $file = $this->_db->loadObject(); if (isset($file->filename) && $file->filename != '') { $deleteThubms = PhocaGalleryFileThumbnail::deleteFileThumbnail($file->filename, 1, 1, 1); if ($deleteThubms) { return true; } else { return false; } } return false; } return false; } protected function batchCopy($value, $pks, $contexts) { $categoryId = (int) $value; $table = $this->getTable(); $db = $this->getDbo(); // Check that the category exists if ($categoryId) { $categoryTable = JTable::getInstance('PhocaGalleryC', 'Table'); if (!$categoryTable->load($categoryId)) { if ($error = $categoryTable->getError()) { // Fatal error $this->setError($error); return false; } else { $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_MOVE_CATEGORY_NOT_FOUND')); return false; } } } if (empty($categoryId)) { $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_MOVE_CATEGORY_NOT_FOUND')); return false; } // Check that the user has create permission for the component $extension = JRequest::getCmd('option'); $user = JFactory::getUser(); if (!$user->authorise('core.create', $extension)) { $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_CREATE')); return false; } //NEW $i = 0; //ENDNEW // Parent exists so we let's proceed while (!empty($pks)) { // Pop the first ID off the stack $pk = array_shift($pks); $table->reset(); // Check that the row actually exists if (!$table->load($pk)) { if ($error = $table->getError()) { // Fatal error $this->setError($error); return false; } else { // Not fatal error $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } } // Alter the title & alias $data = $this->generateNewTitle($categoryId, $table->alias, $table->title); $table->title = $data['0']; $table->alias = $data['1']; // Reset the ID because we are making a copy $table->id = 0; // New category ID $table->catid = $categoryId; // Ordering $table->ordering = $this->increaseOrdering($categoryId); $table->hits = 0; // Check the row. if (!$table->check()) { $this->setError($table->getError()); return false; } // Store the row. if (!$table->store()) { $this->setError($table->getError()); return false; } //NEW // Get the new item ID $newId = $table->get('id'); // Add the new ID to the array $newIds[$i] = $newId; $i++; //ENDNEW } // Clean the cache $this->cleanCache(); //NEW return $newIds; //END NEW } /** * Batch move articles to a new category * * @param integer $value The new category ID. * @param array $pks An array of row IDs. * * @return booelan True if successful, false otherwise and internal error is set. * * @since 11.1 */ protected function batchMove($value, $pks, $contexts) { $categoryId = (int) $value; $table = $this->getTable(); //$db = $this->getDbo(); // Check that the category exists if ($categoryId) { $categoryTable = JTable::getInstance('PhocaGalleryC', 'Table'); if (!$categoryTable->load($categoryId)) { if ($error = $categoryTable->getError()) { // Fatal error $this->setError($error); return false; } else { $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_MOVE_CATEGORY_NOT_FOUND')); return false; } } } if (empty($categoryId)) { $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_MOVE_CATEGORY_NOT_FOUND')); return false; } // Check that user has create and edit permission for the component $extension = JRequest::getCmd('option'); $user = JFactory::getUser(); if (!$user->authorise('core.create', $extension)) { $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_CREATE')); return false; } if (!$user->authorise('core.edit', $extension)) { $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } // Parent exists so we let's proceed foreach ($pks as $pk) { // Check that the row actually exists if (!$table->load($pk)) { if ($error = $table->getError()) { // Fatal error $this->setError($error); return false; } else { // Not fatal error $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); continue; } } // Set the new category ID $table->catid = $categoryId; // Check the row. if (!$table->check()) { $this->setError($table->getError()); return false; } // Store the row. if (!$table->store()) { $this->setError($table->getError()); return false; } } // Clean the cache $this->cleanCache(); return true; } protected function batchTag($value, $pks, $contexts) { foreach ($value as $categoryId){ foreach ($pks as $pk) { $query = 'DELETE FROM #__phocagallery_tags_ref' . ' WHERE imgid ='.$pk .' and tagid = '.$categoryId; $this->_db->setQuery( $query ); if(!$this->_db->query()) { $this->setError($this->_db->getErrorMsg()); return false; } $query = 'insert into #__phocagallery_tags_ref(imgid,tagid) values(' . $pk .', '.$categoryId.')'; $this->_db->setQuery( $query ); if(!$this->_db->query()) { $this->setError($this->_db->getErrorMsg()); return false; } } } return true; } public function increaseOrdering($categoryId) { $ordering = 1; $this->_db->setQuery('SELECT MAX(ordering) FROM #__phocagallery WHERE catid='.(int)$categoryId); $max = $this->_db->loadResult(); $ordering = $max + 1; return $ordering; } } ?>
LuxitoHD/mmall-chen
administrator/components/com_phocagallery/models/phocagalleryimg.php
PHP
gpl-2.0
22,198
26.714107
137
0.598748
false
#include "config.h" #include <arki/tests/tests.h> #include <arki/iotrace.h> namespace { using namespace std; using namespace arki; using namespace arki::tests; class Tests : public TestCase { using TestCase::TestCase; void register_tests() override; } test("arki_iotrace"); void Tests::register_tests() { add_method("empty", [] { }); } }
ARPA-SIMC/arkimet
arki/iotrace-test.cc
C++
gpl-2.0
353
13.708333
35
0.688385
false
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>widget-locale - YUI 3</title> <link rel="stylesheet" href="http:&#x2F;&#x2F;yui.yahooapis.com&#x2F;3.5.0pr4&#x2F;build&#x2F;cssgrids&#x2F;cssgrids-min.css"> <link rel="stylesheet" href="..&#x2F;assets/vendor/prettify/prettify-min.css"> <link rel="stylesheet" href="..&#x2F;assets/css/main.css" id="site_styles"> <script src="http:&#x2F;&#x2F;yui.yahooapis.com&#x2F;3.5.0pr4&#x2F;build&#x2F;yui&#x2F;yui-min.js"></script> </head> <body class="yui3-skin-sam"> <div id="doc"> <div id="hd" class="yui3-g header"> <div class="yui3-u-3-4"> <h1><img src="..&#x2F;assets/css/logo.png" title="YUI 3"></h1> </div> <div class="yui3-u-1-4 version"> <em>API Docs for: 3.5.0</em> </div> </div> <div id="bd" class="yui3-g"> <div class="yui3-u-1-4"> <div id="docs-sidebar" class="sidebar apidocs"> <div id="api-list"> <h2 class="off-left">APIs</h2> <div id="api-tabview" class="tabview"> <ul class="tabs"> <li><a href="#api-classes">Classes</a></li> <li><a href="#api-modules">Modules</a></li> </ul> <div id="api-tabview-filter"> <input type="search" id="api-filter" placeholder="Type to filter APIs"> </div> <div id="api-tabview-panel"> <ul id="api-classes" class="apis classes"> <li><a href="..&#x2F;classes/Anim.html">Anim</a></li> <li><a href="..&#x2F;classes/App.html">App</a></li> <li><a href="..&#x2F;classes/App.Base.html">App.Base</a></li> <li><a href="..&#x2F;classes/App.Transitions.html">App.Transitions</a></li> <li><a href="..&#x2F;classes/App.TransitionsNative.html">App.TransitionsNative</a></li> <li><a href="..&#x2F;classes/AreaSeries.html">AreaSeries</a></li> <li><a href="..&#x2F;classes/AreaSplineSeries.html">AreaSplineSeries</a></li> <li><a href="..&#x2F;classes/Array.html">Array</a></li> <li><a href="..&#x2F;classes/ArrayList.html">ArrayList</a></li> <li><a href="..&#x2F;classes/ArraySort.html">ArraySort</a></li> <li><a href="..&#x2F;classes/AsyncQueue.html">AsyncQueue</a></li> <li><a href="..&#x2F;classes/Attribute.html">Attribute</a></li> <li><a href="..&#x2F;classes/AttributeCore.html">AttributeCore</a></li> <li><a href="..&#x2F;classes/AttributeEvents.html">AttributeEvents</a></li> <li><a href="..&#x2F;classes/AttributeExtras.html">AttributeExtras</a></li> <li><a href="..&#x2F;classes/AttributeLite.html">AttributeLite</a></li> <li><a href="..&#x2F;classes/AutoComplete.html">AutoComplete</a></li> <li><a href="..&#x2F;classes/AutoCompleteBase.html">AutoCompleteBase</a></li> <li><a href="..&#x2F;classes/AutoCompleteFilters.html">AutoCompleteFilters</a></li> <li><a href="..&#x2F;classes/AutoCompleteHighlighters.html">AutoCompleteHighlighters</a></li> <li><a href="..&#x2F;classes/AutoCompleteList.html">AutoCompleteList</a></li> <li><a href="..&#x2F;classes/Axis.html">Axis</a></li> <li><a href="..&#x2F;classes/AxisType.html">AxisType</a></li> <li><a href="..&#x2F;classes/BarSeries.html">BarSeries</a></li> <li><a href="..&#x2F;classes/Base.html">Base</a></li> <li><a href="..&#x2F;classes/BaseCore.html">BaseCore</a></li> <li><a href="..&#x2F;classes/BottomAxisLayout.html">BottomAxisLayout</a></li> <li><a href="..&#x2F;classes/Button.html">Button</a></li> <li><a href="..&#x2F;classes/ButtonCore.html">ButtonCore</a></li> <li><a href="..&#x2F;classes/ButtonGroup.html">ButtonGroup</a></li> <li><a href="..&#x2F;classes/ButtonPlugin.html">ButtonPlugin</a></li> <li><a href="..&#x2F;classes/Cache.html">Cache</a></li> <li><a href="..&#x2F;classes/CacheOffline.html">CacheOffline</a></li> <li><a href="..&#x2F;classes/Calendar.html">Calendar</a></li> <li><a href="..&#x2F;classes/CalendarBase.html">CalendarBase</a></li> <li><a href="..&#x2F;classes/CanvasCircle.html">CanvasCircle</a></li> <li><a href="..&#x2F;classes/CanvasDrawing.html">CanvasDrawing</a></li> <li><a href="..&#x2F;classes/CanvasEllipse.html">CanvasEllipse</a></li> <li><a href="..&#x2F;classes/CanvasGraphic.html">CanvasGraphic</a></li> <li><a href="..&#x2F;classes/CanvasPath.html">CanvasPath</a></li> <li><a href="..&#x2F;classes/CanvasPieSlice.html">CanvasPieSlice</a></li> <li><a href="..&#x2F;classes/CanvasRect.html">CanvasRect</a></li> <li><a href="..&#x2F;classes/CanvasShape.html">CanvasShape</a></li> <li><a href="..&#x2F;classes/CartesianChart.html">CartesianChart</a></li> <li><a href="..&#x2F;classes/CartesianSeries.html">CartesianSeries</a></li> <li><a href="..&#x2F;classes/CategoryAxis.html">CategoryAxis</a></li> <li><a href="..&#x2F;classes/Chart.html">Chart</a></li> <li><a href="..&#x2F;classes/ChartBase.html">ChartBase</a></li> <li><a href="..&#x2F;classes/ChartLegend.html">ChartLegend</a></li> <li><a href="..&#x2F;classes/Circle.html">Circle</a></li> <li><a href="..&#x2F;classes/ClassNameManager.html">ClassNameManager</a></li> <li><a href="..&#x2F;classes/ClickableRail.html">ClickableRail</a></li> <li><a href="..&#x2F;classes/ColumnSeries.html">ColumnSeries</a></li> <li><a href="..&#x2F;classes/ComboSeries.html">ComboSeries</a></li> <li><a href="..&#x2F;classes/ComboSplineSeries.html">ComboSplineSeries</a></li> <li><a href="..&#x2F;classes/config.html">config</a></li> <li><a href="..&#x2F;classes/Console.html">Console</a></li> <li><a href="..&#x2F;classes/Controller.html">Controller</a></li> <li><a href="..&#x2F;classes/Cookie.html">Cookie</a></li> <li><a href="..&#x2F;classes/CurveUtil.html">CurveUtil</a></li> <li><a href="..&#x2F;classes/CustomEvent.html">CustomEvent</a></li> <li><a href="..&#x2F;classes/DataSchema.Array.html">DataSchema.Array</a></li> <li><a href="..&#x2F;classes/DataSchema.Base.html">DataSchema.Base</a></li> <li><a href="..&#x2F;classes/DataSchema.JSON.html">DataSchema.JSON</a></li> <li><a href="..&#x2F;classes/DataSchema.Text.html">DataSchema.Text</a></li> <li><a href="..&#x2F;classes/DataSchema.XML.html">DataSchema.XML</a></li> <li><a href="..&#x2F;classes/DataSource.Function.html">DataSource.Function</a></li> <li><a href="..&#x2F;classes/DataSource.Get.html">DataSource.Get</a></li> <li><a href="..&#x2F;classes/DataSource.IO.html">DataSource.IO</a></li> <li><a href="..&#x2F;classes/DataSource.Local.html">DataSource.Local</a></li> <li><a href="..&#x2F;classes/DataSourceArraySchema.html">DataSourceArraySchema</a></li> <li><a href="..&#x2F;classes/DataSourceCache.html">DataSourceCache</a></li> <li><a href="..&#x2F;classes/DataSourceCacheExtension.html">DataSourceCacheExtension</a></li> <li><a href="..&#x2F;classes/DataSourceJSONSchema.html">DataSourceJSONSchema</a></li> <li><a href="..&#x2F;classes/DataSourceTextSchema.html">DataSourceTextSchema</a></li> <li><a href="..&#x2F;classes/DataSourceXMLSchema.html">DataSourceXMLSchema</a></li> <li><a href="..&#x2F;classes/DataTable.html">DataTable</a></li> <li><a href="..&#x2F;classes/DataTable.Base.html">DataTable.Base</a></li> <li><a href="..&#x2F;classes/DataTable.BodyView.html">DataTable.BodyView</a></li> <li><a href="..&#x2F;classes/DataTable.ColumnWidths.html">DataTable.ColumnWidths</a></li> <li><a href="..&#x2F;classes/DataTable.Core.html">DataTable.Core</a></li> <li><a href="..&#x2F;classes/DataTable.HeaderView.html">DataTable.HeaderView</a></li> <li><a href="..&#x2F;classes/DataTable.Message.html">DataTable.Message</a></li> <li><a href="..&#x2F;classes/DataTable.Mutable.html">DataTable.Mutable</a></li> <li><a href="..&#x2F;classes/DataTable.Scrollable.html">DataTable.Scrollable</a></li> <li><a href="..&#x2F;classes/DataTable.Sortable.html">DataTable.Sortable</a></li> <li><a href="..&#x2F;classes/DataType.Date.html">DataType.Date</a></li> <li><a href="..&#x2F;classes/DataType.Date.Locale.html">DataType.Date.Locale</a></li> <li><a href="..&#x2F;classes/DataType.Number.html">DataType.Number</a></li> <li><a href="..&#x2F;classes/DataType.XML.html">DataType.XML</a></li> <li><a href="..&#x2F;classes/DD.DDM.html">DD.DDM</a></li> <li><a href="..&#x2F;classes/DD.Delegate.html">DD.Delegate</a></li> <li><a href="..&#x2F;classes/DD.Drag.html">DD.Drag</a></li> <li><a href="..&#x2F;classes/DD.Drop.html">DD.Drop</a></li> <li><a href="..&#x2F;classes/DD.Plugin.DDWindowScroll.html">DD.Plugin.DDWindowScroll</a></li> <li><a href="..&#x2F;classes/DD.Scroll.html">DD.Scroll</a></li> <li><a href="..&#x2F;classes/Dial.html">Dial</a></li> <li><a href="..&#x2F;classes/Do.html">Do</a></li> <li><a href="..&#x2F;classes/Do.AlterArgs.html">Do.AlterArgs</a></li> <li><a href="..&#x2F;classes/Do.AlterReturn.html">Do.AlterReturn</a></li> <li><a href="..&#x2F;classes/Do.Error.html">Do.Error</a></li> <li><a href="..&#x2F;classes/Do.Halt.html">Do.Halt</a></li> <li><a href="..&#x2F;classes/Do.Method.html">Do.Method</a></li> <li><a href="..&#x2F;classes/Do.Prevent.html">Do.Prevent</a></li> <li><a href="..&#x2F;classes/DOM.html">DOM</a></li> <li><a href="..&#x2F;classes/DOMEventFacade.html">DOMEventFacade</a></li> <li><a href="..&#x2F;classes/Drawing.html">Drawing</a></li> <li><a href="..&#x2F;classes/Easing.html">Easing</a></li> <li><a href="..&#x2F;classes/EditorBase.html">EditorBase</a></li> <li><a href="..&#x2F;classes/EditorSelection.html">EditorSelection</a></li> <li><a href="..&#x2F;classes/Ellipse.html">Ellipse</a></li> <li><a href="..&#x2F;classes/EllipseGroup.html">EllipseGroup</a></li> <li><a href="..&#x2F;classes/Escape.html">Escape</a></li> <li><a href="..&#x2F;classes/Event.html">Event</a></li> <li><a href="..&#x2F;classes/EventFacade.html">EventFacade</a></li> <li><a href="..&#x2F;classes/EventHandle.html">EventHandle</a></li> <li><a href="..&#x2F;classes/EventTarget.html">EventTarget</a></li> <li><a href="..&#x2F;classes/ExecCommand.html">ExecCommand</a></li> <li><a href="..&#x2F;classes/Features.html">Features</a></li> <li><a href="..&#x2F;classes/File.html">File</a></li> <li><a href="..&#x2F;classes/FileFlash.html">FileFlash</a></li> <li><a href="..&#x2F;classes/FileHTML5.html">FileHTML5</a></li> <li><a href="..&#x2F;classes/Fills.html">Fills</a></li> <li><a href="..&#x2F;classes/Frame.html">Frame</a></li> <li><a href="..&#x2F;classes/Get.html">Get</a></li> <li><a href="..&#x2F;classes/Get.Transaction.html">Get.Transaction</a></li> <li><a href="..&#x2F;classes/GetNodeJS.html">GetNodeJS</a></li> <li><a href="..&#x2F;classes/Graph.html">Graph</a></li> <li><a href="..&#x2F;classes/Graphic.html">Graphic</a></li> <li><a href="..&#x2F;classes/GraphicBase.html">GraphicBase</a></li> <li><a href="..&#x2F;classes/Gridlines.html">Gridlines</a></li> <li><a href="..&#x2F;classes/GroupCircle.html">GroupCircle</a></li> <li><a href="..&#x2F;classes/GroupDiamond.html">GroupDiamond</a></li> <li><a href="..&#x2F;classes/GroupRect.html">GroupRect</a></li> <li><a href="..&#x2F;classes/Handlebars.html">Handlebars</a></li> <li><a href="..&#x2F;classes/Highlight.html">Highlight</a></li> <li><a href="..&#x2F;classes/Histogram.html">Histogram</a></li> <li><a href="..&#x2F;classes/HistoryBase.html">HistoryBase</a></li> <li><a href="..&#x2F;classes/HistoryHash.html">HistoryHash</a></li> <li><a href="..&#x2F;classes/HistoryHTML5.html">HistoryHTML5</a></li> <li><a href="..&#x2F;classes/HorizontalLegendLayout.html">HorizontalLegendLayout</a></li> <li><a href="..&#x2F;classes/ImgLoadGroup.html">ImgLoadGroup</a></li> <li><a href="..&#x2F;classes/ImgLoadImgObj.html">ImgLoadImgObj</a></li> <li><a href="..&#x2F;classes/Intl.html">Intl</a></li> <li><a href="..&#x2F;classes/IO.html">IO</a></li> <li><a href="..&#x2F;classes/json.html">json</a></li> <li><a href="..&#x2F;classes/JSONPRequest.html">JSONPRequest</a></li> <li><a href="..&#x2F;classes/Lang.html">Lang</a></li> <li><a href="..&#x2F;classes/LeftAxisLayout.html">LeftAxisLayout</a></li> <li><a href="..&#x2F;classes/Lines.html">Lines</a></li> <li><a href="..&#x2F;classes/LineSeries.html">LineSeries</a></li> <li><a href="..&#x2F;classes/Loader.html">Loader</a></li> <li><a href="..&#x2F;classes/MarkerSeries.html">MarkerSeries</a></li> <li><a href="..&#x2F;classes/Matrix.html">Matrix</a></li> <li><a href="..&#x2F;classes/Model.html">Model</a></li> <li><a href="..&#x2F;classes/ModelList.html">ModelList</a></li> <li><a href="..&#x2F;classes/Node.html">Node</a></li> <li><a href="..&#x2F;classes/NodeList.html">NodeList</a></li> <li><a href="..&#x2F;classes/NumericAxis.html">NumericAxis</a></li> <li><a href="..&#x2F;classes/Object.html">Object</a></li> <li><a href="..&#x2F;classes/Overlay.html">Overlay</a></li> <li><a href="..&#x2F;classes/Panel.html">Panel</a></li> <li><a href="..&#x2F;classes/Parallel.html">Parallel</a></li> <li><a href="..&#x2F;classes/Path.html">Path</a></li> <li><a href="..&#x2F;classes/PieChart.html">PieChart</a></li> <li><a href="..&#x2F;classes/PieSeries.html">PieSeries</a></li> <li><a href="..&#x2F;classes/Pjax.html">Pjax</a></li> <li><a href="..&#x2F;classes/PjaxBase.html">PjaxBase</a></li> <li><a href="..&#x2F;classes/Plots.html">Plots</a></li> <li><a href="..&#x2F;classes/Plugin.Align.html">Plugin.Align</a></li> <li><a href="..&#x2F;classes/Plugin.AutoComplete.html">Plugin.AutoComplete</a></li> <li><a href="..&#x2F;classes/Plugin.Base.html">Plugin.Base</a></li> <li><a href="..&#x2F;classes/Plugin.Cache.html">Plugin.Cache</a></li> <li><a href="..&#x2F;classes/Plugin.CalendarNavigator.html">Plugin.CalendarNavigator</a></li> <li><a href="..&#x2F;classes/Plugin.ConsoleFilters.html">Plugin.ConsoleFilters</a></li> <li><a href="..&#x2F;classes/Plugin.CreateLinkBase.html">Plugin.CreateLinkBase</a></li> <li><a href="..&#x2F;classes/Plugin.DataTableDataSource.html">Plugin.DataTableDataSource</a></li> <li><a href="..&#x2F;classes/Plugin.DDConstrained.html">Plugin.DDConstrained</a></li> <li><a href="..&#x2F;classes/Plugin.DDNodeScroll.html">Plugin.DDNodeScroll</a></li> <li><a href="..&#x2F;classes/Plugin.DDProxy.html">Plugin.DDProxy</a></li> <li><a href="..&#x2F;classes/Plugin.Drag.html">Plugin.Drag</a></li> <li><a href="..&#x2F;classes/Plugin.Drop.html">Plugin.Drop</a></li> <li><a href="..&#x2F;classes/Plugin.EditorBidi.html">Plugin.EditorBidi</a></li> <li><a href="..&#x2F;classes/Plugin.EditorBR.html">Plugin.EditorBR</a></li> <li><a href="..&#x2F;classes/Plugin.EditorLists.html">Plugin.EditorLists</a></li> <li><a href="..&#x2F;classes/Plugin.EditorPara.html">Plugin.EditorPara</a></li> <li><a href="..&#x2F;classes/Plugin.EditorParaBase.html">Plugin.EditorParaBase</a></li> <li><a href="..&#x2F;classes/Plugin.EditorParaIE.html">Plugin.EditorParaIE</a></li> <li><a href="..&#x2F;classes/Plugin.EditorTab.html">Plugin.EditorTab</a></li> <li><a href="..&#x2F;classes/Plugin.ExecCommand.html">Plugin.ExecCommand</a></li> <li><a href="..&#x2F;classes/Plugin.Flick.html">Plugin.Flick</a></li> <li><a href="..&#x2F;classes/Plugin.Host.html">Plugin.Host</a></li> <li><a href="..&#x2F;classes/plugin.NodeFocusManager.html">plugin.NodeFocusManager</a></li> <li><a href="..&#x2F;classes/Plugin.NodeFX.html">Plugin.NodeFX</a></li> <li><a href="..&#x2F;classes/plugin.NodeMenuNav.html">plugin.NodeMenuNav</a></li> <li><a href="..&#x2F;classes/Plugin.Pjax.html">Plugin.Pjax</a></li> <li><a href="..&#x2F;classes/Plugin.Resize.html">Plugin.Resize</a></li> <li><a href="..&#x2F;classes/Plugin.ResizeConstrained.html">Plugin.ResizeConstrained</a></li> <li><a href="..&#x2F;classes/Plugin.ResizeProxy.html">Plugin.ResizeProxy</a></li> <li><a href="..&#x2F;classes/Plugin.ScrollViewList.html">Plugin.ScrollViewList</a></li> <li><a href="..&#x2F;classes/Plugin.ScrollViewPaginator.html">Plugin.ScrollViewPaginator</a></li> <li><a href="..&#x2F;classes/Plugin.ScrollViewScrollbars.html">Plugin.ScrollViewScrollbars</a></li> <li><a href="..&#x2F;classes/Plugin.Shim.html">Plugin.Shim</a></li> <li><a href="..&#x2F;classes/Plugin.SortScroll.html">Plugin.SortScroll</a></li> <li><a href="..&#x2F;classes/Plugin.WidgetAnim.html">Plugin.WidgetAnim</a></li> <li><a href="..&#x2F;classes/Pollable.html">Pollable</a></li> <li><a href="..&#x2F;classes/Profiler.html">Profiler</a></li> <li><a href="..&#x2F;classes/QueryString.html">QueryString</a></li> <li><a href="..&#x2F;classes/Queue.html">Queue</a></li> <li><a href="..&#x2F;classes/Record.html">Record</a></li> <li><a href="..&#x2F;classes/Recordset.html">Recordset</a></li> <li><a href="..&#x2F;classes/RecordsetFilter.html">RecordsetFilter</a></li> <li><a href="..&#x2F;classes/RecordsetIndexer.html">RecordsetIndexer</a></li> <li><a href="..&#x2F;classes/RecordsetSort.html">RecordsetSort</a></li> <li><a href="..&#x2F;classes/Rect.html">Rect</a></li> <li><a href="..&#x2F;classes/Renderer.html">Renderer</a></li> <li><a href="..&#x2F;classes/Resize.html">Resize</a></li> <li><a href="..&#x2F;classes/RightAxisLayout.html">RightAxisLayout</a></li> <li><a href="..&#x2F;classes/Router.html">Router</a></li> <li><a href="..&#x2F;classes/ScrollView.html">ScrollView</a></li> <li><a href="..&#x2F;classes/Selector.html">Selector</a></li> <li><a href="..&#x2F;classes/Shape.html">Shape</a></li> <li><a href="..&#x2F;classes/ShapeGroup.html">ShapeGroup</a></li> <li><a href="..&#x2F;classes/Slider.html">Slider</a></li> <li><a href="..&#x2F;classes/SliderBase.html">SliderBase</a></li> <li><a href="..&#x2F;classes/SliderValueRange.html">SliderValueRange</a></li> <li><a href="..&#x2F;classes/Sortable.html">Sortable</a></li> <li><a href="..&#x2F;classes/SplineSeries.html">SplineSeries</a></li> <li><a href="..&#x2F;classes/StackedAreaSeries.html">StackedAreaSeries</a></li> <li><a href="..&#x2F;classes/StackedAreaSplineSeries.html">StackedAreaSplineSeries</a></li> <li><a href="..&#x2F;classes/StackedAxis.html">StackedAxis</a></li> <li><a href="..&#x2F;classes/StackedBarSeries.html">StackedBarSeries</a></li> <li><a href="..&#x2F;classes/StackedColumnSeries.html">StackedColumnSeries</a></li> <li><a href="..&#x2F;classes/StackedComboSeries.html">StackedComboSeries</a></li> <li><a href="..&#x2F;classes/StackedComboSplineSeries.html">StackedComboSplineSeries</a></li> <li><a href="..&#x2F;classes/StackedLineSeries.html">StackedLineSeries</a></li> <li><a href="..&#x2F;classes/StackedMarkerSeries.html">StackedMarkerSeries</a></li> <li><a href="..&#x2F;classes/StackedSplineSeries.html">StackedSplineSeries</a></li> <li><a href="..&#x2F;classes/StackingUtil.html">StackingUtil</a></li> <li><a href="..&#x2F;classes/State.html">State</a></li> <li><a href="..&#x2F;classes/StyleSheet.html">StyleSheet</a></li> <li><a href="..&#x2F;classes/Subscriber.html">Subscriber</a></li> <li><a href="..&#x2F;classes/SVGCircle.html">SVGCircle</a></li> <li><a href="..&#x2F;classes/SVGDrawing.html">SVGDrawing</a></li> <li><a href="..&#x2F;classes/SVGEllipse.html">SVGEllipse</a></li> <li><a href="..&#x2F;classes/SVGGraphic.html">SVGGraphic</a></li> <li><a href="..&#x2F;classes/SVGPath.html">SVGPath</a></li> <li><a href="..&#x2F;classes/SVGPieSlice.html">SVGPieSlice</a></li> <li><a href="..&#x2F;classes/SVGRect.html">SVGRect</a></li> <li><a href="..&#x2F;classes/SVGShape.html">SVGShape</a></li> <li><a href="..&#x2F;classes/SWF.html">SWF</a></li> <li><a href="..&#x2F;classes/SWFDetect.html">SWFDetect</a></li> <li><a href="..&#x2F;classes/SyntheticEvent.html">SyntheticEvent</a></li> <li><a href="..&#x2F;classes/SyntheticEvent.Notifier.html">SyntheticEvent.Notifier</a></li> <li><a href="..&#x2F;classes/SynthRegistry.html">SynthRegistry</a></li> <li><a href="..&#x2F;classes/Tab.html">Tab</a></li> <li><a href="..&#x2F;classes/TabView.html">TabView</a></li> <li><a href="..&#x2F;classes/Test.html">Test</a></li> <li><a href="..&#x2F;classes/Test.ArrayAssert.html">Test.ArrayAssert</a></li> <li><a href="..&#x2F;classes/Test.Assert.html">Test.Assert</a></li> <li><a href="..&#x2F;classes/Test.AssertionError.html">Test.AssertionError</a></li> <li><a href="..&#x2F;classes/Test.ComparisonFailure.html">Test.ComparisonFailure</a></li> <li><a href="..&#x2F;classes/Test.Console.html">Test.Console</a></li> <li><a href="..&#x2F;classes/Test.CoverageFormat.CoverageFormat.html">Test.CoverageFormat.CoverageFormat</a></li> <li><a href="..&#x2F;classes/Test.DateAssert.html">Test.DateAssert</a></li> <li><a href="..&#x2F;classes/Test.EventTarget.html">Test.EventTarget</a></li> <li><a href="..&#x2F;classes/Test.Mock.Mock.html">Test.Mock.Mock</a></li> <li><a href="..&#x2F;classes/Test.Mock.Value.html">Test.Mock.Value</a></li> <li><a href="..&#x2F;classes/Test.ObjectAssert.html">Test.ObjectAssert</a></li> <li><a href="..&#x2F;classes/Test.Reporter.html">Test.Reporter</a></li> <li><a href="..&#x2F;classes/Test.Results.html">Test.Results</a></li> <li><a href="..&#x2F;classes/Test.Runner.html">Test.Runner</a></li> <li><a href="..&#x2F;classes/Test.ShouldError.html">Test.ShouldError</a></li> <li><a href="..&#x2F;classes/Test.ShouldFail.html">Test.ShouldFail</a></li> <li><a href="..&#x2F;classes/Test.TestCase.html">Test.TestCase</a></li> <li><a href="..&#x2F;classes/Test.TestFormat.html">Test.TestFormat</a></li> <li><a href="..&#x2F;classes/Test.TestNode.html">Test.TestNode</a></li> <li><a href="..&#x2F;classes/Test.TestRunner.html">Test.TestRunner</a></li> <li><a href="..&#x2F;classes/Test.TestSuite.html">Test.TestSuite</a></li> <li><a href="..&#x2F;classes/Test.UnexpectedError.html">Test.UnexpectedError</a></li> <li><a href="..&#x2F;classes/Test.UnexpectedValue.html">Test.UnexpectedValue</a></li> <li><a href="..&#x2F;classes/Test.Wait.html">Test.Wait</a></li> <li><a href="..&#x2F;classes/Text.AccentFold.html">Text.AccentFold</a></li> <li><a href="..&#x2F;classes/Text.WordBreak.html">Text.WordBreak</a></li> <li><a href="..&#x2F;classes/TimeAxis.html">TimeAxis</a></li> <li><a href="..&#x2F;classes/ToggleButton.html">ToggleButton</a></li> <li><a href="..&#x2F;classes/TopAxisLayout.html">TopAxisLayout</a></li> <li><a href="..&#x2F;classes/Transition.html">Transition</a></li> <li><a href="..&#x2F;classes/UA.html">UA</a></li> <li><a href="..&#x2F;classes/Uploader.html">Uploader</a></li> <li><a href="..&#x2F;classes/Uploader.Queue.html">Uploader.Queue</a></li> <li><a href="..&#x2F;classes/UploaderFlash.html">UploaderFlash</a></li> <li><a href="..&#x2F;classes/UploaderHTML5.html">UploaderHTML5</a></li> <li><a href="..&#x2F;classes/ValueChange.html">ValueChange</a></li> <li><a href="..&#x2F;classes/VerticalLegendLayout.html">VerticalLegendLayout</a></li> <li><a href="..&#x2F;classes/View.html">View</a></li> <li><a href="..&#x2F;classes/View.NodeMap.html">View.NodeMap</a></li> <li><a href="..&#x2F;classes/VMLCircle.html">VMLCircle</a></li> <li><a href="..&#x2F;classes/VMLDrawing.html">VMLDrawing</a></li> <li><a href="..&#x2F;classes/VMLEllipse.html">VMLEllipse</a></li> <li><a href="..&#x2F;classes/VMLGraphic.html">VMLGraphic</a></li> <li><a href="..&#x2F;classes/VMLPath.html">VMLPath</a></li> <li><a href="..&#x2F;classes/VMLPieSlice.html">VMLPieSlice</a></li> <li><a href="..&#x2F;classes/VMLRect.html">VMLRect</a></li> <li><a href="..&#x2F;classes/VMLShape.html">VMLShape</a></li> <li><a href="..&#x2F;classes/Widget.html">Widget</a></li> <li><a href="..&#x2F;classes/WidgetAutohide.html">WidgetAutohide</a></li> <li><a href="..&#x2F;classes/WidgetButtons.html">WidgetButtons</a></li> <li><a href="..&#x2F;classes/WidgetChild.html">WidgetChild</a></li> <li><a href="..&#x2F;classes/WidgetModality.html">WidgetModality</a></li> <li><a href="..&#x2F;classes/WidgetParent.html">WidgetParent</a></li> <li><a href="..&#x2F;classes/WidgetPosition.html">WidgetPosition</a></li> <li><a href="..&#x2F;classes/WidgetPositionAlign.html">WidgetPositionAlign</a></li> <li><a href="..&#x2F;classes/WidgetPositionConstrain.html">WidgetPositionConstrain</a></li> <li><a href="..&#x2F;classes/WidgetStack.html">WidgetStack</a></li> <li><a href="..&#x2F;classes/WidgetStdMod.html">WidgetStdMod</a></li> <li><a href="..&#x2F;classes/YQL.html">YQL</a></li> <li><a href="..&#x2F;classes/YQLRequest.html">YQLRequest</a></li> <li><a href="..&#x2F;classes/YUI.html">YUI</a></li> <li><a href="..&#x2F;classes/YUI~substitute.html">YUI~substitute</a></li> </ul> <ul id="api-modules" class="apis modules"> <li><a href="..&#x2F;modules/align-plugin.html">align-plugin</a></li> <li><a href="..&#x2F;modules/anim.html">anim</a></li> <li><a href="..&#x2F;modules/anim-base.html">anim-base</a></li> <li><a href="..&#x2F;modules/anim-color.html">anim-color</a></li> <li><a href="..&#x2F;modules/anim-curve.html">anim-curve</a></li> <li><a href="..&#x2F;modules/anim-easing.html">anim-easing</a></li> <li><a href="..&#x2F;modules/anim-node-plugin.html">anim-node-plugin</a></li> <li><a href="..&#x2F;modules/anim-scroll.html">anim-scroll</a></li> <li><a href="..&#x2F;modules/anim-xy.html">anim-xy</a></li> <li><a href="..&#x2F;modules/app.html">app</a></li> <li><a href="..&#x2F;modules/app-base.html">app-base</a></li> <li><a href="..&#x2F;modules/app-transitions.html">app-transitions</a></li> <li><a href="..&#x2F;modules/app-transitions-native.html">app-transitions-native</a></li> <li><a href="..&#x2F;modules/array-extras.html">array-extras</a></li> <li><a href="..&#x2F;modules/array-invoke.html">array-invoke</a></li> <li><a href="..&#x2F;modules/arraylist.html">arraylist</a></li> <li><a href="..&#x2F;modules/arraylist-add.html">arraylist-add</a></li> <li><a href="..&#x2F;modules/arraylist-filter.html">arraylist-filter</a></li> <li><a href="..&#x2F;modules/arraysort.html">arraysort</a></li> <li><a href="..&#x2F;modules/async-queue.html">async-queue</a></li> <li><a href="..&#x2F;modules/attribute.html">attribute</a></li> <li><a href="..&#x2F;modules/attribute-base.html">attribute-base</a></li> <li><a href="..&#x2F;modules/attribute-complex.html">attribute-complex</a></li> <li><a href="..&#x2F;modules/attribute-core.html">attribute-core</a></li> <li><a href="..&#x2F;modules/attribute-events.html">attribute-events</a></li> <li><a href="..&#x2F;modules/attribute-extras.html">attribute-extras</a></li> <li><a href="..&#x2F;modules/autocomplete.html">autocomplete</a></li> <li><a href="..&#x2F;modules/autocomplete-base.html">autocomplete-base</a></li> <li><a href="..&#x2F;modules/autocomplete-filters.html">autocomplete-filters</a></li> <li><a href="..&#x2F;modules/autocomplete-filters-accentfold.html">autocomplete-filters-accentfold</a></li> <li><a href="..&#x2F;modules/autocomplete-highlighters.html">autocomplete-highlighters</a></li> <li><a href="..&#x2F;modules/autocomplete-highlighters-accentfold.html">autocomplete-highlighters-accentfold</a></li> <li><a href="..&#x2F;modules/autocomplete-list.html">autocomplete-list</a></li> <li><a href="..&#x2F;modules/autocomplete-list-keys.html">autocomplete-list-keys</a></li> <li><a href="..&#x2F;modules/autocomplete-plugin.html">autocomplete-plugin</a></li> <li><a href="..&#x2F;modules/autocomplete-sources.html">autocomplete-sources</a></li> <li><a href="..&#x2F;modules/base.html">base</a></li> <li><a href="..&#x2F;modules/base-base.html">base-base</a></li> <li><a href="..&#x2F;modules/base-build.html">base-build</a></li> <li><a href="..&#x2F;modules/base-core.html">base-core</a></li> <li><a href="..&#x2F;modules/base-pluginhost.html">base-pluginhost</a></li> <li><a href="..&#x2F;modules/button.html">button</a></li> <li><a href="..&#x2F;modules/button-core.html">button-core</a></li> <li><a href="..&#x2F;modules/button-group.html">button-group</a></li> <li><a href="..&#x2F;modules/button-plugin.html">button-plugin</a></li> <li><a href="..&#x2F;modules/cache.html">cache</a></li> <li><a href="..&#x2F;modules/cache-base.html">cache-base</a></li> <li><a href="..&#x2F;modules/cache-offline.html">cache-offline</a></li> <li><a href="..&#x2F;modules/cache-plugin.html">cache-plugin</a></li> <li><a href="..&#x2F;modules/calendar.html">calendar</a></li> <li><a href="..&#x2F;modules/calendar-base.html">calendar-base</a></li> <li><a href="..&#x2F;modules/calendarnavigator.html">calendarnavigator</a></li> <li><a href="..&#x2F;modules/charts.html">charts</a></li> <li><a href="..&#x2F;modules/charts-legend.html">charts-legend</a></li> <li><a href="..&#x2F;modules/classnamemanager.html">classnamemanager</a></li> <li><a href="..&#x2F;modules/clickable-rail.html">clickable-rail</a></li> <li><a href="..&#x2F;modules/collection.html">collection</a></li> <li><a href="..&#x2F;modules/console.html">console</a></li> <li><a href="..&#x2F;modules/console-filters.html">console-filters</a></li> <li><a href="..&#x2F;modules/cookie.html">cookie</a></li> <li><a href="..&#x2F;modules/createlink-base.html">createlink-base</a></li> <li><a href="..&#x2F;modules/dataschema.html">dataschema</a></li> <li><a href="..&#x2F;modules/dataschema-array.html">dataschema-array</a></li> <li><a href="..&#x2F;modules/dataschema-base.html">dataschema-base</a></li> <li><a href="..&#x2F;modules/dataschema-json.html">dataschema-json</a></li> <li><a href="..&#x2F;modules/dataschema-text.html">dataschema-text</a></li> <li><a href="..&#x2F;modules/dataschema-xml.html">dataschema-xml</a></li> <li><a href="..&#x2F;modules/datasource.html">datasource</a></li> <li><a href="..&#x2F;modules/datasource-arrayschema.html">datasource-arrayschema</a></li> <li><a href="..&#x2F;modules/datasource-cache.html">datasource-cache</a></li> <li><a href="..&#x2F;modules/datasource-function.html">datasource-function</a></li> <li><a href="..&#x2F;modules/datasource-get.html">datasource-get</a></li> <li><a href="..&#x2F;modules/datasource-io.html">datasource-io</a></li> <li><a href="..&#x2F;modules/datasource-jsonschema.html">datasource-jsonschema</a></li> <li><a href="..&#x2F;modules/datasource-local.html">datasource-local</a></li> <li><a href="..&#x2F;modules/datasource-polling.html">datasource-polling</a></li> <li><a href="..&#x2F;modules/datasource-textschema.html">datasource-textschema</a></li> <li><a href="..&#x2F;modules/datasource-xmlschema.html">datasource-xmlschema</a></li> <li><a href="..&#x2F;modules/datatable.html">datatable</a></li> <li><a href="..&#x2F;modules/datatable-base.html">datatable-base</a></li> <li><a href="..&#x2F;modules/datatable-base-deprecated.html">datatable-base-deprecated</a></li> <li><a href="..&#x2F;modules/datatable-body.html">datatable-body</a></li> <li><a href="..&#x2F;modules/datatable-column-widths.html">datatable-column-widths</a></li> <li><a href="..&#x2F;modules/datatable-core.html">datatable-core</a></li> <li><a href="..&#x2F;modules/datatable-datasource.html">datatable-datasource</a></li> <li><a href="..&#x2F;modules/datatable-datasource-deprecated.html">datatable-datasource-deprecated</a></li> <li><a href="..&#x2F;modules/datatable-deprecated.html">datatable-deprecated</a></li> <li><a href="..&#x2F;modules/datatable-head.html">datatable-head</a></li> <li><a href="..&#x2F;modules/datatable-message.html">datatable-message</a></li> <li><a href="..&#x2F;modules/datatable-mutable.html">datatable-mutable</a></li> <li><a href="..&#x2F;modules/datatable-scroll.html">datatable-scroll</a></li> <li><a href="..&#x2F;modules/datatable-scroll-deprecated.html">datatable-scroll-deprecated</a></li> <li><a href="..&#x2F;modules/datatable-sort.html">datatable-sort</a></li> <li><a href="..&#x2F;modules/datatable-sort-deprecated.html">datatable-sort-deprecated</a></li> <li><a href="..&#x2F;modules/datatype.html">datatype</a></li> <li><a href="..&#x2F;modules/datatype-date.html">datatype-date</a></li> <li><a href="..&#x2F;modules/datatype-date-format.html">datatype-date-format</a></li> <li><a href="..&#x2F;modules/datatype-date-math.html">datatype-date-math</a></li> <li><a href="..&#x2F;modules/datatype-date-parse.html">datatype-date-parse</a></li> <li><a href="..&#x2F;modules/datatype-number.html">datatype-number</a></li> <li><a href="..&#x2F;modules/datatype-number-format.html">datatype-number-format</a></li> <li><a href="..&#x2F;modules/datatype-number-parse.html">datatype-number-parse</a></li> <li><a href="..&#x2F;modules/datatype-xml.html">datatype-xml</a></li> <li><a href="..&#x2F;modules/datatype-xml-format.html">datatype-xml-format</a></li> <li><a href="..&#x2F;modules/datatype-xml-parse.html">datatype-xml-parse</a></li> <li><a href="..&#x2F;modules/dd.html">dd</a></li> <li><a href="..&#x2F;modules/dd-constrain.html">dd-constrain</a></li> <li><a href="..&#x2F;modules/dd-ddm.html">dd-ddm</a></li> <li><a href="..&#x2F;modules/dd-ddm-base.html">dd-ddm-base</a></li> <li><a href="..&#x2F;modules/dd-ddm-drop.html">dd-ddm-drop</a></li> <li><a href="..&#x2F;modules/dd-delegate.html">dd-delegate</a></li> <li><a href="..&#x2F;modules/dd-drag.html">dd-drag</a></li> <li><a href="..&#x2F;modules/dd-drop.html">dd-drop</a></li> <li><a href="..&#x2F;modules/dd-drop-plugin.html">dd-drop-plugin</a></li> <li><a href="..&#x2F;modules/dd-plugin.html">dd-plugin</a></li> <li><a href="..&#x2F;modules/dd-proxy.html">dd-proxy</a></li> <li><a href="..&#x2F;modules/dd-scroll.html">dd-scroll</a></li> <li><a href="..&#x2F;modules/dial.html">dial</a></li> <li><a href="..&#x2F;modules/dom.html">dom</a></li> <li><a href="..&#x2F;modules/dom-base.html">dom-base</a></li> <li><a href="..&#x2F;modules/dom-screen.html">dom-screen</a></li> <li><a href="..&#x2F;modules/dom-style.html">dom-style</a></li> <li><a href="..&#x2F;modules/dump.html">dump</a></li> <li><a href="..&#x2F;modules/editor.html">editor</a></li> <li><a href="..&#x2F;modules/editor-base.html">editor-base</a></li> <li><a href="..&#x2F;modules/editor-bidi.html">editor-bidi</a></li> <li><a href="..&#x2F;modules/editor-br.html">editor-br</a></li> <li><a href="..&#x2F;modules/editor-lists.html">editor-lists</a></li> <li><a href="..&#x2F;modules/editor-para.html">editor-para</a></li> <li><a href="..&#x2F;modules/editor-para-base.html">editor-para-base</a></li> <li><a href="..&#x2F;modules/editor-para-ie.html">editor-para-ie</a></li> <li><a href="..&#x2F;modules/editor-tab.html">editor-tab</a></li> <li><a href="..&#x2F;modules/escape.html">escape</a></li> <li><a href="..&#x2F;modules/event.html">event</a></li> <li><a href="..&#x2F;modules/event-base.html">event-base</a></li> <li><a href="..&#x2F;modules/event-contextmenu.html">event-contextmenu</a></li> <li><a href="..&#x2F;modules/event-custom.html">event-custom</a></li> <li><a href="..&#x2F;modules/event-custom-base.html">event-custom-base</a></li> <li><a href="..&#x2F;modules/event-custom-complex.html">event-custom-complex</a></li> <li><a href="..&#x2F;modules/event-delegate.html">event-delegate</a></li> <li><a href="..&#x2F;modules/event-flick.html">event-flick</a></li> <li><a href="..&#x2F;modules/event-focus.html">event-focus</a></li> <li><a href="..&#x2F;modules/event-gestures.html">event-gestures</a></li> <li><a href="..&#x2F;modules/event-hover.html">event-hover</a></li> <li><a href="..&#x2F;modules/event-key.html">event-key</a></li> <li><a href="..&#x2F;modules/event-mouseenter.html">event-mouseenter</a></li> <li><a href="..&#x2F;modules/event-mousewheel.html">event-mousewheel</a></li> <li><a href="..&#x2F;modules/event-move.html">event-move</a></li> <li><a href="..&#x2F;modules/event-outside.html">event-outside</a></li> <li><a href="..&#x2F;modules/event-resize.html">event-resize</a></li> <li><a href="..&#x2F;modules/event-simulate.html">event-simulate</a></li> <li><a href="..&#x2F;modules/event-synthetic.html">event-synthetic</a></li> <li><a href="..&#x2F;modules/event-touch.html">event-touch</a></li> <li><a href="..&#x2F;modules/event-valuechange.html">event-valuechange</a></li> <li><a href="..&#x2F;modules/exec-command.html">exec-command</a></li> <li><a href="..&#x2F;modules/features.html">features</a></li> <li><a href="..&#x2F;modules/file.html">file</a></li> <li><a href="..&#x2F;modules/file-flash.html">file-flash</a></li> <li><a href="..&#x2F;modules/file-html5.html">file-html5</a></li> <li><a href="..&#x2F;modules/frame.html">frame</a></li> <li><a href="..&#x2F;modules/get.html">get</a></li> <li><a href="..&#x2F;modules/get-nodejs.html">get-nodejs</a></li> <li><a href="..&#x2F;modules/graphics.html">graphics</a></li> <li><a href="..&#x2F;modules/handlebars.html">handlebars</a></li> <li><a href="..&#x2F;modules/handlebars-base.html">handlebars-base</a></li> <li><a href="..&#x2F;modules/handlebars-compiler.html">handlebars-compiler</a></li> <li><a href="..&#x2F;modules/highlight.html">highlight</a></li> <li><a href="..&#x2F;modules/highlight-accentfold.html">highlight-accentfold</a></li> <li><a href="..&#x2F;modules/highlight-base.html">highlight-base</a></li> <li><a href="..&#x2F;modules/history.html">history</a></li> <li><a href="..&#x2F;modules/history-base.html">history-base</a></li> <li><a href="..&#x2F;modules/history-hash.html">history-hash</a></li> <li><a href="..&#x2F;modules/history-hash-ie.html">history-hash-ie</a></li> <li><a href="..&#x2F;modules/history-html5.html">history-html5</a></li> <li><a href="..&#x2F;modules/imageloader.html">imageloader</a></li> <li><a href="..&#x2F;modules/intl.html">intl</a></li> <li><a href="..&#x2F;modules/io.html">io</a></li> <li><a href="..&#x2F;modules/io-base.html">io-base</a></li> <li><a href="..&#x2F;modules/io-form.html">io-form</a></li> <li><a href="..&#x2F;modules/io-queue.html">io-queue</a></li> <li><a href="..&#x2F;modules/io-upload-iframe.html">io-upload-iframe</a></li> <li><a href="..&#x2F;modules/io-xdr.html">io-xdr</a></li> <li><a href="..&#x2F;modules/json.html">json</a></li> <li><a href="..&#x2F;modules/json-parse.html">json-parse</a></li> <li><a href="..&#x2F;modules/json-stringify.html">json-stringify</a></li> <li><a href="..&#x2F;modules/jsonp.html">jsonp</a></li> <li><a href="..&#x2F;modules/jsonp-url.html">jsonp-url</a></li> <li><a href="..&#x2F;modules/loader.html">loader</a></li> <li><a href="..&#x2F;modules/loader-base.html">loader-base</a></li> <li><a href="..&#x2F;modules/matrix.html">matrix</a></li> <li><a href="..&#x2F;modules/model.html">model</a></li> <li><a href="..&#x2F;modules/model-list.html">model-list</a></li> <li><a href="..&#x2F;modules/node.html">node</a></li> <li><a href="..&#x2F;modules/node-base.html">node-base</a></li> <li><a href="..&#x2F;modules/node-core.html">node-core</a></li> <li><a href="..&#x2F;modules/node-data.html">node-data</a></li> <li><a href="..&#x2F;modules/node-deprecated.html">node-deprecated</a></li> <li><a href="..&#x2F;modules/node-event-delegate.html">node-event-delegate</a></li> <li><a href="..&#x2F;modules/node-event-html5.html">node-event-html5</a></li> <li><a href="..&#x2F;modules/node-event-simulate.html">node-event-simulate</a></li> <li><a href="..&#x2F;modules/node-flick.html">node-flick</a></li> <li><a href="..&#x2F;modules/node-focusmanager.html">node-focusmanager</a></li> <li><a href="..&#x2F;modules/node-load.html">node-load</a></li> <li><a href="..&#x2F;modules/node-menunav.html">node-menunav</a></li> <li><a href="..&#x2F;modules/node-pluginhost.html">node-pluginhost</a></li> <li><a href="..&#x2F;modules/node-screen.html">node-screen</a></li> <li><a href="..&#x2F;modules/node-style.html">node-style</a></li> <li><a href="..&#x2F;modules/oop.html">oop</a></li> <li><a href="..&#x2F;modules/overlay.html">overlay</a></li> <li><a href="..&#x2F;modules/panel.html">panel</a></li> <li><a href="..&#x2F;modules/parallel.html">parallel</a></li> <li><a href="..&#x2F;modules/pjax.html">pjax</a></li> <li><a href="..&#x2F;modules/pjax-base.html">pjax-base</a></li> <li><a href="..&#x2F;modules/pjax-plugin.html">pjax-plugin</a></li> <li><a href="..&#x2F;modules/plugin.html">plugin</a></li> <li><a href="..&#x2F;modules/pluginhost.html">pluginhost</a></li> <li><a href="..&#x2F;modules/pluginhost-base.html">pluginhost-base</a></li> <li><a href="..&#x2F;modules/pluginhost-config.html">pluginhost-config</a></li> <li><a href="..&#x2F;modules/profiler.html">profiler</a></li> <li><a href="..&#x2F;modules/querystring.html">querystring</a></li> <li><a href="..&#x2F;modules/querystring-parse.html">querystring-parse</a></li> <li><a href="..&#x2F;modules/querystring-parse-simple.html">querystring-parse-simple</a></li> <li><a href="..&#x2F;modules/querystring-stringify.html">querystring-stringify</a></li> <li><a href="..&#x2F;modules/querystring-stringify-simple.html">querystring-stringify-simple</a></li> <li><a href="..&#x2F;modules/queue-promote.html">queue-promote</a></li> <li><a href="..&#x2F;modules/range-slider.html">range-slider</a></li> <li><a href="..&#x2F;modules/recordset.html">recordset</a></li> <li><a href="..&#x2F;modules/recordset-base.html">recordset-base</a></li> <li><a href="..&#x2F;modules/recordset-filter.html">recordset-filter</a></li> <li><a href="..&#x2F;modules/recordset-indexer.html">recordset-indexer</a></li> <li><a href="..&#x2F;modules/recordset-sort.html">recordset-sort</a></li> <li><a href="..&#x2F;modules/resize.html">resize</a></li> <li><a href="..&#x2F;modules/resize-contrain.html">resize-contrain</a></li> <li><a href="..&#x2F;modules/resize-plugin.html">resize-plugin</a></li> <li><a href="..&#x2F;modules/resize-proxy.html">resize-proxy</a></li> <li><a href="..&#x2F;modules/rollup.html">rollup</a></li> <li><a href="..&#x2F;modules/router.html">router</a></li> <li><a href="..&#x2F;modules/scrollview.html">scrollview</a></li> <li><a href="..&#x2F;modules/scrollview-base.html">scrollview-base</a></li> <li><a href="..&#x2F;modules/scrollview-base-ie.html">scrollview-base-ie</a></li> <li><a href="..&#x2F;modules/scrollview-list.html">scrollview-list</a></li> <li><a href="..&#x2F;modules/scrollview-paginator.html">scrollview-paginator</a></li> <li><a href="..&#x2F;modules/scrollview-scrollbars.html">scrollview-scrollbars</a></li> <li><a href="..&#x2F;modules/selection.html">selection</a></li> <li><a href="..&#x2F;modules/selector-css2.html">selector-css2</a></li> <li><a href="..&#x2F;modules/selector-css3.html">selector-css3</a></li> <li><a href="..&#x2F;modules/selector-native.html">selector-native</a></li> <li><a href="..&#x2F;modules/shim-plugin.html">shim-plugin</a></li> <li><a href="..&#x2F;modules/slider.html">slider</a></li> <li><a href="..&#x2F;modules/slider-base.html">slider-base</a></li> <li><a href="..&#x2F;modules/slider-value-range.html">slider-value-range</a></li> <li><a href="..&#x2F;modules/sortable.html">sortable</a></li> <li><a href="..&#x2F;modules/sortable-scroll.html">sortable-scroll</a></li> <li><a href="..&#x2F;modules/stylesheet.html">stylesheet</a></li> <li><a href="..&#x2F;modules/substitute.html">substitute</a></li> <li><a href="..&#x2F;modules/swf.html">swf</a></li> <li><a href="..&#x2F;modules/swfdetect.html">swfdetect</a></li> <li><a href="..&#x2F;modules/tabview.html">tabview</a></li> <li><a href="..&#x2F;modules/test.html">test</a></li> <li><a href="..&#x2F;modules/test-console.html">test-console</a></li> <li><a href="..&#x2F;modules/text.html">text</a></li> <li><a href="..&#x2F;modules/text-accentfold.html">text-accentfold</a></li> <li><a href="..&#x2F;modules/text-wordbreak.html">text-wordbreak</a></li> <li><a href="..&#x2F;modules/transition.html">transition</a></li> <li><a href="..&#x2F;modules/uploader.html">uploader</a></li> <li><a href="..&#x2F;modules/uploader-deprecated.html">uploader-deprecated</a></li> <li><a href="..&#x2F;modules/uploader-flash.html">uploader-flash</a></li> <li><a href="..&#x2F;modules/uploader-html5.html">uploader-html5</a></li> <li><a href="..&#x2F;modules/uploader-queue.html">uploader-queue</a></li> <li><a href="..&#x2F;modules/view.html">view</a></li> <li><a href="..&#x2F;modules/view-node-map.html">view-node-map</a></li> <li><a href="..&#x2F;modules/widget.html">widget</a></li> <li><a href="..&#x2F;modules/widget-anim.html">widget-anim</a></li> <li><a href="..&#x2F;modules/widget-autohide.html">widget-autohide</a></li> <li><a href="..&#x2F;modules/widget-base.html">widget-base</a></li> <li><a href="..&#x2F;modules/widget-base-ie.html">widget-base-ie</a></li> <li><a href="..&#x2F;modules/widget-buttons.html">widget-buttons</a></li> <li><a href="..&#x2F;modules/widget-child.html">widget-child</a></li> <li><a href="..&#x2F;modules/widget-htmlparser.html">widget-htmlparser</a></li> <li><a href="..&#x2F;modules/widget-locale.html">widget-locale</a></li> <li><a href="..&#x2F;modules/widget-modality.html">widget-modality</a></li> <li><a href="..&#x2F;modules/widget-parent.html">widget-parent</a></li> <li><a href="..&#x2F;modules/widget-position.html">widget-position</a></li> <li><a href="..&#x2F;modules/widget-position-align.html">widget-position-align</a></li> <li><a href="..&#x2F;modules/widget-position-constrain.html">widget-position-constrain</a></li> <li><a href="..&#x2F;modules/widget-skin.html">widget-skin</a></li> <li><a href="..&#x2F;modules/widget-stack.html">widget-stack</a></li> <li><a href="..&#x2F;modules/widget-stdmod.html">widget-stdmod</a></li> <li><a href="..&#x2F;modules/widget-uievents.html">widget-uievents</a></li> <li><a href="..&#x2F;modules/yql.html">yql</a></li> <li><a href="..&#x2F;modules/yui.html">yui</a></li> <li><a href="..&#x2F;modules/yui-base.html">yui-base</a></li> <li><a href="..&#x2F;modules/yui-later.html">yui-later</a></li> <li><a href="..&#x2F;modules/yui-log.html">yui-log</a></li> <li><a href="..&#x2F;modules/yui-throttle.html">yui-throttle</a></li> <li><a href="..&#x2F;modules/yui3.html">yui3</a></li> </ul> </div> </div> </div> </div> </div> <div class="yui3-u-3-4"> <div id="api-options"> Show: <label for="api-show-inherited"> <input type="checkbox" id="api-show-inherited" checked> Inherited </label> <label for="api-show-protected"> <input type="checkbox" id="api-show-protected"> Protected </label> <label for="api-show-private"> <input type="checkbox" id="api-show-private"> Private </label> </div> <div class="apidocs"> <div id="docs-main"> <div class="content"> <h1>widget-locale Module</h1> <div class="box clearfix meta"> <a class="button link-docs" href="/yui/docs/widget">User Guide &amp; Examples</a> <div class="foundat"> Defined in: <a href="..&#x2F;files&#x2F;widget_js_WidgetLocale.js.html#l1"><code>widget&#x2F;js&#x2F;WidgetLocale.js:1</code></a> </div> </div> <div class="box deprecated"> <p> <strong>Deprecated:</strong> This module has been deprecated. It&#x27;s replaced by the &quot;intl&quot; module which provides generic internationalization and BCP 47 language tag support with externalization. </p> </div> <div class="box intro"> <p>Provides string support for widget with BCP 47 language tag lookup. This module has been deprecated. It's replaced by the "intl" module which provides generic internationalization and BCP 47 language tag support with externalization.</p> </div> <div class="yui3-g"> <div class="yui3-u-1-2"> </div> <div class="yui3-u-1-2"> </div> </div> </div> </div> </div> </div> </div> </div> <script src="..&#x2F;assets/vendor/prettify/prettify-min.js"></script> <script>prettyPrint();</script> <script src="..&#x2F;assets/js/yui-prettify.js"></script> <script src="..&#x2F;assets/../api.js"></script> <script src="..&#x2F;assets/js/api-filter.js"></script> <script src="..&#x2F;assets/js/api-list.js"></script> <script src="..&#x2F;assets/js/api-search.js"></script> <script src="..&#x2F;assets/js/apidocs.js"></script> </body> </html>
dkist/t-h-inker
sites/all/libraries/yui/api/modules/widget-locale.html
HTML
gpl-2.0
66,604
46.794139
244
0.469146
false
/* * Xiphos Bible Study Tool * sword.cc - glue * * Copyright (C) 2000-2020 Xiphos Developer Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifdef HAVE_CONFIG_H #include <config.h> #endif #include <gtk/gtk.h> #include <glib.h> #include <glib/gstdio.h> #include <swmgr.h> #include <swmodule.h> #include <stringmgr.h> #include <localemgr.h> extern "C" { #include "gui/bibletext.h" #include "main/gtk_compat.h" } #include <ctype.h> #include <time.h> #include "gui/main_window.h" #include "gui/font_dialog.h" #include "gui/widgets.h" #include "gui/commentary.h" #include "gui/dialog.h" #include "gui/parallel_dialog.h" #include "gui/parallel_tab.h" #include "gui/parallel_view.h" #include "gui/tabbed_browser.h" #include "gui/xiphos.h" #include "gui/sidebar.h" #include "gui/utilities.h" #include "gui/cipher_key_dialog.h" #include "gui/main_menu.h" #include "main/biblesync_glue.h" #include "main/display.hh" #include "main/lists.h" #include "main/navbar.h" #include "main/navbar_book.h" #include "main/search_sidebar.h" #include "main/previewer.h" #include "main/settings.h" #include "main/sidebar.h" #include "main/sword.h" #include "main/url.hh" #include "main/xml.h" #include "main/parallel_view.h" #include "main/modulecache.hh" #include "backend/sword_main.hh" #include "backend/gs_stringmgr.h" #include "biblesync/biblesync.hh" #include "gui/debug_glib_null.h" #ifdef HAVE_DBUS #include "gui/ipc.h" #endif extern BibleSync *biblesync; using namespace sword; char *sword_locale = NULL; gboolean companion_activity = FALSE; /* Unicode collation necessities. */ UCollator* collator; UErrorCode collator_status; extern gboolean valid_scripture_key; // these track together. when one changes, so does the other. static std::map<string, string> abbrev_name2abbrev, abbrev_abbrev2name; typedef std::map<string, string>::iterator abbrev_iter; /****************************************************************************** * Name * main_add_abbreviation * * Synopsis * #include "main/sword.h" * * void main_add_abbreviation(char *name, char *abbreviation) * * Description * adds an element to each of the abbreviation maps. * * Return value * void */ void main_add_abbreviation(const char *name, const char *abbreviation) { // let's not be stupid about abbreviations chosen, ok? if (!strchr(abbreviation, '(')) { abbrev_name2abbrev[name] = abbreviation; abbrev_abbrev2name[abbreviation] = name; } } /****************************************************************************** * Name * main_get_abbreviation * * Synopsis * #include "main/sword.h" * * const char * main_get_abbreviation(const char *name) * * Description * gets abbreviation from real module, if available. * * Return value * const char * */ const char *main_get_abbreviation(const char *name) { if (name == NULL) return NULL; abbrev_iter it = abbrev_name2abbrev.find(name); if (it != abbrev_name2abbrev.end()) { return it->second.c_str(); } return NULL; } /****************************************************************************** * Name * main_get_name * * Synopsis * #include "main/sword.h" * * const char * main_get_name(const char *abbreviation) * * Description * gets real module name from abbreviation, if available. * * Return value * const char * */ const char *main_get_name(const char *abbreviation) { if (abbreviation == NULL) return NULL; abbrev_iter it = abbrev_abbrev2name.find(abbreviation); if (it != abbrev_abbrev2name.end()) { return it->second.c_str(); } return NULL; } /****************************************************************************** * Name * main_book_heading * * Synopsis * #include "main/sword.h" * * void main_book_heading(char * mod_name) * * Description * * * Return value * void */ void main_book_heading(char *mod_name) { VerseKey *vkey; SWMgr *mgr = backend->get_mgr(); backend->display_mod = mgr->Modules[mod_name]; vkey = (VerseKey *)(SWKey *)(*backend->display_mod); vkey->setIntros(1); vkey->setAutoNormalize(0); vkey->setChapter(0); vkey->setVerse(0); backend->display_mod->display(); } /****************************************************************************** * Name * main_chapter_heading * * Synopsis * #include "main/module_dialogs.h" * * void main_chapter_heading(char * mod_name) * * Description * * * Return value * void */ void main_chapter_heading(char *mod_name) { VerseKey *vkey; SWMgr *mgr = backend->get_mgr(); backend->display_mod = mgr->Modules[mod_name]; backend->display_mod->setKey(settings.currentverse); vkey = (VerseKey *)(SWKey *)(*backend->display_mod); vkey->setIntros(1); vkey->setAutoNormalize(0); vkey->setVerse(0); backend->display_mod->display(); } /****************************************************************************** * Name * main_save_note * * Synopsis * #include "main/sword.h" * * void main_save_note(const gchar * module_name, * const gchar * key_str , * const gchar * note_str ) * * Description * * * Return value * void */ void main_save_note(const gchar *module_name, const gchar *key_str, const gchar *note_str) { // Massage encoded spaces ("%20") back to real spaces. // This is a sick. unreliable hack that should be removed // after the underlying problem is fixed in Sword. gchar *rework; for (rework = (char *)strstr(note_str, "%20"); rework; rework = strstr(rework + 1, "%20")) { *rework = ' '; (void)strcpy(rework + 1, rework + 3); } XI_message(("note module %s\nnote key %s\nnote text%s", module_name, key_str, note_str)); backend->save_note_entry(module_name, key_str, note_str); main_display_commentary(module_name, settings.currentverse); } /****************************************************************************** * Name * main_delete_note * * Synopsis * #include "main/sword.h" * * void main_delete_note(DIALOG_DATA * d) * * Description * * * Return value * void */ void main_delete_note(const gchar *module_name, const gchar *key_str) { backend->set_module_key(module_name, key_str); XI_message(("note module %s\nnote key %s\n", module_name, key_str)); backend->delete_entry(); if ((!strcmp(settings.CommWindowModule, module_name)) && (!strcmp(settings.currentverse, key_str))) main_display_commentary(module_name, key_str); } /****************************************************************************** * Name * set_module_unlocked * * Synopsis * #include "bibletext.h" * * void set_module_unlocked(char *mod_name, char *key) * * Description * unlocks locked module - * * Return value * void */ void main_set_module_unlocked(const char *mod_name, char *key) { SWMgr *mgr = backend->get_mgr(); mgr->setCipherKey(mod_name, key); } /****************************************************************************** * Name * main_save_module_key * * Synopsis * #include "main/configs.h" * * void main_save_module_key(gchar * mod_name, gchar * key) * * Description * to unlock locked modules * * Return value * void */ void main_save_module_key(const char *mod_name, char *key) { backend->save_module_key((char *)mod_name, key); } /****************************************************************************** * Name * main_getText * * Synopsis * #include "main/sword.h" * void main_getText(gchar * key) * * Description * get unabbreviated key * * Return value * char * */ char *main_getText(char *key) { VerseKey vkey(key); return strdup((char *)vkey.getText()); } /****************************************************************************** * Name * main_getShortText * * Synopsis * #include "main/sword.h" * void main_getShortText(gchar * key) * * Description * get short-name key * * Return value * char * */ char *main_getShortText(char *key) { VerseKey vkey(key); return strdup((char *)vkey.getShortText()); } /****************************************************************************** * Name * main_update_nav_controls * * Synopsis * #include "toolbar_nav.h" * * gchar *main_update_nav_controls(const gchar * key) * * Description * updates the nav toolbar controls * * Return value * gchar * */ gchar *main_update_nav_controls(const char *module_name, const gchar *key) { char *val_key = backend->get_valid_key(module_name, key); // we got a valid key. but was it really a valid key within v11n? // for future use in determining whether to show normal navbar content. navbar_versekey.valid_key = main_is_Bible_key(module_name, key); /* * remember verse */ xml_set_value("Xiphos", "keys", "verse", val_key); settings.currentverse = xml_get_value("keys", "verse"); settings.apply_change = FALSE; navbar_versekey.module_name = g_string_assign(navbar_versekey.module_name, settings.MainWindowModule); navbar_versekey.key = g_string_assign(navbar_versekey.key, val_key); main_navbar_versekey_set(navbar_versekey, val_key); settings.apply_change = TRUE; #ifdef HAVE_DBUS IpcObject *ipc = ipc_get_main_ipc(); if (ipc) ipc_object_navigation_signal(ipc, (const gchar *)val_key, NULL); #endif return val_key; } /****************************************************************************** * Name * get_module_key * * Synopsis * #include "main/module.h" * * char *get_module_key(void) * * Description * returns module key * * Return value * char * */ char *main_get_active_pane_key(void) { if (settings.havebible) { switch (settings.whichwindow) { case MAIN_TEXT_WINDOW: case COMMENTARY_WINDOW: return (char *)settings.currentverse; break; case DICTIONARY_WINDOW: return (char *)settings.dictkey; break; case parallel_WINDOW: return (char *)settings.cvparallel; break; case BOOK_WINDOW: return (char *)settings.book_key; break; } } return NULL; } /****************************************************************************** * Name * get_module_name * * Synopsis * #include "main/module.h" * * char *get_module_name(void) * * Description * returns module name * * Return value * char * */ char *main_get_active_pane_module(void) { if (settings.havebible) { switch (settings.whichwindow) { case MAIN_TEXT_WINDOW: return (char *)xml_get_value("modules", "bible"); break; case COMMENTARY_WINDOW: return (char *)xml_get_value("modules", "comm"); break; case DICTIONARY_WINDOW: return (char *)settings.DictWindowModule; break; case BOOK_WINDOW: return (char *)settings.book_mod; break; } } return NULL; } /****************************************************************************** * Name * module_name_from_description * * Synopsis * #include ".h" * * void module_name_from_description(gchar *mod_name, gchar *description) * * Description * * * Return value * void */ char *main_module_name_from_description(char *description) { return backend->module_name_from_description(description); } /****************************************************************************** * Name * main_get_sword_version * * Synopsis * #include "sword.h" * * const char *main_get_sword_version(void) * * Description * * * Return value * const char * */ const char *main_get_sword_version(void) { return backend->get_sword_version(); } /****************************************************************************** * Name * get_search_results_text * * Synopsis * #include "sword.h" * * char *get_search_results_text(char * mod_name, char * key) * * Description * * * Return value * char * */ char *main_get_search_results_text(char *mod_name, char *key) { return backend->get_render_text((char *)mod_name, (char *)key); } /****************************************************************************** * Name * main_get_path_to_mods * * Synopsis * #include "sword.h" * * gchar *main_get_path_to_mods(void) * * Description * returns the path to the sword modules * * Return value * gchar * */ char *main_get_path_to_mods(void) { SWMgr *mgr = backend->get_mgr(); char *path = mgr->prefixPath; return (path ? g_strdup(path) : NULL); } /****************************************************************************** * Name * main_init_language_map * * Synopsis * #include "sword.h" * * void main_init_language_map(void) * * Description * initializes the hard-coded abbrev->name mapping. * * Return value * void */ typedef std::map<SWBuf, SWBuf> ModLanguageMap; ModLanguageMap languageMap; void main_init_language_map() { gchar *language_file; FILE *language; gchar *s, *end, *abbrev, *name, *newline; gchar *mapspace; size_t length; if ((language_file = gui_general_user_file("languages", FALSE)) == NULL) { gui_generic_warning(_("Xiphos's file for language\nabbreviations is missing.")); return; } XI_message(("%s", language_file)); if ((language = g_fopen(language_file, "r")) == NULL) { gui_generic_warning(_("Xiphos's language abbreviation\nfile cannot be opened.")); g_free(language_file); return; } g_free(language_file); (void)fseek(language, 0L, SEEK_END); length = ftell(language); rewind(language); if ((length == 0) || (mapspace = (gchar *)g_malloc(length + 2)) == NULL) { fclose(language); gui_generic_warning(_("Xiphos cannot allocate space\nfor language abbreviations.")); return; } if (fread(mapspace, 1, length, language) != length) { fclose(language); g_free(mapspace); gui_generic_warning(_("Xiphos cannot read the\nlanguage abbreviation file.")); return; } fclose(language); end = length + mapspace; *end = '\0'; for (s = mapspace; s < end; ++s) { if ((newline = strchr(s, '\n')) == NULL) { XI_message(("incomplete last line in languages")); break; } *newline = '\0'; if ((*s == '#') || (s == newline)) { s = newline; // comment or empty line. continue; } abbrev = s; if ((name = strchr(s, '\t')) == NULL) { XI_message(("tab-less line in languages")); break; } *(name++) = '\0'; // NUL-terminate abbrev, mark name. languageMap[SWBuf(abbrev)] = SWBuf(name); s = newline; } g_free(mapspace); } const char *main_get_language_map(const char *language) { if (language == NULL) return "Unknown"; return languageMap[language].c_str(); } char **main_get_module_language_list(void) { return backend->get_module_language_list(); } /****************************************************************************** * Name * set_sword_locale * * Synopsis * #include "main/sword.h" * * char *set_sword_locale(const char *sys_locale) * * Description * set sword's idea of the locale in which the user operates * * Return value * char * */ char *set_sword_locale(const char *sys_locale) { if (sys_locale) { SWBuf locale; StringList localelist = LocaleMgr::getSystemLocaleMgr()->getAvailableLocales(); StringList::iterator it; int ncmp[3] = {100, 5, 2}; // fixed data // length-limited match for (int i = 0; i < 3; ++i) { for (it = localelist.begin(); it != localelist.end(); ++it) { locale = *it; if (!strncmp(sys_locale, locale.c_str(), ncmp[i])) { LocaleMgr::getSystemLocaleMgr()->setDefaultLocaleName(locale.c_str()); return g_strdup(locale.c_str()); } } } } // either we were given a null sys_locale, or it didn't match anything. char *err = g_strdup_printf(_("No matching locale found for `%s'.\n%s"), sys_locale, _("Book names and menus may not be translated.")); gui_generic_warning(err); g_free(err); return NULL; } /****************************************************************************** * Name * backend_init * * Synopsis * #include "main/sword.h" * * void main_init_backend(void) * * Description * start sword * * Return value * void */ void main_init_backend(void) { StringMgr::setSystemStringMgr(new GS_StringMgr()); const char *lang = getenv("LANG"); if (!lang) lang = "C"; sword_locale = set_sword_locale(lang); collator = ucol_open(sword_locale, &collator_status); lang = LocaleMgr::getSystemLocaleMgr()->getDefaultLocaleName(); backend = new BackEnd(); backend->init_SWORD(0); settings.path_to_mods = main_get_path_to_mods(); //#ifndef DEBUG g_chdir(settings.path_to_mods); //#else // XI_warning(("no chdir(SWORD_PATH) => modmgr 'archive' may not work")); //#endif XI_print(("%s sword-%s\n", "Starting", backend->get_sword_version())); XI_print(("%s\n", "Initiating SWORD")); XI_print(("%s: %s\n", "path to sword", settings.path_to_mods)); XI_print(("%s %s\n", "SWORD locale is", lang)); XI_print(("%s\n", "Checking for SWORD Modules")); settings.spell_language = strdup(lang); main_init_lists(); // // BibleSync backend startup. identify the user by name. // biblesync = new BibleSync("Xiphos", VERSION, #ifdef WIN32 // in win32 glib, get_real_name and get_user_name are the same. (string)g_get_real_name() #else (string)g_get_real_name() + " (" + g_get_user_name() + ")" #endif ); } /****************************************************************************** * Name * shutdown_sword * * Synopsis * #include "sword.h" * * void shutdown_sword(void) * * Description * close down sword by deleting backend; * * Return value * void */ void main_shutdown_backend(void) { if (sword_locale) free((char *)sword_locale); sword_locale = NULL; if (backend) delete backend; backend = NULL; XI_print(("%s\n", "SWORD is shutdown")); } /****************************************************************************** * Name * main_dictionary_entry_changed * * Synopsis * #include "main/sword.h" * * void main_dictionary_entry_changed(char * mod_name) * * Description * text in the dictionary entry has changed and the entry activated * * Return value * void */ void main_dictionary_entry_changed(char *mod_name) { gchar *key = NULL; if (!mod_name) return; if (strcmp(settings.DictWindowModule, mod_name)) { xml_set_value("Xiphos", "modules", "dict", mod_name); settings.DictWindowModule = xml_get_value("modules", "dict"); } key = g_strdup((gchar *)gtk_entry_get_text(GTK_ENTRY(widgets.entry_dict))); backend->set_module_key(mod_name, key); g_free(key); key = backend->get_module_key(); xml_set_value("Xiphos", "keys", "dictionary", key); settings.dictkey = xml_get_value("keys", "dictionary"); main_check_unlock(mod_name, TRUE); backend->set_module_key(mod_name, key); backend->display_mod->display(); gtk_entry_set_text(GTK_ENTRY(widgets.entry_dict), key); g_free(key); } static void dict_key_list_select(GtkMenuItem *menuitem, gpointer user_data) { gtk_entry_set_text(GTK_ENTRY(widgets.entry_dict), (gchar *)user_data); gtk_widget_activate(widgets.entry_dict); } /****************************************************************************** * Name * * * Synopsis * #include "main/sword.h" * * * * Description * text in the dictionary entry has changed and the entry activated * * Return value * void */ GtkWidget *main_dictionary_drop_down_new(char *mod_name, char *old_key) { gint count = 9, i; gchar *new_key; gchar *key = NULL; GtkWidget *menu; menu = gtk_menu_new(); if (!settings.havedict || !mod_name) return NULL; if (strcmp(settings.DictWindowModule, mod_name)) { xml_set_value("Xiphos", "modules", "dict", mod_name); settings.DictWindowModule = xml_get_value( "modules", "dict"); } key = g_strdup((gchar *)gtk_entry_get_text(GTK_ENTRY(widgets.entry_dict))); XI_message(("\nold_key: %s\nkey: %s", old_key, key)); backend->set_module_key(mod_name, key); g_free(key); key = backend->get_module_key(); xml_set_value("Xiphos", "keys", "dictionary", key); settings.dictkey = xml_get_value("keys", "dictionary"); main_check_unlock(mod_name, TRUE); backend->set_module_key(mod_name, key); backend->display_mod->display(); new_key = g_strdup((char *)backend->display_mod->getKeyText()); for (i = 0; i < (count / 2) + 1; i++) { (*backend->display_mod)--; } for (i = 0; i < count; i++) { free(new_key); (*backend->display_mod)++; new_key = g_strdup((char *)backend->display_mod->getKeyText()); /* add menu item */ GtkWidget *item = gtk_menu_item_new_with_label((gchar *)new_key); gtk_widget_show(item); g_signal_connect(G_OBJECT(item), "activate", G_CALLBACK(dict_key_list_select), g_strdup(new_key)); gtk_container_add(GTK_CONTAINER(menu), item); } free(new_key); g_free(key); return menu; } /****************************************************************************** * Name * main_dictionary_button_clicked * * Synopsis * #include "main/sword.h" * * void main_dictionary_button_clicked(gint direction) * * Description * The back or foward dictinary key button was clicked. * the module key is set to the current dictkey. * then the module is incremented or decremented. * the new key is returned from the module and the dictionary entry is set * to the new key. The entry is then activated. * * Return value * void */ void main_dictionary_button_clicked(gint direction) { gchar *key = NULL; if (!settings.havedict || !settings.DictWindowModule) return; backend->set_module_key(settings.DictWindowModule, settings.dictkey); if (direction == 0) (*backend->display_mod)--; else (*backend->display_mod)++; key = g_strdup((char *)backend->display_mod->getKeyText()); gtk_entry_set_text(GTK_ENTRY(widgets.entry_dict), key); gtk_widget_activate(widgets.entry_dict); g_free(key); } void main_display_book(const char *mod_name, const char *key) { if (!settings.havebook || !mod_name) return; if (key == NULL) key = "0"; XI_message(("main_display_book\nmod_name: %s\nkey: %s", mod_name, key)); if (!backend->is_module(mod_name)) return; if (!settings.book_mod) settings.book_mod = g_strdup((char *)mod_name); if (strcmp(settings.book_mod, mod_name)) { xml_set_value("Xiphos", "modules", "book", mod_name); gui_reassign_strdup(&settings.book_mod, (gchar *)mod_name); } if (!isdigit(key[0])) { xml_set_value("Xiphos", "keys", "book", key); settings.book_key = xml_get_value("keys", "book"); backend->set_module(mod_name); backend->set_treekey(0); settings.book_offset = backend->treekey_set_key((char *)key); } else { settings.book_offset = atol(key); if (settings.book_offset < 4) settings.book_offset = 4; xml_set_value("Xiphos", "keys", "book", key); settings.book_key = xml_get_value("keys", "book"); xml_set_value("Xiphos", "keys", "offset", key); backend->set_module(mod_name); backend->set_treekey(settings.book_offset); } main_check_unlock(mod_name, TRUE); backend->display_mod->display(); main_setup_navbar_book(settings.book_mod, settings.book_offset); //if (settings.browsing) gui_update_tab_struct(NULL, NULL, NULL, mod_name, NULL, key, FALSE, settings.showtexts, settings.showpreview, settings.showcomms, settings.showdicts); } void main_display_commentary(const char *mod_name, const char *key) { if (!settings.havecomm || !settings.comm_showing) return; if (!mod_name) mod_name = ((settings.browsing && (cur_passage_tab != NULL)) ? g_strdup(cur_passage_tab->commentary_mod) : xml_get_value("modules", "comm")); if (!mod_name || !backend->is_module(mod_name)) return; int modtype = backend->module_type(mod_name); if ((modtype != COMMENTARY_TYPE) && (modtype != PERCOM_TYPE)) return; // what are we doing here? if (!settings.CommWindowModule) settings.CommWindowModule = g_strdup((gchar *)mod_name); settings.comm_showing = TRUE; settings.whichwindow = COMMENTARY_WINDOW; if (strcmp(settings.CommWindowModule, mod_name)) { xml_set_value("Xiphos", "modules", "comm", mod_name); gui_reassign_strdup(&settings.CommWindowModule, (gchar *)mod_name); // handle a conf directive "Companion=This,That,TheOther" char *companion = main_get_mod_config_entry(mod_name, "Companion"); gchar **name_set = (companion ? g_strsplit(companion, ",", -1) : NULL); if (companion && (!companion_activity) && name_set[0] && *name_set[0] && backend->is_module(name_set[0]) && ((settings.MainWindowModule == NULL) || strcmp(name_set[0], settings.MainWindowModule))) { companion_activity = TRUE; gint name_length = g_strv_length(name_set); char *companion_question = g_strdup_printf(_("Module %s has companion modules:\n%s.\n" "Would you like to open these as well?%s"), mod_name, companion, ((name_length > 1) ? _("\n\nThe first will open in the main window\n" "and others in separate windows.") : "")); if (gui_yes_no_dialog(companion_question, NULL)) { main_display_bible(name_set[0], key); for (int i = 1; i < name_length; i++) { main_dialogs_open(name_set[i], key, FALSE); } } g_free(companion_question); companion_activity = FALSE; } if (name_set) g_strfreev(name_set); if (companion) g_free(companion); } main_check_unlock(mod_name, TRUE); valid_scripture_key = main_is_Bible_key(mod_name, key); backend->set_module_key(mod_name, key); backend->display_mod->display(); valid_scripture_key = TRUE; // leave nice for future use. //if (settings.browsing) gui_update_tab_struct(NULL, mod_name, NULL, NULL, NULL, NULL, TRUE, settings.showtexts, settings.showpreview, settings.showcomms, settings.showdicts); } void main_display_dictionary(const char *mod_name, const char *key) { const gchar *old_key, *feature; // for devotional use. gchar buf[10]; if (!settings.havedict || !mod_name) return; XI_message(("main_display_dictionary\nmod_name: %s\nkey: %s", mod_name, key)); if (!backend->is_module(mod_name)) return; if (!settings.DictWindowModule) settings.DictWindowModule = g_strdup((gchar *)mod_name); if (key == NULL) key = (char *)"Grace"; feature = (char *)backend->get_mgr()->getModule(mod_name)->getConfigEntry("Feature"); // turn on "all strong's" iff we have that kind of dictionary. if (feature && (!strcmp(feature, "HebrewDef") || !strcmp(feature, "GreekDef"))) gtk_widget_show(widgets.all_strongs); else gtk_widget_hide(widgets.all_strongs); if (strcmp(settings.DictWindowModule, mod_name)) { // new dict -- is it actually a devotional? time_t curtime; if (feature && !strcmp(feature, "DailyDevotion")) { if ((strlen(key) != 5) || // blunt tests. (key[0] < '0') || (key[0] > '9') || (key[1] < '0') || (key[1] > '9') || (key[2] != '.') || (key[3] < '0') || (key[3] > '9') || (key[4] < '0') || (key[4] > '9')) { // not MM.DD struct tm *loctime; curtime = time(NULL); loctime = localtime(&curtime); strftime(buf, 10, "%m.%d", loctime); key = buf; } } xml_set_value("Xiphos", "modules", "dict", mod_name); gui_reassign_strdup(&settings.DictWindowModule, (gchar *)mod_name); } // old_key is uppercase key = g_utf8_strup(key, -1); old_key = gtk_entry_get_text(GTK_ENTRY(widgets.entry_dict)); if (!strcmp(old_key, key)) main_dictionary_entry_changed(settings.DictWindowModule); else { gtk_entry_set_text(GTK_ENTRY(widgets.entry_dict), key); gtk_widget_activate(widgets.entry_dict); } //if (settings.browsing) gui_update_tab_struct(NULL, NULL, mod_name, NULL, key, NULL, settings.comm_showing, settings.showtexts, settings.showpreview, settings.showcomms, settings.showdicts); } void main_display_bible(const char *mod_name, const char *key) { gchar *bs_key = g_strdup(key); // avoid tab data corruption problem. /* keeps us out of a crash causing loop */ extern guint scroll_adj_signal; extern GtkAdjustment *adjustment; if (adjustment) g_signal_handler_block(adjustment, scroll_adj_signal); if (!gtk_widget_get_realized(GTK_WIDGET(widgets.html_text))) return; if (!mod_name) mod_name = ((settings.browsing && (cur_passage_tab != NULL)) ? g_strdup(cur_passage_tab->text_mod) : xml_get_value("modules", "bible")); if (!settings.havebible || !mod_name) return; if (!backend->is_module(mod_name)) return; int modtype = backend->module_type(mod_name); if (modtype != TEXT_TYPE) return; // what are we doing here? if (!settings.MainWindowModule) settings.MainWindowModule = g_strdup((gchar *)mod_name); if (strcmp(settings.currentverse, key)) { xml_set_value("Xiphos", "keys", "verse", key); settings.currentverse = xml_get_value( "keys", "verse"); } if (strcmp(settings.MainWindowModule, mod_name)) { xml_set_value("Xiphos", "modules", "bible", mod_name); gui_reassign_strdup(&settings.MainWindowModule, (gchar *)mod_name); // handle a conf directive "Companion=This,That,TheOther" char *companion = main_get_mod_config_entry(mod_name, "Companion"); gchar **name_set = (companion ? g_strsplit(companion, ",", -1) : NULL); if (companion && (!companion_activity) && name_set[0] && *name_set[0] && backend->is_module(name_set[0]) && ((settings.CommWindowModule == NULL) || strcmp(name_set[0], settings.CommWindowModule))) { companion_activity = TRUE; gint name_length = g_strv_length(name_set); char *companion_question = g_strdup_printf(_("Module %s has companion modules:\n%s.\n" "Would you like to open these as well?%s"), mod_name, companion, ((name_length > 1) ? _("\n\nThe first will open in the main window\n" "and others in separate windows.") : "")); if (gui_yes_no_dialog(companion_question, NULL)) { main_display_commentary(name_set[0], key); for (int i = 1; i < name_length; i++) { main_dialogs_open(name_set[i], key, FALSE); } } g_free(companion_question); companion_activity = FALSE; } if (name_set) g_strfreev(name_set); if (companion) g_free(companion); navbar_versekey.module_name = g_string_assign(navbar_versekey.module_name, settings.MainWindowModule); navbar_versekey.key = g_string_assign(navbar_versekey.key, settings.currentverse); main_search_sidebar_fill_bounds_combos(); } settings.whichwindow = MAIN_TEXT_WINDOW; main_check_unlock(mod_name, TRUE); valid_scripture_key = main_is_Bible_key(mod_name, key); if (backend->module_has_testament(mod_name, backend->get_key_testament(mod_name, key))) { backend->set_module_key(mod_name, key); backend->display_mod->display(); } else { gchar *val_key = NULL; if (backend->get_key_testament(mod_name, key) == 1) val_key = main_update_nav_controls(mod_name, "Matthew 1:1"); else val_key = main_update_nav_controls(mod_name, "Genesis 1:1"); backend->set_module_key(mod_name, val_key); backend->display_mod->display(); g_free(val_key); } valid_scripture_key = TRUE; // leave nice for future use. XI_message(("mod_name = %s", mod_name)); //if (settings.browsing) { gui_update_tab_struct(mod_name, NULL, NULL, NULL, NULL, NULL, settings.comm_showing, settings.showtexts, settings.showpreview, settings.showcomms, settings.showdicts); gui_set_tab_label(settings.currentverse, FALSE); //} gui_change_window_title(settings.MainWindowModule); // (called _after_ tab data updated so not overwritten with old tab) /* * change parallel verses */ if (settings.dockedInt) main_update_parallel_page(); else { if (settings.showparatab) gui_keep_parallel_tab_in_sync(); else gui_keep_parallel_dialog_in_sync(); } // multicast now, iff user has not asked for keyboard-only xmit. if (!settings.bs_keyboard) biblesync_prep_and_xmit(mod_name, bs_key); g_free(bs_key); if (adjustment) g_signal_handler_unblock(adjustment, scroll_adj_signal); } /****************************************************************************** * Name * main_display_devotional * * Synopsis * #include "main/sword.h" * * void main_display_devotional(void) * * Description * * * Return value * void */ void main_display_devotional(void) { gchar buf[10]; gchar *prettybuf; time_t curtime; struct tm *loctime; gchar *text; /* * This makes sense only if you've installed & defined one. */ if (settings.devotionalmod == NULL) { GList *glist = get_list(DEVOTION_LIST); if (g_list_length(glist) != 0) { xml_set_value("Xiphos", "modules", "devotional", (char *)glist->data); gui_reassign_strdup(&settings.devotionalmod, (gchar *)glist->data); } else { gui_generic_warning(_("Daily devotional was requested, but there are none installed.")); } } /* * Get the current time, converted to local time. */ curtime = time(NULL); loctime = localtime(&curtime); strftime(buf, 10, "%m.%d", loctime); prettybuf = g_strdup_printf("<b>%s %d</b>", gettext(month_names[loctime->tm_mon]), loctime->tm_mday); text = backend->get_render_text(settings.devotionalmod, buf); if (text) { main_entry_display(settings.show_previewer_in_sidebar ? sidebar.html_viewer_widget : widgets.html_previewer_text, settings.devotionalmod, text, prettybuf, TRUE); g_free(text); } g_free(prettybuf); } void main_setup_displays(void) { backend->textDisplay = new GTKChapDisp(widgets.html_text, backend); backend->commDisplay = new GTKEntryDisp(widgets.html_comm, backend); backend->bookDisplay = new GTKEntryDisp(widgets.html_book, backend); backend->dictDisplay = new GTKEntryDisp(widgets.html_dict, backend); } const char *main_get_module_language(const char *module_name) { return backend->module_get_language(module_name); } /****************************************************************************** * Name * main_check_for_option * * Synopsis * #include ".h" * * gint main_check_for_option(const gchar * mod_name, const gchar * key, const gchar * option) * * Description * get any option for a module * * Return value * gint */ gint main_check_for_option(const gchar *mod_name, const gchar *key, const gchar *option) { return backend->has_option(mod_name, key, option); } /****************************************************************************** * Name * main_check_for_global_option * * Synopsis * #include ".h" * * gint main_check_for_global_option(const gchar * mod_name, const gchar * option) * * Description * get global options for a module * * Return value * gint */ gint main_check_for_global_option(const gchar *mod_name, const gchar *option) { return backend->has_global_option(mod_name, option); } /****************************************************************************** * Name * main_is_module * * Synopsis * #include "main/module.h" * * int main_is_module(char * mod_name) * * Description * check for presents of a module by name * * Return value * int */ int main_is_module(char *mod_name) { return backend->is_module(mod_name); } /****************************************************************************** * Name * main_has_search_framework * * Synopsis * #include "main/module.h" * * int main_has_search_framework(char * mod_name) * * Description * tells us whether CLucene is available * * Return value * int (boolean) */ int main_has_search_framework(char *mod_name) { SWMgr *mgr = backend->get_mgr(); SWModule *mod = mgr->getModule(mod_name); return (mod && mod->hasSearchFramework()); } /****************************************************************************** * Name * main_optimal_search * * Synopsis * #include "main/module.h" * * int main_optimal_search(char * mod_name) * * Description * tells us whether a CLucene index exists * * Return value * int (boolean) */ int main_optimal_search(char *mod_name) { SWMgr *mgr = backend->get_mgr(); SWModule *mod = mgr->Modules.find(mod_name)->second; return mod->isSearchOptimallySupported("God", -4, 0, 0); } char *main_get_mod_config_entry(const char *module_name, const char *entry) { return backend->get_config_entry((char *)module_name, (char *)entry); } char *main_get_mod_config_file(const char *module_name, const char *moddir) { #ifdef SWORD_SHOULD_HAVE_A_WAY_TO_GET_A_CONF_FILENAME_FROM_A_MODNAME return backend->get_config_file((char *)module_name, (char *)moddir); #else GDir *dir; SWBuf name; name = moddir; name += "/mods.d"; if ((dir = g_dir_open(name, 0, NULL))) { const gchar *ent; g_dir_rewind(dir); while ((ent = g_dir_read_name(dir))) { name = moddir; name += "/mods.d/"; name += ent; SWConfig *config = new SWConfig(name.c_str()); if (config->getSections().find(module_name) != config->getSections().end()) { gchar *ret_name = g_strdup(ent); g_dir_close(dir); delete config; return ret_name; } else delete config; } g_dir_close(dir); } return NULL; #endif } int main_is_mod_rtol(const char *module_name) { char *direction = backend->get_config_entry((char *)module_name, (char *)"Direction"); return (direction && !strcmp(direction, "RtoL")); } /****************************************************************************** * Name * main_has_cipher_tag * * Synopsis * #include "main/.h" * * int main_has_cipher_tag(char *mod_name) * * Description * * * Return value * int */ int main_has_cipher_tag(char *mod_name) { gchar *cipherkey = backend->get_config_entry(mod_name, (char *)"CipherKey"); int retval = (cipherkey != NULL); g_free(cipherkey); return retval; } #define CIPHER_INTRO \ _("<b>Locked Module.</b>\n\n<u>You are opening a module which requires a <i>key</i>.</u>\n\nThe module is locked, meaning that the content is encrypted by its publisher, and you must enter its key in order for the content to become useful. This key should have been received by you on the web page which confirmed your purchase, or perhaps sent via email after purchase.\n\nPlease enter the key in the dialog.") /****************************************************************************** * Name * main_check_unlock * * Synopsis * #include "main/.h" * * int main_check_unlock(const char *mod_name) * * Description * * * Return value * int */ void main_check_unlock(const char *mod_name, gboolean conditional) { gchar *cipher_old = main_get_mod_config_entry(mod_name, "CipherKey"); /* if forced by the unlock menu item, or it's present but empty... */ if (!conditional || ((cipher_old != NULL) && (*cipher_old == '\0'))) { if (conditional) { GtkWidget *dialog; dialog = gtk_message_dialog_new_with_markup(NULL, /* no need for a parent window */ GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_INFO, GTK_BUTTONS_OK, CIPHER_INTRO); g_signal_connect_swapped(dialog, "response", G_CALLBACK(gtk_widget_destroy), dialog); gtk_widget_show(dialog); } gchar *cipher_key = gui_add_cipher_key(mod_name, cipher_old); if (cipher_key) { ModuleCacheErase(mod_name); redisplay_to_realign(); g_free(cipher_key); } } g_free(cipher_old); } /****************************************************************************** * Name * main_get_striptext * * Synopsis * #include "main/sword.h" * * char *main_get_striptext(char *module_name, char *key) * * Description * * * Return value * char * */ char *main_get_striptext(char *module_name, char *key) { return backend->get_strip_text(module_name, key); } /****************************************************************************** * Name * main_get_rendered_text * * Synopsis * #include "main/sword.h" * * char *main_get_rendered_text(char *module_name, char *key) * * Description * * * Return value * char * */ char *main_get_rendered_text(const char *module_name, const char *key) { return backend->get_render_text(module_name, key); } /****************************************************************************** * Name * main_get_raw_text * * Synopsis * #include "main/sword.h" * * char *main_get_raw_text(char *module_name, char *key) * * Description * * * Return value * char * */ char *main_get_raw_text(char *module_name, char *key) { return backend->get_raw_text(module_name, key); } /****************************************************************************** * Name * main_get_mod_type * * Synopsis * #include "main/module.h" * * int main_get_mod_type(char * mod_name) * * Description * * * Return value * int */ int main_get_mod_type(char *mod_name) { return backend->module_type(mod_name); } /****************************************************************************** * Name * main_get_module_description * * Synopsis * #include "main/module.h" * * gchar *main_get_module_description(gchar * module_name) * * Description * * * Return value * gchar * */ const char *main_get_module_description(const char *module_name) { return backend->module_description(module_name); } /****************************************************************************** * Name * main_format_number * * Synopsis * #include "main/sword.h" * char *main_format_number(int x) * * Description * returns a digit string in either "latinate arabic" (normal) or * farsi characters. * re_encode_digits is chosen at startup in settings.c. * caller must free allocated string space when finished with it. * * Return value * char * */ int re_encode_digits = FALSE; char * main_format_number(int x) { char *digits = g_strdup_printf("%d", x); if (re_encode_digits) { // // "\333\260" is farsi "zero". // char *d, *f, *farsi = g_new(char, 2 * (strlen(digits) + 1)); // 2 "chars" per farsi-displayed digit + slop. for (d = digits, f = farsi; *d; ++d) { *(f++) = '\333'; *(f++) = '\260' + ((*d) - '0'); } *f = '\0'; g_free(digits); return farsi; } return digits; } /****************************************************************************** * Name * main_flush_widgets_content * * Synopsis * #include "main/sword.h" * void main_flush_widgets_content() * * Description * cleans content from all subwindow widgets. * * Return value * int */ void main_flush_widgets_content(void) { GString *blank_html_content = g_string_new(NULL); g_string_printf(blank_html_content, "<html><head></head><body bgcolor=\"%s\" text=\"%s\"> </body></html>", settings.bible_bg_color, settings.bible_text_color); if (gtk_widget_get_realized(GTK_WIDGET(widgets.html_text))) HtmlOutput(blank_html_content->str, widgets.html_text, NULL, NULL); if (gtk_widget_get_realized(GTK_WIDGET(widgets.html_comm))) HtmlOutput(blank_html_content->str, widgets.html_comm, NULL, NULL); if (gtk_widget_get_realized(GTK_WIDGET(widgets.html_dict))) HtmlOutput(blank_html_content->str, widgets.html_dict, NULL, NULL); if (gtk_widget_get_realized(GTK_WIDGET(widgets.html_book))) HtmlOutput(blank_html_content->str, widgets.html_book, NULL, NULL); g_string_free(blank_html_content, TRUE); } /****************************************************************************** * Name * main_is_Bible_key * * Synopsis * #include "main/sword.h" * void main_is_Bible_key() * * Description * returns boolean status of whether input is a legit Bible key. * * Return value * gboolean */ gboolean main_is_Bible_key(const gchar *name, const gchar *key) { return (gboolean)(backend->is_Bible_key(name, key, settings.currentverse) != 0); } /****************************************************************************** * Name * main_get_osisref_from_key * * Synopsis * #include "main/sword.h" * void main_get_osisref_from_key() * * Description * returns OSISRef-formatted key value. * * Return value * const char * */ const char * main_get_osisref_from_key(const char *module, const char *key) { return backend->get_osisref_from_key(module, key); }
crosswire/xiphos
src/main/sword.cc
C++
gpl-2.0
45,237
22.934921
413
0.599067
false
<?php global $PPT,$PPTDesign; PremiumPress_Header(); ?> <div id="premiumpress_box1" class="premiumpress_box premiumpress_box-100"><div class="premiumpress_boxin"><div class="header"> <h3><img src="<?php echo $GLOBALS['template_url']; ?>/images/premiumpress/h-ico/GeneralPreferences.png" align="middle"> Display Setup</h3> <ul> <li><a rel="premiumpress_tab1" href="#" class="active">Layout</a></li> <li><a rel="premiumpress_tab6" href="#">Home</a></li> <!--<li><a rel="premiumpress_tab2" href="#">Search</a></li>--> <li><a rel="premiumpress_tab3" href="#">Sidebar</a></li> <li><a rel="premiumpress_tab4" href="#">Coupon Page</a></li> <li><a rel="premiumpress_tab5" href="#">Sliders</a></li> </ul> </div> <style> select { border-radius: 0px; -webkit-border-radius: 0px; -moz-border-radius: 0px; } </style> <form method="post" name="directorypress" target="_self" > <input name="admin_page" type="hidden" value="directorypress_setup" /> <input name="submitted" type="hidden" value="yes" /> <input name="setup" type="hidden" value="1" /> <input name="featured" type="hidden" value="1" /> <input name="featured1" type="hidden" value="1" /> <input name="listbox" type="hidden" value="yes" /> <input name="featuredstores" type="hidden" value="yes" /> <div id="premiumpress_tab1" class="content"> <table class="maintable" style="background:white;"> <tr class="mainrow"> <td></td> <td class="forminp"> <p><b>Coupon Display</b></p> <select name="adminArray[system]" class="small-input" style="width: 240px; font-size:14px;"> <option value="clicktoreveal" <?php if(get_option("system") == "clicktoreveal"){ echo "selected='selected'"; } ?>>Click To Reveal</option> <option value="normal" <?php if(get_option("system") == "normal"){ echo "selected='selected'"; } ?>>Click To Copy</option> <option value="link" <?php if(get_option("system") == "link"){ echo "selected='selected'"; } ?>>Link Display</option> </select> <br /> <small>Select which type of coupon display you wish to use.</small> </td> <td class="forminp"><img src="<?php echo IMAGE_PATH; ?>/help1/c3.png"> </td> </tr> <tr class="mainrow"><td></td><td class="forminp"> <b>Select theme layout (2 or 3 columns)</b> <table width="100%" border="1"> <tr> <td style="width:150px;"><img src="<?php echo $GLOBALS['template_url']; ?>/PPT/img/layout2.gif" /><br /><center> <input name="display_themecolumns" type="radio" value="2" <?php if(get_option("display_themecolumns") =="2" || get_option("display_themecolumns") =="" ){ print "checked";} ?> />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</center></td> <td style="width:150px;"><img src="<?php echo $GLOBALS['template_url']; ?>/PPT/img/layout3.gif" /><br /><center> <input name="display_themecolumns" type="radio" value="3" <?php if(get_option("display_themecolumns") =="3"){ print "checked";} ?> />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</center> </td> </tr> </table> </td><td class="forminp"><img src="<?php echo IMAGE_PATH; ?>/help1/c4.png"></td></tr> <?php /***************************************** */ ?> <tr class="mainrow"><td></td> <td class="forminp"> <p><b>Footer Text</b></p> <textarea name="adminArray[footer_text]" type="text" style="width:240px;height:150px;"><?php echo stripslashes(get_option("footer_text")); ?></textarea><br /> <small>This will be added to the bottom of your website.</small> </td><td class="forminp"><img src="<?php echo IMAGE_PATH; ?>/help1/a16.png"></td></tr> <?php /***************************************** */ ?> <tr> <td colspan="3"><p><input class="premiumpress_button" type="submit" value="<?php _e('Save changes','cp')?>" style="color:white;" /></p></td> </tr> </table> </div> <div id="premiumpress_tab6" class="content"> <table class="maintable" style="background:white;"> <?php /***************************************** */ ?> <tr class="mainrow"><td></td><td class="forminp"> <p><b>Website Categories Box</b></p> <select name="adminArray[display_homecats]" style="width: 240px; font-size:14px;"> <option value="yes" <?php if(get_option("display_homecats") =="yes"){ print "selected";} ?>>Show</option> <option value="no" <?php if(get_option("display_homecats") =="no"){ print "selected";} ?>>Hide</option> </select><br /> <small>Show/Hide the home page categories area.</small> </td><td class="forminp"><img src="<?php echo IMAGE_PATH; ?>/help1/a1.png"></td></tr> <?php /***************************************** */ ?> <?php if(get_option("display_homecats") =="yes"){ ?> <tr class="mainrow"><td></td><td class="forminp"> <p><b>Order Categories By </b></p> <select name="adminArray[display_homecats_orderby]" style="width: 240px; font-size:14px;"> <option value="id" <?php if(get_option("display_homecats_orderby") =="id"){ print "selected";} ?>>ID (Ascending Order)</option> <option value="id&order=desc" <?php if(get_option("display_homecats_orderby") =="id&order=desc"){ print "selected";} ?>>ID (Descending Order)</option> <option value="name" <?php if(get_option("display_homecats_orderby") =="name"){ print "selected";} ?>>Name (Ascending Order)</option> <option value="name&order=desc" <?php if(get_option("display_homecats_orderby") =="name&order=desc"){ print "selected";} ?>>Name (Descending Order)</option> <option value="slug" <?php if(get_option("display_homecats_orderby") =="slug"){ print "selected";} ?>>Slug (Ascending Order)</option> <option value="slug&order=desc" <?php if(get_option("display_homecats_orderby") =="slug&order=desc"){ print "selected";} ?>>Slug (Descending Order)</option> <option value="count" <?php if(get_option("display_homecats_orderby") =="count"){ print "selected";} ?>>Count (Ascending Order)</option> <option value="count&order=desc" <?php if(get_option("display_homecats_orderby") =="count&order=desc"){ print "selected";} ?>>Count (Descending Order)</option> <!-- <option value="group" <?php if(get_option("display_homecats_orderby") =="group"){ print "selected";} ?>>Group (Ascending Order)</option> <option value="group&order=desc" <?php if(get_option("display_homecats_orderby") =="group&order=desc"){ print "selected";} ?>>Group (Descending Order)</option>--> </select><br /> <small>select in what order to display the categories.</small> </td><td class="forminp"><img src="<?php echo IMAGE_PATH; ?>/help1/a2.png"></td></tr> <?php /***************************************** */ ?> <tr class="mainrow"> <td></td> <td class="forminp"> <p><b>Display Sub Categories</b></p> <select name="adminArray[display_50_subcategories]" style="width: 240px; font-size:14px;"> <option value="yes" <?php if(get_option("display_50_subcategories") =="yes"){ print "selected";} ?>>Show</option> <option value="no" <?php if(get_option("display_50_subcategories") =="no"){ print "selected";} ?>>Hide</option> </select><br /> <small>Show/Hide the list of sub categories under the main category link.</small> </td><td class="forminp"><img src="<?php echo IMAGE_PATH; ?>/help1/a3.png"></td></tr> <?php } ?> <tr class="mainrow"><td></td><td class="forminp"> <b>Home Page Image</b> <p style="width: 240px;"><input type="checkbox" class="checkbox" name="display_featured_image_enable" value="1" <?php if(get_option("display_featured_image_enable") =="1"){ print "checked";} ?> /> Enable Featured Image</p><br /> <small>Add your own image to the front page</small> <?php if(get_option("display_featured_image_enable") =="1"){ ?> <b>Featured Image URL</b><br /> <input name="adminArray[display_featured_image_url]" type="text" style="width: 240px; font-size:14px;" value="<?php echo get_option("display_featured_image_url"); ?>" /><br /> <small>Enter the full URL for the image you would like to display.</small> <br /><b>Featured Image Link URL</b><br /> <input name="adminArray[display_featured_image_link]" type="text" style="width: 240px; font-size:14px;" value="<?php echo get_option("display_featured_image_link"); ?>" /><br /> <small>Enter the link you would like to have when someone clicks on the image.</small> <?php } ?> </td><td class="forminp"><img src="<?php echo IMAGE_PATH; ?>/help1/a0.png"></td></tr> <tr> <td colspan="3"><p><input class="premiumpress_button" type="submit" value="<?php _e('Save changes','cp')?>" style="color:white;" /></p></td> </tr> </table> </div> <div id="premiumpress_tab2" class="content"> <table class="maintable" style="background:white;"> <tr> <td colspan="4"><p><input class="premiumpress_button" type="submit" value="<?php _e('Save changes','cp')?>" style="color:white;" /></p></td> </tr> </table> </div> <div id="premiumpress_tab3" class="content"> <table class="maintable" style="background:white;"> <?php /***************************************** */ ?> <tr class="mainrow"> <td></td> <td class="forminp"> <p><b>Display Recent Articles</b></p> <select name="adminArray[display_sidebar_articles]" style="width: 240px; font-size:14px;"> <option value="yes" <?php if(get_option("display_sidebar_articles") =="yes"){ print "selected";} ?>>Show</option> <option value="no" <?php if(get_option("display_sidebar_articles") =="no"){ print "selected";} ?>>Hide</option> </select><br /><small>Show/Hide the sidebar articles box.</small> <br /> <input name="adminArray[display_sidebar_articles_count]" value="<?php echo get_option("display_sidebar_articles_count"); ?>" class="txt" style="width:50px; font-size:14px;" type="text"> # Articles </td><td class="forminp"><img src="<?php echo IMAGE_PATH; ?>/help1/a7.png"></td></tr> <?php /***************************************** */ ?> <tr class="mainrow"> <td class="titledesc" valign="top">Featured Stores <br /><br /> <small>Select the stores you wish to be displayed as featured on your sidebar. </small> </td> <td class="forminp" valign="top"> <?php $Maincategories= get_categories('use_desc_for_title=1&hide_empty=0&hierarchical=1'); $Maincatcount = count($Maincategories); $SAVED_DISPLAY = get_option("featured_stores"); $i=0; foreach ($Maincategories as $Maincat) { if($Maincat->parent !=0){ print '<div style="background:#efefef; padding:8px; border:1px solid #ddd; font-size:12px; font-weight:bold; float:left; width:270px; margin-right:10px; "> <input name="featured_stores['.$i.'][ID]" type="checkbox" value="'.$Maincat->cat_ID.'"'; if( isset($SAVED_DISPLAY[$i][ID]) ){ print 'checked="checked"'; } print 'style="margin-right:10px;">' . $Maincat->cat_name.' '; print '<br><small>Order: <input name="featured_stores['.$i.'][ORDER]" type="text" value="'; if(isset($SAVED_DISPLAY[$i][ORDER]) && is_numeric($SAVED_DISPLAY[$i][ORDER]) ){ print $SAVED_DISPLAY[$i][ORDER]; } print '" style="width:30px;font-size:11px;"> </small>'; print ' </div> '; $i++; } } ?> </td> </tr> <tr class="mainrow"><td colspan="3"> <center><a href="widgets.php"><img src="<?php echo $GLOBALS['template_url']; ?>/template_couponpress/images/help1/a23.png"></a></center> </td> <tr> <tr> <td colspan="3"><p><input class="premiumpress_button" type="submit" value="<?php _e('Save changes','cp')?>" style="color:white;" /></p></td> </tr> </table> </div> <div id="premiumpress_tab4" class="content"> <table class="maintable" style="background:white;"> <tr class="mainrow"> <td></td> <td class="forminp"> <p><b>Member information box</b></p> <select name="adminArray[display_sidebar_memberinfo]" style="width: 240px; font-size:14px;"> <option value="yes" <?php if(get_option("display_sidebar_memberinfo") =="yes"){ print "selected";} ?>>Show</option> <option value="no" <?php if(get_option("display_sidebar_memberinfo") =="no"){ print "selected";} ?>>Hide</option> </select><br /><small>Show/Hide the sidebar member information box.</small> <br /> </td><td class="forminp"><img src="<?php echo IMAGE_PATH; ?>/help1/c1.png"></td></tr> <tr class="mainrow"> <td></td> <td class="forminp"> <p><b>Related Coupons</b></p> <select name="adminArray[display_related_coupons]" style="width: 240px; font-size:14px;"> <option value="yes" <?php if(get_option("display_related_coupons") =="yes"){ print "selected";} ?>>Show</option> <option value="no" <?php if(get_option("display_related_coupons") =="no"){ print "selected";} ?>>Hide</option> </select><br /><small>Show/Hide the related coupons on the coupon page.</small> <br /> </td><td class="forminp"><img src="<?php echo IMAGE_PATH; ?>/help1/c4.png"></td></tr> <?php /***************************************** */ ?> <tr class="mainrow"> <td></td><td class="forminp"> <p><b> Google Maps Box</b></p> <select name="adminArray[display_googlemaps]" style="width: 240px; font-size:14px;"> <option value="yes2" <?php if(get_option("display_googlemaps") =="yes2"){ print "selected";} ?>>Show - Interactive Map</option> <option value="no" <?php if(get_option("display_googlemaps") =="no"){ print "selected";} ?>>Hide Google Maps</option> </select><br /> <small><b>Remember</b>Google maps will only display for listings that have a map_location custom field value entered. The interative map requires long/Lat coordinates and isnt recommended for unexperienced users.</small> </td><td class="forminp"><img src="<?php echo IMAGE_PATH; ?>/help1/c2.png"></td></tr> <?php /***************************************** */ ?> <tr> <td colspan="3"><p><input class="premiumpress_button" type="submit" value="Save Changes" style="color:white;" /></p></td> </tr> </table> </div> <div id="premiumpress_tab5" class="content"> <table class="maintable" style="background:white;"> <?php /***************************************** */ ?> <tr class="mainrow"> <td></td><td class="forminp"> <p><b> Enable Home Page Slider </b></p> <select name="adminArray[PPT_slider]" style="width: 240px; font-size:14px;"> <option value="off" <?php if(get_option("PPT_slider") =="off"){ print "selected";} ?>>Disable All Sliders</option> <option value="s1" <?php if(get_option("PPT_slider") =="s1"){ print "selected";} ?>>Featured Content Slider (Full Width)</option> <option value="s2" <?php if(get_option("PPT_slider") =="s2"){ print "selected";} ?>>Half Content Slider</option> </select> <p><b> Slider Style</b></p> <select name="adminArray[PPT_slider_style]" style="width: 240px; font-size:14px;"> <option value="1" <?php if(get_option("PPT_slider_style") =="1"){ print "selected";} ?>>Style 1 (image size: 650x X 265px)</option> <option value="2" <?php if(get_option("PPT_slider_style") =="2"){ print "selected";} ?>>Style 2 (image size: 960x X 360px)</option> <option value="3" <?php if(get_option("PPT_slider_style") =="3"){ print "selected";} ?>>Style 3 (image size: 960x X 360px)</option> <option value="4" <?php if(get_option("PPT_slider_style") =="4"){ print "selected";} ?>>Style 4 (image size: 960x X 360px)</option> <option value="5" <?php if(get_option("PPT_slider_style") =="5"){ print "selected";} ?>>Style 5 (image size: 960x X 360px)</option> </select><br /> <p><b> Slider Content Source</b></p> <select name="adminArray[PPT_slider_items]" style="width: 240px; font-size:14px;"> <option value="manual" <?php if(get_option("PPT_slider_items") =="manual"){ print "selected";} ?>>Manually Configure Slides</option> <option value="featured" <?php if(get_option("PPT_slider_items") =="featured"){ print "selected";} ?>>Use Featured Posts</option> </select><br /> </td><td class="forminp"><img src="<?php echo IMAGE_PATH; ?>/help1/a21.png"></td></tr> <?php /***************************************** */ ?> <tr> <td colspan="3"><p><input class="premiumpress_button" type="submit" value="<?php _e('Save changes','cp')?>" style="color:white;" /></p></td> </tr> </table> </form> <div id="DisplayImages" style="display:none;"></div><input type="hidden" id="searchBox1" name="searchBox1" value="" /> <div id="PPT-sliderbox"></div> <div id="PPT-sliderboxAdd" style="margin-left:20px;display:none"> <form method="post" target="_self" > <input name="admin_slider" type="hidden" value="slider" /> <input type="hidden" id="ppsedit" value="0"> <table width="100%" border="0"> <tr> <td valign="top"><b>Slider Title</b> <br /> <input type="text" name="s1" id="pps1" style="width: 200px; font-size:14px;" class="txt" /> </td> <td><b>Title Description</b> <small>(max. 10 words)</small> <br /> <textarea name="s3" id="pps3" style="width: 200px; font-size:14px; height:70px;" class="txt"></textarea> </td> <td><b>Main Description</b> <small>(max. 250 words)</small> <br /> <textarea name="s4" id="pps4" style="width: 200px; font-size:14px; height:70px;" class="txt"></textarea></td> </tr> <tr> <td><b>Slider Image</b> <br/> <input type="text" name="s2" id="pps2" style="width: 200px; font-size:14px;" class="txt" /> <br/><br/> <input type="hidden" value="" name="imgIdblock" id="imgIdblock" /> <script type="text/javascript"> function ChangeImgBlock(divname){ document.getElementById("imgIdblock").value = divname; } jQuery(document).ready(function() { jQuery('#upload_sliderimage').click(function() { ChangeImgBlock('pps2'); formfield = jQuery('#pps2').attr('name'); tb_show('', <?php if(defined('MULTISITE') && MULTISITE != false){ ?>'admin.php?page=images&amp;tab=nw&amp;TB_iframe=true'<?php }else{ ?>'media-upload.php?type=image&amp;TB_iframe=true'<?php } ?>); return false; }); window.send_to_editor = function(html) { imgurl = jQuery('img',html).attr('src'); jQuery('#'+document.getElementById("imgIdblock").value).val(imgurl); tb_remove(); } }); </script> <input id="upload_sliderimage" type="button" size="36" name="upload_sliderimage" value="Upload Image" /> <input onClick="toggleLayer('DisplayImages'); add_image_next(0,'<?php echo get_option("imagestorage_path"); ?>','<?php echo get_option("imagestorage_link"); ?>','pps2');" type="button" value="View Images" /> </td> <td valign="top"><b>Slider Clickable Link</b> <br /> <input type="text" name="s5" id="pps5" style="width: 200px; font-size:14px;" class="txt" value="http://" /> </td> <td valign="top"><b>Display Order</b><br /><select id="pps6" name="s6" style="width: 100px; font-size:14px;"><?php $i=1; while($i<20){ echo '<option>'.$i.'</option>'; $i++; } ?></select></td> </tr> <tr> <td colspan="3"><p><input class="premiumpress_button" type="submit" value="Create New Slide" style="color:white;" /></p></td> </tr> </table> </form> </div> <div id="addBtn1" style="display:visible"><a href="javascript:void();" onClick="jQuery('#PPT-sliderboxAdd').show();jQuery('#addBtn1').hide();" class="premiumpress_button" style=" float:right; margin-right:10px;" >Add Slider Item</a></div> <h2 style="margin-left:10px;">Website Slider Items</h2> <p style="margin-left:10px;">Here you can setup and create new items for your website slider.</p> <?php $sliderData = get_option("slider_array"); if(is_array($sliderData) && count($sliderData) > 0 ){ ?> <table id="ct"><thead><tr id="ct_sort"> <th width="90" class="first">Title</th> <th width="100">Short Description</th> <th width="40"class="last">Display Order</th> <th width="40"class="last">Actions</th> </tr></thead><tbody> <?php $sortedSlider = $PPTDesign->array_sort($sliderData, 'order', SORT_ASC); $i=-1; foreach($sortedSlider as $hh => $slide){ ?> <tr id="srow<?php echo $i; ?>"> <td width="90" class="first"><?php echo $slide['s1']; ?></td> <td width="80"><?php echo $slide['s3']; ?></td> <td width="50"><?php echo $slide['order']; ?></td> <td width="80" class="last"> <a href='#' Onclick="EditsliderItem('<?php echo $hh; ?>');jQuery('#PPT-sliderbox').show();" style="padding:5px; background:#dcffe1; border:1px solid #57b564; color:green;"><img src="<?php echo $GLOBALS['template_url']; ?>/images/premiumpress/led-ico/find.png" align="middle"> Edit &nbsp;&nbsp;</a> - <a href='#' Onclick="DeleteSliderItem('<?php echo $hh; ?>');jQuery('#PPT-sliderbox').show();jQuery('#srow<?php echo $i; ?>').hide();" style="padding:5px; background:#ffb9ba; border:1px solid #bd2e2f; color:red;"><img src="<?php echo $GLOBALS['template_url']; ?>/images/premiumpress/led-ico/delete.png" align="middle"> Delete&nbsp;</a></td> </tr> <?php $i++; } ?> </tbody> </table> <br /> <form method="post" target="_self" > <input name="admin_slider" type="hidden" value="reset" /> <input class="premiumpress_button" type="submit" value="Reset Slider (Delete All Slides)" style="color:white;" /> </form> <?php } ?> </div>
magictortoise/voucheroffer
wp-content/themes/couponpress/admin/_ad_couponpress_1.php
PHP
gpl-2.0
22,576
39.679279
367
0.573175
false
# 考勤 ---- 考勤信息查询 <br> http://yun.kqapi.com/Default/Index/index
FlyingRunSnail/myHelloWorld
notebook/vnote/日常工作记录/考勤.md
Markdown
gpl-2.0
78
14.75
40
0.677419
false
/* * linux/arch/arm/kernel/traps.c * * Copyright (C) 1995-2009 Russell King * Fragments that appear the same as linux/arch/i386/kernel/traps.c (C) Linus Torvalds * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. * * 'traps.c' handles hardware exceptions after we have saved some state in * 'linux/arch/arm/lib/traps.S'. Mostly a debugging aid, but will probably * kill the offending process. */ #include <linux/module.h> #include <linux/signal.h> #include <linux/spinlock.h> #include <linux/personality.h> #include <linux/kallsyms.h> #include <linux/delay.h> #include <linux/hardirq.h> #include <linux/init.h> #include <linux/uaccess.h> #include <asm/atomic.h> #include <asm/cacheflush.h> #include <asm/system.h> #include <asm/unistd.h> #include <asm/traps.h> #include <asm/unwind.h> #include "ptrace.h" #include "signal.h" static const char *handler[]= { "prefetch abort", "data abort", "address exception", "interrupt" }; void *vectors_page; #ifdef CONFIG_DEBUG_USER unsigned int user_debug; static int __init user_debug_setup(char *str) { get_option(&str, &user_debug); return 1; } __setup("user_debug=", user_debug_setup); #endif static void dump_mem(const char *, const char *, unsigned long, unsigned long); void dump_backtrace_entry(unsigned long where, unsigned long from, unsigned long frame) { #ifdef CONFIG_KALLSYMS char sym1[KSYM_SYMBOL_LEN], sym2[KSYM_SYMBOL_LEN]; sprint_symbol(sym1, where); sprint_symbol(sym2, from); printk("[<%08lx>] (%s) from [<%08lx>] (%s)\n", where, sym1, from, sym2); #else printk("Function entered at [<%08lx>] from [<%08lx>]\n", where, from); #endif if (in_exception_text(where)) dump_mem("", "Exception stack", frame + 4, frame + 4 + sizeof(struct pt_regs)); } #ifndef CONFIG_ARM_UNWIND /* * Stack pointers should always be within the kernels view of * physical memory. If it is not there, then we can't dump * out any information relating to the stack. */ static int verify_stack(unsigned long sp) { if (sp < PAGE_OFFSET || (sp > (unsigned long)high_memory && high_memory != NULL)) return -EFAULT; return 0; } #endif /* * Dump out the contents of some memory nicely... */ static void dump_mem(const char *lvl, const char *str, unsigned long bottom, unsigned long top) { unsigned long first; mm_segment_t fs; int i; /* * We need to switch to kernel mode so that we can use __get_user * to safely read from kernel space. Note that we now dump the * code first, just in case the backtrace kills us. */ fs = get_fs(); set_fs(KERNEL_DS); printk("%s%s(0x%08lx to 0x%08lx)\n", lvl, str, bottom, top); for (first = bottom & ~31; first < top; first += 32) { unsigned long p; char str[sizeof(" 12345678") * 8 + 1]; memset(str, ' ', sizeof(str)); str[sizeof(str) - 1] = '\0'; for (p = first, i = 0; i < 8 && p < top; i++, p += 4) { if (p >= bottom && p < top) { unsigned long val; if (__get_user(val, (unsigned long *)p) == 0) sprintf(str + i * 9, " %08lx", val); else sprintf(str + i * 9, " ????????"); } } printk("%s%04lx:%s\n", lvl, first & 0xffff, str); } set_fs(fs); } static void dump_instr(const char *lvl, struct pt_regs *regs) { unsigned long addr = instruction_pointer(regs); const int thumb = thumb_mode(regs); const int width = thumb ? 4 : 8; mm_segment_t fs; char str[sizeof("00000000 ") * 5 + 2 + 1], *p = str; int i; /* * We need to switch to kernel mode so that we can use __get_user * to safely read from kernel space. Note that we now dump the * code first, just in case the backtrace kills us. */ fs = get_fs(); set_fs(KERNEL_DS); for (i = -4; i < 1; i++) { unsigned int val, bad; if (thumb) bad = __get_user(val, &((u16 *)addr)[i]); else bad = __get_user(val, &((u32 *)addr)[i]); if (!bad) p += sprintf(p, i == 0 ? "(%0*x) " : "%0*x ", width, val); else { p += sprintf(p, "bad PC value"); break; } } printk("%sCode: %s\n", lvl, str); set_fs(fs); } #ifdef CONFIG_ARM_UNWIND static inline void dump_backtrace(struct pt_regs *regs, struct task_struct *tsk) { unwind_backtrace(regs, tsk); } #else static void dump_backtrace(struct pt_regs *regs, struct task_struct *tsk) { unsigned int fp, mode; int ok = 1; printk("Backtrace: "); if (!tsk) tsk = current; if (regs) { fp = regs->ARM_fp; mode = processor_mode(regs); } else if (tsk != current) { fp = thread_saved_fp(tsk); mode = 0x10; } else { asm("mov %0, fp" : "=r" (fp) : : "cc"); mode = 0x10; } if (!fp) { printk("no frame pointer"); ok = 0; } else if (verify_stack(fp)) { printk("invalid frame pointer 0x%08x", fp); ok = 0; } else if (fp < (unsigned long)end_of_stack(tsk)) printk("frame pointer underflow"); printk("\n"); if (ok) c_backtrace(fp, mode); } #endif void dump_stack(void) { dump_backtrace(NULL, NULL); } EXPORT_SYMBOL(dump_stack); void show_stack(struct task_struct *tsk, unsigned long *sp) { dump_backtrace(NULL, tsk); barrier(); } #ifdef CONFIG_PREEMPT #define S_PREEMPT " PREEMPT" #else #define S_PREEMPT "" #endif #ifdef CONFIG_SMP #define S_SMP " SMP" #else #define S_SMP "" #endif static void __die(const char *str, int err, struct thread_info *thread, struct pt_regs *regs) { struct task_struct *tsk = thread->task; static int die_counter; #if defined(CONFIG_MACH_STAR) set_default_loglevel(); /* 20100916 set default loglevel */ #endif printk(KERN_EMERG "Internal error: %s: %x [#%d]" S_PREEMPT S_SMP "\n", str, err, ++die_counter); sysfs_printk_last_file(); print_modules(); __show_regs(regs); printk(KERN_EMERG "Process %.*s (pid: %d, stack limit = 0x%p)\n", TASK_COMM_LEN, tsk->comm, task_pid_nr(tsk), thread + 1); if (!user_mode(regs) || in_interrupt()) { dump_mem(KERN_EMERG, "Stack: ", regs->ARM_sp, THREAD_SIZE + (unsigned long)task_stack_page(tsk)); dump_backtrace(regs, tsk); dump_instr(KERN_EMERG, regs); } } DEFINE_SPINLOCK(die_lock); /* * This function is protected against re-entrancy. */ NORET_TYPE void die(const char *str, struct pt_regs *regs, int err) { struct thread_info *thread = current_thread_info(); oops_enter(); spin_lock_irq(&die_lock); console_verbose(); bust_spinlocks(1); __die(str, err, thread, regs); bust_spinlocks(0); add_taint(TAINT_DIE); spin_unlock_irq(&die_lock); oops_exit(); if (in_interrupt()) panic("Fatal exception in interrupt"); if (panic_on_oops) panic("Fatal exception"); do_exit(SIGSEGV); } void arm_notify_die(const char *str, struct pt_regs *regs, struct siginfo *info, unsigned long err, unsigned long trap) { if (user_mode(regs)) { current->thread.error_code = err; current->thread.trap_no = trap; force_sig_info(info->si_signo, info, current); } else { die(str, regs, err); } } static LIST_HEAD(undef_hook); static DEFINE_SPINLOCK(undef_lock); void register_undef_hook(struct undef_hook *hook) { unsigned long flags; spin_lock_irqsave(&undef_lock, flags); list_add(&hook->node, &undef_hook); spin_unlock_irqrestore(&undef_lock, flags); } void unregister_undef_hook(struct undef_hook *hook) { unsigned long flags; spin_lock_irqsave(&undef_lock, flags); list_del(&hook->node); spin_unlock_irqrestore(&undef_lock, flags); } static int call_undef_hook(struct pt_regs *regs, unsigned int instr) { struct undef_hook *hook; unsigned long flags; int (*fn)(struct pt_regs *regs, unsigned int instr) = NULL; spin_lock_irqsave(&undef_lock, flags); list_for_each_entry(hook, &undef_hook, node) if ((instr & hook->instr_mask) == hook->instr_val && (regs->ARM_cpsr & hook->cpsr_mask) == hook->cpsr_val) fn = hook->fn; spin_unlock_irqrestore(&undef_lock, flags); return fn ? fn(regs, instr) : 1; } asmlinkage void __exception do_undefinstr(struct pt_regs *regs) { unsigned int correction = thumb_mode(regs) ? 2 : 4; unsigned int instr; siginfo_t info; void __user *pc; /* * According to the ARM ARM, PC is 2 or 4 bytes ahead, * depending whether we're in Thumb mode or not. * Correct this offset. */ regs->ARM_pc -= correction; pc = (void __user *)instruction_pointer(regs); if (processor_mode(regs) == SVC_MODE) { instr = *(u32 *) pc; } else if (thumb_mode(regs)) { get_user(instr, (u16 __user *)pc); } else { get_user(instr, (u32 __user *)pc); } if (call_undef_hook(regs, instr) == 0) return; #ifdef CONFIG_DEBUG_USER if (user_debug & UDBG_UNDEFINED) { printk(KERN_INFO "%s (%d): undefined instruction: pc=%p\n", current->comm, task_pid_nr(current), pc); dump_instr(KERN_INFO, regs); } #endif info.si_signo = SIGILL; info.si_errno = 0; info.si_code = ILL_ILLOPC; info.si_addr = pc; arm_notify_die("Oops - undefined instruction", regs, &info, 0, 6); } asmlinkage void do_unexp_fiq (struct pt_regs *regs) { printk("Hmm. Unexpected FIQ received, but trying to continue\n"); printk("You may have a hardware problem...\n"); } /* * bad_mode handles the impossible case in the vectors. If you see one of * these, then it's extremely serious, and could mean you have buggy hardware. * It never returns, and never tries to sync. We hope that we can at least * dump out some state information... */ asmlinkage void bad_mode(struct pt_regs *regs, int reason) { console_verbose(); printk(KERN_CRIT "Bad mode in %s handler detected\n", handler[reason]); die("Oops - bad mode", regs, 0); local_irq_disable(); panic("bad mode"); } static int bad_syscall(int n, struct pt_regs *regs) { struct thread_info *thread = current_thread_info(); siginfo_t info; if (current->personality != PER_LINUX && current->personality != PER_LINUX_32BIT && thread->exec_domain->handler) { thread->exec_domain->handler(n, regs); return regs->ARM_r0; } #ifdef CONFIG_DEBUG_USER if (user_debug & UDBG_SYSCALL) { printk(KERN_ERR "[%d] %s: obsolete system call %08x.\n", task_pid_nr(current), current->comm, n); dump_instr(KERN_ERR, regs); } #endif info.si_signo = SIGILL; info.si_errno = 0; info.si_code = ILL_ILLTRP; info.si_addr = (void __user *)instruction_pointer(regs) - (thumb_mode(regs) ? 2 : 4); arm_notify_die("Oops - bad syscall", regs, &info, n, 0); return regs->ARM_r0; } static inline void do_cache_op(unsigned long start, unsigned long end, int flags) { struct mm_struct *mm = current->active_mm; struct vm_area_struct *vma; if (end < start || flags) return; down_read(&mm->mmap_sem); vma = find_vma(mm, start); if (vma && vma->vm_start < end) { if (start < vma->vm_start) start = vma->vm_start; if (end > vma->vm_end) end = vma->vm_end; up_read(&mm->mmap_sem); flush_cache_user_range(start, end); return; } up_read(&mm->mmap_sem); } /* * Handle all unrecognised system calls. * 0x9f0000 - 0x9fffff are some more esoteric system calls */ #define NR(x) ((__ARM_NR_##x) - __ARM_NR_BASE) asmlinkage int arm_syscall(int no, struct pt_regs *regs) { struct thread_info *thread = current_thread_info(); siginfo_t info; if ((no >> 16) != (__ARM_NR_BASE>> 16)) return bad_syscall(no, regs); switch (no & 0xffff) { case 0: /* branch through 0 */ info.si_signo = SIGSEGV; info.si_errno = 0; info.si_code = SEGV_MAPERR; info.si_addr = NULL; arm_notify_die("branch through zero", regs, &info, 0, 0); return 0; case NR(breakpoint): /* SWI BREAK_POINT */ regs->ARM_pc -= thumb_mode(regs) ? 2 : 4; ptrace_break(current, regs); return regs->ARM_r0; /* * Flush a region from virtual address 'r0' to virtual address 'r1' * _exclusive_. There is no alignment requirement on either address; * user space does not need to know the hardware cache layout. * * r2 contains flags. It should ALWAYS be passed as ZERO until it * is defined to be something else. For now we ignore it, but may * the fires of hell burn in your belly if you break this rule. ;) * * (at a later date, we may want to allow this call to not flush * various aspects of the cache. Passing '0' will guarantee that * everything necessary gets flushed to maintain consistency in * the specified region). */ case NR(cacheflush): do_cache_op(regs->ARM_r0, regs->ARM_r1, regs->ARM_r2); return 0; case NR(usr26): if (!(elf_hwcap & HWCAP_26BIT)) break; regs->ARM_cpsr &= ~MODE32_BIT; return regs->ARM_r0; case NR(usr32): if (!(elf_hwcap & HWCAP_26BIT)) break; regs->ARM_cpsr |= MODE32_BIT; return regs->ARM_r0; case NR(set_tls): thread->tp_value = regs->ARM_r0; #if defined(CONFIG_HAS_TLS_REG) #if defined(CONFIG_TEGRA_ERRATA_657451) BUG_ON(regs->ARM_r0 & 0x1); asm ("mcr p15, 0, %0, c13, c0, 3" : : "r" ((regs->ARM_r0) | ((regs->ARM_r0>>20) & 0x1))); #else asm ("mcr p15, 0, %0, c13, c0, 3" : : "r" (regs->ARM_r0) ); #endif #elif !defined(CONFIG_TLS_REG_EMUL) /* * User space must never try to access this directly. * Expect your app to break eventually if you do so. * The user helper at 0xffff0fe0 must be used instead. * (see entry-armv.S for details) */ *((unsigned int *)0xffff0ff0) = regs->ARM_r0; #endif return 0; #ifdef CONFIG_NEEDS_SYSCALL_FOR_CMPXCHG /* * Atomically store r1 in *r2 if *r2 is equal to r0 for user space. * Return zero in r0 if *MEM was changed or non-zero if no exchange * happened. Also set the user C flag accordingly. * If access permissions have to be fixed up then non-zero is * returned and the operation has to be re-attempted. * * *NOTE*: This is a ghost syscall private to the kernel. Only the * __kuser_cmpxchg code in entry-armv.S should be aware of its * existence. Don't ever use this from user code. */ case NR(cmpxchg): for (;;) { extern void do_DataAbort(unsigned long addr, unsigned int fsr, struct pt_regs *regs); unsigned long val; unsigned long addr = regs->ARM_r2; struct mm_struct *mm = current->mm; pgd_t *pgd; pmd_t *pmd; pte_t *pte; spinlock_t *ptl; regs->ARM_cpsr &= ~PSR_C_BIT; down_read(&mm->mmap_sem); pgd = pgd_offset(mm, addr); if (!pgd_present(*pgd)) goto bad_access; pmd = pmd_offset(pgd, addr); if (!pmd_present(*pmd)) goto bad_access; pte = pte_offset_map_lock(mm, pmd, addr, &ptl); if (!pte_present(*pte) || !pte_dirty(*pte)) { pte_unmap_unlock(pte, ptl); goto bad_access; } val = *(unsigned long *)addr; val -= regs->ARM_r0; if (val == 0) { *(unsigned long *)addr = regs->ARM_r1; regs->ARM_cpsr |= PSR_C_BIT; } pte_unmap_unlock(pte, ptl); up_read(&mm->mmap_sem); return val; bad_access: up_read(&mm->mmap_sem); /* simulate a write access fault */ do_DataAbort(addr, 15 + (1 << 11), regs); } #endif default: /* Calls 9f00xx..9f07ff are defined to return -ENOSYS if not implemented, rather than raising SIGILL. This way the calling program can gracefully determine whether a feature is supported. */ if ((no & 0xffff) <= 0x7ff) return -ENOSYS; break; } #ifdef CONFIG_DEBUG_USER /* * experience shows that these seem to indicate that * something catastrophic has happened */ if (user_debug & UDBG_SYSCALL) { printk("[%d] %s: arm syscall %d\n", task_pid_nr(current), current->comm, no); dump_instr("", regs); if (user_mode(regs)) { __show_regs(regs); c_backtrace(regs->ARM_fp, processor_mode(regs)); } } #endif info.si_signo = SIGILL; info.si_errno = 0; info.si_code = ILL_ILLTRP; info.si_addr = (void __user *)instruction_pointer(regs) - (thumb_mode(regs) ? 2 : 4); arm_notify_die("Oops - bad syscall(2)", regs, &info, no, 0); return 0; } #ifdef CONFIG_TLS_REG_EMUL /* * We might be running on an ARMv6+ processor which should have the TLS * register but for some reason we can't use it, or maybe an SMP system * using a pre-ARMv6 processor (there are apparently a few prototypes like * that in existence) and therefore access to that register must be * emulated. */ static int get_tp_trap(struct pt_regs *regs, unsigned int instr) { int reg = (instr >> 12) & 15; if (reg == 15) return 1; regs->uregs[reg] = current_thread_info()->tp_value; regs->ARM_pc += 4; return 0; } static struct undef_hook arm_mrc_hook = { .instr_mask = 0x0fff0fff, .instr_val = 0x0e1d0f70, .cpsr_mask = PSR_T_BIT, .cpsr_val = 0, .fn = get_tp_trap, }; static int __init arm_mrc_hook_init(void) { register_undef_hook(&arm_mrc_hook); return 0; } late_initcall(arm_mrc_hook_init); #endif void __bad_xchg(volatile void *ptr, int size) { printk("xchg: bad data size: pc 0x%p, ptr 0x%p, size %d\n", __builtin_return_address(0), ptr, size); BUG(); } EXPORT_SYMBOL(__bad_xchg); /* * A data abort trap was taken, but we did not handle the instruction. * Try to abort the user program, or panic if it was the kernel. */ asmlinkage void baddataabort(int code, unsigned long instr, struct pt_regs *regs) { unsigned long addr = instruction_pointer(regs); siginfo_t info; #ifdef CONFIG_DEBUG_USER if (user_debug & UDBG_BADABORT) { printk(KERN_ERR "[%d] %s: bad data abort: code %d instr 0x%08lx\n", task_pid_nr(current), current->comm, code, instr); dump_instr(KERN_ERR, regs); show_pte(current->mm, addr); } #endif info.si_signo = SIGILL; info.si_errno = 0; info.si_code = ILL_ILLOPC; info.si_addr = (void __user *)addr; arm_notify_die("unknown data abort code", regs, &info, instr, 0); } void __attribute__((noreturn)) __bug(const char *file, int line) { printk(KERN_CRIT"kernel BUG at %s:%d!\n", file, line); *(int *)0 = 0; /* Avoid "noreturn function does return" */ for (;;); } EXPORT_SYMBOL(__bug); void __readwrite_bug(const char *fn) { printk("%s called, but not implemented\n", fn); BUG(); } EXPORT_SYMBOL(__readwrite_bug); void __pte_error(const char *file, int line, unsigned long val) { printk("%s:%d: bad pte %08lx.\n", file, line, val); } void __pmd_error(const char *file, int line, unsigned long val) { printk("%s:%d: bad pmd %08lx.\n", file, line, val); } void __pgd_error(const char *file, int line, unsigned long val) { printk("%s:%d: bad pgd %08lx.\n", file, line, val); } asmlinkage void __div0(void) { printk("Division by zero in kernel.\n"); dump_stack(); } EXPORT_SYMBOL(__div0); void abort(void) { BUG(); /* if that doesn't kill us, halt */ panic("Oops failed to kill thread"); } EXPORT_SYMBOL(abort); void __init trap_init(void) { return; } void __init early_trap_init(void) { #if defined(CONFIG_CPU_USE_DOMAINS) unsigned long vectors = CONFIG_VECTORS_BASE; #else unsigned long vectors = (unsigned long)vectors_page; #endif extern char __stubs_start[], __stubs_end[]; extern char __vectors_start[], __vectors_end[]; extern char __kuser_helper_start[], __kuser_helper_end[]; int kuser_sz = __kuser_helper_end - __kuser_helper_start; /* * Copy the vectors, stubs and kuser helpers (in entry-armv.S) * into the vector page, mapped at 0xffff0000, and ensure these * are visible to the instruction stream. */ memcpy((void *)vectors, __vectors_start, __vectors_end - __vectors_start); memcpy((void *)vectors + 0x200, __stubs_start, __stubs_end - __stubs_start); memcpy((void *)vectors + 0x1000 - kuser_sz, __kuser_helper_start, kuser_sz); /* * Copy signal return handlers into the vector page, and * set sigreturn to be a pointer to these. */ memcpy((void *)(vectors + KERN_SIGRETURN_CODE - CONFIG_VECTORS_BASE), sigreturn_codes, sizeof(sigreturn_codes)); memcpy((void *)(vectors + KERN_RESTART_CODE - CONFIG_VECTORS_BASE), syscall_restart_code, sizeof(syscall_restart_code)); flush_icache_range(vectors, vectors + PAGE_SIZE); modify_domain(DOMAIN_USER, DOMAIN_CLIENT); }
Mazout360/lge-kernel-gb
arch/arm/kernel/traps.c
C
gpl-2.0
19,685
24.367268
99
0.654204
false
/* Theme Name: Metaspace Mobile Theme URI: http://metaspace.co Description: Metaspace for Dettol MHSD Version: 1 Author: Metaspace Author URI: http://metaspace.co */
ariniastari/mhsd_dettol
wp-content/themes/metaspace mobile/style.css
CSS
gpl-2.0
165
19.75
38
0.769697
false
<?php /** * @copyright Ilch 2.0 * @package ilch */ namespace Modules\Admin\Models; /** * The layout model class. */ class Layout extends \Ilch\Model { /** * Key of the layout. * * @var string */ protected $key; /** * Name of the layout. * * @var string */ protected $name; /** * Author of the layout. * * @var string */ protected $author; /** * Link of the layout. * * @var string */ protected $link; /** * Description of the layout. * * @var string */ protected $desc; /** * Module of the layout. * * @var string */ protected $modulekey; /** * Gets the key. * * @return string */ public function getKey() { return $this->key; } /** * Sets the key. * * @param string $key */ public function setKey($key) { $this->key = (string)$key; } /** * Gets the name. * * @return string */ public function getName() { return $this->name; } /** * Sets the name. * * @param string $key */ public function setName($name) { $this->name = (string)$name; } /** * Gets the author. * * @return string */ public function getAuthor() { return $this->author; } /** * Sets the author. * * @param string $author */ public function setAuthor($author) { $this->author = (string)$author; } /** * Gets the link. * * @return string */ public function getLink() { return $this->link; } /** * Sets the link. * * @param string $link */ public function setLink($link) { $this->link = (string)$link; } /** * Gets the desc. * * @return string */ public function getDesc() { return $this->desc; } /** * Sets the author. * * @param string $desc */ public function setDesc($desc) { $this->desc = (string)$desc; } /** * Gets the modulekey. * * @return string */ public function getModulekey() { return $this->modulekey; } /** * Sets the modulekey. * * @param string $modulekey */ public function setModulekey($modulekey) { $this->modulekey = (string)$modulekey; } }
jurri/Ilch-2.0
application/modules/admin/models/Layout.php
PHP
gpl-2.0
2,550
13.571429
46
0.453725
false
.NoInherit { font-style: oblique; opacity: 0.5; } .AccessTableHeading { padding-top: 0.5em; padding-bottom: 0.25em; font-weight: bold; } .AccessTable th { white-space: nowrap; } .AccessTable .GroupName { width: 40%; } .AccessTable .Narrow { width: 10%; }
apeisa/UserGroups
UserGroupsHooks.css
CSS
gpl-2.0
263
13.611111
25
0.676806
false
# # # (C) Copyright 2001 The Internet (Aust) Pty Ltd # ACN: 082 081 472 ABN: 83 082 081 472 # All Rights Reserved # # 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. # # Author: Andrew Milton <akm@theinternet.com.au> # $Id: Plugins.py,v 1.5 2004/11/10 14:15:33 akm Exp $ import App, Globals, OFS import string import time from Globals import ImageFile, HTMLFile, HTML, MessageDialog, package_home from OFS.Folder import Folder class PluginRegister: def __init__(self, name, description, pluginClass, pluginStartForm, pluginStartMethod, pluginEditForm=None, pluginEditMethod=None): self.name=name #No Spaces please... self.description=description self.plugin=pluginClass self.manage_addForm=pluginStartForm self.manage_addMethod=pluginStartMethod self.manage_editForm=pluginEditForm self.manage_editMethod=pluginEditMethod class CryptoPluginRegister: def __init__(self, name, crypto, description, pluginMethod): self.name = name #No Spaces please... self.cryptoMethod = crypto self.description = description self.plugin = pluginMethod
denys-duchier/Scolar
ZopeProducts/exUserFolder/Plugins.py
Python
gpl-2.0
1,784
37.782609
76
0.769058
false
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <script src="js/jquery.min.js"></script> <script type="text/javascript" src="js/js.cookie.js"></script> <title>BenchmarkTest00199</title> </head> <body> <form action="/benchmark/BenchmarkTest00199" method="POST" id="FormBenchmarkTest00199"> <div><label>Please explain your answer:</label></div> <br/> <div><textarea rows="4" cols="50" id="vectorArea" name="vectorArea"></textarea></div> <div><label>Any additional note for the reviewer:</label></div> <div><input type="text" id="answer" name="answer"></input></div> <br/> <div><label>An AJAX request will be sent with a header named vector and value:</label> <input type="text" id="vector" name="vector" value="bar" class="safe"></input></div> <div><input type="button" id="login-btn" value="Login" /></div> </form> <div id="ajax-form-msg1"><pre><code class="prettyprint" id="code"></code></pre></div> <script> $('.safe').keypress(function (e) { if (e.which == 13) { $('#login-btn').trigger('click'); return false; } }); $("#login-btn").click(function(){ var formData = $("#FormBenchmarkTest00199").serializeArray(); var URL = $("#FormBenchmarkTest00199").attr("action"); var text = $("#FormBenchmarkTest00199 input[id=vector]").val(); $.ajax({ url : URL, headers: { 'vector': text }, type: "POST", data : formData, success: function(data, textStatus, jqXHR){ $("#code").text(data); }, error: function (jqXHR, textStatus, errorThrown){ console.error(errorThrown);} }); }); </script> </body> </html>
thc202/Benchmark
src/main/webapp/BenchmarkTest00199.html
HTML
gpl-2.0
1,755
36.340426
102
0.635328
false
/* BGP-4, BGP-4+ daemon program Copyright (C) 1996, 97, 98, 99, 2000 Kunihiro Ishiguro This file is part of GNU Kroute. GNU Kroute is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. GNU Kroute is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Kroute; see the file COPYING. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include <kroute.h> #include "prefix.h" #include "thread.h" #include "buffer.h" #include "stream.h" #include "command.h" #include "sockunion.h" #include "network.h" #include "memory.h" #include "filter.h" #include "routemap.h" #include "str.h" #include "log.h" #include "plist.h" #include "linklist.h" #include "workqueue.h" #include "bgpd/bgpd.h" #include "bgpd/bgp_table.h" #include "bgpd/bgp_aspath.h" #include "bgpd/bgp_route.h" #include "bgpd/bgp_dump.h" #include "bgpd/bgp_debug.h" #include "bgpd/bgp_community.h" #include "bgpd/bgp_attr.h" #include "bgpd/bgp_regex.h" #include "bgpd/bgp_clist.h" #include "bgpd/bgp_fsm.h" #include "bgpd/bgp_packet.h" #include "bgpd/bgp_kroute.h" #include "bgpd/bgp_open.h" #include "bgpd/bgp_filter.h" #include "bgpd/bgp_nexthop.h" #include "bgpd/bgp_damp.h" #include "bgpd/bgp_mplsvpn.h" #include "bgpd/bgp_advertise.h" #include "bgpd/bgp_network.h" #include "bgpd/bgp_vty.h" #include "bgpd/bgp_mpath.h" #ifdef HAVE_SNMP #include "bgpd/bgp_snmp.h" #endif /* HAVE_SNMP */ /* BGP process wide configuration. */ static struct bgp_master bgp_master; extern struct in_addr router_id_kroute; /* BGP process wide configuration pointer to export. */ struct bgp_master *bm; /* BGP community-list. */ struct community_list_handler *bgp_clist; /* BGP global flag manipulation. */ int bgp_option_set (int flag) { switch (flag) { case BGP_OPT_NO_FIB: case BGP_OPT_MULTIPLE_INSTANCE: case BGP_OPT_CONFIG_CISCO: SET_FLAG (bm->options, flag); break; default: return BGP_ERR_INVALID_FLAG; } return 0; } int bgp_option_unset (int flag) { switch (flag) { case BGP_OPT_MULTIPLE_INSTANCE: if (listcount (bm->bgp) > 1) return BGP_ERR_MULTIPLE_INSTANCE_USED; /* Fall through. */ case BGP_OPT_NO_FIB: case BGP_OPT_CONFIG_CISCO: UNSET_FLAG (bm->options, flag); break; default: return BGP_ERR_INVALID_FLAG; } return 0; } int bgp_option_check (int flag) { return CHECK_FLAG (bm->options, flag); } /* BGP flag manipulation. */ int bgp_flag_set (struct bgp *bgp, int flag) { SET_FLAG (bgp->flags, flag); return 0; } int bgp_flag_unset (struct bgp *bgp, int flag) { UNSET_FLAG (bgp->flags, flag); return 0; } int bgp_flag_check (struct bgp *bgp, int flag) { return CHECK_FLAG (bgp->flags, flag); } /* Internal function to set BGP structure configureation flag. */ static void bgp_config_set (struct bgp *bgp, int config) { SET_FLAG (bgp->config, config); } static void bgp_config_unset (struct bgp *bgp, int config) { UNSET_FLAG (bgp->config, config); } static int bgp_config_check (struct bgp *bgp, int config) { return CHECK_FLAG (bgp->config, config); } /* Set BGP router identifier. */ int bgp_router_id_set (struct bgp *bgp, struct in_addr *id) { struct peer *peer; struct listnode *node, *nnode; if (bgp_config_check (bgp, BGP_CONFIG_ROUTER_ID) && IPV4_ADDR_SAME (&bgp->router_id, id)) return 0; IPV4_ADDR_COPY (&bgp->router_id, id); bgp_config_set (bgp, BGP_CONFIG_ROUTER_ID); /* Set all peer's local identifier with this value. */ for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) { IPV4_ADDR_COPY (&peer->local_id, id); if (peer->status == Established) { peer->last_reset = PEER_DOWN_RID_CHANGE; bgp_notify_send (peer, BGP_NOTIFY_CEASE, BGP_NOTIFY_CEASE_CONFIG_CHANGE); } } return 0; } /* BGP's cluster-id control. */ int bgp_cluster_id_set (struct bgp *bgp, struct in_addr *cluster_id) { struct peer *peer; struct listnode *node, *nnode; if (bgp_config_check (bgp, BGP_CONFIG_CLUSTER_ID) && IPV4_ADDR_SAME (&bgp->cluster_id, cluster_id)) return 0; IPV4_ADDR_COPY (&bgp->cluster_id, cluster_id); bgp_config_set (bgp, BGP_CONFIG_CLUSTER_ID); /* Clear all IBGP peer. */ for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) { if (peer_sort (peer) != BGP_PEER_IBGP) continue; if (peer->status == Established) { peer->last_reset = PEER_DOWN_CLID_CHANGE; bgp_notify_send (peer, BGP_NOTIFY_CEASE, BGP_NOTIFY_CEASE_CONFIG_CHANGE); } } return 0; } int bgp_cluster_id_unset (struct bgp *bgp) { struct peer *peer; struct listnode *node, *nnode; if (! bgp_config_check (bgp, BGP_CONFIG_CLUSTER_ID)) return 0; bgp->cluster_id.s_addr = 0; bgp_config_unset (bgp, BGP_CONFIG_CLUSTER_ID); /* Clear all IBGP peer. */ for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) { if (peer_sort (peer) != BGP_PEER_IBGP) continue; if (peer->status == Established) { peer->last_reset = PEER_DOWN_CLID_CHANGE; bgp_notify_send (peer, BGP_NOTIFY_CEASE, BGP_NOTIFY_CEASE_CONFIG_CHANGE); } } return 0; } /* time_t value that is monotonicly increasing * and uneffected by adjustments to system clock */ time_t bgp_clock (void) { struct timeval tv; bane_gettime(BANE_CLK_MONOTONIC, &tv); return tv.tv_sec; } /* BGP timer configuration. */ int bgp_timers_set (struct bgp *bgp, u_int32_t keepalive, u_int32_t holdtime) { bgp->default_keepalive = (keepalive < holdtime / 3 ? keepalive : holdtime / 3); bgp->default_holdtime = holdtime; return 0; } int bgp_timers_unset (struct bgp *bgp) { bgp->default_keepalive = BGP_DEFAULT_KEEPALIVE; bgp->default_holdtime = BGP_DEFAULT_HOLDTIME; return 0; } /* BGP confederation configuration. */ int bgp_confederation_id_set (struct bgp *bgp, as_t as) { struct peer *peer; struct listnode *node, *nnode; int already_confed; if (as == 0) return BGP_ERR_INVALID_AS; /* Remember - were we doing confederation before? */ already_confed = bgp_config_check (bgp, BGP_CONFIG_CONFEDERATION); bgp->confed_id = as; bgp_config_set (bgp, BGP_CONFIG_CONFEDERATION); /* If we were doing confederation already, this is just an external AS change. Just Reset EBGP sessions, not CONFED sessions. If we were not doing confederation before, reset all EBGP sessions. */ for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) { /* We're looking for peers who's AS is not local or part of our confederation. */ if (already_confed) { if (peer_sort (peer) == BGP_PEER_EBGP) { peer->local_as = as; if (peer->status == Established) { peer->last_reset = PEER_DOWN_CONFED_ID_CHANGE; bgp_notify_send (peer, BGP_NOTIFY_CEASE, BGP_NOTIFY_CEASE_CONFIG_CHANGE); } else BGP_EVENT_ADD (peer, BGP_Stop); } } else { /* Not doign confederation before, so reset every non-local session */ if (peer_sort (peer) != BGP_PEER_IBGP) { /* Reset the local_as to be our EBGP one */ if (peer_sort (peer) == BGP_PEER_EBGP) peer->local_as = as; if (peer->status == Established) { peer->last_reset = PEER_DOWN_CONFED_ID_CHANGE; bgp_notify_send (peer, BGP_NOTIFY_CEASE, BGP_NOTIFY_CEASE_CONFIG_CHANGE); } else BGP_EVENT_ADD (peer, BGP_Stop); } } } return 0; } int bgp_confederation_id_unset (struct bgp *bgp) { struct peer *peer; struct listnode *node, *nnode; bgp->confed_id = 0; bgp_config_unset (bgp, BGP_CONFIG_CONFEDERATION); for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) { /* We're looking for peers who's AS is not local */ if (peer_sort (peer) != BGP_PEER_IBGP) { peer->local_as = bgp->as; if (peer->status == Established) { peer->last_reset = PEER_DOWN_CONFED_ID_CHANGE; bgp_notify_send (peer, BGP_NOTIFY_CEASE, BGP_NOTIFY_CEASE_CONFIG_CHANGE); } else BGP_EVENT_ADD (peer, BGP_Stop); } } return 0; } /* Is an AS part of the confed or not? */ int bgp_confederation_peers_check (struct bgp *bgp, as_t as) { int i; if (! bgp) return 0; for (i = 0; i < bgp->confed_peers_cnt; i++) if (bgp->confed_peers[i] == as) return 1; return 0; } /* Add an AS to the confederation set. */ int bgp_confederation_peers_add (struct bgp *bgp, as_t as) { struct peer *peer; struct listnode *node, *nnode; if (! bgp) return BGP_ERR_INVALID_BGP; if (bgp->as == as) return BGP_ERR_INVALID_AS; if (bgp_confederation_peers_check (bgp, as)) return -1; if (bgp->confed_peers) bgp->confed_peers = XREALLOC (MTYPE_BGP_CONFED_LIST, bgp->confed_peers, (bgp->confed_peers_cnt + 1) * sizeof (as_t)); else bgp->confed_peers = XMALLOC (MTYPE_BGP_CONFED_LIST, (bgp->confed_peers_cnt + 1) * sizeof (as_t)); bgp->confed_peers[bgp->confed_peers_cnt] = as; bgp->confed_peers_cnt++; if (bgp_config_check (bgp, BGP_CONFIG_CONFEDERATION)) { for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) { if (peer->as == as) { peer->local_as = bgp->as; if (peer->status == Established) { peer->last_reset = PEER_DOWN_CONFED_PEER_CHANGE; bgp_notify_send (peer, BGP_NOTIFY_CEASE, BGP_NOTIFY_CEASE_CONFIG_CHANGE); } else BGP_EVENT_ADD (peer, BGP_Stop); } } } return 0; } /* Delete an AS from the confederation set. */ int bgp_confederation_peers_remove (struct bgp *bgp, as_t as) { int i; int j; struct peer *peer; struct listnode *node, *nnode; if (! bgp) return -1; if (! bgp_confederation_peers_check (bgp, as)) return -1; for (i = 0; i < bgp->confed_peers_cnt; i++) if (bgp->confed_peers[i] == as) for(j = i + 1; j < bgp->confed_peers_cnt; j++) bgp->confed_peers[j - 1] = bgp->confed_peers[j]; bgp->confed_peers_cnt--; if (bgp->confed_peers_cnt == 0) { if (bgp->confed_peers) XFREE (MTYPE_BGP_CONFED_LIST, bgp->confed_peers); bgp->confed_peers = NULL; } else bgp->confed_peers = XREALLOC (MTYPE_BGP_CONFED_LIST, bgp->confed_peers, bgp->confed_peers_cnt * sizeof (as_t)); /* Now reset any peer who's remote AS has just been removed from the CONFED */ if (bgp_config_check (bgp, BGP_CONFIG_CONFEDERATION)) { for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) { if (peer->as == as) { peer->local_as = bgp->confed_id; if (peer->status == Established) { peer->last_reset = PEER_DOWN_CONFED_PEER_CHANGE; bgp_notify_send (peer, BGP_NOTIFY_CEASE, BGP_NOTIFY_CEASE_CONFIG_CHANGE); } else BGP_EVENT_ADD (peer, BGP_Stop); } } } return 0; } /* Local preference configuration. */ int bgp_default_local_preference_set (struct bgp *bgp, u_int32_t local_pref) { if (! bgp) return -1; bgp->default_local_pref = local_pref; return 0; } int bgp_default_local_preference_unset (struct bgp *bgp) { if (! bgp) return -1; bgp->default_local_pref = BGP_DEFAULT_LOCAL_PREF; return 0; } /* If peer is RSERVER_CLIENT in at least one address family and is not member of a peer_group for that family, return 1. Used to check wether the peer is included in list bgp->rsclient. */ int peer_rsclient_active (struct peer *peer) { int i; int j; for (i=AFI_IP; i < AFI_MAX; i++) for (j=SAFI_UNICAST; j < SAFI_MAX; j++) if (CHECK_FLAG(peer->af_flags[i][j], PEER_FLAG_RSERVER_CLIENT) && ! peer->af_group[i][j]) return 1; return 0; } /* Peer comparison function for sorting. */ static int peer_cmp (struct peer *p1, struct peer *p2) { return sockunion_cmp (&p1->su, &p2->su); } int peer_af_flag_check (struct peer *peer, afi_t afi, safi_t safi, u_int32_t flag) { return CHECK_FLAG (peer->af_flags[afi][safi], flag); } /* Reset all address family specific configuration. */ static void peer_af_flag_reset (struct peer *peer, afi_t afi, safi_t safi) { int i; struct bgp_filter *filter; char orf_name[BUFSIZ]; filter = &peer->filter[afi][safi]; /* Clear neighbor filter and route-map */ for (i = FILTER_IN; i < FILTER_MAX; i++) { if (filter->dlist[i].name) { free (filter->dlist[i].name); filter->dlist[i].name = NULL; } if (filter->plist[i].name) { free (filter->plist[i].name); filter->plist[i].name = NULL; } if (filter->aslist[i].name) { free (filter->aslist[i].name); filter->aslist[i].name = NULL; } } for (i = RMAP_IN; i < RMAP_MAX; i++) { if (filter->map[i].name) { free (filter->map[i].name); filter->map[i].name = NULL; } } /* Clear unsuppress map. */ if (filter->usmap.name) free (filter->usmap.name); filter->usmap.name = NULL; filter->usmap.map = NULL; /* Clear neighbor's all address family flags. */ peer->af_flags[afi][safi] = 0; /* Clear neighbor's all address family sflags. */ peer->af_sflags[afi][safi] = 0; /* Clear neighbor's all address family capabilities. */ peer->af_cap[afi][safi] = 0; /* Clear ORF info */ peer->orf_plist[afi][safi] = NULL; sprintf (orf_name, "%s.%d.%d", peer->host, afi, safi); prefix_bgp_orf_remove_all (orf_name); /* Set default neighbor send-community. */ if (! bgp_option_check (BGP_OPT_CONFIG_CISCO)) { SET_FLAG (peer->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY); SET_FLAG (peer->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY); } /* Clear neighbor default_originate_rmap */ if (peer->default_rmap[afi][safi].name) free (peer->default_rmap[afi][safi].name); peer->default_rmap[afi][safi].name = NULL; peer->default_rmap[afi][safi].map = NULL; /* Clear neighbor maximum-prefix */ peer->pmax[afi][safi] = 0; peer->pmax_threshold[afi][safi] = MAXIMUM_PREFIX_THRESHOLD_DEFAULT; } /* peer global config reset */ static void peer_global_config_reset (struct peer *peer) { peer->weight = 0; peer->change_local_as = 0; peer->ttl = (peer_sort (peer) == BGP_PEER_IBGP ? 255 : 1); if (peer->update_source) { sockunion_free (peer->update_source); peer->update_source = NULL; } if (peer->update_if) { XFREE (MTYPE_PEER_UPDATE_SOURCE, peer->update_if); peer->update_if = NULL; } if (peer_sort (peer) == BGP_PEER_IBGP) peer->v_routeadv = BGP_DEFAULT_IBGP_ROUTEADV; else peer->v_routeadv = BGP_DEFAULT_EBGP_ROUTEADV; peer->flags = 0; peer->config = 0; peer->holdtime = 0; peer->keepalive = 0; peer->connect = 0; peer->v_connect = BGP_DEFAULT_CONNECT_RETRY; } /* Check peer's AS number and determin is this peer IBGP or EBGP */ int peer_sort (struct peer *peer) { struct bgp *bgp; bgp = peer->bgp; /* Peer-group */ if (CHECK_FLAG (peer->sflags, PEER_STATUS_GROUP)) { if (peer->as) return (bgp->as == peer->as ? BGP_PEER_IBGP : BGP_PEER_EBGP); else { struct peer *peer1; peer1 = listnode_head (peer->group->peer); if (peer1) return (peer1->local_as == peer1->as ? BGP_PEER_IBGP : BGP_PEER_EBGP); } return BGP_PEER_INTERNAL; } /* Normal peer */ if (bgp && CHECK_FLAG (bgp->config, BGP_CONFIG_CONFEDERATION)) { if (peer->local_as == 0) return BGP_PEER_INTERNAL; if (peer->local_as == peer->as) { if (peer->local_as == bgp->confed_id) return BGP_PEER_EBGP; else return BGP_PEER_IBGP; } if (bgp_confederation_peers_check (bgp, peer->as)) return BGP_PEER_CONFED; return BGP_PEER_EBGP; } else { return (peer->local_as == 0 ? BGP_PEER_INTERNAL : peer->local_as == peer->as ? BGP_PEER_IBGP : BGP_PEER_EBGP); } } static void peer_free (struct peer *peer) { assert (peer->status == Deleted); bgp_unlock(peer->bgp); /* this /ought/ to have been done already through bgp_stop earlier, * but just to be sure.. */ bgp_timer_set (peer); BGP_READ_OFF (peer->t_read); BGP_WRITE_OFF (peer->t_write); BGP_EVENT_FLUSH (peer); if (peer->desc) XFREE (MTYPE_PEER_DESC, peer->desc); /* Free allocated host character. */ if (peer->host) XFREE (MTYPE_BGP_PEER_HOST, peer->host); /* Update source configuration. */ if (peer->update_source) sockunion_free (peer->update_source); if (peer->update_if) XFREE (MTYPE_PEER_UPDATE_SOURCE, peer->update_if); if (peer->clear_node_queue) work_queue_free (peer->clear_node_queue); bgp_sync_delete (peer); memset (peer, 0, sizeof (struct peer)); XFREE (MTYPE_BGP_PEER, peer); } /* increase reference count on a struct peer */ struct peer * peer_lock (struct peer *peer) { assert (peer && (peer->lock >= 0)); peer->lock++; return peer; } /* decrease reference count on a struct peer * struct peer is freed and NULL returned if last reference */ struct peer * peer_unlock (struct peer *peer) { assert (peer && (peer->lock > 0)); peer->lock--; if (peer->lock == 0) { #if 0 zlog_debug ("unlocked and freeing"); zlog_backtrace (LOG_DEBUG); #endif peer_free (peer); return NULL; } #if 0 if (peer->lock == 1) { zlog_debug ("unlocked to 1"); zlog_backtrace (LOG_DEBUG); } #endif return peer; } /* Allocate new peer object, implicitely locked. */ static struct peer * peer_new (struct bgp *bgp) { afi_t afi; safi_t safi; struct peer *peer; struct servent *sp; /* bgp argument is absolutely required */ assert (bgp); if (!bgp) return NULL; /* Allocate new peer. */ peer = XCALLOC (MTYPE_BGP_PEER, sizeof (struct peer)); /* Set default value. */ peer->fd = -1; peer->v_start = BGP_INIT_START_TIMER; peer->v_connect = BGP_DEFAULT_CONNECT_RETRY; peer->v_asorig = BGP_DEFAULT_ASORIGINATE; peer->status = Idle; peer->ostatus = Idle; peer->weight = 0; peer->password = NULL; peer->bgp = bgp; peer = peer_lock (peer); /* initial reference */ bgp_lock (bgp); /* Set default flags. */ for (afi = AFI_IP; afi < AFI_MAX; afi++) for (safi = SAFI_UNICAST; safi < SAFI_MAX; safi++) { if (! bgp_option_check (BGP_OPT_CONFIG_CISCO)) { SET_FLAG (peer->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY); SET_FLAG (peer->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY); } peer->orf_plist[afi][safi] = NULL; } SET_FLAG (peer->sflags, PEER_STATUS_CAPABILITY_OPEN); /* Create buffers. */ peer->ibuf = stream_new (BGP_MAX_PACKET_SIZE); peer->obuf = stream_fifo_new (); peer->work = stream_new (BGP_MAX_PACKET_SIZE); bgp_sync_init (peer); /* Get service port number. */ sp = getservbyname ("bgp", "tcp"); peer->port = (sp == NULL) ? BGP_PORT_DEFAULT : ntohs (sp->s_port); return peer; } /* Create new BGP peer. */ static struct peer * peer_create (union sockunion *su, struct bgp *bgp, as_t local_as, as_t remote_as, afi_t afi, safi_t safi) { int active; struct peer *peer; char buf[SU_ADDRSTRLEN]; peer = peer_new (bgp); peer->su = *su; peer->local_as = local_as; peer->as = remote_as; peer->local_id = bgp->router_id; peer->v_holdtime = bgp->default_holdtime; peer->v_keepalive = bgp->default_keepalive; if (peer_sort (peer) == BGP_PEER_IBGP) peer->v_routeadv = BGP_DEFAULT_IBGP_ROUTEADV; else peer->v_routeadv = BGP_DEFAULT_EBGP_ROUTEADV; peer = peer_lock (peer); /* bgp peer list reference */ listnode_add_sort (bgp->peer, peer); active = peer_active (peer); if (afi && safi) peer->afc[afi][safi] = 1; /* Last read and reset time set */ peer->readtime = peer->resettime = bgp_clock (); /* Default TTL set. */ peer->ttl = (peer_sort (peer) == BGP_PEER_IBGP ? 255 : 1); /* Make peer's address string. */ sockunion2str (su, buf, SU_ADDRSTRLEN); peer->host = XSTRDUP (MTYPE_BGP_PEER_HOST, buf); /* Set up peer's events and timers. */ if (! active && peer_active (peer)) bgp_timer_set (peer); return peer; } /* Make accept BGP peer. Called from bgp_accept (). */ struct peer * peer_create_accept (struct bgp *bgp) { struct peer *peer; peer = peer_new (bgp); peer = peer_lock (peer); /* bgp peer list reference */ listnode_add_sort (bgp->peer, peer); return peer; } /* Change peer's AS number. */ static void peer_as_change (struct peer *peer, as_t as) { int type; /* Stop peer. */ if (! CHECK_FLAG (peer->sflags, PEER_STATUS_GROUP)) { if (peer->status == Established) { peer->last_reset = PEER_DOWN_REMOTE_AS_CHANGE; bgp_notify_send (peer, BGP_NOTIFY_CEASE, BGP_NOTIFY_CEASE_CONFIG_CHANGE); } else BGP_EVENT_ADD (peer, BGP_Stop); } type = peer_sort (peer); peer->as = as; if (bgp_config_check (peer->bgp, BGP_CONFIG_CONFEDERATION) && ! bgp_confederation_peers_check (peer->bgp, as) && peer->bgp->as != as) peer->local_as = peer->bgp->confed_id; else peer->local_as = peer->bgp->as; /* Advertisement-interval reset */ if (peer_sort (peer) == BGP_PEER_IBGP) peer->v_routeadv = BGP_DEFAULT_IBGP_ROUTEADV; else peer->v_routeadv = BGP_DEFAULT_EBGP_ROUTEADV; /* TTL reset */ if (peer_sort (peer) == BGP_PEER_IBGP) peer->ttl = 255; else if (type == BGP_PEER_IBGP) peer->ttl = 1; /* reflector-client reset */ if (peer_sort (peer) != BGP_PEER_IBGP) { UNSET_FLAG (peer->af_flags[AFI_IP][SAFI_UNICAST], PEER_FLAG_REFLECTOR_CLIENT); UNSET_FLAG (peer->af_flags[AFI_IP][SAFI_MULTICAST], PEER_FLAG_REFLECTOR_CLIENT); UNSET_FLAG (peer->af_flags[AFI_IP][SAFI_MPLS_VPN], PEER_FLAG_REFLECTOR_CLIENT); UNSET_FLAG (peer->af_flags[AFI_IP6][SAFI_UNICAST], PEER_FLAG_REFLECTOR_CLIENT); UNSET_FLAG (peer->af_flags[AFI_IP6][SAFI_MULTICAST], PEER_FLAG_REFLECTOR_CLIENT); } /* local-as reset */ if (peer_sort (peer) != BGP_PEER_EBGP) { peer->change_local_as = 0; UNSET_FLAG (peer->flags, PEER_FLAG_LOCAL_AS_NO_PREPEND); } } /* If peer does not exist, create new one. If peer already exists, set AS number to the peer. */ int peer_remote_as (struct bgp *bgp, union sockunion *su, as_t *as, afi_t afi, safi_t safi) { struct peer *peer; as_t local_as; peer = peer_lookup (bgp, su); if (peer) { /* When this peer is a member of peer-group. */ if (peer->group) { if (peer->group->conf->as) { /* Return peer group's AS number. */ *as = peer->group->conf->as; return BGP_ERR_PEER_GROUP_MEMBER; } if (peer_sort (peer->group->conf) == BGP_PEER_IBGP) { if (bgp->as != *as) { *as = peer->as; return BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT; } } else { if (bgp->as == *as) { *as = peer->as; return BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT; } } } /* Existing peer's AS number change. */ if (peer->as != *as) peer_as_change (peer, *as); } else { /* If the peer is not part of our confederation, and its not an iBGP peer then spoof the source AS */ if (bgp_config_check (bgp, BGP_CONFIG_CONFEDERATION) && ! bgp_confederation_peers_check (bgp, *as) && bgp->as != *as) local_as = bgp->confed_id; else local_as = bgp->as; /* If this is IPv4 unicast configuration and "no bgp default ipv4-unicast" is specified. */ if (bgp_flag_check (bgp, BGP_FLAG_NO_DEFAULT_IPV4) && afi == AFI_IP && safi == SAFI_UNICAST) peer = peer_create (su, bgp, local_as, *as, 0, 0); else peer = peer_create (su, bgp, local_as, *as, afi, safi); } return 0; } /* Activate the peer or peer group for specified AFI and SAFI. */ int peer_activate (struct peer *peer, afi_t afi, safi_t safi) { int active; if (peer->afc[afi][safi]) return 0; /* Activate the address family configuration. */ if (CHECK_FLAG (peer->sflags, PEER_STATUS_GROUP)) peer->afc[afi][safi] = 1; else { active = peer_active (peer); peer->afc[afi][safi] = 1; if (! active && peer_active (peer)) bgp_timer_set (peer); else { if (peer->status == Established) { if (CHECK_FLAG (peer->cap, PEER_CAP_DYNAMIC_RCV)) { peer->afc_adv[afi][safi] = 1; bgp_capability_send (peer, afi, safi, CAPABILITY_CODE_MP, CAPABILITY_ACTION_SET); if (peer->afc_recv[afi][safi]) { peer->afc_nego[afi][safi] = 1; bgp_announce_route (peer, afi, safi); } } else { peer->last_reset = PEER_DOWN_AF_ACTIVATE; bgp_notify_send (peer, BGP_NOTIFY_CEASE, BGP_NOTIFY_CEASE_CONFIG_CHANGE); } } } } return 0; } int peer_deactivate (struct peer *peer, afi_t afi, safi_t safi) { struct peer_group *group; struct peer *peer1; struct listnode *node, *nnode; if (CHECK_FLAG (peer->sflags, PEER_STATUS_GROUP)) { group = peer->group; for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer1)) { if (peer1->af_group[afi][safi]) return BGP_ERR_PEER_GROUP_MEMBER_EXISTS; } } else { if (peer->af_group[afi][safi]) return BGP_ERR_PEER_BELONGS_TO_GROUP; } if (! peer->afc[afi][safi]) return 0; /* De-activate the address family configuration. */ peer->afc[afi][safi] = 0; peer_af_flag_reset (peer, afi, safi); if (! CHECK_FLAG (peer->sflags, PEER_STATUS_GROUP)) { if (peer->status == Established) { if (CHECK_FLAG (peer->cap, PEER_CAP_DYNAMIC_RCV)) { peer->afc_adv[afi][safi] = 0; peer->afc_nego[afi][safi] = 0; if (peer_active_nego (peer)) { bgp_capability_send (peer, afi, safi, CAPABILITY_CODE_MP, CAPABILITY_ACTION_UNSET); bgp_clear_route (peer, afi, safi, BGP_CLEAR_ROUTE_NORMAL); peer->pcount[afi][safi] = 0; } else { peer->last_reset = PEER_DOWN_NEIGHBOR_DELETE; bgp_notify_send (peer, BGP_NOTIFY_CEASE, BGP_NOTIFY_CEASE_CONFIG_CHANGE); } } else { peer->last_reset = PEER_DOWN_NEIGHBOR_DELETE; bgp_notify_send (peer, BGP_NOTIFY_CEASE, BGP_NOTIFY_CEASE_CONFIG_CHANGE); } } } return 0; } static void peer_nsf_stop (struct peer *peer) { afi_t afi; safi_t safi; UNSET_FLAG (peer->sflags, PEER_STATUS_NSF_WAIT); UNSET_FLAG (peer->sflags, PEER_STATUS_NSF_MODE); for (afi = AFI_IP ; afi < AFI_MAX ; afi++) for (safi = SAFI_UNICAST ; safi < SAFI_RESERVED_3 ; safi++) peer->nsf[afi][safi] = 0; if (peer->t_gr_restart) { BGP_TIMER_OFF (peer->t_gr_restart); if (BGP_DEBUG (events, EVENTS)) zlog_debug ("%s graceful restart timer stopped", peer->host); } if (peer->t_gr_stale) { BGP_TIMER_OFF (peer->t_gr_stale); if (BGP_DEBUG (events, EVENTS)) zlog_debug ("%s graceful restart stalepath timer stopped", peer->host); } bgp_clear_route_all (peer); } /* Delete peer from confguration. * * The peer is moved to a dead-end "Deleted" neighbour-state, to allow * it to "cool off" and refcounts to hit 0, at which state it is freed. * * This function /should/ take care to be idempotent, to guard against * it being called multiple times through stray events that come in * that happen to result in this function being called again. That * said, getting here for a "Deleted" peer is a bug in the neighbour * FSM. */ int peer_delete (struct peer *peer) { int i; afi_t afi; safi_t safi; struct bgp *bgp; struct bgp_filter *filter; struct listnode *pn; assert (peer->status != Deleted); bgp = peer->bgp; if (CHECK_FLAG (peer->sflags, PEER_STATUS_NSF_WAIT)) peer_nsf_stop (peer); /* If this peer belongs to peer group, clear up the relationship. */ if (peer->group) { if ((pn = listnode_lookup (peer->group->peer, peer))) { peer = peer_unlock (peer); /* group->peer list reference */ list_delete_node (peer->group->peer, pn); } peer->group = NULL; } /* Withdraw all information from routing table. We can not use * BGP_EVENT_ADD (peer, BGP_Stop) at here. Because the event is * executed after peer structure is deleted. */ peer->last_reset = PEER_DOWN_NEIGHBOR_DELETE; bgp_stop (peer); bgp_fsm_change_status (peer, Deleted); /* Password configuration */ if (peer->password) { XFREE (MTYPE_PEER_PASSWORD, peer->password); peer->password = NULL; if (! CHECK_FLAG (peer->sflags, PEER_STATUS_GROUP)) bgp_md5_set (peer); } bgp_timer_set (peer); /* stops all timers for Deleted */ /* Delete from all peer list. */ if (! CHECK_FLAG (peer->sflags, PEER_STATUS_GROUP) && (pn = listnode_lookup (bgp->peer, peer))) { peer_unlock (peer); /* bgp peer list reference */ list_delete_node (bgp->peer, pn); } if (peer_rsclient_active (peer) && (pn = listnode_lookup (bgp->rsclient, peer))) { peer_unlock (peer); /* rsclient list reference */ list_delete_node (bgp->rsclient, pn); /* Clear our own rsclient ribs. */ for (afi = AFI_IP; afi < AFI_MAX; afi++) for (safi = SAFI_UNICAST; safi < SAFI_MAX; safi++) if (CHECK_FLAG(peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT)) bgp_clear_route (peer, afi, safi, BGP_CLEAR_ROUTE_MY_RSCLIENT); } /* Free RIB for any family in which peer is RSERVER_CLIENT, and is not member of a peer_group. */ for (afi = AFI_IP; afi < AFI_MAX; afi++) for (safi = SAFI_UNICAST; safi < SAFI_MAX; safi++) if (peer->rib[afi][safi] && ! peer->af_group[afi][safi]) bgp_table_finish (&peer->rib[afi][safi]); /* Buffers. */ if (peer->ibuf) stream_free (peer->ibuf); if (peer->obuf) stream_fifo_free (peer->obuf); if (peer->work) stream_free (peer->work); peer->obuf = NULL; peer->work = peer->ibuf = NULL; /* Local and remote addresses. */ if (peer->su_local) sockunion_free (peer->su_local); if (peer->su_remote) sockunion_free (peer->su_remote); peer->su_local = peer->su_remote = NULL; /* Free filter related memory. */ for (afi = AFI_IP; afi < AFI_MAX; afi++) for (safi = SAFI_UNICAST; safi < SAFI_MAX; safi++) { filter = &peer->filter[afi][safi]; for (i = FILTER_IN; i < FILTER_MAX; i++) { if (filter->dlist[i].name) free (filter->dlist[i].name); if (filter->plist[i].name) free (filter->plist[i].name); if (filter->aslist[i].name) free (filter->aslist[i].name); filter->dlist[i].name = NULL; filter->plist[i].name = NULL; filter->aslist[i].name = NULL; } for (i = RMAP_IN; i < RMAP_MAX; i++) { if (filter->map[i].name) free (filter->map[i].name); filter->map[i].name = NULL; } if (filter->usmap.name) free (filter->usmap.name); if (peer->default_rmap[afi][safi].name) free (peer->default_rmap[afi][safi].name); filter->usmap.name = NULL; peer->default_rmap[afi][safi].name = NULL; } peer_unlock (peer); /* initial reference */ return 0; } static int peer_group_cmp (struct peer_group *g1, struct peer_group *g2) { return strcmp (g1->name, g2->name); } /* If peer is configured at least one address family return 1. */ static int peer_group_active (struct peer *peer) { if (peer->af_group[AFI_IP][SAFI_UNICAST] || peer->af_group[AFI_IP][SAFI_MULTICAST] || peer->af_group[AFI_IP][SAFI_MPLS_VPN] || peer->af_group[AFI_IP6][SAFI_UNICAST] || peer->af_group[AFI_IP6][SAFI_MULTICAST]) return 1; return 0; } /* Peer group cofiguration. */ static struct peer_group * peer_group_new (void) { return (struct peer_group *) XCALLOC (MTYPE_PEER_GROUP, sizeof (struct peer_group)); } static void peer_group_free (struct peer_group *group) { XFREE (MTYPE_PEER_GROUP, group); } struct peer_group * peer_group_lookup (struct bgp *bgp, const char *name) { struct peer_group *group; struct listnode *node, *nnode; for (ALL_LIST_ELEMENTS (bgp->group, node, nnode, group)) { if (strcmp (group->name, name) == 0) return group; } return NULL; } struct peer_group * peer_group_get (struct bgp *bgp, const char *name) { struct peer_group *group; group = peer_group_lookup (bgp, name); if (group) return group; group = peer_group_new (); group->bgp = bgp; group->name = strdup (name); group->peer = list_new (); group->conf = peer_new (bgp); if (! bgp_flag_check (bgp, BGP_FLAG_NO_DEFAULT_IPV4)) group->conf->afc[AFI_IP][SAFI_UNICAST] = 1; group->conf->host = XSTRDUP (MTYPE_BGP_PEER_HOST, name); group->conf->group = group; group->conf->as = 0; group->conf->ttl = 1; group->conf->gtsm_hops = 0; group->conf->v_routeadv = BGP_DEFAULT_EBGP_ROUTEADV; UNSET_FLAG (group->conf->config, PEER_CONFIG_TIMER); UNSET_FLAG (group->conf->config, PEER_CONFIG_CONNECT); group->conf->keepalive = 0; group->conf->holdtime = 0; group->conf->connect = 0; SET_FLAG (group->conf->sflags, PEER_STATUS_GROUP); listnode_add_sort (bgp->group, group); return 0; } static void peer_group2peer_config_copy (struct peer_group *group, struct peer *peer, afi_t afi, safi_t safi) { int in = FILTER_IN; int out = FILTER_OUT; struct peer *conf; struct bgp_filter *pfilter; struct bgp_filter *gfilter; conf = group->conf; pfilter = &peer->filter[afi][safi]; gfilter = &conf->filter[afi][safi]; /* remote-as */ if (conf->as) peer->as = conf->as; /* remote-as */ if (conf->change_local_as) peer->change_local_as = conf->change_local_as; /* TTL */ peer->ttl = conf->ttl; /* GTSM hops */ peer->gtsm_hops = conf->gtsm_hops; /* Weight */ peer->weight = conf->weight; /* peer flags apply */ peer->flags = conf->flags; /* peer af_flags apply */ peer->af_flags[afi][safi] = conf->af_flags[afi][safi]; /* peer config apply */ peer->config = conf->config; /* peer timers apply */ peer->holdtime = conf->holdtime; peer->keepalive = conf->keepalive; peer->connect = conf->connect; if (CHECK_FLAG (conf->config, PEER_CONFIG_CONNECT)) peer->v_connect = conf->connect; else peer->v_connect = BGP_DEFAULT_CONNECT_RETRY; /* advertisement-interval reset */ if (peer_sort (peer) == BGP_PEER_IBGP) peer->v_routeadv = BGP_DEFAULT_IBGP_ROUTEADV; else peer->v_routeadv = BGP_DEFAULT_EBGP_ROUTEADV; /* password apply */ if (peer->password) XFREE (MTYPE_PEER_PASSWORD, peer->password); if (conf->password) peer->password = XSTRDUP (MTYPE_PEER_PASSWORD, conf->password); else peer->password = NULL; bgp_md5_set (peer); /* maximum-prefix */ peer->pmax[afi][safi] = conf->pmax[afi][safi]; peer->pmax_threshold[afi][safi] = conf->pmax_threshold[afi][safi]; peer->pmax_restart[afi][safi] = conf->pmax_restart[afi][safi]; /* allowas-in */ peer->allowas_in[afi][safi] = conf->allowas_in[afi][safi]; /* route-server-client */ if (CHECK_FLAG(conf->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT)) { /* Make peer's RIB point to group's RIB. */ peer->rib[afi][safi] = group->conf->rib[afi][safi]; /* Import policy. */ if (pfilter->map[RMAP_IMPORT].name) free (pfilter->map[RMAP_IMPORT].name); if (gfilter->map[RMAP_IMPORT].name) { pfilter->map[RMAP_IMPORT].name = strdup (gfilter->map[RMAP_IMPORT].name); pfilter->map[RMAP_IMPORT].map = gfilter->map[RMAP_IMPORT].map; } else { pfilter->map[RMAP_IMPORT].name = NULL; pfilter->map[RMAP_IMPORT].map = NULL; } /* Export policy. */ if (gfilter->map[RMAP_EXPORT].name && ! pfilter->map[RMAP_EXPORT].name) { pfilter->map[RMAP_EXPORT].name = strdup (gfilter->map[RMAP_EXPORT].name); pfilter->map[RMAP_EXPORT].map = gfilter->map[RMAP_EXPORT].map; } } /* default-originate route-map */ if (conf->default_rmap[afi][safi].name) { if (peer->default_rmap[afi][safi].name) free (peer->default_rmap[afi][safi].name); peer->default_rmap[afi][safi].name = strdup (conf->default_rmap[afi][safi].name); peer->default_rmap[afi][safi].map = conf->default_rmap[afi][safi].map; } /* update-source apply */ if (conf->update_source) { if (peer->update_source) sockunion_free (peer->update_source); if (peer->update_if) { XFREE (MTYPE_PEER_UPDATE_SOURCE, peer->update_if); peer->update_if = NULL; } peer->update_source = sockunion_dup (conf->update_source); } else if (conf->update_if) { if (peer->update_if) XFREE (MTYPE_PEER_UPDATE_SOURCE, peer->update_if); if (peer->update_source) { sockunion_free (peer->update_source); peer->update_source = NULL; } peer->update_if = XSTRDUP (MTYPE_PEER_UPDATE_SOURCE, conf->update_if); } /* inbound filter apply */ if (gfilter->dlist[in].name && ! pfilter->dlist[in].name) { if (pfilter->dlist[in].name) free (pfilter->dlist[in].name); pfilter->dlist[in].name = strdup (gfilter->dlist[in].name); pfilter->dlist[in].alist = gfilter->dlist[in].alist; } if (gfilter->plist[in].name && ! pfilter->plist[in].name) { if (pfilter->plist[in].name) free (pfilter->plist[in].name); pfilter->plist[in].name = strdup (gfilter->plist[in].name); pfilter->plist[in].plist = gfilter->plist[in].plist; } if (gfilter->aslist[in].name && ! pfilter->aslist[in].name) { if (pfilter->aslist[in].name) free (pfilter->aslist[in].name); pfilter->aslist[in].name = strdup (gfilter->aslist[in].name); pfilter->aslist[in].aslist = gfilter->aslist[in].aslist; } if (gfilter->map[RMAP_IN].name && ! pfilter->map[RMAP_IN].name) { if (pfilter->map[RMAP_IN].name) free (pfilter->map[RMAP_IN].name); pfilter->map[RMAP_IN].name = strdup (gfilter->map[RMAP_IN].name); pfilter->map[RMAP_IN].map = gfilter->map[RMAP_IN].map; } /* outbound filter apply */ if (gfilter->dlist[out].name) { if (pfilter->dlist[out].name) free (pfilter->dlist[out].name); pfilter->dlist[out].name = strdup (gfilter->dlist[out].name); pfilter->dlist[out].alist = gfilter->dlist[out].alist; } else { if (pfilter->dlist[out].name) free (pfilter->dlist[out].name); pfilter->dlist[out].name = NULL; pfilter->dlist[out].alist = NULL; } if (gfilter->plist[out].name) { if (pfilter->plist[out].name) free (pfilter->plist[out].name); pfilter->plist[out].name = strdup (gfilter->plist[out].name); pfilter->plist[out].plist = gfilter->plist[out].plist; } else { if (pfilter->plist[out].name) free (pfilter->plist[out].name); pfilter->plist[out].name = NULL; pfilter->plist[out].plist = NULL; } if (gfilter->aslist[out].name) { if (pfilter->aslist[out].name) free (pfilter->aslist[out].name); pfilter->aslist[out].name = strdup (gfilter->aslist[out].name); pfilter->aslist[out].aslist = gfilter->aslist[out].aslist; } else { if (pfilter->aslist[out].name) free (pfilter->aslist[out].name); pfilter->aslist[out].name = NULL; pfilter->aslist[out].aslist = NULL; } if (gfilter->map[RMAP_OUT].name) { if (pfilter->map[RMAP_OUT].name) free (pfilter->map[RMAP_OUT].name); pfilter->map[RMAP_OUT].name = strdup (gfilter->map[RMAP_OUT].name); pfilter->map[RMAP_OUT].map = gfilter->map[RMAP_OUT].map; } else { if (pfilter->map[RMAP_OUT].name) free (pfilter->map[RMAP_OUT].name); pfilter->map[RMAP_OUT].name = NULL; pfilter->map[RMAP_OUT].map = NULL; } /* RS-client's import/export route-maps. */ if (gfilter->map[RMAP_IMPORT].name) { if (pfilter->map[RMAP_IMPORT].name) free (pfilter->map[RMAP_IMPORT].name); pfilter->map[RMAP_IMPORT].name = strdup (gfilter->map[RMAP_IMPORT].name); pfilter->map[RMAP_IMPORT].map = gfilter->map[RMAP_IMPORT].map; } else { if (pfilter->map[RMAP_IMPORT].name) free (pfilter->map[RMAP_IMPORT].name); pfilter->map[RMAP_IMPORT].name = NULL; pfilter->map[RMAP_IMPORT].map = NULL; } if (gfilter->map[RMAP_EXPORT].name && ! pfilter->map[RMAP_EXPORT].name) { if (pfilter->map[RMAP_EXPORT].name) free (pfilter->map[RMAP_EXPORT].name); pfilter->map[RMAP_EXPORT].name = strdup (gfilter->map[RMAP_EXPORT].name); pfilter->map[RMAP_EXPORT].map = gfilter->map[RMAP_EXPORT].map; } if (gfilter->usmap.name) { if (pfilter->usmap.name) free (pfilter->usmap.name); pfilter->usmap.name = strdup (gfilter->usmap.name); pfilter->usmap.map = gfilter->usmap.map; } else { if (pfilter->usmap.name) free (pfilter->usmap.name); pfilter->usmap.name = NULL; pfilter->usmap.map = NULL; } } /* Peer group's remote AS configuration. */ int peer_group_remote_as (struct bgp *bgp, const char *group_name, as_t *as) { struct peer_group *group; struct peer *peer; struct listnode *node, *nnode; group = peer_group_lookup (bgp, group_name); if (! group) return -1; if (group->conf->as == *as) return 0; /* When we setup peer-group AS number all peer group member's AS number must be updated to same number. */ peer_as_change (group->conf, *as); for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer)) { if (peer->as != *as) peer_as_change (peer, *as); } return 0; } int peer_group_delete (struct peer_group *group) { struct bgp *bgp; struct peer *peer; struct listnode *node, *nnode; bgp = group->bgp; for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer)) { peer->group = NULL; peer_delete (peer); } list_delete (group->peer); free (group->name); group->name = NULL; group->conf->group = NULL; peer_delete (group->conf); /* Delete from all peer_group list. */ listnode_delete (bgp->group, group); peer_group_free (group); return 0; } int peer_group_remote_as_delete (struct peer_group *group) { struct peer *peer; struct listnode *node, *nnode; if (! group->conf->as) return 0; for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer)) { peer->group = NULL; peer_delete (peer); } list_delete_all_node (group->peer); group->conf->as = 0; return 0; } /* Bind specified peer to peer group. */ int peer_group_bind (struct bgp *bgp, union sockunion *su, struct peer_group *group, afi_t afi, safi_t safi, as_t *as) { struct peer *peer; int first_member = 0; /* Check peer group's address family. */ if (! group->conf->afc[afi][safi]) return BGP_ERR_PEER_GROUP_AF_UNCONFIGURED; /* Lookup the peer. */ peer = peer_lookup (bgp, su); /* Create a new peer. */ if (! peer) { if (! group->conf->as) return BGP_ERR_PEER_GROUP_NO_REMOTE_AS; peer = peer_create (su, bgp, bgp->as, group->conf->as, afi, safi); peer->group = group; peer->af_group[afi][safi] = 1; peer = peer_lock (peer); /* group->peer list reference */ listnode_add (group->peer, peer); peer_group2peer_config_copy (group, peer, afi, safi); return 0; } /* When the peer already belongs to peer group, check the consistency. */ if (peer->af_group[afi][safi]) { if (strcmp (peer->group->name, group->name) != 0) return BGP_ERR_PEER_GROUP_CANT_CHANGE; return 0; } /* Check current peer group configuration. */ if (peer_group_active (peer) && strcmp (peer->group->name, group->name) != 0) return BGP_ERR_PEER_GROUP_MISMATCH; if (! group->conf->as) { if (peer_sort (group->conf) != BGP_PEER_INTERNAL && peer_sort (group->conf) != peer_sort (peer)) { if (as) *as = peer->as; return BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT; } if (peer_sort (group->conf) == BGP_PEER_INTERNAL) first_member = 1; } peer->af_group[afi][safi] = 1; peer->afc[afi][safi] = 1; if (! peer->group) { peer->group = group; peer = peer_lock (peer); /* group->peer list reference */ listnode_add (group->peer, peer); } else assert (group && peer->group == group); if (first_member) { /* Advertisement-interval reset */ if (peer_sort (group->conf) == BGP_PEER_IBGP) group->conf->v_routeadv = BGP_DEFAULT_IBGP_ROUTEADV; else group->conf->v_routeadv = BGP_DEFAULT_EBGP_ROUTEADV; /* ebgp-multihop reset */ if (peer_sort (group->conf) == BGP_PEER_IBGP) group->conf->ttl = 255; /* local-as reset */ if (peer_sort (group->conf) != BGP_PEER_EBGP) { group->conf->change_local_as = 0; UNSET_FLAG (peer->flags, PEER_FLAG_LOCAL_AS_NO_PREPEND); } } if (CHECK_FLAG(peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT)) { struct listnode *pn; /* If it's not configured as RSERVER_CLIENT in any other address family, without being member of a peer_group, remove it from list bgp->rsclient.*/ if (! peer_rsclient_active (peer) && (pn = listnode_lookup (bgp->rsclient, peer))) { peer_unlock (peer); /* peer rsclient reference */ list_delete_node (bgp->rsclient, pn); /* Clear our own rsclient rib for this afi/safi. */ bgp_clear_route (peer, afi, safi, BGP_CLEAR_ROUTE_MY_RSCLIENT); } bgp_table_finish (&peer->rib[afi][safi]); /* Import policy. */ if (peer->filter[afi][safi].map[RMAP_IMPORT].name) { free (peer->filter[afi][safi].map[RMAP_IMPORT].name); peer->filter[afi][safi].map[RMAP_IMPORT].name = NULL; peer->filter[afi][safi].map[RMAP_IMPORT].map = NULL; } /* Export policy. */ if (! CHECK_FLAG(group->conf->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT) && peer->filter[afi][safi].map[RMAP_EXPORT].name) { free (peer->filter[afi][safi].map[RMAP_EXPORT].name); peer->filter[afi][safi].map[RMAP_EXPORT].name = NULL; peer->filter[afi][safi].map[RMAP_EXPORT].map = NULL; } } peer_group2peer_config_copy (group, peer, afi, safi); if (peer->status == Established) { peer->last_reset = PEER_DOWN_RMAP_BIND; bgp_notify_send (peer, BGP_NOTIFY_CEASE, BGP_NOTIFY_CEASE_CONFIG_CHANGE); } else BGP_EVENT_ADD (peer, BGP_Stop); return 0; } int peer_group_unbind (struct bgp *bgp, struct peer *peer, struct peer_group *group, afi_t afi, safi_t safi) { if (! peer->af_group[afi][safi]) return 0; if (group != peer->group) return BGP_ERR_PEER_GROUP_MISMATCH; peer->af_group[afi][safi] = 0; peer->afc[afi][safi] = 0; peer_af_flag_reset (peer, afi, safi); if (peer->rib[afi][safi]) peer->rib[afi][safi] = NULL; if (! peer_group_active (peer)) { assert (listnode_lookup (group->peer, peer)); peer_unlock (peer); /* peer group list reference */ listnode_delete (group->peer, peer); peer->group = NULL; if (group->conf->as) { peer_delete (peer); return 0; } peer_global_config_reset (peer); } if (peer->status == Established) { peer->last_reset = PEER_DOWN_RMAP_UNBIND; bgp_notify_send (peer, BGP_NOTIFY_CEASE, BGP_NOTIFY_CEASE_CONFIG_CHANGE); } else BGP_EVENT_ADD (peer, BGP_Stop); return 0; } /* BGP instance creation by `router bgp' commands. */ static struct bgp * bgp_create (as_t *as, const char *name) { struct bgp *bgp; afi_t afi; safi_t safi; if ( (bgp = XCALLOC (MTYPE_BGP, sizeof (struct bgp))) == NULL) return NULL; bgp_lock (bgp); bgp->peer_self = peer_new (bgp); bgp->peer_self->host = XSTRDUP (MTYPE_BGP_PEER_HOST, "Static announcement"); bgp->peer = list_new (); bgp->peer->cmp = (int (*)(void *, void *)) peer_cmp; bgp->group = list_new (); bgp->group->cmp = (int (*)(void *, void *)) peer_group_cmp; bgp->rsclient = list_new (); bgp->rsclient->cmp = (int (*)(void*, void*)) peer_cmp; for (afi = AFI_IP; afi < AFI_MAX; afi++) for (safi = SAFI_UNICAST; safi < SAFI_MAX; safi++) { bgp->route[afi][safi] = bgp_table_init (afi, safi); bgp->aggregate[afi][safi] = bgp_table_init (afi, safi); bgp->rib[afi][safi] = bgp_table_init (afi, safi); bgp->maxpaths[afi][safi].maxpaths_ebgp = BGP_DEFAULT_MAXPATHS; bgp->maxpaths[afi][safi].maxpaths_ibgp = BGP_DEFAULT_MAXPATHS; } bgp->default_local_pref = BGP_DEFAULT_LOCAL_PREF; bgp->default_holdtime = BGP_DEFAULT_HOLDTIME; bgp->default_keepalive = BGP_DEFAULT_KEEPALIVE; bgp->restart_time = BGP_DEFAULT_RESTART_TIME; bgp->stalepath_time = BGP_DEFAULT_STALEPATH_TIME; bgp->as = *as; if (name) bgp->name = strdup (name); return bgp; } /* Return first entry of BGP. */ struct bgp * bgp_get_default (void) { if (bm->bgp->head) return (listgetdata (listhead (bm->bgp))); return NULL; } /* Lookup BGP entry. */ struct bgp * bgp_lookup (as_t as, const char *name) { struct bgp *bgp; struct listnode *node, *nnode; for (ALL_LIST_ELEMENTS (bm->bgp, node, nnode, bgp)) if (bgp->as == as && ((bgp->name == NULL && name == NULL) || (bgp->name && name && strcmp (bgp->name, name) == 0))) return bgp; return NULL; } /* Lookup BGP structure by view name. */ struct bgp * bgp_lookup_by_name (const char *name) { struct bgp *bgp; struct listnode *node, *nnode; for (ALL_LIST_ELEMENTS (bm->bgp, node, nnode, bgp)) if ((bgp->name == NULL && name == NULL) || (bgp->name && name && strcmp (bgp->name, name) == 0)) return bgp; return NULL; } /* Called from VTY commands. */ int bgp_get (struct bgp **bgp_val, as_t *as, const char *name) { struct bgp *bgp; /* Multiple instance check. */ if (bgp_option_check (BGP_OPT_MULTIPLE_INSTANCE)) { if (name) bgp = bgp_lookup_by_name (name); else bgp = bgp_get_default (); /* Already exists. */ if (bgp) { if (bgp->as != *as) { *as = bgp->as; return BGP_ERR_INSTANCE_MISMATCH; } *bgp_val = bgp; return 0; } } else { /* BGP instance name can not be specified for single instance. */ if (name) return BGP_ERR_MULTIPLE_INSTANCE_NOT_SET; /* Get default BGP structure if exists. */ bgp = bgp_get_default (); if (bgp) { if (bgp->as != *as) { *as = bgp->as; return BGP_ERR_AS_MISMATCH; } *bgp_val = bgp; return 0; } } bgp = bgp_create (as, name); bgp_router_id_set(bgp, &router_id_kroute); *bgp_val = bgp; /* Create BGP server socket, if first instance. */ if (list_isempty(bm->bgp)) { if (bgp_socket (bm->port, bm->address) < 0) return BGP_ERR_INVALID_VALUE; } listnode_add (bm->bgp, bgp); return 0; } /* Delete BGP instance. */ int bgp_delete (struct bgp *bgp) { struct peer *peer; struct peer_group *group; struct listnode *node; struct listnode *next; afi_t afi; int i; /* Delete static route. */ bgp_static_delete (bgp); /* Unset redistribution. */ for (afi = AFI_IP; afi < AFI_MAX; afi++) for (i = 0; i < KROUTE_ROUTE_MAX; i++) if (i != KROUTE_ROUTE_BGP) bgp_redistribute_unset (bgp, afi, i); for (ALL_LIST_ELEMENTS (bgp->peer, node, next, peer)) peer_delete (peer); for (ALL_LIST_ELEMENTS (bgp->group, node, next, group)) peer_group_delete (group); assert (listcount (bgp->rsclient) == 0); if (bgp->peer_self) { peer_delete(bgp->peer_self); bgp->peer_self = NULL; } /* Remove visibility via the master list - there may however still be * routes to be processed still referencing the struct bgp. */ listnode_delete (bm->bgp, bgp); if (list_isempty(bm->bgp)) bgp_close (); bgp_unlock(bgp); /* initial reference */ return 0; } static void bgp_free (struct bgp *); void bgp_lock (struct bgp *bgp) { ++bgp->lock; } void bgp_unlock(struct bgp *bgp) { assert(bgp->lock > 0); if (--bgp->lock == 0) bgp_free (bgp); } static void bgp_free (struct bgp *bgp) { afi_t afi; safi_t safi; list_delete (bgp->group); list_delete (bgp->peer); list_delete (bgp->rsclient); if (bgp->name) free (bgp->name); for (afi = AFI_IP; afi < AFI_MAX; afi++) for (safi = SAFI_UNICAST; safi < SAFI_MAX; safi++) { if (bgp->route[afi][safi]) bgp_table_finish (&bgp->route[afi][safi]); if (bgp->aggregate[afi][safi]) bgp_table_finish (&bgp->aggregate[afi][safi]) ; if (bgp->rib[afi][safi]) bgp_table_finish (&bgp->rib[afi][safi]); } XFREE (MTYPE_BGP, bgp); } struct peer * peer_lookup (struct bgp *bgp, union sockunion *su) { struct peer *peer; struct listnode *node, *nnode; if (bgp != NULL) { for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) if (sockunion_same (&peer->su, su) && ! CHECK_FLAG (peer->sflags, PEER_STATUS_ACCEPT_PEER)) return peer; } else if (bm->bgp != NULL) { struct listnode *bgpnode, *nbgpnode; for (ALL_LIST_ELEMENTS (bm->bgp, bgpnode, nbgpnode, bgp)) for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) if (sockunion_same (&peer->su, su) && ! CHECK_FLAG (peer->sflags, PEER_STATUS_ACCEPT_PEER)) return peer; } return NULL; } struct peer * peer_lookup_with_open (union sockunion *su, as_t remote_as, struct in_addr *remote_id, int *as) { struct peer *peer; struct listnode *node; struct listnode *bgpnode; struct bgp *bgp; if (! bm->bgp) return NULL; for (ALL_LIST_ELEMENTS_RO (bm->bgp, bgpnode, bgp)) { for (ALL_LIST_ELEMENTS_RO (bgp->peer, node, peer)) { if (sockunion_same (&peer->su, su) && ! CHECK_FLAG (peer->sflags, PEER_STATUS_ACCEPT_PEER)) { if (peer->as == remote_as && peer->remote_id.s_addr == remote_id->s_addr) return peer; if (peer->as == remote_as) *as = 1; } } for (ALL_LIST_ELEMENTS_RO (bgp->peer, node, peer)) { if (sockunion_same (&peer->su, su) && ! CHECK_FLAG (peer->sflags, PEER_STATUS_ACCEPT_PEER)) { if (peer->as == remote_as && peer->remote_id.s_addr == 0) return peer; if (peer->as == remote_as) *as = 1; } } } return NULL; } /* If peer is configured at least one address family return 1. */ int peer_active (struct peer *peer) { if (peer->afc[AFI_IP][SAFI_UNICAST] || peer->afc[AFI_IP][SAFI_MULTICAST] || peer->afc[AFI_IP][SAFI_MPLS_VPN] || peer->afc[AFI_IP6][SAFI_UNICAST] || peer->afc[AFI_IP6][SAFI_MULTICAST]) return 1; return 0; } /* If peer is negotiated at least one address family return 1. */ int peer_active_nego (struct peer *peer) { if (peer->afc_nego[AFI_IP][SAFI_UNICAST] || peer->afc_nego[AFI_IP][SAFI_MULTICAST] || peer->afc_nego[AFI_IP][SAFI_MPLS_VPN] || peer->afc_nego[AFI_IP6][SAFI_UNICAST] || peer->afc_nego[AFI_IP6][SAFI_MULTICAST]) return 1; return 0; } /* peer_flag_change_type. */ enum peer_change_type { peer_change_none, peer_change_reset, peer_change_reset_in, peer_change_reset_out, }; static void peer_change_action (struct peer *peer, afi_t afi, safi_t safi, enum peer_change_type type) { if (CHECK_FLAG (peer->sflags, PEER_STATUS_GROUP)) return; if (type == peer_change_reset) bgp_notify_send (peer, BGP_NOTIFY_CEASE, BGP_NOTIFY_CEASE_CONFIG_CHANGE); else if (type == peer_change_reset_in) { if (CHECK_FLAG (peer->cap, PEER_CAP_REFRESH_OLD_RCV) || CHECK_FLAG (peer->cap, PEER_CAP_REFRESH_NEW_RCV)) bgp_route_refresh_send (peer, afi, safi, 0, 0, 0); else bgp_notify_send (peer, BGP_NOTIFY_CEASE, BGP_NOTIFY_CEASE_CONFIG_CHANGE); } else if (type == peer_change_reset_out) bgp_announce_route (peer, afi, safi); } struct peer_flag_action { /* Peer's flag. */ u_int32_t flag; /* This flag can be set for peer-group member. */ u_char not_for_member; /* Action when the flag is changed. */ enum peer_change_type type; /* Peer down cause */ u_char peer_down; }; static const struct peer_flag_action peer_flag_action_list[] = { { PEER_FLAG_PASSIVE, 0, peer_change_reset }, { PEER_FLAG_SHUTDOWN, 0, peer_change_reset }, { PEER_FLAG_DONT_CAPABILITY, 0, peer_change_none }, { PEER_FLAG_OVERRIDE_CAPABILITY, 0, peer_change_none }, { PEER_FLAG_STRICT_CAP_MATCH, 0, peer_change_none }, { PEER_FLAG_DYNAMIC_CAPABILITY, 0, peer_change_reset }, { PEER_FLAG_DISABLE_CONNECTED_CHECK, 0, peer_change_reset }, { 0, 0, 0 } }; static const struct peer_flag_action peer_af_flag_action_list[] = { { PEER_FLAG_NEXTHOP_SELF, 1, peer_change_reset_out }, { PEER_FLAG_SEND_COMMUNITY, 1, peer_change_reset_out }, { PEER_FLAG_SEND_EXT_COMMUNITY, 1, peer_change_reset_out }, { PEER_FLAG_SOFT_RECONFIG, 0, peer_change_reset_in }, { PEER_FLAG_REFLECTOR_CLIENT, 1, peer_change_reset }, { PEER_FLAG_RSERVER_CLIENT, 1, peer_change_reset }, { PEER_FLAG_AS_PATH_UNCHANGED, 1, peer_change_reset_out }, { PEER_FLAG_NEXTHOP_UNCHANGED, 1, peer_change_reset_out }, { PEER_FLAG_MED_UNCHANGED, 1, peer_change_reset_out }, { PEER_FLAG_REMOVE_PRIVATE_AS, 1, peer_change_reset_out }, { PEER_FLAG_ALLOWAS_IN, 0, peer_change_reset_in }, { PEER_FLAG_ORF_PREFIX_SM, 1, peer_change_reset }, { PEER_FLAG_ORF_PREFIX_RM, 1, peer_change_reset }, { PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED, 0, peer_change_reset_out }, { 0, 0, 0 } }; /* Proper action set. */ static int peer_flag_action_set (const struct peer_flag_action *action_list, int size, struct peer_flag_action *action, u_int32_t flag) { int i; int found = 0; int reset_in = 0; int reset_out = 0; const struct peer_flag_action *match = NULL; /* Check peer's frag action. */ for (i = 0; i < size; i++) { match = &action_list[i]; if (match->flag == 0) break; if (match->flag & flag) { found = 1; if (match->type == peer_change_reset_in) reset_in = 1; if (match->type == peer_change_reset_out) reset_out = 1; if (match->type == peer_change_reset) { reset_in = 1; reset_out = 1; } if (match->not_for_member) action->not_for_member = 1; } } /* Set peer clear type. */ if (reset_in && reset_out) action->type = peer_change_reset; else if (reset_in) action->type = peer_change_reset_in; else if (reset_out) action->type = peer_change_reset_out; else action->type = peer_change_none; return found; } static void peer_flag_modify_action (struct peer *peer, u_int32_t flag) { if (flag == PEER_FLAG_SHUTDOWN) { if (CHECK_FLAG (peer->flags, flag)) { if (CHECK_FLAG (peer->sflags, PEER_STATUS_NSF_WAIT)) peer_nsf_stop (peer); UNSET_FLAG (peer->sflags, PEER_STATUS_PREFIX_OVERFLOW); if (peer->t_pmax_restart) { BGP_TIMER_OFF (peer->t_pmax_restart); if (BGP_DEBUG (events, EVENTS)) zlog_debug ("%s Maximum-prefix restart timer canceled", peer->host); } if (CHECK_FLAG (peer->sflags, PEER_STATUS_NSF_WAIT)) peer_nsf_stop (peer); if (peer->status == Established) bgp_notify_send (peer, BGP_NOTIFY_CEASE, BGP_NOTIFY_CEASE_ADMIN_SHUTDOWN); else BGP_EVENT_ADD (peer, BGP_Stop); } else { peer->v_start = BGP_INIT_START_TIMER; BGP_EVENT_ADD (peer, BGP_Stop); } } else if (peer->status == Established) { if (flag == PEER_FLAG_DYNAMIC_CAPABILITY) peer->last_reset = PEER_DOWN_CAPABILITY_CHANGE; else if (flag == PEER_FLAG_PASSIVE) peer->last_reset = PEER_DOWN_PASSIVE_CHANGE; else if (flag == PEER_FLAG_DISABLE_CONNECTED_CHECK) peer->last_reset = PEER_DOWN_MULTIHOP_CHANGE; bgp_notify_send (peer, BGP_NOTIFY_CEASE, BGP_NOTIFY_CEASE_CONFIG_CHANGE); } else BGP_EVENT_ADD (peer, BGP_Stop); } /* Change specified peer flag. */ static int peer_flag_modify (struct peer *peer, u_int32_t flag, int set) { int found; int size; struct peer_group *group; struct listnode *node, *nnode; struct peer_flag_action action; memset (&action, 0, sizeof (struct peer_flag_action)); size = sizeof peer_flag_action_list / sizeof (struct peer_flag_action); found = peer_flag_action_set (peer_flag_action_list, size, &action, flag); /* No flag action is found. */ if (! found) return BGP_ERR_INVALID_FLAG; /* Not for peer-group member. */ if (action.not_for_member && peer_group_active (peer)) return BGP_ERR_INVALID_FOR_PEER_GROUP_MEMBER; /* When unset the peer-group member's flag we have to check peer-group configuration. */ if (! set && peer_group_active (peer)) if (CHECK_FLAG (peer->group->conf->flags, flag)) { if (flag == PEER_FLAG_SHUTDOWN) return BGP_ERR_PEER_GROUP_SHUTDOWN; else return BGP_ERR_PEER_GROUP_HAS_THE_FLAG; } /* Flag conflict check. */ if (set && CHECK_FLAG (peer->flags | flag, PEER_FLAG_STRICT_CAP_MATCH) && CHECK_FLAG (peer->flags | flag, PEER_FLAG_OVERRIDE_CAPABILITY)) return BGP_ERR_PEER_FLAG_CONFLICT; if (! CHECK_FLAG (peer->sflags, PEER_STATUS_GROUP)) { if (set && CHECK_FLAG (peer->flags, flag) == flag) return 0; if (! set && ! CHECK_FLAG (peer->flags, flag)) return 0; } if (set) SET_FLAG (peer->flags, flag); else UNSET_FLAG (peer->flags, flag); if (! CHECK_FLAG (peer->sflags, PEER_STATUS_GROUP)) { if (action.type == peer_change_reset) peer_flag_modify_action (peer, flag); return 0; } /* peer-group member updates. */ group = peer->group; for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer)) { if (set && CHECK_FLAG (peer->flags, flag) == flag) continue; if (! set && ! CHECK_FLAG (peer->flags, flag)) continue; if (set) SET_FLAG (peer->flags, flag); else UNSET_FLAG (peer->flags, flag); if (action.type == peer_change_reset) peer_flag_modify_action (peer, flag); } return 0; } int peer_flag_set (struct peer *peer, u_int32_t flag) { return peer_flag_modify (peer, flag, 1); } int peer_flag_unset (struct peer *peer, u_int32_t flag) { return peer_flag_modify (peer, flag, 0); } static int peer_is_group_member (struct peer *peer, afi_t afi, safi_t safi) { if (peer->af_group[afi][safi]) return 1; return 0; } static int peer_af_flag_modify (struct peer *peer, afi_t afi, safi_t safi, u_int32_t flag, int set) { int found; int size; struct listnode *node, *nnode; struct peer_group *group; struct peer_flag_action action; memset (&action, 0, sizeof (struct peer_flag_action)); size = sizeof peer_af_flag_action_list / sizeof (struct peer_flag_action); found = peer_flag_action_set (peer_af_flag_action_list, size, &action, flag); /* No flag action is found. */ if (! found) return BGP_ERR_INVALID_FLAG; /* Adress family must be activated. */ if (! peer->afc[afi][safi]) return BGP_ERR_PEER_INACTIVE; /* Not for peer-group member. */ if (action.not_for_member && peer_is_group_member (peer, afi, safi)) return BGP_ERR_INVALID_FOR_PEER_GROUP_MEMBER; /* Spcecial check for reflector client. */ if (flag & PEER_FLAG_REFLECTOR_CLIENT && peer_sort (peer) != BGP_PEER_IBGP) return BGP_ERR_NOT_INTERNAL_PEER; /* Spcecial check for remove-private-AS. */ if (flag & PEER_FLAG_REMOVE_PRIVATE_AS && peer_sort (peer) == BGP_PEER_IBGP) return BGP_ERR_REMOVE_PRIVATE_AS; /* When unset the peer-group member's flag we have to check peer-group configuration. */ if (! set && peer->af_group[afi][safi]) if (CHECK_FLAG (peer->group->conf->af_flags[afi][safi], flag)) return BGP_ERR_PEER_GROUP_HAS_THE_FLAG; /* When current flag configuration is same as requested one. */ if (! CHECK_FLAG (peer->sflags, PEER_STATUS_GROUP)) { if (set && CHECK_FLAG (peer->af_flags[afi][safi], flag) == flag) return 0; if (! set && ! CHECK_FLAG (peer->af_flags[afi][safi], flag)) return 0; } if (set) SET_FLAG (peer->af_flags[afi][safi], flag); else UNSET_FLAG (peer->af_flags[afi][safi], flag); /* Execute action when peer is established. */ if (! CHECK_FLAG (peer->sflags, PEER_STATUS_GROUP) && peer->status == Established) { if (! set && flag == PEER_FLAG_SOFT_RECONFIG) bgp_clear_adj_in (peer, afi, safi); else { if (flag == PEER_FLAG_REFLECTOR_CLIENT) peer->last_reset = PEER_DOWN_RR_CLIENT_CHANGE; else if (flag == PEER_FLAG_RSERVER_CLIENT) peer->last_reset = PEER_DOWN_RS_CLIENT_CHANGE; else if (flag == PEER_FLAG_ORF_PREFIX_SM) peer->last_reset = PEER_DOWN_CAPABILITY_CHANGE; else if (flag == PEER_FLAG_ORF_PREFIX_RM) peer->last_reset = PEER_DOWN_CAPABILITY_CHANGE; peer_change_action (peer, afi, safi, action.type); } } /* Peer group member updates. */ if (CHECK_FLAG (peer->sflags, PEER_STATUS_GROUP)) { group = peer->group; for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer)) { if (! peer->af_group[afi][safi]) continue; if (set && CHECK_FLAG (peer->af_flags[afi][safi], flag) == flag) continue; if (! set && ! CHECK_FLAG (peer->af_flags[afi][safi], flag)) continue; if (set) SET_FLAG (peer->af_flags[afi][safi], flag); else UNSET_FLAG (peer->af_flags[afi][safi], flag); if (peer->status == Established) { if (! set && flag == PEER_FLAG_SOFT_RECONFIG) bgp_clear_adj_in (peer, afi, safi); else { if (flag == PEER_FLAG_REFLECTOR_CLIENT) peer->last_reset = PEER_DOWN_RR_CLIENT_CHANGE; else if (flag == PEER_FLAG_RSERVER_CLIENT) peer->last_reset = PEER_DOWN_RS_CLIENT_CHANGE; else if (flag == PEER_FLAG_ORF_PREFIX_SM) peer->last_reset = PEER_DOWN_CAPABILITY_CHANGE; else if (flag == PEER_FLAG_ORF_PREFIX_RM) peer->last_reset = PEER_DOWN_CAPABILITY_CHANGE; peer_change_action (peer, afi, safi, action.type); } } } } return 0; } int peer_af_flag_set (struct peer *peer, afi_t afi, safi_t safi, u_int32_t flag) { return peer_af_flag_modify (peer, afi, safi, flag, 1); } int peer_af_flag_unset (struct peer *peer, afi_t afi, safi_t safi, u_int32_t flag) { return peer_af_flag_modify (peer, afi, safi, flag, 0); } /* EBGP multihop configuration. */ int peer_ebgp_multihop_set (struct peer *peer, int ttl) { struct peer_group *group; struct listnode *node, *nnode; struct peer *peer1; if (peer_sort (peer) == BGP_PEER_IBGP) return 0; /* see comment in peer_ttl_security_hops_set() */ if (ttl != MAXTTL) { if (CHECK_FLAG (peer->sflags, PEER_STATUS_GROUP)) { group = peer->group; if (group->conf->gtsm_hops != 0) return BGP_ERR_NO_EBGP_MULTIHOP_WITH_TTLHACK; for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer1)) { if (peer_sort (peer1) == BGP_PEER_IBGP) continue; if (peer1->gtsm_hops != 0) return BGP_ERR_NO_EBGP_MULTIHOP_WITH_TTLHACK; } } else { if (peer->gtsm_hops != 0) return BGP_ERR_NO_EBGP_MULTIHOP_WITH_TTLHACK; } } peer->ttl = ttl; if (! CHECK_FLAG (peer->sflags, PEER_STATUS_GROUP)) { if (peer->fd >= 0 && peer_sort (peer) != BGP_PEER_IBGP) sockopt_ttl (peer->su.sa.sa_family, peer->fd, peer->ttl); } else { group = peer->group; for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer)) { if (peer_sort (peer) == BGP_PEER_IBGP) continue; peer->ttl = group->conf->ttl; if (peer->fd >= 0) sockopt_ttl (peer->su.sa.sa_family, peer->fd, peer->ttl); } } return 0; } int peer_ebgp_multihop_unset (struct peer *peer) { struct peer_group *group; struct listnode *node, *nnode; if (peer_sort (peer) == BGP_PEER_IBGP) return 0; if (peer->gtsm_hops != 0 && peer->ttl != MAXTTL) return BGP_ERR_NO_EBGP_MULTIHOP_WITH_TTLHACK; if (peer_group_active (peer)) peer->ttl = peer->group->conf->ttl; else peer->ttl = 1; if (! CHECK_FLAG (peer->sflags, PEER_STATUS_GROUP)) { if (peer->fd >= 0 && peer_sort (peer) != BGP_PEER_IBGP) sockopt_ttl (peer->su.sa.sa_family, peer->fd, peer->ttl); } else { group = peer->group; for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer)) { if (peer_sort (peer) == BGP_PEER_IBGP) continue; peer->ttl = 1; if (peer->fd >= 0) sockopt_ttl (peer->su.sa.sa_family, peer->fd, peer->ttl); } } return 0; } /* Neighbor description. */ int peer_description_set (struct peer *peer, char *desc) { if (peer->desc) XFREE (MTYPE_PEER_DESC, peer->desc); peer->desc = XSTRDUP (MTYPE_PEER_DESC, desc); return 0; } int peer_description_unset (struct peer *peer) { if (peer->desc) XFREE (MTYPE_PEER_DESC, peer->desc); peer->desc = NULL; return 0; } /* Neighbor update-source. */ int peer_update_source_if_set (struct peer *peer, const char *ifname) { struct peer_group *group; struct listnode *node, *nnode; if (peer->update_if) { if (! CHECK_FLAG (peer->sflags, PEER_STATUS_GROUP) && strcmp (peer->update_if, ifname) == 0) return 0; XFREE (MTYPE_PEER_UPDATE_SOURCE, peer->update_if); peer->update_if = NULL; } if (peer->update_source) { sockunion_free (peer->update_source); peer->update_source = NULL; } peer->update_if = XSTRDUP (MTYPE_PEER_UPDATE_SOURCE, ifname); if (! CHECK_FLAG (peer->sflags, PEER_STATUS_GROUP)) { if (peer->status == Established) { peer->last_reset = PEER_DOWN_UPDATE_SOURCE_CHANGE; bgp_notify_send (peer, BGP_NOTIFY_CEASE, BGP_NOTIFY_CEASE_CONFIG_CHANGE); } else BGP_EVENT_ADD (peer, BGP_Stop); return 0; } /* peer-group member updates. */ group = peer->group; for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer)) { if (peer->update_if) { if (strcmp (peer->update_if, ifname) == 0) continue; XFREE (MTYPE_PEER_UPDATE_SOURCE, peer->update_if); peer->update_if = NULL; } if (peer->update_source) { sockunion_free (peer->update_source); peer->update_source = NULL; } peer->update_if = XSTRDUP (MTYPE_PEER_UPDATE_SOURCE, ifname); if (peer->status == Established) { peer->last_reset = PEER_DOWN_UPDATE_SOURCE_CHANGE; bgp_notify_send (peer, BGP_NOTIFY_CEASE, BGP_NOTIFY_CEASE_CONFIG_CHANGE); } else BGP_EVENT_ADD (peer, BGP_Stop); } return 0; } int peer_update_source_addr_set (struct peer *peer, union sockunion *su) { struct peer_group *group; struct listnode *node, *nnode; if (peer->update_source) { if (! CHECK_FLAG (peer->sflags, PEER_STATUS_GROUP) && sockunion_cmp (peer->update_source, su) == 0) return 0; sockunion_free (peer->update_source); peer->update_source = NULL; } if (peer->update_if) { XFREE (MTYPE_PEER_UPDATE_SOURCE, peer->update_if); peer->update_if = NULL; } peer->update_source = sockunion_dup (su); if (! CHECK_FLAG (peer->sflags, PEER_STATUS_GROUP)) { if (peer->status == Established) { peer->last_reset = PEER_DOWN_UPDATE_SOURCE_CHANGE; bgp_notify_send (peer, BGP_NOTIFY_CEASE, BGP_NOTIFY_CEASE_CONFIG_CHANGE); } else BGP_EVENT_ADD (peer, BGP_Stop); return 0; } /* peer-group member updates. */ group = peer->group; for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer)) { if (peer->update_source) { if (sockunion_cmp (peer->update_source, su) == 0) continue; sockunion_free (peer->update_source); peer->update_source = NULL; } if (peer->update_if) { XFREE (MTYPE_PEER_UPDATE_SOURCE, peer->update_if); peer->update_if = NULL; } peer->update_source = sockunion_dup (su); if (peer->status == Established) { peer->last_reset = PEER_DOWN_UPDATE_SOURCE_CHANGE; bgp_notify_send (peer, BGP_NOTIFY_CEASE, BGP_NOTIFY_CEASE_CONFIG_CHANGE); } else BGP_EVENT_ADD (peer, BGP_Stop); } return 0; } int peer_update_source_unset (struct peer *peer) { union sockunion *su; struct peer_group *group; struct listnode *node, *nnode; if (! CHECK_FLAG (peer->sflags, PEER_STATUS_GROUP) && ! peer->update_source && ! peer->update_if) return 0; if (peer->update_source) { sockunion_free (peer->update_source); peer->update_source = NULL; } if (peer->update_if) { XFREE (MTYPE_PEER_UPDATE_SOURCE, peer->update_if); peer->update_if = NULL; } if (peer_group_active (peer)) { group = peer->group; if (group->conf->update_source) { su = sockunion_dup (group->conf->update_source); peer->update_source = su; } else if (group->conf->update_if) peer->update_if = XSTRDUP (MTYPE_PEER_UPDATE_SOURCE, group->conf->update_if); } if (! CHECK_FLAG (peer->sflags, PEER_STATUS_GROUP)) { if (peer->status == Established) { peer->last_reset = PEER_DOWN_UPDATE_SOURCE_CHANGE; bgp_notify_send (peer, BGP_NOTIFY_CEASE, BGP_NOTIFY_CEASE_CONFIG_CHANGE); } else BGP_EVENT_ADD (peer, BGP_Stop); return 0; } /* peer-group member updates. */ group = peer->group; for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer)) { if (! peer->update_source && ! peer->update_if) continue; if (peer->update_source) { sockunion_free (peer->update_source); peer->update_source = NULL; } if (peer->update_if) { XFREE (MTYPE_PEER_UPDATE_SOURCE, peer->update_if); peer->update_if = NULL; } if (peer->status == Established) { peer->last_reset = PEER_DOWN_UPDATE_SOURCE_CHANGE; bgp_notify_send (peer, BGP_NOTIFY_CEASE, BGP_NOTIFY_CEASE_CONFIG_CHANGE); } else BGP_EVENT_ADD (peer, BGP_Stop); } return 0; } int peer_default_originate_set (struct peer *peer, afi_t afi, safi_t safi, const char *rmap) { struct peer_group *group; struct listnode *node, *nnode; /* Adress family must be activated. */ if (! peer->afc[afi][safi]) return BGP_ERR_PEER_INACTIVE; /* Default originate can't be used for peer group memeber. */ if (peer_is_group_member (peer, afi, safi)) return BGP_ERR_INVALID_FOR_PEER_GROUP_MEMBER; if (! CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_DEFAULT_ORIGINATE) || (rmap && ! peer->default_rmap[afi][safi].name) || (rmap && strcmp (rmap, peer->default_rmap[afi][safi].name) != 0)) { SET_FLAG (peer->af_flags[afi][safi], PEER_FLAG_DEFAULT_ORIGINATE); if (rmap) { if (peer->default_rmap[afi][safi].name) free (peer->default_rmap[afi][safi].name); peer->default_rmap[afi][safi].name = strdup (rmap); peer->default_rmap[afi][safi].map = route_map_lookup_by_name (rmap); } } if (! CHECK_FLAG (peer->sflags, PEER_STATUS_GROUP)) { if (peer->status == Established && peer->afc_nego[afi][safi]) bgp_default_originate (peer, afi, safi, 0); return 0; } /* peer-group member updates. */ group = peer->group; for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer)) { SET_FLAG (peer->af_flags[afi][safi], PEER_FLAG_DEFAULT_ORIGINATE); if (rmap) { if (peer->default_rmap[afi][safi].name) free (peer->default_rmap[afi][safi].name); peer->default_rmap[afi][safi].name = strdup (rmap); peer->default_rmap[afi][safi].map = route_map_lookup_by_name (rmap); } if (peer->status == Established && peer->afc_nego[afi][safi]) bgp_default_originate (peer, afi, safi, 0); } return 0; } int peer_default_originate_unset (struct peer *peer, afi_t afi, safi_t safi) { struct peer_group *group; struct listnode *node, *nnode; /* Adress family must be activated. */ if (! peer->afc[afi][safi]) return BGP_ERR_PEER_INACTIVE; /* Default originate can't be used for peer group memeber. */ if (peer_is_group_member (peer, afi, safi)) return BGP_ERR_INVALID_FOR_PEER_GROUP_MEMBER; if (CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_DEFAULT_ORIGINATE)) { UNSET_FLAG (peer->af_flags[afi][safi], PEER_FLAG_DEFAULT_ORIGINATE); if (peer->default_rmap[afi][safi].name) free (peer->default_rmap[afi][safi].name); peer->default_rmap[afi][safi].name = NULL; peer->default_rmap[afi][safi].map = NULL; } if (! CHECK_FLAG (peer->sflags, PEER_STATUS_GROUP)) { if (peer->status == Established && peer->afc_nego[afi][safi]) bgp_default_originate (peer, afi, safi, 1); return 0; } /* peer-group member updates. */ group = peer->group; for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer)) { UNSET_FLAG (peer->af_flags[afi][safi], PEER_FLAG_DEFAULT_ORIGINATE); if (peer->default_rmap[afi][safi].name) free (peer->default_rmap[afi][safi].name); peer->default_rmap[afi][safi].name = NULL; peer->default_rmap[afi][safi].map = NULL; if (peer->status == Established && peer->afc_nego[afi][safi]) bgp_default_originate (peer, afi, safi, 1); } return 0; } int peer_port_set (struct peer *peer, u_int16_t port) { peer->port = port; return 0; } int peer_port_unset (struct peer *peer) { peer->port = BGP_PORT_DEFAULT; return 0; } /* neighbor weight. */ int peer_weight_set (struct peer *peer, u_int16_t weight) { struct peer_group *group; struct listnode *node, *nnode; SET_FLAG (peer->config, PEER_CONFIG_WEIGHT); peer->weight = weight; if (! CHECK_FLAG (peer->sflags, PEER_STATUS_GROUP)) return 0; /* peer-group member updates. */ group = peer->group; for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer)) { peer->weight = group->conf->weight; } return 0; } int peer_weight_unset (struct peer *peer) { struct peer_group *group; struct listnode *node, *nnode; /* Set default weight. */ if (peer_group_active (peer)) peer->weight = peer->group->conf->weight; else peer->weight = 0; UNSET_FLAG (peer->config, PEER_CONFIG_WEIGHT); if (! CHECK_FLAG (peer->sflags, PEER_STATUS_GROUP)) return 0; /* peer-group member updates. */ group = peer->group; for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer)) { peer->weight = 0; } return 0; } int peer_timers_set (struct peer *peer, u_int32_t keepalive, u_int32_t holdtime) { struct peer_group *group; struct listnode *node, *nnode; /* Not for peer group memeber. */ if (peer_group_active (peer)) return BGP_ERR_INVALID_FOR_PEER_GROUP_MEMBER; /* keepalive value check. */ if (keepalive > 65535) return BGP_ERR_INVALID_VALUE; /* Holdtime value check. */ if (holdtime > 65535) return BGP_ERR_INVALID_VALUE; /* Holdtime value must be either 0 or greater than 3. */ if (holdtime < 3 && holdtime != 0) return BGP_ERR_INVALID_VALUE; /* Set value to the configuration. */ SET_FLAG (peer->config, PEER_CONFIG_TIMER); peer->holdtime = holdtime; peer->keepalive = (keepalive < holdtime / 3 ? keepalive : holdtime / 3); if (! CHECK_FLAG (peer->sflags, PEER_STATUS_GROUP)) return 0; /* peer-group member updates. */ group = peer->group; for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer)) { SET_FLAG (peer->config, PEER_CONFIG_TIMER); peer->holdtime = group->conf->holdtime; peer->keepalive = group->conf->keepalive; } return 0; } int peer_timers_unset (struct peer *peer) { struct peer_group *group; struct listnode *node, *nnode; if (peer_group_active (peer)) return BGP_ERR_INVALID_FOR_PEER_GROUP_MEMBER; /* Clear configuration. */ UNSET_FLAG (peer->config, PEER_CONFIG_TIMER); peer->keepalive = 0; peer->holdtime = 0; if (! CHECK_FLAG (peer->sflags, PEER_STATUS_GROUP)) return 0; /* peer-group member updates. */ group = peer->group; for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer)) { UNSET_FLAG (peer->config, PEER_CONFIG_TIMER); peer->holdtime = 0; peer->keepalive = 0; } return 0; } int peer_timers_connect_set (struct peer *peer, u_int32_t connect) { if (peer_group_active (peer)) return BGP_ERR_INVALID_FOR_PEER_GROUP_MEMBER; if (connect > 65535) return BGP_ERR_INVALID_VALUE; /* Set value to the configuration. */ SET_FLAG (peer->config, PEER_CONFIG_CONNECT); peer->connect = connect; /* Set value to timer setting. */ peer->v_connect = connect; return 0; } int peer_timers_connect_unset (struct peer *peer) { if (peer_group_active (peer)) return BGP_ERR_INVALID_FOR_PEER_GROUP_MEMBER; /* Clear configuration. */ UNSET_FLAG (peer->config, PEER_CONFIG_CONNECT); peer->connect = 0; /* Set timer setting to default value. */ peer->v_connect = BGP_DEFAULT_CONNECT_RETRY; return 0; } int peer_advertise_interval_set (struct peer *peer, u_int32_t routeadv) { if (peer_group_active (peer)) return BGP_ERR_INVALID_FOR_PEER_GROUP_MEMBER; if (routeadv > 600) return BGP_ERR_INVALID_VALUE; SET_FLAG (peer->config, PEER_CONFIG_ROUTEADV); peer->routeadv = routeadv; peer->v_routeadv = routeadv; return 0; } int peer_advertise_interval_unset (struct peer *peer) { if (peer_group_active (peer)) return BGP_ERR_INVALID_FOR_PEER_GROUP_MEMBER; UNSET_FLAG (peer->config, PEER_CONFIG_ROUTEADV); peer->routeadv = 0; if (peer_sort (peer) == BGP_PEER_IBGP) peer->v_routeadv = BGP_DEFAULT_IBGP_ROUTEADV; else peer->v_routeadv = BGP_DEFAULT_EBGP_ROUTEADV; return 0; } /* neighbor interface */ int peer_interface_set (struct peer *peer, const char *str) { if (peer->ifname) free (peer->ifname); peer->ifname = strdup (str); return 0; } int peer_interface_unset (struct peer *peer) { if (peer->ifname) free (peer->ifname); peer->ifname = NULL; return 0; } /* Allow-as in. */ int peer_allowas_in_set (struct peer *peer, afi_t afi, safi_t safi, int allow_num) { struct peer_group *group; struct listnode *node, *nnode; if (allow_num < 1 || allow_num > 10) return BGP_ERR_INVALID_VALUE; if (peer->allowas_in[afi][safi] != allow_num) { peer->allowas_in[afi][safi] = allow_num; SET_FLAG (peer->af_flags[afi][safi], PEER_FLAG_ALLOWAS_IN); peer_change_action (peer, afi, safi, peer_change_reset_in); } if (! CHECK_FLAG (peer->sflags, PEER_STATUS_GROUP)) return 0; group = peer->group; for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer)) { if (peer->allowas_in[afi][safi] != allow_num) { peer->allowas_in[afi][safi] = allow_num; SET_FLAG (peer->af_flags[afi][safi], PEER_FLAG_ALLOWAS_IN); peer_change_action (peer, afi, safi, peer_change_reset_in); } } return 0; } int peer_allowas_in_unset (struct peer *peer, afi_t afi, safi_t safi) { struct peer_group *group; struct listnode *node, *nnode; if (CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_ALLOWAS_IN)) { peer->allowas_in[afi][safi] = 0; peer_af_flag_unset (peer, afi, safi, PEER_FLAG_ALLOWAS_IN); } if (! CHECK_FLAG (peer->sflags, PEER_STATUS_GROUP)) return 0; group = peer->group; for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer)) { if (CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_ALLOWAS_IN)) { peer->allowas_in[afi][safi] = 0; peer_af_flag_unset (peer, afi, safi, PEER_FLAG_ALLOWAS_IN); } } return 0; } int peer_local_as_set (struct peer *peer, as_t as, int no_prepend) { struct bgp *bgp = peer->bgp; struct peer_group *group; struct listnode *node, *nnode; if (peer_sort (peer) != BGP_PEER_EBGP && peer_sort (peer) != BGP_PEER_INTERNAL) return BGP_ERR_LOCAL_AS_ALLOWED_ONLY_FOR_EBGP; if (bgp->as == as) return BGP_ERR_CANNOT_HAVE_LOCAL_AS_SAME_AS; if (peer_group_active (peer)) return BGP_ERR_INVALID_FOR_PEER_GROUP_MEMBER; if (peer->change_local_as == as && ((CHECK_FLAG (peer->flags, PEER_FLAG_LOCAL_AS_NO_PREPEND) && no_prepend) || (! CHECK_FLAG (peer->flags, PEER_FLAG_LOCAL_AS_NO_PREPEND) && ! no_prepend))) return 0; peer->change_local_as = as; if (no_prepend) SET_FLAG (peer->flags, PEER_FLAG_LOCAL_AS_NO_PREPEND); else UNSET_FLAG (peer->flags, PEER_FLAG_LOCAL_AS_NO_PREPEND); if (! CHECK_FLAG (peer->sflags, PEER_STATUS_GROUP)) { if (peer->status == Established) { peer->last_reset = PEER_DOWN_LOCAL_AS_CHANGE; bgp_notify_send (peer, BGP_NOTIFY_CEASE, BGP_NOTIFY_CEASE_CONFIG_CHANGE); } else BGP_EVENT_ADD (peer, BGP_Stop); return 0; } group = peer->group; for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer)) { peer->change_local_as = as; if (no_prepend) SET_FLAG (peer->flags, PEER_FLAG_LOCAL_AS_NO_PREPEND); else UNSET_FLAG (peer->flags, PEER_FLAG_LOCAL_AS_NO_PREPEND); if (peer->status == Established) { peer->last_reset = PEER_DOWN_LOCAL_AS_CHANGE; bgp_notify_send (peer, BGP_NOTIFY_CEASE, BGP_NOTIFY_CEASE_CONFIG_CHANGE); } else BGP_EVENT_ADD (peer, BGP_Stop); } return 0; } int peer_local_as_unset (struct peer *peer) { struct peer_group *group; struct listnode *node, *nnode; if (peer_group_active (peer)) return BGP_ERR_INVALID_FOR_PEER_GROUP_MEMBER; if (! peer->change_local_as) return 0; peer->change_local_as = 0; UNSET_FLAG (peer->flags, PEER_FLAG_LOCAL_AS_NO_PREPEND); if (! CHECK_FLAG (peer->sflags, PEER_STATUS_GROUP)) { if (peer->status == Established) { peer->last_reset = PEER_DOWN_LOCAL_AS_CHANGE; bgp_notify_send (peer, BGP_NOTIFY_CEASE, BGP_NOTIFY_CEASE_CONFIG_CHANGE); } else BGP_EVENT_ADD (peer, BGP_Stop); return 0; } group = peer->group; for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer)) { peer->change_local_as = 0; UNSET_FLAG (peer->flags, PEER_FLAG_LOCAL_AS_NO_PREPEND); if (peer->status == Established) { peer->last_reset = PEER_DOWN_LOCAL_AS_CHANGE; bgp_notify_send (peer, BGP_NOTIFY_CEASE, BGP_NOTIFY_CEASE_CONFIG_CHANGE); } else BGP_EVENT_ADD (peer, BGP_Stop); } return 0; } /* Set password for authenticating with the peer. */ int peer_password_set (struct peer *peer, const char *password) { struct listnode *nn, *nnode; int len = password ? strlen(password) : 0; int ret = BGP_SUCCESS; if ((len < PEER_PASSWORD_MINLEN) || (len > PEER_PASSWORD_MAXLEN)) return BGP_ERR_INVALID_VALUE; if (peer->password && strcmp (peer->password, password) == 0 && ! CHECK_FLAG (peer->sflags, PEER_STATUS_GROUP)) return 0; if (peer->password) XFREE (MTYPE_PEER_PASSWORD, peer->password); peer->password = XSTRDUP (MTYPE_PEER_PASSWORD, password); if (! CHECK_FLAG (peer->sflags, PEER_STATUS_GROUP)) { if (peer->status == Established) bgp_notify_send (peer, BGP_NOTIFY_CEASE, BGP_NOTIFY_CEASE_CONFIG_CHANGE); else BGP_EVENT_ADD (peer, BGP_Stop); return (bgp_md5_set (peer) >= 0) ? BGP_SUCCESS : BGP_ERR_TCPSIG_FAILED; } for (ALL_LIST_ELEMENTS (peer->group->peer, nn, nnode, peer)) { if (peer->password && strcmp (peer->password, password) == 0) continue; if (peer->password) XFREE (MTYPE_PEER_PASSWORD, peer->password); peer->password = XSTRDUP(MTYPE_PEER_PASSWORD, password); if (peer->status == Established) bgp_notify_send (peer, BGP_NOTIFY_CEASE, BGP_NOTIFY_CEASE_CONFIG_CHANGE); else BGP_EVENT_ADD (peer, BGP_Stop); if (bgp_md5_set (peer) < 0) ret = BGP_ERR_TCPSIG_FAILED; } return ret; } int peer_password_unset (struct peer *peer) { struct listnode *nn, *nnode; if (!peer->password && !CHECK_FLAG (peer->sflags, PEER_STATUS_GROUP)) return 0; if (!CHECK_FLAG (peer->sflags, PEER_STATUS_GROUP)) { if (peer_group_active (peer) && peer->group->conf->password && strcmp (peer->group->conf->password, peer->password) == 0) return BGP_ERR_PEER_GROUP_HAS_THE_FLAG; if (peer->status == Established) bgp_notify_send (peer, BGP_NOTIFY_CEASE, BGP_NOTIFY_CEASE_CONFIG_CHANGE); else BGP_EVENT_ADD (peer, BGP_Stop); if (peer->password) XFREE (MTYPE_PEER_PASSWORD, peer->password); peer->password = NULL; bgp_md5_set (peer); return 0; } XFREE (MTYPE_PEER_PASSWORD, peer->password); peer->password = NULL; for (ALL_LIST_ELEMENTS (peer->group->peer, nn, nnode, peer)) { if (!peer->password) continue; if (peer->status == Established) bgp_notify_send (peer, BGP_NOTIFY_CEASE, BGP_NOTIFY_CEASE_CONFIG_CHANGE); else BGP_EVENT_ADD (peer, BGP_Stop); XFREE (MTYPE_PEER_PASSWORD, peer->password); peer->password = NULL; bgp_md5_set (peer); } return 0; } /* Set distribute list to the peer. */ int peer_distribute_set (struct peer *peer, afi_t afi, safi_t safi, int direct, const char *name) { struct bgp_filter *filter; struct peer_group *group; struct listnode *node, *nnode; if (! peer->afc[afi][safi]) return BGP_ERR_PEER_INACTIVE; if (direct != FILTER_IN && direct != FILTER_OUT) return BGP_ERR_INVALID_VALUE; if (direct == FILTER_OUT && peer_is_group_member (peer, afi, safi)) return BGP_ERR_INVALID_FOR_PEER_GROUP_MEMBER; filter = &peer->filter[afi][safi]; if (filter->plist[direct].name) return BGP_ERR_PEER_FILTER_CONFLICT; if (filter->dlist[direct].name) free (filter->dlist[direct].name); filter->dlist[direct].name = strdup (name); filter->dlist[direct].alist = access_list_lookup (afi, name); if (! CHECK_FLAG (peer->sflags, PEER_STATUS_GROUP)) return 0; group = peer->group; for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer)) { filter = &peer->filter[afi][safi]; if (! peer->af_group[afi][safi]) continue; if (filter->dlist[direct].name) free (filter->dlist[direct].name); filter->dlist[direct].name = strdup (name); filter->dlist[direct].alist = access_list_lookup (afi, name); } return 0; } int peer_distribute_unset (struct peer *peer, afi_t afi, safi_t safi, int direct) { struct bgp_filter *filter; struct bgp_filter *gfilter; struct peer_group *group; struct listnode *node, *nnode; if (! peer->afc[afi][safi]) return BGP_ERR_PEER_INACTIVE; if (direct != FILTER_IN && direct != FILTER_OUT) return BGP_ERR_INVALID_VALUE; if (direct == FILTER_OUT && peer_is_group_member (peer, afi, safi)) return BGP_ERR_INVALID_FOR_PEER_GROUP_MEMBER; filter = &peer->filter[afi][safi]; /* apply peer-group filter */ if (peer->af_group[afi][safi]) { gfilter = &peer->group->conf->filter[afi][safi]; if (gfilter->dlist[direct].name) { if (filter->dlist[direct].name) free (filter->dlist[direct].name); filter->dlist[direct].name = strdup (gfilter->dlist[direct].name); filter->dlist[direct].alist = gfilter->dlist[direct].alist; return 0; } } if (filter->dlist[direct].name) free (filter->dlist[direct].name); filter->dlist[direct].name = NULL; filter->dlist[direct].alist = NULL; if (! CHECK_FLAG (peer->sflags, PEER_STATUS_GROUP)) return 0; group = peer->group; for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer)) { filter = &peer->filter[afi][safi]; if (! peer->af_group[afi][safi]) continue; if (filter->dlist[direct].name) free (filter->dlist[direct].name); filter->dlist[direct].name = NULL; filter->dlist[direct].alist = NULL; } return 0; } /* Update distribute list. */ static void peer_distribute_update (struct access_list *access) { afi_t afi; safi_t safi; int direct; struct listnode *mnode, *mnnode; struct listnode *node, *nnode; struct bgp *bgp; struct peer *peer; struct peer_group *group; struct bgp_filter *filter; for (ALL_LIST_ELEMENTS (bm->bgp, mnode, mnnode, bgp)) { for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) { for (afi = AFI_IP; afi < AFI_MAX; afi++) for (safi = SAFI_UNICAST; safi < SAFI_MAX; safi++) { filter = &peer->filter[afi][safi]; for (direct = FILTER_IN; direct < FILTER_MAX; direct++) { if (filter->dlist[direct].name) filter->dlist[direct].alist = access_list_lookup (afi, filter->dlist[direct].name); else filter->dlist[direct].alist = NULL; } } } for (ALL_LIST_ELEMENTS (bgp->group, node, nnode, group)) { for (afi = AFI_IP; afi < AFI_MAX; afi++) for (safi = SAFI_UNICAST; safi < SAFI_MAX; safi++) { filter = &group->conf->filter[afi][safi]; for (direct = FILTER_IN; direct < FILTER_MAX; direct++) { if (filter->dlist[direct].name) filter->dlist[direct].alist = access_list_lookup (afi, filter->dlist[direct].name); else filter->dlist[direct].alist = NULL; } } } } } /* Set prefix list to the peer. */ int peer_prefix_list_set (struct peer *peer, afi_t afi, safi_t safi, int direct, const char *name) { struct bgp_filter *filter; struct peer_group *group; struct listnode *node, *nnode; if (! peer->afc[afi][safi]) return BGP_ERR_PEER_INACTIVE; if (direct != FILTER_IN && direct != FILTER_OUT) return BGP_ERR_INVALID_VALUE; if (direct == FILTER_OUT && peer_is_group_member (peer, afi, safi)) return BGP_ERR_INVALID_FOR_PEER_GROUP_MEMBER; filter = &peer->filter[afi][safi]; if (filter->dlist[direct].name) return BGP_ERR_PEER_FILTER_CONFLICT; if (filter->plist[direct].name) free (filter->plist[direct].name); filter->plist[direct].name = strdup (name); filter->plist[direct].plist = prefix_list_lookup (afi, name); if (! CHECK_FLAG (peer->sflags, PEER_STATUS_GROUP)) return 0; group = peer->group; for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer)) { filter = &peer->filter[afi][safi]; if (! peer->af_group[afi][safi]) continue; if (filter->plist[direct].name) free (filter->plist[direct].name); filter->plist[direct].name = strdup (name); filter->plist[direct].plist = prefix_list_lookup (afi, name); } return 0; } int peer_prefix_list_unset (struct peer *peer, afi_t afi, safi_t safi, int direct) { struct bgp_filter *filter; struct bgp_filter *gfilter; struct peer_group *group; struct listnode *node, *nnode; if (! peer->afc[afi][safi]) return BGP_ERR_PEER_INACTIVE; if (direct != FILTER_IN && direct != FILTER_OUT) return BGP_ERR_INVALID_VALUE; if (direct == FILTER_OUT && peer_is_group_member (peer, afi, safi)) return BGP_ERR_INVALID_FOR_PEER_GROUP_MEMBER; filter = &peer->filter[afi][safi]; /* apply peer-group filter */ if (peer->af_group[afi][safi]) { gfilter = &peer->group->conf->filter[afi][safi]; if (gfilter->plist[direct].name) { if (filter->plist[direct].name) free (filter->plist[direct].name); filter->plist[direct].name = strdup (gfilter->plist[direct].name); filter->plist[direct].plist = gfilter->plist[direct].plist; return 0; } } if (filter->plist[direct].name) free (filter->plist[direct].name); filter->plist[direct].name = NULL; filter->plist[direct].plist = NULL; if (! CHECK_FLAG (peer->sflags, PEER_STATUS_GROUP)) return 0; group = peer->group; for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer)) { filter = &peer->filter[afi][safi]; if (! peer->af_group[afi][safi]) continue; if (filter->plist[direct].name) free (filter->plist[direct].name); filter->plist[direct].name = NULL; filter->plist[direct].plist = NULL; } return 0; } /* Update prefix-list list. */ static void peer_prefix_list_update (struct prefix_list *plist) { struct listnode *mnode, *mnnode; struct listnode *node, *nnode; struct bgp *bgp; struct peer *peer; struct peer_group *group; struct bgp_filter *filter; afi_t afi; safi_t safi; int direct; for (ALL_LIST_ELEMENTS (bm->bgp, mnode, mnnode, bgp)) { for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) { for (afi = AFI_IP; afi < AFI_MAX; afi++) for (safi = SAFI_UNICAST; safi < SAFI_MAX; safi++) { filter = &peer->filter[afi][safi]; for (direct = FILTER_IN; direct < FILTER_MAX; direct++) { if (filter->plist[direct].name) filter->plist[direct].plist = prefix_list_lookup (afi, filter->plist[direct].name); else filter->plist[direct].plist = NULL; } } } for (ALL_LIST_ELEMENTS (bgp->group, node, nnode, group)) { for (afi = AFI_IP; afi < AFI_MAX; afi++) for (safi = SAFI_UNICAST; safi < SAFI_MAX; safi++) { filter = &group->conf->filter[afi][safi]; for (direct = FILTER_IN; direct < FILTER_MAX; direct++) { if (filter->plist[direct].name) filter->plist[direct].plist = prefix_list_lookup (afi, filter->plist[direct].name); else filter->plist[direct].plist = NULL; } } } } } int peer_aslist_set (struct peer *peer, afi_t afi, safi_t safi, int direct, const char *name) { struct bgp_filter *filter; struct peer_group *group; struct listnode *node, *nnode; if (! peer->afc[afi][safi]) return BGP_ERR_PEER_INACTIVE; if (direct != FILTER_IN && direct != FILTER_OUT) return BGP_ERR_INVALID_VALUE; if (direct == FILTER_OUT && peer_is_group_member (peer, afi, safi)) return BGP_ERR_INVALID_FOR_PEER_GROUP_MEMBER; filter = &peer->filter[afi][safi]; if (filter->aslist[direct].name) free (filter->aslist[direct].name); filter->aslist[direct].name = strdup (name); filter->aslist[direct].aslist = as_list_lookup (name); if (! CHECK_FLAG (peer->sflags, PEER_STATUS_GROUP)) return 0; group = peer->group; for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer)) { filter = &peer->filter[afi][safi]; if (! peer->af_group[afi][safi]) continue; if (filter->aslist[direct].name) free (filter->aslist[direct].name); filter->aslist[direct].name = strdup (name); filter->aslist[direct].aslist = as_list_lookup (name); } return 0; } int peer_aslist_unset (struct peer *peer,afi_t afi, safi_t safi, int direct) { struct bgp_filter *filter; struct bgp_filter *gfilter; struct peer_group *group; struct listnode *node, *nnode; if (! peer->afc[afi][safi]) return BGP_ERR_PEER_INACTIVE; if (direct != FILTER_IN && direct != FILTER_OUT) return BGP_ERR_INVALID_VALUE; if (direct == FILTER_OUT && peer_is_group_member (peer, afi, safi)) return BGP_ERR_INVALID_FOR_PEER_GROUP_MEMBER; filter = &peer->filter[afi][safi]; /* apply peer-group filter */ if (peer->af_group[afi][safi]) { gfilter = &peer->group->conf->filter[afi][safi]; if (gfilter->aslist[direct].name) { if (filter->aslist[direct].name) free (filter->aslist[direct].name); filter->aslist[direct].name = strdup (gfilter->aslist[direct].name); filter->aslist[direct].aslist = gfilter->aslist[direct].aslist; return 0; } } if (filter->aslist[direct].name) free (filter->aslist[direct].name); filter->aslist[direct].name = NULL; filter->aslist[direct].aslist = NULL; if (! CHECK_FLAG (peer->sflags, PEER_STATUS_GROUP)) return 0; group = peer->group; for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer)) { filter = &peer->filter[afi][safi]; if (! peer->af_group[afi][safi]) continue; if (filter->aslist[direct].name) free (filter->aslist[direct].name); filter->aslist[direct].name = NULL; filter->aslist[direct].aslist = NULL; } return 0; } static void peer_aslist_update (void) { afi_t afi; safi_t safi; int direct; struct listnode *mnode, *mnnode; struct listnode *node, *nnode; struct bgp *bgp; struct peer *peer; struct peer_group *group; struct bgp_filter *filter; for (ALL_LIST_ELEMENTS (bm->bgp, mnode, mnnode, bgp)) { for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) { for (afi = AFI_IP; afi < AFI_MAX; afi++) for (safi = SAFI_UNICAST; safi < SAFI_MAX; safi++) { filter = &peer->filter[afi][safi]; for (direct = FILTER_IN; direct < FILTER_MAX; direct++) { if (filter->aslist[direct].name) filter->aslist[direct].aslist = as_list_lookup (filter->aslist[direct].name); else filter->aslist[direct].aslist = NULL; } } } for (ALL_LIST_ELEMENTS (bgp->group, node, nnode, group)) { for (afi = AFI_IP; afi < AFI_MAX; afi++) for (safi = SAFI_UNICAST; safi < SAFI_MAX; safi++) { filter = &group->conf->filter[afi][safi]; for (direct = FILTER_IN; direct < FILTER_MAX; direct++) { if (filter->aslist[direct].name) filter->aslist[direct].aslist = as_list_lookup (filter->aslist[direct].name); else filter->aslist[direct].aslist = NULL; } } } } } /* Set route-map to the peer. */ int peer_route_map_set (struct peer *peer, afi_t afi, safi_t safi, int direct, const char *name) { struct bgp_filter *filter; struct peer_group *group; struct listnode *node, *nnode; if (! peer->afc[afi][safi]) return BGP_ERR_PEER_INACTIVE; if (direct != RMAP_IN && direct != RMAP_OUT && direct != RMAP_IMPORT && direct != RMAP_EXPORT) return BGP_ERR_INVALID_VALUE; if ( (direct == RMAP_OUT || direct == RMAP_IMPORT) && peer_is_group_member (peer, afi, safi)) return BGP_ERR_INVALID_FOR_PEER_GROUP_MEMBER; filter = &peer->filter[afi][safi]; if (filter->map[direct].name) free (filter->map[direct].name); filter->map[direct].name = strdup (name); filter->map[direct].map = route_map_lookup_by_name (name); if (! CHECK_FLAG (peer->sflags, PEER_STATUS_GROUP)) return 0; group = peer->group; for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer)) { filter = &peer->filter[afi][safi]; if (! peer->af_group[afi][safi]) continue; if (filter->map[direct].name) free (filter->map[direct].name); filter->map[direct].name = strdup (name); filter->map[direct].map = route_map_lookup_by_name (name); } return 0; } /* Unset route-map from the peer. */ int peer_route_map_unset (struct peer *peer, afi_t afi, safi_t safi, int direct) { struct bgp_filter *filter; struct bgp_filter *gfilter; struct peer_group *group; struct listnode *node, *nnode; if (! peer->afc[afi][safi]) return BGP_ERR_PEER_INACTIVE; if (direct != RMAP_IN && direct != RMAP_OUT && direct != RMAP_IMPORT && direct != RMAP_EXPORT) return BGP_ERR_INVALID_VALUE; if ( (direct == RMAP_OUT || direct == RMAP_IMPORT) && peer_is_group_member (peer, afi, safi)) return BGP_ERR_INVALID_FOR_PEER_GROUP_MEMBER; filter = &peer->filter[afi][safi]; /* apply peer-group filter */ if (peer->af_group[afi][safi]) { gfilter = &peer->group->conf->filter[afi][safi]; if (gfilter->map[direct].name) { if (filter->map[direct].name) free (filter->map[direct].name); filter->map[direct].name = strdup (gfilter->map[direct].name); filter->map[direct].map = gfilter->map[direct].map; return 0; } } if (filter->map[direct].name) free (filter->map[direct].name); filter->map[direct].name = NULL; filter->map[direct].map = NULL; if (! CHECK_FLAG (peer->sflags, PEER_STATUS_GROUP)) return 0; group = peer->group; for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer)) { filter = &peer->filter[afi][safi]; if (! peer->af_group[afi][safi]) continue; if (filter->map[direct].name) free (filter->map[direct].name); filter->map[direct].name = NULL; filter->map[direct].map = NULL; } return 0; } /* Set unsuppress-map to the peer. */ int peer_unsuppress_map_set (struct peer *peer, afi_t afi, safi_t safi, const char *name) { struct bgp_filter *filter; struct peer_group *group; struct listnode *node, *nnode; if (! peer->afc[afi][safi]) return BGP_ERR_PEER_INACTIVE; if (peer_is_group_member (peer, afi, safi)) return BGP_ERR_INVALID_FOR_PEER_GROUP_MEMBER; filter = &peer->filter[afi][safi]; if (filter->usmap.name) free (filter->usmap.name); filter->usmap.name = strdup (name); filter->usmap.map = route_map_lookup_by_name (name); if (! CHECK_FLAG (peer->sflags, PEER_STATUS_GROUP)) return 0; group = peer->group; for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer)) { filter = &peer->filter[afi][safi]; if (! peer->af_group[afi][safi]) continue; if (filter->usmap.name) free (filter->usmap.name); filter->usmap.name = strdup (name); filter->usmap.map = route_map_lookup_by_name (name); } return 0; } /* Unset route-map from the peer. */ int peer_unsuppress_map_unset (struct peer *peer, afi_t afi, safi_t safi) { struct bgp_filter *filter; struct peer_group *group; struct listnode *node, *nnode; if (! peer->afc[afi][safi]) return BGP_ERR_PEER_INACTIVE; if (peer_is_group_member (peer, afi, safi)) return BGP_ERR_INVALID_FOR_PEER_GROUP_MEMBER; filter = &peer->filter[afi][safi]; if (filter->usmap.name) free (filter->usmap.name); filter->usmap.name = NULL; filter->usmap.map = NULL; if (! CHECK_FLAG (peer->sflags, PEER_STATUS_GROUP)) return 0; group = peer->group; for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer)) { filter = &peer->filter[afi][safi]; if (! peer->af_group[afi][safi]) continue; if (filter->usmap.name) free (filter->usmap.name); filter->usmap.name = NULL; filter->usmap.map = NULL; } return 0; } int peer_maximum_prefix_set (struct peer *peer, afi_t afi, safi_t safi, u_int32_t max, u_char threshold, int warning, u_int16_t restart) { struct peer_group *group; struct listnode *node, *nnode; if (! peer->afc[afi][safi]) return BGP_ERR_PEER_INACTIVE; SET_FLAG (peer->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX); peer->pmax[afi][safi] = max; peer->pmax_threshold[afi][safi] = threshold; peer->pmax_restart[afi][safi] = restart; if (warning) SET_FLAG (peer->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX_WARNING); else UNSET_FLAG (peer->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX_WARNING); if (! CHECK_FLAG (peer->sflags, PEER_STATUS_GROUP)) return 0; group = peer->group; for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer)) { if (! peer->af_group[afi][safi]) continue; SET_FLAG (peer->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX); peer->pmax[afi][safi] = max; peer->pmax_threshold[afi][safi] = threshold; peer->pmax_restart[afi][safi] = restart; if (warning) SET_FLAG (peer->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX_WARNING); else UNSET_FLAG (peer->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX_WARNING); } return 0; } int peer_maximum_prefix_unset (struct peer *peer, afi_t afi, safi_t safi) { struct peer_group *group; struct listnode *node, *nnode; if (! peer->afc[afi][safi]) return BGP_ERR_PEER_INACTIVE; /* apply peer-group config */ if (peer->af_group[afi][safi]) { if (CHECK_FLAG (peer->group->conf->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX)) SET_FLAG (peer->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX); else UNSET_FLAG (peer->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX); if (CHECK_FLAG (peer->group->conf->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX_WARNING)) SET_FLAG (peer->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX_WARNING); else UNSET_FLAG (peer->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX_WARNING); peer->pmax[afi][safi] = peer->group->conf->pmax[afi][safi]; peer->pmax_threshold[afi][safi] = peer->group->conf->pmax_threshold[afi][safi]; peer->pmax_restart[afi][safi] = peer->group->conf->pmax_restart[afi][safi]; return 0; } UNSET_FLAG (peer->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX); UNSET_FLAG (peer->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX_WARNING); peer->pmax[afi][safi] = 0; peer->pmax_threshold[afi][safi] = 0; peer->pmax_restart[afi][safi] = 0; if (! CHECK_FLAG (peer->sflags, PEER_STATUS_GROUP)) return 0; group = peer->group; for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer)) { if (! peer->af_group[afi][safi]) continue; UNSET_FLAG (peer->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX); UNSET_FLAG (peer->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX_WARNING); peer->pmax[afi][safi] = 0; peer->pmax_threshold[afi][safi] = 0; peer->pmax_restart[afi][safi] = 0; } return 0; } /* Set # of hops between us and BGP peer. */ int peer_ttl_security_hops_set (struct peer *peer, int gtsm_hops) { struct peer_group *group; struct listnode *node, *nnode; struct peer *peer1; int ret; zlog_debug ("peer_ttl_security_hops_set: set gtsm_hops to %d for %s", gtsm_hops, peer->host); if (peer_sort (peer) == BGP_PEER_IBGP) return BGP_ERR_NO_IBGP_WITH_TTLHACK; /* We cannot configure ttl-security hops when ebgp-multihop is already set. For non peer-groups, the check is simple. For peer-groups, it's slightly messy, because we need to check both the peer-group structure and all peer-group members for any trace of ebgp-multihop configuration before actually applying the ttl-security rules. Cisco really made a mess of this configuration parameter, and OpenBGPD got it right. */ if (peer->gtsm_hops == 0) { if (CHECK_FLAG (peer->sflags, PEER_STATUS_GROUP)) { group = peer->group; if (group->conf->ttl != 1) return BGP_ERR_NO_EBGP_MULTIHOP_WITH_TTLHACK; for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer1)) { if (peer_sort (peer1) == BGP_PEER_IBGP) continue; if (peer1->ttl != 1) return BGP_ERR_NO_EBGP_MULTIHOP_WITH_TTLHACK; } } else { if (peer->ttl != 1) return BGP_ERR_NO_EBGP_MULTIHOP_WITH_TTLHACK; } /* specify MAXTTL on outgoing packets */ ret = peer_ebgp_multihop_set (peer, MAXTTL); if (ret != 0) return ret; } peer->gtsm_hops = gtsm_hops; if (! CHECK_FLAG (peer->sflags, PEER_STATUS_GROUP)) { if (peer->fd >= 0 && peer_sort (peer) != BGP_PEER_IBGP) sockopt_minttl (peer->su.sa.sa_family, peer->fd, MAXTTL + 1 - gtsm_hops); } else { group = peer->group; for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer)) { if (peer_sort (peer) == BGP_PEER_IBGP) continue; peer->gtsm_hops = group->conf->gtsm_hops; /* Change setting of existing peer * established then change value (may break connectivity) * not established yet (teardown session and restart) * no session then do nothing (will get handled by next connection) */ if (peer->status == Established) { if (peer->fd >= 0 && peer->gtsm_hops != 0) sockopt_minttl (peer->su.sa.sa_family, peer->fd, MAXTTL + 1 - peer->gtsm_hops); } else if (peer->status < Established) { if (BGP_DEBUG (events, EVENTS)) zlog_debug ("%s Min-ttl changed", peer->host); BGP_EVENT_ADD (peer, BGP_Stop); } } } return 0; } int peer_ttl_security_hops_unset (struct peer *peer) { struct peer_group *group; struct listnode *node, *nnode; struct peer *opeer; zlog_debug ("peer_ttl_security_hops_unset: set gtsm_hops to zero for %s", peer->host); if (peer_sort (peer) == BGP_PEER_IBGP) return 0; /* if a peer-group member, then reset to peer-group default rather than 0 */ if (peer_group_active (peer)) peer->gtsm_hops = peer->group->conf->gtsm_hops; else peer->gtsm_hops = 0; opeer = peer; if (! CHECK_FLAG (peer->sflags, PEER_STATUS_GROUP)) { if (peer->fd >= 0 && peer_sort (peer) != BGP_PEER_IBGP) sockopt_minttl (peer->su.sa.sa_family, peer->fd, 0); } else { group = peer->group; for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer)) { if (peer_sort (peer) == BGP_PEER_IBGP) continue; peer->gtsm_hops = 0; if (peer->fd >= 0) sockopt_minttl (peer->su.sa.sa_family, peer->fd, 0); } } return peer_ebgp_multihop_unset (opeer); } int peer_clear (struct peer *peer) { if (! CHECK_FLAG (peer->flags, PEER_FLAG_SHUTDOWN)) { if (CHECK_FLAG (peer->sflags, PEER_STATUS_PREFIX_OVERFLOW)) { UNSET_FLAG (peer->sflags, PEER_STATUS_PREFIX_OVERFLOW); if (peer->t_pmax_restart) { BGP_TIMER_OFF (peer->t_pmax_restart); if (BGP_DEBUG (events, EVENTS)) zlog_debug ("%s Maximum-prefix restart timer canceled", peer->host); } BGP_EVENT_ADD (peer, BGP_Start); return 0; } peer->v_start = BGP_INIT_START_TIMER; if (peer->status == Established) bgp_notify_send (peer, BGP_NOTIFY_CEASE, BGP_NOTIFY_CEASE_ADMIN_RESET); else BGP_EVENT_ADD (peer, BGP_Stop); } return 0; } int peer_clear_soft (struct peer *peer, afi_t afi, safi_t safi, enum bgp_clear_type stype) { if (peer->status != Established) return 0; if (! peer->afc[afi][safi]) return BGP_ERR_AF_UNCONFIGURED; if (stype == BGP_CLEAR_SOFT_RSCLIENT) { if (! CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT)) return 0; bgp_check_local_routes_rsclient (peer, afi, safi); bgp_soft_reconfig_rsclient (peer, afi, safi); } if (stype == BGP_CLEAR_SOFT_OUT || stype == BGP_CLEAR_SOFT_BOTH) bgp_announce_route (peer, afi, safi); if (stype == BGP_CLEAR_SOFT_IN_ORF_PREFIX) { if (CHECK_FLAG (peer->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV) && (CHECK_FLAG (peer->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV) || CHECK_FLAG (peer->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV))) { struct bgp_filter *filter = &peer->filter[afi][safi]; u_char prefix_type; if (CHECK_FLAG (peer->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV)) prefix_type = ORF_TYPE_PREFIX; else prefix_type = ORF_TYPE_PREFIX_OLD; if (filter->plist[FILTER_IN].plist) { if (CHECK_FLAG (peer->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND)) bgp_route_refresh_send (peer, afi, safi, prefix_type, REFRESH_DEFER, 1); bgp_route_refresh_send (peer, afi, safi, prefix_type, REFRESH_IMMEDIATE, 0); } else { if (CHECK_FLAG (peer->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND)) bgp_route_refresh_send (peer, afi, safi, prefix_type, REFRESH_IMMEDIATE, 1); else bgp_route_refresh_send (peer, afi, safi, 0, 0, 0); } return 0; } } if (stype == BGP_CLEAR_SOFT_IN || stype == BGP_CLEAR_SOFT_BOTH || stype == BGP_CLEAR_SOFT_IN_ORF_PREFIX) { /* If neighbor has soft reconfiguration inbound flag. Use Adj-RIB-In database. */ if (CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_SOFT_RECONFIG)) bgp_soft_reconfig_in (peer, afi, safi); else { /* If neighbor has route refresh capability, send route refresh message to the peer. */ if (CHECK_FLAG (peer->cap, PEER_CAP_REFRESH_OLD_RCV) || CHECK_FLAG (peer->cap, PEER_CAP_REFRESH_NEW_RCV)) bgp_route_refresh_send (peer, afi, safi, 0, 0, 0); else return BGP_ERR_SOFT_RECONFIG_UNCONFIGURED; } } return 0; } /* Display peer uptime.*/ /* XXX: why does this function return char * when it takes buffer? */ char * peer_uptime (time_t uptime2, char *buf, size_t len) { time_t uptime1; struct tm *tm; /* Check buffer length. */ if (len < BGP_UPTIME_LEN) { zlog_warn ("peer_uptime (): buffer shortage %lu", (u_long)len); /* XXX: should return status instead of buf... */ snprintf (buf, len, "<error> "); return buf; } /* If there is no connection has been done before print `never'. */ if (uptime2 == 0) { snprintf (buf, len, "never "); return buf; } /* Get current time. */ uptime1 = bgp_clock (); uptime1 -= uptime2; tm = gmtime (&uptime1); /* Making formatted timer strings. */ #define ONE_DAY_SECOND 60*60*24 #define ONE_WEEK_SECOND 60*60*24*7 if (uptime1 < ONE_DAY_SECOND) snprintf (buf, len, "%02d:%02d:%02d", tm->tm_hour, tm->tm_min, tm->tm_sec); else if (uptime1 < ONE_WEEK_SECOND) snprintf (buf, len, "%dd%02dh%02dm", tm->tm_yday, tm->tm_hour, tm->tm_min); else snprintf (buf, len, "%02dw%dd%02dh", tm->tm_yday/7, tm->tm_yday - ((tm->tm_yday/7) * 7), tm->tm_hour); return buf; } static void bgp_config_write_filter (struct vty *vty, struct peer *peer, afi_t afi, safi_t safi) { struct bgp_filter *filter; struct bgp_filter *gfilter = NULL; char *addr; int in = FILTER_IN; int out = FILTER_OUT; addr = peer->host; filter = &peer->filter[afi][safi]; if (peer->af_group[afi][safi]) gfilter = &peer->group->conf->filter[afi][safi]; /* distribute-list. */ if (filter->dlist[in].name) if (! gfilter || ! gfilter->dlist[in].name || strcmp (filter->dlist[in].name, gfilter->dlist[in].name) != 0) vty_out (vty, " neighbor %s distribute-list %s in%s", addr, filter->dlist[in].name, VTY_NEWLINE); if (filter->dlist[out].name && ! gfilter) vty_out (vty, " neighbor %s distribute-list %s out%s", addr, filter->dlist[out].name, VTY_NEWLINE); /* prefix-list. */ if (filter->plist[in].name) if (! gfilter || ! gfilter->plist[in].name || strcmp (filter->plist[in].name, gfilter->plist[in].name) != 0) vty_out (vty, " neighbor %s prefix-list %s in%s", addr, filter->plist[in].name, VTY_NEWLINE); if (filter->plist[out].name && ! gfilter) vty_out (vty, " neighbor %s prefix-list %s out%s", addr, filter->plist[out].name, VTY_NEWLINE); /* route-map. */ if (filter->map[RMAP_IN].name) if (! gfilter || ! gfilter->map[RMAP_IN].name || strcmp (filter->map[RMAP_IN].name, gfilter->map[RMAP_IN].name) != 0) vty_out (vty, " neighbor %s route-map %s in%s", addr, filter->map[RMAP_IN].name, VTY_NEWLINE); if (filter->map[RMAP_OUT].name && ! gfilter) vty_out (vty, " neighbor %s route-map %s out%s", addr, filter->map[RMAP_OUT].name, VTY_NEWLINE); if (filter->map[RMAP_IMPORT].name && ! gfilter) vty_out (vty, " neighbor %s route-map %s import%s", addr, filter->map[RMAP_IMPORT].name, VTY_NEWLINE); if (filter->map[RMAP_EXPORT].name) if (! gfilter || ! gfilter->map[RMAP_EXPORT].name || strcmp (filter->map[RMAP_EXPORT].name, gfilter->map[RMAP_EXPORT].name) != 0) vty_out (vty, " neighbor %s route-map %s export%s", addr, filter->map[RMAP_EXPORT].name, VTY_NEWLINE); /* unsuppress-map */ if (filter->usmap.name && ! gfilter) vty_out (vty, " neighbor %s unsuppress-map %s%s", addr, filter->usmap.name, VTY_NEWLINE); /* filter-list. */ if (filter->aslist[in].name) if (! gfilter || ! gfilter->aslist[in].name || strcmp (filter->aslist[in].name, gfilter->aslist[in].name) != 0) vty_out (vty, " neighbor %s filter-list %s in%s", addr, filter->aslist[in].name, VTY_NEWLINE); if (filter->aslist[out].name && ! gfilter) vty_out (vty, " neighbor %s filter-list %s out%s", addr, filter->aslist[out].name, VTY_NEWLINE); } /* BGP peer configuration display function. */ static void bgp_config_write_peer (struct vty *vty, struct bgp *bgp, struct peer *peer, afi_t afi, safi_t safi) { struct peer *g_peer = NULL; char buf[SU_ADDRSTRLEN]; char *addr; addr = peer->host; if (peer_group_active (peer)) g_peer = peer->group->conf; /************************************ ****** Global to the neighbor ****** ************************************/ if (afi == AFI_IP && safi == SAFI_UNICAST) { /* remote-as. */ if (! peer_group_active (peer)) { if (CHECK_FLAG (peer->sflags, PEER_STATUS_GROUP)) vty_out (vty, " neighbor %s peer-group%s", addr, VTY_NEWLINE); if (peer->as) vty_out (vty, " neighbor %s remote-as %u%s", addr, peer->as, VTY_NEWLINE); } else { if (! g_peer->as) vty_out (vty, " neighbor %s remote-as %u%s", addr, peer->as, VTY_NEWLINE); if (peer->af_group[AFI_IP][SAFI_UNICAST]) vty_out (vty, " neighbor %s peer-group %s%s", addr, peer->group->name, VTY_NEWLINE); } /* local-as. */ if (peer->change_local_as) if (! peer_group_active (peer)) vty_out (vty, " neighbor %s local-as %u%s%s", addr, peer->change_local_as, CHECK_FLAG (peer->flags, PEER_FLAG_LOCAL_AS_NO_PREPEND) ? " no-prepend" : "", VTY_NEWLINE); /* Description. */ if (peer->desc) vty_out (vty, " neighbor %s description %s%s", addr, peer->desc, VTY_NEWLINE); /* Shutdown. */ if (CHECK_FLAG (peer->flags, PEER_FLAG_SHUTDOWN)) if (! peer_group_active (peer) || ! CHECK_FLAG (g_peer->flags, PEER_FLAG_SHUTDOWN)) vty_out (vty, " neighbor %s shutdown%s", addr, VTY_NEWLINE); /* Password. */ if (peer->password) if (!peer_group_active (peer) || ! g_peer->password || strcmp (peer->password, g_peer->password) != 0) vty_out (vty, " neighbor %s password %s%s", addr, peer->password, VTY_NEWLINE); /* BGP port. */ if (peer->port != BGP_PORT_DEFAULT) vty_out (vty, " neighbor %s port %d%s", addr, peer->port, VTY_NEWLINE); /* Local interface name. */ if (peer->ifname) vty_out (vty, " neighbor %s interface %s%s", addr, peer->ifname, VTY_NEWLINE); /* Passive. */ if (CHECK_FLAG (peer->flags, PEER_FLAG_PASSIVE)) if (! peer_group_active (peer) || ! CHECK_FLAG (g_peer->flags, PEER_FLAG_PASSIVE)) vty_out (vty, " neighbor %s passive%s", addr, VTY_NEWLINE); /* EBGP multihop. */ if (peer_sort (peer) != BGP_PEER_IBGP && peer->ttl != 1 && !(peer->gtsm_hops != 0 && peer->ttl == MAXTTL)) if (! peer_group_active (peer) || g_peer->ttl != peer->ttl) vty_out (vty, " neighbor %s ebgp-multihop %d%s", addr, peer->ttl, VTY_NEWLINE); /* ttl-security hops */ if (peer_sort (peer) != BGP_PEER_IBGP && peer->gtsm_hops != 0) if (! peer_group_active (peer) || g_peer->gtsm_hops != peer->gtsm_hops) vty_out (vty, " neighbor %s ttl-security hops %d%s", addr, peer->gtsm_hops, VTY_NEWLINE); /* disable-connected-check. */ if (CHECK_FLAG (peer->flags, PEER_FLAG_DISABLE_CONNECTED_CHECK)) if (! peer_group_active (peer) || ! CHECK_FLAG (g_peer->flags, PEER_FLAG_DISABLE_CONNECTED_CHECK)) vty_out (vty, " neighbor %s disable-connected-check%s", addr, VTY_NEWLINE); /* Update-source. */ if (peer->update_if) if (! peer_group_active (peer) || ! g_peer->update_if || strcmp (g_peer->update_if, peer->update_if) != 0) vty_out (vty, " neighbor %s update-source %s%s", addr, peer->update_if, VTY_NEWLINE); if (peer->update_source) if (! peer_group_active (peer) || ! g_peer->update_source || sockunion_cmp (g_peer->update_source, peer->update_source) != 0) vty_out (vty, " neighbor %s update-source %s%s", addr, sockunion2str (peer->update_source, buf, SU_ADDRSTRLEN), VTY_NEWLINE); /* advertisement-interval */ if (CHECK_FLAG (peer->config, PEER_CONFIG_ROUTEADV)) vty_out (vty, " neighbor %s advertisement-interval %d%s", addr, peer->v_routeadv, VTY_NEWLINE); /* timers. */ if (CHECK_FLAG (peer->config, PEER_CONFIG_TIMER) && ! peer_group_active (peer)) vty_out (vty, " neighbor %s timers %d %d%s", addr, peer->keepalive, peer->holdtime, VTY_NEWLINE); if (CHECK_FLAG (peer->config, PEER_CONFIG_CONNECT)) vty_out (vty, " neighbor %s timers connect %d%s", addr, peer->connect, VTY_NEWLINE); /* Default weight. */ if (CHECK_FLAG (peer->config, PEER_CONFIG_WEIGHT)) if (! peer_group_active (peer) || g_peer->weight != peer->weight) vty_out (vty, " neighbor %s weight %d%s", addr, peer->weight, VTY_NEWLINE); /* Dynamic capability. */ if (CHECK_FLAG (peer->flags, PEER_FLAG_DYNAMIC_CAPABILITY)) if (! peer_group_active (peer) || ! CHECK_FLAG (g_peer->flags, PEER_FLAG_DYNAMIC_CAPABILITY)) vty_out (vty, " neighbor %s capability dynamic%s", addr, VTY_NEWLINE); /* dont capability negotiation. */ if (CHECK_FLAG (peer->flags, PEER_FLAG_DONT_CAPABILITY)) if (! peer_group_active (peer) || ! CHECK_FLAG (g_peer->flags, PEER_FLAG_DONT_CAPABILITY)) vty_out (vty, " neighbor %s dont-capability-negotiate%s", addr, VTY_NEWLINE); /* override capability negotiation. */ if (CHECK_FLAG (peer->flags, PEER_FLAG_OVERRIDE_CAPABILITY)) if (! peer_group_active (peer) || ! CHECK_FLAG (g_peer->flags, PEER_FLAG_OVERRIDE_CAPABILITY)) vty_out (vty, " neighbor %s override-capability%s", addr, VTY_NEWLINE); /* strict capability negotiation. */ if (CHECK_FLAG (peer->flags, PEER_FLAG_STRICT_CAP_MATCH)) if (! peer_group_active (peer) || ! CHECK_FLAG (g_peer->flags, PEER_FLAG_STRICT_CAP_MATCH)) vty_out (vty, " neighbor %s strict-capability-match%s", addr, VTY_NEWLINE); if (! peer_group_active (peer)) { if (bgp_flag_check (bgp, BGP_FLAG_NO_DEFAULT_IPV4)) { if (peer->afc[AFI_IP][SAFI_UNICAST]) vty_out (vty, " neighbor %s activate%s", addr, VTY_NEWLINE); } else { if (! peer->afc[AFI_IP][SAFI_UNICAST]) vty_out (vty, " no neighbor %s activate%s", addr, VTY_NEWLINE); } } } /************************************ ****** Per AF to the neighbor ****** ************************************/ if (! (afi == AFI_IP && safi == SAFI_UNICAST)) { if (peer->af_group[afi][safi]) vty_out (vty, " neighbor %s peer-group %s%s", addr, peer->group->name, VTY_NEWLINE); else vty_out (vty, " neighbor %s activate%s", addr, VTY_NEWLINE); } /* ORF capability. */ if (CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_ORF_PREFIX_SM) || CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_ORF_PREFIX_RM)) if (! peer->af_group[afi][safi]) { vty_out (vty, " neighbor %s capability orf prefix-list", addr); if (CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_ORF_PREFIX_SM) && CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_ORF_PREFIX_RM)) vty_out (vty, " both"); else if (CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_ORF_PREFIX_SM)) vty_out (vty, " send"); else vty_out (vty, " receive"); vty_out (vty, "%s", VTY_NEWLINE); } /* Route reflector client. */ if (peer_af_flag_check (peer, afi, safi, PEER_FLAG_REFLECTOR_CLIENT) && ! peer->af_group[afi][safi]) vty_out (vty, " neighbor %s route-reflector-client%s", addr, VTY_NEWLINE); /* Nexthop self. */ if (peer_af_flag_check (peer, afi, safi, PEER_FLAG_NEXTHOP_SELF) && ! peer->af_group[afi][safi]) vty_out (vty, " neighbor %s next-hop-self%s", addr, VTY_NEWLINE); /* Remove private AS. */ if (peer_af_flag_check (peer, afi, safi, PEER_FLAG_REMOVE_PRIVATE_AS) && ! peer->af_group[afi][safi]) vty_out (vty, " neighbor %s remove-private-AS%s", addr, VTY_NEWLINE); /* send-community print. */ if (! peer->af_group[afi][safi]) { if (bgp_option_check (BGP_OPT_CONFIG_CISCO)) { if (peer_af_flag_check (peer, afi, safi, PEER_FLAG_SEND_COMMUNITY) && peer_af_flag_check (peer, afi, safi, PEER_FLAG_SEND_EXT_COMMUNITY)) vty_out (vty, " neighbor %s send-community both%s", addr, VTY_NEWLINE); else if (peer_af_flag_check (peer, afi, safi, PEER_FLAG_SEND_EXT_COMMUNITY)) vty_out (vty, " neighbor %s send-community extended%s", addr, VTY_NEWLINE); else if (peer_af_flag_check (peer, afi, safi, PEER_FLAG_SEND_COMMUNITY)) vty_out (vty, " neighbor %s send-community%s", addr, VTY_NEWLINE); } else { if (! peer_af_flag_check (peer, afi, safi, PEER_FLAG_SEND_COMMUNITY) && ! peer_af_flag_check (peer, afi, safi, PEER_FLAG_SEND_EXT_COMMUNITY)) vty_out (vty, " no neighbor %s send-community both%s", addr, VTY_NEWLINE); else if (! peer_af_flag_check (peer, afi, safi, PEER_FLAG_SEND_EXT_COMMUNITY)) vty_out (vty, " no neighbor %s send-community extended%s", addr, VTY_NEWLINE); else if (! peer_af_flag_check (peer, afi, safi, PEER_FLAG_SEND_COMMUNITY)) vty_out (vty, " no neighbor %s send-community%s", addr, VTY_NEWLINE); } } /* Default information */ if (peer_af_flag_check (peer, afi, safi, PEER_FLAG_DEFAULT_ORIGINATE) && ! peer->af_group[afi][safi]) { vty_out (vty, " neighbor %s default-originate", addr); if (peer->default_rmap[afi][safi].name) vty_out (vty, " route-map %s", peer->default_rmap[afi][safi].name); vty_out (vty, "%s", VTY_NEWLINE); } /* Soft reconfiguration inbound. */ if (CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_SOFT_RECONFIG)) if (! peer->af_group[afi][safi] || ! CHECK_FLAG (g_peer->af_flags[afi][safi], PEER_FLAG_SOFT_RECONFIG)) vty_out (vty, " neighbor %s soft-reconfiguration inbound%s", addr, VTY_NEWLINE); /* maximum-prefix. */ if (CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX)) if (! peer->af_group[afi][safi] || g_peer->pmax[afi][safi] != peer->pmax[afi][safi] || g_peer->pmax_threshold[afi][safi] != peer->pmax_threshold[afi][safi] || CHECK_FLAG (g_peer->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX_WARNING) != CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX_WARNING)) { vty_out (vty, " neighbor %s maximum-prefix %ld", addr, peer->pmax[afi][safi]); if (peer->pmax_threshold[afi][safi] != MAXIMUM_PREFIX_THRESHOLD_DEFAULT) vty_out (vty, " %d", peer->pmax_threshold[afi][safi]); if (CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX_WARNING)) vty_out (vty, " warning-only"); if (peer->pmax_restart[afi][safi]) vty_out (vty, " restart %d", peer->pmax_restart[afi][safi]); vty_out (vty, "%s", VTY_NEWLINE); } /* Route server client. */ if (CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT) && ! peer->af_group[afi][safi]) vty_out (vty, " neighbor %s route-server-client%s", addr, VTY_NEWLINE); /* Nexthop-local unchanged. */ if (CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED) && ! peer->af_group[afi][safi]) vty_out (vty, " neighbor %s nexthop-local unchanged%s", addr, VTY_NEWLINE); /* Allow AS in. */ if (peer_af_flag_check (peer, afi, safi, PEER_FLAG_ALLOWAS_IN)) if (! peer_group_active (peer) || ! peer_af_flag_check (g_peer, afi, safi, PEER_FLAG_ALLOWAS_IN) || peer->allowas_in[afi][safi] != g_peer->allowas_in[afi][safi]) { if (peer->allowas_in[afi][safi] == 3) vty_out (vty, " neighbor %s allowas-in%s", addr, VTY_NEWLINE); else vty_out (vty, " neighbor %s allowas-in %d%s", addr, peer->allowas_in[afi][safi], VTY_NEWLINE); } /* Filter. */ bgp_config_write_filter (vty, peer, afi, safi); /* atribute-unchanged. */ if ((CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_AS_PATH_UNCHANGED) || CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_NEXTHOP_UNCHANGED) || CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_MED_UNCHANGED)) && ! peer->af_group[afi][safi]) { if (CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_AS_PATH_UNCHANGED) && CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_NEXTHOP_UNCHANGED) && CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_MED_UNCHANGED)) vty_out (vty, " neighbor %s attribute-unchanged%s", addr, VTY_NEWLINE); else vty_out (vty, " neighbor %s attribute-unchanged%s%s%s%s", addr, (CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_AS_PATH_UNCHANGED)) ? " as-path" : "", (CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_NEXTHOP_UNCHANGED)) ? " next-hop" : "", (CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_MED_UNCHANGED)) ? " med" : "", VTY_NEWLINE); } } /* Display "address-family" configuration header. */ void bgp_config_write_family_header (struct vty *vty, afi_t afi, safi_t safi, int *write) { if (*write) return; if (afi == AFI_IP && safi == SAFI_UNICAST) return; vty_out (vty, "!%s address-family ", VTY_NEWLINE); if (afi == AFI_IP) { if (safi == SAFI_MULTICAST) vty_out (vty, "ipv4 multicast"); else if (safi == SAFI_MPLS_VPN) vty_out (vty, "vpnv4 unicast"); } else if (afi == AFI_IP6) { vty_out (vty, "ipv6"); if (safi == SAFI_MULTICAST) vty_out (vty, " multicast"); } vty_out (vty, "%s", VTY_NEWLINE); *write = 1; } /* Address family based peer configuration display. */ static int bgp_config_write_family (struct vty *vty, struct bgp *bgp, afi_t afi, safi_t safi) { int write = 0; struct peer *peer; struct peer_group *group; struct listnode *node, *nnode; bgp_config_write_network (vty, bgp, afi, safi, &write); bgp_config_write_redistribute (vty, bgp, afi, safi, &write); for (ALL_LIST_ELEMENTS (bgp->group, node, nnode, group)) { if (group->conf->afc[afi][safi]) { bgp_config_write_family_header (vty, afi, safi, &write); bgp_config_write_peer (vty, bgp, group->conf, afi, safi); } } for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) { if (peer->afc[afi][safi]) { if (! CHECK_FLAG (peer->sflags, PEER_STATUS_ACCEPT_PEER)) { bgp_config_write_family_header (vty, afi, safi, &write); bgp_config_write_peer (vty, bgp, peer, afi, safi); } } } bgp_config_write_maxpaths (vty, bgp, afi, safi, &write); if (write) vty_out (vty, " exit-address-family%s", VTY_NEWLINE); return write; } int bgp_config_write (struct vty *vty) { int write = 0; struct bgp *bgp; struct peer_group *group; struct peer *peer; struct listnode *node, *nnode; struct listnode *mnode, *mnnode; /* BGP Multiple instance. */ if (bgp_option_check (BGP_OPT_MULTIPLE_INSTANCE)) { vty_out (vty, "bgp multiple-instance%s", VTY_NEWLINE); write++; } /* BGP Config type. */ if (bgp_option_check (BGP_OPT_CONFIG_CISCO)) { vty_out (vty, "bgp config-type cisco%s", VTY_NEWLINE); write++; } /* BGP configuration. */ for (ALL_LIST_ELEMENTS (bm->bgp, mnode, mnnode, bgp)) { if (write) vty_out (vty, "!%s", VTY_NEWLINE); /* Router bgp ASN */ vty_out (vty, "router bgp %u", bgp->as); if (bgp_option_check (BGP_OPT_MULTIPLE_INSTANCE)) { if (bgp->name) vty_out (vty, " view %s", bgp->name); } vty_out (vty, "%s", VTY_NEWLINE); /* No Synchronization */ if (bgp_option_check (BGP_OPT_CONFIG_CISCO)) vty_out (vty, " no synchronization%s", VTY_NEWLINE); /* BGP fast-external-failover. */ if (CHECK_FLAG (bgp->flags, BGP_FLAG_NO_FAST_EXT_FAILOVER)) vty_out (vty, " no bgp fast-external-failover%s", VTY_NEWLINE); /* BGP router ID. */ if (CHECK_FLAG (bgp->config, BGP_CONFIG_ROUTER_ID)) vty_out (vty, " bgp router-id %s%s", inet_ntoa (bgp->router_id), VTY_NEWLINE); /* BGP log-neighbor-changes. */ if (bgp_flag_check (bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES)) vty_out (vty, " bgp log-neighbor-changes%s", VTY_NEWLINE); /* BGP configuration. */ if (bgp_flag_check (bgp, BGP_FLAG_ALWAYS_COMPARE_MED)) vty_out (vty, " bgp always-compare-med%s", VTY_NEWLINE); /* BGP default ipv4-unicast. */ if (bgp_flag_check (bgp, BGP_FLAG_NO_DEFAULT_IPV4)) vty_out (vty, " no bgp default ipv4-unicast%s", VTY_NEWLINE); /* BGP default local-preference. */ if (bgp->default_local_pref != BGP_DEFAULT_LOCAL_PREF) vty_out (vty, " bgp default local-preference %d%s", bgp->default_local_pref, VTY_NEWLINE); /* BGP client-to-client reflection. */ if (bgp_flag_check (bgp, BGP_FLAG_NO_CLIENT_TO_CLIENT)) vty_out (vty, " no bgp client-to-client reflection%s", VTY_NEWLINE); /* BGP cluster ID. */ if (CHECK_FLAG (bgp->config, BGP_CONFIG_CLUSTER_ID)) vty_out (vty, " bgp cluster-id %s%s", inet_ntoa (bgp->cluster_id), VTY_NEWLINE); /* Confederation identifier*/ if (CHECK_FLAG (bgp->config, BGP_CONFIG_CONFEDERATION)) vty_out (vty, " bgp confederation identifier %i%s", bgp->confed_id, VTY_NEWLINE); /* Confederation peer */ if (bgp->confed_peers_cnt > 0) { int i; vty_out (vty, " bgp confederation peers"); for (i = 0; i < bgp->confed_peers_cnt; i++) vty_out(vty, " %u", bgp->confed_peers[i]); vty_out (vty, "%s", VTY_NEWLINE); } /* BGP enforce-first-as. */ if (bgp_flag_check (bgp, BGP_FLAG_ENFORCE_FIRST_AS)) vty_out (vty, " bgp enforce-first-as%s", VTY_NEWLINE); /* BGP deterministic-med. */ if (bgp_flag_check (bgp, BGP_FLAG_DETERMINISTIC_MED)) vty_out (vty, " bgp deterministic-med%s", VTY_NEWLINE); /* BGP graceful-restart. */ if (bgp->stalepath_time != BGP_DEFAULT_STALEPATH_TIME) vty_out (vty, " bgp graceful-restart stalepath-time %d%s", bgp->stalepath_time, VTY_NEWLINE); if (bgp_flag_check (bgp, BGP_FLAG_GRACEFUL_RESTART)) vty_out (vty, " bgp graceful-restart%s", VTY_NEWLINE); /* BGP bestpath method. */ if (bgp_flag_check (bgp, BGP_FLAG_ASPATH_IGNORE)) vty_out (vty, " bgp bestpath as-path ignore%s", VTY_NEWLINE); if (bgp_flag_check (bgp, BGP_FLAG_ASPATH_CONFED)) vty_out (vty, " bgp bestpath as-path confed%s", VTY_NEWLINE); if (bgp_flag_check (bgp, BGP_FLAG_COMPARE_ROUTER_ID)) vty_out (vty, " bgp bestpath compare-routerid%s", VTY_NEWLINE); if (bgp_flag_check (bgp, BGP_FLAG_MED_CONFED) || bgp_flag_check (bgp, BGP_FLAG_MED_MISSING_AS_WORST)) { vty_out (vty, " bgp bestpath med"); if (bgp_flag_check (bgp, BGP_FLAG_MED_CONFED)) vty_out (vty, " confed"); if (bgp_flag_check (bgp, BGP_FLAG_MED_MISSING_AS_WORST)) vty_out (vty, " missing-as-worst"); vty_out (vty, "%s", VTY_NEWLINE); } /* BGP network import check. */ if (bgp_flag_check (bgp, BGP_FLAG_IMPORT_CHECK)) vty_out (vty, " bgp network import-check%s", VTY_NEWLINE); /* BGP scan interval. */ bgp_config_write_scan_time (vty); /* BGP flag dampening. */ if (CHECK_FLAG (bgp->af_flags[AFI_IP][SAFI_UNICAST], BGP_CONFIG_DAMPENING)) bgp_config_write_damp (vty); /* BGP static route configuration. */ bgp_config_write_network (vty, bgp, AFI_IP, SAFI_UNICAST, &write); /* BGP redistribute configuration. */ bgp_config_write_redistribute (vty, bgp, AFI_IP, SAFI_UNICAST, &write); /* BGP timers configuration. */ if (bgp->default_keepalive != BGP_DEFAULT_KEEPALIVE && bgp->default_holdtime != BGP_DEFAULT_HOLDTIME) vty_out (vty, " timers bgp %d %d%s", bgp->default_keepalive, bgp->default_holdtime, VTY_NEWLINE); /* peer-group */ for (ALL_LIST_ELEMENTS (bgp->group, node, nnode, group)) { bgp_config_write_peer (vty, bgp, group->conf, AFI_IP, SAFI_UNICAST); } /* Normal neighbor configuration. */ for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) { if (! CHECK_FLAG (peer->sflags, PEER_STATUS_ACCEPT_PEER)) bgp_config_write_peer (vty, bgp, peer, AFI_IP, SAFI_UNICAST); } /* maximum-paths */ bgp_config_write_maxpaths (vty, bgp, AFI_IP, SAFI_UNICAST, &write); /* Distance configuration. */ bgp_config_write_distance (vty, bgp); /* No auto-summary */ if (bgp_option_check (BGP_OPT_CONFIG_CISCO)) vty_out (vty, " no auto-summary%s", VTY_NEWLINE); /* IPv4 multicast configuration. */ write += bgp_config_write_family (vty, bgp, AFI_IP, SAFI_MULTICAST); /* IPv4 VPN configuration. */ write += bgp_config_write_family (vty, bgp, AFI_IP, SAFI_MPLS_VPN); /* IPv6 unicast configuration. */ write += bgp_config_write_family (vty, bgp, AFI_IP6, SAFI_UNICAST); /* IPv6 multicast configuration. */ write += bgp_config_write_family (vty, bgp, AFI_IP6, SAFI_MULTICAST); write++; } return write; } void bgp_master_init (void) { memset (&bgp_master, 0, sizeof (struct bgp_master)); bm = &bgp_master; bm->bgp = list_new (); bm->listen_sockets = list_new (); bm->port = BGP_PORT_DEFAULT; bm->master = thread_master_create (); bm->start_time = bgp_clock (); } void bgp_init (void) { /* BGP VTY commands installation. */ bgp_vty_init (); /* Init kroute. */ bgp_kroute_init (); /* BGP inits. */ bgp_attr_init (); bgp_debug_init (); bgp_dump_init (); bgp_route_init (); bgp_route_map_init (); bgp_scan_init (); bgp_mplsvpn_init (); /* Access list initialize. */ access_list_init (); access_list_add_hook (peer_distribute_update); access_list_delete_hook (peer_distribute_update); /* Filter list initialize. */ bgp_filter_init (); as_list_add_hook (peer_aslist_update); as_list_delete_hook (peer_aslist_update); /* Prefix list initialize.*/ prefix_list_init (); prefix_list_add_hook (peer_prefix_list_update); prefix_list_delete_hook (peer_prefix_list_update); /* Community list initialize. */ bgp_clist = community_list_init (); #ifdef HAVE_SNMP bgp_snmp_init (); #endif /* HAVE_SNMP */ } void bgp_terminate (void) { struct bgp *bgp; struct peer *peer; struct listnode *node, *nnode; struct listnode *mnode, *mnnode; for (ALL_LIST_ELEMENTS (bm->bgp, mnode, mnnode, bgp)) for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer)) if (peer->status == Established) bgp_notify_send (peer, BGP_NOTIFY_CEASE, BGP_NOTIFY_CEASE_PEER_UNCONFIG); bgp_cleanup_routes (); if (bm->process_main_queue) { work_queue_free (bm->process_main_queue); bm->process_main_queue = NULL; } if (bm->process_rsclient_queue) { work_queue_free (bm->process_rsclient_queue); bm->process_rsclient_queue = NULL; } }
AirbornWdd/qpimd
bgpd/bgpd.c
C
gpl-2.0
144,930
25.597541
95
0.603898
false
/**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the examples of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial Usage ** Licensees holding valid Qt Commercial licenses may use this file in ** accordance with the Qt Commercial License Agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and Nokia. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL included in the ** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, Nokia gives you certain additional ** rights. These rights are described in the Nokia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 3.0 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. Please review the following information to ** ensure the GNU General Public License version 3.0 requirements will be ** met: http://www.gnu.org/copyleft/gpl.html. ** ** If you have questions regarding the use of this file, please contact ** Nokia at qt-info@nokia.com. ** $QT_END_LICENSE$ ** ****************************************************************************/ #ifndef FLOWLAYOUT_H #define FLOWLAYOUT_H #include <QLayout> #include <QRect> #include <QWidgetItem> //! [0] class FlowLayout : public QLayout { public: FlowLayout(QWidget *parent, int margin = -1, int hSpacing = -1, int vSpacing = -1); FlowLayout(int margin = -1, int hSpacing = -1, int vSpacing = -1); ~FlowLayout(); void addItem(QLayoutItem *item); int horizontalSpacing() const; int verticalSpacing() const; Qt::Orientations expandingDirections() const; bool hasHeightForWidth() const; int heightForWidth(int) const; int count() const; QLayoutItem *itemAt(int index) const; QSize minimumSize() const; void setGeometry(const QRect &rect); QSize sizeHint() const; QLayoutItem *takeAt(int index); private: int doLayout(const QRect &rect, bool testOnly) const; int smartSpacing(QStyle::PixelMetric pm) const; QList<QLayoutItem *> itemList; int m_hSpace; int m_vSpace; }; //! [0] #endif
librelab/qtmoko-test
qtopiacore/qt/examples/layouts/flowlayout/flowlayout.h
C
gpl-2.0
2,910
35.835443
87
0.691409
false
@charset "utf-8"; /* CSS Document */ /* Dark Categories */ #categories_container{ background:url(images/categories_bg.png) !important; border:1px solid #4e4e4e !important; border-right:0 !important; border-left:0 !important; } #categories ul li a{ color:#fff !important; text-shadow:1px 1px #000 !important; border-right:1px solid #2d2d2d !important; } #categories .home_first_line{ border-left:1px solid #2d2d2d !important; } #categories .home_second_line{ border-left:1px solid #000000 !important; } #categories ul li{ border-right:1px solid #000000 !important; } #categories ul li a:hover{ background:url(images/categories_bg_hover.png) !important; color:#ccc !important; } #categories .current-cat a{ background:url(images/categories_bg_hover.png) !important; } .secondnav-menu ul{ background:#000 !important; border:1px solid #181818 !important; } .secondnav-menu li li a{ border-top:1px solid #181818 !important; } #categories ul li ul li a:hover{ background:none !important; }
tbinjiayou/CSerzs
wp-content/themes/broadcast/scripts/css/styles/dark/categories.css
CSS
gpl-2.0
1,067
18.132075
59
0.693533
false
<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'> <html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en' lang='en'> <head> <meta http-equiv='Content-Type' content='text/html; charset=utf-8'/> <title>Index of Types</title> <link href='reno.css' type='text/css' rel='stylesheet'/> </head> <body> <div class="body-0"> <div class="body-1"> <div class="body-2"> <div> <h1>QVM: Quaternions, Vectors, Matrices</h1> </div> <!-- Copyright (c) 2008-2016 Emil Dotchevski and Reverge Studios, Inc. --> <!-- Distributed under the Boost Software License, Version 1.0. (See accompanying --> <!-- file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) --> <div class="RenoIncludeDIV"><div class="RenoAutoDIV"><h3>Index of Types</h3> </div> <div class="RenoIndex"><h3>d</h3> <p><a href="deduce_mat.html">deduce_mat</a></p> <p><a href="deduce_mat2.html">deduce_mat2</a></p> <p><a href="deduce_quat.html">deduce_quat</a></p> <p><a href="deduce_quat2.html">deduce_quat2</a></p> <p><a href="deduce_scalar.html">deduce_scalar</a></p> <p><a href="deduce_vec.html">deduce_vec</a></p> <p><a href="deduce_vec2.html">deduce_vec2</a></p> <h3>i</h3> <p><a href="is_mat.html">is_mat</a></p> <p><a href="is_quat.html">is_quat</a></p> <p><a href="is_scalar.html">is_scalar</a></p> <p><a href="is_vec.html">is_vec</a></p> <h3>m</h3> <p><a href="mat.html">mat</a></p> <p><a href="mat_traits.html">mat_traits</a></p> <p><a href="mat_traits_M_scalar_type.html">mat_traits&lt;M&gt;::scalar_type</a></p> <h3>q</h3> <p><a href="quat.html">quat</a></p> <p><a href="quat_traits.html">quat_traits</a></p> <p><a href="quat_traits_Q_scalar_type.html">quat_traits&lt;Q&gt;::scalar_type</a></p> <h3>s</h3> <p><a href="scalar.html">scalar</a></p> <p><a href="scalar_traits.html">scalar_traits</a></p> <h3>v</h3> <p><a href="vec.html">vec</a></p> <p><a href="vec_traits.html">vec_traits</a></p> <p><a href="vec_traits_V_scalar_type.html">vec_traits&lt;V&gt;::scalar_type</a></p> </div> </div><div class="RenoAutoDIV"><div class="RenoHR"><hr/></div> See also: <span class="RenoPageList"><a href="index.html">Boost QVM</a></span> </div> <!-- Copyright (c) 2008-2016 Emil Dotchevski and Reverge Studios, Inc. --> <!-- Distributed under the Boost Software License, Version 1.0. (See accompanying --> <!-- file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) --> <div id="footer"> <p> <a class="logo" href="http://jigsaw.w3.org/css-validator/check/referer"><img class="logo_pic" src="valid-css.png" alt="Valid CSS" height="31" width="88"/></a> <a class="logo" href="http://validator.w3.org/check?uri=referer"><img class="logo_pic" src="valid-xhtml.png" alt="Valid XHTML 1.0" height="31" width="88"/></a> <small>Copyright (c) 2008-2016 by Emil Dotchevski and Reverge Studios, Inc.<br/> Distributed under the <a href="http://www.boost.org/LICENSE_1_0.txt">Boost Software License, Version 1.0</a>.</small> </p> </div> </div> </div> </div> </body> </html>
FFMG/myoddweb.piger
myodd/boost/libs/qvm/doc/Index_of_Types.html
HTML
gpl-2.0
2,996
43.058824
159
0.654539
false
using Mono.Data.Sqlite; namespace Noised.Core.DB.Sqlite { /// <summary> /// Factory for creating Sqlite connections /// </summary> public interface ISqliteConnectionFactory { /// <summary> /// Creates a new, still closed connection /// </summary> SqliteConnection Create(); }; }
bennygr/noised
src/NoisedCore/DB/Sqlite/ISqliteConnectionFactory.cs
C#
gpl-2.0
296
18.733333
45
0.682432
false
module.exports = function(grunt) { require("matchdep").filterDev("grunt-*").forEach(grunt.loadNpmTasks); grunt.initConfig({ pkg: grunt.file.readJSON("package.json"), copy: { main: { expand: true, cwd: "src/", src: ["**", "!css/**/*.scss", "!css/**/*.less"], dest: "dist/" } }, less: { options: { paths: ["src/css"] }, src: { expand: true, cwd: "src/css", src: "*.less", ext: ".css", dest: "src/css" } }, sass: { dist:{ options:{ style: 'expanded', // values: nested, expanded, compact, compressed noCache: true }, files:[{ expand: true, cwd: "src/css", src: ["*.scss"], dest: "src/css", ext: ".css" }] } }, watch: { options: { nospawn: true, livereload: true }, less: { files: ["src/css/**/*.less"], tasks: ["less"] }, sass: { files: ["src/css/**/*.scss"], tasks: ["sass"] }, copy: { files: ["src/**"], tasks: ["copy:main"] } } }); grunt.registerTask("default", ["watch"]); };
MDIAZ88/mad-css-less-sass
Gruntfile.js
JavaScript
gpl-2.0
1,266
18.78125
77
0.403633
false
<div class="toggle-region"></div>
atogle/assisi
src/web/jstemplates/request-layout-tpl.html
HTML
gpl-2.0
33
33
33
0.69697
false
<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"> <html> <head> <title>PHPXRef 0.7.1 : Unnamed Project : Variable Reference: $force_regexp_dirname</title> <link rel="stylesheet" href="../sample.css" type="text/css"> <link rel="stylesheet" href="../sample-print.css" type="text/css" media="print"> <style id="hilight" type="text/css"></style> <meta http-equiv="content-type" content="text/html;charset=iso-8859-1"> </head> <body bgcolor="#ffffff" text="#000000" link="#801800" vlink="#300540" alink="#ffffff"> <table class="pagetitle" width="100%"> <tr> <td valign="top" class="pagetitle"> [ <a href="../index.html">Index</a> ] </td> <td align="right" class="pagetitle"> <h2 style="margin-bottom: 0px">PHP Cross Reference of Unnamed Project</h2> </td> </tr> </table> <!-- Generated by PHPXref 0.7.1 at Sat Nov 21 22:13:19 2015 --> <!-- PHPXref (c) 2000-2010 Gareth Watts - gareth@omnipotent.net --> <!-- http://phpxref.sourceforge.net/ --> <script src="../phpxref.js" type="text/javascript"></script> <script language="JavaScript" type="text/javascript"> <!-- ext='.html'; relbase='../'; subdir='_variables'; filename='index.html'; cookiekey='phpxref'; handleNavFrame(relbase, subdir, filename); logVariable('force_regexp_dirname'); // --> </script> <script language="JavaScript" type="text/javascript"> if (gwGetCookie('xrefnav')=='off') document.write('<p class="navlinks">[ <a href="javascript:navOn()">Show Explorer<\/a> ]<\/p>'); else document.write('<p class="navlinks">[ <a href="javascript:navOff()">Hide Explorer<\/a> ]<\/p>'); </script> <noscript> <p class="navlinks"> [ <a href="../nav.html" target="_top">Show Explorer</a> ] [ <a href="index.html" target="_top">Hide Navbar</a> ] </p> </noscript> [<a href="../index.html">Top level directory</a>]<br> <script language="JavaScript" type="text/javascript"> <!-- document.writeln('<table align="right" class="searchbox-link"><tr><td><a class="searchbox-link" href="javascript:void(0)" onMouseOver="showSearchBox()">Search</a><br>'); document.writeln('<table border="0" cellspacing="0" cellpadding="0" class="searchbox" id="searchbox">'); document.writeln('<tr><td class="searchbox-title">'); document.writeln('<a class="searchbox-title" href="javascript:showSearchPopup()">Search History +</a>'); document.writeln('<\/td><\/tr>'); document.writeln('<tr><td class="searchbox-body" id="searchbox-body">'); document.writeln('<form name="search" style="margin:0px; padding:0px" onSubmit=\'return jump()\'>'); document.writeln('<a class="searchbox-body" href="../_classes/index.html">Class<\/a>: '); document.writeln('<input type="text" size=10 value="" name="classname"><br>'); document.writeln('<a id="funcsearchlink" class="searchbox-body" href="../_functions/index.html">Function<\/a>: '); document.writeln('<input type="text" size=10 value="" name="funcname"><br>'); document.writeln('<a class="searchbox-body" href="../_variables/index.html">Variable<\/a>: '); document.writeln('<input type="text" size=10 value="" name="varname"><br>'); document.writeln('<a class="searchbox-body" href="../_constants/index.html">Constant<\/a>: '); document.writeln('<input type="text" size=10 value="" name="constname"><br>'); document.writeln('<a class="searchbox-body" href="../_tables/index.html">Table<\/a>: '); document.writeln('<input type="text" size=10 value="" name="tablename"><br>'); document.writeln('<input type="submit" class="searchbox-button" value="Search">'); document.writeln('<\/form>'); document.writeln('<\/td><\/tr><\/table>'); document.writeln('<\/td><\/tr><\/table>'); // --> </script> <div id="search-popup" class="searchpopup"><p id="searchpopup-title" class="searchpopup-title">title</p><div id="searchpopup-body" class="searchpopup-body">Body</div><p class="searchpopup-close"><a href="javascript:gwCloseActive()">[close]</a></p></div> <h3>Variable Cross Reference</h3> <h2><a href="index.html#force_regexp_dirname">$force_regexp_dirname</a></h2> <b>Defined at:</b><ul> <li><a href="../conf/_advanced.php.html">/conf/_advanced.php</A> -> <a href="../conf/_advanced.php.source.html#l661"> line 661</A></li> </ul> <br><b>Referenced 6 times:</b><ul> <li><a href="../inc/files/views/_file_settings.form.php.html">/inc/files/views/_file_settings.form.php</a> -> <a href="../inc/files/views/_file_settings.form.php.source.html#l179"> line 179</a></li> <li><a href="../inc/files/views/_file_settings.form.php.html">/inc/files/views/_file_settings.form.php</a> -> <a href="../inc/files/views/_file_settings.form.php.source.html#l193"> line 193</a></li> <li><a href="../inc/files/model/_file.funcs.php.html">/inc/files/model/_file.funcs.php</a> -> <a href="../inc/files/model/_file.funcs.php.source.html#l634"> line 634</a></li> <li><a href="../inc/files/model/_file.funcs.php.html">/inc/files/model/_file.funcs.php</a> -> <a href="../inc/files/model/_file.funcs.php.source.html#l643"> line 643</a></li> <li><a href="../inc/files/model/_file.funcs.php.html">/inc/files/model/_file.funcs.php</a> -> <a href="../inc/files/model/_file.funcs.php.source.html#l645"> line 645</a></li> <li><a href="../conf/_advanced.php.html">/conf/_advanced.php</a> -> <a href="../conf/_advanced.php.source.html#l661"> line 661</a></li> </ul> <!-- A link to the phpxref site in your customized footer file is appreciated ;-) --> <br><hr> <table width="100%"> <tr><td>Generated: Sat Nov 21 22:13:19 2015</td> <td align="right"><i>Cross-referenced by <a href="http://phpxref.sourceforge.net/">PHPXref 0.7.1</a></i></td> </tr> </table> </body></html>
mgsolipa/b2evolution_phpxref
_variables/force_regexp_dirname.html
HTML
gpl-2.0
5,639
54.831683
253
0.665012
false
/* vi: set sw=4 ts=4: */ /* * Utility routines. * * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org> * * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. */ #include "libbb.h" void bb_herror_msg(const char *s, ...) { va_list p; va_start(p, s); bb_vherror_msg(s, p); va_end(p); }
xxha/busybox-1.6.0
libbb/herror_msg.c
C
gpl-2.0
336
16.684211
79
0.633929
false
#!/usr/bin/python "feed fetcher" from db import MySQLDatabase from fetcher import FeedFetcher def main(): db = MySQLDatabase() fetcher = FeedFetcher() feeds = db.get_feeds(offset=0, limit=10) read_count = 10 while len(feeds) > 0: for feed in feeds: fid = feed[0] url = feed[1] title = feed[2] print "fetching #{0}: {1}".format(fid, url) entries = fetcher.fetch(url) for entry in entries: entry.feed_id = fid try: print "insert {0}".format(entry.url) except UnicodeEncodeError: print "insert {0}".format(entry.url.encode('utf-8')) db.append_feed_content(entry) feeds = db.get_feeds(offset=read_count, limit=10) read_count += 10 if __name__ == '__main__': main()
hylom/grrreader
backend/feedfetcher.py
Python
gpl-2.0
889
27.677419
72
0.52306
false
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package sv.edu.uesocc.ingenieria.disenio2_2015.pymesell.presentacion.pymesellv1desktopclient; /** * * @author David */ public class Main { /** * @param args the command line arguments */ public static void main(String[] args) { System.out.println("Hola a todos!!!"); } }
girondave/Proyecto_Disenio2_2015-PymeSell_v1
PymeSellV1DesktopClient/src/java/sv/edu/uesocc/ingenieria/disenio2_2015/pymesell/presentacion/pymesellv1desktopclient/Main.java
Java
gpl-2.0
496
22.619048
93
0.673387
false
<?php global $post; $date_format = get_option('date_format'); $author_id=$post->post_author; $options = ST_Page_Builder::get_page_options($post->ID, array()); ?> <div <?php post_class(); ?>> <?php // show thumbnails if(st_get_setting('sc_show_featured_img','y')!='n'){ $thumb = st_theme_post_thumbnail($post->ID,array('force_video_size'=> false), false); ?> <?php if($thumb!=''){ ?> <div class="entry-thumbnail main-img"> <?php echo $thumb; if (isset($options['count_lessons']) && ($caption = $options['caption_featured_image']) != '') echo '<p class="lead">'. $caption .'</p>'; ?> </div> <?php } } ?> <div class="entry-content"> <?php // show the content if(function_exists('st_the_builder_content')){ if(!st_the_builder_content($post->ID)){ the_content(); } }else{ the_content(); } ?> </div> <?php // pagination for single $args = array( 'before' => '<p class="single-pagination">' . __('Pages:','smooththemes'), 'after' => '</p>', 'link_before' => '', 'link_after' => '', 'next_or_number' => 'number', 'nextpagelink' => __('Next page','smooththemes'), 'previouspagelink' => __('Previous page','smooththemes'), 'pagelink' => '%', 'echo' => 1 ); wp_link_pages( $args ); if(st_get_setting('sc_show_post_tag','y')!='n'){ echo get_the_term_list( $post->ID, 'course_category', '<div class="entry-tags"> '.__('Categories: '), ', ', '</div>' ); } if(st_get_setting("sc_show_author_desc",'y') != 'n'){ st_theme_author_template($author_id); }; if(st_get_setting("sc_show_comments",'y') != 'n'){ ?> <div id="comments"> <?php comments_template('', true ); ?> </div><!-- /#comments--> <?php } ?> </div><!-- /. end post_class -->
dangxuanha/wordpress_language
wp-content/themes/Edu/content-course.php
PHP
gpl-2.0
2,082
32.163934
127
0.466378
false
INTERFACE: #include "initcalls.h" #include "types.h" class Jdb_symbol_info; class Jdb_lines_info; class Jdb_dbinfo { }; //--------------------------------------------------------------------------- IMPLEMENTATION: #include "config.h" // We have to do this here because Jdb_symbol and Jdb_lines must not depend // on Kmem_alloc. PRIVATE static inline NOEXPORT void Jdb_dbinfo::init_symbols_lines () { Mword p; p = (sizeof(Jdb_symbol_info)*Jdb_symbol::Max_tasks) >> Config::PAGE_SHIFT; Jdb_symbol::init(Kmem_alloc::allocator() ->unaligned_alloc(p*Config::PAGE_SIZE), p); p = (sizeof(Jdb_lines_info) *Jdb_lines::Max_tasks) >> Config::PAGE_SHIFT; Jdb_lines::init(Kmem_alloc::allocator() ->unaligned_alloc(p*Config::PAGE_SIZE), p); } //--------------------------------------------------------------------------- IMPLEMENTATION[ia32,amd64]: #include "cpu_lock.h" #include "jdb_lines.h" #include "jdb_symbol.h" #include "kmem.h" #include "kmem_alloc.h" #include "mem_layout.h" #include "mem_unit.h" #include "paging.h" #include "space.h" #include "static_init.h" const Address area_start = Mem_layout::Jdb_debug_start; const Address area_end = Mem_layout::Jdb_debug_end; const unsigned area_size = area_end - area_start; const unsigned bitmap_size = (area_size / Config::PAGE_SIZE) / 8; // We don't use the amm library here anymore since it is nearly impossible // to debug it and I got some strange behavior. Instead of this we use a // simple bitfield here that takes 2k for a virtual memory size of 64MB // which is enough for the Jdb debug info. Speed for allocating/deallocating // pages is not an issue here. static unsigned char bitmap[bitmap_size]; STATIC_INITIALIZE(Jdb_dbinfo); //--------------------------------------------------------------------------- IMPLEMENTATION[ia32, amd64]: PUBLIC static FIASCO_INIT void Jdb_dbinfo::init() { Address addr; for (addr = area_start; addr < area_end; addr += Config::SUPERPAGE_SIZE) Kmem::kdir->walk(Virt_addr(addr), 100, pdir_alloc(Kmem_alloc::allocator())); init_symbols_lines(); } PRIVATE static Address Jdb_dbinfo::reserve_pages(unsigned pages) { auto guard = lock_guard(cpu_lock); Unsigned8 *ptr, bit; for (ptr=bitmap, bit=0; ptr<bitmap+bitmap_size;) { Unsigned8 *ptr1, bit1, c; unsigned pages1; for (ptr1=ptr, bit1=bit, pages1=pages;;) { if (ptr1>=bitmap+bitmap_size) return 0; c = *ptr1 & (1<<bit1); if (++bit1 >= 8) { bit1 = 0; ptr1++; } if (c) { ptr = ptr1; bit = bit1; break; } if (!--pages1) { // found area -- make it as reserved for (ptr1=ptr, bit1=bit, pages1=pages; pages1>0; pages1--) { *ptr1 |= (1<<bit1); if (++bit1 >= 8) { bit1 = 0; ptr1++; } } return area_start + Config::PAGE_SIZE * (8*(ptr-bitmap) + bit); } } } return 0; } PRIVATE static void Jdb_dbinfo::return_pages(Address addr, unsigned pages) { auto guard = lock_guard(cpu_lock); unsigned nr_page = (addr-area_start) / Config::PAGE_SIZE; Unsigned8 *ptr = bitmap + nr_page/8, bit = nr_page % 8; for (; pages && ptr < bitmap+bitmap_size; pages--) { assert (*ptr & (1<<bit)); *ptr &= ~(1<<bit); if (++bit >= 8) { bit = 0; ptr++; } } } //--------------------------------------------------------------------------- IMPLEMENTATION[ia32, amd64]: PUBLIC static bool Jdb_dbinfo::map(Address phys, size_t &size, Address &virt) { Address offs = phys & ~Config::PAGE_MASK; size = (offs + size + Config::PAGE_SIZE - 1) & Config::PAGE_MASK; virt = reserve_pages (size / Config::PAGE_SIZE); if (!virt) return false; phys &= Config::PAGE_MASK; Kmem::kdir->map(phys, Virt_addr(virt), Virt_size(size), Pt_entry::Valid | Pt_entry::Writable | Pt_entry::Referenced | Pt_entry::Dirty, 100, Ptab::Null_alloc()); virt += offs; return true; } PUBLIC static void Jdb_dbinfo::unmap(Address virt, size_t size) { if (virt && size) { virt &= Config::PAGE_MASK; Kmem::kdir->unmap(Virt_addr(virt), Virt_size(size), 100); Mem_unit::tlb_flush (); return_pages(virt, size/Config::PAGE_SIZE); } } PUBLIC static void Jdb_dbinfo::set(Jdb_symbol_info *sym, Address phys, size_t size) { Address virt; if (!sym) return; if (!phys) { sym->get (virt, size); if (! virt) return; unmap (virt, size); sym->reset (); return; } if (! map (phys, size, virt)) return; if (! sym->set (virt, size)) { unmap (virt, size); sym->reset (); } } PUBLIC static void Jdb_dbinfo::set(Jdb_lines_info *lin, Address phys, size_t size) { Address virt; if (!lin) return; if (!phys) { lin->get(virt, size); if (! virt) return; unmap(virt, size); lin->reset (); } if (!map(phys, size, virt)) return; if (!lin->set(virt, size)) { unmap(virt, size); lin->reset(); } } //--------------------------------------------------------------------------- IMPLEMENTATION[ux]: // No special mapping required for UX since all physical memory is mapped #include "jdb_lines.h" #include "jdb_symbol.h" #include "kmem_alloc.h" #include "mem_layout.h" #include "static_init.h" STATIC_INITIALIZE(Jdb_dbinfo); PUBLIC static void Jdb_dbinfo::init() { init_symbols_lines(); } PUBLIC static void Jdb_dbinfo::set(Jdb_symbol_info *sym, Address phys, size_t size) { if (!sym) return; if (!phys) sym->reset(); else sym->set(Mem_layout::phys_to_pmem(phys), size); } PUBLIC static void Jdb_dbinfo::set(Jdb_lines_info *lin, Address phys, size_t size) { if (!lin) return; if (!phys) lin->reset(); else lin->set(Mem_layout::phys_to_pmem(phys), size); }
MicroTrustRepos/microkernel
src/kernel/fiasco/src/jdb/jdb_dbinfo.cpp
C++
gpl-2.0
5,858
18.723906
80
0.572721
false
package org.booleanfloat.traveler.links; import org.booleanfloat.traveler.Location; import org.booleanfloat.traveler.interfaces.Traversable; import java.util.ArrayList; import java.util.concurrent.Callable; public class OneWayLink { public OneWayLink(Location start, Location end) { this(start, end, new ArrayList<Traversable>(), null); } public OneWayLink(Location start, Location end, ArrayList<Traversable> steps) { this(start, end, steps, null); } public OneWayLink(Location start, Location end, ArrayList<Traversable> steps, Callable<Boolean> requirement) { new Link(start, end, steps, requirement); } }
BooleanFloat/Traveler
src/org/booleanfloat/traveler/links/OneWayLink.java
Java
gpl-2.0
662
30.52381
114
0.732628
false
<?php /** * Template Name: Library * @package mjv-theme */ if (is_home()) : get_header(); else : get_header('insiders'); endif; ?> <div id="primary" class="content-area library"> <main id="main" class="site-main" role="main"> <?php //carrega os cases, clients e content get_template_part('template-parts/content', 'library'); ?> </main><!-- #main --> </div><!-- #primary --> <?php get_sidebar(); get_footer();
DiegoDCosta/mjv-wp
page-library.php
PHP
gpl-2.0
472
17.88
67
0.550847
false
public class trace { public void mnonnullelements(int[] a) { int i = 0; //@ assert i == 0 && \nonnullelements(a); return ; } public void mnotmodified(int i) { //@ assert \not_modified(i); i = 4; //@ assert i == 4 && \not_modified(i); return ; } }
shunghsiyu/OpenJML_XOR
OpenJML/testfiles/escTraceBS/trace.java
Java
gpl-2.0
342
20.933333
49
0.447368
false
# จงเขียนโปรแกรมแสดงเลขคู่ในช่วง 0 ถึง 10 (รวม 10 ด้วย) for i in range(11): if (i % 2 == 0): print(i)
supasate/word_prediction
Chapter4/4-7-even-solution.py
Python
gpl-2.0
193
27.5
55
0.557522
false
# healthydesires.com.au A Jekyll based website for healthydesires.com.au by [Bradly Sharpe IT](http://bradlysharpe.com.au) ### Build Status [![Build Status](https://travis-ci.org/brad7928/healthydesires.com.au.svg?branch=master)](https://travis-ci.org/brad7928/healthydesires.com.au)
brad7928/healthydesires.com.au-old
README.md
Markdown
gpl-2.0
285
56.2
143
0.77193
false
// RUN: %clang_cc1 -analyze -inline-call -analyzer-store region -analyze-function f2 -verify %s // Test parameter 'a' is registered to LiveVariables analysis data although it // is not referenced in the function body. // Before processing 'return 1;', in RemoveDeadBindings(), we query the liveness // of 'a', because we have a binding for it due to parameter passing. int f1(int a) { return 1; } void f2() { int x; x = f1(1); }
vrtadmin/clamav-bytecode-compiler
clang/test/Analysis/inline2.c
C
gpl-2.0
438
30.285714
95
0.700913
false
<?php echo '<?xml version="1.0" encoding="utf-8"?>'; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-ca"> <head> <?php $this->RenderAsset('Head'); ?> <meta property="qc:admins" content="266656217765113126654" /> </head> <body id="<?php echo $BodyIdentifier; ?>" class="<?php echo $this->CssClass; ?>"> <div id="Frame"> <div id="Head"> <div class="Menu"> <h1><a class="Title" href="<?php echo Url('/'); ?>"><span><?php echo Gdn_Theme::Logo(); ?></span></a></h1> <?php $Session = Gdn::Session(); if ($this->Menu) { $this->Menu->AddLink('Dashboard', T('Dashboard'), '/dashboard/settings', array('Garden.Settings.Manage')); // $this->Menu->AddLink('Dashboard', T('Users'), '/user/browse', array('Garden.Users.Add', 'Garden.Users.Edit', 'Garden.Users.Delete')); $this->Menu->AddLink('Activity', T('Activity'), '/activity'); if ($Session->IsValid()) { $Name = $Session->User->Name; $CountNotifications = $Session->User->CountNotifications; if (is_numeric($CountNotifications) && $CountNotifications > 0) $Name .= ' <span class="Alert">'.$CountNotifications.'</span>'; if (urlencode($Session->User->Name) == $Session->User->Name) $ProfileSlug = $Session->User->Name; else $ProfileSlug = $Session->UserID.'/'.urlencode($Session->User->Name); $this->Menu->AddLink('User', $Name, '/profile/'.$ProfileSlug, array('Garden.SignIn.Allow'), array('class' => 'UserNotifications')); $this->Menu->AddLink('SignOut', T('Sign Out'), SignOutUrl(), FALSE, array('class' => 'NonTab SignOut')); } else { $Attribs = array(); if (SignInPopup() && strpos(Gdn::Request()->Url(), 'entry') === FALSE) $Attribs['class'] = 'SignInPopup'; $this->Menu->AddLink('Entry', T('Sign In'), SignInUrl($this->SelfUrl), FALSE, array('class' => 'NonTab'), $Attribs); } echo $this->Menu->ToString(); } ?> <div class="Search"><?php $Form = Gdn::Factory('Form'); $Form->InputPrefix = ''; echo $Form->Open(array('action' => Url('/search'), 'method' => 'get')), $Form->TextBox('Search'), $Form->Button('Go', array('Name' => '')), $Form->Close(); ?></div> </div> </div> <div id="Body"> <div id="Content"><?php $this->RenderAsset('Content'); ?></div> <div id="Panel"><?php $this->RenderAsset('Panel'); ?></div> </div> <div id="Foot"> <?php $this->RenderAsset('Foot'); echo Wrap(Anchor(T('Powered by Vanilla'), C('Garden.VanillaUrl')), 'div'); ?> </div> </div> <?php $this->FireEvent('AfterBody'); ?> </body> </html>
ttym7993/Garden
applications/dashboard/views/default.master.php
PHP
gpl-2.0
2,898
43.584615
142
0.545549
false
var ModuleManager = (function(){ //Directorio donde se encuentran los modulos const BASE_PATH = "js/modules/"; //modules var modules = { "templateManager":{ "className":"TemplateManager", "fileName":"templateManagerModule.js", "order":1, "loaded":false, "dependences":null, "instance":null }, "preferences":{ "className":"Preferences", "fileName":"preferencesModule.js", "order":1, "loaded":false, "dependences":["templateManager"], "instance":null }, "logger":{ "className":"Logger", "fileName":"logModule.js", "order":2, "loaded":false, "dependences":null, "instance":null }, "webSpeech":{ "className":"WebSpeech", "fileName":"webSpeechModule.js", "order":3, "loaded":false, "dependences":null, "instance":null }, "utils":{ "className":"Utils", "fileName":"utils.js", "order":4, "loaded":false, "dependences":null, "instance":null }, "serviceLocator":{ "className":"ServiceLocator", "fileName":"serviceLocatorModule.js", "order":3, "loaded":false, "dependences":["logger","utils"], "instance":null }, "geoLocation":{ "className":"GeoLocation", "fileName":"geolocationModule.js", "order":4, "loaded":false, "dependences":["serviceLocator"], "instance":null }, "notificator":{ "className":"Notificator", "fileName":"notificationsModule.js", "order":5, "loaded":false, "dependences":["templateManager"], "instance":null }, "applicationsManager":{ "className":"ApplicationsManager", "fileName":"applicationsModule.js", "order":6, "loaded":false, "dependences":["templateManager","serviceLocator","notificator"], "instance":null }, "searchs":{ "className":"Searchs", "fileName":"searchsModule.js", "order":7, "loaded":false, "dependences":["templateManager","serviceLocator","webSpeech","applicationsManager","notificator"], "instance":null }, "contacts":{ "className":"Contacts", "fileName":"contactsModule.js", "order":8, "loaded":false, "dependences":["templateManager","serviceLocator","webSpeech","notificator","geoLocation"], "instance":null }, "gui":{ "className":"GUI", "fileName":"guiModule.js", "order":9, "loaded":false, "dependences":["serviceLocator","searchs","contacts","applicationsManager","notificator"], "instance":null } }; /** * Devuelve las dependencias a partir de los nombres. * * @param {Array} arr: names of the dependencies * @return {Array} dependencies to bind */ var getDependencies = function(arr) { return arr instanceof Array && arr.length ? arr.map(function (value) { var o = modules[value] && modules[value].instance; if (!o) { throw new Error('Dependency ' + value + ' not found'); }else{ return o; } }) : false; } /** * Extrae los nombres de las dependencias a inyectar. * * @param {Function} target: function to process * @return {Array} */ var getArgs = function(target) { if (!target instanceof Function) { throw new TypeError('Target to process should be a Function'); }else{ var FN_ARGS = /^function\s*[^\(]*\(\s*([^\)]*)\)/m; var COMMENTS = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg; var SPACES = /[\s|\t|\n|\r]+/mg; var result = target.toString().match(FN_ARGS); //Comprobamos si existe alguna dependencia a inyectar if(result && result[1]) var args = result[1].replace(COMMENTS,'').replace(SPACES,'').split(','); else var args = false; return args; } } /** * Crea el objeto con las dependencias previamente inyectadas. * * @param {Function} constructor: function to call as constructor * @return {Object} object created from its constructor */ var create = function(constructor) { var args = getArgs(constructor); if (args) { var args = [null].concat(getDependencies(args)); var o = new (Function.prototype.bind.apply(constructor, args))(); }else{ var o = new (Function.prototype.bind.apply(constructor))(); } return o; } var loadScript = function(src, callback) { var s,r,t; r = false ; s = document. createElement ('script' ); s.type = 'text/javascript' ; s.src = src; s.onload = s.onreadystatechange = function () { if ( !r && (!this .readyState || this .readyState == 'complete' )){ r = true ; typeof(callback) == "function" && callback(); } }; t = document.getElementsByTagName ('script')[0]; t.parentNode.insertBefore (s, t); } var downloadModules = function(callback){ console.log(modules); for(var module in modules) (function(currentModule){ loadScript(BASE_PATH+currentModule.fileName,function(){ currentModule.loaded = true; Object.keys(modules).map(function(key){ return modules[key].loaded; }).indexOf(false) == -1 && typeof(callback) == "function" && callback(); }); })(modules[module]); } var loadModules = function(callback){ downloadModules(function(){ for(var module in modules){ console.log("Cargando Módulo : " + modules[module].className); modules[module].instance = create(window[modules[module].className]); delete window[modules[module].className]; } typeof(callback) == "function" && callback(); }); } //API pública return{ loadModules:loadModules } })();
sergio11/teVeo
js/managerModule.js
JavaScript
gpl-2.0
6,834
30.634259
111
0.492828
false
# ionic-audioguide An audioguide app with geolocation and media streaming support for the ionic framework # Howto These files will not run standalone, you have to create a new ionic app to make use of them. The interesting code is in www/js/controllers.js and www/js/app.js # Webserver and JSON You will need a webserver which serves the media files and handles the JSON requests. # Cordova plugins Listing of needed cordova plugins in cordova-plugins.txt. # License Copyright (c) 2015 Felix Herrmann (github.com/hfx) Licensed under GPL v2. Code for the AudiostationsCtrl controller adapted from https://github.com/devgeeks/ExampleHTML5AudioStreaming/blob/master/www/scripts/html5audio.js, Copyright (c) 2011 Tommy-Carlos Williams (github.com/devgeeks). This part of code is licensed under The MIT license by the original author, please see https://github.com/devgeeks/ExampleHTML5AudioStreaming#license
hfx/ionic-audioguide
README.md
Markdown
gpl-2.0
913
47.052632
213
0.803943
false
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> <head> <title>DOM.Node</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Style-Type" content="text/css" /> <link rel="stylesheet" type="text/css" href="../common/doxygen.css" /> <link rel="stylesheet" media="screen" type="text/css" title="KDE Colors" href="../common/kde.css" /> </head> <body> <div id="container"> <div id="header"> <div id="header_top"> <div> <div> <img alt ="" src="../common/top-kde.jpg"/> KDE 4.9 PyKDE API Reference </div> </div> </div> <div id="header_bottom"> <div id="location"> <ul> <li>KDE's Python API</li> </ul> </div> <div id="menu"> <ul> <li><a href="../modules.html">Overview</a></li> <li><a href="http://techbase.kde.org/Development/Languages/Python">PyKDE Home</a></li> <li><a href="http://kde.org/family/">Sitemap</a></li> <li><a href="http://kde.org/contact/">Contact Us</a></li> </ul> </div> </div> </div> <div id="body_wrapper"> <div id="body"> <div id="right"> <div class="content"> <div id="main"> <div class="clearer">&nbsp;</div> <h1>Node Class Reference</h1> <code>from PyKDE4.khtml import *</code> <p> Subclasses: <a href="../khtml/DOM.Document.html">DOM.Document</a>, <a href="../khtml/DOM.DocumentFragment.html">DOM.DocumentFragment</a>, <a href="../khtml/DOM.DocumentType.html">DOM.DocumentType</a>, <a href="../khtml/DOM.Attr.html">DOM.Attr</a>, <a href="../khtml/DOM.Element.html">DOM.Element</a>, <a href="../khtml/DOM.CharacterData.html">DOM.CharacterData</a>, <a href="../khtml/DOM.Entity.html">DOM.Entity</a>, <a href="../khtml/DOM.EntityReference.html">DOM.EntityReference</a>, <a href="../khtml/DOM.Notation.html">DOM.Notation</a>, <a href="../khtml/DOM.ProcessingInstruction.html">DOM.ProcessingInstruction</a><br /> Namespace: <a href="../khtml/DOM.html">DOM</a><br /> <h2>Detailed Description</h2> <p>The Node interface is the primary datatype for the entire Document Object Model. It represents a single node in the document tree. While all objects implementing the Node interface expose methods for dealing with children, not all objects implementing the Node interface may have children. For example, Text nodes may not have children, and adding children to such nodes results in a DOMException being raised. </p> <p> The attributes nodeName , nodeValue and attributes are included as a mechanism to get at node information without casting down to the specific derived interface. In cases where there is no obvious mapping of these attributes for a specific nodeType (e.g., nodeValue for an Element or attributes for a Comment), this returns null . Note that the specialized interfaces may contain additional and more convenient mechanisms to get and set the relevant information. </p> <table border="0" cellpadding="0" cellspacing="0"><tr><td colspan="2"><br><h2>Enumerations</h2></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="#DocumentPosition">DocumentPosition</a>&nbsp;</td><td class="memItemRight" valign="bottom">{&nbsp;DOCUMENT_POSITION_DISCONNECTED, DOCUMENT_POSITION_PRECEDING, DOCUMENT_POSITION_FOLLOWING, DOCUMENT_POSITION_CONTAINS, DOCUMENT_POSITION_CONTAINED_BY, DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC&nbsp;}</td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="#NodeType">NodeType</a>&nbsp;</td><td class="memItemRight" valign="bottom">{&nbsp;ELEMENT_NODE, ATTRIBUTE_NODE, TEXT_NODE, CDATA_SECTION_NODE, ENTITY_REFERENCE_NODE, ENTITY_NODE, PROCESSING_INSTRUCTION_NODE, COMMENT_NODE, DOCUMENT_NODE, DOCUMENT_TYPE_NODE, DOCUMENT_FRAGMENT_NODE, NOTATION_NODE, XPATH_NAMESPACE_NODE&nbsp;}</td></tr> <tr><td colspan="2"><br><h2>Methods</h2></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="#Node">__init__</a> (self)</td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="#Node">__init__</a> (self, <a href="../khtml/DOM.Node.html">DOM.Node</a> other)</td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="#addEventListener">addEventListener</a> (self, <a href="../khtml/DOM.DOMString.html">DOM.DOMString</a> type, <a href="../khtml/DOM.EventListener.html">DOM.EventListener</a> listener, bool useCapture)</td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top"><a href="../khtml/DOM.Node.html">DOM.Node</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="#appendChild">appendChild</a> (self, <a href="../khtml/DOM.Node.html">DOM.Node</a> newChild)</td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="#applyChanges">applyChanges</a> (self)</td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top"><a href="../khtml/DOM.NamedNodeMap.html">DOM.NamedNodeMap</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="#attributes">attributes</a> (self)</td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top"><a href="../khtml/DOM.NodeList.html">DOM.NodeList</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="#childNodes">childNodes</a> (self)</td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top"><a href="../khtml/DOM.Node.html">DOM.Node</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="#cloneNode">cloneNode</a> (self, bool deep)</td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">unsigned&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="#compareDocumentPosition">compareDocumentPosition</a> (self, <a href="../khtml/DOM.Node.html">DOM.Node</a> other)</td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="#dispatchEvent">dispatchEvent</a> (self, <a href="../khtml/DOM.Event.html">DOM.Event</a> evt)</td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">long&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="#elementId">elementId</a> (self)</td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top"><a href="../khtml/DOM.Node.html">DOM.Node</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="#firstChild">firstChild</a> (self)</td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">int _x, int _y, int height&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="#getCursor">getCursor</a> (self, int offset)</td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">QRect&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="#getRect">getRect</a> (self)</td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="#hasAttributes">hasAttributes</a> (self)</td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="#hasChildNodes">hasChildNodes</a> (self)</td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">long&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="#index">index</a> (self)</td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top"><a href="../khtml/DOM.Node.html">DOM.Node</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="#insertBefore">insertBefore</a> (self, <a href="../khtml/DOM.Node.html">DOM.Node</a> newChild, <a href="../khtml/DOM.Node.html">DOM.Node</a> refChild)</td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="#isNull">isNull</a> (self)</td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="#isSupported">isSupported</a> (self, <a href="../khtml/DOM.DOMString.html">DOM.DOMString</a> feature, <a href="../khtml/DOM.DOMString.html">DOM.DOMString</a> version)</td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top"><a href="../khtml/DOM.Node.html">DOM.Node</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="#lastChild">lastChild</a> (self)</td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top"><a href="../khtml/DOM.DOMString.html">DOM.DOMString</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="#localName">localName</a> (self)</td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top"><a href="../khtml/DOM.DOMString.html">DOM.DOMString</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="#namespaceURI">namespaceURI</a> (self)</td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top"><a href="../khtml/DOM.Node.html">DOM.Node</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="#nextSibling">nextSibling</a> (self)</td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top"><a href="../khtml/DOM.DOMString.html">DOM.DOMString</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="#nodeName">nodeName</a> (self)</td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="#nodeType">nodeType</a> (self)</td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top"><a href="../khtml/DOM.DOMString.html">DOM.DOMString</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="#nodeValue">nodeValue</a> (self)</td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="#normalize">normalize</a> (self)</td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="#operator !=">operator !=</a> (self, <a href="../khtml/DOM.Node.html">DOM.Node</a> other)</td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="#operator ==">operator ==</a> (self, <a href="../khtml/DOM.Node.html">DOM.Node</a> other)</td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top"><a href="../khtml/DOM.Document.html">DOM.Document</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="#ownerDocument">ownerDocument</a> (self)</td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top"><a href="../khtml/DOM.Node.html">DOM.Node</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="#parentNode">parentNode</a> (self)</td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top"><a href="../khtml/DOM.DOMString.html">DOM.DOMString</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="#prefix">prefix</a> (self)</td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top"><a href="../khtml/DOM.Node.html">DOM.Node</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="#previousSibling">previousSibling</a> (self)</td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top"><a href="../khtml/DOM.Node.html">DOM.Node</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="#removeChild">removeChild</a> (self, <a href="../khtml/DOM.Node.html">DOM.Node</a> oldChild)</td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="#removeEventListener">removeEventListener</a> (self, <a href="../khtml/DOM.DOMString.html">DOM.DOMString</a> type, <a href="../khtml/DOM.EventListener.html">DOM.EventListener</a> listener, bool useCapture)</td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top"><a href="../khtml/DOM.Node.html">DOM.Node</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="#replaceChild">replaceChild</a> (self, <a href="../khtml/DOM.Node.html">DOM.Node</a> newChild, <a href="../khtml/DOM.Node.html">DOM.Node</a> oldChild)</td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="#setNodeValue">setNodeValue</a> (self, <a href="../khtml/DOM.DOMString.html">DOM.DOMString</a> a0)</td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="#setPrefix">setPrefix</a> (self, <a href="../khtml/DOM.DOMString.html">DOM.DOMString</a> prefix)</td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="#setTextContent">setTextContent</a> (self, <a href="../khtml/DOM.DOMString.html">DOM.DOMString</a> text)</td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top"><a href="../khtml/DOM.DOMString.html">DOM.DOMString</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="#textContent">textContent</a> (self)</td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">QString&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="#toHTML">toHTML</a> (self)</td></tr> </table> <hr><h2>Method Documentation</h2><a class="anchor" name="Node"></a> <div class="memitem"> <div class="memproto"> <table class="memname"><tr> <td class="memname">__init__</td> <td>(</td> <td class="paramtype">&nbsp;</td> <td class="paramname"><em>self</em>&nbsp;)</td> <td width="100%"> </td> </tr> </table> </div> <div class="memdoc"></div></div><a class="anchor" name="Node"></a> <div class="memitem"> <div class="memproto"> <table class="memname"><tr> <td class="memname">__init__</td> <td>(</td> <td class="paramtype">&nbsp;<em>self</em>, </td> <td class="paramname"></td> </tr><tr> <td class="memname"></td> <td></td> <td class="paramtype"><a href="../khtml/DOM.Node.html">DOM.Node</a>&nbsp;</td> <td class="paramname"><em>other</em></td> </tr> <tr> <td></td> <td>)</td> <td></td> <td></td> <td width="100%"> </td> </tr></table> </div> <div class="memdoc"></div></div><a class="anchor" name="addEventListener"></a> <div class="memitem"> <div class="memproto"> <table class="memname"><tr> <td class="memname"> addEventListener</td> <td>(</td> <td class="paramtype">&nbsp;<em>self</em>, </td> <td class="paramname"></td> </tr><tr> <td class="memname"></td> <td></td> <td class="paramtype"><a href="../khtml/DOM.DOMString.html">DOM.DOMString</a>&nbsp;</td> <td class="paramname"><em>type</em>, </td> </tr> <tr> <td class="memname"></td> <td></td> <td class="paramtype"><a href="../khtml/DOM.EventListener.html">DOM.EventListener</a>&nbsp;</td> <td class="paramname"><em>listener</em>, </td> </tr> <tr> <td class="memname"></td> <td></td> <td class="paramtype">bool&nbsp;</td> <td class="paramname"><em>useCapture</em></td> </tr> <tr> <td></td> <td>)</td> <td></td> <td></td> <td width="100%"> </td> </tr></table> </div> <div class="memdoc"><p>Introduced in DOM Level 2 This method is from the EventTarget interface </p> <p> This method allows the registration of event listeners on the event target. If an EventListener is added to an EventTarget while it is processing an event, it will not be triggered by the current actions but may be triggered during a later stage of event flow, such as the bubbling phase. </p> <p> If multiple identical EventListeners are registered on the same EventTarget with the same parameters the duplicate instances are discarded. They do not cause the EventListener to be called twice and since they are discarded they do not need to be removed with the removeEventListener method. Parameters </p> <p> </p><dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td></td><td valign="top"><em>type</em>&nbsp;</td><td> The event type for which the user is registering </td></tr> <tr><td></td><td valign="top"><em>listener</em>&nbsp;</td><td> The listener parameter takes an interface implemented by the user which contains the methods to be called when the event occurs. </td></tr> <tr><td></td><td valign="top"><em>useCapture</em>&nbsp;</td><td> If true, useCapture indicates that the user wishes to initiate capture. After initiating capture, all events of the specified type will be dispatched to the registered EventListener before being dispatched to any EventTargets beneath them in the tree. Events which are bubbling upward through the tree will not trigger an EventListener designated to use capture. </td></tr> </table></dl> <p> </p></div></div><a class="anchor" name="appendChild"></a> <div class="memitem"> <div class="memproto"> <table class="memname"><tr> <td class="memname"><a href="../khtml/DOM.Node.html">DOM.Node</a> appendChild</td> <td>(</td> <td class="paramtype">&nbsp;<em>self</em>, </td> <td class="paramname"></td> </tr><tr> <td class="memname"></td> <td></td> <td class="paramtype"><a href="../khtml/DOM.Node.html">DOM.Node</a>&nbsp;</td> <td class="paramname"><em>newChild</em></td> </tr> <tr> <td></td> <td>)</td> <td></td> <td></td> <td width="100%"> </td> </tr></table> </div> <div class="memdoc"><p>Adds the node newChild to the end of the list of children of this node. If the newChild is already in the tree, it is first removed. </p> <p> </p><dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td></td><td valign="top"><em>newChild</em>&nbsp;</td><td> The node to add. </td></tr> </table></dl> <p> If it is a DocumentFragment object, the entire contents of the document fragment are moved into the child list of this node </p> <p> <dl class="return" compact><dt><b>Returns:</b></dt><dd> The node added. </dd></dl> </p> <p> DOMException HIERARCHY_REQUEST_ERR: Raised if this node is of a type that does not allow children of the type of the newChild node, or if the node to append is one of this node's ancestors. </p> <p> WRONG_DOCUMENT_ERR: Raised if newChild was created from a different document than the one that created this node. </p> <p> NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly. </p></div></div><a class="anchor" name="applyChanges"></a> <div class="memitem"> <div class="memproto"> <table class="memname"><tr> <td class="memname"> applyChanges</td> <td>(</td> <td class="paramtype">&nbsp;</td> <td class="paramname"><em>self</em>&nbsp;)</td> <td width="100%"> </td> </tr> </table> </div> <div class="memdoc"></div></div><a class="anchor" name="attributes"></a> <div class="memitem"> <div class="memproto"> <table class="memname"><tr> <td class="memname"><a href="../khtml/DOM.NamedNodeMap.html">DOM.NamedNodeMap</a> attributes</td> <td>(</td> <td class="paramtype">&nbsp;</td> <td class="paramname"><em>self</em>&nbsp;)</td> <td width="100%"> </td> </tr> </table> </div> <div class="memdoc"><p>A NamedNodeMap containing the attributes of this node (if it is an Element ) or null otherwise. </p></div></div><a class="anchor" name="childNodes"></a> <div class="memitem"> <div class="memproto"> <table class="memname"><tr> <td class="memname"><a href="../khtml/DOM.NodeList.html">DOM.NodeList</a> childNodes</td> <td>(</td> <td class="paramtype">&nbsp;</td> <td class="paramname"><em>self</em>&nbsp;)</td> <td width="100%"> </td> </tr> </table> </div> <div class="memdoc"><p>A NodeList that contains all children of this node. If there are no children, this is a NodeList containing no nodes. The content of the returned NodeList is &amp;quot;live&amp;quot; in the sense that, for instance, changes to the children of the node object that it was created from are immediately reflected in the nodes returned by the NodeList accessors; it is not a static snapshot of the content of the node. This is true for every NodeList , including the ones returned by the getElementsByTagName method. </p></div></div><a class="anchor" name="cloneNode"></a> <div class="memitem"> <div class="memproto"> <table class="memname"><tr> <td class="memname"><a href="../khtml/DOM.Node.html">DOM.Node</a> cloneNode</td> <td>(</td> <td class="paramtype">&nbsp;<em>self</em>, </td> <td class="paramname"></td> </tr><tr> <td class="memname"></td> <td></td> <td class="paramtype">bool&nbsp;</td> <td class="paramname"><em>deep</em></td> </tr> <tr> <td></td> <td>)</td> <td></td> <td></td> <td width="100%"> </td> </tr></table> </div> <div class="memdoc"><p>Returns a duplicate of this node, i.e., serves as a generic copy constructor for nodes. The duplicate node has no parent ( parentNode returns null .). </p> <p> Cloning an Element copies all attributes and their values, including those generated by the XML processor to represent defaulted attributes, but this method does not copy any text it contains unless it is a deep clone, since the text is contained in a child Text node. Cloning any other type of node simply returns a copy of this node. </p> <p> </p><dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td></td><td valign="top"><em>deep</em>&nbsp;</td><td> If true , recursively clone the subtree under the specified node; if false , clone only the node itself (and its attributes, if it is an </td></tr> </table></dl> <p> Element ). </p> <p> <dl class="return" compact><dt><b>Returns:</b></dt><dd> The duplicate node. </dd></dl> </p></div></div><a class="anchor" name="compareDocumentPosition"></a> <div class="memitem"> <div class="memproto"> <table class="memname"><tr> <td class="memname">unsigned compareDocumentPosition</td> <td>(</td> <td class="paramtype">&nbsp;<em>self</em>, </td> <td class="paramname"></td> </tr><tr> <td class="memname"></td> <td></td> <td class="paramtype"><a href="../khtml/DOM.Node.html">DOM.Node</a>&nbsp;</td> <td class="paramname"><em>other</em></td> </tr> <tr> <td></td> <td>)</td> <td></td> <td></td> <td width="100%"> </td> </tr></table> </div> <div class="memdoc"><p>Introduced in DOM Level 3. </p> <p> This method compares the current node's position with that of 'other' and returns it as a combination of DocumentPosition bitfields. Here DOCUMENT_POSITION_FOLLOWING means that the 'other' is after the current. </p> <p> The notion of order here is a logical one; for example attributes are viewed as if they were children of an element inserted right before the real children. The method will also assign some total order even if the nodes are not connected. </p> <p> <dl class="since" compact><dt><b>Since:</b></dt><dd> 4.2.4 </dd></dl> </p></div></div><a class="anchor" name="dispatchEvent"></a> <div class="memitem"> <div class="memproto"> <table class="memname"><tr> <td class="memname">bool dispatchEvent</td> <td>(</td> <td class="paramtype">&nbsp;<em>self</em>, </td> <td class="paramname"></td> </tr><tr> <td class="memname"></td> <td></td> <td class="paramtype"><a href="../khtml/DOM.Event.html">DOM.Event</a>&nbsp;</td> <td class="paramname"><em>evt</em></td> </tr> <tr> <td></td> <td>)</td> <td></td> <td></td> <td width="100%"> </td> </tr></table> </div> <div class="memdoc"><p>Introduced in DOM Level 2 This method is from the EventTarget interface </p> <p> This method allows the dispatch of events into the implementations event model. Events dispatched in this manner will have the same capturing and bubbling behavior as events dispatched directly by the implementation. The target of the event is the EventTarget on which dispatchEvent is called. </p> <p> </p><dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td></td><td valign="top"><em>evt</em>&nbsp;</td><td> Specifies the event type, behavior, and contextual information to be used in processing the event. </td></tr> </table></dl> <p> <dl class="return" compact><dt><b>Returns:</b></dt><dd> The return value of dispatchEvent indicates whether any of the listeners which handled the event called preventDefault. If preventDefault was called the value is false, else the value is true. </dd></dl> </p> <p> EventException UNSPECIFIED_EVENT_TYPE_ERR: Raised if the Event's type was not specified by initializing the event before dispatchEvent was called. Specification of the Event's type as null or an empty string will also trigger this exception. </p></div></div><a class="anchor" name="elementId"></a> <div class="memitem"> <div class="memproto"> <table class="memname"><tr> <td class="memname">long elementId</td> <td>(</td> <td class="paramtype">&nbsp;</td> <td class="paramname"><em>self</em>&nbsp;)</td> <td width="100%"> </td> </tr> </table> </div> <div class="memdoc"><p><dl class="internal" compact><dt><b>Internal:</b></dt><dd> not part of the DOM. </dd></dl> <dl class="return" compact><dt><b>Returns:</b></dt><dd> the element id, in case this is an element, 0 otherwise </dd></dl> </p></div></div><a class="anchor" name="firstChild"></a> <div class="memitem"> <div class="memproto"> <table class="memname"><tr> <td class="memname"><a href="../khtml/DOM.Node.html">DOM.Node</a> firstChild</td> <td>(</td> <td class="paramtype">&nbsp;</td> <td class="paramname"><em>self</em>&nbsp;)</td> <td width="100%"> </td> </tr> </table> </div> <div class="memdoc"><p>The first child of this node. If there is no such node, this returns null . </p></div></div><a class="anchor" name="getCursor"></a> <div class="memitem"> <div class="memproto"> <table class="memname"><tr> <td class="memname">int _x, int _y, int height getCursor</td> <td>(</td> <td class="paramtype">&nbsp;<em>self</em>, </td> <td class="paramname"></td> </tr><tr> <td class="memname"></td> <td></td> <td class="paramtype">int&nbsp;</td> <td class="paramname"><em>offset</em></td> </tr> <tr> <td></td> <td>)</td> <td></td> <td></td> <td width="100%"> </td> </tr></table> </div> <div class="memdoc"><p><dl class="deprecated" compact><dt><b>Deprecated:</b></dt><dd> without substitution since 3.2 </dd></dl> </p></div></div><a class="anchor" name="getRect"></a> <div class="memitem"> <div class="memproto"> <table class="memname"><tr> <td class="memname">QRect getRect</td> <td>(</td> <td class="paramtype">&nbsp;</td> <td class="paramname"><em>self</em>&nbsp;)</td> <td width="100%"> </td> </tr> </table> </div> <div class="memdoc"><p>not part of the DOM. <dl class="return" compact><dt><b>Returns:</b></dt><dd> the exact coordinates and size of this element. </dd></dl> </p></div></div><a class="anchor" name="hasAttributes"></a> <div class="memitem"> <div class="memproto"> <table class="memname"><tr> <td class="memname">bool hasAttributes</td> <td>(</td> <td class="paramtype">&nbsp;</td> <td class="paramname"><em>self</em>&nbsp;)</td> <td width="100%"> </td> </tr> </table> </div> <div class="memdoc"><p>Returns whether this node (if it is an element) has any attributes. <dl class="return" compact><dt><b>Returns:</b></dt><dd> a boolean. True if this node has any attributes, false otherwise. Introduced in DOM Level 2 </dd></dl> </p></div></div><a class="anchor" name="hasChildNodes"></a> <div class="memitem"> <div class="memproto"> <table class="memname"><tr> <td class="memname">bool hasChildNodes</td> <td>(</td> <td class="paramtype">&nbsp;</td> <td class="paramname"><em>self</em>&nbsp;)</td> <td width="100%"> </td> </tr> </table> </div> <div class="memdoc"><p>This is a convenience method to allow easy determination of whether a node has any children. </p> <p> <dl class="return" compact><dt><b>Returns:</b></dt><dd> true if the node has any children, </dd></dl> false if the node has no children. </p></div></div><a class="anchor" name="index"></a> <div class="memitem"> <div class="memproto"> <table class="memname"><tr> <td class="memname">long index</td> <td>(</td> <td class="paramtype">&nbsp;</td> <td class="paramname"><em>self</em>&nbsp;)</td> <td width="100%"> </td> </tr> </table> </div> <div class="memdoc"><p><dl class="internal" compact><dt><b>Internal:</b></dt><dd> returns the index of a node </dd></dl> </p></div></div><a class="anchor" name="insertBefore"></a> <div class="memitem"> <div class="memproto"> <table class="memname"><tr> <td class="memname"><a href="../khtml/DOM.Node.html">DOM.Node</a> insertBefore</td> <td>(</td> <td class="paramtype">&nbsp;<em>self</em>, </td> <td class="paramname"></td> </tr><tr> <td class="memname"></td> <td></td> <td class="paramtype"><a href="../khtml/DOM.Node.html">DOM.Node</a>&nbsp;</td> <td class="paramname"><em>newChild</em>, </td> </tr> <tr> <td class="memname"></td> <td></td> <td class="paramtype"><a href="../khtml/DOM.Node.html">DOM.Node</a>&nbsp;</td> <td class="paramname"><em>refChild</em></td> </tr> <tr> <td></td> <td>)</td> <td></td> <td></td> <td width="100%"> </td> </tr></table> </div> <div class="memdoc"><p>Inserts the node newChild before the existing child node refChild . If refChild is null , insert newChild at the end of the list of children. </p> <p> If newChild is a DocumentFragment object, all of its children are inserted, in the same order, before refChild . If the newChild is already in the tree, it is first removed. </p> <p> </p><dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td></td><td valign="top"><em>newChild</em>&nbsp;</td><td> The node to insert. </td></tr> <tr><td></td><td valign="top"><em>refChild</em>&nbsp;</td><td> The reference node, i.e., the node before which the new node must be inserted. </td></tr> </table></dl> <p> <dl class="return" compact><dt><b>Returns:</b></dt><dd> The node being inserted. </dd></dl> </p> <p> DOMException HIERARCHY_REQUEST_ERR: Raised if this node is of a type that does not allow children of the type of the newChild node, or if the node to insert is one of this node's ancestors. </p> <p> WRONG_DOCUMENT_ERR: Raised if newChild was created from a different document than the one that created this node. </p> <p> NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly. </p> <p> NOT_FOUND_ERR: Raised if refChild is not a child of this node. </p></div></div><a class="anchor" name="isNull"></a> <div class="memitem"> <div class="memproto"> <table class="memname"><tr> <td class="memname">bool isNull</td> <td>(</td> <td class="paramtype">&nbsp;</td> <td class="paramname"><em>self</em>&nbsp;)</td> <td width="100%"> </td> </tr> </table> </div> <div class="memdoc"><p>tests if this Node is 0. Useful especially, if casting to a derived class: </p> <p> <pre class="fragment"> Node n = .....; // try to convert into an Element: Element e = n; if( e.isNull() ) kDebug() &lt;&lt; "node isn't an element node"; </pre> </p></div></div><a class="anchor" name="isSupported"></a> <div class="memitem"> <div class="memproto"> <table class="memname"><tr> <td class="memname">bool isSupported</td> <td>(</td> <td class="paramtype">&nbsp;<em>self</em>, </td> <td class="paramname"></td> </tr><tr> <td class="memname"></td> <td></td> <td class="paramtype"><a href="../khtml/DOM.DOMString.html">DOM.DOMString</a>&nbsp;</td> <td class="paramname"><em>feature</em>, </td> </tr> <tr> <td class="memname"></td> <td></td> <td class="paramtype"><a href="../khtml/DOM.DOMString.html">DOM.DOMString</a>&nbsp;</td> <td class="paramname"><em>version</em></td> </tr> <tr> <td></td> <td>)</td> <td></td> <td></td> <td width="100%"> </td> </tr></table> </div> <div class="memdoc"><p>Introduced in DOM Level 2 </p> <p> Tests whether the DOM implementation implements a specific feature and that feature is supported by this node. </p> <p> </p><dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td></td><td valign="top"><em>feature</em>&nbsp;</td><td> The name of the feature to test. This is the same name which can be passed to the method hasFeature on DOMImplementation. </td></tr> <tr><td></td><td valign="top"><em>version</em>&nbsp;</td><td> This is the version number of the feature to test. In Level 2, version 1, this is the string "2.0". If the version is not specified, supporting any version of the feature will cause the method to return true. </td></tr> </table></dl> <p> <dl class="return" compact><dt><b>Returns:</b></dt><dd> Returns true if the specified feature is supported on this node, false otherwise. </dd></dl> </p></div></div><a class="anchor" name="lastChild"></a> <div class="memitem"> <div class="memproto"> <table class="memname"><tr> <td class="memname"><a href="../khtml/DOM.Node.html">DOM.Node</a> lastChild</td> <td>(</td> <td class="paramtype">&nbsp;</td> <td class="paramname"><em>self</em>&nbsp;)</td> <td width="100%"> </td> </tr> </table> </div> <div class="memdoc"><p>The last child of this node. If there is no such node, this returns null . </p></div></div><a class="anchor" name="localName"></a> <div class="memitem"> <div class="memproto"> <table class="memname"><tr> <td class="memname"><a href="../khtml/DOM.DOMString.html">DOM.DOMString</a> localName</td> <td>(</td> <td class="paramtype">&nbsp;</td> <td class="paramname"><em>self</em>&nbsp;)</td> <td width="100%"> </td> </tr> </table> </div> <div class="memdoc"><p>Introduced in DOM Level 2 </p> <p> Returns the local part of the qualified name of this node. For nodes of any type other than ELEMENT_NODE and ATTRIBUTE_NODE and nodes created with a DOM Level 1 method, such as createElement from the Document interface, this is always null. </p></div></div><a class="anchor" name="namespaceURI"></a> <div class="memitem"> <div class="memproto"> <table class="memname"><tr> <td class="memname"><a href="../khtml/DOM.DOMString.html">DOM.DOMString</a> namespaceURI</td> <td>(</td> <td class="paramtype">&nbsp;</td> <td class="paramname"><em>self</em>&nbsp;)</td> <td width="100%"> </td> </tr> </table> </div> <div class="memdoc"><p>Introduced in DOM Level 2 </p> <p> The namespace URI of this node, or null if it is unspecified. This is not a computed value that is the result of a namespace lookup based on an examination of the namespace declarations in scope. It is merely the namespace URI given at creation time. For nodes of any type other than ELEMENT_NODE and ATTRIBUTE_NODE and nodes created with a DOM Level 1 method, such as createElement from the Document interface, this is always null. </p> <p> Note: Per the Namespaces in XML Specification [Namespaces] an attribute does not inherit its namespace from the element it is attached to. If an attribute is not explicitly given a namespace, it simply has no namespace. </p></div></div><a class="anchor" name="nextSibling"></a> <div class="memitem"> <div class="memproto"> <table class="memname"><tr> <td class="memname"><a href="../khtml/DOM.Node.html">DOM.Node</a> nextSibling</td> <td>(</td> <td class="paramtype">&nbsp;</td> <td class="paramname"><em>self</em>&nbsp;)</td> <td width="100%"> </td> </tr> </table> </div> <div class="memdoc"><p>The node immediately following this node. If there is no such node, this returns null . </p></div></div><a class="anchor" name="nodeName"></a> <div class="memitem"> <div class="memproto"> <table class="memname"><tr> <td class="memname"><a href="../khtml/DOM.DOMString.html">DOM.DOMString</a> nodeName</td> <td>(</td> <td class="paramtype">&nbsp;</td> <td class="paramname"><em>self</em>&nbsp;)</td> <td width="100%"> </td> </tr> </table> </div> <div class="memdoc"><p>The name of this node, depending on its type; see the table above. </p></div></div><a class="anchor" name="nodeType"></a> <div class="memitem"> <div class="memproto"> <table class="memname"><tr> <td class="memname">int nodeType</td> <td>(</td> <td class="paramtype">&nbsp;</td> <td class="paramname"><em>self</em>&nbsp;)</td> <td width="100%"> </td> </tr> </table> </div> <div class="memdoc"><p>A code representing the type of the underlying object, as defined above. </p></div></div><a class="anchor" name="nodeValue"></a> <div class="memitem"> <div class="memproto"> <table class="memname"><tr> <td class="memname"><a href="../khtml/DOM.DOMString.html">DOM.DOMString</a> nodeValue</td> <td>(</td> <td class="paramtype">&nbsp;</td> <td class="paramname"><em>self</em>&nbsp;)</td> <td width="100%"> </td> </tr> </table> </div> <div class="memdoc"><p>The value of this node, depending on its type; see the table above. </p> <p> DOMException DOMSTRING_SIZE_ERR: Raised when it would return more characters than fit in a DOMString variable on the implementation platform. </p></div></div><a class="anchor" name="normalize"></a> <div class="memitem"> <div class="memproto"> <table class="memname"><tr> <td class="memname"> normalize</td> <td>(</td> <td class="paramtype">&nbsp;</td> <td class="paramname"><em>self</em>&nbsp;)</td> <td width="100%"> </td> </tr> </table> </div> <div class="memdoc"><p>Modified in DOM Level 2 </p> <p> Puts all Text nodes in the full depth of the sub-tree underneath this Node, including attribute nodes, into a "normal" form where only structure (e.g., elements, comments, processing instructions, CDATA sections, and entity references) separates Text nodes, i.e., there are neither adjacent Text nodes nor empty Text nodes. This can be used to ensure that the DOM view of a document is the same as if it were saved and re-loaded, and is useful when operations (such as XPointer [XPointer] lookups) that depend on a particular document tree structure are to be used. </p> <p> Note: In cases where the document contains CDATASections, the normalize operation alone may not be sufficient, since XPointers do not differentiate between Text nodes and CDATASection nodes. </p></div></div><a class="anchor" name="operator !="></a> <div class="memitem"> <div class="memproto"> <table class="memname"><tr> <td class="memname">bool operator !=</td> <td>(</td> <td class="paramtype">&nbsp;<em>self</em>, </td> <td class="paramname"></td> </tr><tr> <td class="memname"></td> <td></td> <td class="paramtype"><a href="../khtml/DOM.Node.html">DOM.Node</a>&nbsp;</td> <td class="paramname"><em>other</em></td> </tr> <tr> <td></td> <td>)</td> <td></td> <td></td> <td width="100%"> </td> </tr></table> </div> <div class="memdoc"></div></div><a class="anchor" name="operator =="></a> <div class="memitem"> <div class="memproto"> <table class="memname"><tr> <td class="memname">bool operator ==</td> <td>(</td> <td class="paramtype">&nbsp;<em>self</em>, </td> <td class="paramname"></td> </tr><tr> <td class="memname"></td> <td></td> <td class="paramtype"><a href="../khtml/DOM.Node.html">DOM.Node</a>&nbsp;</td> <td class="paramname"><em>other</em></td> </tr> <tr> <td></td> <td>)</td> <td></td> <td></td> <td width="100%"> </td> </tr></table> </div> <div class="memdoc"></div></div><a class="anchor" name="ownerDocument"></a> <div class="memitem"> <div class="memproto"> <table class="memname"><tr> <td class="memname"><a href="../khtml/DOM.Document.html">DOM.Document</a> ownerDocument</td> <td>(</td> <td class="paramtype">&nbsp;</td> <td class="paramname"><em>self</em>&nbsp;)</td> <td width="100%"> </td> </tr> </table> </div> <div class="memdoc"><p>The Document object associated with this node. This is also the Document object used to create new nodes. When this node is a Document this is null . </p></div></div><a class="anchor" name="parentNode"></a> <div class="memitem"> <div class="memproto"> <table class="memname"><tr> <td class="memname"><a href="../khtml/DOM.Node.html">DOM.Node</a> parentNode</td> <td>(</td> <td class="paramtype">&nbsp;</td> <td class="paramname"><em>self</em>&nbsp;)</td> <td width="100%"> </td> </tr> </table> </div> <div class="memdoc"><p>The parent of this node. All nodes, except Document , DocumentFragment , and Attr may have a parent. However, if a node has just been created and not yet added to the tree, or if it has been removed from the tree, this is null . </p></div></div><a class="anchor" name="prefix"></a> <div class="memitem"> <div class="memproto"> <table class="memname"><tr> <td class="memname"><a href="../khtml/DOM.DOMString.html">DOM.DOMString</a> prefix</td> <td>(</td> <td class="paramtype">&nbsp;</td> <td class="paramname"><em>self</em>&nbsp;)</td> <td width="100%"> </td> </tr> </table> </div> <div class="memdoc"><p>Introduced in DOM Level 2 </p> <p> The namespace prefix of this node, or null if it is unspecified. Note that setting this attribute, when permitted, changes the nodeName attribute, which holds the qualified name, as well as the tagName and name attributes of the Element and Attr interfaces, when applicable. Note also that changing the prefix of an attribute that is known to have a default value, does not make a new attribute with the default value and the original prefix appear, since the namespaceURI and localName do not change. For nodes of any type other than ELEMENT_NODE and ATTRIBUTE_NODE and nodes created with a DOM Level 1 method, such as createElement from the Document interface, this is always null. </p></div></div><a class="anchor" name="previousSibling"></a> <div class="memitem"> <div class="memproto"> <table class="memname"><tr> <td class="memname"><a href="../khtml/DOM.Node.html">DOM.Node</a> previousSibling</td> <td>(</td> <td class="paramtype">&nbsp;</td> <td class="paramname"><em>self</em>&nbsp;)</td> <td width="100%"> </td> </tr> </table> </div> <div class="memdoc"><p>The node immediately preceding this node. If there is no such node, this returns null . </p></div></div><a class="anchor" name="removeChild"></a> <div class="memitem"> <div class="memproto"> <table class="memname"><tr> <td class="memname"><a href="../khtml/DOM.Node.html">DOM.Node</a> removeChild</td> <td>(</td> <td class="paramtype">&nbsp;<em>self</em>, </td> <td class="paramname"></td> </tr><tr> <td class="memname"></td> <td></td> <td class="paramtype"><a href="../khtml/DOM.Node.html">DOM.Node</a>&nbsp;</td> <td class="paramname"><em>oldChild</em></td> </tr> <tr> <td></td> <td>)</td> <td></td> <td></td> <td width="100%"> </td> </tr></table> </div> <div class="memdoc"><p>Removes the child node indicated by oldChild from the list of children, and returns it. </p> <p> </p><dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td></td><td valign="top"><em>oldChild</em>&nbsp;</td><td> The node being removed. </td></tr> </table></dl> <p> <dl class="return" compact><dt><b>Returns:</b></dt><dd> The node removed. </dd></dl> </p> <p> DOMException NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly. </p> <p> NOT_FOUND_ERR: Raised if oldChild is not a child of this node. </p></div></div><a class="anchor" name="removeEventListener"></a> <div class="memitem"> <div class="memproto"> <table class="memname"><tr> <td class="memname"> removeEventListener</td> <td>(</td> <td class="paramtype">&nbsp;<em>self</em>, </td> <td class="paramname"></td> </tr><tr> <td class="memname"></td> <td></td> <td class="paramtype"><a href="../khtml/DOM.DOMString.html">DOM.DOMString</a>&nbsp;</td> <td class="paramname"><em>type</em>, </td> </tr> <tr> <td class="memname"></td> <td></td> <td class="paramtype"><a href="../khtml/DOM.EventListener.html">DOM.EventListener</a>&nbsp;</td> <td class="paramname"><em>listener</em>, </td> </tr> <tr> <td class="memname"></td> <td></td> <td class="paramtype">bool&nbsp;</td> <td class="paramname"><em>useCapture</em></td> </tr> <tr> <td></td> <td>)</td> <td></td> <td></td> <td width="100%"> </td> </tr></table> </div> <div class="memdoc"><p>Introduced in DOM Level 2 This method is from the EventTarget interface </p> <p> This method allows the removal of event listeners from the event target. If an EventListener is removed from an EventTarget while it is processing an event, it will not be triggered by the current actions. </p> <p> EventListeners can never be invoked after being removed. </p> <p> Calling removeEventListener with arguments which do not identify any currently registered EventListener on the EventTarget has no effect. </p> <p> </p><dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td></td><td valign="top"><em>type</em>&nbsp;</td><td> Specifies the event type of the EventListener being removed. </td></tr> <tr><td></td><td valign="top"><em>listener</em>&nbsp;</td><td> The EventListener parameter indicates the EventListener to be removed. </td></tr> <tr><td></td><td valign="top"><em>useCapture</em>&nbsp;</td><td> Specifies whether the EventListener being removed was registered as a capturing listener or not. If a listener was registered twice, one with capture and one without, each must be removed separately. Removal of a capturing listener does not affect a non-capturing version of the same listener, and vice versa. </td></tr> </table></dl> <p> </p></div></div><a class="anchor" name="replaceChild"></a> <div class="memitem"> <div class="memproto"> <table class="memname"><tr> <td class="memname"><a href="../khtml/DOM.Node.html">DOM.Node</a> replaceChild</td> <td>(</td> <td class="paramtype">&nbsp;<em>self</em>, </td> <td class="paramname"></td> </tr><tr> <td class="memname"></td> <td></td> <td class="paramtype"><a href="../khtml/DOM.Node.html">DOM.Node</a>&nbsp;</td> <td class="paramname"><em>newChild</em>, </td> </tr> <tr> <td class="memname"></td> <td></td> <td class="paramtype"><a href="../khtml/DOM.Node.html">DOM.Node</a>&nbsp;</td> <td class="paramname"><em>oldChild</em></td> </tr> <tr> <td></td> <td>)</td> <td></td> <td></td> <td width="100%"> </td> </tr></table> </div> <div class="memdoc"><p>Replaces the child node oldChild with newChild in the list of children, and returns the oldChild node. If the newChild is already in the tree, it is first removed. </p> <p> </p><dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td></td><td valign="top"><em>newChild</em>&nbsp;</td><td> The new node to put in the child list. </td></tr> <tr><td></td><td valign="top"><em>oldChild</em>&nbsp;</td><td> The node being replaced in the list. </td></tr> </table></dl> <p> <dl class="return" compact><dt><b>Returns:</b></dt><dd> The node replaced. </dd></dl> </p> <p> DOMException HIERARCHY_REQUEST_ERR: Raised if this node is of a type that does not allow children of the type of the newChild node, or it the node to put in is one of this node's ancestors. </p> <p> WRONG_DOCUMENT_ERR: Raised if newChild was created from a different document than the one that created this node. </p> <p> NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly. </p> <p> NOT_FOUND_ERR: Raised if oldChild is not a child of this node. </p></div></div><a class="anchor" name="setNodeValue"></a> <div class="memitem"> <div class="memproto"> <table class="memname"><tr> <td class="memname"> setNodeValue</td> <td>(</td> <td class="paramtype">&nbsp;<em>self</em>, </td> <td class="paramname"></td> </tr><tr> <td class="memname"></td> <td></td> <td class="paramtype"><a href="../khtml/DOM.DOMString.html">DOM.DOMString</a>&nbsp;</td> <td class="paramname"><em>a0</em></td> </tr> <tr> <td></td> <td>)</td> <td></td> <td></td> <td width="100%"> </td> </tr></table> </div> <div class="memdoc"><p>see nodeValue DOMException NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly. </p></div></div><a class="anchor" name="setPrefix"></a> <div class="memitem"> <div class="memproto"> <table class="memname"><tr> <td class="memname"> setPrefix</td> <td>(</td> <td class="paramtype">&nbsp;<em>self</em>, </td> <td class="paramname"></td> </tr><tr> <td class="memname"></td> <td></td> <td class="paramtype"><a href="../khtml/DOM.DOMString.html">DOM.DOMString</a>&nbsp;</td> <td class="paramname"><em>prefix</em></td> </tr> <tr> <td></td> <td>)</td> <td></td> <td></td> <td width="100%"> </td> </tr></table> </div> <div class="memdoc"><p>see prefix </p> <p> DOMException INVALID_CHARACTER_ERR: Raised if the specified prefix contains an illegal character. </p> <p> NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly. </p> <p> NAMESPACE_ERR: Raised if the specified prefix is malformed, if the namespaceURI of this node is null, if the specified prefix is "xml" and the namespaceURI of this node is different from "http://www.w3.org/XML/1998/namespace", if this node is an attribute and the specified prefix is "xmlns" and the namespaceURI of this node is different from "http://www.w3.org/2000/xmlns/", or if this node is an attribute and the qualifiedName of this node is "xmlns" [Namespaces]. </p></div></div><a class="anchor" name="setTextContent"></a> <div class="memitem"> <div class="memproto"> <table class="memname"><tr> <td class="memname"> setTextContent</td> <td>(</td> <td class="paramtype">&nbsp;<em>self</em>, </td> <td class="paramname"></td> </tr><tr> <td class="memname"></td> <td></td> <td class="paramtype"><a href="../khtml/DOM.DOMString.html">DOM.DOMString</a>&nbsp;</td> <td class="paramname"><em>text</em></td> </tr> <tr> <td></td> <td>)</td> <td></td> <td></td> <td width="100%"> </td> </tr></table> </div> <div class="memdoc"><p>see textContent() </p> <p> DOMException NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly. </p></div></div><a class="anchor" name="textContent"></a> <div class="memitem"> <div class="memproto"> <table class="memname"><tr> <td class="memname"><a href="../khtml/DOM.DOMString.html">DOM.DOMString</a> textContent</td> <td>(</td> <td class="paramtype">&nbsp;</td> <td class="paramname"><em>self</em>&nbsp;)</td> <td width="100%"> </td> </tr> </table> </div> <div class="memdoc"><p>Introduced in DOM Level 3 </p> <p> This attribute returns the text content of this node and its descendants. When it is defined to be null, setting it has no effect. On setting, any possible children this node may have are removed and, if it the new string is not empty or null, replaced by a single Text node containing the string this attribute is set to. On getting, no serialization is performed, the returned string does not contain any markup. No whitespace normalization is performed and the returned string does not contain the white spaces in element content (see the attribute Text.isElementContentWhitespace). Similarly, on setting, no parsing is performed either, the input string is taken as pure textual content. </p></div></div><a class="anchor" name="toHTML"></a> <div class="memitem"> <div class="memproto"> <table class="memname"><tr> <td class="memname">QString toHTML</td> <td>(</td> <td class="paramtype">&nbsp;</td> <td class="paramname"><em>self</em>&nbsp;)</td> <td width="100%"> </td> </tr> </table> </div> <div class="memdoc"></div></div><hr><h2>Enumeration Documentation</h2><a class="anchor" name="DocumentPosition"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr><td class="memname">DocumentPosition</td> </tr> </table> </div> <div class="memdoc"><p>Introduced in DOM Level 3. </p> <p> These constants represent bitflags returned by the compareDocumentPosition method. </p> <p> <dl class="since" compact><dt><b>Since:</b></dt><dd> 4.2.4 </dd></dl> </p><dl compact><dt><b>Enumerator: </b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"><tr><td valign="top"><em>DOCUMENT_POSITION_DISCONNECTED</em>&nbsp;=&nbsp;0x01</td><td><tr><td valign="top"><em>DOCUMENT_POSITION_PRECEDING</em>&nbsp;=&nbsp;0x02</td><td><tr><td valign="top"><em>DOCUMENT_POSITION_FOLLOWING</em>&nbsp;=&nbsp;0x04</td><td><tr><td valign="top"><em>DOCUMENT_POSITION_CONTAINS</em>&nbsp;=&nbsp;0x08</td><td><tr><td valign="top"><em>DOCUMENT_POSITION_CONTAINED_BY</em>&nbsp;=&nbsp;0x10</td><td><tr><td valign="top"><em>DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC</em>&nbsp;=&nbsp;0x20</td><td></table> </dl> </div></div><p><a class="anchor" name="NodeType"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr><td class="memname">NodeType</td> </tr> </table> </div> <div class="memdoc"><p>An integer indicating which type of node this is. </p> <p> <p>The values of nodeName, nodeValue, and attributes vary according to the node type as follows: &lt;table border="1"&gt; &lt;tr&gt; &lt;td&gt;&lt;/td&gt; &lt;td&gt;nodeName&lt;/td&gt; &lt;td&gt;nodeValue&lt;/td&gt; &lt;td&gt;attributes&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Element&lt;/td&gt; &lt;td&gt;tagName&lt;/td&gt; &lt;td&gt;null&lt;/td&gt; &lt;td&gt;NamedNodeMap&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Attr&lt;/td&gt; &lt;td&gt;name of attribute&lt;/td&gt; &lt;td&gt;value of attribute&lt;/td&gt; &lt;td&gt;null&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Text&lt;/td&gt; &lt;td&gt;#text&lt;/td&gt; &lt;td&gt;content of the text node&lt;/td&gt; &lt;td&gt;null&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;CDATASection&lt;/td&gt; &lt;td&gt;#cdata-section&lt;/td&gt; &lt;td&gt;content of the CDATA Section&lt;/td&gt; &lt;td&gt;null&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;EntityReference&lt;/td&gt; &lt;td&gt;name of entity referenced&lt;/td&gt; &lt;td&gt;null&lt;/td&gt; &lt;td&gt;null&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Entity&lt;/td&gt; &lt;td&gt;entity name&lt;/td&gt; &lt;td&gt;null&lt;/td&gt; &lt;td&gt;null&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;ProcessingInstruction&lt;/td&gt; &lt;td&gt;target&lt;/td&gt; &lt;td&gt;entire content excluding the target&lt;/td&gt; &lt;td&gt;null&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Comment&lt;/td&gt; &lt;td&gt;#comment&lt;/td&gt; &lt;td&gt;content of the comment&lt;/td&gt; &lt;td&gt;null&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Document&lt;/td&gt; &lt;td&gt;#document&lt;/td&gt; &lt;td&gt;null&lt;/td&gt; &lt;td&gt;null&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;DocumentType&lt;/td&gt; &lt;td&gt;document type name&lt;/td&gt; &lt;td&gt;null&lt;/td&gt; &lt;td&gt;null&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;DocumentFragment&lt;/td&gt; &lt;td&gt;#document-fragment&lt;/td&gt; &lt;td&gt;null&lt;/td&gt; &lt;td&gt;null&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Notation&lt;/td&gt; &lt;td&gt;notation name&lt;/td&gt; &lt;td&gt;null&lt;/td&gt; &lt;td&gt;null&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; </p> </p><dl compact><dt><b>Enumerator: </b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"><tr><td valign="top"><em>ELEMENT_NODE</em>&nbsp;=&nbsp;1</td><td><tr><td valign="top"><em>ATTRIBUTE_NODE</em>&nbsp;=&nbsp;2</td><td><tr><td valign="top"><em>TEXT_NODE</em>&nbsp;=&nbsp;3</td><td><tr><td valign="top"><em>CDATA_SECTION_NODE</em>&nbsp;=&nbsp;4</td><td><tr><td valign="top"><em>ENTITY_REFERENCE_NODE</em>&nbsp;=&nbsp;5</td><td><tr><td valign="top"><em>ENTITY_NODE</em>&nbsp;=&nbsp;6</td><td><tr><td valign="top"><em>PROCESSING_INSTRUCTION_NODE</em>&nbsp;=&nbsp;7</td><td><tr><td valign="top"><em>COMMENT_NODE</em>&nbsp;=&nbsp;8</td><td><tr><td valign="top"><em>DOCUMENT_NODE</em>&nbsp;=&nbsp;9</td><td><tr><td valign="top"><em>DOCUMENT_TYPE_NODE</em>&nbsp;=&nbsp;10</td><td><tr><td valign="top"><em>DOCUMENT_FRAGMENT_NODE</em>&nbsp;=&nbsp;11</td><td><tr><td valign="top"><em>NOTATION_NODE</em>&nbsp;=&nbsp;12</td><td><tr><td valign="top"><em>XPATH_NAMESPACE_NODE</em>&nbsp;=&nbsp;13</td><td></table> </dl> </div></div><p> </div> </div> </div> <div id="left"> <div class="menu_box"> <div class="nav_list"> <ul> <li><a href="../allclasses.html">Full Index</a></li> </ul> </div> <a name="cp-menu" /><div class="menutitle"><div> <h2 id="cp-menu-project">Modules</h2> </div></div> <div class="nav_list"> <ul><li><a href="../akonadi/index.html">akonadi</a></li> <li><a href="../dnssd/index.html">dnssd</a></li> <li><a href="../kdecore/index.html">kdecore</a></li> <li><a href="../kdeui/index.html">kdeui</a></li> <li><a href="../khtml/index.html">khtml</a></li> <li><a href="../kio/index.html">kio</a></li> <li><a href="../knewstuff/index.html">knewstuff</a></li> <li><a href="../kparts/index.html">kparts</a></li> <li><a href="../kutils/index.html">kutils</a></li> <li><a href="../nepomuk/index.html">nepomuk</a></li> <li><a href="../phonon/index.html">phonon</a></li> <li><a href="../plasma/index.html">plasma</a></li> <li><a href="../polkitqt/index.html">polkitqt</a></li> <li><a href="../solid/index.html">solid</a></li> <li><a href="../soprano/index.html">soprano</a></li> </ul></div></div> </div> </div> <div class="clearer"/> </div> <div id="end_body"></div> </div> <div id="footer"><div id="footer_text"> This documentation is maintained by <a href="&#109;&#97;&#105;&#108;&#116;&#111;&#58;simon&#64;simonzone&#46;com">Simon Edwards</a>.<br /> KDE<sup>&#174;</sup> and <a href="../images/kde_gear_black.png">the K Desktop Environment<sup>&#174;</sup> logo</a> are registered trademarks of <a href="http://ev.kde.org/" title="Homepage of the KDE non-profit Organization">KDE e.V.</a> | <a href="http://www.kde.org/contact/impressum.php">Legal</a> </div></div> </body> </html>
KDE/pykde4
docs/html/khtml/DOM.Node.html
HTML
gpl-2.0
56,993
38.089849
961
0.675293
false
<?php /** * H4PH - HTML4 PHP Helper * @link https://github.com/Coft/H4PH */ class Td { /** * contains all setted attributes * @var array */ private $attrs = array(); /** * keeps content * @var string */ private $content = null; /** * holds markup name * @var string */ private static $markupName = 'td'; /** * tells is this markup can handle content * @var bool */ private static $isContenerable = true; /** * __construct() - can add content to tag * @param null|string $content * @return Td */ public function __construct($content = null) { $argumentsNumber = func_num_args(); for ($i = 0; $i < $argumentsNumber; $i++) { $this->addContent(func_get_arg($i)); } } /** * renders tag and it content to string * @param null|string $content * @return Td */ public static function getInstance($content = null) { $markupTag = new Td; $argumentsNumber = func_num_args(); for ($i = 0; $i < $argumentsNumber; $i++) { $markupTag->addContent(func_get_arg($i)); } return $markupTag; } /** * adds content to tag * @param null|string $content * @return Td */ public function addContent($content = null) { $this->content .= (string) $content; return $this; } /** * renders tag and it content to string * @return string */ public function __toString() { $parsedAttrs = ''; foreach ($this->attrs as $attrName => $attrValue) { $parsedAttrs .= ' '.$attrName.'=\''.$attrValue.'\''; } return '<'.self::$markupName.$parsedAttrs.'>'.$this->content.'</'.self::$markupName.'>'; } /** * sets abbr attribute * @param null|string $value * @return Td */ public function abbr($value = null) { $this->attrs['abbr'] = $value; return $this; } /** * sets align attribute * @param null|string $value * @return Td */ public function align($value = null) { $this->attrs['align'] = $value; return $this; } /** * sets axis attribute * @param null|string $value * @return Td */ public function axis($value = null) { $this->attrs['axis'] = $value; return $this; } /** * sets char attribute * @param null|string $value * @return Td */ public function char($value = null) { $this->attrs['char'] = $value; return $this; } /** * sets charoff attribute * @param null|string $value * @return Td */ public function charoff($value = null) { $this->attrs['charoff'] = $value; return $this; } /** * sets colspan attribute * @param null|string $value * @return Td */ public function colspan($value = null) { $this->attrs['colspan'] = $value; return $this; } /** * sets headers attribute * @param null|string $value * @return Td */ public function headers($value = null) { $this->attrs['headers'] = $value; return $this; } /** * sets rowspan attribute * @param null|string $value * @return Td */ public function rowspan($value = null) { $this->attrs['rowspan'] = $value; return $this; } /** * sets scope attribute * @param null|string $value * @return Td */ public function scope($value = null) { $this->attrs['scope'] = $value; return $this; } /** * sets valign attribute * @param null|string $value * @return Td */ public function valign($value = null) { $this->attrs['valign'] = $value; return $this; } /** * sets classes attribute * @param null|string $value * @return Td */ public function classes($value = null) { $this->attrs['class'] = $value; return $this; } /** * sets dir attribute * @param null|string $value * @return Td */ public function dir($value = null) { $this->attrs['dir'] = $value; return $this; } /** * sets id attribute * @param null|string $value * @return Td */ public function id($value = null) { $this->attrs['id'] = $value; return $this; } /** * sets lang attribute * @param null|string $value * @return Td */ public function lang($value = null) { $this->attrs['lang'] = $value; return $this; } /** * sets style attribute * @param null|string $value * @return Td */ public function style($value = null) { $this->attrs['style'] = $value; return $this; } /** * sets title attribute * @param null|string $value * @return Td */ public function title($value = null) { $this->attrs['title'] = $value; return $this; } /** * sets xmlLang attribute * @param null|string $value * @return Td */ public function xmlLang($value = null) { $this->attrs['xml:lang'] = $value; return $this; } /** * sets onclick attribute * @param null|string $value * @return Td */ public function onclick($value = null) { $this->attrs['onclick'] = $value; return $this; } /** * sets ondblclick attribute * @param null|string $value * @return Td */ public function ondblclick($value = null) { $this->attrs['ondblclick'] = $value; return $this; } /** * sets onmousedown attribute * @param null|string $value * @return Td */ public function onmousedown($value = null) { $this->attrs['onmousedown'] = $value; return $this; } /** * sets onmousemove attribute * @param null|string $value * @return Td */ public function onmousemove($value = null) { $this->attrs['onmousemove'] = $value; return $this; } /** * sets onmouseout attribute * @param null|string $value * @return Td */ public function onmouseout($value = null) { $this->attrs['onmouseout'] = $value; return $this; } /** * sets onmouseover attribute * @param null|string $value * @return Td */ public function onmouseover($value = null) { $this->attrs['onmouseover'] = $value; return $this; } /** * sets onmouseup attribute * @param null|string $value * @return Td */ public function onmouseup($value = null) { $this->attrs['onmouseup'] = $value; return $this; } /** * sets onkeydown attribute * @param null|string $value * @return Td */ public function onkeydown($value = null) { $this->attrs['onkeydown'] = $value; return $this; } /** * sets onkeypress attribute * @param null|string $value * @return Td */ public function onkeypress($value = null) { $this->attrs['onkeypress'] = $value; return $this; } /** * sets onkeyup attribute * @param null|string $value * @return Td */ public function onkeyup($value = null) { $this->attrs['onkeyup'] = $value; return $this; } } ?>
Coft/H4PH
classes/Td.php
PHP
gpl-2.0
7,819
19.633245
96
0.495332
false
var SPHERE = { getSphereVertex: function (radius, res) { // Se obtienen los vértices, normales y coordenadas de textura var vertexData = [], alpha, beta, x, y, z, u, v; for (var i = 0; i <= res; i++) { // Se recorren las latitudes alpha = i * Math.PI / res; // Ángulo latitud for (var j = 0; j <= res; j++) { // Se recorren las longitudes beta = j * 2 * Math.PI / res; // Ángulo longitud // Cálculo de x, y, z para vértices y normales x = Math.cos(beta) * Math.sin(alpha); y = Math.cos(alpha); z = Math.sin(beta) * Math.sin(alpha); // Cálculo de u, v para las coordenadas de textura u = 1 - (j / res); v = 1 - (i / res); // Vértices vertexData.push(radius * x); vertexData.push(radius * y); vertexData.push(radius * z); // Normales vertexData.push(x); vertexData.push(y); vertexData.push(z); // Coordenadas de textura vertexData.push(u); vertexData.push(v); } } return vertexData; }, getShereFaces: function (res) { // Se obtienen los índices para crear las caras var indexData = [], first, second; for (var i = 0; i < res; i++) { // Se recorren las latitudes for (var j = 0; j < res; j++) { // Se recorren las longitudes // Cálculo de las esquinas superior e inferior izquierda first = (i * (res + 1)) + j; second = first + res + 1; // Cara par indexData.push(first); // Esquina superior izquierda indexData.push(second); // Esquina inferior izquierda indexData.push(first + 1); // Esquina superior derecha // Cara impar indexData.push(second); // Esquina inferior izquierda indexData.push(second + 1); // Esquina inferior derecha indexData.push(first + 1); // Esquina superior derecha } } return indexData; } };
fblupi/grado_informatica-SG
P2/P2_1/SistemaSolar/js/sphere.js
JavaScript
gpl-2.0
2,248
43.8
108
0.486824
false
/** * */ package org.sylvani.io.voice.http; import java.io.IOException; import java.util.List; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.eclipse.emf.common.util.EList; import org.eclipse.smarthome.model.sitemap.Sitemap; import org.eclipse.smarthome.model.sitemap.SitemapProvider; import org.eclipse.smarthome.model.sitemap.Widget; import org.eclipse.smarthome.ui.items.ItemUIRegistry; /** * Varianten * - Simple and Stupid HAL9000 * - Volltext * - Tagged Analyse * * @author hkuhn * */ public class RecognitionRelayServlet extends HttpServlet { private static final long serialVersionUID = 1L; private ItemUIRegistry itemUIRegistry; private List<SitemapProvider> sitemaps; public RecognitionRelayServlet(ItemUIRegistry itemUIRegistry, List<SitemapProvider> sitemaps) { this.itemUIRegistry = itemUIRegistry; this.sitemaps = sitemaps; } @Override protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { super.doPost(req, resp); } @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { for (SitemapProvider sitemapProvider : sitemaps) { for (String sitemapName : sitemapProvider.getSitemapNames()) { System.out.println("sitemap " + sitemapName); Sitemap sitemap = sitemapProvider.getSitemap(sitemapName); EList<Widget> list = sitemap.getChildren(); for (Widget widget : list) { System.out.println("#Widget " + widget.getLabel() + " " + widget.getItem()); } } } } }
hkuhn42/sylvani
org.sylvani.io/src/main/java/org/sylvani/io/voice/http/RecognitionRelayServlet.java
Java
gpl-2.0
1,853
28.412698
114
0.699946
false
class Class3_Sub28 extends Class3 { static Class94[] aClass94Array2566 = new Class94[200]; static int anInt2567 = -1; private static Class94 aClass94_2568 = Class3_Sub4.buildString("Started 3d Library"); long aLong2569; Class3_Sub28 aClass3_Sub28_2570; static int anInt2571; static int anInt2572; static Class153 aClass153_2573; static int[] anIntArray2574 = new int[14]; static int anInt2575; static Class94 aClass94_2576 = aClass94_2568; static int anInt2577 = 0; Class3_Sub28 aClass3_Sub28_2578; static final void method518(Class140_Sub4_Sub1 var0, int var1) { try { Class3_Sub9 var2 = (Class3_Sub9)Class3_Sub28_Sub7_Sub1.aClass130_4046.method1780(var0.aClass94_3967.method1578(-121), 0); if(var1 >= -85) { method523(40, -17, -52, -32, 9, -51, -85, -84, -19); } if(var2 != null) { var2.method134(1); } else { Class70.method1286(var0.anIntArray2755[0], false, (Class111)null, 0, (Class140_Sub4_Sub2)null, var0.anIntArray2767[0], Class26.anInt501, var0); } } catch (RuntimeException var3) { throw Class44.method1067(var3, "rg.UA(" + (var0 != null?"{...}":"null") + ',' + var1 + ')'); } } static final int method519(int var0, boolean var1, int var2, int var3) { try { var0 &= 3; if(!var1) { method520((byte)-89); } return 0 != var0?(~var0 != -2?(~var0 == -3?-var3 + 7:-var2 + 7):var2):var3; } catch (RuntimeException var5) { throw Class44.method1067(var5, "rg.RA(" + var0 + ',' + var1 + ',' + var2 + ',' + var3 + ')'); } } static final Class3_Sub28_Sub3 method520(byte var0) { try { int var1 = -122 % ((var0 - -48) / 33); return Class3_Sub30.aClass3_Sub28_Sub3_2600; } catch (RuntimeException var2) { throw Class44.method1067(var2, "rg.OA(" + var0 + ')'); } } public static void method521(int var0) { try { aClass153_2573 = null; if(var0 == -3) { aClass94Array2566 = null; aClass94_2568 = null; anIntArray2574 = null; aClass94_2576 = null; } } catch (RuntimeException var2) { throw Class44.method1067(var2, "rg.QA(" + var0 + ')'); } } static final Class90 method522(int var0, int var1) { try { Class90 var2 = (Class90)Class3_Sub28_Sub7_Sub1.aClass93_4043.method1526((long)var0, (byte)121); if(null == var2) { byte[] var3 = Class29.aClass153_557.method2133(Class38_Sub1.method1031(var0, 2), (byte)-122, Canvas_Sub1.method54(var0, false)); var2 = new Class90(); if(var1 != 27112) { anInt2572 = -67; } var2.anInt1284 = var0; if(null != var3) { var2.method1478(new Class3_Sub30(var3), 74); } var2.method1481(98); Class3_Sub28_Sub7_Sub1.aClass93_4043.method1515((byte)-95, var2, (long)var0); return var2; } else { return var2; } } catch (RuntimeException var4) { throw Class44.method1067(var4, "rg.PA(" + var0 + ',' + var1 + ')'); } } static final void method523(int var0, int var1, int var2, int var3, int var4, int var5, int var6, int var7, int var8) { try { int var9 = var3 - var8; int var11 = (-var5 + var0 << 16) / var9; int var10 = -var4 + var6; int var12 = (var7 + -var1 << 16) / var10; Class83.method1410(var1, 0, var6, var4, var3, var5, var8, var12, var11, var2, -12541); } catch (RuntimeException var13) { throw Class44.method1067(var13, "rg.SA(" + var0 + ',' + var1 + ',' + var2 + ',' + var3 + ',' + var4 + ',' + var5 + ',' + var6 + ',' + var7 + ',' + var8 + ')'); } } final void method524(byte var1) { try { if(this.aClass3_Sub28_2570 != null) { this.aClass3_Sub28_2570.aClass3_Sub28_2578 = this.aClass3_Sub28_2578; this.aClass3_Sub28_2578.aClass3_Sub28_2570 = this.aClass3_Sub28_2570; this.aClass3_Sub28_2578 = null; this.aClass3_Sub28_2570 = null; if(var1 != -107) { this.aClass3_Sub28_2578 = (Class3_Sub28)null; } } } catch (RuntimeException var3) { throw Class44.method1067(var3, "rg.TA(" + var1 + ')'); } } }
Lmctruck30/RiotScape-Client
src/Class3_Sub28.java
Java
gpl-2.0
4,615
34.054688
168
0.531961
false
/* Kvalobs - Free Quality Control Software for Meteorological Observations $Id: Data.h,v 1.2.6.2 2007/09/27 09:02:22 paule Exp $ Copyright (C) 2007 met.no Contact information: Norwegian Meteorological Institute Box 43 Blindern 0313 OSLO NORWAY email: kvalobs-dev@met.no This file is part of KVALOBS KVALOBS is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. KVALOBS is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with KVALOBS; if not, write to the Free Software Foundation Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include <boost/assign.hpp> #include "EncodeBufr302053.h" EncodeBufr302053:: EncodeBufr302053() { } std::string EncodeBufr302053:: logIdentifier() const { return "302053"; } std::list<int> EncodeBufr302053:: encodeIds()const { std::list<int> ids; boost::assign::push_back( ids )(302053); return ids; } void EncodeBufr302053:: encode( ) { bufr->addValue( 7032, stationInfo->heightVisability(), "h_V, height of visibility sensor above marine deck.", false ); bufr->addValue( 7033, FLT_MAX, "h_V, height of visibility sensor above water surface.", false ); bufr->addValue( 20001, data->VV, "VV, horisental visibility" ); }
metno/kvbufrd
src/bufr/EncodeBufr302053.cc
C++
gpl-2.0
1,668
23.895522
122
0.727818
false
## PostgreSQL 拒绝服务DDOS攻击与防范 ### 作者 digoal ### 日期 2018-12-02 ### 标签 PostgreSQL , ddos , 拒绝服务 , 锁 , SLOT ---- ## 背景 连接数据库的过程中,需要数据库有足够的SLOT(连接槽,通过max_connections配置),认证。如果把连接槽位占用,或者在认证过程加锁(使得认证过程被锁),则可以制造DDOS攻击。 占用连接槽的攻击与防范方法: [《PostgreSQL 连接攻击(类似DDoS)》](../201706/20170629_02.md) 认证过程加锁的攻击方法,本文会提到。 https://paquier.xyz/postgresql-2/postgres-12-dos-prevention/ https://www.postgresql.org/message-id/152512087100.19803.12733865831237526317@wrigleys.postgresql.org ``` BUG #15182: Canceling authentication due to timeout aka Denial of Service Attack From: PG Bug reporting form <noreply(at)postgresql(dot)org> To: pgsql-bugs(at)lists(dot)postgresql(dot)org Cc: lalbin(at)scharp(dot)org Subject: BUG #15182: Canceling authentication due to timeout aka Denial of Service Attack Date: 2018-04-30 20:41:11 Message-ID: 152512087100.19803.12733865831237526317@wrigleys.postgresql.org Views: Raw Message | Whole Thread | Download mbox Thread: Lists: pgsql-bugs pgsql-hackers The following bug has been logged on the website: Bug reference: 15182 Logged by: Lloyd Albin Email address: lalbin(at)scharp(dot)org PostgreSQL version: 10.3 Operating system: OpenSUSE Description: Over the last several weeks our developers caused a Denial of Service Attack against ourselves by accident. When looking at the log files, I noticed that we had authentication timeouts during these time periods. In researching the problem I found this is due to locks being held on shared system catalog items, aka system catalog items that are shared between all databases on the same cluster/server. This can be caused by beginning a long running transaction that queries pg_stat_activity, pg_roles, pg_database, etc and then another connection that runs either a REINDEX DATABASE, REINDEX SYSTEM, or VACUUM FULL. This issue is of particular importance to database resellers who use the same cluster/server for multiple clients, as two clients can cause this issue to happen inadvertently or a single client can either cause it to happen maliciously or inadvertently. Note: The large cloud providers give each of their clients their own cluster/server so this will not affect across cloud clients but can affect an individual client. The problem is that traditional hosting companies will have all clients from one or more web servers share the same PostgreSQL cluster/server. This means that one or two clients could inadvertently stop all the other clients from being able to connect to their databases until the first client does either a COMMIT or ROLLBACK of their transaction which they could hold open for hours, which is what happened to us internally. In Connection 1 we need to BEGIN a transaction and then query a shared system item; pg_authid, pg_database, etc; or a view that depends on a shared system item; pg_stat_activity, pg_roles, etc. Our developers were accessing pg_roles. Connection 1 (Any database, Any User) BEGIN; SELECT * FROM pg_stat_activity; Connection 2 (Any database will do as long as you are the database owner) REINDEX DATABASE postgres; Connection 3 (Any Database, Any User) psql -h sqltest-alt -d sandbox All future Connection 3's will hang for however long the transaction in Connection 1 runs. In our case this was hours and denied everybody else the ability to log into the server until Connection 1 was committed. psql will just hang for hours, even overnight in my testing, but our apps would get the "Canceling authentication due to timeout" after 1 minute. Connection 2 can also do any of these commands to also cause the same issue: REINDEX SYSTEM postgres; VACUUM FULL pg_authid; vacuumdb -f -h sqltest-alt -d lloyd -U lalbin Even worse is that the VACUUM FULL pg_authid; can be started by an unprivileged user and it will wait for the AccessShareLock by connection 1 to be released before returning the error that you don't have permission to perform this action, so even an unprivileged user can cause this to happen. The privilege check needs to happen before the waiting for the AccessExclusiveLock happens. This bug report has been simplified and shorted drastically. To read the full information about this issue please see my blog post: http://lloyd.thealbins.com/Canceling%20authentication%20due%20to%20timeout Lloyd Albin Database Administrator Statistical Center for HIV/AIDS Research and Prevention (SCHARP) Fred Hutchinson Cancer Research Center ``` 复现方法如上。 ## 防范 1、对于连接占用DDOS攻击的防范(1,设置认证超时参数。2,不要在公网监听。3,设置网络层防火墙。) 2、对于锁攻击(通常是无意识攻击),建议在操作大锁的SQL前,加锁超时,或者语句超时(尽量减少等待时长)。 (lock_timeout, statement_timeout都可以) ## 参考 [《PostgreSQL 锁等待监控 珍藏级SQL - 谁堵塞了谁》](../201705/20170521_01.md) [《PostgreSQL 设置单条SQL的执行超时 - 防雪崩》](../201712/20171211_02.md) [《如何防止数据库雪崩(泛洪 flood)》](../201609/20160909_01.md) https://paquier.xyz/postgresql-2/postgres-12-dos-prevention/ [《PostgreSQL 连接攻击(类似DDoS)》](../201706/20170629_02.md) #### [PostgreSQL 许愿链接](https://github.com/digoal/blog/issues/76 "269ac3d1c492e938c0191101c7238216") 您的愿望将传达给PG kernel hacker、数据库厂商等, 帮助提高数据库产品质量和功能, 说不定下一个PG版本就有您提出的功能点. 针对非常好的提议,奖励限量版PG文化衫、纪念品、贴纸、PG热门书籍等,奖品丰富,快来许愿。[开不开森](https://github.com/digoal/blog/issues/76 "269ac3d1c492e938c0191101c7238216"). #### [9.9元购买3个月阿里云RDS PostgreSQL实例](https://www.aliyun.com/database/postgresqlactivity "57258f76c37864c6e6d23383d05714ea") #### [PostgreSQL 解决方案集合](https://yq.aliyun.com/topic/118 "40cff096e9ed7122c512b35d8561d9c8") #### [德哥 / digoal's github - 公益是一辈子的事.](https://github.com/digoal/blog/blob/master/README.md "22709685feb7cab07d30f30387f0a9ae") ![digoal's wechat](../pic/digoal_weixin.jpg "f7ad92eeba24523fd47a6e1a0e691b59")
digoal/blog
201812/20181202_03.md
Markdown
gpl-2.0
8,041
29.563559
201
0.614585
false
using System; namespace WIC { public enum DXGI_FORMAT { DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_R32G32B32A32_TYPELESS, DXGI_FORMAT_R32G32B32A32_FLOAT, DXGI_FORMAT_R32G32B32A32_UINT, DXGI_FORMAT_R32G32B32A32_SINT, DXGI_FORMAT_R32G32B32_TYPELESS, DXGI_FORMAT_R32G32B32_FLOAT, DXGI_FORMAT_R32G32B32_UINT, DXGI_FORMAT_R32G32B32_SINT, DXGI_FORMAT_R16G16B16A16_TYPELESS, DXGI_FORMAT_R16G16B16A16_FLOAT, DXGI_FORMAT_R16G16B16A16_UNORM, DXGI_FORMAT_R16G16B16A16_UINT, DXGI_FORMAT_R16G16B16A16_SNORM, DXGI_FORMAT_R16G16B16A16_SINT, DXGI_FORMAT_R32G32_TYPELESS, DXGI_FORMAT_R32G32_FLOAT, DXGI_FORMAT_R32G32_UINT, DXGI_FORMAT_R32G32_SINT, DXGI_FORMAT_R32G8X24_TYPELESS, DXGI_FORMAT_D32_FLOAT_S8X24_UINT, DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS, DXGI_FORMAT_X32_TYPELESS_G8X24_UINT, DXGI_FORMAT_R10G10B10A2_TYPELESS, DXGI_FORMAT_R10G10B10A2_UNORM, DXGI_FORMAT_R10G10B10A2_UINT, DXGI_FORMAT_R11G11B10_FLOAT, DXGI_FORMAT_R8G8B8A8_TYPELESS, DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_R8G8B8A8_UNORM_SRGB, DXGI_FORMAT_R8G8B8A8_UINT, DXGI_FORMAT_R8G8B8A8_SNORM, DXGI_FORMAT_R8G8B8A8_SINT, DXGI_FORMAT_R16G16_TYPELESS, DXGI_FORMAT_R16G16_FLOAT, DXGI_FORMAT_R16G16_UNORM, DXGI_FORMAT_R16G16_UINT, DXGI_FORMAT_R16G16_SNORM, DXGI_FORMAT_R16G16_SINT, DXGI_FORMAT_R32_TYPELESS, DXGI_FORMAT_D32_FLOAT, DXGI_FORMAT_R32_FLOAT, DXGI_FORMAT_R32_UINT, DXGI_FORMAT_R32_SINT, DXGI_FORMAT_R24G8_TYPELESS, DXGI_FORMAT_D24_UNORM_S8_UINT, DXGI_FORMAT_R24_UNORM_X8_TYPELESS, DXGI_FORMAT_X24_TYPELESS_G8_UINT, DXGI_FORMAT_R8G8_TYPELESS, DXGI_FORMAT_R8G8_UNORM, DXGI_FORMAT_R8G8_UINT, DXGI_FORMAT_R8G8_SNORM, DXGI_FORMAT_R8G8_SINT, DXGI_FORMAT_R16_TYPELESS, DXGI_FORMAT_R16_FLOAT, DXGI_FORMAT_D16_UNORM, DXGI_FORMAT_R16_UNORM, DXGI_FORMAT_R16_UINT, DXGI_FORMAT_R16_SNORM, DXGI_FORMAT_R16_SINT, DXGI_FORMAT_R8_TYPELESS, DXGI_FORMAT_R8_UNORM, DXGI_FORMAT_R8_UINT, DXGI_FORMAT_R8_SNORM, DXGI_FORMAT_R8_SINT, DXGI_FORMAT_A8_UNORM, DXGI_FORMAT_R1_UNORM, DXGI_FORMAT_R9G9B9E5_SHAREDEXP, DXGI_FORMAT_R8G8_B8G8_UNORM, DXGI_FORMAT_G8R8_G8B8_UNORM, DXGI_FORMAT_BC1_TYPELESS, DXGI_FORMAT_BC1_UNORM, DXGI_FORMAT_BC1_UNORM_SRGB, DXGI_FORMAT_BC2_TYPELESS, DXGI_FORMAT_BC2_UNORM, DXGI_FORMAT_BC2_UNORM_SRGB, DXGI_FORMAT_BC3_TYPELESS, DXGI_FORMAT_BC3_UNORM, DXGI_FORMAT_BC3_UNORM_SRGB, DXGI_FORMAT_BC4_TYPELESS, DXGI_FORMAT_BC4_UNORM, DXGI_FORMAT_BC4_SNORM, DXGI_FORMAT_BC5_TYPELESS, DXGI_FORMAT_BC5_UNORM, DXGI_FORMAT_BC5_SNORM, DXGI_FORMAT_B5G6R5_UNORM, DXGI_FORMAT_B5G5R5A1_UNORM, DXGI_FORMAT_B8G8R8A8_UNORM, DXGI_FORMAT_B8G8R8X8_UNORM, DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM, DXGI_FORMAT_B8G8R8A8_TYPELESS, DXGI_FORMAT_B8G8R8A8_UNORM_SRGB, DXGI_FORMAT_B8G8R8X8_TYPELESS, DXGI_FORMAT_B8G8R8X8_UNORM_SRGB, DXGI_FORMAT_BC6H_TYPELESS, DXGI_FORMAT_BC6H_UF16, DXGI_FORMAT_BC6H_SF16, DXGI_FORMAT_BC7_TYPELESS, DXGI_FORMAT_BC7_UNORM, DXGI_FORMAT_BC7_UNORM_SRGB, DXGI_FORMAT_AYUV, DXGI_FORMAT_Y410, DXGI_FORMAT_Y416, DXGI_FORMAT_NV12, DXGI_FORMAT_P010, DXGI_FORMAT_P016, DXGI_FORMAT_420_OPAQUE, DXGI_FORMAT_YUY2, DXGI_FORMAT_Y210, DXGI_FORMAT_Y216, DXGI_FORMAT_NV11, DXGI_FORMAT_AI44, DXGI_FORMAT_IA44, DXGI_FORMAT_P8, DXGI_FORMAT_A8P8, DXGI_FORMAT_B4G4R4A4_UNORM, DXGI_FORMAT_FORCE_UINT = -1 } }
Rambalac/DummyWIC
Wic/WIC/DXGI_FORMAT.cs
C#
gpl-2.0
3,363
25.904
41
0.746655
false
/*************************************************************************** getfmtast.cpp - returns the AST for formatted IO ------------------- begin : July 22 2002 copyright : (C) 2002 by Marc Schellens email : m_schellens@users.sf.net ***************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ //#define FMT_DEBUG #undef FMT_DEBUG #include "includefirst.hpp" #include "basegdl.hpp" #include "fmtnode.hpp" #include "print_tree.hpp" #include "FMTLexer.hpp" #include "FMTParser.hpp" #include <antlr/ASTFactory.hpp> using namespace std; antlr::ASTFactory FMTNodeFactory("FMTNode",FMTNode::factory); RefFMTNode GetFMTAST( DString fmtString) { istringstream istr(fmtString); //+"\n"); RefFMTNode fmtAST; try { antlr::TokenStreamSelector selector; FMTLexer lexer( istr); lexer.SetSelector( selector); CFMTLexer cLexer( lexer.getInputState()); cLexer.SetSelector( selector); lexer.SetCLexer( cLexer); selector.select( &lexer); FMTParser parser( selector); // because we use the standard (ANTLR generated) constructor here // we cannot do it in the constructor parser.initializeASTFactory( FMTNodeFactory); parser.setASTFactory( &FMTNodeFactory ); parser.format( 1); fmtAST=parser.getAST(); #ifdef FMT_DEBUG antlr::print_tree pt; pt.pr_tree(static_cast<antlr::RefAST>(fmtAST)); cout << endl; #endif } catch( GDLException& ex) { throw GDLException("Format: "+ex.getMessage()); } catch( antlr::ANTLRException& ex) { throw GDLException("Format parser: "+ex.getMessage()); } catch( exception& ex) { throw GDLException("Format exception: "+string(ex.what())); } catch(...) { throw GDLException("Format: general exception."); } return fmtAST; }
cenit/GDL
src/getfmtast.cpp
C++
gpl-2.0
2,564
27.808989
77
0.50819
false
# # \brief Download and unpack upstream library source codes # \author Norman Feske # \date 2009-10-16 # # # Print help information by default # help:: VERBOSE ?= @ ECHO = @echo DOWNLOAD_DIR = download CONTRIB_DIR = contrib GNU_FIND = find SHELL = bash # # Create download and contrib directory so that '<port>.mk' files # do not need to care for them. # prepare:: $(DOWNLOAD_DIR) $(CONTRIB_DIR) # # Utility to check if a tool is installed # check_tool = $(if $(shell which $(1)),,$(error Need to have '$(1)' installed.)) $(call check_tool,wget) $(call check_tool,patch) # # Include information about available ports # # Each '<port>.mk' file in the 'ports/' directory extends the following # variables: # # PORTS - list names of the available ports, e.g., 'freetype-2.3.9' # GEN_DIRS - list of automatically generated directories # GEN_FILES - list of automatically generated files # # Furthermore, each '<port>.mk' file extends the 'prepare' rule for # downloading and unpacking the corresponding upstream sources. # PKG ?= * include $(addprefix ports/,$(addsuffix .mk,$(PKG))) help:: $(ECHO) "" $(ECHO) "Download and unpack upstream source codes:" @for i in $(PORTS); do echo " $$i"; done $(ECHO) "" $(ECHO) "Downloads will be placed into the '$(DOWNLOAD_DIR)/' directory." $(ECHO) "Source codes will be unpacked in the '$(CONTRIB_DIR)/' directory." $(ECHO) "" $(ECHO) "--- available commands ---" $(ECHO) "prepare - download and unpack upstream source codes" $(ECHO) "clean - remove upstream source codes" $(ECHO) "cleanall - remove upstream source codes and downloads" $(ECHO) "" $(ECHO) "--- available arguments ---" $(ECHO) "PKG=<package-list> - prepare only the specified packages," $(ECHO) " each package specified w/o version number" # # Remove download and contrib directories if empty # prepare:: $(VERBOSE)$(GNU_FIND) $(DOWNLOAD_DIR) -depth -type d -empty -delete $(VERBOSE)$(GNU_FIND) $(CONTRIB_DIR) -depth -type d -empty -delete $(DOWNLOAD_DIR) $(CONTRIB_DIR): $(VERBOSE)mkdir -p $@ clean:: $(VERBOSE)rm -rf $(CONTRIB_DIR) cleanall: clean $(VERBOSE)rm -rf $(DOWNLOAD_DIR) .NOTPARALLEL:
m-stein/genode
ports/Makefile
Makefile
gpl-2.0
2,193
25.743902
79
0.666211
false
/* * psgp_settings.h * * Created on: 21 Jan 2012 * Author: barillrl */ #ifndef PSGP_SETTINGS_H_ #define PSGP_SETTINGS_H_ //----------------------------------------------------------------------------- // CONSTANTS AND OTHER GENERAL PARAMETERS //----------------------------------------------------------------------------- // Max number of parameters for PSGP (this limit is set by the R code) #define NUM_PSGP_PARAMETERS 16 // Maximum number of observations kept for param estimation #define MAX_OBS 1000 // Maximum number of active points #define MAX_ACTIVE_POINTS 400 // Likelihood to nugget ratio #define LIKELIHOOD_NUGGET_RATIO 0.01 // Number of sweeps through data with changing/fixed active set #define NUM_SWEEPS_CHANGING 1 #define NUM_SWEEPS_FIXED 1 // Whether to use a GP instead of PSGP for parameter estimation #define PARAMETER_ESTIMATION_USING_GP false // Outer loops in parameter estimation for PSGP #define PSGP_PARAM_ITERATIONS 3 // Inner loop (i.e. SCG iterations in each outer loop) for PSGP #define PSGP_SCG_ITERATIONS 5 // Define whether to use full prediction (all data at once) or // split prediction (by chunks of data) #define USING_CHUNK_PREDICTION true // Size of prediction chunk (in number of observations) #define CHUNK_SIZE 1000 #endif /* PSGP_SETTINGS_H_ */
SeSaMe-NUS/Smiler
src/predictor/GP/gp/psgp_settings.h
C
gpl-2.0
1,315
26.395833
79
0.658555
false
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" type="text/javascript" charset="utf-8"></script> <script src="specimen_files/easytabs.js" type="text/javascript" charset="utf-8"></script> <link rel="stylesheet" href="specimen_files/specimen_stylesheet.css" type="text/css" charset="utf-8" /> <link rel="stylesheet" href="stylesheet.css" type="text/css" charset="utf-8" /> <style type="text/css"> body{ font-family: 'ralewaythin'; } </style> <title>Raleway Thin Specimen</title> <script type="text/javascript" charset="utf-8"> $(document).ready(function() { $('#container').easyTabs({defaultContent:1}); }); </script> </head> <body> <div id="container"> <div id="header"> Raleway Thin </div> <ul class="tabs"> <li><a href="#specimen">Specimen</a></li> <li><a href="#layout">Sample Layout</a></li> <li><a href="#glyphs">Glyphs &amp; Languages</a></li> <li><a href="#installing">Installing Webfonts</a></li> </ul> <div id="main_content"> <div id="specimen"> <div class="section"> <div class="grid12 firstcol"> <div class="huge">AaBb</div> </div> </div> <div class="section"> <div class="glyph_range">A&#x200B;B&#x200b;C&#x200b;D&#x200b;E&#x200b;F&#x200b;G&#x200b;H&#x200b;I&#x200b;J&#x200b;K&#x200b;L&#x200b;M&#x200b;N&#x200b;O&#x200b;P&#x200b;Q&#x200b;R&#x200b;S&#x200b;T&#x200b;U&#x200b;V&#x200b;W&#x200b;X&#x200b;Y&#x200b;Z&#x200b;a&#x200b;b&#x200b;c&#x200b;d&#x200b;e&#x200b;f&#x200b;g&#x200b;h&#x200b;i&#x200b;j&#x200b;k&#x200b;l&#x200b;m&#x200b;n&#x200b;o&#x200b;p&#x200b;q&#x200b;r&#x200b;s&#x200b;t&#x200b;u&#x200b;v&#x200b;w&#x200b;x&#x200b;y&#x200b;z&#x200b;1&#x200b;2&#x200b;3&#x200b;4&#x200b;5&#x200b;6&#x200b;7&#x200b;8&#x200b;9&#x200b;0&#x200b;&amp;&#x200b;.&#x200b;,&#x200b;?&#x200b;!&#x200b;&#64;&#x200b;(&#x200b;)&#x200b;#&#x200b;$&#x200b;%&#x200b;*&#x200b;+&#x200b;-&#x200b;=&#x200b;:&#x200b;;</div> </div> <div class="section"> <div class="grid12 firstcol"> <table class="sample_table"> <tr><td>10</td><td class="size10">abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ</td></tr> <tr><td>11</td><td class="size11">abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ</td></tr> <tr><td>12</td><td class="size12">abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ</td></tr> <tr><td>13</td><td class="size13">abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ</td></tr> <tr><td>14</td><td class="size14">abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ</td></tr> <tr><td>16</td><td class="size16">abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ</td></tr> <tr><td>18</td><td class="size18">abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ</td></tr> <tr><td>20</td><td class="size20">abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ</td></tr> <tr><td>24</td><td class="size24">abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ</td></tr> <tr><td>30</td><td class="size30">abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ</td></tr> <tr><td>36</td><td class="size36">abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ</td></tr> <tr><td>48</td><td class="size48">abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ</td></tr> <tr><td>60</td><td class="size60">abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ</td></tr> <tr><td>72</td><td class="size72">abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ</td></tr> <tr><td>90</td><td class="size90">abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ</td></tr> </table> </div> </div> <div class="section" id="bodycomparison"> <div id="xheight"> <div class="fontbody">&#x25FC;&#x25FC;&#x25FC;&#x25FC;&#x25FC;&#x25FC;&#x25FC;&#x25FC;&#x25FC;&#x25FC;&#x25FC;&#x25FC;&#x25FC;&#x25FC;&#x25FC;&#x25FC;&#x25FC;&#x25FC;&#x25FC;&#x25FC;&#x25FC;&#x25FC;&#x25FC;&#x25FC;&#x25FC;&#x25FC;&#x25FC;&#x25FC;&#x25FC;&#x25FC;&#x25FC;&#x25FC;&#x25FC;&#x25FC;&#x25FC;&#x25FC;&#x25FC;&#x25FC;&#x25FC;&#x25FC;&#x25FC;&#x25FC;&#x25FC;&#x25FC;&#x25FC;&#x25FC;&#x25FC;&#x25FC;&#x25FC;&#x25FC;&#x25FC;&#x25FC;&#x25FC;&#x25FC;&#x25FC;&#x25FC;&#x25FC;&#x25FC;&#x25FC;&#x25FC;&#x25FC;&#x25FC;&#x25FC;&#x25FC;&#x25FC;&#x25FC;&#x25FC;&#x25FC;&#x25FC;&#x25FC;&#x25FC;&#x25FC;&#x25FC;&#x25FC;&#x25FC;&#x25FC;&#x25FC;&#x25FC;&#x25FC;&#x25FC;&#x25FC;&#x25FC;&#x25FC;&#x25FC;&#x25FC;&#x25FC;&#x25FC;&#x25FC;&#x25FC;&#x25FC;&#x25FC;&#x25FC;&#x25FC;&#x25FC;&#x25FC;&#x25FC;&#x25FC;&#x25FC;&#x25FC;body</div><div class="arialbody">body</div><div class="verdanabody">body</div><div class="georgiabody">body</div></div> <div class="fontbody" style="z-index:1"> body<span>Raleway Thin</span> </div> <div class="arialbody" style="z-index:1"> body<span>Arial</span> </div> <div class="verdanabody" style="z-index:1"> body<span>Verdana</span> </div> <div class="georgiabody" style="z-index:1"> body<span>Georgia</span> </div> </div> <div class="section psample psample_row1" id=""> <div class="grid2 firstcol"> <p class="size10"><span>10.</span>Aenean lacinia bibendum nulla sed consectetur. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Nullam id dolor id nibh ultricies vehicula ut id elit. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nulla vitae elit libero, a pharetra augue.</p> </div> <div class="grid3"> <p class="size11"><span>11.</span>Aenean lacinia bibendum nulla sed consectetur. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Nullam id dolor id nibh ultricies vehicula ut id elit. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nulla vitae elit libero, a pharetra augue.</p> </div> <div class="grid3"> <p class="size12"><span>12.</span>Aenean lacinia bibendum nulla sed consectetur. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Nullam id dolor id nibh ultricies vehicula ut id elit. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nulla vitae elit libero, a pharetra augue.</p> </div> <div class="grid4"> <p class="size13"><span>13.</span>Aenean lacinia bibendum nulla sed consectetur. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Nullam id dolor id nibh ultricies vehicula ut id elit. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nulla vitae elit libero, a pharetra augue.</p> </div> <div class="white_blend"></div> </div> <div class="section psample psample_row2" id=""> <div class="grid3 firstcol"> <p class="size14"><span>14.</span>Aenean lacinia bibendum nulla sed consectetur. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Nullam id dolor id nibh ultricies vehicula ut id elit. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nulla vitae elit libero, a pharetra augue.</p> </div> <div class="grid4"> <p class="size16"><span>16.</span>Aenean lacinia bibendum nulla sed consectetur. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Nullam id dolor id nibh ultricies vehicula ut id elit. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nulla vitae elit libero, a pharetra augue.</p> </div> <div class="grid5"> <p class="size18"><span>18.</span>Aenean lacinia bibendum nulla sed consectetur. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Nullam id dolor id nibh ultricies vehicula ut id elit. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nulla vitae elit libero, a pharetra augue.</p> </div> <div class="white_blend"></div> </div> <div class="section psample psample_row3" id=""> <div class="grid5 firstcol"> <p class="size20"><span>20.</span>Aenean lacinia bibendum nulla sed consectetur. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Nullam id dolor id nibh ultricies vehicula ut id elit. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nulla vitae elit libero, a pharetra augue.</p> </div> <div class="grid7"> <p class="size24"><span>24.</span>Aenean lacinia bibendum nulla sed consectetur. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Nullam id dolor id nibh ultricies vehicula ut id elit. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nulla vitae elit libero, a pharetra augue.</p> </div> <div class="white_blend"></div> </div> <div class="section psample psample_row4" id=""> <div class="grid12 firstcol"> <p class="size30"><span>30.</span>Aenean lacinia bibendum nulla sed consectetur. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Nullam id dolor id nibh ultricies vehicula ut id elit. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nulla vitae elit libero, a pharetra augue.</p> </div> <div class="white_blend"></div> </div> <div class="section psample psample_row1 fullreverse"> <div class="grid2 firstcol"> <p class="size10"><span>10.</span>Aenean lacinia bibendum nulla sed consectetur. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Nullam id dolor id nibh ultricies vehicula ut id elit. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nulla vitae elit libero, a pharetra augue.</p> </div> <div class="grid3"> <p class="size11"><span>11.</span>Aenean lacinia bibendum nulla sed consectetur. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Nullam id dolor id nibh ultricies vehicula ut id elit. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nulla vitae elit libero, a pharetra augue.</p> </div> <div class="grid3"> <p class="size12"><span>12.</span>Aenean lacinia bibendum nulla sed consectetur. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Nullam id dolor id nibh ultricies vehicula ut id elit. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nulla vitae elit libero, a pharetra augue.</p> </div> <div class="grid4"> <p class="size13"><span>13.</span>Aenean lacinia bibendum nulla sed consectetur. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Nullam id dolor id nibh ultricies vehicula ut id elit. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nulla vitae elit libero, a pharetra augue.</p> </div> <div class="black_blend"></div> </div> <div class="section psample psample_row2 fullreverse"> <div class="grid3 firstcol"> <p class="size14"><span>14.</span>Aenean lacinia bibendum nulla sed consectetur. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Nullam id dolor id nibh ultricies vehicula ut id elit. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nulla vitae elit libero, a pharetra augue.</p> </div> <div class="grid4"> <p class="size16"><span>16.</span>Aenean lacinia bibendum nulla sed consectetur. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Nullam id dolor id nibh ultricies vehicula ut id elit. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nulla vitae elit libero, a pharetra augue.</p> </div> <div class="grid5"> <p class="size18"><span>18.</span>Aenean lacinia bibendum nulla sed consectetur. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Nullam id dolor id nibh ultricies vehicula ut id elit. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nulla vitae elit libero, a pharetra augue.</p> </div> <div class="black_blend"></div> </div> <div class="section psample fullreverse psample_row3" id=""> <div class="grid5 firstcol"> <p class="size20"><span>20.</span>Aenean lacinia bibendum nulla sed consectetur. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Nullam id dolor id nibh ultricies vehicula ut id elit. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nulla vitae elit libero, a pharetra augue.</p> </div> <div class="grid7"> <p class="size24"><span>24.</span>Aenean lacinia bibendum nulla sed consectetur. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Nullam id dolor id nibh ultricies vehicula ut id elit. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nulla vitae elit libero, a pharetra augue.</p> </div> <div class="black_blend"></div> </div> <div class="section psample fullreverse psample_row4" id="" style="border-bottom: 20px #000 solid;"> <div class="grid12 firstcol"> <p class="size30"><span>30.</span>Aenean lacinia bibendum nulla sed consectetur. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Nullam id dolor id nibh ultricies vehicula ut id elit. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nulla vitae elit libero, a pharetra augue.</p> </div> <div class="black_blend"></div> </div> </div> <div id="layout"> <div class="section"> <div class="grid12 firstcol"> <h1>Lorem Ipsum Dolor</h1> <h2>Etiam porta sem malesuada magna mollis euismod</h2> <p class="byline">By <a href="#link">Aenean Lacinia</a></p> </div> </div> <div class="section"> <div class="grid8 firstcol"> <p class="large">Donec sed odio dui. Morbi leo risus, porta ac consectetur ac, vestibulum at eros. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. </p> <h3>Pellentesque ornare sem</h3> <p>Maecenas sed diam eget risus varius blandit sit amet non magna. Maecenas faucibus mollis interdum. Donec ullamcorper nulla non metus auctor fringilla. Nullam id dolor id nibh ultricies vehicula ut id elit. Nullam id dolor id nibh ultricies vehicula ut id elit. </p> <p>Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. </p> <p>Nulla vitae elit libero, a pharetra augue. Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Aenean lacinia bibendum nulla sed consectetur. </p> <p>Nullam quis risus eget urna mollis ornare vel eu leo. Nullam quis risus eget urna mollis ornare vel eu leo. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec ullamcorper nulla non metus auctor fringilla. </p> <h3>Cras mattis consectetur</h3> <p>Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum. Aenean lacinia bibendum nulla sed consectetur. Integer posuere erat a ante venenatis dapibus posuere velit aliquet. Cras mattis consectetur purus sit amet fermentum. </p> <p>Nullam id dolor id nibh ultricies vehicula ut id elit. Nullam quis risus eget urna mollis ornare vel eu leo. Cras mattis consectetur purus sit amet fermentum.</p> </div> <div class="grid4 sidebar"> <div class="box reverse"> <p class="last">Nullam quis risus eget urna mollis ornare vel eu leo. Donec ullamcorper nulla non metus auctor fringilla. Cras mattis consectetur purus sit amet fermentum. Sed posuere consectetur est at lobortis. Lorem ipsum dolor sit amet, consectetur adipiscing elit. </p> </div> <p class="caption">Maecenas sed diam eget risus varius.</p> <p>Vestibulum id ligula porta felis euismod semper. Integer posuere erat a ante venenatis dapibus posuere velit aliquet. Vestibulum id ligula porta felis euismod semper. Sed posuere consectetur est at lobortis. Maecenas sed diam eget risus varius blandit sit amet non magna. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. </p> <p>Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Aenean lacinia bibendum nulla sed consectetur. Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Aenean lacinia bibendum nulla sed consectetur. Nullam quis risus eget urna mollis ornare vel eu leo. </p> <p>Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Donec ullamcorper nulla non metus auctor fringilla. Maecenas faucibus mollis interdum. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. </p> </div> </div> </div> <div id="glyphs"> <div class="section"> <div class="grid12 firstcol"> <h1>Language Support</h1> <p>The subset of Raleway Thin in this kit supports the following languages:<br /> Albanian, Basque, Breton, Chamorro, Danish, Dutch, English, Faroese, Finnish, French, Frisian, Galician, German, Icelandic, Italian, Malagasy, Norwegian, Portuguese, Spanish, Swedish </p> <h1>Glyph Chart</h1> <p>The subset of Raleway Thin in this kit includes all the glyphs listed below. Unicode entities are included above each glyph to help you insert individual characters into your layout.</p> <div id="glyph_chart"> <div><p>&amp;#13;</p>&#13;</div> <div><p>&amp;#32;</p>&#32;</div> <div><p>&amp;#33;</p>&#33;</div> <div><p>&amp;#34;</p>&#34;</div> <div><p>&amp;#35;</p>&#35;</div> <div><p>&amp;#36;</p>&#36;</div> <div><p>&amp;#37;</p>&#37;</div> <div><p>&amp;#38;</p>&#38;</div> <div><p>&amp;#39;</p>&#39;</div> <div><p>&amp;#40;</p>&#40;</div> <div><p>&amp;#41;</p>&#41;</div> <div><p>&amp;#42;</p>&#42;</div> <div><p>&amp;#43;</p>&#43;</div> <div><p>&amp;#44;</p>&#44;</div> <div><p>&amp;#45;</p>&#45;</div> <div><p>&amp;#46;</p>&#46;</div> <div><p>&amp;#47;</p>&#47;</div> <div><p>&amp;#48;</p>&#48;</div> <div><p>&amp;#49;</p>&#49;</div> <div><p>&amp;#50;</p>&#50;</div> <div><p>&amp;#51;</p>&#51;</div> <div><p>&amp;#52;</p>&#52;</div> <div><p>&amp;#53;</p>&#53;</div> <div><p>&amp;#54;</p>&#54;</div> <div><p>&amp;#55;</p>&#55;</div> <div><p>&amp;#56;</p>&#56;</div> <div><p>&amp;#57;</p>&#57;</div> <div><p>&amp;#58;</p>&#58;</div> <div><p>&amp;#59;</p>&#59;</div> <div><p>&amp;#60;</p>&#60;</div> <div><p>&amp;#61;</p>&#61;</div> <div><p>&amp;#62;</p>&#62;</div> <div><p>&amp;#63;</p>&#63;</div> <div><p>&amp;#64;</p>&#64;</div> <div><p>&amp;#65;</p>&#65;</div> <div><p>&amp;#66;</p>&#66;</div> <div><p>&amp;#67;</p>&#67;</div> <div><p>&amp;#68;</p>&#68;</div> <div><p>&amp;#69;</p>&#69;</div> <div><p>&amp;#70;</p>&#70;</div> <div><p>&amp;#71;</p>&#71;</div> <div><p>&amp;#72;</p>&#72;</div> <div><p>&amp;#73;</p>&#73;</div> <div><p>&amp;#74;</p>&#74;</div> <div><p>&amp;#75;</p>&#75;</div> <div><p>&amp;#76;</p>&#76;</div> <div><p>&amp;#77;</p>&#77;</div> <div><p>&amp;#78;</p>&#78;</div> <div><p>&amp;#79;</p>&#79;</div> <div><p>&amp;#80;</p>&#80;</div> <div><p>&amp;#81;</p>&#81;</div> <div><p>&amp;#82;</p>&#82;</div> <div><p>&amp;#83;</p>&#83;</div> <div><p>&amp;#84;</p>&#84;</div> <div><p>&amp;#85;</p>&#85;</div> <div><p>&amp;#86;</p>&#86;</div> <div><p>&amp;#87;</p>&#87;</div> <div><p>&amp;#88;</p>&#88;</div> <div><p>&amp;#89;</p>&#89;</div> <div><p>&amp;#90;</p>&#90;</div> <div><p>&amp;#91;</p>&#91;</div> <div><p>&amp;#92;</p>&#92;</div> <div><p>&amp;#93;</p>&#93;</div> <div><p>&amp;#94;</p>&#94;</div> <div><p>&amp;#95;</p>&#95;</div> <div><p>&amp;#96;</p>&#96;</div> <div><p>&amp;#97;</p>&#97;</div> <div><p>&amp;#98;</p>&#98;</div> <div><p>&amp;#99;</p>&#99;</div> <div><p>&amp;#100;</p>&#100;</div> <div><p>&amp;#101;</p>&#101;</div> <div><p>&amp;#102;</p>&#102;</div> <div><p>&amp;#103;</p>&#103;</div> <div><p>&amp;#104;</p>&#104;</div> <div><p>&amp;#105;</p>&#105;</div> <div><p>&amp;#106;</p>&#106;</div> <div><p>&amp;#107;</p>&#107;</div> <div><p>&amp;#108;</p>&#108;</div> <div><p>&amp;#109;</p>&#109;</div> <div><p>&amp;#110;</p>&#110;</div> <div><p>&amp;#111;</p>&#111;</div> <div><p>&amp;#112;</p>&#112;</div> <div><p>&amp;#113;</p>&#113;</div> <div><p>&amp;#114;</p>&#114;</div> <div><p>&amp;#115;</p>&#115;</div> <div><p>&amp;#116;</p>&#116;</div> <div><p>&amp;#117;</p>&#117;</div> <div><p>&amp;#118;</p>&#118;</div> <div><p>&amp;#119;</p>&#119;</div> <div><p>&amp;#120;</p>&#120;</div> <div><p>&amp;#121;</p>&#121;</div> <div><p>&amp;#122;</p>&#122;</div> <div><p>&amp;#123;</p>&#123;</div> <div><p>&amp;#124;</p>&#124;</div> <div><p>&amp;#125;</p>&#125;</div> <div><p>&amp;#126;</p>&#126;</div> <div><p>&amp;#160;</p>&#160;</div> <div><p>&amp;#161;</p>&#161;</div> <div><p>&amp;#162;</p>&#162;</div> <div><p>&amp;#163;</p>&#163;</div> <div><p>&amp;#165;</p>&#165;</div> <div><p>&amp;#166;</p>&#166;</div> <div><p>&amp;#167;</p>&#167;</div> <div><p>&amp;#168;</p>&#168;</div> <div><p>&amp;#169;</p>&#169;</div> <div><p>&amp;#170;</p>&#170;</div> <div><p>&amp;#171;</p>&#171;</div> <div><p>&amp;#172;</p>&#172;</div> <div><p>&amp;#173;</p>&#173;</div> <div><p>&amp;#174;</p>&#174;</div> <div><p>&amp;#175;</p>&#175;</div> <div><p>&amp;#176;</p>&#176;</div> <div><p>&amp;#177;</p>&#177;</div> <div><p>&amp;#178;</p>&#178;</div> <div><p>&amp;#179;</p>&#179;</div> <div><p>&amp;#180;</p>&#180;</div> <div><p>&amp;#181;</p>&#181;</div> <div><p>&amp;#182;</p>&#182;</div> <div><p>&amp;#183;</p>&#183;</div> <div><p>&amp;#184;</p>&#184;</div> <div><p>&amp;#185;</p>&#185;</div> <div><p>&amp;#186;</p>&#186;</div> <div><p>&amp;#187;</p>&#187;</div> <div><p>&amp;#188;</p>&#188;</div> <div><p>&amp;#189;</p>&#189;</div> <div><p>&amp;#190;</p>&#190;</div> <div><p>&amp;#191;</p>&#191;</div> <div><p>&amp;#192;</p>&#192;</div> <div><p>&amp;#193;</p>&#193;</div> <div><p>&amp;#194;</p>&#194;</div> <div><p>&amp;#195;</p>&#195;</div> <div><p>&amp;#196;</p>&#196;</div> <div><p>&amp;#197;</p>&#197;</div> <div><p>&amp;#198;</p>&#198;</div> <div><p>&amp;#199;</p>&#199;</div> <div><p>&amp;#200;</p>&#200;</div> <div><p>&amp;#201;</p>&#201;</div> <div><p>&amp;#202;</p>&#202;</div> <div><p>&amp;#203;</p>&#203;</div> <div><p>&amp;#204;</p>&#204;</div> <div><p>&amp;#205;</p>&#205;</div> <div><p>&amp;#206;</p>&#206;</div> <div><p>&amp;#207;</p>&#207;</div> <div><p>&amp;#208;</p>&#208;</div> <div><p>&amp;#209;</p>&#209;</div> <div><p>&amp;#210;</p>&#210;</div> <div><p>&amp;#211;</p>&#211;</div> <div><p>&amp;#212;</p>&#212;</div> <div><p>&amp;#213;</p>&#213;</div> <div><p>&amp;#214;</p>&#214;</div> <div><p>&amp;#215;</p>&#215;</div> <div><p>&amp;#216;</p>&#216;</div> <div><p>&amp;#217;</p>&#217;</div> <div><p>&amp;#218;</p>&#218;</div> <div><p>&amp;#219;</p>&#219;</div> <div><p>&amp;#220;</p>&#220;</div> <div><p>&amp;#221;</p>&#221;</div> <div><p>&amp;#222;</p>&#222;</div> <div><p>&amp;#223;</p>&#223;</div> <div><p>&amp;#224;</p>&#224;</div> <div><p>&amp;#225;</p>&#225;</div> <div><p>&amp;#226;</p>&#226;</div> <div><p>&amp;#227;</p>&#227;</div> <div><p>&amp;#228;</p>&#228;</div> <div><p>&amp;#229;</p>&#229;</div> <div><p>&amp;#230;</p>&#230;</div> <div><p>&amp;#231;</p>&#231;</div> <div><p>&amp;#232;</p>&#232;</div> <div><p>&amp;#233;</p>&#233;</div> <div><p>&amp;#234;</p>&#234;</div> <div><p>&amp;#235;</p>&#235;</div> <div><p>&amp;#236;</p>&#236;</div> <div><p>&amp;#237;</p>&#237;</div> <div><p>&amp;#238;</p>&#238;</div> <div><p>&amp;#239;</p>&#239;</div> <div><p>&amp;#240;</p>&#240;</div> <div><p>&amp;#241;</p>&#241;</div> <div><p>&amp;#242;</p>&#242;</div> <div><p>&amp;#243;</p>&#243;</div> <div><p>&amp;#244;</p>&#244;</div> <div><p>&amp;#245;</p>&#245;</div> <div><p>&amp;#246;</p>&#246;</div> <div><p>&amp;#247;</p>&#247;</div> <div><p>&amp;#248;</p>&#248;</div> <div><p>&amp;#249;</p>&#249;</div> <div><p>&amp;#250;</p>&#250;</div> <div><p>&amp;#251;</p>&#251;</div> <div><p>&amp;#252;</p>&#252;</div> <div><p>&amp;#253;</p>&#253;</div> <div><p>&amp;#254;</p>&#254;</div> <div><p>&amp;#255;</p>&#255;</div> <div><p>&amp;#338;</p>&#338;</div> <div><p>&amp;#339;</p>&#339;</div> <div><p>&amp;#376;</p>&#376;</div> <div><p>&amp;#710;</p>&#710;</div> <div><p>&amp;#732;</p>&#732;</div> <div><p>&amp;#8192;</p>&#8192;</div> <div><p>&amp;#8193;</p>&#8193;</div> <div><p>&amp;#8194;</p>&#8194;</div> <div><p>&amp;#8195;</p>&#8195;</div> <div><p>&amp;#8196;</p>&#8196;</div> <div><p>&amp;#8197;</p>&#8197;</div> <div><p>&amp;#8198;</p>&#8198;</div> <div><p>&amp;#8199;</p>&#8199;</div> <div><p>&amp;#8200;</p>&#8200;</div> <div><p>&amp;#8201;</p>&#8201;</div> <div><p>&amp;#8202;</p>&#8202;</div> <div><p>&amp;#8208;</p>&#8208;</div> <div><p>&amp;#8209;</p>&#8209;</div> <div><p>&amp;#8210;</p>&#8210;</div> <div><p>&amp;#8211;</p>&#8211;</div> <div><p>&amp;#8212;</p>&#8212;</div> <div><p>&amp;#8216;</p>&#8216;</div> <div><p>&amp;#8217;</p>&#8217;</div> <div><p>&amp;#8218;</p>&#8218;</div> <div><p>&amp;#8220;</p>&#8220;</div> <div><p>&amp;#8221;</p>&#8221;</div> <div><p>&amp;#8222;</p>&#8222;</div> <div><p>&amp;#8226;</p>&#8226;</div> <div><p>&amp;#8230;</p>&#8230;</div> <div><p>&amp;#8239;</p>&#8239;</div> <div><p>&amp;#8249;</p>&#8249;</div> <div><p>&amp;#8250;</p>&#8250;</div> <div><p>&amp;#8287;</p>&#8287;</div> <div><p>&amp;#8364;</p>&#8364;</div> <div><p>&amp;#8482;</p>&#8482;</div> <div><p>&amp;#9724;</p>&#9724;</div> <div><p>&amp;#64257;</p>&#64257;</div> <div><p>&amp;#64258;</p>&#64258;</div> <div><p>&amp;#64259;</p>&#64259;</div> <div><p>&amp;#64260;</p>&#64260;</div> </div> </div> </div> </div> <div id="specs"> </div> <div id="installing"> <div class="section"> <div class="grid7 firstcol"> <h1>Installing Webfonts</h1> <p>Webfonts are supported by all major browser platforms but not all in the same way. There are currently four different font formats that must be included in order to target all browsers. This includes TTF, WOFF, EOT and SVG.</p> <h2>1. Upload your webfonts</h2> <p>You must upload your webfont kit to your website. They should be in or near the same directory as your CSS files.</p> <h2>2. Include the webfont stylesheet</h2> <p>A special CSS @font-face declaration helps the various browsers select the appropriate font it needs without causing you a bunch of headaches. Learn more about this syntax by reading the <a href="http://www.fontspring.com/blog/further-hardening-of-the-bulletproof-syntax">Fontspring blog post</a> about it. The code for it is as follows:</p> <code> @font-face{ font-family: 'MyWebFont'; src: url('WebFont.eot'); src: url('WebFont.eot?#iefix') format('embedded-opentype'), url('WebFont.woff') format('woff'), url('WebFont.ttf') format('truetype'), url('WebFont.svg#webfont') format('svg'); } </code> <p>We've already gone ahead and generated the code for you. All you have to do is link to the stylesheet in your HTML, like this:</p> <code>&lt;link rel=&quot;stylesheet&quot; href=&quot;stylesheet.css&quot; type=&quot;text/css&quot; charset=&quot;utf-8&quot; /&gt;</code> <h2>3. Modify your own stylesheet</h2> <p>To take advantage of your new fonts, you must tell your stylesheet to use them. Look at the original @font-face declaration above and find the property called "font-family." The name linked there will be what you use to reference the font. Prepend that webfont name to the font stack in the "font-family" property, inside the selector you want to change. For example:</p> <code>p { font-family: 'WebFont', Arial, sans-serif; }</code> <h2>4. Test</h2> <p>Getting webfonts to work cross-browser <em>can</em> be tricky. Use the information in the sidebar to help you if you find that fonts aren't loading in a particular browser.</p> </div> <div class="grid5 sidebar"> <div class="box"> <h2>Troubleshooting<br />Font-Face Problems</h2> <p>Having trouble getting your webfonts to load in your new website? Here are some tips to sort out what might be the problem.</p> <h3>Fonts not showing in any browser</h3> <p>This sounds like you need to work on the plumbing. You either did not upload the fonts to the correct directory, or you did not link the fonts properly in the CSS. If you've confirmed that all this is correct and you still have a problem, take a look at your .htaccess file and see if requests are getting intercepted.</p> <h3>Fonts not loading in iPhone or iPad</h3> <p>The most common problem here is that you are serving the fonts from an IIS server. IIS refuses to serve files that have unknown MIME types. If that is the case, you must set the MIME type for SVG to "image/svg+xml" in the server settings. Follow these instructions from Microsoft if you need help.</p> <h3>Fonts not loading in Firefox</h3> <p>The primary reason for this failure? You are still using a version Firefox older than 3.5. So upgrade already! If that isn't it, then you are very likely serving fonts from a different domain. Firefox requires that all font assets be served from the same domain. Lastly it is possible that you need to add WOFF to your list of MIME types (if you are serving via IIS.)</p> <h3>Fonts not loading in IE</h3> <p>Are you looking at Internet Explorer on an actual Windows machine or are you cheating by using a service like Adobe BrowserLab? Many of these screenshot services do not render @font-face for IE. Best to test it on a real machine.</p> <h3>Fonts not loading in IE9</h3> <p>IE9, like Firefox, requires that fonts be served from the same domain as the website. Make sure that is the case.</p> </div> </div> </div> </div> </div> <div id="footer"> <p>&copy;2010-2011 Font Squirrel. All rights reserved.</p> </div> </div> </body> </html>
yujihayashi/socialismosustentavel
wp-content/themes/socialismosustentavel/fonts/raleway-thin-demo.html
HTML
gpl-2.0
37,757
60.593801
937
0.57584
false
<?php /** * Created by PhpStorm. * User: Sheila * Date: 12/12/2014 * Time: 6:51 AM */
experimentX/worklor
wp-content/plugins/booklor/testlor.php
PHP
gpl-2.0
91
12
23
0.56044
false
.club_logo { text-align: center; } .club_name { text-align: center; } .club_teams { text-align: center; } .club_address { text-align: center; }
xbegault/clrh-idf
components/com_joomleague/assets/css/clubs.css
CSS
gpl-2.0
150
9.066667
20
0.64
false
#!/usr/bin/env python import math fin = open('figs/single-rod-in-water.dat', 'r') fout = open('figs/single-rods-calculated-density.dat', 'w') kB = 3.16681539628059e-6 # This is Boltzmann's constant in Hartree/Kelvin first = 1 nm = 18.8972613 for line in fin: current = str(line) pieces = current.split('\t') if first: r2 = float(pieces[0])/2*nm E2 = float(pieces[1]) first = 0 else: if ((float(pieces[0])/2*nm - r2) > 0.25): r1 = r2 r2 = float(pieces[0])/2*nm E1 = E2 E2 = float(pieces[1]) # actually it's energy per unit length! length = 1 # arbitrary r = (r1 + r2)/2 dEdR = (E2-E1)/(r2-r1)*length area = 2*math.pi*r*length force = dEdR pressure = force/area kT = kB*298 # about this ncontact = pressure/kT fout.write(str(r)+'\t'+str(ncontact)+'\n') fin.close() fout.close()
droundy/deft
papers/hughes-saft/figs/density_calc.py
Python
gpl-2.0
986
25.648649
73
0.526369
false
/* This is a File System Recognizer for IRIG 106 Ch10 Filesystem Copyright (C) 2014 Arthur Walton. Heavily derived from the File System Recognizer for RomFs Copyright (C) 2001 Bo Brantén. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _ROM_FS_ #define _ROM_FS_ #define SECTOR_SIZE 512 #define CH10_MAGIC "FORTYtwo" #define CH10_MAGIC_OFFSET 512 // // Types used by Linux // #include "ltypes.h" // // Use 1 byte packing of on-disk structures // #include <pshpack1.h> // // The following is a subset of linux/include/linux/ch10fs_fs.h from // version 2.2.14 // /* The basic structures of the ch10fs filesystem */ #define CH10_BLOCK_SIZE 512 #define CH10_MAXFN 48 #define MAX_FILES_PER_DIR 4 #define CH10_MAX_DIR_BLOCKS 64 /* * Ch10 Directory Entry */ struct ch10_dir_entry { __u8 name[56]; // name of the directory entry __u64 blockNum; // block number that the entry starts at __u64 numBlocks; // length of the entry in blocks __u64 size; // length of the entry in bytes __u8 createDate[8]; // date entry was created __u8 createTime[8]; // time entry was created __u8 timeType; // time system the previous date and time were stored in __u8 reserved[7]; // currently unused, reserved for future use __u8 closeTime[8]; // time this entry was finished being written }; /* * Ch10 Directory Block */ struct ch10_dir_block { __u8 magicNumAscii[8]; // Identifies this as being a directory block, always set to FORTYtwo __u8 revNum; // revision number of the data recording standard in use __u8 shutdown; // flag to indicate filesystem was not properly shutdown while writing to this directory __u16 numEntries; // number of directory entries/files that are in this block __u32 bytesPerBlock; // number of bytes per block __u8 volName[32]; // name of this directory block __u64 forwardLink:64; // block address of next directory block __u64 reverseLink:64; // block address of previous directory block struct ch10_dir_entry dirEntries[MAX_FILES_PER_DIR]; // all entries/files in the block }; #include <poppack.h> #endif
ArthurWalton/windows-ch10-fs
ch10fsrec/inc/ch10_fs.h
C
gpl-2.0
2,857
32.22093
114
0.696535
false
dojo.require("dijit.Dialog"); dojo.require("dijit.form.FilteringSelect"); dojo.require('dijit.form.Button'); dojo.require('dijit.TooltipDialog'); dojo.require('dijit.form.DropDownButton'); dojo.require('dijit.form.CheckBox'); dojo.require('dojox.grid.DataGrid'); dojo.require('dojo.data.ItemFileWriteStore'); dojo.require('openils.widget.OrgUnitFilteringSelect'); dojo.require('openils.acq.CurrencyType'); dojo.require('openils.Event'); dojo.require('openils.Util'); dojo.require('openils.User'); dojo.require('openils.CGI'); dojo.require('openils.PermaCrud'); dojo.require('openils.widget.AutoGrid'); dojo.require('openils.widget.ProgressDialog'); dojo.require('fieldmapper.OrgUtils'); dojo.requireLocalization('openils.acq', 'acq'); var localeStrings = dojo.i18n.getLocalization('openils.acq', 'acq'); var contextOrg; var rolloverResponses; var rolloverMode = false; var fundFleshFields = [ 'spent_balance', 'combined_balance', 'spent_total', 'encumbrance_total', 'debit_total', 'allocation_total' ]; var adminPermOrgs = []; var cachedFunds = []; function initPage() { contextOrg = openils.User.user.ws_ou(); /* Reveal controls for rollover without money if org units say ok. * Actual ability to do the operation is controlled in the database, of * course. */ var ouSettings = fieldmapper.aou.fetchOrgSettingBatch( openils.User.user.ws_ou(), ["acq.fund.allow_rollover_without_money"] ); if ( ouSettings["acq.fund.allow_rollover_without_money"] && ouSettings["acq.fund.allow_rollover_without_money"].value ) { dojo.query(".encumb_only").forEach( function(o) { openils.Util.show(o, "table-row"); } ); } var connect = function() { dojo.connect(contextOrgSelector, 'onChange', function() { contextOrg = this.attr('value'); dojo.byId('oils-acq-rollover-ctxt-org').innerHTML = fieldmapper.aou.findOrgUnit(contextOrg).shortname(); rolloverMode = false; gridDataLoader(); } ); }; dojo.connect(refreshButton, 'onClick', function() { rolloverMode = false; gridDataLoader(); }); new openils.User().buildPermOrgSelector( ['ADMIN_ACQ_FUND', 'VIEW_FUND'], contextOrgSelector, contextOrg, connect); dojo.byId('oils-acq-rollover-ctxt-org').innerHTML = fieldmapper.aou.findOrgUnit(contextOrg).shortname(); loadYearSelector(); lfGrid.onItemReceived = function(item) {cachedFunds.push(item)}; new openils.User().getPermOrgList( 'ADMIN_ACQ_FUND', function(list) { adminPermOrgs = list; loadFundGrid( new openils.CGI().param('year') || new Date().getFullYear().toString()); }, true, true ); } function gridDataLoader() { lfGrid.resetStore(); if(rolloverMode) { var offset = lfGrid.displayOffset; for(var i = offset; i < (offset + lfGrid.displayLimit - 1); i++) { var fund = rolloverResponses[i]; if(!fund) break; lfGrid.store.newItem(fieldmapper.acqf.toStoreItem(fund)); } } else { loadFundGrid(); } } function getBalanceInfo(rowIdx, item) { if (!item) return ''; var fundId = this.grid.store.getValue(item, 'id'); var fund = cachedFunds.filter(function(f) { return f.id() == fundId })[0]; var cb = fund.combined_balance(); return cb ? cb.amount() : '0'; } function loadFundGrid(year) { openils.Util.hide('acq-fund-list-rollover-summary'); year = year || fundFilterYearSelect.attr('value'); cachedFunds = []; lfGrid.loadAll( { flesh : 1, flesh_fields : {acqf : fundFleshFields}, // by default, sort funds I can edit to the front order_by : [ { 'class' : 'acqf', field : 'org', compare : {'in' : adminPermOrgs}, direction : 'desc' }, { 'class' : 'acqf', field : 'name' } ] }, { year : year, org : fieldmapper.aou.descendantNodeList(contextOrg, true) } ); } function loadYearSelector() { fieldmapper.standardRequest( ['open-ils.acq', 'open-ils.acq.fund.org.years.retrieve'], { async : true, params : [openils.User.authtoken, {}, {limit_perm : 'VIEW_FUND'}], oncomplete : function(r) { var yearList = openils.Util.readResponse(r); if(!yearList) return; yearList = yearList.map(function(year){return {year:year+''};}); // dojo wants strings var yearStore = {identifier:'year', name:'year', items:yearList}; yearStore.items = yearStore.items.sort().reverse(); fundFilterYearSelect.store = new dojo.data.ItemFileWriteStore({data:yearStore}); // default to this year fundFilterYearSelect.setValue(new Date().getFullYear().toString()); dojo.connect( fundFilterYearSelect, 'onChange', function() { rolloverMode = false; gridDataLoader(); } ); } } ); } function performRollover(args) { rolloverMode = true; progressDialog.show(true, "Processing..."); rolloverResponses = []; var method = 'open-ils.acq.fiscal_rollover'; if(args.rollover[0] == 'on') { method += '.combined'; } else { method += '.propagate'; } var dryRun = args.dry_run[0] == 'on'; if(dryRun) method += '.dry_run'; var encumbOnly = args.encumb_only[0] == 'on'; var count = 0; var amount_rolled = 0; var year = fundFilterYearSelect.attr('value'); // TODO alternate selector? fieldmapper.standardRequest( ['open-ils.acq', method], { async : true, params : [ openils.User.authtoken, year, contextOrg, (args.child_orgs[0] == 'on'), { encumb_only : encumbOnly } ], onresponse : function(r) { var resp = openils.Util.readResponse(r); rolloverResponses.push(resp.fund); count += 1; amount_rolled += Number(resp.rollover_amount); }, oncomplete : function() { var nextYear = Number(year) + 1; rolloverResponses = rolloverResponses.sort( function(a, b) { if(a.code() > b.code()) return 1; return -1; } ) // add the new, rolled funds to the cache. Note that in dry-run // mode, these are ephemeral and no longer exist on the server. cachedFunds = cachedFunds.concat(rolloverResponses); dojo.byId('acq-fund-list-rollover-summary-header').innerHTML = dojo.string.substitute( localeStrings.FUND_LIST_ROLLOVER_SUMMARY, [nextYear] ); dojo.byId('acq-fund-list-rollover-summary-funds').innerHTML = dojo.string.substitute( localeStrings.FUND_LIST_ROLLOVER_SUMMARY_FUNDS, [nextYear, count] ); dojo.byId('acq-fund-list-rollover-summary-rollover-amount').innerHTML = dojo.string.substitute( localeStrings.FUND_LIST_ROLLOVER_SUMMARY_ROLLOVER_AMOUNT, [nextYear, amount_rolled] ); if(!dryRun) { openils.Util.hide('acq-fund-list-rollover-summary-dry-run'); // add the new year to the year selector if it's not already there fundFilterYearSelect.store.fetch({ query : {year : nextYear}, onComplete: function(list) { if(list && list.length > 0) return; fundFilterYearSelect.store.newItem({year : nextYear}); } }); } openils.Util.show('acq-fund-list-rollover-summary'); progressDialog.hide(); gridDataLoader(); } } ); } openils.Util.addOnLoad(initPage);
ubcic/evergreen
Open-ILS/web/js/ui/default/acq/financial/list_funds.js
JavaScript
gpl-2.0
8,907
31.746324
102
0.528124
false
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Sims")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Sims")] [assembly: AssemblyCopyright("Copyright © 2015")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("69611fa1-6403-4862-abd4-bd4e91c43d06")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
efaruk/playground
sims/Sims/Properties/AssemblyInfo.cs
C#
gpl-2.0
1,420
37.361111
84
0.723359
false
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!--NewPage--> <HTML> <HEAD> <TITLE> Uses of Interface com.google.gwt.core.ext.soyc.HasDependencies (Google Web Toolkit Javadoc) </TITLE> <LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../../../stylesheet.css" TITLE="Style"> <SCRIPT type="text/javascript"> function windowTitle() { if (location.href.indexOf('is-external=true') == -1) { parent.document.title="Uses of Interface com.google.gwt.core.ext.soyc.HasDependencies (Google Web Toolkit Javadoc)"; } } </SCRIPT> <NOSCRIPT> </NOSCRIPT> </HEAD> <BODY BGCOLOR="white" onload="windowTitle();"> <HR> <!-- ========= START OF TOP NAVBAR ======= --> <A NAME="navbar_top"><!-- --></A> <A HREF="#skip-navbar_top" title="Skip navigation links"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_top_firstrow"><!-- --></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../com/google/gwt/core/ext/soyc/HasDependencies.html" title="interface in com.google.gwt.core.ext.soyc"><FONT CLASS="NavBarFont1"><B>Class</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> GWT 2.6.0</EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> &nbsp;PREV&nbsp; &nbsp;NEXT</FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../../../../index.html?com/google/gwt/core/ext/soyc//class-useHasDependencies.html" target="_top"><B>FRAMES</B></A> &nbsp; &nbsp;<A HREF="HasDependencies.html" target="_top"><B>NO FRAMES</B></A> &nbsp; &nbsp;<SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../../../../../../../allclasses-noframe.html"><B>All Classes</B></A>'); } //--> </SCRIPT> <NOSCRIPT> <A HREF="../../../../../../../allclasses-noframe.html"><B>All Classes</B></A> </NOSCRIPT> </FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_top"></A> <!-- ========= END OF TOP NAVBAR ========= --> <HR> <CENTER> <H2> <B>Uses of Interface<br>com.google.gwt.core.ext.soyc.HasDependencies</B></H2> </CENTER> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> Packages that use <A HREF="../../../../../../../com/google/gwt/core/ext/soyc/HasDependencies.html" title="interface in com.google.gwt.core.ext.soyc">HasDependencies</A></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><A HREF="#com.google.gwt.core.ext.soyc"><B>com.google.gwt.core.ext.soyc</B></A></TD> <TD>This package contains interfaces that provide access to "Story of Your Compile" information.&nbsp;</TD> </TR> </TABLE> &nbsp; <P> <A NAME="com.google.gwt.core.ext.soyc"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> Uses of <A HREF="../../../../../../../com/google/gwt/core/ext/soyc/HasDependencies.html" title="interface in com.google.gwt.core.ext.soyc">HasDependencies</A> in <A HREF="../../../../../../../com/google/gwt/core/ext/soyc/package-summary.html">com.google.gwt.core.ext.soyc</A></FONT></TH> </TR> </TABLE> &nbsp; <P> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableSubHeadingColor"> <TH ALIGN="left" COLSPAN="2">Subinterfaces of <A HREF="../../../../../../../com/google/gwt/core/ext/soyc/HasDependencies.html" title="interface in com.google.gwt.core.ext.soyc">HasDependencies</A> in <A HREF="../../../../../../../com/google/gwt/core/ext/soyc/package-summary.html">com.google.gwt.core.ext.soyc</A></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;interface</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../../../com/google/gwt/core/ext/soyc/ClassMember.html" title="interface in com.google.gwt.core.ext.soyc">ClassMember</A></B></CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Represents a reference type, such as a class or interface, in the compiled output.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;interface</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../../../com/google/gwt/core/ext/soyc/MethodMember.html" title="interface in com.google.gwt.core.ext.soyc">MethodMember</A></B></CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Represents compiled JS code derived from a Java method.</TD> </TR> </TABLE> &nbsp; <P> <HR> <!-- ======= START OF BOTTOM NAVBAR ====== --> <A NAME="navbar_bottom"><!-- --></A> <A HREF="#skip-navbar_bottom" title="Skip navigation links"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_bottom_firstrow"><!-- --></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../com/google/gwt/core/ext/soyc/HasDependencies.html" title="interface in com.google.gwt.core.ext.soyc"><FONT CLASS="NavBarFont1"><B>Class</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> GWT 2.6.0</EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> &nbsp;PREV&nbsp; &nbsp;NEXT</FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../../../../index.html?com/google/gwt/core/ext/soyc//class-useHasDependencies.html" target="_top"><B>FRAMES</B></A> &nbsp; &nbsp;<A HREF="HasDependencies.html" target="_top"><B>NO FRAMES</B></A> &nbsp; &nbsp;<SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../../../../../../../allclasses-noframe.html"><B>All Classes</B></A>'); } //--> </SCRIPT> <NOSCRIPT> <A HREF="../../../../../../../allclasses-noframe.html"><B>All Classes</B></A> </NOSCRIPT> </FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_bottom"></A> <!-- ======== END OF BOTTOM NAVBAR ======= --> <HR> </BODY> </HTML>
JakaCikac/dScrum
web/WEB-INF/classes/gwt-2.6.0/doc/javadoc/com/google/gwt/core/ext/soyc/class-use/HasDependencies.html
HTML
gpl-2.0
8,539
44.420213
325
0.622438
false
<!DOCTYPE html> <!-- Website template by freewebsitetemplates.com --> <html> <head> <meta charset="UTF-8"> <title>Blog - Astronomy Website Template</title> <link rel="stylesheet" href="css/style.css" type="text/css"> </head> <body> <div id="header"> <div class="wrapper clearfix"> <div id="logo"> <a href="index.html"><img src="images/logo.png" alt="LOGO"></a> </div> <ul id="navigation"> <li> <a href="index.html">Home</a> </li> <li> <a href="about.html">About</a> </li> <li class="selected"> <a href="blog.html">Blog</a> </li> <li> <a href="gallery.html">Gallery</a> </li> <li> <a href="contact.html">Contact Us</a> </li> </ul> </div> </div> <div id="contents"> <div class="wrapper clearfix"> <div id="sidebar"> <ul> <li> <a href="blog.html"><img src="images/earth-small.jpg" alt="Img" height="154" width="213"></a> </li> <li> <a href="blog.html"><img src="images/spaceshuttle-closeup.jpg" alt="Img" height="154" width="213"></a> </li> </ul> <div class="click-here"> <h1>Lorem Ipsum Dolor!</h1> <a href="index.html" class="btn1">Click Here!</a> </div> </div> <div class="main"> <h1>Blog</h1> <ul class="list"> <li> <span class="time">01-01-2012</span> <h4>Blog Title One</h4> <p> This website template has been designed by <a href="http://www.freewebsitetemplates.com/">Free Website Templates</a> for you, for free. You can replace all this text with your own text.This website template has been designed by <a href="http://www.freewebsitetemplates.com/">Free Website Templates</a> for you, for free. You can replace all this text with your own text. </p> <a href="blog.html" class="more">Read more&gt;&gt;</a> </li> <li> <span class="time">01-01-2012</span> <h4>Blog Title One</h4> <p> This website template has been designed by <a href="http://www.freewebsitetemplates.com/">Free Website Templates</a> for you, for free. You can replace all this text with your own text.This website template has been designed by <a href="http://www.freewebsitetemplates.com/">Free Website Templates</a> for you, for free. You can replace all this text with your own text. </p> <a href="blog.html" class="more">Read more&gt;&gt;</a> </li> <li> <span class="time">01-01-2012</span> <h4>Blog Title One</h4> <p> This website template has been designed by <a href="http://www.freewebsitetemplates.com/">Free Website Templates</a> for you, for free. You can replace all this text with your own text.This website template has been designed by <a href="http://www.freewebsitetemplates.com/">Free Website Templates</a> for you, for free. You can replace all this text with your own text. </p> <a href="blog.html" class="more">Read more&gt;&gt;</a> </li> </ul> <ul class="pagination"> <li> <a href="blog.html">&lt;&lt;</a> </li> <li> <a href="blog.html">First</a> </li> <li class="selected"> <a href="blog.html">1</a> </li> <li> <a href="blog.html">2</a> </li> <li> <a href="blog.html">3</a> </li> <li> <a href="blog.html">4</a> </li> <li> <a href="blog.html">5</a> </li> <li> <a href="blog.html">6</a> </li> <li> <a href="blog.html">7</a> </li> <li> <a href="blog.html">8</a> </li> <li> <a href="blog.html">9</a> </li> <li> <a href="blog.html">10</a> </li> <li> <a href="blog.html">11</a> </li> <li> <a href="blog.html">12</a> </li> <li> <a href="blog.html">13</a> </li> <li> <a href="blog.html">14</a> </li> <li> <a href="blog.html">15</a> </li> <li> <a href="blog.html">16</a> </li> <li> <a href="blog.html">17</a> </li> <li> <a href="blog.html">18</a> </li> <li> <a href="blog.html">19</a> </li> <li> <a href="blog.html">20</a> </li> <li> <a href="blog.html">Last</a> </li> <li> <a href="blog.html">&gt;&gt;</a> </li> </ul> <!-- /.pagination --> </div> </div> </div> <div id="footer"> <ul id="featured" class="wrapper clearfix"> <li> <img src="images/astronaut.jpg" alt="Img" height="204" width="220"> <h3><a href="blog.html">Category 1</a></h3> <p> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque nec mi tortor. Phasellus commodo semper vehicula. </p> </li> <li> <img src="images/earth.jpg" alt="Img" height="204" width="220"> <h3><a href="blog.html">Category 2</a></h3> <p> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque nec mi tortor. Phasellus commodo semper vehicula. </p> </li> <li> <img src="images/spacecraft-small.jpg" alt="Img" height="204" width="220"> <h3><a href="blog.html">Category 3</a></h3> <p> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque nec mi tortor. Phasellus commodo semper vehicula. </p> </li> <li> <img src="images/space-shuttle.jpg" alt="Img" height="204" width="220"> <h3><a href="blog.html">Category 4</a></h3> <p> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque nec mi tortor. Phasellus commodo semper vehicula. </p> </li> </ul> <div class="body"> <div class="wrapper clearfix"> <div id="links"> <div> <h4>Social</h4> <ul> <li> <a href="http://freewebsitetemplates.com/go/googleplus/" target="_blank">Google +</a> </li> <li> <a href="http://freewebsitetemplates.com/go/facebook/" target="_blank">Facebook</a> </li> <li> <a href="http://freewebsitetemplates.com/go/youtube/" target="_blank">Youtube</a> </li> </ul> </div> <div> <h4>Heading placeholder</h4> <ul> <li> <a href="index.html">Link Title 1</a> </li> <li> <a href="index.html">Link Title 2</a> </li> <li> <a href="index.html">Link Title 3</a> </li> </ul> </div> </div> <div id="newsletter"> <h4>Newsletter</h4> <p> Sign up for Our Newsletter </p> <form action="index.html" method="post"> <input type="text" value=""> <input type="submit" value="Sign Up!"> </form> </div> <p class="footnote"> © Copyright © 2023.Company name all rights reserved </p> </div> </div> </div> </body> </html>
emgrob1/georginagrobquincenera.com
public/astronomywebsitetemplate/blog.html
HTML
gpl-2.0
6,776
26.995868
187
0.545173
false